Implement a basic engine with separate modules

This commit is contained in:
reo 2025-06-29 23:17:53 +03:00
parent 0135974d08
commit 95070f854c
20 changed files with 1253 additions and 117 deletions

BIN
resources/cube.bin Normal file

Binary file not shown.

121
resources/cube.gltf Normal file
View file

@ -0,0 +1,121 @@
{
"asset":{
"generator":"Khronos glTF Blender I/O v4.4.56",
"version":"2.0"
},
"scene":0,
"scenes":[
{
"name":"Scene",
"nodes":[
0
]
}
],
"nodes":[
{
"mesh":0,
"name":"Cube"
}
],
"materials":[
{
"doubleSided":true,
"name":"Material",
"pbrMetallicRoughness":{
"baseColorFactor":[
0.800000011920929,
0.800000011920929,
0.800000011920929,
1
],
"metallicFactor":0,
"roughnessFactor":0.5
}
}
],
"meshes":[
{
"name":"Cube",
"primitives":[
{
"attributes":{
"POSITION":0,
"NORMAL":1,
"TEXCOORD_0":2
},
"indices":3,
"material":0
}
]
}
],
"accessors":[
{
"bufferView":0,
"componentType":5126,
"count":24,
"max":[
1,
1,
1
],
"min":[
-1,
-1,
-1
],
"type":"VEC3"
},
{
"bufferView":1,
"componentType":5126,
"count":24,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5126,
"count":24,
"type":"VEC2"
},
{
"bufferView":3,
"componentType":5123,
"count":36,
"type":"SCALAR"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":288,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":288,
"byteOffset":288,
"target":34962
},
{
"buffer":0,
"byteLength":192,
"byteOffset":576,
"target":34962
},
{
"buffer":0,
"byteLength":72,
"byteOffset":768,
"target":34963
}
],
"buffers":[
{
"byteLength":840,
"uri":"cube.bin"
}
]
}

33
resources/cube.obj Normal file
View file

@ -0,0 +1,33 @@
# cube.obj
#
g cube
v 0.0 0.0 0.0
v 0.0 0.0 1.0
v 0.0 1.0 0.0
v 0.0 1.0 1.0
v 1.0 0.0 0.0
v 1.0 0.0 1.0
v 1.0 1.0 0.0
v 1.0 1.0 1.0
vn 0.0 0.0 1.0
vn 0.0 0.0 -1.0
vn 0.0 1.0 0.0
vn 0.0 -1.0 0.0
vn 1.0 0.0 0.0
vn -1.0 0.0 0.0
f 1//2 7//2 5//2
f 1//2 3//2 7//2
f 1//6 4//6 3//6
f 1//6 2//6 4//6
f 3//3 8//3 7//3
f 3//3 4//3 8//3
f 5//5 7//5 8//5
f 5//5 8//5 6//5
f 1//4 5//4 6//4
f 1//4 6//4 2//4
f 2//1 6//1 8//1
f 2//1 8//1 4//1

BIN
resources/monkey-smooth.bin Normal file

Binary file not shown.

View file

@ -0,0 +1,104 @@
{
"asset":{
"generator":"Khronos glTF Blender I/O v4.4.56",
"version":"2.0"
},
"scene":0,
"scenes":[
{
"name":"Scene",
"nodes":[
0
]
}
],
"nodes":[
{
"mesh":0,
"name":"Suzanne"
}
],
"meshes":[
{
"name":"Suzanne",
"primitives":[
{
"attributes":{
"POSITION":0,
"NORMAL":1,
"TEXCOORD_0":2
},
"indices":3
}
]
}
],
"accessors":[
{
"bufferView":0,
"componentType":5126,
"count":555,
"max":[
1.3671875,
0.984375,
0.8515625
],
"min":[
-1.3671875,
-0.984375,
-0.8515625
],
"type":"VEC3"
},
{
"bufferView":1,
"componentType":5126,
"count":555,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5126,
"count":555,
"type":"VEC2"
},
{
"bufferView":3,
"componentType":5123,
"count":2904,
"type":"SCALAR"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":6660,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":6660,
"byteOffset":6660,
"target":34962
},
{
"buffer":0,
"byteLength":4440,
"byteOffset":13320,
"target":34962
},
{
"buffer":0,
"byteLength":5808,
"byteOffset":17760,
"target":34963
}
],
"buffers":[
{
"byteLength":23568,
"uri":"monkey-smooth.bin"
}
]
}

