From 43f3dc16cc9e43c459814249089c79f22eefa7dc Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Thu, 28 Sep 2023 16:17:56 -0400 Subject: add torus and update models to not include vertex color --- assets/models/cube.bin | Bin 1224 -> 840 bytes assets/models/cube.gltf | 37 ++++-------- assets/models/plane.gltf | 2 +- assets/models/torus.bin | Bin 0 -> 80640 bytes assets/models/torus.gltf | 137 ++++++++++++++++++++++++++++++++++++++++++++ assets/models/torus.png | Bin 0 -> 325509 bytes assets/shaders/texture.frag | 6 +- assets/shaders/vert.vert | 4 +- 8 files changed, 158 insertions(+), 28 deletions(-) create mode 100644 assets/models/torus.bin create mode 100644 assets/models/torus.gltf create mode 100644 assets/models/torus.png (limited to 'assets') diff --git a/assets/models/cube.bin b/assets/models/cube.bin index 6223cf0..5494d9c 100644 Binary files a/assets/models/cube.bin and b/assets/models/cube.bin differ diff --git a/assets/models/cube.gltf b/assets/models/cube.gltf index 9bc8a22..e43dd04 100644 --- a/assets/models/cube.gltf +++ b/assets/models/cube.gltf @@ -37,12 +37,11 @@ "primitives":[ { "attributes":{ - "COLOR_0":0, - "POSITION":1, - "NORMAL":2, - "TEXCOORD_0":3 + "POSITION":0, + "NORMAL":1, + "TEXCOORD_0":2 }, - "indices":4, + "indices":3, "material":0 } ] @@ -66,12 +65,6 @@ "bufferView":0, "componentType":5126, "count":24, - "type":"VEC4" - }, - { - "bufferView":1, - "componentType":5126, - "count":24, "max":[ 1, 1, @@ -85,53 +78,47 @@ "type":"VEC3" }, { - "bufferView":2, + "bufferView":1, "componentType":5126, "count":24, "type":"VEC3" }, { - "bufferView":3, + "bufferView":2, "componentType":5126, "count":24, "type":"VEC2" }, { - "bufferView":4, + "bufferView":3, "componentType":5123, "count":36, "type":"SCALAR" } ], "bufferViews":[ - { - "buffer":0, - "byteLength":384, - "byteOffset":0, - "target":34962 - }, { "buffer":0, "byteLength":288, - "byteOffset":384, + "byteOffset":0, "target":34962 }, { "buffer":0, "byteLength":288, - "byteOffset":672, + "byteOffset":288, "target":34962 }, { "buffer":0, "byteLength":192, - "byteOffset":960, + "byteOffset":576, "target":34962 }, { "buffer":0, "byteLength":72, - "byteOffset":1152, + "byteOffset":768, "target":34963 } ], @@ -143,7 +130,7 @@ ], "buffers":[ { - "byteLength":1224, + "byteLength":840, "uri":"cube.bin" } ] diff --git a/assets/models/plane.gltf b/assets/models/plane.gltf index da40554..6d9c6a5 100644 --- a/assets/models/plane.gltf +++ b/assets/models/plane.gltf @@ -21,7 +21,7 @@ "materials":[ { "doubleSided":true, - "name":"Material", + "name":"Material.001", "pbrMetallicRoughness":{ "baseColorTexture":{ "index":0 diff --git a/assets/models/torus.bin b/assets/models/torus.bin new file mode 100644 index 0000000..4c92207 Binary files /dev/null and b/assets/models/torus.bin differ diff --git a/assets/models/torus.gltf b/assets/models/torus.gltf new file mode 100644 index 0000000..89f5103 --- /dev/null +++ b/assets/models/torus.gltf @@ -0,0 +1,137 @@ +{ + "asset":{ + "generator":"Khronos glTF Blender I/O v3.6.27", + "version":"2.0" + }, + "scene":0, + "scenes":[ + { + "name":"Scene", + "nodes":[ + 0 + ] + } + ], + "nodes":[ + { + "mesh":0, + "name":"Torus" + } + ], + "materials":[ + { + "doubleSided":true, + "name":"Material.001", + "pbrMetallicRoughness":{ + "baseColorTexture":{ + "index":0 + }, + "metallicFactor":0, + "roughnessFactor":0.5 + } + } + ], + "meshes":[ + { + "name":"Torus", + "primitives":[ + { + "attributes":{ + "POSITION":0, + "NORMAL":1, + "TEXCOORD_0":2 + }, + "indices":3, + "material":0 + } + ] + } + ], + "textures":[ + { + "sampler":0, + "source":0 + } + ], + "images":[ + { + "mimeType":"image/png", + "name":"torus", + "uri":"torus.png" + } + ], + "accessors":[ + { + "bufferView":0, + "componentType":5126, + "count":2304, + "max":[ + 1.25, + 1.25, + 0.25 + ], + "min":[ + -1.25, + -1.25, + -0.25 + ], + "type":"VEC3" + }, + { + "bufferView":1, + "componentType":5126, + "count":2304, + "type":"VEC3" + }, + { + "bufferView":2, + "componentType":5126, + "count":2304, + "type":"VEC2" + }, + { + "bufferView":3, + "componentType":5123, + "count":3456, + "type":"SCALAR" + } + ], + "bufferViews":[ + { + "buffer":0, + "byteLength":27648, + "byteOffset":0, + "target":34962 + }, + { + "buffer":0, + "byteLength":27648, + "byteOffset":27648, + "target":34962 + }, + { + "buffer":0, + "byteLength":18432, + "byteOffset":55296, + "target":34962 + }, + { + "buffer":0, + "byteLength":6912, + "byteOffset":73728, + "target":34963 + } + ], + "samplers":[ + { + "magFilter":9729, + "minFilter":9987 + } + ], + "buffers":[ + { + "byteLength":80640, + "uri":"torus.bin" + } + ] +} diff --git a/assets/models/torus.png b/assets/models/torus.png new file mode 100644 index 0000000..dc3f10f Binary files /dev/null and b/assets/models/torus.png differ diff --git a/assets/shaders/texture.frag b/assets/shaders/texture.frag index 44e3dd6..9859bb6 100644 --- a/assets/shaders/texture.frag +++ b/assets/shaders/texture.frag @@ -9,8 +9,12 @@ layout(binding = 1) uniform sampler2D texSampler; void main() { vec4 color = texture(texSampler, fragTexCoord.xy); +/* if (color.w == 0) { discard; } - outColor = color; +*/ + outColor = color; + // outColor = vec4(0.0, 0.8, 0.0, 1.0); + // outColor = vec4(fragTexCoord.xyz, 1.0); } diff --git a/assets/shaders/vert.vert b/assets/shaders/vert.vert index 07044c8..593e88c 100644 --- a/assets/shaders/vert.vert +++ b/assets/shaders/vert.vert @@ -27,10 +27,12 @@ void main() { ubo.proj * ubo.view * ubo.model * + vec4(inPosition, 1.0); +/* vec4(instPos, 1.0) * vec4(instRot, 1.0) * vec4(instScale, 1.0) * - vec4(inPosition, 1.0); +*/ fragColor = vec4(0.0, 0.0, 0.0, 0.0); fragTexCoord = vec3(inUV, 0); } -- cgit v1.2.3