Skip to content

Commit 93822bc

Browse files
committed
Model loading and rendering
1 parent 1b5c386 commit 93822bc

14 files changed

Lines changed: 122 additions & 10 deletions

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "libs/stb"]
55
path = libs/stb
66
url = https://github.com/nothings/stb.git
7+
[submodule "libs/cgltf"]
8+
path = libs/cgltf
9+
url = https://github.com/jkuhlmann/cgltf.git

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD 11)
77

88
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
99

10-
set(SOURCE_FILES src/main.cpp src/simple_logger.cpp src/vulkan_base/vulkan_device.cpp src/vulkan_base/vulkan_swapchain.cpp src/vulkan_base/vulkan_renderpass.cpp src/vulkan_base/vulkan_pipeline.cpp src/vulkan_base/vulkan_utils.cpp)
10+
set(SOURCE_FILES src/main.cpp src/simple_logger.cpp src/model.cpp src/vulkan_base/vulkan_device.cpp src/vulkan_base/vulkan_swapchain.cpp src/vulkan_base/vulkan_renderpass.cpp src/vulkan_base/vulkan_pipeline.cpp src/vulkan_base/vulkan_utils.cpp)
1111

1212
# Find SDL2
1313
add_subdirectory(libs/SDL)

data/models/monkey.glb

68 KB
Binary file not shown.

libs/cgltf

Submodule cgltf added at cd37936

shaders/compile.bat

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ glslc.exe -fshader-stage=frag triangle_frag.glsl -o triangle_frag.spv
33
glslc.exe -fshader-stage=vert color_vert.glsl -o color_vert.spv
44
glslc.exe -fshader-stage=frag color_frag.glsl -o color_frag.spv
55
glslc.exe -fshader-stage=vert texture_vert.glsl -o texture_vert.spv
6-
glslc.exe -fshader-stage=frag texture_frag.glsl -o texture_frag.spv
6+
glslc.exe -fshader-stage=frag texture_frag.glsl -o texture_frag.spv
7+
glslc.exe -fshader-stage=vert model_vert.glsl -o model_vert.spv
8+
glslc.exe -fshader-stage=frag model_frag.glsl -o model_frag.spv

shaders/compile.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ glslc -fshader-stage=frag triangle_frag.glsl -o triangle_frag.spv
44
glslc -fshader-stage=vert color_vert.glsl -o color_vert.spv
55
glslc -fshader-stage=frag color_frag.glsl -o color_frag.spv
66
glslc -fshader-stage=vert texture_vert.glsl -o texture_vert.spv
7-
glslc -fshader-stage=frag texture_frag.glsl -o texture_frag.spv
7+
glslc -fshader-stage=frag texture_frag.glsl -o texture_frag.spv
8+
glslc -fshader-stage=vert model_vert.glsl -o model_vert.spv
9+
glslc -fshader-stage=frag model_frag.glsl -o model_frag.spv

shaders/model_frag.glsl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#version 450 core
2+
3+
layout(location = 0) out vec4 out_color;
4+
5+
void main() {
6+
out_color = vec4(1.0);
7+
}

shaders/model_frag.spv

408 Bytes
Binary file not shown.

shaders/model_vert.glsl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#version 450 core
2+
3+
layout(location = 0) in vec3 in_position;
4+
5+
void main() {
6+
gl_Position = vec4(in_position.x, -in_position.y, in_position.z, 1.0);
7+
}

shaders/model_vert.spv

996 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)