BIN
resources/monkey.bin Normal file

Binary file not shown.

104
resources/monkey.gltf Normal file
View file

@ -0,0 +1,104 @@
{
"asset":{
"generator":"Khronos glTF Blender I/O v4.4.56",
"version":"2.0"
},
"scene":0,
"scenes":[
{
"name":"Scene",
"nodes":[
0
]
}
],
"nodes":[
{
"mesh":0,
"name":"Suzanne"
}
],
"meshes":[
{
"name":"Suzanne",
"primitives":[
{
"attributes":{
"POSITION":0,
"NORMAL":1,
"TEXCOORD_0":2
},
"indices":3
}
]
}
],
"accessors":[
{
"bufferView":0,
"componentType":5126,
"count":1966,
"max":[
1.3671875,
0.984375,
0.8515625
],
"min":[
-1.3671875,
-0.984375,
-0.8515625
],
"type":"VEC3"
},
{
"bufferView":1,
"componentType":5126,
"count":1966,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5126,
"count":1966,
"type":"VEC2"
},
{
"bufferView":3,
"componentType":5123,
"count":2904,
"type":"SCALAR"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":23592,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":23592,
"byteOffset":23592,
"target":34962
},
{
"buffer":0,
"byteLength":15728,
"byteOffset":47184,
"target":34962
},
{
"buffer":0,
"byteLength":5808,
"byteOffset":62912,
"target":34963
}
],
"buffers":[
{
"byteLength":68720,
"uri":"monkey.bin"
}
]
}

Binary file not shown.

View file

@ -0,0 +1,109 @@
{
"asset":{
"generator":"Khronos glTF Blender I/O v4.4.56",
"version":"2.0"
},
"scene":0,
"scenes":[
{
"name":"Scene",
"nodes":[
0
]
}
],
"nodes":[
{
"mesh":0,
"name":"Sphere",
"translation":[
0,
0,
0.003377079963684082
]
}
],
"meshes":[
{
"name":"Sphere",
"primitives":[
{
"attributes":{
"POSITION":0,
"NORMAL":1,
"TEXCOORD_0":2
},
"indices":3
}
]
}
],
"accessors":[
{
"bufferView":0,
"componentType":5126,
"count":559,
"max":[
0.9999997019767761,
1,
0.9999993443489075
],
"min":[
-0.9999990463256836,
-1,
-1
],
"type":"VEC3"
},
{
"bufferView":1,
"componentType":5126,
"count":559,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5126,
"count":559,
"type":"VEC2"
},
{
"bufferView":3,
"componentType":5123,
"count":2880,
"type":"SCALAR"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":6708,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":6708,
"byteOffset":6708,
"target":34962
},
{
"buffer":0,
"byteLength":4472,
"byteOffset":13416,
"target":34962
},
{
"buffer":0,
"byteLength":5760,
"byteOffset":17888,
"target":34963
}
],
"buffers":[
{
"byteLength":23648,
"uri":"uvsphere-smooth.bin"
}
]
}

BIN
resources/uvsphere.bin Normal file

Binary file not shown.

104
resources/uvsphere.gltf Normal file
View file

