Dear ForumReaders,
can anyone help me with the following code-snip from
MotionBlurRenderPass (line 294):
if( !freeze ) {
for( int i = 0; i < dynamicObjects.size(); i++ ) {
DynamicObject dynamicObject = dynamicObjects.get( i );
Matrix4f modelMatrix = dynamicObject.modelMatrix;
Spatial spatial = dynamicObject.spatial;
modelMatrix.loadIdentity();
spatial.getWorldRotation().toRotationMatrix( tmpMatrix );
modelMatrix.multLocal( tmpMatrix );
modelMatrix.m00 *= spatial.getWorldScale().x;
modelMatrix.m11 *= spatial.getWorldScale().y;
modelMatrix.m22 *= spatial.getWorldScale().z;
modelMatrix.setTranslation( spatial.getWorldTranslation() );
modelMatrix.transposeLocal();
}
}
Seems to be a little confusing to me - the rotation of the dynObj stored into tmpMatrix, then again multiplicated with the modelMatrix, then scaled, translated and afterwards transposed. I know transposing is useful for the inversion of a rotation, but in this case? What mathematical trick is done here - and for what? I know the algo behind the shader-code used here (Stupid OpenGL Shader Tricks, NVIDIA), but my brain is freezed with this snip - can anyone explain?
Thnx in advance for any help,
Best Regards Woidl