In GroupRotator
private Matrix3f rotMatX = new Matrix3f(),
rotMatY = new Matrix3f(),
rotMatZ = new Matrix3f(),
rotMat = new Matrix3f();
...
public boolean animate( long gameTime, long frameTime, TimingMode timingMode )
{
if ( !isAnimating() || ( getNumTransformNodes() == 0 ) )
return ( false );
final long micros = timingMode.getMicroSeconds( gameTime );
if ( getTransformationDirectives().isDirty() )
{
setTransformationDirectives( getTransformationDirectives() );
}
if ( getTransformationDirectives().getUserAxis() == null )
{
final float x = angleX.getValue( micros );
final float y = angleY.getValue( micros );
final float z = angleZ.getValue( micros );
final float sin_x = FastMath.sin( x );
final float cos_x = FastMath.cos( x );
final float sin_y = FastMath.sin( y );
final float cos_y = FastMath.cos( y );
final float sin_z = FastMath.sin( z );
final float cos_z = FastMath.cos( z );
/*
t3dMain.setRotation( angleX.getValue( micros ),
angleY.getValue( micros ),
angleZ.getValue( micros ) );
*/
rotMatX.set( 1f, 0f, 0f, 0f, cos_x, -sin_x, 0f, sin_x, cos_x );
rotMatY.set( cos_y, 0f, sin_y, 0f, 1f, 0f, -sin_y, 0f, cos_y );
rotMatZ.set( cos_z, -sin_z, 0f, sin_z, cos_z, 0f, 0f, 0f, 1f );
switch ( getTransformationDirectives().getAxisOrder() )
{
case XYZ:
rotMatX.mul( rotMatY );
rotMatX.mul( rotMatZ );
rotMat = rotMatX;
break;
case XZY:
rotMatX.mul( rotMatZ );
rotMatX.mul( rotMatY );
rotMat = rotMatX;
break;
case YXZ:
rotMatY.mul( rotMatX );
rotMatY.mul( rotMatZ );
rotMat = rotMatY;
break;
case YZX:
rotMatY.mul( rotMatZ );
rotMatY.mul( rotMatY );
rotMat = rotMatY;
break;
case ZXY:
rotMatZ.mul( rotMatX );
rotMatZ.mul( rotMatY );
rotMat = rotMatZ;
break;
case ZYX:
rotMatZ.mul( rotMatY );
rotMatZ.mul( rotMatX );
rotMat = rotMatZ;
break;
}
}
...
}
causes a memory leak because rotMat gets discarded by each of the switch cases.