瀏覽代碼

Major revamp gltf (#1849)

* Added my own model and license to Raylib exclusively created by me and provided for use in the examples (and other projects if anyone decides to)

* Use animation vertices on initial load if possible.

* Added girl model to model example

* Revamped GLTF model loading as it was wrong by default. Also updated some comments.

GLTF models were loaded only by mesh but they should be loaded recursively by hierarchical nodes because tehre are some static node transformations that are to be applied to the vertices. It also resulted in more meshes being included in some models.

It is the correct way of loading GLTF and what is suggested in the official examples.

Currenlty limiting to only one scene but more can be included later.

* Refactored the new names and structure of extracted functions.

* Safer and easier read value.

* Made reading easier for accessor->bufferView->buffer in GLTF.

Now there is no need to check for supported types or anything.

* Correct inclusion of limits.h in the cases of MSVC based compilers vs the world

* Removed weird example file
Hristo Stamenov 4 年之前
父節點
當前提交
71700254b4
共有 4 個文件被更改,包括 557 次插入352 次删除
  1. 2 1
      examples/models/models_gltf_model.c
  2. 3 0
      examples/models/resources/gltf/LICENSE
  3. 二進制
      examples/models/resources/gltf/girl.glb
  4. 552 351
      src/models.c

+ 2 - 1
examples/models/models_gltf_model.c

@@ -21,7 +21,7 @@
 
 
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-#define MAX_MODELS  7
+#define MAX_MODELS  8
 
 
 int main(void)
 int main(void)
 {
 {
@@ -49,6 +49,7 @@ int main(void)
     model[4] = LoadModel("resources/gltf/AnimatedTriangle.gltf");
     model[4] = LoadModel("resources/gltf/AnimatedTriangle.gltf");
     model[5] = LoadModel("resources/gltf/AnimatedMorphCube.glb");
     model[5] = LoadModel("resources/gltf/AnimatedMorphCube.glb");
     model[6] = LoadModel("resources/gltf/vertex_colored_object.glb");
     model[6] = LoadModel("resources/gltf/vertex_colored_object.glb");
+    model[7] = LoadModel("resources/gltf/girl.glb");
 
 
     int currentModel = 0;
     int currentModel = 0;
 
 

+ 3 - 0
examples/models/resources/gltf/LICENSE

@@ -15,6 +15,9 @@ Animated Triangle model is licensed as CC0 Universal Public Domain
 Gearbox Assy model has been provided by Okino Computer Graphics, using Okino Polytrans Software.
 Gearbox Assy model has been provided by Okino Computer Graphics, using Okino Polytrans Software.
 no license information was provided
 no license information was provided
 
 
+Girl model has been provided by Hristo Stamenov (https://thatonegamedev.com/)
+and licensed as CC0 Universal Public Domain
+
 Check for details on CC0: https://creativecommons.org/publicdomain/zero/1.0/
 Check for details on CC0: https://creativecommons.org/publicdomain/zero/1.0/
 Check for details on CC4: http://creativecommons.org/licenses/by/4.0/
 Check for details on CC4: http://creativecommons.org/licenses/by/4.0/
 GLTF sample models for testing are taken from: https://github.com/KhronosGroup/glTF-Sample-Models/
 GLTF sample models for testing are taken from: https://github.com/KhronosGroup/glTF-Sample-Models/

二進制
examples/models/resources/gltf/girl.glb


文件差異過大導致無法顯示
+ 552 - 351
src/models.c


部分文件因文件數量過多而無法顯示