casual-simulation / casualos

Casual Open Simulation for the Web
https://ab1.bot
MIT License
48 stars 9 forks source link

Mesh glTF form fixes - Color & Disposal #277

Closed Blitzy closed 1 year ago

Blitzy commented 1 year ago

This PR adds support for the color tag on all meshes and materials of a bot loading a glTF model. Previously CasualOS would only apply the color tag value to the first mesh child of glTF. This PR also fixes material texture registration and disposal for glTF models that have many materials and textures.

Before: color_develop

After: color_gltf-fixes

Blitzy commented 1 year ago

@KallynGowdy I reverted the changes to disposeObject3D and disposeGroup. Instead, when disposing of the glTF scene, we loop through all of the descendants and dispose of each object, checking for when an object is actually a Mesh and calling disposeMesh appropriately.