Skip to content

Commit 344c303

Browse files
committed
Add: Model Loading and Rendering, Fix: improper swapchain destruction.
1 parent 7ed7a53 commit 344c303

File tree

20 files changed

+897
-128
lines changed

20 files changed

+897
-128
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,6 @@ endif ()
8080

8181
FETCH_GLFW(${EOS_DEPENDENCIES_DIR})
8282
FETCH_SPDLOG(${EOS_DEPENDENCIES_DIR})
83-
FETCH_SLANG()
83+
FETCH_ASSIMP(${EOS_DEPENDENCIES_DIR})
84+
FETCH_SLANG()
85+
FETCH_GLM(${EOS_DEPENDENCIES_DIR})

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Eos aims to be:
1212

1313
# Dependencies
1414
> [!NOTE]
15-
> These dependencies are fetched automatically by CMake during the configuration step using FetchContent
15+
> These dependencies are used by EOS and are fetched automatically by CMake during the configuration step using FetchContent
1616
>
1717
1818

@@ -21,6 +21,8 @@ Eos aims to be:
2121
- [VMA](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator)
2222
- [SPDLOG](https://github.com/gabime/spdlog)
2323
- [SLANG](https://github.com/shader-slang/slang)
24+
- [ASSIMP]()
25+
- [GLM]()
2426

2527

2628
# Building

cmake/CmakeMacros.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ macro(CREATE_APP name)
4242
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)
4343
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
4444
set_property(TARGET ${PROJECT_NAME} PROPERTY CMAKE_CXX_EXTENSIONS OFF)
45-
if(MSVC)
46-
add_compile_options(/std:c++20)
47-
else()
48-
add_compile_options(-std=c++20)
49-
endif()
5045
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++")
5146

5247
if(MSVC)

cmake/FetchMacros.cmake

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,35 @@ macro(FETCH_SLANG)
112112
message(WARNING "Slang include directory not found at ${SLANG_BASE_PATH}/include")
113113
endif()
114114
endif()
115+
endmacro()
116+
117+
macro(FETCH_ASSIMP depsDir)
118+
set(ASSIMP_ROOT_DIR ${depsDir}/src/assimp)
119+
set(ASSIMP_BUILD_TESTS OFF)
120+
set(ASSIMP_INSTALL_PDB OFF)
121+
set(ASSIMP_BUILD_ASSIMP_VIEW OFF)
122+
set(ASSIMP_BUILD_IFC_IMPORTER OFF)
123+
124+
125+
FetchContent_Declare(
126+
assimp
127+
GIT_REPOSITORY https://github.com/assimp/assimp
128+
GIT_TAG v6.0.0
129+
)
130+
131+
FetchContent_MakeAvailable(assimp)
132+
target_link_libraries(EOS PRIVATE assimp::assimp)
133+
endmacro()
134+
135+
macro(FETCH_GLM depsDir)
136+
137+
set(GLM_ROOT_DIR ${depsDir}/src/assimp)
138+
FetchContent_Declare(
139+
glm
140+
GIT_REPOSITORY https://github.com/g-truc/glm
141+
GIT_TAG 1.0.1
142+
)
143+
144+
FetchContent_MakeAvailable(glm)
145+
target_link_libraries(EOS PRIVATE glm::glm)
115146
endmacro()

data/rubber_duck/scene.bin

396 KB
Binary file not shown.

data/rubber_duck/scene.gltf

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
{
2+
"accessors": [
3+
{
4+
"bufferView": 2,
5+
"componentType": 5126,
6+
"count": 5676,
7+
"max": [
8+
0.36252099275588989,
9+
0.51303797960281372,
10+
1.0525829792022705
11+
],
12+
"min": [
13+
-0.36252099275588989,
14+
-0.48232200741767883,
15+
0.00014600000577047467
16+
],
17+
"type": "VEC3"
18+
},
19+
{
20+
"bufferView": 2,
21+
"byteOffset": 68112,
22+
"componentType": 5126,
23+
"count": 5676,
24+
"max": [
25+
0.99994742870330811,
26+
0.99997341632843018,
27+
0.9999920129776001
28+
],
29+
"min": [
30+
-0.99994742870330811,
31+
-0.99984163045883179,
32+
-1
33+
],
34+
"type": "VEC3"
35+
},
36+
{
37+
"bufferView": 3,
38+
"componentType": 5126,
39+
"count": 5676,
40+
"max": [
41+
0.99985033273696899,
42+
0.99970757961273193,
43+
0.99825453758239746,
44+
1
45+
],
46+
"min": [
47+
-1,
48+
-0.99970918893814087,
49+
-0.99825495481491089,
50+
-1
51+
],
52+
"type": "VEC4"
53+
},
54+
{
55+
"bufferView": 1,
56+
"componentType": 5126,
57+
"count": 5676,
58+
"max": [
59+
0.9983140230178833,
60+
0.87805598974227905
61+
],
62+
"min": [
63+
0.00010900000052060932,
64+
0.00010900000052060932
65+
],
66+
"type": "VEC2"
67+
},
68+
{
69+
"bufferView": 0,
70+
"componentType": 5125,
71+
"count": 33216,
72+
"max": [
73+
5675
74+
],
75+
"min": [
76+
0
77+
],
78+
"type": "SCALAR"
79+
}
80+
],
81+
"asset": {
82+
"extras": {
83+
"author": "emilsvfx (https://sketchfab.com/emilsvfx)",
84+
"license": "CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)",
85+
"source": "https://sketchfab.com/models/a84cecb600c04eeba60d02f99b8b154b",
86+
"title": "Rubber Duck"
87+
},
88+
"generator": "Sketchfab-3.37.2",
89+
"version": "2.0"
90+
},
91+
"bufferViews": [
92+
{
93+
"buffer": 0,
94+
"byteLength": 132864,
95+
"byteOffset": 0,
96+
"name": "floatBufferViews",
97+
"target": 34963
98+
},
99+
{
100+
"buffer": 0,
101+
"byteLength": 45408,
102+
"byteOffset": 132864,
103+
"byteStride": 8,
104+
"name": "floatBufferViews",
105+
"target": 34962
106+
},
107+
{
108+
"buffer": 0,
109+
"byteLength": 136224,
110+
"byteOffset": 178272,
111+
"byteStride": 12,
112+
"name": "floatBufferViews",
113+
"target": 34962
114+
},
115+
{
116+
"buffer": 0,
117+
"byteLength": 90816,
118+
"byteOffset": 314496,
119+
"byteStride": 16,
120+
"name": "floatBufferViews",
121+
"target": 34962
122+
}
123+
],
124+
"buffers": [
125+
{
126+
"byteLength": 405312,
127+
"uri": "scene.bin"
128+
}
129+
],
130+
"images": [
131+
{
132+
"uri": "textures/Duck_baseColor.png"
133+
}
134+
],
135+
"materials": [
136+
{
137+
"doubleSided": true,
138+
"emissiveFactor": [
139+
0,
140+
0,
141+
0
142+
],
143+
"name": "Duck",
144+
"pbrMetallicRoughness": {
145+
"baseColorFactor": [
146+
1,
147+
1,
148+
1,
149+
1
150+
],
151+
"baseColorTexture": {
152+
"index": 0,
153+
"texCoord": 0
154+
},
155+
"metallicFactor": 0,
156+
"roughnessFactor": 0.84349154199999998
157+
}
158+
}
159+
],
160+
"meshes": [
161+
{
162+
"primitives": [
163+
{
164+
"attributes": {
165+
"NORMAL": 1,
166+
"POSITION": 0,
167+
"TANGENT": 2,
168+
"TEXCOORD_0": 3
169+
},
170+
"indices": 4,
171+
"material": 0,
172+
"mode": 4
173+
}
174+
]
175+
}
176+
],
177+
"nodes": [
178+
{
179+
"children": [
180+
1
181+
],
182+
"name": "RootNode (gltf orientation matrix)",
183+
"rotation": [
184+
-0.70710678118654746,
185+
-0,
186+
-0,
187+
0.70710678118654757
188+
]
189+
},
190+
{
191+
"children": [
192+
2
193+
],
194+
"name": "RootNode (model correction matrix)"
195+
},
196+
{
197+
"children": [
198+
3
199+
],
200+
"name": "duck.obj.cleaner.materialmerger.gles"
201+
},
202+
{
203+
"mesh": 0,
204+
"name": ""
205+
}
206+
],
207+
"samplers": [
208+
{
209+
"magFilter": 9729,
210+
"minFilter": 9987,
211+
"wrapS": 10497,
212+
"wrapT": 10497
213+
}
214+
],
215+
"scene": 0,
216+
"scenes": [
217+
{
218+
"name": "OSG_Scene",
219+
"nodes": [
220+
0
221+
]
222+
}
223+
],
224+
"textures": [
225+
{
226+
"sampler": 0,
227+
"source": 0
228+
}
229+
]
230+
}
231+
37.3 KB
Loading

0 commit comments

Comments
 (0)