AndroidJgltfViewer icon indicating copy to clipboard operation
AndroidJgltfViewer copied to clipboard

Can I optimize this?

Open 3dportable opened this issue 5 years ago • 0 comments

This code in class UniformGetterFactory 477 row

for (int j = 0; j < numJoints; j++)
        {
            NodeModel jointNodeModel = joints.get(j);
            
            Supplier<float[]> inverseBindMatrixSupplier = 
                inverseBindMatrixSuppliers.get(j);
            
            Supplier<float[]> jointMatrixSupplier = MatrixOps
                .create4x4(nodeModel.createGlobalTransformSupplier()).invert4x4()
                .multiply4x4(jointNodeModel.createGlobalTransformSupplier())
                .multiply4x4(inverseBindMatrixSupplier)
                .multiply4x4(bindShapeMatrixSupplier)
                .log("jointMatrix "+j, Level.FINE)
                .build();
            jointMatrixSuppliers.add(jointMatrixSupplier);
        }

.create4x4(nodeModel.createGlobalTransformSupplier()).invert4x4() It seems to me that this line calculates a matrix with the same result for each bone, and it requires significant resources. Can I take her calculation out of the loop?

3dportable avatar Feb 08 '20 03:02 3dportable