mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 00:05:40 +00:00
Remove projection offset, add the hmd head matrix. Also tidy up a few things.
This commit is contained in:
parent
e7bafe3c7b
commit
f91aa639d6
20 changed files with 126 additions and 113 deletions
|
|
@ -96,9 +96,9 @@ ExtendedMove::ExtendedMove() : Move()
|
|||
rotZ[i] = 0;
|
||||
rotW[i] = 1;
|
||||
|
||||
cposX[i] = 0;
|
||||
cposY[i] = 0;
|
||||
cposZ[i] = 0;
|
||||
cposX[i] = 0;
|
||||
cposY[i] = 0;
|
||||
cposZ[i] = 0;
|
||||
|
||||
EulerBasedRotation[i] = false;
|
||||
}
|
||||
|
|
@ -139,11 +139,11 @@ void ExtendedMove::pack(BitStream *stream, const Move * basemove)
|
|||
{
|
||||
// Position
|
||||
if(stream->writeFlag(posX[i] != extBaseMove->posX[i]))
|
||||
stream->writeSignedInt(cposX[i], MaxPositionBits);
|
||||
stream->writeInt(cposX[i], MaxPositionBits);
|
||||
if(stream->writeFlag(posY[i] != extBaseMove->posY[i]))
|
||||
stream->writeSignedInt(cposY[i], MaxPositionBits);
|
||||
stream->writeInt(cposY[i], MaxPositionBits);
|
||||
if(stream->writeFlag(posZ[i] != extBaseMove->posZ[i]))
|
||||
stream->writeSignedInt(cposZ[i], MaxPositionBits);
|
||||
stream->writeInt(cposZ[i], MaxPositionBits);
|
||||
|
||||
// Rotation
|
||||
stream->writeFlag(EulerBasedRotation[i]);
|
||||
|
|
@ -183,7 +183,7 @@ void ExtendedMove::unpack(BitStream *stream, const Move * basemove)
|
|||
// Position
|
||||
if (stream->readFlag())
|
||||
{
|
||||
posX[i] = stream->readSignedInt(MaxPositionBits);
|
||||
posX[i] = stream->readInt(MaxPositionBits);
|
||||
cposX[i] = UNCLAMPPOS(posX[i]);
|
||||
}
|
||||
else
|
||||
|
|
@ -191,7 +191,7 @@ void ExtendedMove::unpack(BitStream *stream, const Move * basemove)
|
|||
|
||||
if (stream->readFlag())
|
||||
{
|
||||
cposY[i] = stream->readSignedInt(MaxPositionBits);
|
||||
cposY[i] = stream->readInt(MaxPositionBits);
|
||||
posY[i] = UNCLAMPPOS(cposY[i]);
|
||||
}
|
||||
else
|
||||
|
|
@ -199,7 +199,7 @@ void ExtendedMove::unpack(BitStream *stream, const Move * basemove)
|
|||
|
||||
if (stream->readFlag())
|
||||
{
|
||||
cposZ[i] = stream->readSignedInt(MaxPositionBits);
|
||||
cposZ[i] = stream->readInt(MaxPositionBits);
|
||||
posZ[i] = UNCLAMPPOS(cposZ[i]);
|
||||
}
|
||||
else
|
||||
|
|
@ -267,9 +267,9 @@ void ExtendedMove::clamp()
|
|||
for(U32 i=0; i<MaxPositionsRotations; ++i)
|
||||
{
|
||||
// Positions
|
||||
posX[i] = CLAMPPOS(posX[i]);
|
||||
posY[i] = CLAMPPOS(posY[i]);
|
||||
posZ[i] = CLAMPPOS(posZ[i]);
|
||||
cposX[i] = CLAMPPOS(posX[i]);
|
||||
cposY[i] = CLAMPPOS(posY[i]);
|
||||
cposZ[i] = CLAMPPOS(posZ[i]);
|
||||
|
||||
// Rotations
|
||||
if(EulerBasedRotation[i])
|
||||
|
|
@ -285,6 +285,16 @@ void ExtendedMove::clamp()
|
|||
crotZ[i] = CLAMPPOS(rotZ[i]);
|
||||
crotW[i] = CLAMPROT(rotW[i] / M_2PI_F);
|
||||
}
|
||||
|
||||
/*if (i == 0)
|
||||
{
|
||||
F32 x, y, z, a;
|
||||
x = UNCLAMPPOS(crotX[i]);
|
||||
y = UNCLAMPPOS(crotY[i]);
|
||||
z = UNCLAMPPOS(crotZ[i]);
|
||||
a = UNCLAMPROT(crotW[i]) * M_2PI_F;
|
||||
//Con::printf("rot %f,%f,%f,%f clamped to %f,%f,%f,%f", rotX[i], rotY[i], rotZ[i], rotW[i], x,y,z,a);
|
||||
}*/
|
||||
}
|
||||
|
||||
// Perform the standard Move clamp
|
||||
|
|
@ -296,9 +306,9 @@ void ExtendedMove::unclamp()
|
|||
// Unclamp the values the same as for net traffic so the client matches the server
|
||||
for(U32 i=0; i<MaxPositionsRotations; ++i)
|
||||
{
|
||||
posX[i] = UNCLAMPPOS(posX[i]);
|
||||
posY[i] = UNCLAMPPOS(posY[i]);
|
||||
posZ[i] = UNCLAMPPOS(posZ[i]);
|
||||
posX[i] = UNCLAMPPOS(cposX[i]);
|
||||
posY[i] = UNCLAMPPOS(cposY[i]);
|
||||
posZ[i] = UNCLAMPPOS(cposZ[i]);
|
||||
|
||||
// Rotations
|
||||
if(EulerBasedRotation[i])
|
||||
|
|
|
|||
|
|
@ -681,6 +681,24 @@ bool GameConnection::getControlCameraTransform(F32 dt, MatrixF* mat)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GameConnection::getControlCameraHeadTransform(IDisplayDevice *display, MatrixF *transform)
|
||||
{
|
||||
GameBase* obj = getCameraObject();
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
GameBase* cObj = obj;
|
||||
while ((cObj = cObj->getControlObject()) != 0)
|
||||
{
|
||||
if (cObj->useObjsEyePoint())
|
||||
obj = cObj;
|
||||
}
|
||||
|
||||
obj->getEyeCameraTransform(display, -1, transform);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GameConnection::getControlCameraEyeTransforms(IDisplayDevice *display, MatrixF *transforms)
|
||||
{
|
||||
GameBase* obj = getCameraObject();
|
||||
|
|
|
|||
|
|
@ -267,6 +267,10 @@ public:
|
|||
bool getControlCameraTransform(F32 dt,MatrixF* mat);
|
||||
bool getControlCameraVelocity(Point3F *vel);
|
||||
|
||||
/// Returns the head transform for the control object, using supplemental information
|
||||
/// from the provided IDisplayDevice
|
||||
bool getControlCameraHeadTransform(IDisplayDevice *display, MatrixF *transform);
|
||||
|
||||
/// Returns the eye transforms for the control object, using supplemental information
|
||||
/// from the provided IDisplayDevice.
|
||||
bool getControlCameraEyeTransforms(IDisplayDevice *display, MatrixF *transforms);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue