Remove uniform scale matrix from scene graph

This commit is contained in:
Janine Liu 2022-03-14 17:17:42 -04:00
parent 363e32c9cd
commit 7b985bfffa
3 changed files with 10 additions and 18 deletions

View File

@ -255,14 +255,9 @@ ModelExperimentalNode.prototype.configurePipeline = function () {
*/
ModelExperimentalNode.prototype.updateModelMatrix = function () {
this._transformDirty = true;
Matrix4.multiplyTransformation(
Matrix4.multiply(
this._sceneGraph.computedModelMatrix,
this._transform,
this._computedTransform
);
Matrix4.multiplyByUniformScale(
this._computedTransform,
this._sceneGraph._scale,
this._computedTransform
);
};

View File

@ -119,9 +119,6 @@ export default function ModelExperimentalSceneGraph(options) {
this._boundingSphere = undefined;
this._computedModelMatrix = Matrix4.clone(this._model.modelMatrix);
this._uniformScaleMatrix = Matrix4.fromUniformScale(
this._model._modifiedScale
);
initialize(this);
}
@ -186,6 +183,12 @@ function initialize(sceneGraph) {
components.forwardAxis
);
Matrix4.multiplyByUniformScale(
sceneGraph._computedModelMatrix,
model._modifiedScale,
sceneGraph._computedModelMatrix
);
const rootNodes = scene.nodes;
for (let i = 0; i < rootNodes.length; i++) {
const rootNode = scene.nodes[i];
@ -397,8 +400,7 @@ ModelExperimentalSceneGraph.prototype.update = function (frameState) {
ModelExperimentalSceneGraph.prototype.updateModelMatrix = function () {
const model = this._model;
const scale = model._modifiedScale;
this._scale = scale;
this._computedModelMatrix = Matrix4.clone(model.modelMatrix);
Matrix4.clone(model.modelMatrix, this._computedModelMatrix);
Matrix4.multiply(
this._computedModelMatrix,

View File

@ -62,16 +62,11 @@ export default function buildDrawCommands(
const pass = primitiveRenderResources.alphaOptions.pass;
const sceneGraph = model.sceneGraph;
const scaledTransform = Matrix4.multiply(
sceneGraph._uniformScaleMatrix,
primitiveRenderResources.transform,
new Matrix4()
);
const modelMatrix = Matrix4.multiply(
sceneGraph.computedModelMatrix,
scaledTransform,
scaledTransform
primitiveRenderResources.transform,
new Matrix4()
);
BoundingSphere.transform(