Commit Graph

57 Commits (47c8971b526f28b4a1ab6d21bbb9c0b88424be82)

Author SHA1 Message Date
Alexis Breust 9b5df71150 Not using external bin file for glb2 2018-01-05 10:28:12 +01:00
Alexis Breust 32e5e3a576 Forgot to uncomment isBinary 2017-12-15 15:40:31 +01:00
Alexis Breust 31a4ccaebb Added support for generating glb2 (binary glTF 2) 2017-12-14 16:11:12 +01:00
Alexandre Avenel eb452b28a2 Fix warning on MSVC14 2017-11-25 11:38:12 +01:00
Patrick Dähne a05d74a281 [glTF2] Moved byteStride from accessor to bufferView 2017-11-20 19:01:28 +01:00
Kim Kulling 7db10022e9 closes https://github.com/assimp/assimp/issues/1513: fix assimp for cross compile for android 2017-11-15 21:26:25 +01:00
Kim Kulling de1ec4ee5d
Merge branch 'master' into gltf2-mesh-export-fix 2017-11-10 19:07:46 +01:00
Unknown 12dbbd4ce9 Misc. typos
Some are doxy comments, some are just trivial source comment typos. 
Found using `codespell -q 3 --skip="./contrib" -I ../assimp-whitelist.txt`
whereby whitelist contained:
```
childs
iff
lod
nto
ot
whitespaces
```
2017-11-09 17:19:26 -05:00
Daniel Hritzkiv 9ec117d0bc
Fix export of deleted meshes; Add LazyDict::Remove method
When I was merging a node’s multiple meshes into that node’s first mesh’s primitives, I was deleting the merged meshes from the node.

However, I wasn’t deleting the merged meshes from the mAsset->meshes Dict, causing the gltf2 export to contain extra unreferenced meshes and duplicate primitives.

This new code adds a new method to LazyDict, which removes the object from it, taking care to update indexes of the subsequent objects. This change also requires that `Ref`s of `Mesh`es (stored in node->meshes) have their indexes updated.
2017-11-08 18:31:32 -05:00
Kim Kulling d279a3cc02
Merge branch 'master' into fix_trivial_warnings 2017-11-03 10:35:02 +01:00
Thomas Lemaire 5b76a31485 fix trivial warnings
mainly unused parameter and unused function
some parameters are indeed used in a debug built, I used the
(void)(param) trick
warnings reported by clang 4
2017-11-02 11:13:52 +01:00
Daniel Hritzkiv 8b73ec7541
Fix shininess to roughness conversion; Add comments
Was accidentally flipping to value (1 - x) twice, thus negating the effect.
2017-10-26 11:33:33 -04:00
Daniel Hritzkiv 6e88838602
powf -> pow
Fix build errors on linux
2017-10-19 16:21:29 -04:00
Daniel Hritzkiv 40147d253d
Prefer “BLEND” over “MASK” as an alphaMode default
“BLEND” is a much nicer alphaMode value (if the hardware supports it – not a steep requirement) than “MASK” as mask is either fully opaque or fully transparent, depending on the alphaCutoff. This matches many other converters’ alphaMode default.
2017-10-19 16:21:29 -04:00
Daniel Hritzkiv 89358458f0
Approximate specularity / glossiness in metallicRoughness materials
Before, models (of traditional lighting models) with specularity/glossiness would be completely flat when exported to metallicRoughness. These changes approximate glossiness (as an inverse of roughness, with specular intensity as a multiplier) both reading from gltf2 and writing to gltf2.
2017-10-19 16:21:29 -04:00
Daniel Hritzkiv a898c1f2d1
SpecularFactor import and export improvements
The changes here (which only apply to reading from or writing to pbrSpecularGlossiness) will:

- store and read specular color on `AI_MATKEY_COLOR_SPECULAR ` rather than `AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS_SPECULAR_FACTOR`
- store and read specular texture from `aiTextureType_SPECULAR` rather than `AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS_SPECULARGLOSSINESS_TEXTURE`. Even though pbrSG’s specularGlossiness texture uses the alpha channel for glossiness, it will still work well enough with just the RGB channels of the image
2017-10-19 16:21:29 -04:00
Daniel Hritzkiv c71790c78d
Diffuse color and diffuse texture import and export improvements
These changes do a better of importing and exporting baseColor colors and textures, as well as diffuse colors and textures (in the case of pbrSpecularGlossiness)

- baseColorFactor will be stored on both `$clr.diffuse` and `$mat.gltf.pbrMetallicRoughness.baseColorFactor`, and will be extracted from `$mat.gltf.pbrMetallicRoughness.baseColorFactor` first, and falling back to `$clr.diffuse`. The behaviour for baseColorTexture is similar
- pbrSG’s diffuseFactor will now only be store on `$clr.diffuse` (overwriting any previous assignments to `$clr.diffuse`, e.g. from metallicRoughness’ baseColorFactor, as diffuseFactor is more analogous to diffuse color than baseColor), and will only extract from `$clr.diffuse`
2017-10-19 16:21:16 -04:00
Jared Mulconry 326158633b Fixed warnings on MSVC caused by implicit conversions from double to float. 2017-10-06 18:23:28 +03:00
Kim Kulling c1f93a69ae Revert "WIP: Enable Travis clang build" 2017-10-06 15:42:05 +02:00
Jared Mulconry 3803a5181c Fixed warnings on MSVC caused by implicit conversions from double to float. 2017-10-06 20:32:33 +11:00
Jared Mulconry 059a32654e Addressed warnings generated on MSVC across x86 and x64. 2017-09-24 19:29:43 +10:00
Kim Kulling b5ac248703 Merge pull request #1444 from turol/warnings
Clean up some more GCC warnings
2017-09-20 22:18:21 +02:00
Kim Kulling 81b94a1dca Merge pull request #1445 from Matter-and-Form/gltf2-alphaMode-fix
Fix glTF2 alphaMode storage and reading
2017-09-19 15:40:53 +02:00
Daniel Hritzkiv 798542d7bd
Formatting 2017-09-18 14:48:07 -04:00
Daniel Hritzkiv de0bf2ea96
Fix alphaMode storage and reading
alphaMode is now converted from a std::string to an aiString and back to std::string, since aiString is easier to store and retrieve from aiMaterial properties than std::string