@ -0,0 +1,104 @@
{
"asset":{
"generator":"Khronos glTF Blender I/O v4.4.56",
"version":"2.0"
},
"scene":0,
"scenes":[
{
"name":"Scene",
"nodes":[
0
]
}
],
"nodes":[
{
"mesh":0,
"name":"Sphere"
}
],
"meshes":[
{
"name":"Sphere",
"primitives":[
{
"attributes":{
"POSITION":0,
"NORMAL":1,
"TEXCOORD_0":2
},
"indices":3
}
]
}
],
"accessors":[
{
"bufferView":0,
"componentType":5126,
"count":1984,
"max":[
0.9999997019767761,
1,
0.9999993443489075
],
"min":[
-0.9999990463256836,
-1,
-1
],
"type":"VEC3"
},
{
"bufferView":1,
"componentType":5126,
"count":1984,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5126,
"count":1984,
"type":"VEC2"
},
{
"bufferView":3,
"componentType":5123,
"count":2880,
"type":"SCALAR"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":23808,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":23808,
"byteOffset":23808,
"target":34962
},
{
"buffer":0,
"byteLength":15872,
"byteOffset":47616,
"target":34962
},
{
"buffer":0,
"byteLength":5760,
"byteOffset":63488,
"target":34963
}
],
"buffers":[
{
"byteLength":69248,
"uri":"uvsphere.bin"
}
]
}

BIN
resources/uvsphere2.bin Normal file

Binary file not shown.

190
resources/uvsphere2.gltf Normal file
View file

@ -0,0 +1,190 @@
{
"asset":{
"generator":"Khronos glTF Blender I/O v4.4.56",
"version":"2.0"
},
"scene":0,
"scenes":[
{
"name":"Scene",
"nodes":[
0,
1
]
}
],
"nodes":[
{
"mesh":0,
"name":"Sphere",
"translation":[
0,
0,
-1.0871706008911133
]
},
{
"mesh":1,
"name":"Cube",
"translation":[
0,
0,
1.0190757513046265
]
}
],
"meshes":[
{
"name":"Sphere",
"primitives":[
{
"attributes":{
"POSITION":0,
"NORMAL":1,
"TEXCOORD_0":2
},
"indices":3
}
]
},
{
"name":"Cube.001",
"primitives":[
{
"attributes":{
"POSITION":4,
"NORMAL":5,
"TEXCOORD_0":6
},
"indices":7
}
]
}
],
"accessors":[
{
"bufferView":0,
"componentType":5126,
"count":1984,
"max":[
0.9999997019767761,
1,
0.9999993443489075
],
"min":[
-0.9999990463256836,
-1,
-1
],
"type":"VEC3"
},
{
"bufferView":1,
"componentType":5126,
"count":1984,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5126,
"count":1984,
"type":"VEC2"
},
{
"bufferView":3,
"componentType":5123,
"count":2880,
"type":"SCALAR"
},
{
"bufferView":4,
"componentType":5126,
"count":24,
"max":[
1,
1,
1
],
"min":[
-1,
-1,
-1
],
"type":"VEC3"
},
{
"bufferView":5,
"componentType":5126,
"count":24,
"type":"VEC3"
},
{
"bufferView":6,
"componentType":5126,
"count":24,
"type":"VEC2"
},
{
"bufferView":7,
"componentType":5123,
"count":36,
"type":"SCALAR"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":23808,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":23808,
"byteOffset":23808,
"target":34962
},
{
"buffer":0,
"byteLength":15872,
"byteOffset":47616,
"target":34962
},
{
"buffer":0,
"byteLength":5760,
"byteOffset":63488,
"target":34963
},
{
"buffer":0,
"byteLength":288,
"byteOffset":69248,
"target":34962
},
{
"buffer":0,
"byteLength":288,
"byteOffset":69536,
"target":34962
},
{
"buffer":0,
"byteLength":192,
"byteOffset":69824,
"target":34962
},
{
"buffer":0,
"byteLength":72,
"byteOffset":70016,
"target":34963
}
],
"buffers":[
{
"byteLength":70088,
"uri":"uvsphere2.bin"
}
]
}