Last active
August 29, 2015 14:03
-
-
Save andr3wmac/1c4f6e027f1d8f8c2f55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void SFX3DObject::getEarTransform( MatrixF& transform ) const | |
{ | |
// If it's not a ShapeBase, just use the object transform. | |
ShapeBase* shape = dynamic_cast< ShapeBase* >( mObject ); | |
if ( !shape ) | |
{ | |
transform = mObject->getTransform(); | |
return; | |
} | |
// It it's ShapeBase, use the earNode transform if one was defined. | |
// Otherwise, use the camera transform. | |
TSShapeInstance* shapeInstance = shape->getShapeInstance(); | |
if ( !shapeInstance ) | |
{ | |
// Just in case. | |
GameConnection* connection = dynamic_cast<GameConnection *>(NetConnection::getConnectionToServer()); | |
if ( !connection || !connection->getControlCameraTransform( 0.0f, &transform ) ) | |
transform = mObject->getTransform(); | |
return; | |
} | |
ShapeBaseData* datablock = dynamic_cast< ShapeBaseData* >( shape->getDataBlock() ); | |
AssertFatal( datablock, "SFX3DObject::getEarTransform() - shape without ShapeBaseData datablock!" ); | |
// Get the transform for the ear node. | |
const S32 earNode = datablock->earNode; | |
if ( earNode != -1 && earNode != datablock->eyeNode ) | |
{ | |
transform = shape->getTransform(); | |
transform *= shapeInstance->mNodeTransforms[ earNode ]; | |
} | |
else | |
{ | |
GameConnection* connection = dynamic_cast<GameConnection *>(NetConnection::getConnectionToServer()); | |
if ( !connection || !connection->getControlCameraTransform( 0.0f, &transform ) ) | |
transform = mObject->getTransform(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment