mirror of
https://github.com/syoyo/tinygltf.git
synced 2026-08-17 00:29:56 +00:00
Move tiny_gltf.h/.cc, tinygltf_json.h, json.hpp, stb_image*, loader_example.cc, examples/, wasm/, experimental/, legacy tests and fuzzers under attic/. TinyGLTF v3 C (tiny_gltf_v3.h/.c + tinygltf_json_c.h) is now the mainline: - CMakeLists.txt: v3 C tests only, installs only v3 files - tests/Makefile and Makefile: build/run the v3 C testers - test_runner.py: verifies v3 C tester output only (no v1 ground truth) - CI workflows: build and test v3 C only (GCC/Clang/MSVC/Meson/sanitizers) - README: v3 C quick start, testing, licenses; legacy moved to attic/
68 lines
1.1 KiB
C++
68 lines
1.1 KiB
C++
#include <stdio.h>
|
|
#define TINYGLTF_IMPLEMENTATION
|
|
#define TINYGLTF_NO_STB_IMAGE
|
|
#define TINYGLTF_NO_STB_IMAGE_WRITE
|
|
#include "tiny_gltf.h"
|
|
|
|
|
|
#ifdef __clang__
|
|
#pragma clang diagnostic ignored "-Weverything"
|
|
#endif
|
|
|
|
|
|
static int _allocs = 0;
|
|
|
|
void* operator new( size_t size )
|
|
{
|
|
++_allocs;
|
|
return malloc( size );
|
|
}
|
|
|
|
void* operator new[]( size_t size )
|
|
{
|
|
++_allocs;
|
|
return malloc( size );
|
|
}
|
|
|
|
void operator delete( void* memory )
|
|
{
|
|
--_allocs;
|
|
free( memory );
|
|
}
|
|
|
|
void operator delete( void* memory, size_t size )
|
|
{
|
|
--_allocs;
|
|
free( memory );
|
|
}
|
|
|
|
void operator delete[]( void* memory )
|
|
{
|
|
--_allocs;
|
|
free( memory );
|
|
}
|
|
|
|
void operator delete[]( void* memory, size_t size )
|
|
{
|
|
--_allocs;
|
|
free( memory );
|
|
}
|
|
|
|
void test()
|
|
{
|
|
tinygltf::TinyGLTF loader;
|
|
tinygltf::Model model;
|
|
|
|
bool status = loader.LoadASCIIFromFile( &model, NULL, NULL, "box.gltf" );
|
|
printf( "status: %d\n", status );
|
|
}
|
|
|
|
int main()
|
|
{
|
|
printf( "before: %d\n", _allocs );
|
|
test();
|
|
printf( "after: %d\n", _allocs );
|
|
return 0;
|
|
}
|
|
|