Refactors the glTF2 internal classes to more closely reflect the structure
of the actual GLTF2 file format. Adds implementations for reading skins
and animations from GLTF2 files into those structures.
Also provides implementations for converting skins and animations from GLTF
into assimp data structures. Special handling is required for bone weights
since assimp stores vertex-weights-per-bone whereas GLTF2 stores
bone-weights-per-vertex. Only supports keyframed LINEAR animation data;
STEP and CUBICSPLINE is not currently supported.
Refactors the glTF2 internal classes to more closely reflect the structure
of the actual GLTF2 file format. Adds implementations for reading skins
and animations from GLTF2 files into those structures.
Also provides implementations for converting skins and animations from GLTF
into assimp data structures. Special handling is required for bone weights
since assimp stores vertex-weights-per-bone whereas GLTF2 stores
bone-weights-per-vertex. Only supports keyframed LINEAR animation data;
STEP and CUBICSPLINE is not currently supported.
In glTF2Exporter, roughnessFactor = 1 - normalizedShininess = 1 - someFunc(sqrt(shininess / 1000)). But in gltf2Importer, roughnessAsShininess = (1 - roughnessFactor) * 1000. No sqr there. So if save a shininess to a gltf2 and load it back, the value changed. This fix add a square to importer to make sure the consistency.
Skips some glTF/2.0 uv processing if the count of uvs in the attribute stream doesn't match the vertex count.
This happens with some malformed glTF/2.0 files, and the change will allow them to be processed properly.
Without the change, an access violation will occur several lines below if uv count is less than the position count.
Assimp was returning glTF/2.0 values as address modes instead of aiTextureMapModes.
Also modified text glTF/2.0 model's sampler uv address modes to mirror/clamp respectively, and tests for them in the unit test.
Uses node name if it is set, and globally unique id otherwise.
This may still break in some models (glTF2 spec doesn’t guaruntee name values to be unique). However, I couldn’t cause it to break any further using gltf2 models on hand.
Closes#1600
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
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.
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
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`
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…`