Skip to content

Commit

Permalink
add GLM dependency and compilation works
Browse files Browse the repository at this point in the history
  • Loading branch information
leanid committed Jan 18, 2025
1 parent fe3d498 commit 5b9ec90
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
5 changes: 3 additions & 2 deletions 02-vulkan/09-vk-res-loading-1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ find_package(
#[OPTIONAL_COMPONENTS <libs>...]
# Optional Boost libraries by their canonical name)
) # e.g. "date_time" for "libboost_date_time"
find_package(glm REQUIRED)
find_program(SLANGC slangc REQUIRED)

om_clang_tidy_enable()
Expand All @@ -33,15 +34,15 @@ target_compile_features(09-vk-res-loading-1 PRIVATE cxx_std_26)
target_include_directories(
09-vk-res-loading-1
PRIVATE
$<$<PLATFORM_ID:Windows,Darwin,Linux>:${CMAKE_SOURCE_DIR}/support/cxx_lib/>
${CMAKE_SOURCE_DIR}/support/cxx_lib/)
target_link_libraries(
09-vk-res-loading-1
PRIVATE om::io::read_file
Vulkan::Headers
Vulkan::Vulkan
SDL3::SDL3-shared
Boost::program_options)
Boost::program_options
glm::glm)

# cmake-format: off
target_link_libraries(
Expand Down
6 changes: 1 addition & 5 deletions 02-vulkan/09-vk-res-loading-1/shaders/shader.frag
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#version 450 // OpenGL 4.5

// from vertex shader
layout(location = 0) in vec3 frag_color;
// output color for framebuffer(blending)
layout(location = 0) out vec4 out_color;

void main()
{
// we need to add alpha value to result color
out_color = vec4(frag_color, 1.0);
out_color = vec4(1.0, 0.0, 0.0, 1.0);
}
19 changes: 2 additions & 17 deletions 02-vulkan/09-vk-res-loading-1/shaders/shader.vert
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
#version 450 // OpenGL 4.5

// location = 0 means - color attachment buffer 0
layout(location = 0) out vec3 frag_color; // output color for vertex

// triangle vertex positions directly in shader code
// @note use () not {} in GLSL for inplace vector
vec3 positions[3] = vec3[](
vec3(0.0, -0.4, 0.0),
vec3(0.4, 0.4, 0.0),
vec3(-0.4, 0.4, 0.0));

// triangle vertex colors directly in shader code
vec3 colors[3] = vec3[](
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 0.0, 1.0));
layout(location = 0) in vec3 pos;

void main()
{
gl_Position = vec4(positions[gl_VertexIndex], 1.0);
frag_color = colors[gl_VertexIndex];
gl_Position = vec4(pos, 1.0);
}

0 comments on commit 5b9ec90

Please sign in to comment.