Fixes issues of alphaMode being written out as `\fOPAQUE\0\0\0\0\0\0…`
2017-09-18 12:19:55 -04:00
Daniel Hritzkiv 8743d28ec5
SImplify mesh merging code
My assumption that primitives of different types (modes) can’t be in the same mesh was incorrect.
2017-09-18 12:16:30 -04:00
Daniel Hritzkiv 2efd2cdef8
tweaks to primitive merging logic; comments + formatting 2017-09-18 11:16:05 -04:00
Daniel Hritzkiv 28523232cf
Merge multiple meshes in a node into one mesh with many primtives; write out only one mesh per node
To do:
- clean up MergeMeshes
- see if there’s a way to do this earlier in the flow
2017-09-18 11:16:05 -04:00
Daniel Hritzkiv 5147acfe65
Revert "store node mesh vs. meshes"
This reverts commit a0d97505e5.
2017-09-18 11:16:04 -04:00
Turo Lamminen 40c308af44 glTF: Silence uninitialized variable warning
This is a false positive. 'jointNamesIndex' is either set by the loop
or the following conditional is false which also sets it. The undefined value
is never seen by the following code.
2017-09-18 15:18:45 +03:00
John Senneker 933bbb4f1c Manually read alphaMode material property 2017-09-12 11:55:52 -04:00
Daniel Hritzkiv b0da0796c8
Fix Segfault caused by losing pointer to std::string
Keep std::string alive
2017-09-12 10:07:15 -04:00
Daniel Hritzkiv cde29c937c
Formatting 2017-09-11 11:02:16 -04:00
Daniel Hritzkiv 816e6909ca
Remove KHR_binary_glTF code
Binary glTF is now part of the glTF2 spec. However, it’s implemented incorrectly, so will be temporarily removed
2017-09-11 11:02:16 -04:00
John Senneker 140b903d7a
Fix parsing of glTF version
Handle version as int in gltf
Fix format specifiers in glTF version parser
2017-09-11 11:02:15 -04:00
Daniel Hritzkiv 0a8183531e
Set alphaMode, baseColorFactor opacity when model’s opacity isn’t 1 2017-09-11 11:02:14 -04:00
Daniel Hritzkiv 37582131f4
Set the metallicFactor to 0 if source file doesn’t have metallicFactor
Otherwise, the models have full metallic materials and appear very dim
2017-09-11 11:02:14 -04:00
Daniel Hritzkiv 3ba00ca421
Define gltf material property names as constants 2017-09-11 11:02:14 -04:00
Daniel Hritzkiv 44757af34a
Implement pbrSpecularGlossiness property as Nullable 2017-09-11 11:02:13 -04:00
Daniel Hritzkiv 1a5823700f
Remove need for Has by returning an empty Ref in Get 2017-09-11 11:02:13 -04:00
Daniel Hritzkiv a9c4fa84b5
Sampler improvements; Add new LazyDict method
Samplers are now imported into assimp internal format from textures;
Samplers have defaults as per spec;
Sampler enums are strongly typed with UNSET values;
Samplers are exported properly;
Sampler filters are exported as well;
Samplers are re-used across textures on export
Default sampler values are not written
2017-09-11 11:02:12 -04:00
Daniel Hritzkiv 63ef19d9ad
Export extensions 2017-09-11 10:55:51 -04:00
Daniel Hritzkiv a0d97505e5
store node mesh vs. meshes
glTF nodes can only hold one mesh. this simply assigns to and check’s a Node’s Mesh
2017-09-11 10:55:50 -04:00
Daniel Hritzkiv ab08a7c3cb
reenable animation and skins exports
Currently incorrect, however. May need to be removed
2017-09-11 10:55:50 -04:00
Daniel Hritzkiv feee7528d6
Make sure `on` flag for specularGlossiness is being persisted 2017-09-11 10:50:39 -04:00
Daniel Hritzkiv 2d54019b8f
Remove OPEN3DGC and compression references 2017-09-11 10:50:39 -04:00
Daniel Hritzkiv 562920fbb8
Changes to GLTF2 materials
pbrMetallicRoughness and pbrSpecularGlossiness as structs; persist textureinfo properties from start to finish; persist pbrSpecularGlossiness (via extensionsUsed) usage from start to finish
2017-09-11 10:50:39 -04:00
Daniel Hritzkiv 11cb9ac139
Working read, import, export, and write of gltf2 (pbr) material 2017-09-11 10:50:38 -04:00
Daniel Hritzkiv 67eb3b0608
temporarily disable gltf exporting of animations and skins 2017-09-11 10:50:38 -04:00
Jared Mulconry 698cd5826d Fixed warnings when compiling for x64 on MSVC through VS 2017 v15.3.3. 2017-09-11 00:16:26 +10:00