mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-28 11:03:49 +00:00
Fix merge conflict and add check for unix and not apple for glx
Merge branch 'development-gg' into gladdev # Conflicts: # Tools/CMake/libraries/glad.cmake
This commit is contained in:
commit
0296e6d3fd
728 changed files with 83679 additions and 66879 deletions
|
|
@ -1440,10 +1440,9 @@ F32 AIPlayer::getTargetDistance(GameBase* target, bool _checkEnabled)
|
|||
return (getPosition() - target->getPosition()).len();
|
||||
}
|
||||
|
||||
DefineEngineMethod(AIPlayer, getTargetDistance, bool, (ShapeBase* obj, bool checkEnabled), (NULL, false),
|
||||
"@brief Check whether an object is within a specified veiw cone.\n"
|
||||
DefineEngineMethod(AIPlayer, getTargetDistance, F32, (ShapeBase* obj, bool checkEnabled), (NULL, false),
|
||||
"@brief The distance to a given object.\n"
|
||||
"@obj Object to check. (If blank, it will check the current target).\n"
|
||||
"@fov view angle in degrees.(Defaults to 45)\n"
|
||||
"@checkEnabled check whether the object can take damage and if so is still alive.(Defaults to false)\n")
|
||||
{
|
||||
return object->getTargetDistance(obj, checkEnabled);
|
||||
|
|
|
|||
|
|
@ -91,9 +91,9 @@ ConsoleSetType(TypeComponentAssetPtr)
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
ComponentAsset::ComponentAsset() :
|
||||
mAcquireReferenceCount(0),
|
||||
mpOwningAssetManager(NULL),
|
||||
mAssetInitialized(false)
|
||||
mAssetInitialized(false),
|
||||
mAcquireReferenceCount(0)
|
||||
{
|
||||
// Generate an asset definition.
|
||||
mpAssetDefinition = new AssetDefinition();
|
||||
|
|
|
|||
|
|
@ -91,9 +91,9 @@ ConsoleSetType(TypeExampleAssetPtr)
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
ExampleAsset::ExampleAsset() :
|
||||
mAcquireReferenceCount(0),
|
||||
mpOwningAssetManager(NULL),
|
||||
mAssetInitialized(false)
|
||||
mAssetInitialized(false),
|
||||
mAcquireReferenceCount(0)
|
||||
{
|
||||
// Generate an asset definition.
|
||||
mpAssetDefinition = new AssetDefinition();
|
||||
|
|
|
|||
|
|
@ -91,9 +91,9 @@ ConsoleSetType(TypeGameObjectAssetPtr)
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
GameObjectAsset::GameObjectAsset() :
|
||||
mAcquireReferenceCount(0),
|
||||
mpOwningAssetManager(NULL),
|
||||
mAssetInitialized(false)
|
||||
mAssetInitialized(false),
|
||||
mAcquireReferenceCount(0)
|
||||
{
|
||||
// Generate an asset definition.
|
||||
mpAssetDefinition = new AssetDefinition();
|
||||
|
|
|
|||
|
|
@ -45,9 +45,6 @@
|
|||
// Debug Profiling.
|
||||
#include "platform/profiler.h"
|
||||
|
||||
static U32 execDepth = 0;
|
||||
static U32 journalDepth = 1;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_CONOBJECT(ShapeAsset);
|
||||
|
|
@ -96,9 +93,9 @@ ConsoleSetType(TypeShapeAssetPtr)
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
ShapeAsset::ShapeAsset() :
|
||||
mAcquireReferenceCount(0),
|
||||
mpOwningAssetManager(NULL),
|
||||
mAssetInitialized(false)
|
||||
mAssetInitialized(false),
|
||||
mAcquireReferenceCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -393,44 +393,6 @@ void Camera::getEyeCameraTransform(IDisplayDevice *displayDevice, U32 eyeId, Mat
|
|||
}
|
||||
}
|
||||
|
||||
DisplayPose Camera::calcCameraDeltaPose(GameConnection *con, const DisplayPose& inPose)
|
||||
{
|
||||
// NOTE: this is intended to be similar to updateMove
|
||||
DisplayPose outPose;
|
||||
outPose.orientation = EulerF(0,0,0);
|
||||
outPose.position = inPose.position;
|
||||
|
||||
// Pitch
|
||||
outPose.orientation.x = (inPose.orientation.x - mLastAbsolutePitch);
|
||||
|
||||
// Constrain the range of mRot.x
|
||||
while (outPose.orientation.x < -M_PI_F)
|
||||
outPose.orientation.x += M_2PI_F;
|
||||
while (outPose.orientation.x > M_PI_F)
|
||||
outPose.orientation.x -= M_2PI_F;
|
||||
|
||||
// Yaw
|
||||
outPose.orientation.z = (inPose.orientation.z - mLastAbsoluteYaw);
|
||||
|
||||
// Constrain the range of mRot.z
|
||||
while (outPose.orientation.z < -M_PI_F)
|
||||
outPose.orientation.z += M_2PI_F;
|
||||
while (outPose.orientation.z > M_PI_F)
|
||||
outPose.orientation.z -= M_2PI_F;
|
||||
|
||||
// Bank
|
||||
if (mDataBlock->cameraCanBank)
|
||||
{
|
||||
outPose.orientation.y = (inPose.orientation.y - mLastAbsoluteRoll);
|
||||
}
|
||||
|
||||
// Constrain the range of mRot.y
|
||||
while (outPose.orientation.y > M_PI_F)
|
||||
outPose.orientation.y -= M_2PI_F;
|
||||
|
||||
return outPose;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
F32 Camera::getCameraFov()
|
||||
|
|
|
|||
|
|
@ -237,7 +237,6 @@ class Camera: public ShapeBase
|
|||
virtual void interpolateTick( F32 delta);
|
||||
virtual void getCameraTransform( F32* pos,MatrixF* mat );
|
||||
virtual void getEyeCameraTransform( IDisplayDevice *display, U32 eyeId, MatrixF *outMat );
|
||||
virtual DisplayPose calcCameraDeltaPose(GameConnection *con, const DisplayPose& inPose);
|
||||
|
||||
virtual void writePacketData( GameConnection* conn, BitStream* stream );
|
||||
virtual void readPacketData( GameConnection* conn, BitStream* stream );
|
||||
|
|
|
|||
|
|
@ -39,14 +39,14 @@ class WaterObject;
|
|||
struct ContainerQueryInfo
|
||||
{
|
||||
ContainerQueryInfo()
|
||||
: waterCoverage(0.0f),
|
||||
: box(-1,-1,-1,1,1,1),
|
||||
mass(1.0f),
|
||||
waterCoverage(0.0f),
|
||||
waterHeight(0.0f),
|
||||
waterDensity(0.0f),
|
||||
waterViscosity(0.0f),
|
||||
gravityScale(1.0f),
|
||||
appliedForce(0,0,0),
|
||||
box(-1,-1,-1,1,1,1),
|
||||
mass(1.0f),
|
||||
waterObject(NULL)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,12 +227,12 @@ bool ConvexShape::protectedSetSurface( void *object, const char *index, const ch
|
|||
|
||||
|
||||
ConvexShape::ConvexShape()
|
||||
: mMaterialInst( NULL ),
|
||||
mNormalLength( 0.3f ),
|
||||
: mMaterialName( "Grid512_OrangeLines_Mat" ),
|
||||
mMaterialInst( NULL ),
|
||||
mVertCount( 0 ),
|
||||
mPrimCount( 0 ),
|
||||
mMaterialName( "Grid512_OrangeLines_Mat" ),
|
||||
mPhysicsRep( NULL )
|
||||
mPhysicsRep( NULL ),
|
||||
mNormalLength( 0.3f )
|
||||
{
|
||||
mNetFlags.set( Ghostable | ScopeAlways );
|
||||
|
||||
|
|
@ -1102,8 +1102,6 @@ void ConvexShape::_updateGeometry( bool updateCollision )
|
|||
const Vector< ConvexShape::Triangle > &triangles = face.triangles;
|
||||
const ColorI &faceColor = sgConvexFaceColors[ i % sgConvexFaceColorCount ];
|
||||
|
||||
const Point3F binormal = mCross( face.normal, face.tangent );
|
||||
|
||||
for ( S32 j = 0; j < triangles.size(); j++ )
|
||||
{
|
||||
for ( S32 k = 0; k < 3; k++ )
|
||||
|
|
|
|||
|
|
@ -43,9 +43,6 @@
|
|||
|
||||
const U32 csmStaticCollisionMask = TerrainObjectType | StaticShapeObjectType | StaticObjectType;
|
||||
|
||||
const U32 csmDynamicCollisionMask = StaticShapeObjectType;
|
||||
|
||||
|
||||
IMPLEMENT_CO_DATABLOCK_V1(DebrisData);
|
||||
|
||||
ConsoleDocClass( DebrisData,
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ struct DebrisData : public GameBaseData
|
|||
F32 elasticity;
|
||||
F32 lifetime;
|
||||
F32 lifetimeVariance;
|
||||
U32 numBounces;
|
||||
U32 bounceVariance;
|
||||
S32 numBounces;
|
||||
S32 bounceVariance;
|
||||
F32 minSpinSpeed;
|
||||
F32 maxSpinSpeed;
|
||||
bool explodeOnMaxBounce; // explodes after it has bounced max times
|
||||
|
|
|
|||
|
|
@ -163,6 +163,7 @@ void GuiHealthBarHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
// Pulse the damage fill if it's below the threshold
|
||||
if (mPulseRate != 0)
|
||||
{
|
||||
if (mValue < mPulseThreshold)
|
||||
{
|
||||
U32 time = Platform::getVirtualMilliseconds();
|
||||
|
|
@ -171,7 +172,7 @@ void GuiHealthBarHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
}
|
||||
else
|
||||
mDamageFillColor.alpha = 1;
|
||||
|
||||
}
|
||||
// Render damage fill %
|
||||
RectI rect(updateRect);
|
||||
if(getWidth() > getHeight())
|
||||
|
|
|
|||
|
|
@ -110,9 +110,6 @@ ConsoleDocClass( GuiShapeNameHud,
|
|||
"@ingroup GuiGame\n"
|
||||
);
|
||||
|
||||
/// Default distance for object's information to be displayed.
|
||||
static const F32 cDefaultVisibleDistance = 500.0f;
|
||||
|
||||
GuiShapeNameHud::GuiShapeNameHud()
|
||||
{
|
||||
mFillColor.set( 0.25f, 0.25f, 0.25f, 0.25f );
|
||||
|
|
|
|||
|
|
@ -132,7 +132,6 @@ ConsoleDocClass( fxFoliageReplicator,
|
|||
// Trig Table Lookups.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
const F32 PeriodLen = (F32) 2.0f * (F32) M_PI;
|
||||
const F32 PeriodLenMinus = (F32) (2.0f * M_PI) - 0.01f;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -60,14 +60,14 @@ GFXImplementVertexFormat( GCVertex )
|
|||
};
|
||||
|
||||
GroundCoverShaderConstHandles::GroundCoverShaderConstHandles()
|
||||
: mTypeRectsSC( NULL ),
|
||||
: mGroundCover( NULL ),
|
||||
mTypeRectsSC( NULL ),
|
||||
mFadeSC( NULL ),
|
||||
mWindDirSC( NULL ),
|
||||
mGustInfoSC( NULL ),
|
||||
mTurbInfoSC( NULL ),
|
||||
mCamRightSC( NULL ),
|
||||
mCamUpSC( NULL ),
|
||||
mGroundCover( NULL )
|
||||
mCamUpSC( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class ParticleEmitterData : public GameBaseData
|
|||
/// of the ambient color on the particle.
|
||||
F32 ambientFactor;
|
||||
|
||||
U32 lifetimeMS; ///< Lifetime of particles
|
||||
S32 lifetimeMS; ///< Lifetime of particles
|
||||
U32 lifetimeVarianceMS; ///< Varience in lifetime from 0 to n
|
||||
|
||||
bool overrideAdvance; ///<
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ void Ribbon::addSegmentPoint(Point3F &point, MatrixF &mat) {
|
|||
U32 segmentsToDelete = checkRibbonDistance(mDataBlock->segmentsPerUpdate);
|
||||
|
||||
for (U32 i = 0; i < segmentsToDelete; i++) {
|
||||
U32 last = mSegmentPoints.size() - 1;
|
||||
S32 last = mSegmentPoints.size() - 1;
|
||||
if (last < 0)
|
||||
break;
|
||||
mTravelledDistance += last ? (mSegmentPoints[last] - mSegmentPoints[last-1]).len() : 0;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "T3D/gameBase/extended/extendedMove.h"
|
||||
#include "core/stream/bitStream.h"
|
||||
#include "math/mathIO.h"
|
||||
#include "math/mAngAxis.h"
|
||||
#include "core/module.h"
|
||||
#include "console/consoleTypes.h"
|
||||
#include "core/strings/stringFunctions.h"
|
||||
|
|
@ -15,15 +16,17 @@ MODULE_BEGIN( ExtendedMoveManager )
|
|||
|
||||
MODULE_END;
|
||||
|
||||
S32 ExtendedMoveManager::mPosX[ExtendedMove::MaxPositionsRotations] = { 0, };
|
||||
S32 ExtendedMoveManager::mPosY[ExtendedMove::MaxPositionsRotations] = { 0, };
|
||||
S32 ExtendedMoveManager::mPosZ[ExtendedMove::MaxPositionsRotations] = { 0, };
|
||||
F32 ExtendedMoveManager::mPosX[ExtendedMove::MaxPositionsRotations] = { 0, };
|
||||
F32 ExtendedMoveManager::mPosY[ExtendedMove::MaxPositionsRotations] = { 0, };
|
||||
F32 ExtendedMoveManager::mPosZ[ExtendedMove::MaxPositionsRotations] = { 0, };
|
||||
bool ExtendedMoveManager::mRotIsEuler[ExtendedMove::MaxPositionsRotations] = { 0, };
|
||||
F32 ExtendedMoveManager::mRotAX[ExtendedMove::MaxPositionsRotations] = { 0, };
|
||||
F32 ExtendedMoveManager::mRotAY[ExtendedMove::MaxPositionsRotations] = { 0, };
|
||||
F32 ExtendedMoveManager::mRotAZ[ExtendedMove::MaxPositionsRotations] = { 0, };
|
||||
F32 ExtendedMoveManager::mRotAA[ExtendedMove::MaxPositionsRotations] = { 1, };
|
||||
|
||||
F32 ExtendedMoveManager::mPosScale = 2.0f;
|
||||
|
||||
void ExtendedMoveManager::init()
|
||||
{
|
||||
for(U32 i = 0; i < ExtendedMove::MaxPositionsRotations; ++i)
|
||||
|
|
@ -31,19 +34,19 @@ void ExtendedMoveManager::init()
|
|||
char varName[256];
|
||||
|
||||
dSprintf(varName, sizeof(varName), "mvPosX%d", i);
|
||||
Con::addVariable(varName, TypeS32, &mPosX[i],
|
||||
Con::addVariable(varName, TypeF32, &mPosX[i],
|
||||
"X position of controller in millimeters. Only 13 bits are networked.\n"
|
||||
"@ingroup Game");
|
||||
"@ingroup Game");
|
||||
|
||||
dSprintf(varName, sizeof(varName), "mvPosY%d", i);
|
||||
Con::addVariable(varName, TypeS32, &mPosY[i],
|
||||
Con::addVariable(varName, TypeF32, &mPosY[i],
|
||||
"Y position of controller in millimeters. Only 13 bits are networked.\n"
|
||||
"@ingroup Game");
|
||||
"@ingroup Game");
|
||||
|
||||
dSprintf(varName, sizeof(varName), "mvPosZ%d", i);
|
||||
Con::addVariable(varName, TypeS32, &mPosZ[i],
|
||||
Con::addVariable(varName, TypeF32, &mPosZ[i],
|
||||
"Z position of controller in millimeters. Only 13 bits are networked.\n"
|
||||
"@ingroup Game");
|
||||
"@ingroup Game");
|
||||
|
||||
dSprintf(varName, sizeof(varName), "mvRotIsEuler%d", i);
|
||||
Con::addVariable(varName, TypeBool, &mRotIsEuler[i],
|
||||
|
|
@ -52,33 +55,39 @@ void ExtendedMoveManager::init()
|
|||
"(a vector and angle). When true, the given rotation is a three component "
|
||||
"Euler angle. When using Euler angles, the $mvRotA component of the ExtendedMove "
|
||||
"is ignored for this set of rotations.\n"
|
||||
"@ingroup Game");
|
||||
"@ingroup Game");
|
||||
|
||||
dSprintf(varName, sizeof(varName), "mvRotX%d", i);
|
||||
Con::addVariable(varName, TypeF32, &mRotAX[i],
|
||||
"X rotation vector component of controller.\n"
|
||||
"@ingroup Game");
|
||||
"@ingroup Game");
|
||||
|
||||
dSprintf(varName, sizeof(varName), "mvRotY%d", i);
|
||||
Con::addVariable(varName, TypeF32, &mRotAY[i],
|
||||
"Y rotation vector component of controller.\n"
|
||||
"@ingroup Game");
|
||||
"@ingroup Game");
|
||||
|
||||
dSprintf(varName, sizeof(varName), "mvRotZ%d", i);
|
||||
Con::addVariable(varName, TypeF32, &mRotAZ[i],
|
||||
"Z rotation vector component of controller.\n"
|
||||
"@ingroup Game");
|
||||
"@ingroup Game");
|
||||
|
||||
dSprintf(varName, sizeof(varName), "mvRotA%d", i);
|
||||
Con::addVariable(varName, TypeF32, &mRotAA[i],
|
||||
"Angle rotation (in degrees) component of controller.\n"
|
||||
"@ingroup Game");
|
||||
"@ingroup Game");
|
||||
}
|
||||
|
||||
Con::addVariable("mvPosScale", TypeF32, &mPosScale,
|
||||
"@brief Indicates the scale to be given to mvPos values.\n\n"
|
||||
""
|
||||
"@ingroup Game");
|
||||
}
|
||||
|
||||
const ExtendedMove NullExtendedMove;
|
||||
|
||||
#define CLAMPPOS(x) (x<0 ? -((-x) & (1<<(MaxPositionBits-1))-1) : (x & (1<<(MaxPositionBits-1))-1))
|
||||
#define CLAMPPOS(x) ((S32)(((x + 1) * .5) * ((1 << MaxPositionBits) - 1)) & ((1<<MaxPositionBits)-1))
|
||||
#define UNCLAMPPOS(x) ((F32)(x * 2 / F32((1 << MaxPositionBits) - 1) - 1.0f))
|
||||
#define CLAMPROT(f) ((S32)(((f + 1) * .5) * ((1 << MaxRotationBits) - 1)) & ((1<<MaxRotationBits)-1))
|
||||
#define UNCLAMPROT(x) ((F32)(x * 2 / F32((1 << MaxRotationBits) - 1) - 1.0f))
|
||||
|
||||
|
|
@ -94,6 +103,10 @@ ExtendedMove::ExtendedMove() : Move()
|
|||
rotZ[i] = 0;
|
||||
rotW[i] = 1;
|
||||
|
||||
cposX[i] = 0;
|
||||
cposY[i] = 0;
|
||||
cposZ[i] = 0;
|
||||
|
||||
EulerBasedRotation[i] = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -133,20 +146,20 @@ void ExtendedMove::pack(BitStream *stream, const Move * basemove)
|
|||
{
|
||||
// Position
|
||||
if(stream->writeFlag(posX[i] != extBaseMove->posX[i]))
|
||||
stream->writeSignedInt(posX[i], MaxPositionBits);
|
||||
stream->writeInt(cposX[i], MaxPositionBits);
|
||||
if(stream->writeFlag(posY[i] != extBaseMove->posY[i]))
|
||||
stream->writeSignedInt(posY[i], MaxPositionBits);
|
||||
stream->writeInt(cposY[i], MaxPositionBits);
|
||||
if(stream->writeFlag(posZ[i] != extBaseMove->posZ[i]))
|
||||
stream->writeSignedInt(posZ[i], MaxPositionBits);
|
||||
stream->writeInt(cposZ[i], MaxPositionBits);
|
||||
|
||||
// Rotation
|
||||
stream->writeFlag(EulerBasedRotation[i]);
|
||||
if(stream->writeFlag(rotX[i] != extBaseMove->rotX[i]))
|
||||
stream->writeInt(crotX[i], MaxRotationBits);
|
||||
stream->writeInt(crotX[i], EulerBasedRotation[i] ? MaxRotationBits : MaxPositionBits);
|
||||
if(stream->writeFlag(rotY[i] != extBaseMove->rotY[i]))
|
||||
stream->writeInt(crotY[i], MaxRotationBits);
|
||||
stream->writeInt(crotY[i], EulerBasedRotation[i] ? MaxRotationBits : MaxPositionBits);
|
||||
if(stream->writeFlag(rotZ[i] != extBaseMove->rotZ[i]))
|
||||
stream->writeInt(crotZ[i], MaxRotationBits);
|
||||
stream->writeInt(crotZ[i], EulerBasedRotation[i] ? MaxRotationBits : MaxPositionBits);
|
||||
if(!EulerBasedRotation[i])
|
||||
{
|
||||
if(stream->writeFlag(rotW[i] != extBaseMove->rotW[i]))
|
||||
|
|
@ -175,18 +188,27 @@ void ExtendedMove::unpack(BitStream *stream, const Move * basemove)
|
|||
for(U32 i=0; i<MaxPositionsRotations; ++i)
|
||||
{
|
||||
// Position
|
||||
if(stream->readFlag())
|
||||
posX[i] = stream->readSignedInt(MaxPositionBits);
|
||||
if (stream->readFlag())
|
||||
{
|
||||
cposX[i] = stream->readInt(MaxPositionBits);
|
||||
posX[i] = UNCLAMPPOS(cposX[i]) * ExtendedMoveManager::mPosScale;
|
||||
}
|
||||
else
|
||||
posX[i] = extBaseMove->posX[i];
|
||||
|
||||
if(stream->readFlag())
|
||||
posY[i] = stream->readSignedInt(MaxPositionBits);
|
||||
if (stream->readFlag())
|
||||
{
|
||||
cposY[i] = stream->readInt(MaxPositionBits);
|
||||
posY[i] = UNCLAMPPOS(cposY[i]) * ExtendedMoveManager::mPosScale;
|
||||
}
|
||||
else
|
||||
posY[i] = extBaseMove->posY[i];
|
||||
|
||||
if(stream->readFlag())
|
||||
posZ[i] = stream->readSignedInt(MaxPositionBits);
|
||||
if (stream->readFlag())
|
||||
{
|
||||
cposZ[i] = stream->readInt(MaxPositionBits);
|
||||
posZ[i] = UNCLAMPPOS(cposZ[i]) * ExtendedMoveManager::mPosScale;
|
||||
}
|
||||
else
|
||||
posZ[i] = extBaseMove->posZ[i];
|
||||
|
||||
|
|
@ -197,8 +219,8 @@ void ExtendedMove::unpack(BitStream *stream, const Move * basemove)
|
|||
scale = M_2PI_F;
|
||||
if(stream->readFlag())
|
||||
{
|
||||
crotX[i] = stream->readInt(MaxRotationBits);
|
||||
rotX[i] = UNCLAMPROT(crotX[i]) * scale;
|
||||
crotX[i] = stream->readInt(EulerBasedRotation[i] ? MaxRotationBits : MaxPositionBits);
|
||||
rotX[i] = EulerBasedRotation[i] ? (UNCLAMPROT(crotX[i]) * scale) : UNCLAMPPOS(crotX[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -207,8 +229,8 @@ void ExtendedMove::unpack(BitStream *stream, const Move * basemove)
|
|||
|
||||
if(stream->readFlag())
|
||||
{
|
||||
crotY[i] = stream->readInt(MaxRotationBits);
|
||||
rotY[i] = UNCLAMPROT(crotY[i]) * scale;
|
||||
crotY[i] = stream->readInt(EulerBasedRotation[i] ? MaxRotationBits : MaxPositionBits);
|
||||
rotY[i] = EulerBasedRotation[i] ? (UNCLAMPROT(crotY[i]) * scale) : UNCLAMPPOS(crotY[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -217,8 +239,8 @@ void ExtendedMove::unpack(BitStream *stream, const Move * basemove)
|
|||
|
||||
if(stream->readFlag())
|
||||
{
|
||||
crotZ[i] = stream->readInt(MaxRotationBits);
|
||||
rotZ[i] = UNCLAMPROT(crotZ[i]) * scale;
|
||||
crotZ[i] = stream->readInt(EulerBasedRotation[i] ? MaxRotationBits : MaxPositionBits);
|
||||
rotZ[i] = EulerBasedRotation[i] ? (UNCLAMPROT(crotZ[i]) * scale) : UNCLAMPPOS(crotZ[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -230,7 +252,7 @@ void ExtendedMove::unpack(BitStream *stream, const Move * basemove)
|
|||
if(stream->readFlag())
|
||||
{
|
||||
crotW[i] = stream->readInt(MaxRotationBits);
|
||||
rotW[i] = UNCLAMPROT(crotW[i]);
|
||||
rotW[i] = UNCLAMPROT(crotW[i]) * M_2PI_F;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -252,9 +274,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] / ExtendedMoveManager::mPosScale);
|
||||
cposY[i] = CLAMPPOS(posY[i] / ExtendedMoveManager::mPosScale);
|
||||
cposZ[i] = CLAMPPOS(posZ[i] / ExtendedMoveManager::mPosScale);
|
||||
|
||||
// Rotations
|
||||
if(EulerBasedRotation[i])
|
||||
|
|
@ -265,11 +287,29 @@ void ExtendedMove::clamp()
|
|||
}
|
||||
else
|
||||
{
|
||||
crotX[i] = CLAMPROT(rotX[i]);
|
||||
crotY[i] = CLAMPROT(rotY[i]);
|
||||
crotZ[i] = CLAMPROT(rotZ[i]);
|
||||
crotW[i] = CLAMPROT(rotW[i]);
|
||||
crotX[i] = CLAMPPOS(rotX[i]);
|
||||
crotY[i] = CLAMPPOS(rotY[i]);
|
||||
crotZ[i] = CLAMPPOS(rotZ[i]);
|
||||
crotW[i] = CLAMPROT(rotW[i] / M_2PI_F);
|
||||
}
|
||||
|
||||
#ifdef DEBUG_CONTROLLER_MOVE
|
||||
if (i == 1)
|
||||
{
|
||||
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("INPUT POS == %f,%f,%f", ExtendedMoveManager::mPosX[i], ExtendedMoveManager::mPosY[i], ExtendedMoveManager::mPosZ[i]);
|
||||
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);
|
||||
x = UNCLAMPPOS(cposX[i]) * ExtendedMoveManager::mPosScale;
|
||||
y = UNCLAMPPOS(cposX[i]) * ExtendedMoveManager::mPosScale;
|
||||
z = UNCLAMPPOS(cposX[i]) * ExtendedMoveManager::mPosScale;
|
||||
Con::printf("pos %f,%f,%f clamped to %f,%f,%f", posX[i], posY[i], posZ[i], x, y, z);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Perform the standard Move clamp
|
||||
|
|
@ -281,6 +321,10 @@ 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(cposX[i]) * ExtendedMoveManager::mPosScale;
|
||||
posY[i] = UNCLAMPPOS(cposY[i]) * ExtendedMoveManager::mPosScale;
|
||||
posZ[i] = UNCLAMPPOS(cposZ[i]) * ExtendedMoveManager::mPosScale;
|
||||
|
||||
// Rotations
|
||||
if(EulerBasedRotation[i])
|
||||
{
|
||||
|
|
@ -290,10 +334,10 @@ void ExtendedMove::unclamp()
|
|||
}
|
||||
else
|
||||
{
|
||||
rotX[i] = UNCLAMPROT(crotX[i]);
|
||||
rotY[i] = UNCLAMPROT(crotY[i]);
|
||||
rotZ[i] = UNCLAMPROT(crotZ[i]);
|
||||
rotW[i] = UNCLAMPROT(crotW[i]);
|
||||
rotX[i] = UNCLAMPPOS(crotX[i]);
|
||||
rotY[i] = UNCLAMPPOS(crotY[i]);
|
||||
rotZ[i] = UNCLAMPPOS(crotZ[i]);
|
||||
rotW[i] = UNCLAMPROT(crotW[i]) * M_2PI_F;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,12 +11,14 @@ struct ExtendedMove : public Move
|
|||
enum Constants {
|
||||
MaxPositionsRotations = 3,
|
||||
|
||||
MaxPositionBits = 13,
|
||||
MaxPositionBits = 16,
|
||||
MaxRotationBits = 16,
|
||||
};
|
||||
|
||||
// Position is in millimeters
|
||||
S32 posX[MaxPositionsRotations], posY[MaxPositionsRotations], posZ[MaxPositionsRotations];
|
||||
F32 posX[MaxPositionsRotations], posY[MaxPositionsRotations], posZ[MaxPositionsRotations];
|
||||
|
||||
S32 cposX[MaxPositionsRotations], cposY[MaxPositionsRotations], cposZ[MaxPositionsRotations];
|
||||
|
||||
bool EulerBasedRotation[MaxPositionsRotations];
|
||||
|
||||
|
|
@ -39,15 +41,17 @@ extern const ExtendedMove NullExtendedMove;
|
|||
class ExtendedMoveManager
|
||||
{
|
||||
public:
|
||||
static S32 mPosX[ExtendedMove::MaxPositionsRotations];
|
||||
static S32 mPosY[ExtendedMove::MaxPositionsRotations];
|
||||
static S32 mPosZ[ExtendedMove::MaxPositionsRotations];
|
||||
static F32 mPosX[ExtendedMove::MaxPositionsRotations];
|
||||
static F32 mPosY[ExtendedMove::MaxPositionsRotations];
|
||||
static F32 mPosZ[ExtendedMove::MaxPositionsRotations];
|
||||
static bool mRotIsEuler[ExtendedMove::MaxPositionsRotations];
|
||||
static F32 mRotAX[ExtendedMove::MaxPositionsRotations];
|
||||
static F32 mRotAY[ExtendedMove::MaxPositionsRotations];
|
||||
static F32 mRotAZ[ExtendedMove::MaxPositionsRotations];
|
||||
static F32 mRotAA[ExtendedMove::MaxPositionsRotations];
|
||||
|
||||
static F32 mPosScale;
|
||||
|
||||
static void init();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -75,11 +75,11 @@ bool ExtendedMoveList::getNextExtMove( ExtendedMove &curMove )
|
|||
else
|
||||
{
|
||||
//Rotation is passed in as an Angle Axis in degrees. We need to convert this into a Quat.
|
||||
QuatF q(Point3F(ExtendedMoveManager::mRotAX[i], ExtendedMoveManager::mRotAY[i], ExtendedMoveManager::mRotAZ[i]), mDegToRad(ExtendedMoveManager::mRotAA[i]));
|
||||
curMove.rotX[i] = q.x;
|
||||
curMove.rotY[i] = q.y;
|
||||
curMove.rotZ[i] = q.z;
|
||||
curMove.rotW[i] = q.w;
|
||||
AngAxisF q(Point3F(ExtendedMoveManager::mRotAX[i], ExtendedMoveManager::mRotAY[i], ExtendedMoveManager::mRotAZ[i]), mDegToRad(ExtendedMoveManager::mRotAA[i]));
|
||||
curMove.rotX[i] = q.axis.x;
|
||||
curMove.rotY[i] = q.axis.y;
|
||||
curMove.rotZ[i] = q.axis.z;
|
||||
curMove.rotW[i] = q.angle;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,14 +97,14 @@ IMPLEMENT_CALLBACK( GameBaseData, onRemove, void, ( GameBase* obj ), ( obj ),
|
|||
"@param obj the GameBase object\n\n"
|
||||
"@see onAdd for an example\n" );
|
||||
|
||||
IMPLEMENT_CALLBACK( GameBaseData, onMount, void, ( GameBase* obj, SceneObject* mountObj, S32 node ), ( obj, mountObj, node ),
|
||||
IMPLEMENT_CALLBACK( GameBaseData, onMount, void, ( SceneObject* obj, SceneObject* mountObj, S32 node ), ( obj, mountObj, node ),
|
||||
"@brief Called when the object is mounted to another object in the scene.\n\n"
|
||||
"@param obj the GameBase object being mounted\n"
|
||||
"@param mountObj the object we are mounted to\n"
|
||||
"@param node the mountObj node we are mounted to\n\n"
|
||||
"@see onAdd for an example\n" );
|
||||
|
||||
IMPLEMENT_CALLBACK( GameBaseData, onUnmount, void, ( GameBase* obj, SceneObject* mountObj, S32 node ), ( obj, mountObj, node ),
|
||||
IMPLEMENT_CALLBACK( GameBaseData, onUnmount, void, ( SceneObject* obj, SceneObject* mountObj, S32 node ), ( obj, mountObj, node ),
|
||||
"@brief Called when the object is unmounted from another object in the scene.\n\n"
|
||||
"@param obj the GameBase object being unmounted\n"
|
||||
"@param mountObj the object we are unmounted from\n"
|
||||
|
|
|
|||
|
|
@ -110,8 +110,8 @@ public:
|
|||
DECLARE_CALLBACK( void, onAdd, ( GameBase* obj ) );
|
||||
DECLARE_CALLBACK( void, onRemove, ( GameBase* obj ) );
|
||||
DECLARE_CALLBACK( void, onNewDataBlock, ( GameBase* obj ) );
|
||||
DECLARE_CALLBACK( void, onMount, ( GameBase* obj, SceneObject* mountObj, S32 node ) );
|
||||
DECLARE_CALLBACK( void, onUnmount, ( GameBase* obj, SceneObject* mountObj, S32 node ) );
|
||||
DECLARE_CALLBACK( void, onMount, ( SceneObject* obj, SceneObject* mountObj, S32 node ) );
|
||||
DECLARE_CALLBACK( void, onUnmount, ( SceneObject* obj, SceneObject* mountObj, S32 node ) );
|
||||
/// @}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -469,8 +469,8 @@ bool GameConnection::readConnectRequest(BitStream *stream, const char **errorStr
|
|||
|
||||
for(U32 i = 0; i < mConnectArgc+3; i++)
|
||||
{
|
||||
connectArgv[i].value = &connectArgvValue[i];
|
||||
connectArgvValue[i].init();
|
||||
connectArgv[i].value = &connectArgvValue[i];
|
||||
connectArgvValue[i].init();
|
||||
}
|
||||
|
||||
for(U32 i = 0; i < mConnectArgc; 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();
|
||||
|
|
@ -896,8 +914,8 @@ void GameConnection::onRemove()
|
|||
// clientgroup and what not (this is so that we can disconnect from a local server
|
||||
// without needing to destroy and recreate the server before we can connect to it
|
||||
// again).
|
||||
// Safe-delete as we don't know whether the server connection is currently being
|
||||
// worked on.
|
||||
// Safe-delete as we don't know whether the server connection is currently being
|
||||
// worked on.
|
||||
getRemoteConnection()->safeDeleteObject();
|
||||
setRemoteConnectionObject(NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,12 @@ class BitStream;
|
|||
|
||||
struct Move
|
||||
{
|
||||
enum { ChecksumBits = 16, ChecksumMask = ((1<<ChecksumBits)-1), ChecksumMismatch = U32(-1) };
|
||||
enum : U32
|
||||
{
|
||||
ChecksumBits = 16,
|
||||
ChecksumMask = ((1<<ChecksumBits)-1),
|
||||
ChecksumMismatch = U32(-1)
|
||||
};
|
||||
|
||||
// packed storage rep, set in clamp
|
||||
S32 px, py, pz;
|
||||
|
|
|
|||
|
|
@ -348,13 +348,13 @@ bool GameProcessCameraQuery(CameraQuery *query)
|
|||
query->farPlane = gClientSceneGraph->getVisibleDistance() * CameraAndFOV::sVisDistanceScale;
|
||||
|
||||
// Provide some default values
|
||||
query->projectionOffset = Point2F::Zero;
|
||||
query->stereoTargets[0] = 0;
|
||||
query->stereoTargets[1] = 0;
|
||||
query->eyeOffset[0] = Point3F::Zero;
|
||||
query->eyeOffset[1] = Point3F::Zero;
|
||||
query->hasFovPort = false;
|
||||
query->hasStereoTargets = false;
|
||||
query->displayDevice = NULL;
|
||||
|
||||
F32 cameraFov = 0.0f;
|
||||
bool fovSet = false;
|
||||
|
|
@ -364,6 +364,9 @@ bool GameProcessCameraQuery(CameraQuery *query)
|
|||
if(!gEditingMission && connection->hasDisplayDevice())
|
||||
{
|
||||
IDisplayDevice* display = connection->getDisplayDevice();
|
||||
|
||||
query->displayDevice = display;
|
||||
|
||||
// Note: all eye values are invalid until this is called
|
||||
display->setDrawCanvas(query->drawCanvas);
|
||||
|
||||
|
|
@ -372,12 +375,6 @@ bool GameProcessCameraQuery(CameraQuery *query)
|
|||
// Display may activate AFTER so we need to call this again just in case
|
||||
display->onStartFrame();
|
||||
|
||||
// The connection's display device may want to set the projection offset
|
||||
if(display->providesProjectionOffset())
|
||||
{
|
||||
query->projectionOffset = display->getProjectionOffset();
|
||||
}
|
||||
|
||||
// The connection's display device may want to set the eye offset
|
||||
if(display->providesEyeOffsets())
|
||||
{
|
||||
|
|
@ -394,6 +391,7 @@ bool GameProcessCameraQuery(CameraQuery *query)
|
|||
|
||||
// Grab the latest overriding render view transforms
|
||||
connection->getControlCameraEyeTransforms(display, query->eyeTransforms);
|
||||
connection->getControlCameraHeadTransform(display, &query->headMatrix);
|
||||
|
||||
display->getStereoViewports(query->stereoViewports);
|
||||
display->getStereoTargets(query->stereoTargets);
|
||||
|
|
@ -403,6 +401,7 @@ bool GameProcessCameraQuery(CameraQuery *query)
|
|||
{
|
||||
query->eyeTransforms[0] = query->cameraMatrix;
|
||||
query->eyeTransforms[1] = query->cameraMatrix;
|
||||
query->headMatrix = query->cameraMatrix;
|
||||
}
|
||||
|
||||
// Use the connection's FOV settings if requried
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ GroundPlane::GroundPlane()
|
|||
mScaleU( 1.0f ),
|
||||
mScaleV( 1.0f ),
|
||||
mMaterial( NULL ),
|
||||
mPhysicsRep( NULL ),
|
||||
mMin( 0.0f, 0.0f ),
|
||||
mMax( 0.0f, 0.0f ),
|
||||
mPhysicsRep( NULL )
|
||||
mMax( 0.0f, 0.0f )
|
||||
{
|
||||
mTypeMask |= StaticObjectType | StaticShapeObjectType;
|
||||
mNetFlags.set( Ghostable | ScopeAlways );
|
||||
|
|
|
|||
|
|
@ -36,15 +36,15 @@
|
|||
|
||||
// GuiMaterialPreview
|
||||
GuiMaterialPreview::GuiMaterialPreview()
|
||||
: mMaxOrbitDist(5.0f),
|
||||
mMinOrbitDist(0.0f),
|
||||
mOrbitDist(5.0f),
|
||||
mMouseState(None),
|
||||
: mMouseState(None),
|
||||
mModel(NULL),
|
||||
mLastMousePoint(0, 0),
|
||||
lastRenderTime(0),
|
||||
runThread(0),
|
||||
mFakeSun(NULL)
|
||||
lastRenderTime(0),
|
||||
mLastMousePoint(0, 0),
|
||||
mFakeSun(NULL),
|
||||
mMaxOrbitDist(5.0f),
|
||||
mMinOrbitDist(0.0f),
|
||||
mOrbitDist(5.0f)
|
||||
{
|
||||
mActive = true;
|
||||
mCameraMatrix.identity();
|
||||
|
|
|
|||
|
|
@ -89,21 +89,21 @@ IMPLEMENT_CALLBACK( GuiObjectView, onMouseLeave, void, (),(),
|
|||
//------------------------------------------------------------------------------
|
||||
|
||||
GuiObjectView::GuiObjectView()
|
||||
: mMaxOrbitDist( 5.0f ),
|
||||
mMinOrbitDist( 0.0f ),
|
||||
mOrbitDist( 5.0f ),
|
||||
mMouseState( None ),
|
||||
mModel( NULL ),
|
||||
mMountedModel( NULL ),
|
||||
: mMouseState( None ),
|
||||
mLastMousePoint( 0, 0 ),
|
||||
mLastRenderTime( 0 ),
|
||||
mRunThread( NULL ),
|
||||
mLight( NULL ),
|
||||
mAnimationSeq( -1 ),
|
||||
mMountNodeName( "mount0" ),
|
||||
mMountNode( -1 ),
|
||||
mModel( NULL ),
|
||||
mMaxOrbitDist( 5.0f ),
|
||||
mMinOrbitDist( 0.0f ),
|
||||
mCameraRotation( 0.0f, 0.0f, 0.0f ),
|
||||
mOrbitDist( 5.0f ),
|
||||
mCameraSpeed( 0.01f ),
|
||||
mCameraRotation( 0.0f, 0.0f, 0.0f ),
|
||||
mMountNode( -1 ),
|
||||
mMountNodeName( "mount0" ),
|
||||
mMountedModel( NULL ),
|
||||
mAnimationSeq( -1 ),
|
||||
mRunThread( NULL ),
|
||||
mLastRenderTime( 0 ),
|
||||
mLight( NULL ),
|
||||
mLightColor( 1.0f, 1.0f, 1.0f ),
|
||||
mLightAmbient( 0.5f, 0.5f, 0.5f ),
|
||||
mLightDirection( 0.f, 0.707f, -0.707f )
|
||||
|
|
|
|||
|
|
@ -79,16 +79,16 @@ static SFXAmbience sDefaultAmbience;
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
LevelInfo::LevelInfo()
|
||||
: mNearClip( 0.1f ),
|
||||
: mWorldSize( 10000.0f ),
|
||||
mNearClip( 0.1f ),
|
||||
mVisibleDistance( 1000.0f ),
|
||||
mVisibleGhostDistance ( 0 ),
|
||||
mDecalBias( 0.0015f ),
|
||||
mCanvasClearColor( 255, 0, 255, 255 ),
|
||||
mAmbientLightBlendPhase( 1.f ),
|
||||
mSoundAmbience( NULL ),
|
||||
mSoundscape( NULL ),
|
||||
mSoundDistanceModel( SFXDistanceModelLinear ),
|
||||
mWorldSize( 10000.0f ),
|
||||
mAmbientLightBlendPhase( 1.f )
|
||||
mSoundscape( NULL )
|
||||
{
|
||||
mFogData.density = 0.0f;
|
||||
mFogData.densityOffset = 0.0f;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "gfx/gfxOcclusionQuery.h"
|
||||
#include "gfx/gfxDrawUtil.h"
|
||||
#include "gfx/gfxTextureManager.h"
|
||||
#include "gfx/sim/debugDraw.h"
|
||||
#include "renderInstance/renderPassManager.h"
|
||||
#include "T3D/gameBase/gameConnection.h"
|
||||
#include "T3D/gameBase/processList.h"
|
||||
|
|
@ -117,11 +118,11 @@ ConsoleDocClass( LightFlareData,
|
|||
);
|
||||
|
||||
LightFlareData::LightFlareData()
|
||||
: mFlareEnabled( true ),
|
||||
mElementCount( 0 ),
|
||||
mScale( 1.0f ),
|
||||
: mScale( 1.0f ),
|
||||
mFlareEnabled( true ),
|
||||
mOcclusionRadius( 0.0f ),
|
||||
mRenderReflectPass( true )
|
||||
mRenderReflectPass( true ),
|
||||
mElementCount( 0 )
|
||||
{
|
||||
dMemset( mElementRect, 0, sizeof( RectF ) * MAX_ELEMENTS );
|
||||
dMemset( mElementScale, 0, sizeof( F32 ) * MAX_ELEMENTS );
|
||||
|
|
@ -275,12 +276,10 @@ bool LightFlareData::_testVisibility(const SceneRenderState *state, LightFlareSt
|
|||
// is on scren at all... if not then return
|
||||
// the last result.
|
||||
const Point3F &lightPos = flareState->lightMat.getPosition();
|
||||
const RectI &viewport = GFX->getViewport();
|
||||
MatrixF projMatrix;
|
||||
state->getCameraFrustum().getProjectionMatrix(&projMatrix);
|
||||
if( state->isReflectPass() )
|
||||
projMatrix = state->getSceneManager()->getNonClipProjection();
|
||||
bool onScreen = MathUtils::mProjectWorldToScreen( lightPos, outLightPosSS, viewport, GFX->getWorldMatrix(), projMatrix );
|
||||
const RectI &viewport = RectI(Point2I(0, 0), GFX->getViewport().extent);
|
||||
MatrixF camProjMatrix = state->getSceneManager()->getNonClipProjection();
|
||||
|
||||
bool onScreen = MathUtils::mProjectWorldToScreen( lightPos, outLightPosSS, viewport, GFX->getWorldMatrix(), camProjMatrix );
|
||||
|
||||
// It is onscreen, so raycast as a simple occlusion test.
|
||||
const LightInfo *lightInfo = flareState->lightInfo;
|
||||
|
|
@ -297,7 +296,7 @@ bool LightFlareData::_testVisibility(const SceneRenderState *state, LightFlareSt
|
|||
// Always treat light as onscreen if using HOQ
|
||||
// it will be faded out if offscreen anyway.
|
||||
onScreen = true;
|
||||
needsRaycast = false;
|
||||
needsRaycast = false;
|
||||
|
||||
// Test the hardware queries for rendered pixels.
|
||||
U32 pixels = 0, fullPixels = 0;
|
||||
|
|
@ -400,63 +399,75 @@ bool LightFlareData::_testVisibility(const SceneRenderState *state, LightFlareSt
|
|||
return lightVisible;
|
||||
}
|
||||
|
||||
void LightFlareData::prepRender( SceneRenderState *state, LightFlareState *flareState )
|
||||
void LightFlareData::prepRender(SceneRenderState *state, LightFlareState *flareState)
|
||||
{
|
||||
PROFILE_SCOPE( LightFlareData_prepRender );
|
||||
PROFILE_SCOPE(LightFlareData_prepRender);
|
||||
|
||||
const LightInfo *lightInfo = flareState->lightInfo;
|
||||
|
||||
if ( mIsZero( flareState->fullBrightness ) ||
|
||||
mIsZero( lightInfo->getBrightness() ) )
|
||||
return;
|
||||
if (mIsZero(flareState->fullBrightness) ||
|
||||
mIsZero(lightInfo->getBrightness()))
|
||||
return;
|
||||
|
||||
// Figure out the element count to render.
|
||||
U32 elementCount = mElementCount;
|
||||
const bool isReflectPass = state->isReflectPass();
|
||||
if ( isReflectPass )
|
||||
if (isReflectPass)
|
||||
{
|
||||
// Then we don't render anything this pass.
|
||||
if ( !mRenderReflectPass )
|
||||
if (!mRenderReflectPass)
|
||||
return;
|
||||
|
||||
// Find the zero distance elements which make
|
||||
// up the corona of the light flare.
|
||||
elementCount = 0.0f;
|
||||
for ( U32 i=0; i < mElementCount; i++ )
|
||||
if ( mIsZero( mElementDist[i] ) )
|
||||
elementCount++;
|
||||
for (U32 i = 0; i < mElementCount; i++)
|
||||
if (mIsZero(mElementDist[i]))
|
||||
elementCount++;
|
||||
}
|
||||
|
||||
// Better have something to render.
|
||||
if ( elementCount == 0 )
|
||||
if (elementCount == 0)
|
||||
return;
|
||||
|
||||
|
||||
U32 visDelta = U32_MAX;
|
||||
F32 occlusionFade = 1.0f;
|
||||
Point3F lightPosSS;
|
||||
bool lightVisible = _testVisibility( state, flareState, &visDelta, &occlusionFade, &lightPosSS );
|
||||
|
||||
bool lightVisible = _testVisibility(state, flareState, &visDelta, &occlusionFade, &lightPosSS);
|
||||
|
||||
//DebugDrawer::get()->drawBox(flareState->lightMat.getPosition() + Point3F(-0.5, -0.5, -0.5) * 4, flareState->lightMat.getPosition() + Point3F(0.5, 0.5, 0.5) * 4, ColorI::BLUE);
|
||||
|
||||
// We can only skip rendering if the light is not
|
||||
// visible, and it has elapsed the fade out time.
|
||||
if ( mIsZero( occlusionFade ) ||
|
||||
!lightVisible && visDelta > FadeOutTime )
|
||||
if (mIsZero(occlusionFade) ||
|
||||
!lightVisible && visDelta > FadeOutTime)
|
||||
return;
|
||||
|
||||
const RectI &viewport = GFX->getViewport();
|
||||
Point3F oneOverViewportExtent( 1.0f / (F32)viewport.extent.x, 1.0f / (F32)viewport.extent.y, 0.0f );
|
||||
Point3F oneOverViewportExtent(1.0f / (F32)viewport.extent.x, 1.0f / (F32)viewport.extent.y, 0.0f);
|
||||
|
||||
// Really convert it to screen space.
|
||||
lightPosSS.x -= viewport.point.x;
|
||||
lightPosSS.y -= viewport.point.y;
|
||||
lightPosSS *= oneOverViewportExtent;
|
||||
lightPosSS = ( lightPosSS * 2.0f ) - Point3F::One;
|
||||
lightPosSS = (lightPosSS * 2.0f) - Point3F::One;
|
||||
lightPosSS.y = -lightPosSS.y;
|
||||
lightPosSS.z = 0.0f;
|
||||
|
||||
// Determine the center of the current projection so we can converge there
|
||||
Point3F centerProj(0);
|
||||
{
|
||||
MatrixF camProjMatrix = state->getSceneManager()->getNonClipProjection();
|
||||
Point3F outCenterPos;
|
||||
RectI centerViewport = RectI(Point2I(0, 0), viewport.extent);
|
||||
MathUtils::mProjectWorldToScreen(Point3F(0,state->getSceneManager()->getNearClip(),0), &outCenterPos, centerViewport, MatrixF::Identity, camProjMatrix);
|
||||
centerProj = outCenterPos;
|
||||
centerProj *= oneOverViewportExtent;
|
||||
centerProj = (centerProj * 2.0f) - Point3F::One;
|
||||
centerProj.y = -centerProj.y;
|
||||
centerProj.z = 0.0f;
|
||||
}
|
||||
|
||||
// Take any projection offset into account so that the point where the flare's
|
||||
// elements converge is at the 'eye' point rather than the center of the viewport.
|
||||
const Point2F& projOffset = state->getCameraFrustum().getProjectionOffset();
|
||||
Point3F flareVec( -lightPosSS + Point3F(projOffset.x, projOffset.y, 0.0f) );
|
||||
Point3F flareVec( centerProj - lightPosSS );
|
||||
const F32 flareLength = flareVec.len();
|
||||
if ( flareLength > 0.0f )
|
||||
flareVec *= 1.0f / flareLength;
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ enum SceneObjectTypes
|
|||
/// @}
|
||||
};
|
||||
|
||||
enum SceneObjectTypeMasks
|
||||
enum SceneObjectTypeMasks : U32
|
||||
{
|
||||
STATIC_COLLISION_TYPEMASK = (StaticShapeObjectType |
|
||||
EntityObjectType),
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ struct PhysicsState
|
|||
momentum( Point3F::Zero ),
|
||||
orientation( QuatF::Identity ),
|
||||
angularMomentum( Point3F::Zero ),
|
||||
sleeping( false ),
|
||||
linVelocity( Point3F::Zero ),
|
||||
angVelocity( Point3F::Zero ),
|
||||
sleeping( false )
|
||||
angVelocity( Point3F::Zero )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -312,11 +312,11 @@ PhysicsDebris* PhysicsDebris::create( PhysicsDebrisData *datablock,
|
|||
}
|
||||
|
||||
PhysicsDebris::PhysicsDebris()
|
||||
: mDataBlock( NULL ),
|
||||
mLifetime( 0.0f ),
|
||||
: mLifetime( 0.0f ),
|
||||
mInitialLinVel( Point3F::Zero ),
|
||||
mDataBlock( NULL ),
|
||||
mShapeInstance( NULL ),
|
||||
mWorld( NULL ),
|
||||
mInitialLinVel( Point3F::Zero )
|
||||
mWorld( NULL )
|
||||
{
|
||||
mTypeMask |= DebrisObjectType | DynamicShapeObjectType;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,9 +41,10 @@ ConsoleDocClass( PhysicsForce,
|
|||
|
||||
|
||||
PhysicsForce::PhysicsForce()
|
||||
: mWorld( NULL ),
|
||||
mBody( NULL ),
|
||||
mPhysicsTick( false )
|
||||
:
|
||||
mWorld( NULL ),
|
||||
mPhysicsTick( false ),
|
||||
mBody( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -401,12 +401,12 @@ ConsoleDocClass( PhysicsShape,
|
|||
PhysicsShape::PhysicsShape()
|
||||
: mPhysicsRep( NULL ),
|
||||
mWorld( NULL ),
|
||||
mShapeInst( NULL ),
|
||||
mResetPos( MatrixF::Identity ),
|
||||
mShapeInst( NULL ),
|
||||
mDestroyed( false ),
|
||||
mPlayAmbient( false ),
|
||||
mAmbientThread( NULL ),
|
||||
mAmbientSeq( -1 )
|
||||
mAmbientSeq( -1 ),
|
||||
mAmbientThread( NULL )
|
||||
{
|
||||
mNetFlags.set( Ghostable | ScopeAlways );
|
||||
mTypeMask |= DynamicShapeObjectType;
|
||||
|
|
|
|||
|
|
@ -55,11 +55,12 @@ public:
|
|||
|
||||
/// The constructor.
|
||||
PhysicsUserData()
|
||||
: mObject( NULL ),
|
||||
:
|
||||
#ifdef TORQUE_DEBUG
|
||||
mTypeId( smTypeName ),
|
||||
#endif
|
||||
mObject( NULL ),
|
||||
mBody( NULL )
|
||||
#ifdef TORQUE_DEBUG
|
||||
, mTypeId( smTypeName )
|
||||
#endif
|
||||
{}
|
||||
|
||||
/// The destructor.
|
||||
|
|
@ -117,4 +118,4 @@ protected:
|
|||
PhysicsBody *mBody;
|
||||
};
|
||||
|
||||
#endif // _PHYSICS_PHYSICSUSERDATA_H_
|
||||
#endif // _PHYSICS_PHYSICSUSERDATA_H_
|
||||
|
|
|
|||
|
|
@ -56,11 +56,18 @@
|
|||
#include "T3D/decal/decalManager.h"
|
||||
#include "T3D/decal/decalData.h"
|
||||
#include "materials/baseMatInstance.h"
|
||||
#include "math/mathUtils.h"
|
||||
#include "gfx/sim/debugDraw.h"
|
||||
|
||||
#ifdef TORQUE_EXTENDED_MOVE
|
||||
#include "T3D/gameBase/extended/extendedMove.h"
|
||||
#endif
|
||||
|
||||
#ifdef TORQUE_OPENVR
|
||||
#include "platform/input/openVR/openVRProvider.h"
|
||||
#include "platform/input/openVR/openVRTrackedObject.h"
|
||||
#endif
|
||||
|
||||
// Amount of time if takes to transition to a new action sequence.
|
||||
static F32 sAnimationTransitionTime = 0.25f;
|
||||
static bool sUseAnimationTransitions = true;
|
||||
|
|
@ -102,8 +109,6 @@ static S32 sMaxPredictionTicks = 30; // Number of ticks to predict
|
|||
|
||||
S32 Player::smExtendedMoveHeadPosRotIndex = 0; // The ExtendedMove position/rotation index used for head movements
|
||||
|
||||
// Anchor point compression
|
||||
const F32 sAnchorMaxDistance = 32.0f;
|
||||
|
||||
//
|
||||
static U32 sCollisionMoveMask = TerrainObjectType |
|
||||
|
|
@ -1776,7 +1781,7 @@ void Player::onRemove()
|
|||
mWorkingQueryBox.minExtents.set(-1e9f, -1e9f, -1e9f);
|
||||
mWorkingQueryBox.maxExtents.set(-1e9f, -1e9f, -1e9f);
|
||||
|
||||
SAFE_DELETE( mPhysicsRep );
|
||||
SAFE_DELETE( mPhysicsRep );
|
||||
|
||||
Parent::onRemove();
|
||||
}
|
||||
|
|
@ -2489,10 +2494,25 @@ void Player::allowAllPoses()
|
|||
mAllowSwimming = true;
|
||||
}
|
||||
|
||||
AngAxisF gPlayerMoveRot;
|
||||
|
||||
void Player::updateMove(const Move* move)
|
||||
{
|
||||
delta.move = *move;
|
||||
|
||||
#ifdef TORQUE_OPENVR
|
||||
if (mControllers[0])
|
||||
{
|
||||
mControllers[0]->processTick(move);
|
||||
}
|
||||
|
||||
if (mControllers[1])
|
||||
{
|
||||
mControllers[1]->processTick(move);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Is waterCoverage high enough to be 'swimming'?
|
||||
{
|
||||
bool swimming = mWaterCoverage > 0.65f && canSwim();
|
||||
|
|
@ -2531,6 +2551,7 @@ void Player::updateMove(const Move* move)
|
|||
delta.headVec = mHead;
|
||||
|
||||
bool doStandardMove = true;
|
||||
bool absoluteDelta = false;
|
||||
GameConnection* con = getControllingClient();
|
||||
|
||||
#ifdef TORQUE_EXTENDED_MOVE
|
||||
|
|
@ -2618,6 +2639,38 @@ void Player::updateMove(const Move* move)
|
|||
while (mHead.y > M_PI_F)
|
||||
mHead.y -= M_2PI_F;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Orient the player so we are looking towards the required position, ignoring any banking
|
||||
AngAxisF moveRot(Point3F(emove->rotX[emoveIndex], emove->rotY[emoveIndex], emove->rotZ[emoveIndex]), emove->rotW[emoveIndex]);
|
||||
MatrixF trans(1);
|
||||
moveRot.setMatrix(&trans);
|
||||
trans.inverse();
|
||||
|
||||
Point3F vecForward(0, 10, 0);
|
||||
Point3F viewAngle;
|
||||
Point3F orient;
|
||||
EulerF rot;
|
||||
trans.mulV(vecForward);
|
||||
viewAngle = vecForward;
|
||||
vecForward.z = 0; // flatten
|
||||
vecForward.normalizeSafe();
|
||||
|
||||
F32 yawAng;
|
||||
F32 pitchAng;
|
||||
MathUtils::getAnglesFromVector(vecForward, yawAng, pitchAng);
|
||||
|
||||
mRot = EulerF(0);
|
||||
mRot.z = yawAng;
|
||||
mHead = EulerF(0);
|
||||
|
||||
while (mRot.z < 0.0f)
|
||||
mRot.z += M_2PI_F;
|
||||
while (mRot.z > M_2PI_F)
|
||||
mRot.z -= M_2PI_F;
|
||||
|
||||
absoluteDelta = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -2666,6 +2719,13 @@ void Player::updateMove(const Move* move)
|
|||
|
||||
delta.head = mHead;
|
||||
delta.headVec -= mHead;
|
||||
|
||||
if (absoluteDelta)
|
||||
{
|
||||
delta.headVec = Point3F(0, 0, 0);
|
||||
delta.rotVec = Point3F(0, 0, 0);
|
||||
}
|
||||
|
||||
for(U32 i=0; i<3; ++i)
|
||||
{
|
||||
if (delta.headVec[i] > M_PI_F)
|
||||
|
|
@ -3275,9 +3335,9 @@ bool Player::canCrouch()
|
|||
if ( mDataBlock->actionList[PlayerData::CrouchRootAnim].sequence == -1 )
|
||||
return false;
|
||||
|
||||
// We are already in this pose, so don't test it again...
|
||||
if ( mPose == CrouchPose )
|
||||
return true;
|
||||
// We are already in this pose, so don't test it again...
|
||||
if ( mPose == CrouchPose )
|
||||
return true;
|
||||
|
||||
// Do standard Torque physics test here!
|
||||
if ( !mPhysicsRep )
|
||||
|
|
@ -3327,8 +3387,8 @@ bool Player::canStand()
|
|||
return false;
|
||||
|
||||
// We are already in this pose, so don't test it again...
|
||||
if ( mPose == StandPose )
|
||||
return true;
|
||||
if ( mPose == StandPose )
|
||||
return true;
|
||||
|
||||
// Do standard Torque physics test here!
|
||||
if ( !mPhysicsRep )
|
||||
|
|
@ -3391,9 +3451,9 @@ bool Player::canProne()
|
|||
if ( !mPhysicsRep )
|
||||
return true;
|
||||
|
||||
// We are already in this pose, so don't test it again...
|
||||
if ( mPose == PronePose )
|
||||
return true;
|
||||
// We are already in this pose, so don't test it again...
|
||||
if ( mPose == PronePose )
|
||||
return true;
|
||||
|
||||
return mPhysicsRep->testSpacials( getPosition(), mDataBlock->proneBoxSize );
|
||||
}
|
||||
|
|
@ -3590,7 +3650,7 @@ MatrixF * Player::Death::fallToGround(F32 dt, const Point3F& loc, F32 curZ, F32
|
|||
normal.normalize();
|
||||
mat.set(EulerF (0.0f, 0.0f, curZ));
|
||||
mat.mulV(upY, & ahead);
|
||||
mCross(ahead, normal, &sideVec);
|
||||
mCross(ahead, normal, &sideVec);
|
||||
sideVec.normalize();
|
||||
mCross(normal, sideVec, &ahead);
|
||||
|
||||
|
|
@ -3773,11 +3833,13 @@ void Player::updateActionThread()
|
|||
// Select an action animation sequence, this assumes that
|
||||
// this function is called once per tick.
|
||||
if(mActionAnimation.action != PlayerData::NullAnimation)
|
||||
{
|
||||
if (mActionAnimation.forward)
|
||||
mActionAnimation.atEnd = mShapeInstance->getPos(mActionAnimation.thread) == 1;
|
||||
else
|
||||
mActionAnimation.atEnd = mShapeInstance->getPos(mActionAnimation.thread) == 0;
|
||||
|
||||
}
|
||||
|
||||
// Only need to deal with triggers on the client
|
||||
if( isGhost() )
|
||||
{
|
||||
|
|
@ -4452,7 +4514,7 @@ void Player::onImageAnimThreadUpdate(U32 imageSlot, S32 imageShapeIndex, F32 dt)
|
|||
}
|
||||
}
|
||||
|
||||
void Player::onUnmount( ShapeBase *obj, S32 node )
|
||||
void Player::onUnmount( SceneObject *obj, S32 node )
|
||||
{
|
||||
// Reset back to root position during dismount.
|
||||
setActionThread(PlayerData::RootAnim,true,false,false);
|
||||
|
|
@ -4519,6 +4581,7 @@ void Player::updateAnimationTree(bool firstPerson)
|
|||
{
|
||||
S32 mode = 0;
|
||||
if (firstPerson)
|
||||
{
|
||||
if (mActionAnimation.firstPerson)
|
||||
mode = 0;
|
||||
// TSShapeInstance::MaskNodeRotation;
|
||||
|
|
@ -4526,7 +4589,7 @@ void Player::updateAnimationTree(bool firstPerson)
|
|||
// TSShapeInstance::MaskNodePosY;
|
||||
else
|
||||
mode = TSShapeInstance::MaskNodeAllButBlend;
|
||||
|
||||
}
|
||||
for (U32 i = 0; i < PlayerData::NumSpineNodes; i++)
|
||||
if (mDataBlock->spineNode[i] != -1)
|
||||
mShapeInstance->setNodeAnimationState(mDataBlock->spineNode[i],mode);
|
||||
|
|
@ -5589,58 +5652,6 @@ void Player::getMuzzleTransform(U32 imageSlot,MatrixF* mat)
|
|||
*mat = nmat;
|
||||
}
|
||||
|
||||
DisplayPose Player::calcCameraDeltaPose(GameConnection *con, const DisplayPose& inPose)
|
||||
{
|
||||
// NOTE: this is intended to be similar to updateMove
|
||||
DisplayPose outPose;
|
||||
outPose.orientation = getRenderTransform().toEuler();
|
||||
outPose.position = inPose.position;
|
||||
|
||||
if (con && con->getControlSchemeAbsoluteRotation())
|
||||
{
|
||||
// Pitch
|
||||
outPose.orientation.x = (inPose.orientation.x - mLastAbsolutePitch);
|
||||
|
||||
// Constrain the range of mRot.x
|
||||
while (outPose.orientation.x < -M_PI_F)
|
||||
outPose.orientation.x += M_2PI_F;
|
||||
while (outPose.orientation.x > M_PI_F)
|
||||
outPose.orientation.x -= M_2PI_F;
|
||||
|
||||
// Yaw
|
||||
|
||||
// Rotate (heading) head or body?
|
||||
if ((isMounted() && getMountNode() == 0) || (con && !con->isFirstPerson()))
|
||||
{
|
||||
// Rotate head
|
||||
outPose.orientation.z = (inPose.orientation.z - mLastAbsoluteYaw);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Rotate body
|
||||
outPose.orientation.z = (inPose.orientation.z - mLastAbsoluteYaw);
|
||||
}
|
||||
|
||||
// Constrain the range of mRot.z
|
||||
while (outPose.orientation.z < 0.0f)
|
||||
outPose.orientation.z += M_2PI_F;
|
||||
while (outPose.orientation.z > M_2PI_F)
|
||||
outPose.orientation.z -= M_2PI_F;
|
||||
|
||||
// Bank
|
||||
if (mDataBlock->cameraCanBank)
|
||||
{
|
||||
outPose.orientation.y = (inPose.orientation.y - mLastAbsoluteRoll);
|
||||
}
|
||||
|
||||
// Constrain the range of mRot.y
|
||||
while (outPose.orientation.y > M_PI_F)
|
||||
outPose.orientation.y -= M_2PI_F;
|
||||
}
|
||||
|
||||
return outPose;
|
||||
}
|
||||
|
||||
void Player::getRenderMuzzleTransform(U32 imageSlot,MatrixF* mat)
|
||||
{
|
||||
disableHeadZCalc();
|
||||
|
|
@ -5836,7 +5847,7 @@ F32 Player::getSpeed() const
|
|||
|
||||
void Player::setVelocity(const VectorF& vel)
|
||||
{
|
||||
AssertFatal( !mIsNaN( vel ), "Player::setVelocity() - The velocity is NaN!" );
|
||||
AssertFatal( !mIsNaN( vel ), "Player::setVelocity() - The velocity is NaN!" );
|
||||
|
||||
mVelocity = vel;
|
||||
setMaskBits(MoveMask);
|
||||
|
|
@ -5844,7 +5855,7 @@ void Player::setVelocity(const VectorF& vel)
|
|||
|
||||
void Player::applyImpulse(const Point3F&,const VectorF& vec)
|
||||
{
|
||||
AssertFatal( !mIsNaN( vec ), "Player::applyImpulse() - The vector is NaN!" );
|
||||
AssertFatal( !mIsNaN( vec ), "Player::applyImpulse() - The vector is NaN!" );
|
||||
|
||||
// Players ignore angular velocity
|
||||
VectorF vel;
|
||||
|
|
@ -6192,7 +6203,7 @@ U32 Player::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
stream->writeFlag(mSwimming);
|
||||
stream->writeFlag(mJetting);
|
||||
stream->writeInt(mPose, NumPoseBits);
|
||||
|
||||
|
||||
stream->writeInt(mState,NumStateBits);
|
||||
if (stream->writeFlag(mState == RecoverState))
|
||||
stream->writeInt(mRecoverTicks,PlayerData::RecoverDelayBits);
|
||||
|
|
@ -6293,7 +6304,7 @@ void Player::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
mSwimming = stream->readFlag();
|
||||
mJetting = stream->readFlag();
|
||||
mPose = (Pose)(stream->readInt(NumPoseBits));
|
||||
|
||||
|
||||
ActionState actionState = (ActionState)stream->readInt(NumStateBits);
|
||||
if (stream->readFlag()) {
|
||||
mRecoverTicks = stream->readInt(PlayerData::RecoverDelayBits);
|
||||
|
|
@ -7160,3 +7171,38 @@ void Player::renderConvex( ObjectRenderInst *ri, SceneRenderState *state, BaseMa
|
|||
mConvex.renderWorkingList();
|
||||
GFX->leaveDebugEvent();
|
||||
}
|
||||
|
||||
#ifdef TORQUE_OPENVR
|
||||
void Player::setControllers(Vector<OpenVRTrackedObject*> controllerList)
|
||||
{
|
||||
mControllers[0] = controllerList.size() > 0 ? controllerList[0] : NULL;
|
||||
mControllers[1] = controllerList.size() > 1 ? controllerList[1] : NULL;
|
||||
}
|
||||
|
||||
ConsoleMethod(Player, setVRControllers, void, 4, 4, "")
|
||||
{
|
||||
OpenVRTrackedObject *controllerL, *controllerR;
|
||||
Vector<OpenVRTrackedObject*> list;
|
||||
|
||||
if (Sim::findObject(argv[2], controllerL))
|
||||
{
|
||||
list.push_back(controllerL);
|
||||
}
|
||||
else
|
||||
{
|
||||
list.push_back(NULL);
|
||||
}
|
||||
|
||||
if (Sim::findObject(argv[3], controllerR))
|
||||
{
|
||||
list.push_back(controllerR);
|
||||
}
|
||||
else
|
||||
{
|
||||
list.push_back(NULL);
|
||||
}
|
||||
|
||||
object->setControllers(list);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ class SplashData;
|
|||
class PhysicsPlayer;
|
||||
class Player;
|
||||
|
||||
#ifdef TORQUE_OPENVR
|
||||
class OpenVRTrackedObject;
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
struct PlayerData: public ShapeBaseData {
|
||||
|
|
@ -480,7 +484,7 @@ protected:
|
|||
/// @{
|
||||
|
||||
struct ActionAnimation {
|
||||
U32 action;
|
||||
S32 action;
|
||||
TSThread* thread;
|
||||
S32 delayTicks; // before picking another.
|
||||
bool forward;
|
||||
|
|
@ -518,6 +522,10 @@ protected:
|
|||
Point3F mLastPos; ///< Holds the last position for physics updates
|
||||
Point3F mLastWaterPos; ///< Same as mLastPos, but for water
|
||||
|
||||
#ifdef TORQUE_OPENVR
|
||||
SimObjectPtr<OpenVRTrackedObject> mControllers[2];
|
||||
#endif
|
||||
|
||||
struct ContactInfo
|
||||
{
|
||||
bool contacted, jump, run;
|
||||
|
|
@ -577,12 +585,17 @@ protected:
|
|||
|
||||
PhysicsPlayer* getPhysicsRep() const { return mPhysicsRep; }
|
||||
|
||||
#ifdef TORQUE_OPENVR
|
||||
void setControllers(Vector<OpenVRTrackedObject*> controllerList);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void reSkin();
|
||||
|
||||
void setState(ActionState state, U32 ticks=0);
|
||||
void updateState();
|
||||
|
||||
|
||||
// Jetting
|
||||
bool mJetting;
|
||||
|
||||
|
|
@ -615,7 +628,7 @@ protected:
|
|||
|
||||
/// @name Mounted objects
|
||||
/// @{
|
||||
virtual void onUnmount( ShapeBase *obj, S32 node );
|
||||
virtual void onUnmount( SceneObject *obj, S32 node );
|
||||
virtual void unmount();
|
||||
/// @}
|
||||
|
||||
|
|
@ -686,7 +699,6 @@ public:
|
|||
void getEyeBaseTransform(MatrixF* mat, bool includeBank);
|
||||
void getRenderEyeTransform(MatrixF* mat);
|
||||
void getRenderEyeBaseTransform(MatrixF* mat, bool includeBank);
|
||||
virtual DisplayPose calcCameraDeltaPose(GameConnection *con, const DisplayPose& inPose);
|
||||
void getCameraParameters(F32 *min, F32 *max, Point3F *offset, MatrixF *rot);
|
||||
void getMuzzleTransform(U32 imageSlot,MatrixF* mat);
|
||||
void getRenderMuzzleTransform(U32 imageSlot,MatrixF* mat);
|
||||
|
|
|
|||
|
|
@ -551,14 +551,14 @@ S32 ProjectileData::scaleValue( S32 value, bool down )
|
|||
Projectile::Projectile()
|
||||
: mPhysicsWorld( NULL ),
|
||||
mDataBlock( NULL ),
|
||||
mParticleEmitter( NULL ),
|
||||
mParticleWaterEmitter( NULL ),
|
||||
mSound( NULL ),
|
||||
mCurrPosition( 0, 0, 0 ),
|
||||
mCurrVelocity( 0, 0, 1 ),
|
||||
mSourceObjectId( -1 ),
|
||||
mSourceObjectSlot( -1 ),
|
||||
mCurrTick( 0 ),
|
||||
mParticleEmitter( NULL ),
|
||||
mParticleWaterEmitter( NULL ),
|
||||
mSound( NULL ),
|
||||
mProjectileShape( NULL ),
|
||||
mActivateThread( NULL ),
|
||||
mMaintainThread( NULL ),
|
||||
|
|
|
|||
|
|
@ -187,8 +187,6 @@ IMPLEMENT_CALLBACK( RigidShape, onLeaveLiquid, void, ( const char* objId, const
|
|||
|
||||
namespace {
|
||||
|
||||
const U32 sMoveRetryCount = 3;
|
||||
|
||||
// Client prediction
|
||||
const S32 sMaxWarpTicks = 3; // Max warp duration in ticks
|
||||
const S32 sMaxPredictionTicks = 30; // Number of ticks to predict
|
||||
|
|
|
|||
|
|
@ -95,9 +95,9 @@ SFXEmitter::SFXEmitter()
|
|||
: SceneObject(),
|
||||
mSource( NULL ),
|
||||
mTrack( NULL ),
|
||||
mUseTrackDescriptionOnly( false ),
|
||||
mLocalProfile( &mDescription ),
|
||||
mPlayOnAdd( true ),
|
||||
mUseTrackDescriptionOnly( false )
|
||||
mPlayOnAdd( true )
|
||||
{
|
||||
mTypeMask |= MarkerObjectType;
|
||||
mNetFlags.set( Ghostable | ScopeAlways );
|
||||
|
|
|
|||
|
|
@ -168,12 +168,9 @@ ShapeBaseData::ShapeBaseData()
|
|||
density( 1.0f ),
|
||||
maxEnergy( 0.0f ),
|
||||
maxDamage( 1.0f ),
|
||||
destroyedLevel( 1.0f ),
|
||||
disabledLevel( 1.0f ),
|
||||
repairRate( 0.0033f ),
|
||||
eyeNode( -1 ),
|
||||
earNode( -1 ),
|
||||
cameraNode( -1 ),
|
||||
disabledLevel( 1.0f ),
|
||||
destroyedLevel( 1.0f ),
|
||||
cameraMaxDist( 0.0f ),
|
||||
cameraMinDist( 0.2f ),
|
||||
cameraDefaultFov( 75.0f ),
|
||||
|
|
@ -181,6 +178,11 @@ ShapeBaseData::ShapeBaseData()
|
|||
cameraMaxFov( 120.f ),
|
||||
cameraCanBank( false ),
|
||||
mountedImagesBank( false ),
|
||||
mCRC( 0 ),
|
||||
computeCRC( false ),
|
||||
eyeNode( -1 ),
|
||||
earNode( -1 ),
|
||||
cameraNode( -1 ),
|
||||
debrisDetail( -1 ),
|
||||
damageSequence( -1 ),
|
||||
hulkSequence( -1 ),
|
||||
|
|
@ -189,9 +191,7 @@ ShapeBaseData::ShapeBaseData()
|
|||
useEyePoint( false ),
|
||||
isInvincible( false ),
|
||||
renderWhenDestroyed( true ),
|
||||
computeCRC( false ),
|
||||
inheritEnergyFromMount( false ),
|
||||
mCRC( 0 )
|
||||
inheritEnergyFromMount( false )
|
||||
{
|
||||
dMemset( mountPointNode, -1, sizeof( S32 ) * SceneObject::NumMountPoints );
|
||||
}
|
||||
|
|
@ -1992,67 +1992,21 @@ void ShapeBase::getEyeCameraTransform(IDisplayDevice *displayDevice, U32 eyeId,
|
|||
Point3F eyePos;
|
||||
Point3F rotEyePos;
|
||||
|
||||
DisplayPose inPose;
|
||||
displayDevice->getFrameEyePose(&inPose, eyeId);
|
||||
DisplayPose newPose = calcCameraDeltaPose(displayDevice->getCurrentConnection(), inPose);
|
||||
DisplayPose newPose;
|
||||
displayDevice->getFrameEyePose(&newPose, eyeId);
|
||||
|
||||
// Ok, basically we just need to add on newPose to the camera transform
|
||||
// NOTE: currently we dont support third-person camera in this mode
|
||||
MatrixF cameraTransform(1);
|
||||
F32 fakePos = 0;
|
||||
//cameraTransform = getRenderTransform(); // use this for controllers TODO
|
||||
getCameraTransform(&fakePos, &cameraTransform);
|
||||
|
||||
QuatF baserot = cameraTransform;
|
||||
QuatF qrot = QuatF(newPose.orientation);
|
||||
QuatF concatRot;
|
||||
concatRot.mul(baserot, qrot);
|
||||
concatRot.setMatrix(&temp);
|
||||
temp.setPosition(cameraTransform.getPosition() + concatRot.mulP(newPose.position, &rotEyePos));
|
||||
temp = MatrixF(1);
|
||||
newPose.orientation.setMatrix(&temp);
|
||||
temp.setPosition(newPose.position);
|
||||
|
||||
*outMat = temp;
|
||||
}
|
||||
|
||||
DisplayPose ShapeBase::calcCameraDeltaPose(GameConnection *con, const DisplayPose& inPose)
|
||||
{
|
||||
// NOTE: this is intended to be similar to updateMove
|
||||
// WARNING: does not take into account any move values
|
||||
|
||||
DisplayPose outPose;
|
||||
outPose.orientation = getRenderTransform().toEuler();
|
||||
outPose.position = inPose.position;
|
||||
|
||||
if (con && con->getControlSchemeAbsoluteRotation())
|
||||
{
|
||||
// Pitch
|
||||
outPose.orientation.x = inPose.orientation.x;
|
||||
|
||||
// Constrain the range of mRot.x
|
||||
while (outPose.orientation.x < -M_PI_F)
|
||||
outPose.orientation.x += M_2PI_F;
|
||||
while (outPose.orientation.x > M_PI_F)
|
||||
outPose.orientation.x -= M_2PI_F;
|
||||
|
||||
// Yaw
|
||||
outPose.orientation.z = inPose.orientation.z;
|
||||
|
||||
// Constrain the range of mRot.z
|
||||
while (outPose.orientation.z < -M_PI_F)
|
||||
outPose.orientation.z += M_2PI_F;
|
||||
while (outPose.orientation.z > M_PI_F)
|
||||
outPose.orientation.z -= M_2PI_F;
|
||||
|
||||
// Bank
|
||||
if (mDataBlock->cameraCanBank)
|
||||
{
|
||||
outPose.orientation.y = inPose.orientation.y;
|
||||
}
|
||||
|
||||
// Constrain the range of mRot.y
|
||||
while (outPose.orientation.y > M_PI_F)
|
||||
outPose.orientation.y -= M_2PI_F;
|
||||
}
|
||||
|
||||
return outPose;
|
||||
*outMat = cameraTransform * temp;
|
||||
}
|
||||
|
||||
void ShapeBase::getCameraParameters(F32 *min,F32* max,Point3F* off,MatrixF* rot)
|
||||
|
|
|
|||
|
|
@ -491,8 +491,8 @@ struct ShapeBaseImageData: public GameBaseData {
|
|||
|
||||
/// @name Callbacks
|
||||
/// @{
|
||||
DECLARE_CALLBACK( void, onMount, ( ShapeBase* obj, S32 slot, F32 dt ) );
|
||||
DECLARE_CALLBACK( void, onUnmount, ( ShapeBase* obj, S32 slot, F32 dt ) );
|
||||
DECLARE_CALLBACK( void, onMount, ( SceneObject* obj, S32 slot, F32 dt ) );
|
||||
DECLARE_CALLBACK( void, onUnmount, ( SceneObject* obj, S32 slot, F32 dt ) );
|
||||
/// @}
|
||||
};
|
||||
|
||||
|
|
@ -1588,9 +1588,6 @@ public:
|
|||
/// orient and position values of the display device.
|
||||
virtual void getEyeCameraTransform( IDisplayDevice *display, U32 eyeId, MatrixF *outMat );
|
||||
|
||||
/// Calculates a delta camera angle and view position based on inPose
|
||||
virtual DisplayPose calcCameraDeltaPose(GameConnection *con, const DisplayPose& inPose);
|
||||
|
||||
/// Gets the index of a node inside a mounted image given the name
|
||||
/// @param imageSlot Image slot
|
||||
/// @param nodeName Node name
|
||||
|
|
|
|||
|
|
@ -97,14 +97,14 @@ ConsoleDocClass( ShapeBaseImageData,
|
|||
"@ingroup gameObjects\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( ShapeBaseImageData, onMount, void, ( ShapeBase* obj, S32 slot, F32 dt ), ( obj, slot, dt ),
|
||||
IMPLEMENT_CALLBACK( ShapeBaseImageData, onMount, void, ( SceneObject* obj, S32 slot, F32 dt ), ( obj, slot, dt ),
|
||||
"@brief Called when the Image is first mounted to the object.\n\n"
|
||||
|
||||
"@param obj object that this Image has been mounted to\n"
|
||||
"@param slot Image mount slot on the object\n"
|
||||
"@param dt time remaining in this Image update\n" );
|
||||
|
||||
IMPLEMENT_CALLBACK( ShapeBaseImageData, onUnmount, void, ( ShapeBase* obj, S32 slot, F32 dt ), ( obj, slot, dt ),
|
||||
IMPLEMENT_CALLBACK( ShapeBaseImageData, onUnmount, void, ( SceneObject* obj, S32 slot, F32 dt ), ( obj, slot, dt ),
|
||||
"@brief Called when the Image is unmounted from the object.\n\n"
|
||||
|
||||
"@param obj object that this Image has been unmounted from\n"
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ void StaticShape::setTransform(const MatrixF& mat)
|
|||
setMaskBits(PositionMask);
|
||||
}
|
||||
|
||||
void StaticShape::onUnmount(ShapeBase*,S32)
|
||||
void StaticShape::onUnmount(SceneObject*,S32)
|
||||
{
|
||||
// Make sure the client get's the final server pos.
|
||||
setMaskBits(PositionMask);
|
||||
|
|
@ -251,14 +251,14 @@ void StaticShape::onUnmount(ShapeBase*,S32)
|
|||
|
||||
U32 StaticShape::packUpdate(NetConnection *connection, U32 mask, BitStream *bstream)
|
||||
{
|
||||
U32 retMask = Parent::packUpdate(connection,mask,bstream);
|
||||
U32 retMask = Parent::packUpdate(connection, mask, bstream);
|
||||
if (bstream->writeFlag(mask & PositionMask | ExtendedInfoMask))
|
||||
{
|
||||
|
||||
// Write the transform (do _not_ use writeAffineTransform. Since this is a static
|
||||
// object, the transform must be RIGHT THE *&)*$&^ ON or it will goof up the
|
||||
// synchronization between the client and the server.
|
||||
mathWrite(*bstream,mObjToWorld);
|
||||
mathWrite(*bstream, mObjToWorld);
|
||||
mathWrite(*bstream, mObjScale);
|
||||
}
|
||||
|
||||
|
|
@ -275,11 +275,11 @@ U32 StaticShape::packUpdate(NetConnection *connection, U32 mask, BitStream *bstr
|
|||
|
||||
void StaticShape::unpackUpdate(NetConnection *connection, BitStream *bstream)
|
||||
{
|
||||
Parent::unpackUpdate(connection,bstream);
|
||||
Parent::unpackUpdate(connection, bstream);
|
||||
if (bstream->readFlag())
|
||||
{
|
||||
MatrixF mat;
|
||||
mathRead(*bstream,&mat);
|
||||
mathRead(*bstream, &mat);
|
||||
Parent::setTransform(mat);
|
||||
Parent::setRenderTransform(mat);
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ void StaticShape::unpackUpdate(NetConnection *connection, BitStream *bstream)
|
|||
// This appears to be legacy T2 stuff
|
||||
// Marked internal, as this is flagged to be deleted
|
||||
// [8/1/2010 mperry]
|
||||
DefineConsoleMethod( StaticShape, setPoweredState, void, (bool isPowered), , "(bool isPowered)"
|
||||
DefineConsoleMethod(StaticShape, setPoweredState, void, (bool isPowered), , "(bool isPowered)"
|
||||
"@internal")
|
||||
{
|
||||
if(!object->isServerObject())
|
||||
|
|
@ -310,7 +310,7 @@ DefineConsoleMethod( StaticShape, setPoweredState, void, (bool isPowered), , "(b
|
|||
object->setPowered(isPowered);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( StaticShape, getPoweredState, bool, (), , "@internal")
|
||||
DefineConsoleMethod(StaticShape, getPoweredState, bool, (), , "@internal")
|
||||
{
|
||||
if(!object->isServerObject())
|
||||
return(false);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class StaticShape: public ShapeBase
|
|||
StaticShapeData* mDataBlock;
|
||||
bool mPowered;
|
||||
|
||||
void onUnmount(ShapeBase* obj,S32 node);
|
||||
void onUnmount(SceneObject* obj,S32 node);
|
||||
|
||||
protected:
|
||||
enum MaskBits {
|
||||
|
|
|
|||
|
|
@ -36,15 +36,6 @@
|
|||
//----------------------------------------------------------------------------
|
||||
|
||||
// Client prediction
|
||||
static F32 sMinWarpTicks = 0.5 ; // Fraction of tick at which instant warp occures
|
||||
static S32 sMaxWarpTicks = 3; // Max warp duration in ticks
|
||||
|
||||
const U32 sClientCollisionMask = (TerrainObjectType |
|
||||
StaticShapeObjectType |
|
||||
VehicleObjectType);
|
||||
|
||||
const U32 sServerCollisionMask = (sClientCollisionMask);
|
||||
|
||||
// Trigger objects that are not normally collided with.
|
||||
static U32 sTriggerMask = ItemObjectType |
|
||||
TriggerObjectType |
|
||||
|
|
@ -69,7 +60,7 @@ ConsoleDocClass( TurretShapeData,
|
|||
"@ingroup gameObjects\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( TurretShapeData, onMountObject, void, ( TurretShape* turret, SceneObject* obj, S32 node ),( turret, obj, node ),
|
||||
IMPLEMENT_CALLBACK( TurretShapeData, onMountObject, void, ( SceneObject* turret, SceneObject* obj, S32 node ),( turret, obj, node ),
|
||||
"@brief Informs the TurretShapeData object that a player is mounting it.\n\n"
|
||||
"@param turret The TurretShape object.\n"
|
||||
"@param obj The player that is mounting.\n"
|
||||
|
|
@ -77,7 +68,7 @@ IMPLEMENT_CALLBACK( TurretShapeData, onMountObject, void, ( TurretShape* turret,
|
|||
"@note Server side only.\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( TurretShapeData, onUnmountObject, void, ( TurretShape* turret, SceneObject* obj ),( turret, obj ),
|
||||
IMPLEMENT_CALLBACK( TurretShapeData, onUnmountObject, void, ( SceneObject* turret, SceneObject* obj ),( turret, obj ),
|
||||
"@brief Informs the TurretShapeData object that a player is unmounting it.\n\n"
|
||||
"@param turret The TurretShape object.\n"
|
||||
"@param obj The player that is unmounting.\n"
|
||||
|
|
@ -933,7 +924,7 @@ void TurretShape::unmountObject( SceneObject *obj )
|
|||
}
|
||||
}
|
||||
|
||||
void TurretShape::onUnmount(ShapeBase*,S32)
|
||||
void TurretShape::onUnmount(SceneObject*,S32)
|
||||
{
|
||||
// Make sure the client get's the final server pos of this turret.
|
||||
setMaskBits(PositionMask);
|
||||
|
|
|
|||
|
|
@ -93,8 +93,8 @@ public:
|
|||
|
||||
virtual bool preload(bool server, String &errorStr);
|
||||
|
||||
DECLARE_CALLBACK( void, onMountObject, ( TurretShape* turret, SceneObject* obj, S32 node ) );
|
||||
DECLARE_CALLBACK( void, onUnmountObject, ( TurretShape* turret, SceneObject* obj ) );
|
||||
DECLARE_CALLBACK( void, onMountObject, ( SceneObject* turret, SceneObject* obj, S32 node ) );
|
||||
DECLARE_CALLBACK( void, onUnmountObject, ( SceneObject* turret, SceneObject* obj ) );
|
||||
DECLARE_CALLBACK( void, onStickyCollision, ( TurretShape* obj ) );
|
||||
};
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ protected:
|
|||
void _applyLimits(Point3F& rot);
|
||||
bool _outsideLimits(Point3F& rot); ///< Return true if any angle is outside of the limits
|
||||
|
||||
void onUnmount(ShapeBase* obj,S32 node);
|
||||
void onUnmount(SceneObject* obj,S32 node);
|
||||
|
||||
// Script level control
|
||||
bool allowManualRotation;
|
||||
|
|
|
|||
|
|
@ -69,8 +69,6 @@ ConsoleDocClass( HoverVehicle,
|
|||
);
|
||||
|
||||
namespace {
|
||||
|
||||
const U32 sIntergrationsPerTick = 1;
|
||||
const F32 sHoverVehicleGravity = -20;
|
||||
|
||||
const U32 sCollisionMoveMask = (TerrainObjectType | PlayerObjectType |
|
||||
|
|
|
|||
|
|
@ -63,8 +63,6 @@ static F32 sWorkingQueryBoxSizeMultiplier = 2.0f; // How much larger should the
|
|||
// will be updated due to motion, but any non-static shape
|
||||
// that moves into the query box will not be noticed.
|
||||
|
||||
const U32 sMoveRetryCount = 3;
|
||||
|
||||
// Client prediction
|
||||
const S32 sMaxWarpTicks = 3; // Max warp duration in ticks
|
||||
const S32 sMaxPredictionTicks = 30; // Number of ticks to predict
|
||||
|
|
|
|||
|
|
@ -43,17 +43,6 @@ extern void createFontShutdown(void);
|
|||
|
||||
static HashTable<StringTableEntry,StringTableEntry> gSecureScript;
|
||||
|
||||
#ifdef TORQUE_OS_MAC
|
||||
|
||||
// ObjC hooks for shared library support
|
||||
// See: macMain.mm
|
||||
|
||||
void torque_mac_engineinit(S32 argc, const char **argv);
|
||||
void torque_mac_enginetick();
|
||||
void torque_mac_engineshutdown();
|
||||
|
||||
#endif
|
||||
|
||||
extern bool LinkConsoleFunctions;
|
||||
|
||||
extern "C" {
|
||||
|
|
@ -78,10 +67,6 @@ extern "C" {
|
|||
createFontInit();
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TORQUE_OS_MAC
|
||||
torque_mac_engineinit(argc, argv);
|
||||
#endif
|
||||
// Initialize the subsystems.
|
||||
StandardMainLoop::init();
|
||||
|
||||
|
|
@ -113,11 +98,6 @@ extern "C" {
|
|||
__try {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TORQUE_OS_MAC
|
||||
torque_mac_enginetick();
|
||||
#endif
|
||||
|
||||
bool ret = StandardMainLoop::doMainLoop();
|
||||
return ret;
|
||||
|
||||
|
|
@ -159,10 +139,6 @@ extern "C" {
|
|||
createFontShutdown();
|
||||
#endif
|
||||
|
||||
#ifdef TORQUE_OS_MAC
|
||||
torque_mac_engineshutdown();
|
||||
#endif
|
||||
|
||||
#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE )
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,17 +56,24 @@ void AbstractPolyList::addBox(const Box3F &box, BaseMatInstance* material)
|
|||
pos.x += dx; addPoint(pos);
|
||||
|
||||
for (S32 i = 0; i < 6; i++) {
|
||||
begin(material, i);
|
||||
S32 v1 = base + PolyFace[i][0];
|
||||
S32 v2 = base + PolyFace[i][1];
|
||||
S32 v3 = base + PolyFace[i][2];
|
||||
S32 v4 = base + PolyFace[i][3];
|
||||
// First triangle
|
||||
begin(material, i);
|
||||
vertex(v1);
|
||||
vertex(v2);
|
||||
vertex(v3);
|
||||
vertex(v4);
|
||||
plane(v1, v2, v3);
|
||||
end();
|
||||
// Second triangle
|
||||
begin(material, i);
|
||||
vertex(v3);
|
||||
vertex(v4);
|
||||
vertex(v1);
|
||||
plane(v3, v4, v1);
|
||||
end();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,9 +96,9 @@ U32 ClippedPolyList::addPointAndNormal(const Point3F& p, const Point3F& normal)
|
|||
AssertFatal(mNormalList.size() == mVertexList.size(), "Normals count does not match vertex count!");
|
||||
|
||||
// Build the plane mask
|
||||
register U32 mask = 1;
|
||||
register S32 count = mPlaneList.size();
|
||||
register PlaneF * plane = mPlaneList.address();
|
||||
U32 mask = 1;
|
||||
S32 count = mPlaneList.size();
|
||||
PlaneF * plane = mPlaneList.address();
|
||||
|
||||
v.mask = 0;
|
||||
while(--count >= 0) {
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ void Convex::updateStateList(const MatrixF& mat, const Point3F& scale, const Poi
|
|||
|
||||
// Add collision states for new overlapping objects
|
||||
for (CollisionWorkingList* itr0 = mWorking.wLink.mNext; itr0 != &mWorking; itr0 = itr0->wLink.mNext) {
|
||||
register Convex* cv = itr0->mConvex;
|
||||
Convex* cv = itr0->mConvex;
|
||||
if (cv->mTag != sTag && box1.isOverlapped(cv->getBoundingBox())) {
|
||||
CollisionState* state = new GjkCollisionState;
|
||||
state->set(this,cv,mat,cv->getTransform());
|
||||
|
|
|
|||
|
|
@ -87,9 +87,9 @@ class OptimizedPolyList : public AbstractPolyList
|
|||
|
||||
Poly()
|
||||
: plane( -1 ),
|
||||
object( NULL ),
|
||||
vertexCount( 0 ),
|
||||
material( NULL ),
|
||||
vertexCount( 0 ),
|
||||
object( NULL ),
|
||||
type( TriangleFan )
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1413,7 +1413,6 @@ ConsoleValueRef Namespace::Entry::execute(S32 argc, ConsoleValueRef *argv, ExprE
|
|||
return ConsoleValueRef();
|
||||
}
|
||||
|
||||
static char returnBuffer[32];
|
||||
switch(mType)
|
||||
{
|
||||
case StringCallbackType:
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ public:
|
|||
/// @see addGroup, endGroup
|
||||
/// @see addGroup, endGroup
|
||||
/// @see addDeprecatedField
|
||||
enum ACRFieldTypes
|
||||
enum ACRFieldTypes : U32
|
||||
{
|
||||
/// The first custom field type... all fields
|
||||
/// types greater or equal to this one are not
|
||||
|
|
|
|||
|
|
@ -62,4 +62,4 @@ namespace Con {
|
|||
|
||||
/// @}
|
||||
|
||||
#endif _CONSOLEXMLEXPORT_H_
|
||||
#endif //_CONSOLEXMLEXPORT_H_
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ static VectorPtr< ConsoleBaseType* > gConsoleTypeTable( __FILE__, __LINE__ );
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleBaseType::ConsoleBaseType( const S32 size, S32 *idPtr, const char *aTypeName )
|
||||
: mInspectorFieldType( NULL ),
|
||||
mTypeSize( size ),
|
||||
: mTypeSize( size ),
|
||||
mInspectorFieldType( NULL ),
|
||||
mTypeInfo( NULL )
|
||||
{
|
||||
mTypeName = StringTable->insert( aTypeName );
|
||||
|
|
|
|||
|
|
@ -43,13 +43,13 @@ EngineFunctionInfo::EngineFunctionInfo( const char* name,
|
|||
void* address,
|
||||
U32 flags )
|
||||
: SuperType( name, EngineExportKindFunction, scope, docString ),
|
||||
mBindingName( bindingName ),
|
||||
mFunctionFlags( flags ),
|
||||
mFunctionType( functionType ),
|
||||
mDefaultArgumentValues( defaultArgs ),
|
||||
mFunctionFlags( flags ),
|
||||
mBindingName( bindingName ),
|
||||
mPrototypeString( prototypeString ),
|
||||
mNextFunction( smFirstFunction ),
|
||||
mAddress( address )
|
||||
mAddress( address ),
|
||||
mNextFunction( smFirstFunction )
|
||||
{
|
||||
AssertFatal( functionType, "EngineFunctionInfo - Function cannot have void type!" );
|
||||
smFirstFunction = this;
|
||||
|
|
|
|||
|
|
@ -55,11 +55,11 @@ EngineTypeInfo::EngineTypeInfo( const char* typeName, EngineExportScope* scope,
|
|||
: SuperType( typeName, scope, docString ),
|
||||
mTypeKind( kind ),
|
||||
mInstanceSize( instanceSize ),
|
||||
mNext( smFirst ),
|
||||
mEnumTable( NULL ),
|
||||
mFieldTable( NULL ),
|
||||
mPropertyTable( NULL ),
|
||||
mSuperType( NULL )
|
||||
mSuperType( NULL ),
|
||||
mNext( smFirst )
|
||||
{
|
||||
mExportKind = EngineExportKindType;
|
||||
|
||||
|
|
|
|||
|
|
@ -613,7 +613,7 @@ namespace _Private {
|
|||
|
||||
///
|
||||
#define FIELD( fieldName, exportName, numElements, doc ) \
|
||||
{ #exportName, doc, numElements, TYPE( ( ( ThisType* ) 16 )->fieldName ), FIELDOFFSET( fieldName ) }, // Artificial offset to avoid compiler warnings.
|
||||
{ #exportName, doc, numElements, TYPE( ( ( ThisType* ) 16 )->fieldName ), (U32)FIELDOFFSET( fieldName ) }, // Artificial offset to avoid compiler warnings.
|
||||
|
||||
///
|
||||
#define FIELD_AS( type, fieldName, exportName, numElements, doc ) \
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ typedef U32 SimObjectId;
|
|||
/// The RootGroupId is assigned to gRootGroup, in which most SimObjects
|
||||
/// are addded as child members. See simManager.cc for details, particularly
|
||||
/// Sim::initRoot() and following.
|
||||
enum SimObjectsConstants
|
||||
enum SimObjectsConstants : U32
|
||||
{
|
||||
DataBlockObjectIdFirst = 3,
|
||||
DataBlockObjectIdBitSize = 14,
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@ void *DataChunker::alloc(S32 size)
|
|||
{
|
||||
if (size > mChunkSize)
|
||||
{
|
||||
DataBlock * temp = new DataBlock(size);
|
||||
DataBlock * temp = (DataBlock*)dMalloc(DataChunker::PaddDBSize + size);
|
||||
AssertFatal(temp, "Malloc failed");
|
||||
constructInPlace(temp);
|
||||
if (mCurBlock)
|
||||
{
|
||||
temp->next = mCurBlock->next;
|
||||
|
|
@ -52,30 +54,32 @@ void *DataChunker::alloc(S32 size)
|
|||
mCurBlock = temp;
|
||||
temp->curIndex = mChunkSize;
|
||||
}
|
||||
return temp->data;
|
||||
return temp->getData();
|
||||
}
|
||||
|
||||
if(!mCurBlock || size + mCurBlock->curIndex > mChunkSize)
|
||||
{
|
||||
DataBlock *temp = new DataBlock(mChunkSize);
|
||||
const U32 paddDBSize = (sizeof(DataBlock) + 3) & ~3;
|
||||
DataBlock *temp = (DataBlock*)dMalloc(paddDBSize+ mChunkSize);
|
||||
AssertFatal(temp, "Malloc failed");
|
||||
constructInPlace(temp);
|
||||
temp->next = mCurBlock;
|
||||
temp->curIndex = 0;
|
||||
mCurBlock = temp;
|
||||
}
|
||||
|
||||
void *ret = mCurBlock->data + mCurBlock->curIndex;
|
||||
|
||||
void *ret = mCurBlock->getData() + mCurBlock->curIndex;
|
||||
mCurBlock->curIndex += (size + 3) & ~3; // dword align
|
||||
return ret;
|
||||
}
|
||||
|
||||
DataChunker::DataBlock::DataBlock(S32 size)
|
||||
DataChunker::DataBlock::DataBlock()
|
||||
{
|
||||
data = new U8[size];
|
||||
curIndex = 0;
|
||||
next = NULL;
|
||||
}
|
||||
|
||||
DataChunker::DataBlock::~DataBlock()
|
||||
{
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
void DataChunker::freeBlocks(bool keepOne)
|
||||
|
|
@ -83,15 +87,17 @@ void DataChunker::freeBlocks(bool keepOne)
|
|||
while(mCurBlock && mCurBlock->next)
|
||||
{
|
||||
DataBlock *temp = mCurBlock->next;
|
||||
delete mCurBlock;
|
||||
dFree(mCurBlock);
|
||||
mCurBlock = temp;
|
||||
}
|
||||
if (!keepOne)
|
||||
{
|
||||
delete mCurBlock;
|
||||
if (mCurBlock) dFree(mCurBlock);
|
||||
mCurBlock = NULL;
|
||||
}
|
||||
else if (mCurBlock)
|
||||
{
|
||||
mCurBlock->curIndex = 0;
|
||||
mCurBlock->next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,21 @@
|
|||
class DataChunker
|
||||
{
|
||||
public:
|
||||
/// Block of allocated memory.
|
||||
///
|
||||
/// <b>This has nothing to do with datablocks as used in the rest of Torque.</b>
|
||||
struct DataBlock
|
||||
{
|
||||
DataBlock* next; ///< linked list pointer to the next DataBlock for this chunker
|
||||
S32 curIndex; ///< current allocation point within this DataBlock
|
||||
DataBlock();
|
||||
~DataBlock();
|
||||
inline U8 *getData();
|
||||
};
|
||||
|
||||
enum {
|
||||
ChunkSize = 16376 ///< Default size of each DataBlock page in the DataChunker
|
||||
PaddDBSize = (sizeof(DataBlock) + 3) & ~3, ///< Padded size of DataBlock
|
||||
ChunkSize = 16384 - PaddDBSize ///< Default size of each DataBlock page in the DataChunker
|
||||
};
|
||||
|
||||
/// Return a pointer to a chunk of memory from a pre-allocated block.
|
||||
|
|
@ -81,27 +94,40 @@ public:
|
|||
mCurBlock = temp;
|
||||
}
|
||||
|
||||
private:
|
||||
/// Block of allocated memory.
|
||||
///
|
||||
/// <b>This has nothing to do with datablocks as used in the rest of Torque.</b>
|
||||
struct DataBlock
|
||||
public:
|
||||
U32 countUsedBlocks()
|
||||
{
|
||||
DataBlock* prev;
|
||||
DataBlock* next; ///< linked list pointer to the next DataBlock for this chunker
|
||||
U8 *data; ///< allocated pointer for the base of this page
|
||||
S32 curIndex; ///< current allocation point within this DataBlock
|
||||
DataBlock(S32 size);
|
||||
~DataBlock();
|
||||
};
|
||||
U32 count = 0;
|
||||
if (!mCurBlock)
|
||||
return 0;
|
||||
for (DataBlock *ptr = mCurBlock; ptr != NULL; ptr = ptr->next)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void setChunkSize(U32 size)
|
||||
{
|
||||
AssertFatal(mCurBlock == NULL, "Cant resize now");
|
||||
mChunkSize = size;
|
||||
}
|
||||
|
||||
DataBlock* mFirstBlock;
|
||||
DataBlock *mCurBlock; ///< current page we're allocating data from. If the
|
||||
|
||||
public:
|
||||
|
||||
DataBlock* mCurBlock; ///< current page we're allocating data from. If the
|
||||
///< data size request is greater than the memory space currently
|
||||
///< available in the current page, a new page will be allocated.
|
||||
S32 mChunkSize; ///< The size allocated for each page in the DataChunker
|
||||
};
|
||||
|
||||
|
||||
inline U8 *DataChunker::DataBlock::getData()
|
||||
{
|
||||
return (U8*)this + DataChunker::PaddDBSize;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
template<class T>
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ bool OggDecoder::_nextPacket()
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
OggInputStream::OggInputStream( Stream* stream )
|
||||
: mStream( stream ),
|
||||
mIsAtEnd( false )
|
||||
: mIsAtEnd( false ),
|
||||
mStream( stream )
|
||||
{
|
||||
ogg_sync_init( &mOggSyncState );
|
||||
|
||||
|
|
|
|||
|
|
@ -95,12 +95,12 @@ static inline S32 sampleG( U8* pCb, U8* pCr )
|
|||
|
||||
OggTheoraDecoder::OggTheoraDecoder( const ThreadSafeRef< OggInputStream >& stream )
|
||||
: Parent( stream ),
|
||||
#ifdef TORQUE_DEBUG
|
||||
mLock( 0 ),
|
||||
#endif
|
||||
mTheoraSetup( NULL ),
|
||||
mTheoraDecoder( NULL ),
|
||||
mTranscoder( TRANSCODER_Auto )
|
||||
#ifdef TORQUE_DEBUG
|
||||
,mLock( 0 )
|
||||
#endif
|
||||
{
|
||||
// Initialize.
|
||||
|
||||
|
|
@ -285,8 +285,7 @@ U32 OggTheoraDecoder::read( OggTheoraFrame** buffer, U32 num )
|
|||
|
||||
// Transcode the packet.
|
||||
|
||||
#if ( defined( TORQUE_COMPILER_GCC ) || defined( TORQUE_COMPILER_VISUALC ) ) && defined( TORQUE_CPU_X86 )
|
||||
|
||||
#if ( defined( TORQUE_COMPILER_GCC ) || defined( TORQUE_COMPILER_VISUALC ) ) && (defined( TORQUE_CPU_X86 ) )
|
||||
if( ( mTranscoder == TRANSCODER_Auto || mTranscoder == TRANSCODER_SSE2420RGBA ) &&
|
||||
getDecoderPixelFormat() == PIXEL_FORMAT_420 &&
|
||||
Platform::SystemInfo.processor.properties & CPU_PROP_SSE2 &&
|
||||
|
|
@ -560,7 +559,7 @@ void OggTheoraDecoder::_transcode420toRGBA_SSE2( th_ycbcr_buffer ycbcr, U8* buff
|
|||
jnz hloop
|
||||
};
|
||||
|
||||
#elif defined( TORQUE_COMPILER_GCC ) && defined( TORQUE_CPU_X86 )
|
||||
#elif defined( TORQUE_COMPILER_GCC ) && defined( TORQUE_CPU_X86 )
|
||||
|
||||
asm( "pushal\n" // Save all general-purpose registers.
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
class FileStream : public Stream
|
||||
{
|
||||
public:
|
||||
enum
|
||||
enum : U32
|
||||
{
|
||||
BUFFER_SIZE = 8 * 1024, // this can be changed to anything appropriate [in k]
|
||||
BUFFER_INVALID = 0xffffffff // file offsets must all be less than this
|
||||
|
|
|
|||
|
|
@ -25,13 +25,7 @@
|
|||
#include "core/stream/stream.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const char TAG_ASCII_ID[] = "[TAG]";
|
||||
const char TAG_ASCII_END[] = "[END]";
|
||||
const char TAG_ASCII_HEADER[] = "// Auto-Generated by TagDictionary class";
|
||||
|
||||
const S32 sg_tagDictAsciiUser = 1;
|
||||
|
||||
} // namespace
|
||||
|
||||
TagDictionary tagDictionary;
|
||||
|
|
|
|||
|
|
@ -104,9 +104,9 @@ acceptable. Do NOT use for cryptographic purposes.
|
|||
--------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
U32 hash(register const U8 *k, register U32 length, register U32 initval)
|
||||
U32 hash(const U8 *k, U32 length, U32 initval)
|
||||
{
|
||||
register U32 a,b,c,len;
|
||||
U32 a,b,c,len;
|
||||
|
||||
/* Set up the internal state */
|
||||
len = length;
|
||||
|
|
@ -211,9 +211,9 @@ is acceptable. Do NOT use for cryptographic purposes.
|
|||
--------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
U64 hash64( register const U8 *k, register U32 length, register U64 initval )
|
||||
U64 hash64( const U8 *k, U32 length, U64 initval )
|
||||
{
|
||||
register U64 a,b,c,len;
|
||||
U64 a,b,c,len;
|
||||
|
||||
/* Set up the internal state */
|
||||
len = length;
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ void MD5Final( unsigned char digest[16], MD5Context* ctx)
|
|||
*/
|
||||
void MD5Transform( int buf[4], int in[16])
|
||||
{
|
||||
register int a, b, c, d;
|
||||
int a, b, c, d;
|
||||
|
||||
a = buf[0];
|
||||
b = buf[1];
|
||||
|
|
|
|||
|
|
@ -127,8 +127,6 @@ inline void Swizzle<T, mapLength>::ToBuffer( void *destination, const void *sour
|
|||
|
||||
for( S32 i = 0; i < size / ( mapLength * sizeof( T ) ); i++ )
|
||||
{
|
||||
dMemcpy( dest, src, mapLength * sizeof( T ) );
|
||||
|
||||
for( S32 j = 0; j < mapLength; j++ )
|
||||
*dest++ = src[mMap[j]];
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ protected:
|
|||
|
||||
StrTest() : mData( 0 ), mUTF16( 0 ), mLength( 0 ) {}
|
||||
StrTest( const char* str )
|
||||
: mData( str ), mLength( str ? dStrlen( str ) : 0 ), mUTF16( NULL )
|
||||
: mData( str ), mUTF16( NULL ), mLength( str ? dStrlen( str ) : 0 )
|
||||
{
|
||||
if( str )
|
||||
mUTF16 = createUTF16string( mData );
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@
|
|||
** this software for any purpose.
|
||||
*/
|
||||
|
||||
#include "platform/platform.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -68,7 +69,11 @@
|
|||
|
||||
#include "core/util/md5.h"
|
||||
|
||||
#if defined (TORQUE_OS_MAC) && defined(TORQUE_CPU_X64)
|
||||
typedef unsigned int unsigned32;
|
||||
#else
|
||||
typedef unsigned long unsigned32;
|
||||
#endif
|
||||
typedef unsigned short unsigned16;
|
||||
typedef unsigned char unsigned8;
|
||||
|
||||
|
|
@ -162,7 +167,7 @@ static void create_uuid_state(uuid_state *st)
|
|||
*/
|
||||
static void format_token(char *target, const xuuid_t *u)
|
||||
{
|
||||
sprintf(target, "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
sprintf(target, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
u->time_low, u->time_mid, u->time_hi_and_version,
|
||||
u->clock_seq_hi_and_reserved, u->clock_seq_low,
|
||||
u->node[0], u->node[1], u->node[2],
|
||||
|
|
|
|||
|
|
@ -272,11 +272,11 @@ SimObjectPtr<SimSet> DecalRoad::smServerDecalRoadSet = NULL;
|
|||
// Constructors
|
||||
|
||||
DecalRoad::DecalRoad()
|
||||
: mLoadRenderData( true ),
|
||||
mBreakAngle( 3.0f ),
|
||||
: mBreakAngle( 3.0f ),
|
||||
mSegmentsPerBatch( 10 ),
|
||||
mTextureLength( 5.0f ),
|
||||
mRenderPriority( 10 ),
|
||||
mLoadRenderData( true ),
|
||||
mMaterial( NULL ),
|
||||
mMatInst( NULL ),
|
||||
mUpdateEventId( -1 ),
|
||||
|
|
@ -1580,8 +1580,6 @@ void DecalRoad::_captureVerts()
|
|||
box.intersect( batch.bounds );
|
||||
}
|
||||
|
||||
Point3F pos = getPosition();
|
||||
|
||||
mWorldBox = box;
|
||||
resetObjectBox();
|
||||
|
||||
|
|
|
|||
|
|
@ -59,29 +59,28 @@ GuiMeshRoadEditorCtrl::GuiMeshRoadEditorCtrl()
|
|||
// tool palette
|
||||
mSelectMeshRoadMode("MeshRoadEditorSelectMode"),
|
||||
mAddMeshRoadMode("MeshRoadEditorAddRoadMode"),
|
||||
mMovePointMode("MeshRoadEditorMoveMode"),
|
||||
mRotatePointMode("MeshRoadEditorRotateMode"),
|
||||
mScalePointMode("MeshRoadEditorScaleMode"),
|
||||
mAddNodeMode("MeshRoadEditorAddNodeMode"),
|
||||
mInsertPointMode("MeshRoadEditorInsertPointMode"),
|
||||
mRemovePointMode("MeshRoadEditorRemovePointMode"),
|
||||
mMode(mSelectMeshRoadMode),
|
||||
|
||||
mHasCopied( false ),
|
||||
mIsDirty( false ),
|
||||
mRoadSet( NULL ),
|
||||
mSelNode( -1 ),
|
||||
mSelRoad( NULL ),
|
||||
mHoverRoad( NULL ),
|
||||
mHoverNode( -1 ),
|
||||
mDefaultWidth( 10.0f ),
|
||||
mDefaultDepth( 5.0f ),
|
||||
mDefaultNormal( 0,0,1 ),
|
||||
mAddNodeIdx( 0 ),
|
||||
mNodeHalfSize( 4,4 ),
|
||||
mHoverSplineColor( 255,0,0,255 ),
|
||||
mSelectedSplineColor( 0,255,0,255 ),
|
||||
mHoverNodeColor( 255,255,255,255 )
|
||||
mMovePointMode("MeshRoadEditorMoveMode"),
|
||||
mScalePointMode("MeshRoadEditorScaleMode"),
|
||||
mRotatePointMode("MeshRoadEditorRotateMode"),
|
||||
mIsDirty( false ),
|
||||
mRoadSet( NULL ),
|
||||
mSelNode( -1 ),
|
||||
mHoverNode( -1 ),
|
||||
mAddNodeIdx( 0 ),
|
||||
mSelRoad( NULL ),
|
||||
mHoverRoad( NULL ),
|
||||
mMode(mSelectMeshRoadMode),
|
||||
mDefaultWidth( 10.0f ),
|
||||
mDefaultDepth( 5.0f ),
|
||||
mDefaultNormal( 0,0,1 ),
|
||||
mNodeHalfSize( 4,4 ),
|
||||
mHoverSplineColor( 255,0,0,255 ),
|
||||
mSelectedSplineColor( 0,255,0,255 ),
|
||||
mHoverNodeColor( 255,255,255,255 ),
|
||||
mHasCopied( false )
|
||||
{
|
||||
mMaterialName[Top] = StringTable->insert("DefaultRoadMaterialTop");
|
||||
mMaterialName[Bottom] = StringTable->insert("DefaultRoadMaterialOther");
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ ConsoleDocClass( GuiRiverEditorCtrl,
|
|||
);
|
||||
|
||||
GuiRiverEditorCtrl::GuiRiverEditorCtrl()
|
||||
: mDefaultNormal( 0, 0, 1 ),
|
||||
mDefaultWidth( 10.0f ),
|
||||
mDefaultDepth( 5.0f )
|
||||
: mDefaultWidth( 10.0f ),
|
||||
mDefaultDepth( 5.0f ),
|
||||
mDefaultNormal( 0, 0, 1 )
|
||||
{
|
||||
// Each of the mode names directly correlates with the River Editor's
|
||||
// tool palette
|
||||
|
|
|
|||
|
|
@ -1713,8 +1713,6 @@ void MeshRoad::_generateSlices()
|
|||
}
|
||||
}
|
||||
|
||||
Point3F pos = getPosition();
|
||||
|
||||
mWorldBox = box;
|
||||
resetObjectBox();
|
||||
|
||||
|
|
|
|||
|
|
@ -593,14 +593,14 @@ IMPLEMENT_CO_NETOBJECT_V1(River);
|
|||
|
||||
|
||||
River::River()
|
||||
: mMetersPerSegment(10.0f),
|
||||
mSegmentsPerBatch(10),
|
||||
: mSegmentsPerBatch(10),
|
||||
mMetersPerSegment(10.0f),
|
||||
mDepthScale(1.0f),
|
||||
mFlowMagnitude(1.0f),
|
||||
mLodDistance( 50.0f ),
|
||||
mMaxDivisionSize(2.5f),
|
||||
mMinDivisionSize(0.25f),
|
||||
mColumnCount(5),
|
||||
mFlowMagnitude(1.0f),
|
||||
mLodDistance( 50.0f )
|
||||
mColumnCount(5)
|
||||
{
|
||||
mNetFlags.set( Ghostable | ScopeAlways );
|
||||
|
||||
|
|
@ -1592,8 +1592,6 @@ void River::_generateSlices()
|
|||
}
|
||||
}
|
||||
|
||||
Point3F pos = getPosition();
|
||||
|
||||
mWorldBox = box;
|
||||
//mObjBox.minExtents -= pos;
|
||||
//mObjBox.maxExtents -= pos;
|
||||
|
|
|
|||
|
|
@ -667,11 +667,11 @@ void ScatterSky::prepRenderImage( SceneRenderState *state )
|
|||
mFlareState.scale = mFlareScale;
|
||||
mFlareState.lightInfo = mLight;
|
||||
|
||||
Point3F lightPos = state->getCameraPosition() - state->getFarPlane() * mLight->getDirection() * 0.9f;
|
||||
Point3F lightPos = state->getDiffuseCameraPosition() - state->getFarPlane() * mLight->getDirection() * 0.9f;
|
||||
mFlareState.lightMat.identity();
|
||||
mFlareState.lightMat.setPosition( lightPos );
|
||||
|
||||
F32 dist = ( lightPos - state->getCameraPosition( ) ).len( );
|
||||
F32 dist = ( lightPos - state->getDiffuseCameraPosition( ) ).len( );
|
||||
F32 coronaScale = 0.5f;
|
||||
F32 screenRadius = GFX->getViewport( ).extent.y * coronaScale * 0.5f;
|
||||
mFlareState.worldRadius = screenRadius * dist / state->getWorldToScreenScale( ).y;
|
||||
|
|
|
|||
|
|
@ -189,7 +189,6 @@ void WaterBlock::setupVBIB()
|
|||
//-----------------------------------------------------------------------------
|
||||
void WaterBlock::setupVertexBlock( U32 width, U32 height, U32 rowOffset )
|
||||
{
|
||||
Point3F pos = getPosition();
|
||||
RayInfo rInfo;
|
||||
VectorF sunVector(-0.61f, 0.354f, 0.707f);
|
||||
|
||||
|
|
@ -592,9 +591,6 @@ void WaterBlock::setTransform( const MatrixF &mat )
|
|||
// If our transform changes we need to recalculate the
|
||||
// per vertex depth/shadow info. Would be nice if this could
|
||||
// be done independently of generating the whole VBIB...
|
||||
|
||||
MatrixF oldMat = mObjToWorld;
|
||||
|
||||
Parent::setTransform( mat );
|
||||
|
||||
// We don't need to regen our vb anymore since we aren't calculating
|
||||
|
|
|
|||
|
|
@ -179,23 +179,24 @@ ConsoleDocClass( WaterObject,
|
|||
WaterObject::WaterObject()
|
||||
: mViscosity( 1.0f ),
|
||||
mDensity( 1.0f ),
|
||||
mReflectivity( 0.5f ),
|
||||
mReflectNormalUp( true ),
|
||||
mLiquidType( "Water" ),
|
||||
mFresnelBias( 0.3f ),
|
||||
mFresnelPower( 6.0f ),
|
||||
mReflectNormalUp( true ),
|
||||
mReflectivity( 0.5f ),
|
||||
mDistortStartDist( 0.1f ),
|
||||
mDistortEndDist( 20.0f ),
|
||||
mDistortFullDepth( 3.5f ),
|
||||
mUndulateMaxDist(50.0f),
|
||||
mOverallFoamOpacity( 1.0f ),
|
||||
mFoamMaxDepth( 2.0f ),
|
||||
mFoamAmbientLerp( 0.5f ),
|
||||
mFoamRippleInfluence( 0.05f ),
|
||||
mUnderwaterPostFx( NULL ),
|
||||
mLiquidType( "Water" ),
|
||||
mFresnelBias( 0.3f ),
|
||||
mFresnelPower( 6.0f ),
|
||||
mClarity( 0.5f ),
|
||||
mBasicLighting( false ),
|
||||
mUnderwaterColor(9, 6, 5, 240),
|
||||
mUndulateMaxDist(50.0f),
|
||||
mMiscParamW( 0.0f ),
|
||||
mUnderwaterPostFx( NULL ),
|
||||
mBasicLighting( false ),
|
||||
mOverallWaveMagnitude( 1.0f ),
|
||||
mOverallRippleMagnitude( 0.1f ),
|
||||
mCubemap( NULL ),
|
||||
|
|
@ -203,8 +204,7 @@ WaterObject::WaterObject()
|
|||
mSpecularPower( 48.0f ),
|
||||
mSpecularColor( 1.0f, 1.0f, 1.0f, 1.0f ),
|
||||
mDepthGradientMax( 50.0f ),
|
||||
mEmissive( false ),
|
||||
mUnderwaterColor(9, 6, 5, 240)
|
||||
mEmissive( false )
|
||||
{
|
||||
mTypeMask = WaterObjectType;
|
||||
|
||||
|
|
|
|||
|
|
@ -533,7 +533,7 @@ void WaterPlane::setupVBIB( SceneRenderState *state )
|
|||
1, // Top
|
||||
-(S32)gridStride, // Right
|
||||
-1, // Bottom
|
||||
gridStride, // Left
|
||||
(S32)gridStride, // Left
|
||||
};
|
||||
|
||||
const U32 firstBorderVert = gridStride * gridSize + gridStride;
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ ForestBrushElement::ForestBrushElement()
|
|||
mSinkMin( 0.0f ),
|
||||
mSinkMax( 0.0f ),
|
||||
mSinkRadius( 1 ),
|
||||
mSlopeMax( 90.0f ),
|
||||
mSlopeMin( 0.0f ),
|
||||
mSlopeMax( 90.0f ),
|
||||
mElevationMin( -10000.0f ),
|
||||
mElevationMax( 10000.0f )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -78,16 +78,16 @@ EndImplementEnumType;
|
|||
|
||||
|
||||
ForestBrushTool::ForestBrushTool()
|
||||
: mSize( 5.0f ),
|
||||
: mRandom( Platform::getRealMilliseconds() + 1 ),
|
||||
mSize( 5.0f ),
|
||||
mPressure( 0.1f ),
|
||||
mHardness( 1.0f ),
|
||||
mDrawBrush( false ),
|
||||
mCurrAction( NULL ),
|
||||
mStrokeEvent( 0 ),
|
||||
mBrushDown( false ),
|
||||
mColor( ColorI::WHITE ),
|
||||
mMode( Paint ),
|
||||
mRandom( Platform::getRealMilliseconds() + 1 )
|
||||
mColor( ColorI::WHITE ),
|
||||
mBrushDown( false ),
|
||||
mDrawBrush( false ),
|
||||
mStrokeEvent( 0 ),
|
||||
mCurrAction( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ ForestUndoAction::ForestUndoAction( const Resource<ForestData> &data,
|
|||
ForestEditorCtrl *editor,
|
||||
const char *description )
|
||||
: UndoAction( description ),
|
||||
mData( data ),
|
||||
mEditor( editor )
|
||||
mEditor( editor ),
|
||||
mData( data )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,8 +77,6 @@ void ForestWindAccumulator::updateWind( const VectorF &windForce, F32 timeDelta
|
|||
// an infinite mass.
|
||||
mParticles[0].position = target;
|
||||
|
||||
Point2F relVel = target * timeDelta;
|
||||
|
||||
Point2F diff( 0, 0 );
|
||||
Point2F springForce( 0, 0 );
|
||||
|
||||
|
|
|
|||
|
|
@ -119,74 +119,77 @@ void GFXD3D11Device::enumerateAdapters(Vector<GFXAdapter*> &adapterList)
|
|||
|
||||
for(U32 adapterIndex = 0; DXGIFactory->EnumAdapters1(adapterIndex, &EnumAdapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex)
|
||||
{
|
||||
GFXAdapter *toAdd = new GFXAdapter;
|
||||
toAdd->mType = Direct3D11;
|
||||
toAdd->mIndex = adapterIndex;
|
||||
toAdd->mCreateDeviceInstanceDelegate = mCreateDeviceInstance;
|
||||
GFXAdapter *toAdd = new GFXAdapter;
|
||||
toAdd->mType = Direct3D11;
|
||||
toAdd->mIndex = adapterIndex;
|
||||
toAdd->mCreateDeviceInstanceDelegate = mCreateDeviceInstance;
|
||||
|
||||
toAdd->mShaderModel = 5.0f;
|
||||
DXGI_ADAPTER_DESC1 desc;
|
||||
EnumAdapter->GetDesc1(&desc);
|
||||
toAdd->mShaderModel = 5.0f;
|
||||
DXGI_ADAPTER_DESC1 desc;
|
||||
EnumAdapter->GetDesc1(&desc);
|
||||
|
||||
size_t size=wcslen(desc.Description);
|
||||
char *str = new char[size+1];
|
||||
// LUID identifies adapter for oculus rift
|
||||
dMemcpy(&toAdd->mLUID, &desc.AdapterLuid, sizeof(toAdd->mLUID));
|
||||
|
||||
wcstombs(str, desc.Description,size);
|
||||
str[size]='\0';
|
||||
String Description=str;
|
||||
size_t size=wcslen(desc.Description);
|
||||
char *str = new char[size+1];
|
||||
|
||||
wcstombs(str, desc.Description,size);
|
||||
str[size]='\0';
|
||||
String Description=str;
|
||||
SAFE_DELETE_ARRAY(str);
|
||||
|
||||
dStrncpy(toAdd->mName, Description.c_str(), GFXAdapter::MaxAdapterNameLen);
|
||||
dStrncat(toAdd->mName, " (D3D11)", GFXAdapter::MaxAdapterNameLen);
|
||||
dStrncpy(toAdd->mName, Description.c_str(), GFXAdapter::MaxAdapterNameLen);
|
||||
dStrncat(toAdd->mName, " (D3D11)", GFXAdapter::MaxAdapterNameLen);
|
||||
|
||||
IDXGIOutput* pOutput = NULL;
|
||||
HRESULT hr;
|
||||
IDXGIOutput* pOutput = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
hr = EnumAdapter->EnumOutputs(adapterIndex, &pOutput);
|
||||
hr = EnumAdapter->EnumOutputs(adapterIndex, &pOutput);
|
||||
|
||||
if(hr == DXGI_ERROR_NOT_FOUND)
|
||||
{
|
||||
if(hr == DXGI_ERROR_NOT_FOUND)
|
||||
{
|
||||
SAFE_RELEASE(EnumAdapter);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::enumerateAdapters -> EnumOutputs call failure");
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::enumerateAdapters -> EnumOutputs call failure");
|
||||
|
||||
UINT numModes = 0;
|
||||
DXGI_MODE_DESC* displayModes = NULL;
|
||||
DXGI_FORMAT format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
UINT numModes = 0;
|
||||
DXGI_MODE_DESC* displayModes = NULL;
|
||||
DXGI_FORMAT format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
|
||||
// Get the number of elements
|
||||
hr = pOutput->GetDisplayModeList(format, 0, &numModes, NULL);
|
||||
// Get the number of elements
|
||||
hr = pOutput->GetDisplayModeList(format, 0, &numModes, NULL);
|
||||
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::enumerateAdapters -> GetDisplayModeList call failure");
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::enumerateAdapters -> GetDisplayModeList call failure");
|
||||
|
||||
displayModes = new DXGI_MODE_DESC[numModes];
|
||||
displayModes = new DXGI_MODE_DESC[numModes];
|
||||
|
||||
// Get the list
|
||||
hr = pOutput->GetDisplayModeList(format, 0, &numModes, displayModes);
|
||||
// Get the list
|
||||
hr = pOutput->GetDisplayModeList(format, 0, &numModes, displayModes);
|
||||
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::enumerateAdapters -> GetDisplayModeList call failure");
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::enumerateAdapters -> GetDisplayModeList call failure");
|
||||
|
||||
for(U32 numMode = 0; numMode < numModes; ++numMode)
|
||||
{
|
||||
GFXVideoMode vmAdd;
|
||||
for(U32 numMode = 0; numMode < numModes; ++numMode)
|
||||
{
|
||||
GFXVideoMode vmAdd;
|
||||
|
||||
vmAdd.fullScreen = true;
|
||||
vmAdd.bitDepth = 32;
|
||||
vmAdd.refreshRate = displayModes[numMode].RefreshRate.Numerator / displayModes[numMode].RefreshRate.Denominator;
|
||||
vmAdd.resolution.x = displayModes[numMode].Width;
|
||||
vmAdd.resolution.y = displayModes[numMode].Height;
|
||||
toAdd->mAvailableModes.push_back(vmAdd);
|
||||
}
|
||||
vmAdd.fullScreen = true;
|
||||
vmAdd.bitDepth = 32;
|
||||
vmAdd.refreshRate = displayModes[numMode].RefreshRate.Numerator / displayModes[numMode].RefreshRate.Denominator;
|
||||
vmAdd.resolution.x = displayModes[numMode].Width;
|
||||
vmAdd.resolution.y = displayModes[numMode].Height;
|
||||
toAdd->mAvailableModes.push_back(vmAdd);
|
||||
}
|
||||
|
||||
delete[] displayModes;
|
||||
delete[] displayModes;
|
||||
SAFE_RELEASE(pOutput);
|
||||
SAFE_RELEASE(EnumAdapter);
|
||||
adapterList.push_back(toAdd);
|
||||
adapterList.push_back(toAdd);
|
||||
}
|
||||
|
||||
SAFE_RELEASE(DXGIFactory);
|
||||
|
|
@ -207,50 +210,50 @@ void GFXD3D11Device::enumerateVideoModes()
|
|||
|
||||
for(U32 adapterIndex = 0; DXGIFactory->EnumAdapters1(adapterIndex, &EnumAdapter) != DXGI_ERROR_NOT_FOUND; ++adapterIndex)
|
||||
{
|
||||
IDXGIOutput* pOutput = NULL;
|
||||
IDXGIOutput* pOutput = NULL;
|
||||
|
||||
hr = EnumAdapter->EnumOutputs(adapterIndex, &pOutput);
|
||||
hr = EnumAdapter->EnumOutputs(adapterIndex, &pOutput);
|
||||
|
||||
if(hr == DXGI_ERROR_NOT_FOUND)
|
||||
{
|
||||
if(hr == DXGI_ERROR_NOT_FOUND)
|
||||
{
|
||||
SAFE_RELEASE(EnumAdapter);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::enumerateVideoModes -> EnumOutputs call failure");
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::enumerateVideoModes -> EnumOutputs call failure");
|
||||
|
||||
UINT numModes = 0;
|
||||
DXGI_MODE_DESC* displayModes = NULL;
|
||||
DXGI_FORMAT format = GFXD3D11TextureFormat[GFXFormatR8G8B8A8];
|
||||
UINT numModes = 0;
|
||||
DXGI_MODE_DESC* displayModes = NULL;
|
||||
DXGI_FORMAT format = GFXD3D11TextureFormat[GFXFormatR8G8B8A8];
|
||||
|
||||
// Get the number of elements
|
||||
hr = pOutput->GetDisplayModeList(format, 0, &numModes, NULL);
|
||||
// Get the number of elements
|
||||
hr = pOutput->GetDisplayModeList(format, 0, &numModes, NULL);
|
||||
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::enumerateVideoModes -> GetDisplayModeList call failure");
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::enumerateVideoModes -> GetDisplayModeList call failure");
|
||||
|
||||
displayModes = new DXGI_MODE_DESC[numModes];
|
||||
displayModes = new DXGI_MODE_DESC[numModes];
|
||||
|
||||
// Get the list
|
||||
hr = pOutput->GetDisplayModeList(format, 0, &numModes, displayModes);
|
||||
// Get the list
|
||||
hr = pOutput->GetDisplayModeList(format, 0, &numModes, displayModes);
|
||||
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::enumerateVideoModes -> GetDisplayModeList call failure");
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::enumerateVideoModes -> GetDisplayModeList call failure");
|
||||
|
||||
for(U32 numMode = 0; numMode < numModes; ++numMode)
|
||||
{
|
||||
GFXVideoMode toAdd;
|
||||
for(U32 numMode = 0; numMode < numModes; ++numMode)
|
||||
{
|
||||
GFXVideoMode toAdd;
|
||||
|
||||
toAdd.fullScreen = false;
|
||||
toAdd.bitDepth = 32;
|
||||
toAdd.refreshRate = displayModes[numMode].RefreshRate.Numerator / displayModes[numMode].RefreshRate.Denominator;
|
||||
toAdd.resolution.x = displayModes[numMode].Width;
|
||||
toAdd.resolution.y = displayModes[numMode].Height;
|
||||
mVideoModes.push_back(toAdd);
|
||||
}
|
||||
toAdd.fullScreen = false;
|
||||
toAdd.bitDepth = 32;
|
||||
toAdd.refreshRate = displayModes[numMode].RefreshRate.Numerator / displayModes[numMode].RefreshRate.Denominator;
|
||||
toAdd.resolution.x = displayModes[numMode].Width;
|
||||
toAdd.resolution.y = displayModes[numMode].Height;
|
||||
mVideoModes.push_back(toAdd);
|
||||
}
|
||||
|
||||
delete[] displayModes;
|
||||
delete[] displayModes;
|
||||
SAFE_RELEASE(pOutput);
|
||||
SAFE_RELEASE(EnumAdapter);
|
||||
}
|
||||
|
|
@ -260,7 +263,7 @@ void GFXD3D11Device::enumerateVideoModes()
|
|||
|
||||
IDXGISwapChain* GFXD3D11Device::getSwapChain()
|
||||
{
|
||||
return mSwapChain;
|
||||
return mSwapChain;
|
||||
}
|
||||
|
||||
void GFXD3D11Device::init(const GFXVideoMode &mode, PlatformWindow *window)
|
||||
|
|
@ -282,19 +285,19 @@ void GFXD3D11Device::init(const GFXVideoMode &mode, PlatformWindow *window)
|
|||
// create a device, device context and swap chain using the information in the d3dpp struct
|
||||
HRESULT hres = D3D11CreateDeviceAndSwapChain(NULL,
|
||||
driverType,
|
||||
NULL,
|
||||
createDeviceFlags,
|
||||
NULL,
|
||||
0,
|
||||
D3D11_SDK_VERSION,
|
||||
&d3dpp,
|
||||
&mSwapChain,
|
||||
&mD3DDevice,
|
||||
&deviceFeature,
|
||||
&mD3DDeviceContext);
|
||||
NULL,
|
||||
createDeviceFlags,
|
||||
NULL,
|
||||
0,
|
||||
D3D11_SDK_VERSION,
|
||||
&d3dpp,
|
||||
&mSwapChain,
|
||||
&mD3DDevice,
|
||||
&deviceFeature,
|
||||
&mD3DDeviceContext);
|
||||
|
||||
if(FAILED(hres))
|
||||
{
|
||||
if(FAILED(hres))
|
||||
{
|
||||
#ifdef TORQUE_DEBUG
|
||||
//try again without debug device layer enabled
|
||||
createDeviceFlags &= ~D3D11_CREATE_DEVICE_DEBUG;
|
||||
|
|
@ -312,9 +315,9 @@ void GFXD3D11Device::init(const GFXVideoMode &mode, PlatformWindow *window)
|
|||
Con::warnf("GFXD3D11Device::init - Debug layers not detected!");
|
||||
mDebugLayers = false;
|
||||
#else
|
||||
AssertFatal(false, "GFXD3D11Device::init - D3D11CreateDeviceAndSwapChain failed!");
|
||||
AssertFatal(false, "GFXD3D11Device::init - D3D11CreateDeviceAndSwapChain failed!");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
//set the fullscreen state here if we need to
|
||||
if(mode.fullScreen)
|
||||
|
|
@ -326,79 +329,79 @@ void GFXD3D11Device::init(const GFXVideoMode &mode, PlatformWindow *window)
|
|||
}
|
||||
}
|
||||
|
||||
mTextureManager = new GFXD3D11TextureManager();
|
||||
mTextureManager = new GFXD3D11TextureManager();
|
||||
|
||||
// Now reacquire all the resources we trashed earlier
|
||||
reacquireDefaultPoolResources();
|
||||
// Now reacquire all the resources we trashed earlier
|
||||
reacquireDefaultPoolResources();
|
||||
//TODO implement feature levels?
|
||||
if (deviceFeature >= D3D_FEATURE_LEVEL_11_0)
|
||||
mPixVersion = 5.0f;
|
||||
else
|
||||
AssertFatal(false, "GFXD3D11Device::init - We don't support anything below feature level 11.");
|
||||
if (deviceFeature >= D3D_FEATURE_LEVEL_11_0)
|
||||
mPixVersion = 5.0f;
|
||||
else
|
||||
AssertFatal(false, "GFXD3D11Device::init - We don't support anything below feature level 11.");
|
||||
|
||||
D3D11_QUERY_DESC queryDesc;
|
||||
D3D11_QUERY_DESC queryDesc;
|
||||
queryDesc.Query = D3D11_QUERY_OCCLUSION;
|
||||
queryDesc.MiscFlags = 0;
|
||||
|
||||
ID3D11Query *testQuery = NULL;
|
||||
ID3D11Query *testQuery = NULL;
|
||||
|
||||
// detect occlusion query support
|
||||
if (SUCCEEDED(mD3DDevice->CreateQuery(&queryDesc, &testQuery))) mOcclusionQuerySupported = true;
|
||||
// detect occlusion query support
|
||||
if (SUCCEEDED(mD3DDevice->CreateQuery(&queryDesc, &testQuery))) mOcclusionQuerySupported = true;
|
||||
|
||||
SAFE_RELEASE(testQuery);
|
||||
|
||||
Con::printf("Hardware occlusion query detected: %s", mOcclusionQuerySupported ? "Yes" : "No");
|
||||
Con::printf("Hardware occlusion query detected: %s", mOcclusionQuerySupported ? "Yes" : "No");
|
||||
|
||||
mCardProfiler = new GFXD3D11CardProfiler();
|
||||
mCardProfiler->init();
|
||||
mCardProfiler = new GFXD3D11CardProfiler();
|
||||
mCardProfiler->init();
|
||||
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.Format = GFXD3D11TextureFormat[GFXFormatD24S8];
|
||||
desc.MipLevels = 1;
|
||||
desc.ArraySize = 1;
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.Width = mode.resolution.x;
|
||||
desc.Height = mode.resolution.y;
|
||||
desc.SampleDesc.Count =1;
|
||||
desc.SampleDesc.Quality =0;
|
||||
desc.MiscFlags = 0;
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.Format = GFXD3D11TextureFormat[GFXFormatD24S8];
|
||||
desc.MipLevels = 1;
|
||||
desc.ArraySize = 1;
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.Width = mode.resolution.x;
|
||||
desc.Height = mode.resolution.y;
|
||||
desc.SampleDesc.Count =1;
|
||||
desc.SampleDesc.Quality =0;
|
||||
desc.MiscFlags = 0;
|
||||
|
||||
HRESULT hr = mD3DDevice->CreateTexture2D(&desc, NULL, &mDeviceDepthStencil);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "GFXD3D11Device::init - couldn't create device's depth-stencil surface.");
|
||||
}
|
||||
HRESULT hr = mD3DDevice->CreateTexture2D(&desc, NULL, &mDeviceDepthStencil);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "GFXD3D11Device::init - couldn't create device's depth-stencil surface.");
|
||||
}
|
||||
|
||||
D3D11_DEPTH_STENCIL_VIEW_DESC depthDesc;
|
||||
depthDesc.Format = GFXD3D11TextureFormat[GFXFormatD24S8];
|
||||
depthDesc.Flags =0 ;
|
||||
depthDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
|
||||
depthDesc.Texture2D.MipSlice = 0;
|
||||
D3D11_DEPTH_STENCIL_VIEW_DESC depthDesc;
|
||||
depthDesc.Format = GFXD3D11TextureFormat[GFXFormatD24S8];
|
||||
depthDesc.Flags =0 ;
|
||||
depthDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
|
||||
depthDesc.Texture2D.MipSlice = 0;
|
||||
|
||||
hr = mD3DDevice->CreateDepthStencilView(mDeviceDepthStencil, &depthDesc, &mDeviceDepthStencilView);
|
||||
hr = mD3DDevice->CreateDepthStencilView(mDeviceDepthStencil, &depthDesc, &mDeviceDepthStencilView);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "GFXD3D11Device::init - couldn't create depth stencil view");
|
||||
}
|
||||
if(FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "GFXD3D11Device::init - couldn't create depth stencil view");
|
||||
}
|
||||
|
||||
hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mDeviceBackbuffer);
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::init - coudln't retrieve backbuffer ref");
|
||||
hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mDeviceBackbuffer);
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::init - coudln't retrieve backbuffer ref");
|
||||
|
||||
//create back buffer view
|
||||
D3D11_RENDER_TARGET_VIEW_DESC RTDesc;
|
||||
//create back buffer view
|
||||
D3D11_RENDER_TARGET_VIEW_DESC RTDesc;
|
||||
|
||||
RTDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
RTDesc.Texture2D.MipSlice = 0;
|
||||
RTDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
|
||||
RTDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
RTDesc.Texture2D.MipSlice = 0;
|
||||
RTDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
|
||||
|
||||
hr = mD3DDevice->CreateRenderTargetView(mDeviceBackbuffer, &RTDesc, &mDeviceBackBufferView);
|
||||
hr = mD3DDevice->CreateRenderTargetView(mDeviceBackbuffer, &RTDesc, &mDeviceBackBufferView);
|
||||
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::init - couldn't create back buffer target view");
|
||||
if(FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::init - couldn't create back buffer target view");
|
||||
|
||||
#ifdef TORQUE_DEBUG
|
||||
String backBufferName = "MainBackBuffer";
|
||||
|
|
@ -416,8 +419,8 @@ void GFXD3D11Device::init(const GFXVideoMode &mode, PlatformWindow *window)
|
|||
|
||||
gScreenShot = new ScreenShotD3D11;
|
||||
|
||||
mInitialized = true;
|
||||
deviceInited();
|
||||
mInitialized = true;
|
||||
deviceInited();
|
||||
}
|
||||
|
||||
// Supress any debug layer messages we don't want to see
|
||||
|
|
@ -486,28 +489,28 @@ GFXTextureTarget* GFXD3D11Device::allocRenderToTextureTarget()
|
|||
|
||||
void GFXD3D11Device::reset(DXGI_SWAP_CHAIN_DESC &d3dpp)
|
||||
{
|
||||
if (!mD3DDevice)
|
||||
return;
|
||||
if (!mD3DDevice)
|
||||
return;
|
||||
|
||||
mInitialized = false;
|
||||
mInitialized = false;
|
||||
|
||||
// Clean up some commonly dangling state. This helps prevents issues with
|
||||
// items that are destroyed by the texture manager callbacks and recreated
|
||||
// later, but still left bound.
|
||||
setVertexBuffer(NULL);
|
||||
setPrimitiveBuffer(NULL);
|
||||
for (S32 i = 0; i<getNumSamplers(); i++)
|
||||
setTexture(i, NULL);
|
||||
// Clean up some commonly dangling state. This helps prevents issues with
|
||||
// items that are destroyed by the texture manager callbacks and recreated
|
||||
// later, but still left bound.
|
||||
setVertexBuffer(NULL);
|
||||
setPrimitiveBuffer(NULL);
|
||||
for (S32 i = 0; i<getNumSamplers(); i++)
|
||||
setTexture(i, NULL);
|
||||
|
||||
mD3DDeviceContext->ClearState();
|
||||
mD3DDeviceContext->ClearState();
|
||||
|
||||
DXGI_MODE_DESC displayModes;
|
||||
displayModes.Format = d3dpp.BufferDesc.Format;
|
||||
displayModes.Height = d3dpp.BufferDesc.Height;
|
||||
displayModes.Width = d3dpp.BufferDesc.Width;
|
||||
displayModes.RefreshRate = d3dpp.BufferDesc.RefreshRate;
|
||||
displayModes.Scaling = d3dpp.BufferDesc.Scaling;
|
||||
displayModes.ScanlineOrdering = d3dpp.BufferDesc.ScanlineOrdering;
|
||||
DXGI_MODE_DESC displayModes;
|
||||
displayModes.Format = d3dpp.BufferDesc.Format;
|
||||
displayModes.Height = d3dpp.BufferDesc.Height;
|
||||
displayModes.Width = d3dpp.BufferDesc.Width;
|
||||
displayModes.RefreshRate = d3dpp.BufferDesc.RefreshRate;
|
||||
displayModes.Scaling = d3dpp.BufferDesc.Scaling;
|
||||
displayModes.ScanlineOrdering = d3dpp.BufferDesc.ScanlineOrdering;
|
||||
|
||||
HRESULT hr;
|
||||
if (!d3dpp.Windowed)
|
||||
|
|
@ -520,79 +523,79 @@ void GFXD3D11Device::reset(DXGI_SWAP_CHAIN_DESC &d3dpp)
|
|||
}
|
||||
}
|
||||
|
||||
// First release all the stuff we allocated from D3DPOOL_DEFAULT
|
||||
releaseDefaultPoolResources();
|
||||
// First release all the stuff we allocated from D3DPOOL_DEFAULT
|
||||
releaseDefaultPoolResources();
|
||||
|
||||
//release the backbuffer, depthstencil, and their views
|
||||
SAFE_RELEASE(mDeviceBackBufferView);
|
||||
SAFE_RELEASE(mDeviceBackbuffer);
|
||||
SAFE_RELEASE(mDeviceDepthStencilView);
|
||||
SAFE_RELEASE(mDeviceDepthStencil);
|
||||
//release the backbuffer, depthstencil, and their views
|
||||
SAFE_RELEASE(mDeviceBackBufferView);
|
||||
SAFE_RELEASE(mDeviceBackbuffer);
|
||||
SAFE_RELEASE(mDeviceDepthStencilView);
|
||||
SAFE_RELEASE(mDeviceDepthStencil);
|
||||
|
||||
hr = mSwapChain->ResizeBuffers(d3dpp.BufferCount, d3dpp.BufferDesc.Width, d3dpp.BufferDesc.Height, d3dpp.BufferDesc.Format, d3dpp.Windowed ? 0 : DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "D3D11Device::reset - failed to resize back buffer!");
|
||||
}
|
||||
if (FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "D3D11Device::reset - failed to resize back buffer!");
|
||||
}
|
||||
|
||||
//recreate backbuffer view. depth stencil view and texture
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.Format = GFXD3D11TextureFormat[GFXFormatD24S8];
|
||||
desc.MipLevels = 1;
|
||||
desc.ArraySize = 1;
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.Width = d3dpp.BufferDesc.Width;
|
||||
desc.Height = d3dpp.BufferDesc.Height;
|
||||
desc.SampleDesc.Count = 1;
|
||||
desc.SampleDesc.Quality = 0;
|
||||
desc.MiscFlags = 0;
|
||||
//recreate backbuffer view. depth stencil view and texture
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.Format = GFXD3D11TextureFormat[GFXFormatD24S8];
|
||||
desc.MipLevels = 1;
|
||||
desc.ArraySize = 1;
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.Width = d3dpp.BufferDesc.Width;
|
||||
desc.Height = d3dpp.BufferDesc.Height;
|
||||
desc.SampleDesc.Count = 1;
|
||||
desc.SampleDesc.Quality = 0;
|
||||
desc.MiscFlags = 0;
|
||||
|
||||
hr = mD3DDevice->CreateTexture2D(&desc, NULL, &mDeviceDepthStencil);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "GFXD3D11Device::reset - couldn't create device's depth-stencil surface.");
|
||||
}
|
||||
hr = mD3DDevice->CreateTexture2D(&desc, NULL, &mDeviceDepthStencil);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "GFXD3D11Device::reset - couldn't create device's depth-stencil surface.");
|
||||
}
|
||||
|
||||
D3D11_DEPTH_STENCIL_VIEW_DESC depthDesc;
|
||||
depthDesc.Format = GFXD3D11TextureFormat[GFXFormatD24S8];
|
||||
depthDesc.Flags = 0;
|
||||
depthDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
|
||||
depthDesc.Texture2D.MipSlice = 0;
|
||||
D3D11_DEPTH_STENCIL_VIEW_DESC depthDesc;
|
||||
depthDesc.Format = GFXD3D11TextureFormat[GFXFormatD24S8];
|
||||
depthDesc.Flags = 0;
|
||||
depthDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
|
||||
depthDesc.Texture2D.MipSlice = 0;
|
||||
|
||||
hr = mD3DDevice->CreateDepthStencilView(mDeviceDepthStencil, &depthDesc, &mDeviceDepthStencilView);
|
||||
hr = mD3DDevice->CreateDepthStencilView(mDeviceDepthStencil, &depthDesc, &mDeviceDepthStencilView);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "GFXD3D11Device::reset - couldn't create depth stencil view");
|
||||
}
|
||||
if (FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "GFXD3D11Device::reset - couldn't create depth stencil view");
|
||||
}
|
||||
|
||||
hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mDeviceBackbuffer);
|
||||
if (FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::reset - coudln't retrieve backbuffer ref");
|
||||
hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mDeviceBackbuffer);
|
||||
if (FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::reset - coudln't retrieve backbuffer ref");
|
||||
|
||||
//create back buffer view
|
||||
D3D11_RENDER_TARGET_VIEW_DESC RTDesc;
|
||||
//create back buffer view
|
||||
D3D11_RENDER_TARGET_VIEW_DESC RTDesc;
|
||||
|
||||
RTDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
RTDesc.Texture2D.MipSlice = 0;
|
||||
RTDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
|
||||
RTDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
RTDesc.Texture2D.MipSlice = 0;
|
||||
RTDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
|
||||
|
||||
hr = mD3DDevice->CreateRenderTargetView(mDeviceBackbuffer, &RTDesc, &mDeviceBackBufferView);
|
||||
hr = mD3DDevice->CreateRenderTargetView(mDeviceBackbuffer, &RTDesc, &mDeviceBackBufferView);
|
||||
|
||||
if (FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::reset - couldn't create back buffer target view");
|
||||
if (FAILED(hr))
|
||||
AssertFatal(false, "GFXD3D11Device::reset - couldn't create back buffer target view");
|
||||
|
||||
mD3DDeviceContext->OMSetRenderTargets(1, &mDeviceBackBufferView, mDeviceDepthStencilView);
|
||||
|
||||
hr = mSwapChain->SetFullscreenState(!d3dpp.Windowed, NULL);
|
||||
hr = mSwapChain->SetFullscreenState(!d3dpp.Windowed, NULL);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
if (FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "D3D11Device::reset - failed to change screen states!");
|
||||
}
|
||||
}
|
||||
|
||||
//Microsoft recommend this, see DXGI documentation
|
||||
if (!d3dpp.Windowed)
|
||||
|
|
@ -607,13 +610,13 @@ void GFXD3D11Device::reset(DXGI_SWAP_CHAIN_DESC &d3dpp)
|
|||
}
|
||||
}
|
||||
|
||||
mInitialized = true;
|
||||
mInitialized = true;
|
||||
|
||||
// Now re aquire all the resources we trashed earlier
|
||||
reacquireDefaultPoolResources();
|
||||
// Now re aquire all the resources we trashed earlier
|
||||
reacquireDefaultPoolResources();
|
||||
|
||||
// Mark everything dirty and flush to card, for sanity.
|
||||
updateStates(true);
|
||||
// Mark everything dirty and flush to card, for sanity.
|
||||
updateStates(true);
|
||||
}
|
||||
|
||||
class GFXPCD3D11RegisterDevice
|
||||
|
|
@ -896,20 +899,20 @@ void GFXD3D11Device::_updateRenderTargets()
|
|||
mRTDirty = false;
|
||||
}
|
||||
|
||||
if (mViewportDirty)
|
||||
{
|
||||
D3D11_VIEWPORT viewport;
|
||||
if (mViewportDirty)
|
||||
{
|
||||
D3D11_VIEWPORT viewport;
|
||||
|
||||
viewport.TopLeftX = mViewport.point.x;
|
||||
viewport.TopLeftY = mViewport.point.y;
|
||||
viewport.Width = mViewport.extent.x;
|
||||
viewport.Height = mViewport.extent.y;
|
||||
viewport.MinDepth = 0.0f;
|
||||
viewport.MaxDepth = 1.0f;
|
||||
viewport.TopLeftX = mViewport.point.x;
|
||||
viewport.TopLeftY = mViewport.point.y;
|
||||
viewport.Width = mViewport.extent.x;
|
||||
viewport.Height = mViewport.extent.y;
|
||||
viewport.MinDepth = 0.0f;
|
||||
viewport.MaxDepth = 1.0f;
|
||||
|
||||
mD3DDeviceContext->RSSetViewports(1, &viewport);
|
||||
mD3DDeviceContext->RSSetViewports(1, &viewport);
|
||||
|
||||
mViewportDirty = false;
|
||||
mViewportDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -967,35 +970,35 @@ void GFXD3D11Device::releaseDefaultPoolResources()
|
|||
|
||||
void GFXD3D11Device::reacquireDefaultPoolResources()
|
||||
{
|
||||
// Now do the dynamic index buffers
|
||||
if( mDynamicPB == NULL )
|
||||
mDynamicPB = new GFXD3D11PrimitiveBuffer(this, 0, 0, GFXBufferTypeDynamic);
|
||||
// Now do the dynamic index buffers
|
||||
if( mDynamicPB == NULL )
|
||||
mDynamicPB = new GFXD3D11PrimitiveBuffer(this, 0, 0, GFXBufferTypeDynamic);
|
||||
|
||||
D3D11_BUFFER_DESC desc;
|
||||
desc.ByteWidth = sizeof(U16) * MAX_DYNAMIC_INDICES;
|
||||
desc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
desc.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
desc.MiscFlags = 0;
|
||||
desc.StructureByteStride = 0;
|
||||
D3D11_BUFFER_DESC desc;
|
||||
desc.ByteWidth = sizeof(U16) * MAX_DYNAMIC_INDICES;
|
||||
desc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
desc.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
desc.MiscFlags = 0;
|
||||
desc.StructureByteStride = 0;
|
||||
|
||||
HRESULT hr = D3D11DEVICE->CreateBuffer(&desc, NULL, &mDynamicPB->ib);
|
||||
HRESULT hr = D3D11DEVICE->CreateBuffer(&desc, NULL, &mDynamicPB->ib);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "Failed to allocate dynamic IB");
|
||||
}
|
||||
if(FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "Failed to allocate dynamic IB");
|
||||
}
|
||||
|
||||
// Walk the resource list and zombify everything.
|
||||
GFXResource *walk = mResourceListHead;
|
||||
while(walk)
|
||||
{
|
||||
walk->resurrect();
|
||||
walk = walk->getNextResource();
|
||||
}
|
||||
// Walk the resource list and zombify everything.
|
||||
GFXResource *walk = mResourceListHead;
|
||||
while(walk)
|
||||
{
|
||||
walk->resurrect();
|
||||
walk = walk->getNextResource();
|
||||
}
|
||||
|
||||
if(mTextureManager)
|
||||
mTextureManager->resurrect();
|
||||
if(mTextureManager)
|
||||
mTextureManager->resurrect();
|
||||
}
|
||||
|
||||
GFXD3D11VertexBuffer* GFXD3D11Device::findVBPool( const GFXVertexFormat *vertexFormat, U32 vertsNeeded )
|
||||
|
|
@ -1011,40 +1014,40 @@ GFXD3D11VertexBuffer* GFXD3D11Device::findVBPool( const GFXVertexFormat *vertexF
|
|||
|
||||
GFXD3D11VertexBuffer * GFXD3D11Device::createVBPool( const GFXVertexFormat *vertexFormat, U32 vertSize )
|
||||
{
|
||||
PROFILE_SCOPE( GFXD3D11Device_createVBPool );
|
||||
PROFILE_SCOPE( GFXD3D11Device_createVBPool );
|
||||
|
||||
// this is a bit funky, but it will avoid problems with (lack of) copy constructors
|
||||
// with a push_back() situation
|
||||
mVolatileVBList.increment();
|
||||
StrongRefPtr<GFXD3D11VertexBuffer> newBuff;
|
||||
mVolatileVBList.last() = new GFXD3D11VertexBuffer();
|
||||
newBuff = mVolatileVBList.last();
|
||||
// this is a bit funky, but it will avoid problems with (lack of) copy constructors
|
||||
// with a push_back() situation
|
||||
mVolatileVBList.increment();
|
||||
StrongRefPtr<GFXD3D11VertexBuffer> newBuff;
|
||||
mVolatileVBList.last() = new GFXD3D11VertexBuffer();
|
||||
newBuff = mVolatileVBList.last();
|
||||
|
||||
newBuff->mNumVerts = 0;
|
||||
newBuff->mBufferType = GFXBufferTypeVolatile;
|
||||
newBuff->mVertexFormat.copy( *vertexFormat );
|
||||
newBuff->mVertexSize = vertSize;
|
||||
newBuff->mDevice = this;
|
||||
newBuff->mNumVerts = 0;
|
||||
newBuff->mBufferType = GFXBufferTypeVolatile;
|
||||
newBuff->mVertexFormat.copy( *vertexFormat );
|
||||
newBuff->mVertexSize = vertSize;
|
||||
newBuff->mDevice = this;
|
||||
|
||||
// Requesting it will allocate it.
|
||||
vertexFormat->getDecl();
|
||||
// Requesting it will allocate it.
|
||||
vertexFormat->getDecl();
|
||||
|
||||
D3D11_BUFFER_DESC desc;
|
||||
desc.ByteWidth = vertSize * MAX_DYNAMIC_VERTS;
|
||||
desc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
desc.MiscFlags = 0;
|
||||
desc.StructureByteStride = 0;
|
||||
D3D11_BUFFER_DESC desc;
|
||||
desc.ByteWidth = vertSize * MAX_DYNAMIC_VERTS;
|
||||
desc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
desc.MiscFlags = 0;
|
||||
desc.StructureByteStride = 0;
|
||||
|
||||
HRESULT hr = D3D11DEVICE->CreateBuffer(&desc, NULL, &newBuff->vb);
|
||||
HRESULT hr = D3D11DEVICE->CreateBuffer(&desc, NULL, &newBuff->vb);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "Failed to allocate dynamic VB");
|
||||
}
|
||||
if(FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "Failed to allocate dynamic VB");
|
||||
}
|
||||
|
||||
return newBuff;
|
||||
return newBuff;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -1100,30 +1103,30 @@ void GFXD3D11Device::setClipRect( const RectI &inRect )
|
|||
|
||||
void GFXD3D11Device::setVertexStream( U32 stream, GFXVertexBuffer *buffer )
|
||||
{
|
||||
GFXD3D11VertexBuffer *d3dBuffer = static_cast<GFXD3D11VertexBuffer*>( buffer );
|
||||
GFXD3D11VertexBuffer *d3dBuffer = static_cast<GFXD3D11VertexBuffer*>( buffer );
|
||||
|
||||
if ( stream == 0 )
|
||||
{
|
||||
// Set the volatile buffer which is used to
|
||||
// offset the start index when doing draw calls.
|
||||
if ( d3dBuffer && d3dBuffer->mVolatileStart > 0 )
|
||||
mVolatileVB = d3dBuffer;
|
||||
else
|
||||
mVolatileVB = NULL;
|
||||
}
|
||||
if ( stream == 0 )
|
||||
{
|
||||
// Set the volatile buffer which is used to
|
||||
// offset the start index when doing draw calls.
|
||||
if ( d3dBuffer && d3dBuffer->mVolatileStart > 0 )
|
||||
mVolatileVB = d3dBuffer;
|
||||
else
|
||||
mVolatileVB = NULL;
|
||||
}
|
||||
|
||||
// NOTE: We do not use the stream offset here for stream 0
|
||||
// as that feature is *supposedly* not as well supported as
|
||||
// using the start index in drawPrimitive.
|
||||
//
|
||||
// If we can verify that this is not the case then we should
|
||||
// start using this method exclusively for all streams.
|
||||
// NOTE: We do not use the stream offset here for stream 0
|
||||
// as that feature is *supposedly* not as well supported as
|
||||
// using the start index in drawPrimitive.
|
||||
//
|
||||
// If we can verify that this is not the case then we should
|
||||
// start using this method exclusively for all streams.
|
||||
|
||||
U32 strides[1] = { d3dBuffer ? d3dBuffer->mVertexSize : 0 };
|
||||
U32 offset = d3dBuffer && stream != 0 ? d3dBuffer->mVolatileStart * d3dBuffer->mVertexSize : 0;
|
||||
ID3D11Buffer* buff = d3dBuffer ? d3dBuffer->vb : NULL;
|
||||
U32 strides[1] = { d3dBuffer ? d3dBuffer->mVertexSize : 0 };
|
||||
U32 offset = d3dBuffer && stream != 0 ? d3dBuffer->mVolatileStart * d3dBuffer->mVertexSize : 0;
|
||||
ID3D11Buffer* buff = d3dBuffer ? d3dBuffer->vb : NULL;
|
||||
|
||||
getDeviceContext()->IASetVertexBuffers(stream, 1, &buff, strides, &offset);
|
||||
getDeviceContext()->IASetVertexBuffers(stream, 1, &buff, strides, &offset);
|
||||
}
|
||||
|
||||
void GFXD3D11Device::setVertexStreamFrequency( U32 stream, U32 frequency )
|
||||
|
|
@ -1176,7 +1179,7 @@ void GFXD3D11Device::drawPrimitive( GFXPrimitiveType primType, U32 vertexStart,
|
|||
setShaderConstBufferInternal(mCurrentShaderConstBuffer);
|
||||
|
||||
if ( mVolatileVB )
|
||||
vertexStart += mVolatileVB->mVolatileStart;
|
||||
vertexStart += mVolatileVB->mVolatileStart;
|
||||
|
||||
mD3DDeviceContext->IASetPrimitiveTopology(GFXD3D11PrimType[primType]);
|
||||
|
||||
|
|
@ -1240,23 +1243,23 @@ void GFXD3D11Device::setShader(GFXShader *shader, bool force)
|
|||
{
|
||||
if(shader)
|
||||
{
|
||||
GFXD3D11Shader *d3dShader = static_cast<GFXD3D11Shader*>(shader);
|
||||
GFXD3D11Shader *d3dShader = static_cast<GFXD3D11Shader*>(shader);
|
||||
|
||||
if (d3dShader->mPixShader != mLastPixShader || force)
|
||||
{
|
||||
mD3DDeviceContext->PSSetShader( d3dShader->mPixShader, NULL, 0);
|
||||
mLastPixShader = d3dShader->mPixShader;
|
||||
}
|
||||
{
|
||||
mD3DDeviceContext->PSSetShader( d3dShader->mPixShader, NULL, 0);
|
||||
mLastPixShader = d3dShader->mPixShader;
|
||||
}
|
||||
|
||||
if (d3dShader->mVertShader != mLastVertShader || force)
|
||||
{
|
||||
mD3DDeviceContext->VSSetShader( d3dShader->mVertShader, NULL, 0);
|
||||
mLastVertShader = d3dShader->mVertShader;
|
||||
}
|
||||
{
|
||||
mD3DDeviceContext->VSSetShader( d3dShader->mVertShader, NULL, 0);
|
||||
mLastVertShader = d3dShader->mVertShader;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setupGenericShaders();
|
||||
setupGenericShaders();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1283,7 +1286,7 @@ GFXPrimitiveBuffer * GFXD3D11Device::allocPrimitiveBuffer(U32 numIndices, U32 nu
|
|||
|
||||
case GFXBufferTypeDynamic:
|
||||
case GFXBufferTypeVolatile:
|
||||
usage = D3D11_USAGE_DYNAMIC;
|
||||
usage = D3D11_USAGE_DYNAMIC;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1301,24 +1304,24 @@ GFXPrimitiveBuffer * GFXD3D11Device::allocPrimitiveBuffer(U32 numIndices, U32 nu
|
|||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, get it as a seperate buffer...
|
||||
D3D11_BUFFER_DESC desc;
|
||||
desc.ByteWidth = sizeof(U16) * numIndices;
|
||||
desc.Usage = usage;
|
||||
if(bufferType == GFXBufferTypeDynamic)
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; // We never allow reading from a primitive buffer.
|
||||
else
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
||||
desc.MiscFlags = 0;
|
||||
desc.StructureByteStride = 0;
|
||||
// Otherwise, get it as a seperate buffer...
|
||||
D3D11_BUFFER_DESC desc;
|
||||
desc.ByteWidth = sizeof(U16) * numIndices;
|
||||
desc.Usage = usage;
|
||||
if(bufferType == GFXBufferTypeDynamic)
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; // We never allow reading from a primitive buffer.
|
||||
else
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
||||
desc.MiscFlags = 0;
|
||||
desc.StructureByteStride = 0;
|
||||
|
||||
HRESULT hr = D3D11DEVICE->CreateBuffer(&desc, NULL, &res->ib);
|
||||
HRESULT hr = D3D11DEVICE->CreateBuffer(&desc, NULL, &res->ib);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "Failed to allocate an index buffer.");
|
||||
}
|
||||
if(FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "Failed to allocate an index buffer.");
|
||||
}
|
||||
}
|
||||
|
||||
if (data)
|
||||
|
|
@ -1362,7 +1365,7 @@ GFXVertexBuffer * GFXD3D11Device::allocVertexBuffer(U32 numVerts, const GFXVerte
|
|||
|
||||
case GFXBufferTypeDynamic:
|
||||
case GFXBufferTypeVolatile:
|
||||
usage = D3D11_USAGE_DYNAMIC;
|
||||
usage = D3D11_USAGE_DYNAMIC;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1377,27 +1380,27 @@ GFXVertexBuffer * GFXD3D11Device::allocVertexBuffer(U32 numVerts, const GFXVerte
|
|||
}
|
||||
else
|
||||
{
|
||||
// Requesting it will allocate it.
|
||||
vertexFormat->getDecl(); //-ALEX disabled to postpone until after shader is actually set...
|
||||
// Requesting it will allocate it.
|
||||
vertexFormat->getDecl(); //-ALEX disabled to postpone until after shader is actually set...
|
||||
|
||||
// Get a new buffer...
|
||||
D3D11_BUFFER_DESC desc;
|
||||
desc.ByteWidth = vertSize * numVerts;
|
||||
desc.Usage = usage;
|
||||
desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||
if(bufferType == GFXBufferTypeDynamic)
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; // We never allow reading from a vertex buffer.
|
||||
else
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.MiscFlags = 0;
|
||||
desc.StructureByteStride = 0;
|
||||
// Get a new buffer...
|
||||
D3D11_BUFFER_DESC desc;
|
||||
desc.ByteWidth = vertSize * numVerts;
|
||||
desc.Usage = usage;
|
||||
desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||
if(bufferType == GFXBufferTypeDynamic)
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; // We never allow reading from a vertex buffer.
|
||||
else
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.MiscFlags = 0;
|
||||
desc.StructureByteStride = 0;
|
||||
|
||||
HRESULT hr = D3D11DEVICE->CreateBuffer(&desc, NULL, &res->vb);
|
||||
HRESULT hr = D3D11DEVICE->CreateBuffer(&desc, NULL, &res->vb);
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "Failed to allocate VB");
|
||||
}
|
||||
if(FAILED(hr))
|
||||
{
|
||||
AssertFatal(false, "Failed to allocate VB");
|
||||
}
|
||||
}
|
||||
|
||||
res->mNumVerts = numVerts;
|
||||
|
|
@ -1595,7 +1598,6 @@ GFXVertexDecl* GFXD3D11Device::allocVertexDecl( const GFXVertexFormat *vertexFor
|
|||
S32 elemIndex = 0;
|
||||
for (S32 i = 0; i < elemCount; i++, elemIndex++)
|
||||
{
|
||||
|
||||
const GFXVertexElement &element = vertexFormat->getElement(elemIndex);
|
||||
|
||||
stream = element.getStreamIndex();
|
||||
|
|
@ -1687,9 +1689,9 @@ void GFXD3D11Device::setTextureInternal( U32 textureUnit, const GFXTextureObject
|
|||
{
|
||||
if( texture == NULL )
|
||||
{
|
||||
ID3D11ShaderResourceView *pView = NULL;
|
||||
mD3DDeviceContext->PSSetShaderResources(textureUnit, 1, &pView);
|
||||
return;
|
||||
ID3D11ShaderResourceView *pView = NULL;
|
||||
mD3DDeviceContext->PSSetShaderResources(textureUnit, 1, &pView);
|
||||
return;
|
||||
}
|
||||
|
||||
GFXD3D11TextureObject *tex = (GFXD3D11TextureObject*)(texture);
|
||||
|
|
@ -1701,23 +1703,23 @@ GFXFence *GFXD3D11Device::createFence()
|
|||
// Figure out what fence type we should be making if we don't know
|
||||
if( mCreateFenceType == -1 )
|
||||
{
|
||||
D3D11_QUERY_DESC desc;
|
||||
desc.MiscFlags = 0;
|
||||
desc.Query = D3D11_QUERY_EVENT;
|
||||
D3D11_QUERY_DESC desc;
|
||||
desc.MiscFlags = 0;
|
||||
desc.Query = D3D11_QUERY_EVENT;
|
||||
|
||||
ID3D11Query *testQuery = NULL;
|
||||
ID3D11Query *testQuery = NULL;
|
||||
|
||||
HRESULT hRes = mD3DDevice->CreateQuery(&desc, &testQuery);
|
||||
HRESULT hRes = mD3DDevice->CreateQuery(&desc, &testQuery);
|
||||
|
||||
if(FAILED(hRes))
|
||||
{
|
||||
mCreateFenceType = true;
|
||||
}
|
||||
if(FAILED(hRes))
|
||||
{
|
||||
mCreateFenceType = true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
mCreateFenceType = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreateFenceType = false;
|
||||
}
|
||||
|
||||
SAFE_RELEASE(testQuery);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@
|
|||
|
||||
class PlatformWindow;
|
||||
class GFXD3D11ShaderConstBuffer;
|
||||
class OculusVRHMDDevice;
|
||||
class D3D11OculusTexture;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -53,6 +55,8 @@ class GFXD3D11Device : public GFXDevice
|
|||
friend class GFXD3D11TextureObject;
|
||||
friend class GFXD3D11TextureTarget;
|
||||
friend class GFXD3D11WindowTarget;
|
||||
friend class OculusVRHMDDevice;
|
||||
friend class D3D11OculusTexture;
|
||||
|
||||
virtual GFXFormat selectSupportedFormat(GFXTextureProfile *profile,
|
||||
const Vector<GFXFormat> &formats, bool texture, bool mustblend, bool mustfilter);
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ void GFXD3D11EnumTranslate::init()
|
|||
GFXD3D11TextureFormat[GFXFormatD24FS8] = DXGI_FORMAT_UNKNOWN;
|
||||
GFXD3D11TextureFormat[GFXFormatD16] = DXGI_FORMAT_D16_UNORM;
|
||||
GFXD3D11TextureFormat[GFXFormatR8G8B8A8_SRGB] = DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
|
||||
GFXD3D11TextureFormat[GFXFormatR8G8B8A8_LINEAR_FORCE] = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
GFXD3D11TextureFilter[GFXTextureFilterNone] = D3D11_FILTER_MIN_MAG_MIP_POINT;
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@ void GFXD3D11TextureTarget::attachTexture( RenderSlot slot, GFXTextureObject *te
|
|||
if( tex == GFXTextureTarget::sDefaultDepthStencil )
|
||||
{
|
||||
mTargets[slot] = D3D11->mDeviceDepthStencil;
|
||||
mTargetViews[slot] = D3D11->mDeviceDepthStencilView;
|
||||
mTargets[slot]->AddRef();
|
||||
mTargetViews[slot]->AddRef();
|
||||
mTargetViews[slot] = D3D11->mDeviceDepthStencilView;
|
||||
mTargets[slot]->AddRef();
|
||||
mTargetViews[slot]->AddRef();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -110,14 +110,14 @@ void GFXD3D11TextureTarget::attachTexture( RenderSlot slot, GFXTextureObject *te
|
|||
|
||||
// Grab the surface level.
|
||||
if( slot == DepthStencil )
|
||||
{
|
||||
{
|
||||
mTargets[slot] = d3dto->getSurface();
|
||||
if ( mTargets[slot] )
|
||||
mTargets[slot]->AddRef();
|
||||
|
||||
mTargetViews[slot] = d3dto->getDSView();
|
||||
if( mTargetViews[slot])
|
||||
mTargetViews[slot]->AddRef();
|
||||
mTargetViews[slot] = d3dto->getDSView();
|
||||
if( mTargetViews[slot])
|
||||
mTargetViews[slot]->AddRef();
|
||||
|
||||
}
|
||||
else
|
||||
|
|
@ -126,12 +126,12 @@ void GFXD3D11TextureTarget::attachTexture( RenderSlot slot, GFXTextureObject *te
|
|||
// if the surface that it needs to render to is different than the mip level
|
||||
// in the actual texture. This will happen with MSAA.
|
||||
if( d3dto->getSurface() == NULL )
|
||||
{
|
||||
{
|
||||
|
||||
mTargets[slot] = d3dto->get2DTex();
|
||||
mTargets[slot]->AddRef();
|
||||
mTargetViews[slot] = d3dto->getRTView();
|
||||
mTargetViews[slot]->AddRef();
|
||||
mTargets[slot] = d3dto->get2DTex();
|
||||
mTargets[slot]->AddRef();
|
||||
mTargetViews[slot] = d3dto->getRTView();
|
||||
mTargetViews[slot]->AddRef();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -163,6 +163,13 @@ void GFXD3D11TextureTarget::attachTexture( RenderSlot slot, GFXTextureObject *te
|
|||
mTargetSize = Point2I(sd.Width, sd.Height);
|
||||
|
||||
S32 format = sd.Format;
|
||||
|
||||
if (format == DXGI_FORMAT_R8G8B8A8_TYPELESS || format == DXGI_FORMAT_B8G8R8A8_TYPELESS)
|
||||
{
|
||||
mTargetFormat = GFXFormatR8G8B8A8;
|
||||
return;
|
||||
}
|
||||
|
||||
GFXREVERSE_LOOKUP( GFXD3D11TextureFormat, GFXFormat, format );
|
||||
mTargetFormat = (GFXFormat)format;
|
||||
}
|
||||
|
|
@ -276,7 +283,7 @@ void GFXD3D11TextureTarget::resolve()
|
|||
if (mResolveTargets[i])
|
||||
{
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
mTargets[i]->GetDesc(&desc);
|
||||
mTargets[i]->GetDesc(&desc);
|
||||
D3D11DEVICECONTEXT->CopySubresourceRegion(mResolveTargets[i]->get2DTex(), 0, 0, 0, 0, mTargets[i], 0, NULL);
|
||||
}
|
||||
}
|
||||
|
|
@ -400,10 +407,10 @@ void GFXD3D11WindowTarget::activate()
|
|||
|
||||
void GFXD3D11WindowTarget::resolveTo(GFXTextureObject *tex)
|
||||
{
|
||||
GFXDEBUGEVENT_SCOPE(GFXPCD3D11WindowTarget_resolveTo, ColorI::RED);
|
||||
GFXDEBUGEVENT_SCOPE(GFXPCD3D11WindowTarget_resolveTo, ColorI::RED);
|
||||
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
ID3D11Texture2D* surf = ((GFXD3D11TextureObject*)(tex))->get2DTex();
|
||||
surf->GetDesc(&desc);
|
||||
D3D11DEVICECONTEXT->ResolveSubresource(surf, 0, D3D11->mDeviceBackbuffer, 0, desc.Format);
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
ID3D11Texture2D* surf = ((GFXD3D11TextureObject*)(tex))->get2DTex();
|
||||
surf->GetDesc(&desc);
|
||||
D3D11DEVICECONTEXT->ResolveSubresource(surf, 0, D3D11->mDeviceBackbuffer, 0, desc.Format);
|
||||
}
|
||||
|
|
@ -180,8 +180,8 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp)
|
|||
// check format limitations
|
||||
// at the moment we only support RGBA for the source (other 4 byte formats should
|
||||
// be easy to add though)
|
||||
AssertFatal(mFormat == GFXFormatR8G8B8A8, "copyToBmp: invalid format");
|
||||
if (mFormat != GFXFormatR8G8B8A8)
|
||||
AssertFatal(mFormat == GFXFormatR8G8B8A8 || mFormat == GFXFormatR8G8B8A8_LINEAR_FORCE, "copyToBmp: invalid format");
|
||||
if (mFormat != GFXFormatR8G8B8A8 && mFormat != GFXFormatR8G8B8A8_LINEAR_FORCE)
|
||||
return false;
|
||||
|
||||
PROFILE_START(GFXD3D11TextureObject_copyToBmp);
|
||||
|
|
@ -197,7 +197,7 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp)
|
|||
const U32 sourceBytesPerPixel = 4;
|
||||
U32 destBytesPerPixel = 0;
|
||||
|
||||
if(bmp->getFormat() == GFXFormatR8G8B8A8)
|
||||
if (bmp->getFormat() == GFXFormatR8G8B8A8 || bmp->getFormat() == GFXFormatR8G8B8A8_LINEAR_FORCE)
|
||||
destBytesPerPixel = 4;
|
||||
else if(bmp->getFormat() == GFXFormatR8G8B8)
|
||||
destBytesPerPixel = 3;
|
||||
|
|
|
|||
|
|
@ -176,7 +176,6 @@ bool GFXD3D9ShaderBufferLayout::setMatrix(const ParamDesc& pd, const GFXShaderCo
|
|||
}
|
||||
else if (pd.constType == GFXSCT_Float4x3)
|
||||
{
|
||||
F32 buffer[4*4];
|
||||
const U32 csize = 48;
|
||||
|
||||
// Loop through and copy
|
||||
|
|
|
|||
|
|
@ -115,6 +115,8 @@ void GFXD3D9EnumTranslate::init()
|
|||
GFXD3D9TextureFormat[GFXFormatD24FS8] = D3DFMT_D24FS8;
|
||||
GFXD3D9TextureFormat[GFXFormatD16] = D3DFMT_D16;
|
||||
GFXD3D9TextureFormat[GFXFormatR8G8B8A8_SRGB] = D3DFMT_UNKNOWN;
|
||||
|
||||
GFXD3D9TextureFormat[GFXFormatR8G8B8A8_LINEAR_FORCE] = D3DFMT_A8R8G8B8;
|
||||
VALIDATE_LOOKUPTABLE( GFXD3D9TextureFormat, GFXFormat);
|
||||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@ void GBitmap::allocateBitmap(const U32 in_width, const U32 in_height, const bool
|
|||
break;
|
||||
case GFXFormatR8G8B8: mBytesPerPixel = 3;
|
||||
break;
|
||||
case GFXFormatR8G8B8A8_LINEAR_FORCE:
|
||||
case GFXFormatR8G8B8X8:
|
||||
case GFXFormatR8G8B8A8: mBytesPerPixel = 4;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -328,13 +328,14 @@ static bool _writePNG(GBitmap *bitmap, Stream &stream, U32 compressionLevel, U32
|
|||
format == GFXFormatR8G8B8A8 ||
|
||||
format == GFXFormatR8G8B8X8 ||
|
||||
format == GFXFormatA8 ||
|
||||
format == GFXFormatR5G6B5, "_writePNG: ONLY RGB bitmap writing supported at this time.");
|
||||
format == GFXFormatR5G6B5 ||
|
||||
format == GFXFormatR8G8B8A8_LINEAR_FORCE, "_writePNG: ONLY RGB bitmap writing supported at this time.");
|
||||
|
||||
if ( format != GFXFormatR8G8B8 &&
|
||||
format != GFXFormatR8G8B8A8 &&
|
||||
format != GFXFormatR8G8B8X8 &&
|
||||
format != GFXFormatA8 &&
|
||||
format != GFXFormatR5G6B5 )
|
||||
format != GFXFormatR5G6B5 && format != GFXFormatR8G8B8A8_LINEAR_FORCE)
|
||||
return false;
|
||||
|
||||
png_structp png_ptr = png_create_write_struct_2(PNG_LIBPNG_VER_STRING,
|
||||
|
|
@ -381,7 +382,7 @@ static bool _writePNG(GBitmap *bitmap, Stream &stream, U32 compressionLevel, U32
|
|||
NULL, // compression type
|
||||
NULL); // filter type
|
||||
}
|
||||
else if (format == GFXFormatR8G8B8A8 || format == GFXFormatR8G8B8X8)
|
||||
else if (format == GFXFormatR8G8B8A8 || format == GFXFormatR8G8B8X8 || format == GFXFormatR8G8B8A8_LINEAR_FORCE)
|
||||
{
|
||||
png_set_IHDR(png_ptr, info_ptr,
|
||||
width, height, // the width & height
|
||||
|
|
|
|||
|
|
@ -35,6 +35,12 @@
|
|||
#include "core/util/delegate.h"
|
||||
#endif
|
||||
|
||||
struct GFXAdapterLUID
|
||||
{
|
||||
unsigned long LowPart;
|
||||
long HighPart;
|
||||
};
|
||||
|
||||
struct GFXAdapter
|
||||
{
|
||||
public:
|
||||
|
|
@ -58,6 +64,9 @@ public:
|
|||
/// Supported shader model. 0.f means none supported.
|
||||
F32 mShaderModel;
|
||||
|
||||
/// LUID for windows oculus support
|
||||
GFXAdapterLUID mLUID;
|
||||
|
||||
const char * getName() const { return mName; }
|
||||
const char * getOutputName() const { return mOutputName; }
|
||||
GFXAdapterType mType;
|
||||
|
|
@ -72,6 +81,7 @@ public:
|
|||
mOutputName[0] = 0;
|
||||
mShaderModel = 0.f;
|
||||
mIndex = 0;
|
||||
dMemset(&mLUID, '\0', sizeof(mLUID));
|
||||
}
|
||||
|
||||
~GFXAdapter()
|
||||
|
|
|
|||
|
|
@ -232,3 +232,14 @@ DefineEngineStaticMethod( GFXCardProfilerAPI, queryProfile, S32, ( const char *n
|
|||
{
|
||||
return (S32)GFX->getCardProfiler()->queryProfile( name, (U32)defaultValue );
|
||||
}
|
||||
|
||||
|
||||
DefineEngineStaticMethod( GFXCardProfilerAPI, getBestDepthFormat, String, (),,
|
||||
"Returns the card name." )
|
||||
{
|
||||
if (GFX->getCardProfiler()->queryProfile("GL::Workaround::intel_mac_depth", false))
|
||||
return "GFXFormatD16";
|
||||
else
|
||||
return "GFXFormatD24S8";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,8 @@ GFXDevice::GFXDevice()
|
|||
// misc
|
||||
mAllowRender = true;
|
||||
mCurrentRenderStyle = RS_Standard;
|
||||
mCurrentProjectionOffset = Point2F::Zero;
|
||||
mCurrentStereoTarget = -1;
|
||||
mStereoHeadTransform = MatrixF(1);
|
||||
mCanCurrentlyRender = false;
|
||||
mInitialized = false;
|
||||
|
||||
|
|
@ -1320,7 +1321,7 @@ DefineEngineFunction( getBestHDRFormat, GFXFormat, (),,
|
|||
// Figure out the best HDR format. This is the smallest
|
||||
// format which supports blending and filtering.
|
||||
Vector<GFXFormat> formats;
|
||||
formats.push_back( GFXFormatR10G10B10A2 );
|
||||
//formats.push_back( GFXFormatR10G10B10A2 ); TODO: replace with SRGB format once DX9 is gone - BJR
|
||||
formats.push_back( GFXFormatR16G16B16A16F );
|
||||
formats.push_back( GFXFormatR16G16B16A16 );
|
||||
GFXFormat format = GFX->selectSupportedFormat( &GFXDefaultRenderTargetProfile,
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue