Skip to content
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

Load gltf textures correctly #2327

Merged
merged 5 commits into from
Jul 30, 2020
Merged

Conversation

slimbuck
Copy link
Member

This PR addresses a few issues in the gltf loader:

  • multiple gltfTextures can reference a single gltfImage, each gltfTexture having it's own sampler state. When loading an image multiple times, the asset system cache kicks in an all texture assets end up sharing the same underlying pc.Texture instance. This resulted in the failed test https://cx20.github.io/gltf-test/examples/playcanvas/index.html?category=tutorialModels&model=TextureSettingsTest&scale=0.2&type=glTF. We fix this here by implementing cloneTextureAsset and cloneTexture which we use when multiple textures are found using the same underlying image.
  • generate normals when position data isn't tightly packed. This is needed when position data is interleaved or when position data is quantised to short or byte (where position stride !== size due to 4-byte alignment).
  • simplified of vertex semantic map handling

I confirm I have signed the Contributor License Agreement.

@slimbuck slimbuck requested a review from a team July 30, 2020 11:49
@slimbuck slimbuck self-assigned this Jul 30, 2020
@slimbuck slimbuck merged commit 706f88e into playcanvas:master Jul 30, 2020
@slimbuck slimbuck deleted the glb-parser-fix branch July 30, 2020 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants