Commit Graph

402 Commits

Author SHA1 Message Date
Syoyo Fujita
ffa2c665f9 Allow zero-sized BIN chunk. Fixes #440 2024-01-24 05:43:27 +09:00
rhiskey
cf55186b0b Update tiny_gltf.h
Removed `#undef` 
and used the @syoyo method:

https://github.com/syoyo/tinygltf/pull/467#issuecomment-1838703699
2023-12-04 17:11:59 +03:00
rhiskey
808ab042e9 Update tiny_gltf.h
Fixed `Windows.h` MINMAX error and reverted to original numeric limits of type `uint32_t`
2023-12-04 16:57:36 +03:00
rhiskey
aa2fb04ab7 Merge branch 'syoyo:release' into release 2023-12-04 16:55:16 +03:00
Syoyo Fujita
354c1146ee Fix possible nullptr dereferencing.
Add missing `return false`
2023-12-04 22:50:49 +09:00
rhiskey
46fd11cef1 Update tiny_gltf.h
Fix max size of `header_and_json_size` limit.
In case of 4GB will check ` sizeof(uint64_t)` insted deprecated max
2023-12-04 14:21:06 +03:00
Thomas Gamper
cef28f1791 Fix #464
tinygltf.h - serialize empty scenes as empty json objects; tester.cc - ad respective test case, bring test cases in correct order, tag test case for light index with correct issue number and fix it to compare to deserialozed model
2023-11-23 15:14:46 +01:00
Thomas Gamper
46a1e426d1 fix #457
tiny_gltf.h - access correct json object when serializing a light, this fixes an assert and causes us to serialze the light index properly; tester.cc - add respective testcase
2023-11-23 14:13:12 +01:00
Thomas Gamper
439d103665 fix #457
tiny_gltf.h - make sure to serialize null node as empty object; tester.cc - add respective test case
2023-11-23 11:59:18 +01:00
Thomas Gamper
d66d9d291b fix #459
tiny_gltf.h - use member initialization
2023-11-22 15:59:13 +01:00
Thomas Gamper
925d783330 fix #459
tiny_gltf.h - properly initialise emissiveFactor; tests/tester.cc - add test case
2023-11-22 14:17:46 +01:00
haroonq
8036d6a00f Allow BufferView indices to be unspecified.
Allow BufferView indices for element array buffers to be unspecified to support some extensions.

Note that this is similar to how invalid array buffers are handled in order to support, for example, sparse morph targets.
2023-10-09 10:30:25 +00:00
Nyall Dawson
1fc0f8056d Fix incorrect component type shown in warning message 2023-09-12 08:46:14 +10:00
Syoyo Fujita
d7449cc0d6 Remove unused code. Fixes #454 2023-09-07 22:03:46 +09:00
Nyall Dawson
7db1b126b8 Fix build with draco 2023-09-07 08:20:28 +10:00
Nyall Dawson
e387e3a221 Relax bin chunk end alignment check in permissive mode 2023-09-07 07:08:26 +10:00
Nyall Dawson
7f514ca27b Fix msvc build -- STRICT is a msvc macro name 2023-09-07 06:28:37 +10:00
Nyall Dawson
2aad0ce782 Fix warning when building without draco support 2023-09-03 09:04:56 +10:00
Syoyo Fujita
9977c05b4b Merge pull request #449 from emimvi/consistent_byteOffset
Always use size_t for byte offsets
2023-09-03 02:20:35 +09:00
emimvi
8b24ce8f3a Consistently use size_t for all byteOffset's 2023-09-02 09:39:53 +02:00
Nyall Dawson
3cf58eef43 When in permissive mode, handle the situation where the
recorded component type does not match the required type
for the actual number of stored points

This situation arises when decoding certain malformed files, most
notably it's seen in glb tiles from Google Earth's 3d tileset.

It's a port of the workaround used by Cesium native here:

