-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extensions and bugfixes for the model builder package #103
Conversation
During some tests, I noticed another issue that is addressed here. Fixes #104 : The |
I'll merge this for now, because it contains some important and uncontroversial bugfixes. But I'll not immediately schedule a new release. There still are open questions and issues that should be addressed before a new release. Some of them are summarized in #107 , and I'll create a (draft) PR with some approaches for addressing them ... soon, |
This PR summarizes a few extensions and bugfixes, mainly for the
jgltf-model-builder
package and related classes.It makes the PR #99 obsolete (it includes all changes from there).
Fixes #98
Fixes #101
A short summary:
GltfModelBuilder
, then the morph targets had not been taken into account when building the buffer structure ( morph targets aren't saved properly #98 )MeshPrimitiveModel
/DefaultMeshPrimitiveModel
had minor changes for handling morph targets. These should not affect clients in terms of behavior.GltfModelBuilder
, then this texture was not properly added to the model. This was fixed in 36c7875GltfModel
was read (from a glTF/GLB file), then themeshModel.getWeights()
method always returnednull
( Mesh weights are not read into model #101 )ImageModel
with JPG MIME type was created from image data that included an alpha component, then the resulting image was invalid (JPG does not support alpha). This was fixed in 04112ffPreviously, it was possible to pass an
AccessorModel
to aGltfModelBuilder
even when theAccessorModel
already had an associatedBufferViewModel
. This caused an "invalid" glTF to be created (because the whole point of theGltfModelBuilder
is to create the bufferView/buffer structure for the data that is passed to it). Now, attempting to do this will cause aGltfException
to be thrown. (The validation and error handling could be extended and improved in many ways and places, but this may be a first step).In order to simplify the process of inserting an existing
AccessorModel
(that was read from another model) to aGltfModelBuilder
, there now is anAccessorModels.copy(AccessorModel)
method: It extracts the data from the givenAccessorModel
and creates a newAccessorModel
(without a buffer view) that can be passed to the builder, and the builder will eventually create the buffer view as necessary.s
to the model class name. These classes are:ImageModels
to create image models from buffered imagesTextureModels
the create texture models from image models or buffered imagesMaterialModels
to create "default" materials (usually, withmetallicFactor=0
) from base colors, images, or texturesMeshPrimitiveModels
to create mesh primitive models from the common input of indices/positions/normals/texCoords (with all except for the positions being optional)SceneModels
to create simple scenes from a single mesh primitive, mesh, or node