20 Commits

Author SHA1 Message Date
Lars Müller
036b40a9d8 Fix gltf static mesh loading issues (#14)
* Support u8 / u32 indices

* Skip primitives without vertices

* Add support for non-indexed geometry & skipping primitives

* Fix possible memory leak on error

* Use SSkinnedMesh

* Check indices

* Properly mirror node hierarchy

* Update .gitignore

* Reorder includes

* Add some throws for logic errors

* Fix non-indexed geometry winding order, add unit test

* Address code review comments

* Add matrix transform unit test
2024-04-18 07:37:36 -05:00
Lars Müller
0faf1320c5 Move from tinygltf to tiniergltf (#13)
* Remove tinygltf

* Integrate tiniergltf

* Update build.yml to include jsoncpp

* Namespace target

* Undo noexcept removal, readd move constructor

* Remove debug throw

* Remove now obsolete build code

* Bump CMake minimum version to 3.12

* Fix oops

* Remove unnecessary install/export

* Remove tinygltf from Config.cmake.in

* Take inspiration from Minetest's FindJson.cmake

* Move tiniergltf to separate repo

* CI: Install git

* Bump tiniergltf version (obtain jsoncpp via FetchContent)

* Remove jsoncpp from build dependency list
2024-04-18 07:37:10 -05:00
jordan4ibanez
777ec9d130 Fix getScale()
* Fix getScale()

* Create blender_cube_scaled.gltf

* Add scaling unit test

* Remove comment

* Undo github's silent reversion of 1,1,1
2024-04-18 07:34:58 -05:00
jordan4ibanez
f8f10248b4 Package glTF spec docs with comments
* git --CRUSH

And try to make this line the same

Now undo my gitignore nonsense

Hail mary

Move these functions to the top

More documentation

Add some serious documentation

Move this to the top

Readability & documentation

Add some documentation

Add spec documentation

Make this more more complex to make it less complex

Move this up & document

Make this more readable for me

Document and make this more readable

Move this out of the way and document it

Update CGLTFMeshFileLoader.cpp

Documentation

Document

Update CGLTFMeshFileLoader.cpp

Document

Move entry point to bottom

Part 5

Part 4

Part 3

Part 2

Allman -> OTBS (readability for me)

Consolidate

Remove unneeded function

These files are annoying

* fix #1

* fix 2

* indentation

* Remove redundant function

* Remove redundant function

* add trailing new line

* Stop an interesting build error with a template

* Code reduction

* Document bytestride

* Add more detail to chain hierarchy

* Dump this huge vscode thing in here for no reason

* Document 3 more functions

* Document copyTcoords

* Dump in (incorrect) scale documentation for node

* Add a readable description

* Fix incorrect getScale

* Add update based on context of function

* Add documentation, fix another one

* Document another

* Document another

* And document another

* Document this nice function

* Bolt in some future use documentation

* Add highlighting for IDE

* Just shovel on more docs to this

* 2 more comments

* I think that's all of them

* Add some wild west debuggin

* And then update this comment

* Bolt on isAccessorNormalized()

* Bolt in an absolute hack job to test

* Now clean this mess up and give josiah ref material

* Fix Josiah's request for scale

* Fix josiah request

* Fix josiah request .vscode

Fix indentation

Fix indentation

Fix indentation

* Unfix getScale()

again
2024-04-18 07:34:49 -05:00
JosiahWI
95a4030b50 Handle byte stride on vertex buffers
Vertex buffers (and only vertex buffers) may have a byte stride
specified.
2024-04-18 07:34:03 -05:00
JosiahWI
53c92b0b1d Refactor vertex loading 2024-04-18 07:33:37 -05:00
JosiahWI
0896aae906 Extract loadPrimitives method from createMesh 2024-04-18 07:33:36 -05:00
JosiahWI
3930bd8c85 Rename ModelParser to MeshExtractor 2024-04-18 07:32:53 -05:00
JosiahWI
0f73c30a1f Mark ModelParser constructors noexcept 2024-04-18 07:31:37 -05:00
JosiahWI
22f6012d2e Document readVec3DF and getScale 2024-04-18 07:30:47 -05:00
JosiahWI
fd41ee02df Add const to numeric parameters 2024-04-18 07:28:34 -05:00
JosiahWI
60a5f5746f Return vector from getVertices 2024-04-18 07:28:03 -05:00
JosiahWI
ea22b642c1 Refactor getIndices() 2024-04-18 07:27:42 -05:00
JosiahWI
50da04297f Add r-value reference constructor to ModelParser 2024-04-18 07:27:20 -05:00
JosiahWI
85fdf95afa Fix function declaration indents 2024-04-18 07:26:48 -05:00
JosiahWI
79bfd8afbe Move parsing methods into ModelParser class 2024-04-18 07:26:11 -05:00
JosiahWI
7e0d57b4fe Reorganize CGLTFMeshFileLoader help functions
I moved them all into static methods and changed the ordering in the
source file so that createMesh() would be close to the top of the file.
I also corrected formatting in some of the function declarations since I
had to change them anyway.
2024-04-18 07:25:34 -05:00
JosiahWI
eaebd34c4e Remove unneeded tinygltf include from header 2024-04-18 07:24:01 -05:00
JosiahWI
a20ac715ce Load vertex coordinates from glTF buffer 2024-04-18 07:20:22 -05:00
JosiahWI
21c3c16557 Test invalid JSON
Also converted all .cpp and .h line endings to CRLF in this commit.
2024-04-18 07:19:30 -05:00