d9172461e2/CesiumGltfReader/src/decodeDraco.cpp (L101)
2023-09-02 10:16:04 +10:00
emimvi
7dc9766ce1 Serialize byteOffset as size_t, avoiding cast
Fixes silently writing an overflowed int in the output file.
2023-09-02 00:11:41 +02:00
Nyall Dawson
285e87211c Add method to set parsing strictness 2023-08-28 12:56:09 +10:00
Nyall Dawson
e65694cc7d Raise a warning when encountering emissiveFactor with array length
of 4 instead of aborting the model loading
2023-08-28 12:46:44 +10:00
Nyall Dawson
6c6e131792 Fix misleading error message
Avoids a confusing "Must have 4 bytes or more bytes, but got 4."
error.
2023-08-24 11:48:09 +10:00
Syoyo Fujita
737a0b57c6 Merge pull request #433 from dyollb/modernize
Modernize
2023-07-11 19:43:53 +09:00
KUDELSKI Dimitri
ebbcdf999f Fix issue when serializing extensions of a primitive 2023-07-10 15:13:09 +02:00
R.E. Kovalev
7979314811 MinGW _wfopen_s fix 2023-07-05 09:11:57 +03:00
Bryn Lloyd
879cf43bab cppcoreguidelines-prefer-member-initializer 2023-06-21 22:30:14 +02:00
Bryn Lloyd
0817693edd modernize-use-equals-default 2023-06-21 22:15:49 +02:00
Bryn Lloyd
4f9e144547 readability-redundant-string-init 2023-06-21 18:42:24 +02:00
Bryn Lloyd
210d56b07f modernize-use-default-member-init 2023-06-21 18:40:18 +02:00
Syoyo Fujita
927457b104 Initialize light and emitter members. Fixes #431
Include `light` and `emitter` comparison in Node::operator==()
2023-06-19 21:52:13 +09:00
Baranob_Ilya
f082c5d6b3 Added parsing and serializing of audio emitters for scene (global sources) 2023-06-12 13:35:05 +04:00
Baranob_Ilya
d5c7d72786 Forgot to add KHR_audio to used extensions 2023-06-12 12:34:34 +04:00
Baranob_Ilya
b1309d47a8 Added KHR_audio extension. Parsing and serialization.
Added KHR_audio extension parsing and serializing. Only for ascii
2023-06-12 10:43:52 +04:00
David Siegel
75bf1532ee clean up 2023-06-07 15:35:35 +02:00
David Siegel
29107bbcc6 fix syntax error 2023-06-07 15:30:02 +02:00
David Siegel
9bbc79e27e KHR_lights_punctual: Serialize node light refs
This is surprisingly involved:

1. Add non-const json iterators, FindMember(…) and GetValue(…)
2. Add json utilities IsEmpty(…) and Erase(…)
3. Serialize the property and clean up
2023-06-07 15:18:38 +02:00
Syoyo Fujita
2dfc7eb661 Merge pull request #422 from agnat/fix/add_missing_extras_and_extensions
Add missing extras and extensions fields
2023-06-07 02:47:59 +09:00
Syoyo Fujita
3246fa4d8c Merge pull request #423 from agnat/finish_KHR_lights_puncutal
KHR_lights_punctual: parse light source references from scene nodes
2023-06-06 23:12:50 +09:00
David Siegel
db9ec34b4e refactor extension and extra serialization
Add missing serialization:

accessor.extensions
accessor.sparse.extensions
accessor.sparse.extras
accessor.sparse.indices.extensions
accessor.sparse.indices.extras
accessor.sparse.values.extensions
accessor.sparse.values.extras
animation.channel.target.extras
animation.sampler.extensions
buffer.extensions
bufferView.extensions
sampler.extensions
camera.orthographic.extensions
camera.perspective.extensions
skin.extras
skin.extensions
2023-06-06 15:40:29 +02:00
David Siegel
a782975b74 rewrite ForEachInArray as a simple C++11 function
no need for std::function here. A free function with an unspecified callback will do nicely.
2023-06-06 15:36:07 +02:00
David Siegel
41c3ed9b0e fix: add missing nullptr check 2023-06-06 15:31:58 +02:00
David Siegel
8c3bf572db parse light source references 2023-06-06 06:18:14 +02:00
David Siegel
b875b65987 Add missing extras and extensions fields
Handle extras and extensions in nested “sub-objects”:

animation.channel.target.extras
accessor.sparse.extras
accessor.sparse.extensions
accessor.sparse.indices.extras
accessor.sparse.indices.extensions
accessor.sparse.values.extras
accessor.sparse.values.extensions
2023-06-06 00:07:37 +02:00
David Siegel
6e768f27c9 remove duplicate code
use a function to parse extras and extensions
2023-06-06 00:07:37 +02:00
David Siegel
0037b05e18 fix warnings: unused variable 2023-06-06 00:07:37 +02:00
Syoyo Fujita
c0cde4de4a Simplify version comment in tiny_gltf.h
Remove wuffs code(which was accidently adde to `release` branch)
2023-06-04 19:07:00 +09:00
Syoyo Fujita
d96d324975 Prevent duplicated key generation when serializing lights + RapidJSON backend. Fixes #420 2023-06-04 05:45:24 +09:00