-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Tutorial changes Vulkan.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
/build | ||
/build | ||
/cmake-build-debug** | ||
/include | ||
CMakeUserPresets.json | ||
**/*.spv |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
cmake_minimum_required(VERSION 3.26) | ||
project(TEngine) | ||
|
||
set(CMAKE_TOOLCHAIN_FILE include/conan_toolchain.cmake) | ||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
set(CMAKE_CXX_STANDARD 23) | ||
|
||
set(SHADERS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/shaders) | ||
|
||
file(GLOB_RECURSE SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp) | ||
file(GLOB SHADER_FILES ${SHADERS_DIR}/*.frag ${SHADERS_DIR}/*.vert) | ||
|
||
find_package(GLFW3 REQUIRED) | ||
find_package(GLM REQUIRED) | ||
find_package(Vulkan REQUIRED) | ||
find_package(tinyobjloader REQUIRED) | ||
|
||
find_package(Vulkan COMPONENTS glslc) | ||
find_program(glslc_executable NAMES glslc HINTS Vulkan::glslc) | ||
|
||
function(compile_shader target) | ||
cmake_parse_arguments(PARSE_ARGV 1 arg "" "ENV;FORMAT" "SOURCES") | ||
foreach(source ${arg_SOURCES}) | ||
add_custom_command( | ||
TARGET ${PROJECT_NAME} | ||
COMMAND | ||
${glslc_executable} | ||
${source} | ||
-o ${source}.${arg_FORMAT} | ||
) | ||
target_sources(${target} PRIVATE ${source}.${arg_FORMAT}) | ||
endforeach() | ||
endfunction() | ||
|
||
message("Building with CMake version: ${CMAKE_VERSION}") | ||
|
||
add_executable(${PROJECT_NAME} ${SOURCES}) | ||
|
||
compile_shader(${PROJECT_NAME} | ||
FORMAT spv | ||
SOURCES | ||
${SHADER_FILES} | ||
) | ||
|
||
target_link_libraries(${PROJECT_NAME} glfw glm::glm Vulkan::Vulkan tinyobjloader::tinyobjloader) | ||
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/src ${glfw3_INCLUDE_DIRS} ${glm_INCLUDE_DIRS} ${tinyobjloader_INCLUDE_DIRS}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
# TEngine | ||
# TEngine | ||
|
||
```bash | ||
conan install . --output-folder=include --build=missing | ||
cmake ./cmake-build-debug -DCMAKE_TOOLCHAIN_FILE=include/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release | ||
``` | ||
|
||
`cmake --preset conan-release` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
shader=(`find . -type f -name \*.vert -o -name \*.frag`) | ||
index=0 | ||
|
||
for i in "${shader[@]}"; do | ||
echo "Compiling $i.spv" | ||
glslc "$i" -o "$i.spv" | ||
index=$((index+1)) | ||
done |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[requires] | ||
glfw/3.3.8 | ||
glm/cci.20230113 | ||
tinyobjloader/2.0.0-rc10 | ||
|
||
[tool_requires] | ||
cmake/3.27.7 | ||
|
||
[imports] | ||
include, *.h -> ./include | ||
include, *.hpp -> ./include | ||
|
||
[generators] | ||
CMakeDeps | ||
CMakeToolchain |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Blender v2.90.1 OBJ File: '' | ||
# www.blender.org | ||
mtllib untitled.mtl | ||
o Cube | ||
v 1.000000 -1.000000 1.000000 1.0 0.0 0.0 | ||
v 1.000000 1.000000 1.000000 0.0 0.0 1.0 | ||
v 1.000000 -1.000000 -1.000000 0.0 1.0 0.0 | ||
v 1.000000 1.000000 -1.000000 1.0 0.5 0.0 | ||
v -1.000000 -1.000000 1.000000 1.0 0.0 0.0 | ||
v -1.000000 1.000000 1.000000 1.0 0.0 1.0 | ||
v -1.000000 -1.000000 -1.000000 0.0 1.0 0.0 | ||
v -1.000000 1.000000 -1.000000 1.0 0.5 0.0 | ||
vt 0.875000 0.500000 | ||
vt 0.625000 0.750000 | ||
vt 0.625000 0.500000 | ||
vt 0.375000 1.000000 | ||
vt 0.375000 0.750000 | ||
vt 0.625000 0.000000 | ||
vt 0.375000 0.250000 | ||
vt 0.375000 0.000000 | ||
vt 0.375000 0.500000 | ||
vt 0.125000 0.750000 | ||
vt 0.125000 0.500000 | ||
vt 0.625000 0.250000 | ||
vt 0.875000 0.750000 | ||
vt 0.625000 1.000000 | ||
vn 0.0000 -1.0000 0.0000 | ||
vn 0.0000 0.0000 -1.0000 | ||
vn -1.0000 0.0000 0.0000 | ||
vn 0.0000 1.0000 0.0000 | ||
vn 1.0000 0.0000 0.0000 | ||
vn 0.0000 0.0000 1.0000 | ||
usemtl Material | ||
s off | ||
f 5/1/1 3/2/1 1/3/1 | ||
f 3/2/2 8/4/2 4/5/2 | ||
f 7/6/3 6/7/3 8/8/3 | ||
f 2/9/4 8/10/4 6/11/4 | ||
f 1/3/5 4/5/5 2/9/5 | ||
f 5/12/6 2/9/6 6/7/6 | ||
f 5/1/1 7/13/1 3/2/1 | ||
f 3/2/2 7/14/2 8/4/2 | ||
f 7/6/3 5/12/3 6/7/3 | ||
f 2/9/4 4/5/4 8/10/4 | ||
f 1/3/5 3/2/5 4/5/5 | ||
f 5/12/6 1/3/6 2/9/6 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Blender v2.90.1 OBJ File: '' | ||
# www.blender.org | ||
mtllib untitled.mtl | ||
o Cube | ||
v 1.000000 -1.000000 1.000000 | ||
v 1.000000 1.000000 1.000000 | ||
v 1.000000 -1.000000 -1.000000 | ||
v 1.000000 1.000000 -1.000000 | ||
v -1.000000 -1.000000 1.000000 | ||
v -1.000000 1.000000 1.000000 | ||
v -1.000000 -1.000000 -1.000000 | ||
v -1.000000 1.000000 -1.000000 | ||
vt 0.875000 0.500000 | ||
vt 0.625000 0.750000 | ||
vt 0.625000 0.500000 | ||
vt 0.375000 1.000000 | ||
vt 0.375000 0.750000 | ||
vt 0.625000 0.000000 | ||
vt 0.375000 0.250000 | ||
vt 0.375000 0.000000 | ||
vt 0.375000 0.500000 | ||
vt 0.125000 0.750000 | ||
vt 0.125000 0.500000 | ||
vt 0.625000 0.250000 | ||
vt 0.875000 0.750000 | ||
vt 0.625000 1.000000 | ||
vn 0.0000 -1.0000 0.0000 | ||
vn 0.0000 0.0000 -1.0000 | ||
vn -1.0000 0.0000 0.0000 | ||
vn 0.0000 1.0000 0.0000 | ||
vn 1.0000 0.0000 0.0000 | ||
vn 0.0000 0.0000 1.0000 | ||
usemtl Material | ||
s off | ||
f 5/1/1 3/2/1 1/3/1 | ||
f 3/2/2 8/4/2 4/5/2 | ||
f 7/6/3 6/7/3 8/8/3 | ||
f 2/9/4 8/10/4 6/11/4 | ||
f 1/3/5 4/5/5 2/9/5 | ||
f 5/12/6 2/9/6 6/7/6 | ||
f 5/1/1 7/13/1 3/2/1 | ||
f 3/2/2 7/14/2 8/4/2 | ||
f 7/6/3 5/12/3 6/7/3 | ||
f 2/9/4 4/5/4 8/10/4 | ||
f 1/3/5 3/2/5 4/5/5 | ||
f 5/12/6 1/3/6 2/9/6 |