285 Commits

Author SHA1 Message Date
Syoyo Fujita
a472a3fa0f Add Set/Get SerializeDefaultValues method(W.I.P.) 2019-08-21 14:23:00 +09:00
Syoyo Fujita
1f160d5b8f
Merge pull request #195 from ux3d/fix/parse-int-as-double
(also) parse int as double
2019-08-20 19:33:20 +09:00
Syoyo Fujita
5150a46072 Merge branch 'master' of github.com:syoyo/tinygltf 2019-08-20 17:11:29 +09:00
Syoyo Fujita
cea69e37a5 Suppress clang warnings. 2019-08-20 17:10:30 +09:00
Benjamin Schmithüsen
c7e205be87 when parsing a number from an int, also set the 'real value' to the value 2019-08-19 16:16:43 +02:00
Selmar Kok
6dba6c6aac [emissiveFactor] correct default values 2019-08-19 11:23:31 +02:00
Selmar Kok
6df800d2b6 [emissiveFactor] fix inconsistency with baseColorFactor where default values were set only for baseColorFactor and not emissiveFactor 2019-08-19 11:05:28 +02:00
Selmar Kok
af5a5ef026 Merge branch 'master' of github.com:syoyo/tinygltf into animation_extension_properties 2019-08-16 17:54:14 +02:00
Benjamin Schmithüsen
74c3c10121 serialize node weights 2019-08-16 14:24:26 +02:00
Benjamin Schmithüsen
ad63bf748b parse node weights 2019-08-16 14:19:27 +02:00
Selmar Kok
5d43cf8e64 Merge branch 'master' of github.com:syoyo/tinygltf 2019-08-16 14:08:31 +02:00
Selmar Kok
4e2988eebd add extension property for Animation and AnimationChannel 2019-08-16 14:08:08 +02:00
Syoyo Fujita
ee179b2cb6 Set default value of minFilter and magFilter in Sampler to -1(unset), since glTF 2.0 spec does not declare default values for it.
Fixes #186
2019-08-16 13:11:30 +09:00
Syoyo Fujita
4ebd6368fb Fix inequality of texture index check when serializing texture of material.
Texture info was written even if it have invalid index(-1). Fixes #189
2019-08-15 12:25:50 +09:00
Patrick Härtl
d9a468bbb4 Fixed saving of alphaMode if not OPAQUE
Removed duplicated code for alphaCutoff
2019-08-14 14:14:07 +02:00
Benjamin Schmithüsen
1c84fc22a5 fix default value checks for serialization 2019-07-25 16:07:27 +02:00
Syoyo Fujita
150f243b1b Change the behavior of NUMBER value in Value class. NUMBER now reprents the value is either int or real(floating point). 2019-07-25 19:22:44 +09:00
Syoyo Fujita
046400b17f Now material is parsed as a struct with explicit parameter definitions.
Implement Material struct serialization.
2019-07-24 19:26:48 +09:00
Syoyo Fujita
89fd93f815 Introduce TextureInfo class(W.I.P.) 2019-07-23 22:37:06 +09:00
Syoyo Fujita
e940337796
Merge pull request #180 from ux3d/master
Explicitly use the correct constructor for empty object
2019-07-23 18:55:34 +09:00
Johan Bowald
52936a00e0 clang format 2019-07-17 09:06:45 +02:00
Benjamin Schmithüsen
f3ef880029 call json constructor explicitly 2019-07-16 17:07:45 +02:00
Johan Bowald
1af7c1d784 can write to streams 2019-07-16 15:56:18 +02:00
Benjamin Schmithüsen
051f4be2f1 serialize lights 2019-07-09 17:59:20 +02:00
Benjamin Schmithüsen
4557b6aa22 fix spot light parsingg 2019-07-09 16:55:55 +02:00
Benjamin Schmithüsen
b2d7d88dbc parse additional light properties and fix defaults 2019-07-09 16:32:42 +02:00
Benjamin Schmithüsen
b7ca7c9381 update lights to follow the KHR_lights_punctual extension 2019-07-08 18:04:24 +02:00
Arthur Brianville (Ybalrid)
2a9d9deb67 Applied clang-format 2019-07-05 00:30:47 +02:00
Arthur Brainville
8a98d98cd9 Add Paramter::TextureStrength(). Precise default values.
The default values on these methods as been set to what is described [here](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0?ts=4#normaltextureinfo) and [here](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0?ts=4#occlusiontextureinfo).

This is to keep consistent with the API behavior from #144
2019-07-05 00:30:20 +02:00
Christophe
820ede87db Adding texture scale reading (for normal maps) + asset copyright and texture names to the export 2019-07-04 15:21:21 +09:00
Syoyo Fujita
d6b0d0a61f Explicitly define copy constructor and copy assignment operator for Model an Node. 2019-06-29 17:31:13 +09:00
Arthur Brainville (Ybalrid)
dab0daaedf Material names are stored once in material.name, then duplicated in "additionalValues"
This patch prevent this duplication
2019-06-23 21:50:10 +02:00
Arthur Brainville (Ybalrid)
811e1d3899 Fix C4267 warning (size_t -> int) convertion 2019-06-15 07:32:38 +02:00
Syoyo Fujita
f65e06c5ca
Merge pull request #169 from Ybalrid/remove_mesh_targets
Remove Mesh::targets, as targets only exists inside `Primitive`
2019-05-26 16:23:46 +09:00
Arthur Brianville (Ybalrid)
f29ae1a653 Remove Mesh::targets, as targets only exists inside Primitive 2019-05-25 22:30:55 +02:00
Syoyo Fujita
3bf16e4be5 Merge branch 'master' of github.com:syoyo/tinygltf 2019-05-16 16:55:09 +09:00
Syoyo Fujita
fbc4295770 Remove CATMULLROMSPLINE, which was removed in the final glTF 2.0 spec. 2019-05-16 16:54:28 +09:00
Benjamin Schmithüsen
d02ad0dede add REQUIRE_VERSION to gltf validation and use it as default instead of REQUIRE_ALL 2019-05-02 14:44:20 +02:00
rainliang000
62be8d04cf
if image.uri empty, should use bufferview
if uri empty, shoud use mimeType and bufferview
2019-04-29 09:54:27 +08:00
Jeff McGlynn
19b806e052 Parse integers directly instead of casting doubles
When parsing numeric values as doubles, its possible for users to
specify values that cannot be converted to integers, such as Inf, NaN,
and extremes such as 1e100.  If this value is received, and then cast to
an int, it is undefined behavior, which trips ubsan when running
tinygltf under a fuzzer.

Instead of parsing integral values as doubles, use nlohmann/json's
built-in support to parse integer and unsigned values directly, with
.is_number_integer() and .is_number_unsigned().

Add ParseIntegerProperty, ParseUnsignedProperty, and
ParseIntegerArrayProperty helpers that allow parsing directly to
int/uint values and update code to use them when appropriate.
2019-04-26 17:20:50 -07:00
Jeff McGlynn
8915252407 Add checks for boundary conditions for malformed glTF files
When loading untrusted glTF files, ideally an error should be returned
if the file is malformed instead of an exception/crash.  Add additional
validation for crashes found when running tinygltf under a fuzzer, and
add test cases to confirm:

1. Validate that the primitive indices value is within the
   model->accessors bounds before dereferencing.
2. Validate that the accessors bufferView index if valid.
3. Validate that the buffer's index is valid when parsing images.
4. For glb files, validate that the overall length is within the
   provided input buffer.
2019-04-25 16:51:09 -07:00
Selmar
a63cc6373d
correct Value::Equals mistake
a missing exclamation mark... ^^
2019-04-16 16:57:43 +02:00
Fabien Freling
9056aee823 Serialize accessor 'normalized' attribute. 2019-03-21 17:06:22 +01:00
Syoyo Fujita
ca56f726d6 Merge branch '16bit-lodepng' 2019-03-07 21:04:25 +09:00
Syoyo Fujita
e8a46c4e1d Update README.
Check bit depth when saving image as PNG.
2019-03-07 20:50:58 +09:00
Arthur Brainville (Ybalrid)
9223d3133a Ran clang-format on tiny_gltf.h 2019-03-06 14:00:56 +00:00
Arthur Brainville (Ybalrid)
7e9f734d73 Parse sparse accessors 2019-03-06 12:27:23 +00:00
Arthur Brainville (Ybalrid)
9d86405d3d Fix accessor ctor 2019-03-06 11:33:30 +00:00
Arthur Brainville (Ybalrid)
1ccb4ff580 added sparse structure to accessors 2019-03-06 11:30:00 +01:00
Syoyo Fujita
7bdfed3bec Add lodepng to save 16bit PNG.
Suppress clang/gcc warnings.
2019-03-03 17:04:49 +09:00