Say I want to call the
IDirect3DDevice9->SetTransform(D3DTS_WORLD, &mtxWorld)
method, but I don't want the user to have to worry about the Device Object, or the SetTransform method. To fix this, I would create a function like so:
SetWorldPosition(D3DXMATRIX position)
{
Device->SetTransform( D3DTS_WORLD, &position );
}
and could call it from the game like this:
Engine->SetWorldPosition( m_pPlayer->Position() );
The Player doesn't know about the matrix, only that the player has a position, so he would pass it subconsciously.
Now, I want my engine as fast as possible. If I were to declare a function like this, would it waste time since it has to call another function inside of it's body (SetWorldPosition() -> SetTransform() )? Would it be faster if I let them handle the device and SetTransform function by themselves? (so just SetTransform() instead of both functions)
If I 'inline' this function, will that help solve my problem?
Thanks,
-Gardon












