diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/GeoSphere003_color.png b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/GeoSphere003_color.png new file mode 100644 index 0000000..c8b7ed0 Binary files /dev/null and b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/GeoSphere003_color.png differ diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/GeoSphere003_roughness.png b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/GeoSphere003_roughness.png new file mode 100644 index 0000000..d4fe330 Binary files /dev/null and b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/GeoSphere003_roughness.png differ diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/GridFloor_color.png b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/GridFloor_color.png new file mode 100644 index 0000000..babc3ed Binary files /dev/null and b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/GridFloor_color.png differ diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel.bin b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel.bin new file mode 100644 index 0000000..ecaf6bd Binary files /dev/null and b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel.bin differ diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel.glb b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel.glb new file mode 100644 index 0000000..85fb1eb Binary files /dev/null and b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel.glb differ diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel.gltf b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel.gltf new file mode 100644 index 0000000..014b951 --- /dev/null +++ b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel.gltf @@ -0,0 +1,2208 @@ +{ + "asset":{ + "generator":"Khronos glTF Blender I/O v4.1.63", + "version":"2.0" + }, + "extensionsUsed":[ + "KHR_physics_rigid_bodies", + "KHR_materials_specular", + "KHR_materials_ior", + "KHR_collision_shapes", + "KHR_lights_punctual" + ], + "extensionsRequired":[ + "KHR_lights_punctual" + ], + "extensions":{ + "KHR_physics_rigid_bodies":{ + "physicsJoints":[ + { + "limits":[ + { + "linearAxes":[ + 0 + ], + "min":0, + "max":0 + }, + { + "linearAxes":[ + 2 + ], + "min":0, + "max":0 + }, + { + "linearAxes":[ + 1 + ], + "min":0, + "max":0 + }, + { + "angularAxes":[ + 2 + ], + "min":0, + "max":0 + }, + { + "angularAxes":[ + 1 + ], + "min":0, + "max":0 + } + ] + }, + { + "limits":[ + { + "linearAxes":[ + 0 + ], + "min":0, + "max":0 + }, + { + "linearAxes":[ + 2 + ], + "min":0, + "max":0 + }, + { + "linearAxes":[ + 1 + ], + "min":0, + "max":0 + }, + { + "angularAxes":[ + 0 + ], + "min":-1.2217304706573486, + "max":4.537856101989746 + }, + { + "angularAxes":[ + 2 + ], + "min":0, + "max":0 + }, + { + "angularAxes":[ + 1 + ], + "min":0, + "max":0 + } + ] + } + ], + "physicsMaterials":[ + { + "staticFriction":0.5, + "dynamicFriction":0.5, + "restitution":0 + }, + { + "staticFriction":0.820274829864502, + "dynamicFriction":0.820274829864502, + "restitution":0 + } + ], + "collisionFilters":[ + { + "collisionSystems":[ + "System_2" + ], + "collideWithSystems":[ + "System_2" + ] + }, + { + "collisionSystems":[ + "System_0", + "System_1", + "System_2" + ], + "collideWithSystems":[ + "System_0", + "System_1", + "System_2" + ] + }, + { + "collisionSystems":[ + "System_1" + ], + "collideWithSystems":[ + "System_1" + ] + }, + { + "collisionSystems":[ + "System_0" + ], + "collideWithSystems":[ + "System_0" + ] + }, + { + "collisionSystems":[ + "System_0", + "System_2" + ], + "collideWithSystems":[ + "System_0", + "System_2" + ] + } + ] + }, + "KHR_collision_shapes":{ + "shapes":[ + { + "type":"mesh", + "mesh":{ + "mesh":0 + } + }, + { + "type":"sphere", + "sphere":{ + "radius":0.00881940146862658 + } + }, + { + "type":"mesh", + "mesh":{ + "mesh":2 + }, + "extensions":{ + "KHR_physics_rigid_bodies":{ + "convexHull":true + } + } + }, + { + "type":"mesh", + "mesh":{ + "mesh":3 + } + }, + { + "type":"mesh", + "mesh":{ + "mesh":4 + } + }, + { + "type":"mesh", + "mesh":{ + "mesh":5 + } + }, + { + "type":"mesh", + "mesh":{ + "mesh":6 + } + }, + { + "type":"mesh", + "mesh":{ + "mesh":14 + } + } + ] + }, + "KHR_lights_punctual":{ + "lights":[ + { + "color":[ + 1, + 1, + 1 + ], + "intensity":5.435141387578143, + "spot":{ + "innerConeAngle":0.25444365854513507, + "outerConeAngle":0.36739182472229004 + }, + "type":"spot", + "name":"Spot" + } + ] + } + }, + "scene":0, + "scenes":[ + { + "name":"Scene", + "nodes":[ + 2, + 3, + 6, + 7, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25 + ] + } + ], + "nodes":[ + { + "name":"jointSpaceB", + "rotation":[ + 0, + 0, + 0, + 1 + ], + "translation":[ + 0.05728593468666077, + 0.21237924695014954, + -0.003656008979305625 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "joint":{ + "connectedNode":0, + "joint":0 + } + } + }, + "name":"jointSpaceA", + "rotation":[ + 0, + 0, + 0, + 1 + ], + "translation":[ + 1.341104507446289e-07, + -4.470348358154297e-07, + -3.958120942115784e-09 + ] + }, + { + "children":[ + 1 + ], + "extensions":{ + "KHR_physics_rigid_bodies":{ + "motion":{ + "mass":1, + "centerOfMass":[ + 0, + 0, + 0 + ], + "inertiaDiagonal":[ + 0.4000000059604645, + 0.10000000149011612, + 0.10000000149011612 + ], + "inertiaOrientation":[ + 1, + 0, + 0, + 0 + ] + }, + "collider":{ + "shape":0, + "physicsMaterial":0, + "collisionFilter":0 + } + } + }, + "mesh":0, + "name":"WaterWheel", + "translation":[ + 0.05728580057621002, + 0.21237969398498535, + -0.003656005021184683 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "motion":{ + "mass":0.10000000149011612 + }, + "collider":{ + "shape":1, + "physicsMaterial":0, + "collisionFilter":1 + } + } + }, + "mesh":1, + "name":"GeoSphere003", + "translation":[ + -0.005234080366790295, + 0.37534430623054504, + -0.06499435007572174 + ] + }, + { + "name":"jointSpaceB", + "rotation":[ + 0, + 0, + 0, + 1 + ], + "translation":[ + -0.14698892831802368, + 0.3779352605342865, + -0.06632310152053833 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "joint":{ + "connectedNode":4, + "joint":1 + } + } + }, + "name":"jointSpaceA", + "rotation":[ + 0, + 0, + 0, + 1 + ], + "translation":[ + -0.14698892831802368, + 0.3779352605342865, + -0.06632310152053833 + ] + }, + { + "children":[ + 5 + ], + "extensions":{ + "KHR_physics_rigid_bodies":{ + "motion":{ + "mass":1 + }, + "collider":{ + "shape":2, + "physicsMaterial":0, + "collisionFilter":0 + } + } + }, + "mesh":2, + "name":"Sign" + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "motion":{ + "isKinematic":true, + "mass":1, + "angularVelocity":[ + 0, + 6, + 0 + ] + }, + "collider":{ + "shape":3, + "physicsMaterial":0, + "collisionFilter":2 + } + } + }, + "mesh":3, + "name":"ArchimedesScrew_Insert.001", + "rotation":[ + -0.0005147010087966919, + -0.004580619279295206, + -0.014868726022541523, + 0.9998789429664612 + ], + "scale":[ + 1, + 1.0555225610733032, + 1 + ], + "translation":[ + -0.06644231826066971, + 0.17988070845603943, + -0.0692431852221489 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "collider":{ + "shape":4, + "physicsMaterial":0, + "collisionFilter":3 + } + } + }, + "mesh":4, + "name":"Water_Wheel_Track_01" + }, + { + "children":[ + 0 + ], + "extensions":{ + "KHR_physics_rigid_bodies":{ + "collider":{ + "shape":5, + "physicsMaterial":0, + "collisionFilter":3 + } + } + }, + "mesh":5, + "name":"WaterWheel_Structure_01" + }, + { + "children":[ + 4 + ], + "extensions":{ + "KHR_physics_rigid_bodies":{ + "collider":{ + "shape":6, + "physicsMaterial":0, + "collisionFilter":3 + } + } + }, + "mesh":6, + "name":"WaterWheel_Tower_01" + }, + { + "children":[ + 8, + 9, + 10 + ], + "extensions":{ + "KHR_physics_rigid_bodies":{} + }, + "name":"Structure" + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{} + }, + "name":"WheelJoint", + "translation":[ + 0.05728593468666077, + 0.21237924695014954, + -0.003656008979305625 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{} + }, + "name":"SignJoint", + "translation":[ + -0.14698892831802368, + 0.3779352605342865, + -0.06632310152053833 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "motion":{ + "mass":0.10000000149011612 + }, + "collider":{ + "shape":1, + "physicsMaterial":0, + "collisionFilter":1 + } + } + }, + "mesh":1, + "name":"GeoSphere003.001", + "translation":[ + 0.016579197719693184, + 0.366679847240448, + -0.06432890146970749 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "motion":{ + "mass":0.10000000149011612 + }, + "collider":{ + "shape":1, + "physicsMaterial":0, + "collisionFilter":1 + } + } + }, + "mesh":7, + "name":"GeoSphere003.002", + "translation":[ + 0.042281683534383774, + 0.3598223626613617, + -0.06482820212841034 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "motion":{ + "mass":0.10000000149011612 + }, + "collider":{ + "shape":1, + "physicsMaterial":0, + "collisionFilter":1 + } + } + }, + "mesh":8, + "name":"GeoSphere003.003", + "translation":[ + 0.059068500995635986, + 0.34973812103271484, + -0.03793502226471901 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "motion":{ + "mass":0.10000000149011612 + }, + "collider":{ + "shape":1, + "physicsMaterial":0, + "collisionFilter":1 + } + } + }, + "mesh":9, + "name":"GeoSphere003.004", + "translation":[ + -0.05159764736890793, + 0.03759405016899109, + 0.011329771019518375 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "motion":{ + "mass":0.10000000149011612 + }, + "collider":{ + "shape":1, + "physicsMaterial":0, + "collisionFilter":1 + } + } + }, + "mesh":9, + "name":"GeoSphere003.005", + "translation":[ + -0.05517333000898361, + 0.041500113904476166, + 0.030902884900569916 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "motion":{ + "mass":0.10000000149011612 + }, + "collider":{ + "shape":1, + "physicsMaterial":0, + "collisionFilter":1 + } + } + }, + "mesh":10, + "name":"GeoSphere003.006", + "translation":[ + -0.05255746841430664, + 0.048563435673713684, + 0.05307483300566673 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "motion":{ + "mass":0.10000000149011612 + }, + "collider":{ + "shape":1, + "physicsMaterial":0, + "collisionFilter":1 + } + } + }, + "mesh":11, + "name":"GeoSphere003.007", + "translation":[ + -0.05378921702504158, + 0.0588318407535553, + 0.07647882401943207 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "motion":{ + "mass":0.10000000149011612 + }, + "collider":{ + "shape":1, + "physicsMaterial":0, + "collisionFilter":1 + } + } + }, + "mesh":12, + "name":"GeoSphere003.008", + "translation":[ + -0.04643058404326439, + 0.05906756594777107, + 0.09860686212778091 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "motion":{ + "mass":0.10000000149011612 + }, + "collider":{ + "shape":1, + "physicsMaterial":0, + "collisionFilter":1 + } + } + }, + "mesh":13, + "name":"GeoSphere003.009", + "translation":[ + -0.03744261711835861, + 0.059426020830869675, + 0.12039768695831299 + ] + }, + { + "extensions":{ + "KHR_physics_rigid_bodies":{ + "collider":{ + "shape":7, + "physicsMaterial":1, + "collisionFilter":4 + } + } + }, + "mesh":14, + "name":"GridFloor", + "scale":[ + 1.4501413106918335, + 1.4501413106918335, + 1.4501413106918335 + ], + "translation":[ + 0, + -0.0007645171135663986, + 9.033709526062012 + ] + }, + { + "extensions":{ + "KHR_lights_punctual":{ + "light":0 + } + }, + "name":"KeyLight", + "rotation":[ + -0.1052761971950531, + 0.4410267770290375, + 0.4316149950027466, + 0.7798210382461548 + ], + "translation":[ + 1.181721568107605, + 1.3424081802368164, + 1.1594487428665161 + ] + }, + { + "camera":0, + "name":"Camera", + "rotation":[ + -0.2835523188114166, + -0.24759718775749207, + -0.04565512761473656, + 0.925315797328949 + ], + "translation":[ + -0.6562365293502808, + 1.0855183601379395, + 1.1557092666625977 + ] + } + ], + "cameras":[ + { + "name":"Camera", + "perspective":{ + "aspectRatio":1.7777777777777777, + "yfov":0.39959652046304894, + "zfar":1000, + "znear":0.10000000149011612 + }, + "type":"perspective" + } + ], + "materials":[ + { + "doubleSided":true, + "extensions":{ + "KHR_materials_specular":{ + "specularFactor":0.7999999523162842 + }, + "KHR_materials_ior":{ + "ior":1.4500000476837158 + } + }, + "name":"Wheel.001", + "pbrMetallicRoughness":{ + "baseColorTexture":{ + "index":0 + }, + "metallicFactor":0, + "roughnessFactor":0.5527864098548889 + } + }, + { + "doubleSided":true, + "name":"GeoSphere003.001", + "pbrMetallicRoughness":{ + "baseColorTexture":{ + "index":1 + }, + "metallicFactor":0.5, + "metallicRoughnessTexture":{ + "index":2 + } + } + }, + { + "doubleSided":true, + "extensions":{ + "KHR_materials_specular":{ + "specularFactor":0.7999999523162842 + }, + "KHR_materials_ior":{ + "ior":1.4500000476837158 + } + }, + "name":"Track_Sign.001", + "pbrMetallicRoughness":{ + "baseColorTexture":{ + "index":3 + }, + "metallicFactor":0, + "roughnessFactor":0.5527864098548889 + } + }, + { + "alphaMode":"BLEND", + "doubleSided":true, + "extensions":{ + "KHR_materials_specular":{ + "specularColorFactor":[ + 2.0, + 2.0, + 2.0 + ] + }, + "KHR_materials_ior":{ + "ior":1.4500000476837158 + } + }, + "name":"Spiral.001", + "pbrMetallicRoughness":{ + "baseColorFactor":[ + 0.5, + 0.5, + 0.5, + 0 + ], + "metallicFactor":0, + "roughnessFactor":0.5527864098548889 + } + }, + { + "doubleSided":true, + "extensions":{ + "KHR_materials_specular":{ + "specularFactor":0.7999999523162842 + }, + "KHR_materials_ior":{ + "ior":1.4500000476837158 + } + }, + "name":"Structure.001", + "pbrMetallicRoughness":{ + "baseColorTexture":{ + "index":4 + }, + "metallicFactor":0, + "roughnessFactor":0.5527864098548889 + } + }, + { + "doubleSided":true, + "extensions":{ + "KHR_materials_specular":{ + "specularColorFactor":[ + 2.0, + 2.0, + 2.0 + ] + }, + "KHR_materials_ior":{ + "ior":1.4500000476837158 + } + }, + "name":"Tower.001", + "pbrMetallicRoughness":{ + "baseColorTexture":{ + "index":5 + }, + "metallicFactor":0, + "roughnessFactor":0.5527864098548889 + } + }, + { + "doubleSided":true, + "name":"GridFloorBaked", + "pbrMetallicRoughness":{ + "baseColorTexture":{ + "index":6 + }, + "metallicFactor":0, + "roughnessFactor":0.5 + } + } + ], + "meshes":[ + { + "name":"Mesh.046", + "primitives":[ + { + "attributes":{ + "POSITION":0, + "NORMAL":1, + "TEXCOORD_0":2 + }, + "indices":3, + "material":0 + } + ] + }, + { + "name":"Mesh.084", + "primitives":[ + { + "attributes":{ + "POSITION":4, + "NORMAL":5, + "TEXCOORD_0":6, + "TANGENT":7 + }, + "indices":8, + "material":1 + } + ] + }, + { + "name":"Mesh.090", + "primitives":[ + { + "attributes":{ + "POSITION":9, + "NORMAL":10, + "TEXCOORD_0":11, + "TANGENT":12 + }, + "indices":13, + "material":2 + } + ] + }, + { + "name":"Mesh.091", + "primitives":[ + { + "attributes":{ + "POSITION":14, + "NORMAL":15 + }, + "indices":16, + "material":3 + } + ] + }, + { + "name":"Mesh.088", + "primitives":[ + { + "attributes":{ + "POSITION":17, + "NORMAL":18, + "TEXCOORD_0":19 + }, + "indices":20, + "material":2 + }, + { + "attributes":{ + "POSITION":21, + "NORMAL":22, + "TEXCOORD_0":23 + }, + "indices":24, + "material":3 + } + ] + }, + { + "name":"Mesh.089", + "primitives":[ + { + "attributes":{ + "POSITION":25, + "NORMAL":26, + "TEXCOORD_0":27, + "TANGENT":28 + }, + "indices":29, + "material":4 + } + ] + }, + { + "name":"Mesh.087", + "primitives":[ + { + "attributes":{ + "POSITION":30, + "NORMAL":31, + "TEXCOORD_0":32 + }, + "indices":33, + "material":5 + } + ] + }, + { + "name":"Mesh.102", + "primitives":[ + { + "attributes":{ + "POSITION":34, + "NORMAL":35, + "TEXCOORD_0":36, + "TANGENT":37 + }, + "indices":8, + "material":1 + } + ] + }, + { + "name":"Mesh.103", + "primitives":[ + { + "attributes":{ + "POSITION":38, + "NORMAL":39, + "TEXCOORD_0":40, + "TANGENT":41 + }, + "indices":8, + "material":1 + } + ] + }, + { + "name":"Mesh.104", + "primitives":[ + { + "attributes":{ + "POSITION":42, + "NORMAL":43, + "TEXCOORD_0":44, + "TANGENT":45 + }, + "indices":8, + "material":1 + } + ] + }, + { + "name":"Mesh.105", + "primitives":[ + { + "attributes":{ + "POSITION":46, + "NORMAL":47, + "TEXCOORD_0":48, + "TANGENT":49 + }, + "indices":8, + "material":1 + } + ] + }, + { + "name":"Mesh.106", + "primitives":[ + { + "attributes":{ + "POSITION":50, + "NORMAL":51, + "TEXCOORD_0":52, + "TANGENT":53 + }, + "indices":8, + "material":1 + } + ] + }, + { + "name":"Mesh.107", + "primitives":[ + { + "attributes":{ + "POSITION":54, + "NORMAL":55, + "TEXCOORD_0":56, + "TANGENT":57 + }, + "indices":8, + "material":1 + } + ] + }, + { + "name":"Mesh.108", + "primitives":[ + { + "attributes":{ + "POSITION":58, + "NORMAL":59, + "TEXCOORD_0":60, + "TANGENT":61 + }, + "indices":8, + "material":1 + } + ] + }, + { + "name":"Plane", + "primitives":[ + { + "attributes":{ + "POSITION":62, + "NORMAL":63, + "TEXCOORD_0":64, + "TANGENT":65 + }, + "indices":66, + "material":6 + } + ] + } + ], + "textures":[ + { + "sampler":0, + "source":0 + }, + { + "sampler":0, + "source":1 + }, + { + "sampler":0, + "source":2 + }, + { + "sampler":0, + "source":3 + }, + { + "sampler":0, + "source":4 + }, + { + "sampler":0, + "source":5 + }, + { + "sampler":0, + "source":6 + } + ], + "images":[ + { + "mimeType":"image/png", + "name":"WaterWheel_Albedo", + "uri":"WaterWheel_Albedo.png" + }, + { + "mimeType":"image/png", + "name":"GeoSphere003_color", + "uri":"GeoSphere003_color.png" + }, + { + "mimeType":"image/png", + "name":"GeoSphere003_roughness", + "uri":"GeoSphere003_roughness.png" + }, + { + "mimeType":"image/png", + "name":"WaterWheelTrack", + "uri":"WaterWheelTrack.png" + }, + { + "mimeType":"image/png", + "name":"WaterWheelStructure", + "uri":"WaterWheelStructure.png" + }, + { + "mimeType":"image/png", + "name":"WaterWheel_Tower_Albedo", + "uri":"WaterWheel_Tower_Albedo.png" + }, + { + "mimeType":"image/png", + "name":"GridFloor_color", + "uri":"GridFloor_color.png" + } + ], + "accessors":[ + { + "bufferView":0, + "componentType":5126, + "count":2616, + "max":[ + 0.05798754096031189, + 0.10441994667053223, + 0.10614965111017227 + ], + "min":[ + -0.05804050341248512, + -0.10644197463989258, + -0.10471226274967194 + ], + "type":"VEC3" + }, + { + "bufferView":1, + "componentType":5126, + "count":2616, + "type":"VEC3" + }, + { + "bufferView":2, + "componentType":5126, + "count":2616, + "type":"VEC2" + }, + { + "bufferView":3, + "componentType":5123, + "count":4926, + "type":"SCALAR" + }, + { + "bufferView":4, + "componentType":5126, + "count":55, + "max":[ + 0.008819391019642353, + 0.008819401264190674, + 0.008387740701436996 + ], + "min":[ + -0.008819391019642353, + -0.008819401264190674, + -0.008387736976146698 + ], + "type":"VEC3" + }, + { + "bufferView":5, + "componentType":5126, + "count":55, + "type":"VEC3" + }, + { + "bufferView":6, + "componentType":5126, + "count":55, + "type":"VEC2" + }, + { + "bufferView":7, + "componentType":5126, + "count":55, + "type":"VEC4" + }, + { + "bufferView":8, + "componentType":5123, + "count":240, + "type":"SCALAR" + }, + { + "bufferView":9, + "componentType":5126, + "count":842, + "max":[ + -0.09425088763237, + 0.4297420382499695, + 0.059620268642902374 + ], + "min":[ + -0.21493330597877502, + 0.37259554862976074, + -0.0718759298324585 + ], + "type":"VEC3" + }, + { + "bufferView":10, + "componentType":5126, + "count":842, + "type":"VEC3" + }, + { + "bufferView":11, + "componentType":5126, + "count":842, + "type":"VEC2" + }, + { + "bufferView":12, + "componentType":5126, + "count":842, + "type":"VEC4" + }, + { + "bufferView":13, + "componentType":5123, + "count":1326, + "type":"SCALAR" + }, + { + "bufferView":14, + "componentType":5126, + "count":2028, + "max":[ + 0.04342711716890335, + 0.19477732479572296, + 0.043082352727651596 + ], + "min":[ + -0.043997082859277725, + -0.18901492655277252, + -0.04437132924795151 + ], + "type":"VEC3" + }, + { + "bufferView":15, + "componentType":5126, + "count":2028, + "type":"VEC3" + }, + { + "bufferView":16, + "componentType":5123, + "count":4056, + "type":"SCALAR" + }, + { + "bufferView":17, + "componentType":5126, + "count":1207, + "max":[ + 0.08558999001979828, + 0.3874734938144684, + 0.20304353535175323 + ], + "min":[ + -0.07261299341917038, + 0.005203968845307827, + -0.08958588540554047 + ], + "type":"VEC3" + }, + { + "bufferView":18, + "componentType":5126, + "count":1207, + "type":"VEC3" + }, + { + "bufferView":19, + "componentType":5126, + "count":1207, + "type":"VEC2" + }, + { + "bufferView":20, + "componentType":5123, + "count":2178, + "type":"SCALAR" + }, + { + "bufferView":21, + "componentType":5126, + "count":12, + "max":[ + -0.02999844402074814, + 0.3848891258239746, + -0.061530813574790955 + ], + "min":[ + -0.07261299341917038, + 0.3450210392475128, + -0.08274127542972565 + ], + "type":"VEC3" + }, + { + "bufferView":22, + "componentType":5126, + "count":12, + "type":"VEC3" + }, + { + "bufferView":23, + "componentType":5126, + "count":12, + "type":"VEC2" + }, + { + "bufferView":24, + "componentType":5123, + "count":18, + "type":"SCALAR" + }, + { + "bufferView":25, + "componentType":5126, + "count":4928, + "max":[ + 0.12013931572437286, + 0.4467830955982208, + 0.20643405616283417 + ], + "min":[ + -0.19980090856552124, + 0.0009531389805488288, + -0.108261838555336 + ], + "type":"VEC3" + }, + { + "bufferView":26, + "componentType":5126, + "count":4928, + "type":"VEC3" + }, + { + "bufferView":27, + "componentType":5126, + "count":4928, + "type":"VEC2" + }, + { + "bufferView":28, + "componentType":5126, + "count":4928, + "type":"VEC4" + }, + { + "bufferView":29, + "componentType":5123, + "count":7590, + "type":"SCALAR" + }, + { + "bufferView":30, + "componentType":5126, + "count":1012, + "max":[ + 0.0003804340958595276, + 0.49942100048065186, + -0.0044776094146072865 + ], + "min":[ + -0.10492343455553055, + 0.0009531345567665994, + -0.12181717902421951 + ], + "type":"VEC3" + }, + { + "bufferView":31, + "componentType":5126, + "count":1012, + "type":"VEC3" + }, + { + "bufferView":32, + "componentType":5126, + "count":1012, + "type":"VEC2" + }, + { + "bufferView":33, + "componentType":5123, + "count":1524, + "type":"SCALAR" + }, + { + "bufferView":34, + "componentType":5126, + "count":55, + "max":[ + 0.008819391019642353, + 0.008819401264190674, + 0.008387740701436996 + ], + "min":[ + -0.008819391019642353, + -0.008819401264190674, + -0.008387736976146698 + ], + "type":"VEC3" + }, + { + "bufferView":35, + "componentType":5126, + "count":55, + "type":"VEC3" + }, + { + "bufferView":36, + "componentType":5126, + "count":55, + "type":"VEC2" + }, + { + "bufferView":37, + "componentType":5126, + "count":55, + "type":"VEC4" + }, + { + "bufferView":38, + "componentType":5126, + "count":55, + "max":[ + 0.008819391019642353, + 0.008819401264190674, + 0.008387740701436996 + ], + "min":[ + -0.008819391019642353, + -0.008819401264190674, + -0.008387736976146698 + ], + "type":"VEC3" + }, + { + "bufferView":39, + "componentType":5126, + "count":55, + "type":"VEC3" + }, + { + "bufferView":40, + "componentType":5126, + "count":55, + "type":"VEC2" + }, + { + "bufferView":41, + "componentType":5126, + "count":55, + "type":"VEC4" + }, + { + "bufferView":42, + "componentType":5126, + "count":55, + "max":[ + 0.008819391019642353, + 0.008819401264190674, + 0.008387740701436996 + ], + "min":[ + -0.008819391019642353, + -0.008819401264190674, + -0.008387736976146698 + ], + "type":"VEC3" + }, + { + "bufferView":43, + "componentType":5126, + "count":55, + "type":"VEC3" + }, + { + "bufferView":44, + "componentType":5126, + "count":55, + "type":"VEC2" + }, + { + "bufferView":45, + "componentType":5126, + "count":55, + "type":"VEC4" + }, + { + "bufferView":46, + "componentType":5126, + "count":55, + "max":[ + 0.008819391019642353, + 0.008819401264190674, + 0.008387740701436996 + ], + "min":[ + -0.008819391019642353, + -0.008819401264190674, + -0.008387736976146698 + ], + "type":"VEC3" + }, + { + "bufferView":47, + "componentType":5126, + "count":55, + "type":"VEC3" + }, + { + "bufferView":48, + "componentType":5126, + "count":55, + "type":"VEC2" + }, + { + "bufferView":49, + "componentType":5126, + "count":55, + "type":"VEC4" + }, + { + "bufferView":50, + "componentType":5126, + "count":55, + "max":[ + 0.008819391019642353, + 0.008819401264190674, + 0.008387740701436996 + ], + "min":[ + -0.008819391019642353, + -0.008819401264190674, + -0.008387736976146698 + ], + "type":"VEC3" + }, + { + "bufferView":51, + "componentType":5126, + "count":55, + "type":"VEC3" + }, + { + "bufferView":52, + "componentType":5126, + "count":55, + "type":"VEC2" + }, + { + "bufferView":53, + "componentType":5126, + "count":55, + "type":"VEC4" + }, + { + "bufferView":54, + "componentType":5126, + "count":55, + "max":[ + 0.008819391019642353, + 0.008819401264190674, + 0.008387740701436996 + ], + "min":[ + -0.008819391019642353, + -0.008819401264190674, + -0.008387736976146698 + ], + "type":"VEC3" + }, + { + "bufferView":55, + "componentType":5126, + "count":55, + "type":"VEC3" + }, + { + "bufferView":56, + "componentType":5126, + "count":55, + "type":"VEC2" + }, + { + "bufferView":57, + "componentType":5126, + "count":55, + "type":"VEC4" + }, + { + "bufferView":58, + "componentType":5126, + "count":55, + "max":[ + 0.008819391019642353, + 0.008819401264190674, + 0.008387740701436996 + ], + "min":[ + -0.008819391019642353, + -0.008819401264190674, + -0.008387736976146698 + ], + "type":"VEC3" + }, + { + "bufferView":59, + "componentType":5126, + "count":55, + "type":"VEC3" + }, + { + "bufferView":60, + "componentType":5126, + "count":55, + "type":"VEC2" + }, + { + "bufferView":61, + "componentType":5126, + "count":55, + "type":"VEC4" + }, + { + "bufferView":62, + "componentType":5126, + "count":4, + "max":[ + 0.5187754034996033, + 3.5185035440754575e-10, + -5.864701747894287 + ], + "min":[ + -0.6138892769813538, + 3.5185035440754575e-10, + -6.997365951538086 + ], + "type":"VEC3" + }, + { + "bufferView":63, + "componentType":5126, + "count":4, + "type":"VEC3" + }, + { + "bufferView":64, + "componentType":5126, + "count":4, + "type":"VEC2" + }, + { + "bufferView":65, + "componentType":5126, + "count":4, + "type":"VEC4" + }, + { + "bufferView":66, + "componentType":5123, + "count":6, + "type":"SCALAR" + } + ], + "bufferViews":[ + { + "buffer":0, + "byteLength":31392, + "byteOffset":0, + "target":34962 + }, + { + "buffer":0, + "byteLength":31392, + "byteOffset":31392, + "target":34962 + }, + { + "buffer":0, + "byteLength":20928, + "byteOffset":62784, + "target":34962 + }, + { + "buffer":0, + "byteLength":9852, + "byteOffset":83712, + "target":34963 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":93564, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":94224, + "target":34962 + }, + { + "buffer":0, + "byteLength":440, + "byteOffset":94884, + "target":34962 + }, + { + "buffer":0, + "byteLength":880, + "byteOffset":95324, + "target":34962 + }, + { + "buffer":0, + "byteLength":480, + "byteOffset":96204, + "target":34963 + }, + { + "buffer":0, + "byteLength":10104, + "byteOffset":96684, + "target":34962 + }, + { + "buffer":0, + "byteLength":10104, + "byteOffset":106788, + "target":34962 + }, + { + "buffer":0, + "byteLength":6736, + "byteOffset":116892, + "target":34962 + }, + { + "buffer":0, + "byteLength":13472, + "byteOffset":123628, + "target":34962 + }, + { + "buffer":0, + "byteLength":2652, + "byteOffset":137100, + "target":34963 + }, + { + "buffer":0, + "byteLength":24336, + "byteOffset":139752, + "target":34962 + }, + { + "buffer":0, + "byteLength":24336, + "byteOffset":164088, + "target":34962 + }, + { + "buffer":0, + "byteLength":8112, + "byteOffset":188424, + "target":34963 + }, + { + "buffer":0, + "byteLength":14484, + "byteOffset":196536, + "target":34962 + }, + { + "buffer":0, + "byteLength":14484, + "byteOffset":211020, + "target":34962 + }, + { + "buffer":0, + "byteLength":9656, + "byteOffset":225504, + "target":34962 + }, + { + "buffer":0, + "byteLength":4356, + "byteOffset":235160, + "target":34963 + }, + { + "buffer":0, + "byteLength":144, + "byteOffset":239516, + "target":34962 + }, + { + "buffer":0, + "byteLength":144, + "byteOffset":239660, + "target":34962 + }, + { + "buffer":0, + "byteLength":96, + "byteOffset":239804, + "target":34962 + }, + { + "buffer":0, + "byteLength":36, + "byteOffset":239900, + "target":34963 + }, + { + "buffer":0, + "byteLength":59136, + "byteOffset":239936, + "target":34962 + }, + { + "buffer":0, + "byteLength":59136, + "byteOffset":299072, + "target":34962 + }, + { + "buffer":0, + "byteLength":39424, + "byteOffset":358208, + "target":34962 + }, + { + "buffer":0, + "byteLength":78848, + "byteOffset":397632, + "target":34962 + }, + { + "buffer":0, + "byteLength":15180, + "byteOffset":476480, + "target":34963 + }, + { + "buffer":0, + "byteLength":12144, + "byteOffset":491660, + "target":34962 + }, + { + "buffer":0, + "byteLength":12144, + "byteOffset":503804, + "target":34962 + }, + { + "buffer":0, + "byteLength":8096, + "byteOffset":515948, + "target":34962 + }, + { + "buffer":0, + "byteLength":3048, + "byteOffset":524044, + "target":34963 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":527092, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":527752, + "target":34962 + }, + { + "buffer":0, + "byteLength":440, + "byteOffset":528412, + "target":34962 + }, + { + "buffer":0, + "byteLength":880, + "byteOffset":528852, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":529732, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":530392, + "target":34962 + }, + { + "buffer":0, + "byteLength":440, + "byteOffset":531052, + "target":34962 + }, + { + "buffer":0, + "byteLength":880, + "byteOffset":531492, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":532372, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":533032, + "target":34962 + }, + { + "buffer":0, + "byteLength":440, + "byteOffset":533692, + "target":34962 + }, + { + "buffer":0, + "byteLength":880, + "byteOffset":534132, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":535012, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":535672, + "target":34962 + }, + { + "buffer":0, + "byteLength":440, + "byteOffset":536332, + "target":34962 + }, + { + "buffer":0, + "byteLength":880, + "byteOffset":536772, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":537652, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":538312, + "target":34962 + }, + { + "buffer":0, + "byteLength":440, + "byteOffset":538972, + "target":34962 + }, + { + "buffer":0, + "byteLength":880, + "byteOffset":539412, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":540292, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":540952, + "target":34962 + }, + { + "buffer":0, + "byteLength":440, + "byteOffset":541612, + "target":34962 + }, + { + "buffer":0, + "byteLength":880, + "byteOffset":542052, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":542932, + "target":34962 + }, + { + "buffer":0, + "byteLength":660, + "byteOffset":543592, + "target":34962 + }, + { + "buffer":0, + "byteLength":440, + "byteOffset":544252, + "target":34962 + }, + { + "buffer":0, + "byteLength":880, + "byteOffset":544692, + "target":34962 + }, + { + "buffer":0, + "byteLength":48, + "byteOffset":545572, + "target":34962 + }, + { + "buffer":0, + "byteLength":48, + "byteOffset":545620, + "target":34962 + }, + { + "buffer":0, + "byteLength":32, + "byteOffset":545668, + "target":34962 + }, + { + "buffer":0, + "byteLength":64, + "byteOffset":545700, + "target":34962 + }, + { + "buffer":0, + "byteLength":12, + "byteOffset":545764, + "target":34963 + } + ], + "samplers":[ + { + "magFilter":9729, + "minFilter":9987 + } + ], + "buffers":[ + { + "byteLength":545776, + "uri":"WaterWheel.bin" + } + ] +} diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheelStructure.png b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheelStructure.png new file mode 100644 index 0000000..41165bf Binary files /dev/null and b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheelStructure.png differ diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheelTrack.png b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheelTrack.png new file mode 100644 index 0000000..789f56c Binary files /dev/null and b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheelTrack.png differ diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel_Albedo.png b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel_Albedo.png new file mode 100644 index 0000000..c5e105b Binary files /dev/null and b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel_Albedo.png differ diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel_Tower_Albedo.png b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel_Tower_Albedo.png new file mode 100644 index 0000000..0a66571 Binary files /dev/null and b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/WaterWheel/WaterWheel_Tower_Albedo.png differ diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/sphere.bin b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/sphere.bin new file mode 100644 index 0000000..0f08a5a Binary files /dev/null and b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/sphere.bin differ diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/sphere.gltf b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/sphere.gltf new file mode 100644 index 0000000..1ba270e --- /dev/null +++ b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/meshes/sphere.gltf @@ -0,0 +1,137 @@ +{ + "asset":{ + "generator":"Khronos glTF Blender I/O v4.1.63", + "version":"2.0" + }, + "scene":0, + "scenes":[ + { + "name":"Scene", + "nodes":[ + 0 + ] + } + ], + "nodes":[ + { + "mesh":0, + "name":"Sphere" + } + ], + "materials":[ + { + "doubleSided":true, + "name":"Material.002", + "pbrMetallicRoughness":{ + "baseColorTexture":{ + "index":0 + }, + "metallicFactor":0, + "roughnessFactor":0.5 + } + } + ], + "meshes":[ + { + "name":"Sphere", + "primitives":[ + { + "attributes":{ + "POSITION":0, + "NORMAL":1, + "TEXCOORD_0":2 + }, + "indices":3, + "material":0 + } + ] + } + ], + "textures":[ + { + "sampler":0, + "source":0 + } + ], + "images":[ + { + "mimeType":"image/png", + "name":"blue-sky", + "uri":"blue-sky.png" + } + ], + "accessors":[ + { + "bufferView":0, + "componentType":5126, + "count":151, + "max":[ + 1, + 1, + 1 + ], + "min":[ + -0.9999999403953552, + -1, + -1 + ], + "type":"VEC3" + }, + { + "bufferView":1, + "componentType":5126, + "count":151, + "type":"VEC3" + }, + { + "bufferView":2, + "componentType":5126, + "count":151, + "type":"VEC2" + }, + { + "bufferView":3, + "componentType":5123, + "count":672, + "type":"SCALAR" + } + ], + "bufferViews":[ + { + "buffer":0, + "byteLength":1812, + "byteOffset":0, + "target":34962 + }, + { + "buffer":0, + "byteLength":1812, + "byteOffset":1812, + "target":34962 + }, + { + "buffer":0, + "byteLength":1208, + "byteOffset":3624, + "target":34962 + }, + { + "buffer":0, + "byteLength":1344, + "byteOffset":4832, + "target":34963 + } + ], + "samplers":[ + { + "magFilter":9729, + "minFilter":9987 + } + ], + "buffers":[ + { + "byteLength":6176, + "uri":"sphere.bin" + } + ] +} diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/pipelines/pbr_basic.sf b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/pipelines/pbr_basic.sf new file mode 100644 index 0000000..a802d09 --- /dev/null +++ b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/pipelines/pbr_basic.sf @@ -0,0 +1,85 @@ +/* + TODO(john): Need a description of the .sf format here +*/ + +pipeline { + + raster + { + primitive: TRIANGLES + index_buffer_element_size: UINT32 + }, + + depth + { + func: LESS + }, + + + shader { + + vertex { + + attributes { + + /* + Vertex layout required for this pipeline (for input assembler) + + fields: + + POSITION: float3 + TEXCOORD: float2 + TEXCOORD[0 - 12]: float2 + COLOR: uint8[4] + NORMAL: float3 + TANGENT: float4 + JOINT: float4 + WEIGHT: float + FLOAT: float + FLOAT2: float2 + FLOAT3: float3 + FLOAT4: float4 + */ + + POSITION : a_position + TEXCOORD : a_uv + COLOR : a_color + }, + + uniforms { + mat4 u_mvp; + }, + + out { + vec2 uv; + vec3 position; + }, + + code { + void main() { + gl_Position = u_mvp * vec4(a_position, 1.0); + uv = a_uv; + position = a_position; + } + } + }, + + fragment { + + uniforms { + sampler2D u_base_col_tex; + vec4 u_base_col_fact; + }, + + out { + vec4 frag_color; + }, + + code { + void main() { + frag_color = texture(u_base_col_tex, uv); // // + } + } + } + } +} diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/pipelines/sky_sphere.sf b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/pipelines/sky_sphere.sf new file mode 100644 index 0000000..ecb15d3 --- /dev/null +++ b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/pipelines/sky_sphere.sf @@ -0,0 +1,83 @@ +/* + TODO(john): Need a description of the .sf format here +*/ + +pipeline { + + raster + { + primitive: TRIANGLES + index_buffer_element_size: UINT32 + }, + + depth + { + func: ALWAYS + }, + + + shader { + + vertex { + + attributes { + + /* + Vertex layout required for this pipeline (for input assembler) + + fields: + + POSITION: float3 + TEXCOORD: float2 + TEXCOORD[0 - 12]: float2 + COLOR: uint8[4] + NORMAL: float3 + TANGENT: float4 + JOINT: float4 + WEIGHT: float + FLOAT: float + FLOAT2: float2 + FLOAT3: float3 + FLOAT4: float4 + */ + + POSITION : a_position + TEXCOORD : a_uv + COLOR : a_color + }, + + uniforms { + mat4 u_svp; + }, + + out { + vec2 uv; + }, + + code { + void main() { + vec4 pos = u_svp * vec4(a_position, 1.0); + uv = a_uv; + gl_Position = pos.xyww; + } + } + }, + + fragment { + + uniforms { + sampler2D u_tex; + }, + + out { + vec4 frag_color; + }, + + code { + void main() { + frag_color = texture(u_tex, uv); + } + } + } + } +} diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/textures/blue-sky.png b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/textures/blue-sky.png new file mode 100644 index 0000000..0ac7592 Binary files /dev/null and b/ex_util_gfxt_ext/cgltf_multiple_nodes/assets/textures/blue-sky.png differ diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/bin/App b/ex_util_gfxt_ext/cgltf_multiple_nodes/bin/App new file mode 100755 index 0000000..b209e9c Binary files /dev/null and b/ex_util_gfxt_ext/cgltf_multiple_nodes/bin/App differ diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/html5/emcc.sh b/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/html5/emcc.sh new file mode 100644 index 0000000..f4d6d32 --- /dev/null +++ b/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/html5/emcc.sh @@ -0,0 +1,34 @@ +#!bin/sh + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -O3 -w -s WASM=1 -s USE_WEBGL2=1 -s ASYNCIFY -s ALLOW_MEMORY_GROWTH=1 --preload-file ../assets +) + +# Include directories +inc=( + -I ../../../third_party/include/ # Gunslinger includes + -I ../external/ # External includes +) + +# Source files +src=( + ../source/main.c +) + +libs=( +) + +# Build +emcc ${inc[*]} ${src[*]} ${flags[*]} -o $proj_name.html + +cd .. + + + diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/linux/gcc.sh b/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/linux/gcc.sh new file mode 100644 index 0000000..5eb6741 --- /dev/null +++ b/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/linux/gcc.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=gnu99 -Wl,--no-as-needed -ldl -lGL -lX11 -pthread -lXi +) + +# Include directories +inc=( + -I ../../../third_party/include/ + -I ../external/ +) + +# Source files +src=( + ../source/main.c +) + +# Build +gcc -O3 ${inc[*]} ${src[*]} ${flags[*]} -lm -o ${proj_name} + +cd .. diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/osx/gcc.sh b/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/osx/gcc.sh new file mode 100644 index 0000000..8d7a98b --- /dev/null +++ b/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/osx/gcc.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=c99 -x objective-c -O0 -w +) + +# Include directories +inc=( + -I ../../../third_party/include/ -I ../external/ +) + +# Source files +src=( + ../source/main.c +) + +fworks=( + -framework OpenGL + -framework CoreFoundation + -framework CoreVideo + -framework IOKit + -framework Cocoa + -framework Carbon +) + +# Build +gcc ${flags[*]} ${fworks[*]} ${inc[*]} ${src[*]} -o ${proj_name} + +cd .. + + + diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/win/cl.bat b/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/win/cl.bat new file mode 100644 index 0000000..0c6ac75 --- /dev/null +++ b/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/win/cl.bat @@ -0,0 +1,35 @@ +@echo off +rmdir /Q /S bin +mkdir bin +pushd bin + +rem Name +set name=App + +rem Include directories +set inc=/I ..\..\..\third_party\include\ /I ..\external\ + +rem Source files +set src_main=..\source\main.c + +rem All source together +set src_all=%src_main% + +rem OS Libraries +set os_libs= opengl32.lib kernel32.lib user32.lib ^ +shell32.lib vcruntime.lib msvcrt.lib gdi32.lib Advapi32.lib winmm.lib + +rem Link options +set l_options=/EHsc /link /SUBSYSTEM:CONSOLE /NODEFAULTLIB:msvcrt.lib + +rem Compile Release +rem cl /MP /FS /Ox /W0 /Fe%name%.exe %src_all% %inc% ^ +rem /EHsc /link /SUBSYSTEM:CONSOLE /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:LIBCMT ^ +rem %os_libs% + +rem Compile Debug +cl /w /MP -Zi /DEBUG:FULL /Fe%name%.exe %src_all% %inc% ^ +/EHsc /link /SUBSYSTEM:CONSOLE /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:LIBCMT ^ +%os_libs% + +popd diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/win/mingw.sh b/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/win/mingw.sh new file mode 100644 index 0000000..9145c0a --- /dev/null +++ b/ex_util_gfxt_ext/cgltf_multiple_nodes/proc/win/mingw.sh @@ -0,0 +1,41 @@ +#!bin/sh + +rm -rf bin +mkdir bin +cd bin + +proj_name=App +proj_root_dir=$(pwd)/../ + +flags=( + -std=gnu99 -w +) + +# Include directories +inc=( + -I ../../../third_party/include/ # Gunslinger includes + -I ../external/ # External includes +) + +# Source files +src=( + ../source/main.c +) + +libs=( + -lopengl32 + -lkernel32 + -luser32 + -lshell32 + -lgdi32 + -lAdvapi32 + -lwinmm +) + +# Build +gcc -O0 ${inc[*]} ${src[*]} ${flags[*]} ${libs[*]} -lm -o ${proj_name} + +cd .. + + + diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/source/data.c b/ex_util_gfxt_ext/cgltf_multiple_nodes/source/data.c new file mode 100644 index 0000000..3f5d8b6 --- /dev/null +++ b/ex_util_gfxt_ext/cgltf_multiple_nodes/source/data.c @@ -0,0 +1,56 @@ +#ifdef GS_PLATFORM_WEB + #define GS_VERSION_STR "#version 300 es\n" +#else + #define GS_VERSION_STR "#version 330 core\n" +#endif +/*================================================================ + * Copyright: 2020 John Jackson +================================================================*/ +int32_t gui_opts = GS_GUI_OPT_NOTITLE | + GS_GUI_OPT_NORESIZE | + GS_GUI_OPT_NOMOVE | + GS_GUI_OPT_FULLSCREEN | + GS_GUI_OPT_FORCESETRECT | + GS_GUI_OPT_NORESIZE | + GS_GUI_OPT_NOFRAME | + GS_GUI_OPT_NOTITLE; + +typedef struct { + gs_gui_context_t gui; + gs_command_buffer_t cb; + + gs_gfxt_pipeline_t pip; + gs_gfxt_material_t mat; + gs_gfxt_mesh_t mesh; + gs_gfxt_texture_t texture; + + const char* asset_dir; + gs_camera_t camera; + + gs_gfxt_scene_t scene; +} app_t; + +void ortho3(gs_vec3* left, gs_vec3* up, gs_vec3 v) +{ + *left = (v.z*v.z) < (v.x*v.x) ? gs_v3(v.y,-v.x,0) : gs_v3(0,-v.z,v.y); + *up = gs_vec3_cross(*left, v); +} + +void ray_cast(gs_aabb_t* aabb, gs_camera_t* camera, gs_vqs* xform, gs_contact_info_t* res, gs_vec2 fbs) { + + // Ray cast against various shapes in scene + const float ray_len = 1000.f; + const gs_vec2 mc = gs_platform_mouse_positionv(); // Mouse coordinate + const gs_vec3 ms = gs_v3(mc.x, mc.y, 0.f); // Mouse coordinate start with z = 0.f + const gs_vec3 me = gs_v3(mc.x, mc.y, -ray_len); // Mouse coordinate end with z = -1000.f (for ray cast into screen) + const gs_vec3 ro = gs_camera_screen_to_world(camera, ms, 0, 0, (uint32_t)fbs.x, (uint32_t)fbs.y); + const gs_vec3 rd = gs_camera_screen_to_world(camera, me, 0, 0, (uint32_t)fbs.x, (uint32_t)fbs.y); + + gs_ray_t ray = { + .p = ro, + .d = gs_vec3_norm(gs_vec3_sub(ro, rd)), + .len = ray_len + }; + + gs_aabb_vs_ray(aabb, xform, &ray, NULL, res); +} diff --git a/ex_util_gfxt_ext/cgltf_multiple_nodes/source/main.c b/ex_util_gfxt_ext/cgltf_multiple_nodes/source/main.c new file mode 100644 index 0000000..5f5af7b --- /dev/null +++ b/ex_util_gfxt_ext/cgltf_multiple_nodes/source/main.c @@ -0,0 +1,199 @@ +/*================================================================ + * Copyright: 2020 John Jackson + * gfxt + + The purpose of this example is to demonstrate how to use the gs_gfxt + util. + + + Press `esc` to exit the application. +================================================================*/ + +#define GS_IMPL +#include + +#define GS_IMMEDIATE_DRAW_IMPL +#include + +#define GS_GFXT_IMPL +#include + +#define GS_GUI_IMPL +#include + +#include "data.c" + +void app_camera_update(); + +void app_init() +{ + app_t* app = gs_user_data(app_t); + app->scene = (gs_gfxt_scene_t){ .pbr_pip = gs_gfxt_default_pbr_pipeline() }; + gs_gfxt_scene_t* scene = &app->scene; + + char TMP[256] = {0}; + app->asset_dir = gs_platform_dir_exists("./assets") ? "./assets" : "../assets"; + + const char* wheel_mesh_folder = "./assets/meshes/WaterWheel"; + + gs_gfxt_load_into_scene_from_file(wheel_mesh_folder, "WaterWheel.gltf", scene); + + gs_gui_init(&app->gui, gs_platform_main_window()); + + app->camera = gs_camera_perspective(); + app->cb = gs_command_buffer_new(); + + // sky sphere + gs_snprintf(TMP, sizeof(TMP), "%s/%s", app->asset_dir, "pipelines/sky_sphere.sf"); + app->pip = gs_gfxt_pipeline_load_from_file(TMP); + app->mat = gs_gfxt_material_create(&(gs_gfxt_material_desc_t){ + .pip_func.hndl = &app->pip + }); + app->mesh = gs_gfxt_mesh_load_from_file(app->asset_dir, "meshes/sphere.gltf", &(gs_gfxt_mesh_import_options_t){ + .layout = app->pip.mesh_layout, + .size = gs_dyn_array_size(app->pip.mesh_layout) * sizeof(gs_gfxt_mesh_layout_t), + .index_buffer_element_size = app->pip.desc.raster.index_buffer_element_size + }); + gs_snprintf(TMP, sizeof(TMP), "%s/%s", app->asset_dir, "textures/blue-sky.png"); + app->texture = gs_gfxt_texture_load_from_file(TMP, NULL, false, false); +} + +void app_update() +{ + // Cache data for frame + app_t* app = gs_user_data(app_t); + + gs_gfxt_scene_t* scene = &app->scene; + gs_command_buffer_t* cb = &app->cb; + + gs_gfxt_material_t* mat = &app->mat; + gs_gfxt_mesh_t* mesh = &app->mesh; + gs_gfxt_texture_t* tex = &app->texture; + + gs_camera_t* cam = &app->camera; + gs_gui_context_t* gui = &app->gui; + + const gs_vec2 fbs = gs_platform_framebuffer_sizev(gs_platform_main_window()); + const float _t = gs_platform_elapsed_time() * 0.001f; + const float t = gs_platform_elapsed_time(); + + const float dt = gs_platform_delta_time(); + + if (gs_platform_key_pressed(GS_KEYCODE_ESC)) + { + gs_quit(); + } + + // Camera for scene + if (gs_platform_mouse_down(GS_MOUSE_RBUTTON)) { + gs_platform_lock_mouse(gs_platform_main_window(), true); + app_camera_update(); + } + else { + gs_platform_lock_mouse(gs_platform_main_window(), false); + } + + gs_mat4 svp = gs_camera_get_sky_view_projection(cam, fbs.x, fbs.y); + gs_mat4 mvp = gs_camera_get_view_projection(cam, fbs.x, fbs.y); + mvp = gs_mat4_mul(mvp, gs_mat4_scale(10, 10, 10)); + + // sky uniforms + gs_gfxt_material_set_uniform(mat, "u_svp", &svp); + gs_gfxt_material_set_uniform(mat, "u_tex", tex); + + // gs_gfxt_material_set_uniform(tstmat, "u_mvp", &mvp); + + // Rendering + gs_graphics_clear_desc_t clear = {.actions = &(gs_graphics_clear_action_t){.color = {0.05f, 0.05, 0.05, 1.f}}}; + gs_graphics_renderpass_begin(cb, (gs_handle(gs_graphics_renderpass_t)){0}); + { + // Set view port + gs_graphics_set_viewport(cb,0,0,(int)fbs.x,(int)fbs.y); + + // Clear screen + gs_graphics_clear(cb, &clear); + + // sky + gs_gfxt_material_bind(cb, mat); + gs_gfxt_material_bind_uniforms(cb, mat); + gs_gfxt_mesh_draw_material(cb, mesh, mat); + + //scene + gs_gfxt_default_pbr_pipeline_draw(cb, scene, mvp); + // gs_gui_render(gui, cb); + } + gs_graphics_renderpass_end(cb); + + //Submits to cb + gs_graphics_command_buffer_submit(cb); +} + +void app_shutdown() +{ + // free + app_t* app = gs_user_data(app_t); + gs_command_buffer_free(&app->cb); + gs_gui_free(&app->gui); + gs_gfxt_scene_free(&app->scene); +} + +gs_app_desc_t gs_main(int32_t argc, char** argv) +{ + return (gs_app_desc_t) { + .user_data = gs_malloc_init(app_t), + .init = app_init, + .update = app_update, + .shutdown = app_shutdown, + .window.width = 900, + .window.height = 580 + }; +} + + +#define SENSITIVITY 0.2f +static float pitch = 0.f; +static float speed = 2000.f; +void app_camera_update() +{ + app_t* app = gs_user_data(app_t); + gs_platform_t* platform = gs_subsystem(platform); + gs_vec2 dp = gs_vec2_scale(gs_platform_mouse_deltav(), SENSITIVITY); + const float mod = gs_platform_key_down(GS_KEYCODE_LEFT_SHIFT) ? 2.f : 1.f; + float dt = platform->time.delta; + float old_pitch = pitch; + gs_camera_t* camera = &app->camera; + + // Keep track of previous amount to clamp the camera's orientation + pitch = gs_clamp(old_pitch + dp.y, -90.f, 90.f); + + // Rotate camera + gs_camera_offset_orientation(camera, -dp.x, old_pitch - pitch); + + gs_vec3 vel = {0}; + switch (camera->proj_type) + { + case GS_PROJECTION_TYPE_ORTHOGRAPHIC: + { + if (gs_platform_key_down(GS_KEYCODE_W)) vel = gs_vec3_add(vel, gs_camera_up(camera)); + if (gs_platform_key_down(GS_KEYCODE_S)) vel = gs_vec3_add(vel, gs_vec3_scale(gs_camera_up(camera), -1.f)); + if (gs_platform_key_down(GS_KEYCODE_A)) vel = gs_vec3_add(vel, gs_camera_left(camera)); + if (gs_platform_key_down(GS_KEYCODE_D)) vel = gs_vec3_add(vel, gs_camera_right(camera)); + + // Ortho scale + gs_vec2 wheel = gs_platform_mouse_wheelv(); + camera->ortho_scale -= wheel.y; + } break; + + case GS_PROJECTION_TYPE_PERSPECTIVE: + { + if (gs_platform_key_down(GS_KEYCODE_W)) vel = gs_vec3_add(vel, gs_camera_forward(camera)); + if (gs_platform_key_down(GS_KEYCODE_S)) vel = gs_vec3_add(vel, gs_camera_backward(camera)); + if (gs_platform_key_down(GS_KEYCODE_A)) vel = gs_vec3_add(vel, gs_camera_left(camera)); + if (gs_platform_key_down(GS_KEYCODE_D)) vel = gs_vec3_add(vel, gs_camera_right(camera)); + gs_vec2 wheel = gs_platform_mouse_wheelv(); + speed = gs_clamp(speed + wheel.y, 0.01f, 50.f); + } break; + } + + camera->transform.position = gs_vec3_add(camera->transform.position, gs_vec3_scale(gs_vec3_norm(vel), dt * speed * mod)); +} diff --git a/ex_util_gfxt_ext/gfxt/source/main.c b/ex_util_gfxt_ext/gfxt/source/main.c index f4a53da..139af20 100644 --- a/ex_util_gfxt_ext/gfxt/source/main.c +++ b/ex_util_gfxt_ext/gfxt/source/main.c @@ -38,8 +38,7 @@ void app_init() }); // Create mesh that uses the layout from the pipeline's requested mesh layout - gs_snprintf(TMP, sizeof(TMP), "%s/%s", app->asset_dir, "meshes/Duck.gltf"); - app->mesh = gs_gfxt_mesh_load_from_file(TMP, &(gs_gfxt_mesh_import_options_t){ + app->mesh = gs_gfxt_mesh_load_from_file(app->asset_dir, "meshes/Duck.gltf", &(gs_gfxt_mesh_import_options_t){ .layout = app->pip.mesh_layout, .size = gs_dyn_array_size(app->pip.mesh_layout) * sizeof(gs_gfxt_mesh_layout_t), .index_buffer_element_size = app->pip.desc.raster.index_buffer_element_size diff --git a/third_party/include/gs b/third_party/include/gs index cf60546..9561480 160000 --- a/third_party/include/gs +++ b/third_party/include/gs @@ -1 +1 @@ -Subproject commit cf60546189a1d51819979586351c2ed1332ad111 +Subproject commit 9561480ee43c5989dac62ed985a89e3180ea5a21