Sometimes, for mesh instances, it is useful to have a dedicated proxy function that overrides the original position. For example, in the case of prefabs where world coordinates are defined relative to an internal root node, this helps avoid sending redundant data through the (model_matrix) | (matrix_normal) uniform channel.
It is worth considering adding such a feature.
|
setMeshInstanceMatrices(meshInstance, setNormalMatrix = false) { |
Prototype:
setMeshInstanceMatrices(meshInstance, setNormalMatrix = false) {
const modelMatrix = meshInstance.customModelMatrix ?? meshInstance.node.worldTransform;
this.modelMatrixId.setValue(modelMatrix.data);
if (setNormalMatrix) {
this.normalMatrixId.setValue((meshInstance.customNormalMatrix ?? meshInstance.node.normalMatrix).data);
}
}
Sometimes, for mesh instances, it is useful to have a dedicated proxy function that overrides the original position. For example, in the case of prefabs where world coordinates are defined relative to an internal root node, this helps avoid sending redundant data through the (model_matrix) | (matrix_normal) uniform channel.
It is worth considering adding such a feature.
engine/src/scene/renderer/renderer.js
Line 832 in 4429ce7
Prototype: