Open xeolabs opened 10 months ago
Maybe, those transforms could be created in a lazy way when needed?
I mean, only initialize it the 1st time time the transform is modified
@tmarti yes I think that would work - SceneModelTransforms
are decoupled enough that they can be created on-demand.
We could:
SceneModel.createTransform()
method, so users can eager-create transformhierarchies, SceneModelMesh.transform
property into an accessor, that lazy-creates a SceneModelTransform
if it doesn't already existSceneModel.transforms
map private, since it won't be pre-populated any more, replace it with SceneModel.getTransform(id)
, which would lazy-create. A SceneModelMesh
with batched VBO geometry would not have a SceneModelTransform
though, since we don't support dynamic transforms on batched VBO objects. That's because it's not efficient to store transform matrices in the batched VBO arrays (16 floats per vertex in a VBO).
Solution options for that could be:
For data textures, we're in luck, however, because all DTX objects always have updateable transform matrices ;)
Yes, DTX was designed with such things in mind 😊
I recently added the ability to create transform hierarchies on models in the SDK.
Specifically, this PR adds a new
SceneModelTransform
component, which can be used to define for each object in aSceneModel
a transform that positions, scales and orients it. The transform can then be animated by dynamically updating itsscale
,position
androtation
properties. These transforms can also be created in hierarchies, for complex transform animations.When we load
glTF
orXKT
into the SDK, we load them into aSceneModel
. However, when we loadglTF
orXKT
into aSceneModel
it probably does not make sense to automatically create aSceneModelTransform
for every object, since they each do represent an additional JavaScript object in memory, with its own properties (matrix, quaternion, rotation angles, scale factors, translation offset, etc).Is there some heuristic we can use to decide when
SceneModelTranslations
should be created byXKTLoaderPlugin
andGLTFLoaderPlugin
?Are there certain IFC types that should trigger the creation of these, ie. things that are likely to move, like
IfcFurnishingElement
?Any sort of metadata that can hint at when they should be created?
Or maybe just have a loading option that either creates them for all objects, or no objects?