Skip to content

benanil/GLTF-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GLTF-Parser

Fast Gltf scene parser. one Cpp file only, mostly C code but some C++ 11 and C++ 14 features used.

No external dependency! C runtime is also haven't used in this project except stdio.h for file interactions
Matrix conversion code may require ARM neon or SSE4.1, but in case these instruction sets are not exist there is scalar versions as well.

Custom string and integer allocators have been used for performance, unlike other json parsers parser doesn't store strings or hash strings,
compares the values and stores the required values immediately that's why this is faster than other gltf parsers.

haven't tested mac and ios platform but Android, Windows and gcc, clang msvc compilers works fine.

no .glb support yet. only .gltf + .bin + image files

int main()
{
    SceneBundle sponzaScene;
    float scale = 1.2f;
    int parsed = ParseGLTF("SponzaGLTF/scene.gltf", &sponzaScene, scale);
    if (parsed == 0)
    {
        printf("gltf scene parsing error!: %s", ParsedSceneGetError(sponzaScene.error));
    }
    // use scene....
    FreeGLTFBuffers(&sponzaScene);
    FreeGltf(&sponzaScene);
}

for custom allocators define this macros before including GLTFParser.h

#ifndef AX_MALLOC
    #define AX_MALLOC(size) (malloc(size))
    #define AX_CALLOC(size) (calloc(size, 1))
    #define AX_FREE(ptr)    (free(ptr))
#endif

declare android_app somewhere if you are using with android platform.

android_app* g_android_app

animation and scene imported using this lib
Library has been used by my engine: Template Sane Program

Contributing

feel free to contribute

Contact

If you have any questions, feedback, or suggestions, feel free to reach out:

Email: anilcangulkaya7@gmail.com
Twitter: @anilcanglk12
GitHub: @benanil

Feel free to reach out regarding any inquiries related to the project.

About

Fast Gltf scene parser. one Cpp file only

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published