Benjamin Schmithüsen
dab2402cac
add REQUIRE_VERSION to gltf validation and use it as default instead of REQUIRE_ALL
2019-05-02 14:44:20 +02:00
rainliang000
8e0a60213e
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
469e039169
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
38657337fc
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
2d5f6dcbd7
correct Value::Equals mistake
...
a missing exclamation mark... ^^
2019-04-16 16:57:43 +02:00
Fabien Freling
35ac2aea2c
Serialize accessor 'normalized' attribute.
2019-03-21 17:06:22 +01:00
Syoyo Fujita
11656a589f
Merge branch '16bit-lodepng'
2019-03-07 21:04:25 +09:00
Syoyo Fujita
0f2506725f
Update README.
...
Check bit depth when saving image as PNG.
2019-03-07 20:50:58 +09:00
Arthur Brainville (Ybalrid)
fb43948c7f
Ran clang-format on tiny_gltf.h
2019-03-06 14:00:56 +00:00
Arthur Brainville (Ybalrid)
e95d35c7b2
Parse sparse accessors
2019-03-06 12:27:23 +00:00
Arthur Brainville (Ybalrid)
83f0a1e1fe
Fix accessor ctor
2019-03-06 11:33:30 +00:00
Arthur Brainville (Ybalrid)
edf81ce458
added sparse structure to accessors
2019-03-06 11:30:00 +01:00
Syoyo Fujita
f5dcd85c34
Add lodepng to save 16bit PNG.
...
Suppress clang/gcc warnings.
2019-03-03 17:04:49 +09:00
Syoyo Fujita
deff077560
Merge pull request #146 from WARP-LAB/master
...
Fix for when json and stb is aready used in project
2019-03-03 15:31:09 +09:00
kroko
640898750b
rename TINYGLTF_BYPASS_INCLUDE_x to TINYGLTF_NO_INCLUDE_x
2019-03-03 08:28:49 +02:00
kroko
12fc2afc9f
Fix for when json and stb is aready used in project v2
2019-03-03 01:28:45 +02:00
kroko
3fadc0a664
Fix for when json and stb is aready used in project
2019-03-03 01:11:31 +02:00
Arthur Brainville (Ybalrid)
025305fa5d
Fixed wrong metadata in case 16bit image wasn't actually loaded
...
The fallback to 8 bit would have been broken.
2019-03-02 22:03:34 +01:00
Arthur Brainville (Ybalrid)
f39a8f2cbe
16bit images are 16bit images: added Image::bits and Image::pixel_type
2019-03-02 22:00:48 +01:00
Sascha Willems
bd2028c74c
Added function to easily access texture coordinate set index on a texture parameter
2019-02-23 21:15:45 +01:00
Syoyo Fujita
42819e746a
Define WIN32_LEAN_AND_MEAN to save the number of including files.
2019-02-19 21:36:32 +09:00
Syoyo Fujita
c8d1ecb33a
Define NOMINMAX to avoid defining MIN/MAX macros on Windows. Without defining NOMINMAX, MIN/MAX macro would affect other header/c++ files. Fixes #143
2019-02-19 16:03:23 +09:00
Evan Birenbaum
e027b5c2f7
Change AnimationSampler::interpolation to a non-required field. The spec states to default to LINEAR when not present.
2019-02-14 13:30:57 -08:00
timmmeh
5f0a6aab29
fix compile
2019-01-31 11:46:19 -08:00
timmmeh
5a0168069c
Adding default values for min and mag filter.
2019-01-30 18:38:46 -08:00
Thomas Tissot
6efee92d47
Add line strip primitive mode define
...
This small commit adds the `TINYGLTF_MODE_LINE_STRIP` primitive mode
define whose value is set to `3` as per the GLTF 2.0 specification.
2019-01-30 13:10:51 +01:00
Alexander Wood
fe11dc418d
Updates to draco decoding:
...
- When injecting draco decoded meshes into accessor data, update count to match the optimized and decoded draco mesh
- accessor.componentType is now used for extraction of decoded draco meshes.
Fixes #135
2019-01-26 08:58:45 -05:00
Alex Wood
eb07083296
Looks like I'm colliding with work by syoyo. Only difference so far appears to be our macro name.
2019-01-24 15:45:16 -05:00
Alex Wood
5fd4d4d662
Merge branch 'draco' of https://github.com/abwood/tinygltf into draco
2019-01-24 15:40:28 -05:00
Alex Wood
07a015d6a2
Initial support for draco mesh compression. In this PR, we establish that draco is a dependency built external to tinygltf, which breaks from the current tradition of header only dependencies. For that reason, this feature is hidden behind a #define TINYGLTF_ENABLE_DRACO and requires developers to explicitly opt-in for draco support.
...
In this change, tinygltf any primitive using draco compression will:
If indices are specified
1) Decode the index buffer using draco, creating a new buffer and bufferview, adding to Model::bufferViews and Model::buffer collections
2) Update the primitive's accessor id to reference this new decoded bufferview.
For each attribute semantic specified by the draco extension
1) Decode the vertex buffer using draco, creating a new buffer and bufferview, adding to Model::bufferViews and Model::buffer collections
2) Update the primitive's accessor id to reference this new decoded bufferview.
2019-01-24 15:38:16 -05:00
Syoyo Fujita
446b3147e0
Begin supporting draco.
2019-01-19 03:03:22 +09:00
Syoyo Fujita
207b7b3ebd
Show more expressive messages when parsing image.
2019-01-06 18:55:57 +09:00
Sascha Willems
5278dfff58
Added new feature for loading all gltf related files (including textures, binaries, etc.) from assets packaged with an Android app
2018-12-28 20:53:41 +01:00
Peter Le Bek
8d23e8c6aa
Fix incorrect index into bufferViews array
2018-12-08 16:04:42 -08:00
viperscape
4deeaa1a03
find missing bufferView target types and fill them in
2018-12-05 14:11:01 -05:00
Selmar Kok
126fee11b5
Set a default for sampler.wrapR, because it was serializing an uninitialized value
2018-12-04 19:55:56 +01:00
Selmar Kok
bbaa65ce93
Fix prettyprint to really not print pretty
2018-11-30 18:01:31 +01:00
Unknown
1983cfc536
Removed unreachable code and fixed ambiguity warning.
2018-11-15 18:36:59 +00:00
Syoyo Fujita
c04e762b64
Merge branch 'master' of github.com:syoyo/tinygltf
2018-11-10 20:08:02 +09:00
Syoyo Fujita
8f25f8400c
Merge branch 'master' of https://github.com/loomai/tinygltf into loomai-master
2018-11-10 20:07:15 +09:00
Selmar Kok
adc900a97a
Merge remote-tracking branch 'origin/master' into serialization_fixes
2018-11-09 10:34:55 +01:00
Selmar Kok
f273efe4e9
Fix missing serialization: sampler.wrapR
2018-11-09 10:34:39 +01:00
Johan Bowald
eb14d8ea25
fixed a reference error which cause an error when writing images to disk
2018-11-06 14:28:20 +01:00
Syoyo Fujita
a0617fd244
Merge branch 'master' of github.com:syoyo/tinygltf
2018-11-05 13:33:27 +09:00
Syoyo Fujita
67faff5842
Fix logic error. Fixes #104
2018-11-05 13:32:43 +09:00
Selmar Kok
eae3ba05df
fail serialization if a buffer file fails to be written (e.g. due to access rights)
2018-10-25 16:45:49 +02:00
Selmar Kok
863fd440e3
fix an issue when serializing an empty extension object would serialize as type null (and thus deserialize as type null, causing it to be ignored)
2018-10-10 18:10:58 +02:00
Selmar Kok
2c0c4fc62d
// pretty print as optional parameter, default true
...
// serialize name instead of type for camera.name
// create empy Value::Object if extension value parsing failed
2018-10-08 16:20:43 +02:00
Syoyo Fujita
48b6826198
Serialize extension with empty object. Fixes #97
...
Use pretty printing JSON when serializing for the readability.
2018-10-08 21:18:33 +09:00
Selmar Kok
7f13e3e912
tabs to spaces
2018-10-05 16:30:50 +02:00