diff --git a/games/devtest/mods/gltf/LICENSE.md b/games/devtest/mods/gltf/LICENSE.md index 6c3828a4a..9c6b1185c 100644 --- a/games/devtest/mods/gltf/LICENSE.md +++ b/games/devtest/mods/gltf/LICENSE.md @@ -12,3 +12,6 @@ The glTF test models (and corresponding textures) in this mod are all licensed f * Minimal triangle, triangle without indices (`gltf_minimal_triangle.gltf`, `gltf_triangle_without_indices.gltf`) * From [the glTF sample model collection](https://github.com/KhronosGroup/glTF-Sample-Models) * Licensed under CC0 / public domain + + +Morph stuff is from https://github.com/KhronosGroup/glTF-Sample-Assets/ \ No newline at end of file diff --git a/games/devtest/mods/gltf/init.lua b/games/devtest/mods/gltf/init.lua index bcf18c327..591b875cb 100644 --- a/games/devtest/mods/gltf/init.lua +++ b/games/devtest/mods/gltf/init.lua @@ -40,6 +40,32 @@ core.register_entity("gltf:morph", { }, }) +core.register_entity("gltf:morph_animated", { + initial_properties = { + visual = "mesh", + mesh = "gltf_morph_animated.glb", + textures = {}, + backface_culling = false, + visual_size = vector.new(100, 100, 100), + }, + on_activate = function(self) + self.object:set_animation({x = 0, y = 5}, 1) + end +}) + +core.register_entity("gltf:morph_animated2", { + initial_properties = { + visual = "mesh", + mesh = "gltf_morph_animated2.gltf", + textures = {}, + backface_culling = false, + visual_size = vector.new(1, 1, 1), + }, + on_activate = function(self) + self.object:set_animation({x = 0, y = 5}, 1) + end +}) + core.register_entity("gltf:spider_animated", { initial_properties = { visual = "mesh", diff --git a/games/devtest/mods/gltf/models/gltf_morph_animated.glb b/games/devtest/mods/gltf/models/gltf_morph_animated.glb new file mode 100644 index 000000000..219d2ac52 Binary files /dev/null and b/games/devtest/mods/gltf/models/gltf_morph_animated.glb differ diff --git a/games/devtest/mods/gltf/models/gltf_morph_animated2.gltf b/games/devtest/mods/gltf/models/gltf_morph_animated2.gltf new file mode 100644 index 000000000..3b6efd8d0 --- /dev/null +++ b/games/devtest/mods/gltf/models/gltf_morph_animated2.gltf @@ -0,0 +1,192 @@ +{ + "scene" : 0, + "scenes":[ + { + "nodes":[ + 0 + ] + } + ], + "nodes":[ + { + "mesh":0 + } + ], + "meshes":[ + { + "primitives":[ + { + "attributes":{ + "POSITION":1 + }, + "targets":[ + { + "POSITION":2 + }, + { + "POSITION":3 + } + ], + "indices":0 + } + ], + "weights":[ + 0.5, + 0.5 + ] + } + ], + + "animations":[ + { + "samplers":[ + { + "input":4, + "interpolation":"LINEAR", + "output":5 + } + ], + "channels":[ + { + "sampler":0, + "target":{ + "node":0, + "path":"weights" + } + } + ] + } + ], + + "buffers":[ + { + "uri":"data:application/gltf-buffer;base64,AAABAAIAAAAAAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAAA/AAAAPwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIC/AACAPwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIA/AACAPwAAAAA=", + "byteLength":116 + }, + { + "uri":"data:application/gltf-buffer;base64,AAAAAAAAgD8AAABAAABAQAAAgEAAAAAAAAAAAAAAAAAAAIA/AACAPwAAgD8AAIA/AAAAAAAAAAAAAAAA", + "byteLength":60 + } + ], + "bufferViews":[ + { + "buffer":0, + "byteOffset":0, + "byteLength":6, + "target":34963 + }, + { + "buffer":0, + "byteOffset":8, + "byteLength":108, + "byteStride":12, + "target":34962 + }, + { + "buffer":1, + "byteOffset":0, + "byteLength":20 + }, + { + "buffer":1, + "byteOffset":20, + "byteLength":40 + } + ], + "accessors":[ + { + "bufferView":0, + "byteOffset":0, + "componentType":5123, + "count":3, + "type":"SCALAR", + "max":[ + 2 + ], + "min":[ + 0 + ] + }, + { + "bufferView":1, + "byteOffset":0, + "componentType":5126, + "count":3, + "type":"VEC3", + "max":[ + 1.0, + 0.5, + 0.0 + ], + "min":[ + 0.0, + 0.0, + 0.0 + ] + }, + { + "bufferView":1, + "byteOffset":36, + "componentType":5126, + "count":3, + "type":"VEC3", + "max":[ + 0.0, + 1.0, + 0.0 + ], + "min":[ + -1.0, + 0.0, + 0.0 + ] + }, + { + "bufferView":1, + "byteOffset":72, + "componentType":5126, + "count":3, + "type":"VEC3", + "max":[ + 1.0, + 1.0, + 0.0 + ], + "min":[ + 0.0, + 0.0, + 0.0 + ] + }, + { + "bufferView":2, + "byteOffset":0, + "componentType":5126, + "count":5, + "type":"SCALAR", + "max":[ + 4.0 + ], + "min":[ + 0.0 + ] + }, + { + "bufferView":3, + "byteOffset":0, + "componentType":5126, + "count":10, + "type":"SCALAR", + "max":[ + 1.0 + ], + "min":[ + 0.0 + ] + } + ], + + "asset":{ + "version":"2.0" + } +} \ No newline at end of file