mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
Merge branch 'GarageGames/development' into ueberengine-dev
This commit is contained in:
commit
683a11e384
273 changed files with 4702 additions and 3631 deletions
|
|
@ -2,6 +2,8 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||||
|
|
||||||
set(TORQUE_APP_NAME "" CACHE STRING "the app name")
|
set(TORQUE_APP_NAME "" CACHE STRING "the app name")
|
||||||
|
|
||||||
|
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/temp" CACHE PATH "default install path" FORCE )
|
||||||
|
|
||||||
if("${TORQUE_APP_NAME}" STREQUAL "")
|
if("${TORQUE_APP_NAME}" STREQUAL "")
|
||||||
message(FATAL_ERROR "Please set TORQUE_APP_NAME first")
|
message(FATAL_ERROR "Please set TORQUE_APP_NAME first")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ void daeStringTable::clear()
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i=0;i<_stringBuffersList.getCount();i++)
|
for (i=0;i<_stringBuffersList.getCount();i++)
|
||||||
#if _MSC_VER <= 1200
|
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
|
||||||
delete [] (char *) _stringBuffersList[i];
|
delete [] (char *) _stringBuffersList[i];
|
||||||
#else
|
#else
|
||||||
delete [] _stringBuffersList[i];
|
delete [] _stringBuffersList[i];
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ NvSimpleTypes.h : Defines basic data types for integers and floats.
|
||||||
typedef float NxF32;
|
typedef float NxF32;
|
||||||
typedef double NxF64;
|
typedef double NxF64;
|
||||||
|
|
||||||
#elif LINUX
|
#elif defined(LINUX)
|
||||||
typedef long long NxI64;
|
typedef long long NxI64;
|
||||||
typedef signed int NxI32;
|
typedef signed int NxI32;
|
||||||
typedef signed short NxI16;
|
typedef signed short NxI16;
|
||||||
|
|
@ -101,7 +101,7 @@ NvSimpleTypes.h : Defines basic data types for integers and floats.
|
||||||
typedef float NxF32;
|
typedef float NxF32;
|
||||||
typedef double NxF64;
|
typedef double NxF64;
|
||||||
|
|
||||||
#elif __APPLE__
|
#elif defined(__APPLE__)
|
||||||
typedef long long NxI64;
|
typedef long long NxI64;
|
||||||
typedef signed int NxI32;
|
typedef signed int NxI32;
|
||||||
typedef signed short NxI16;
|
typedef signed short NxI16;
|
||||||
|
|
@ -115,7 +115,7 @@ NvSimpleTypes.h : Defines basic data types for integers and floats.
|
||||||
typedef float NxF32;
|
typedef float NxF32;
|
||||||
typedef double NxF64;
|
typedef double NxF64;
|
||||||
|
|
||||||
#elif __CELLOS_LV2__
|
#elif defined(__CELLOS_LV2__)
|
||||||
typedef long long NxI64;
|
typedef long long NxI64;
|
||||||
typedef signed int NxI32;
|
typedef signed int NxI32;
|
||||||
typedef signed short NxI16;
|
typedef signed short NxI16;
|
||||||
|
|
@ -129,7 +129,7 @@ NvSimpleTypes.h : Defines basic data types for integers and floats.
|
||||||
typedef float NxF32;
|
typedef float NxF32;
|
||||||
typedef double NxF64;
|
typedef double NxF64;
|
||||||
|
|
||||||
#elif _XBOX
|
#elif defined(_XBOX)
|
||||||
typedef __int64 NxI64;
|
typedef __int64 NxI64;
|
||||||
typedef signed int NxI32;
|
typedef signed int NxI32;
|
||||||
typedef signed short NxI16;
|
typedef signed short NxI16;
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@ void AIPlayer::setAimObject( GameBase *targetObject )
|
||||||
* @param targetObject The object to target
|
* @param targetObject The object to target
|
||||||
* @param offset The offest from the target location to aim at
|
* @param offset The offest from the target location to aim at
|
||||||
*/
|
*/
|
||||||
void AIPlayer::setAimObject( GameBase *targetObject, Point3F offset )
|
void AIPlayer::setAimObject(GameBase *targetObject, const Point3F& offset)
|
||||||
{
|
{
|
||||||
mAimObject = targetObject;
|
mAimObject = targetObject;
|
||||||
mTargetInLOS = false;
|
mTargetInLOS = false;
|
||||||
|
|
@ -725,24 +725,20 @@ bool AIPlayer::setPathDestination(const Point3F &pos)
|
||||||
|
|
||||||
// Create a new path.
|
// Create a new path.
|
||||||
NavPath *path = new NavPath();
|
NavPath *path = new NavPath();
|
||||||
if(path)
|
|
||||||
|
path->mMesh = getNavMesh();
|
||||||
|
path->mFrom = getPosition();
|
||||||
|
path->mTo = pos;
|
||||||
|
path->mFromSet = path->mToSet = true;
|
||||||
|
path->mAlwaysRender = true;
|
||||||
|
path->mLinkTypes = mLinkTypes;
|
||||||
|
path->mXray = true;
|
||||||
|
// Paths plan automatically upon being registered.
|
||||||
|
if(!path->registerObject())
|
||||||
{
|
{
|
||||||
path->mMesh = getNavMesh();
|
delete path;
|
||||||
path->mFrom = getPosition();
|
|
||||||
path->mTo = pos;
|
|
||||||
path->mFromSet = path->mToSet = true;
|
|
||||||
path->mAlwaysRender = true;
|
|
||||||
path->mLinkTypes = mLinkTypes;
|
|
||||||
path->mXray = true;
|
|
||||||
// Paths plan automatically upon being registered.
|
|
||||||
if(!path->registerObject())
|
|
||||||
{
|
|
||||||
delete path;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(path->success())
|
if(path->success())
|
||||||
{
|
{
|
||||||
|
|
@ -831,11 +827,15 @@ void AIPlayer::followObject(SceneObject *obj, F32 radius)
|
||||||
if(!isServerObject())
|
if(!isServerObject())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ((mFollowData.lastPos - obj->getPosition()).len()<mMoveTolerance)
|
||||||
|
return;
|
||||||
|
|
||||||
if(setPathDestination(obj->getPosition()))
|
if(setPathDestination(obj->getPosition()))
|
||||||
{
|
{
|
||||||
clearCover();
|
clearCover();
|
||||||
mFollowData.object = obj;
|
mFollowData.object = obj;
|
||||||
mFollowData.radius = radius;
|
mFollowData.radius = radius;
|
||||||
|
mFollowData.lastPos = obj->getPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,10 +122,12 @@ private:
|
||||||
SimObjectPtr<SceneObject> object;
|
SimObjectPtr<SceneObject> object;
|
||||||
/// Distance at whcih to follow.
|
/// Distance at whcih to follow.
|
||||||
F32 radius;
|
F32 radius;
|
||||||
|
Point3F lastPos;
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
FollowData() : object(NULL)
|
FollowData() : object(NULL)
|
||||||
{
|
{
|
||||||
radius = 5.0f;
|
radius = 5.0f;
|
||||||
|
lastPos = Point3F::Zero;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -161,7 +163,7 @@ public:
|
||||||
|
|
||||||
// Targeting and aiming sets/gets
|
// Targeting and aiming sets/gets
|
||||||
void setAimObject( GameBase *targetObject );
|
void setAimObject( GameBase *targetObject );
|
||||||
void setAimObject( GameBase *targetObject, Point3F offset );
|
void setAimObject(GameBase *targetObject, const Point3F& offset);
|
||||||
GameBase* getAimObject() const { return mAimObject; }
|
GameBase* getAimObject() const { return mAimObject; }
|
||||||
void setAimLocation( const Point3F &location );
|
void setAimLocation( const Point3F &location );
|
||||||
Point3F getAimLocation() const { return mAimLocation; }
|
Point3F getAimLocation() const { return mAimLocation; }
|
||||||
|
|
|
||||||
|
|
@ -279,6 +279,7 @@ Camera::Camera()
|
||||||
|
|
||||||
mLastAbsoluteYaw = 0.0f;
|
mLastAbsoluteYaw = 0.0f;
|
||||||
mLastAbsolutePitch = 0.0f;
|
mLastAbsolutePitch = 0.0f;
|
||||||
|
mLastAbsoluteRoll = 0.0f;
|
||||||
|
|
||||||
// For NewtonFlyMode
|
// For NewtonFlyMode
|
||||||
mNewtonRotation = false;
|
mNewtonRotation = false;
|
||||||
|
|
@ -379,6 +380,57 @@ void Camera::getCameraTransform(F32* pos, MatrixF* mat)
|
||||||
mat->mul( gCamFXMgr.getTrans() );
|
mat->mul( gCamFXMgr.getTrans() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Camera::getEyeCameraTransform(IDisplayDevice *displayDevice, U32 eyeId, MatrixF *outMat)
|
||||||
|
{
|
||||||
|
// The camera doesn't support a third person mode,
|
||||||
|
// so we want to override the default ShapeBase behavior.
|
||||||
|
ShapeBase * obj = dynamic_cast<ShapeBase*>(static_cast<SimObject*>(mOrbitObject));
|
||||||
|
if(obj && static_cast<ShapeBaseData*>(obj->getDataBlock())->observeThroughObject)
|
||||||
|
obj->getEyeCameraTransform(displayDevice, eyeId, outMat);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Parent::getEyeCameraTransform(displayDevice, eyeId, outMat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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()
|
F32 Camera::getCameraFov()
|
||||||
|
|
@ -547,6 +599,7 @@ void Camera::processTick(const Move* move)
|
||||||
|
|
||||||
mLastAbsoluteYaw = emove->rotZ[emoveIndex];
|
mLastAbsoluteYaw = emove->rotZ[emoveIndex];
|
||||||
mLastAbsolutePitch = emove->rotX[emoveIndex];
|
mLastAbsolutePitch = emove->rotX[emoveIndex];
|
||||||
|
mLastAbsoluteRoll = emove->rotY[emoveIndex];
|
||||||
|
|
||||||
// Bank
|
// Bank
|
||||||
mRot.y = emove->rotY[emoveIndex];
|
mRot.y = emove->rotY[emoveIndex];
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,7 @@ class Camera: public ShapeBase
|
||||||
|
|
||||||
F32 mLastAbsoluteYaw; ///< Stores that last absolute yaw value as passed in by ExtendedMove
|
F32 mLastAbsoluteYaw; ///< Stores that last absolute yaw value as passed in by ExtendedMove
|
||||||
F32 mLastAbsolutePitch; ///< Stores that last absolute pitch value as passed in by ExtendedMove
|
F32 mLastAbsolutePitch; ///< Stores that last absolute pitch value as passed in by ExtendedMove
|
||||||
|
F32 mLastAbsoluteRoll; ///< Stores that last absolute roll value as passed in by ExtendedMove
|
||||||
|
|
||||||
/// @name NewtonFlyMode
|
/// @name NewtonFlyMode
|
||||||
/// @{
|
/// @{
|
||||||
|
|
@ -235,6 +236,8 @@ class Camera: public ShapeBase
|
||||||
virtual void processTick( const Move* move );
|
virtual void processTick( const Move* move );
|
||||||
virtual void interpolateTick( F32 delta);
|
virtual void interpolateTick( F32 delta);
|
||||||
virtual void getCameraTransform( F32* pos,MatrixF* mat );
|
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 writePacketData( GameConnection* conn, BitStream* stream );
|
||||||
virtual void readPacketData( GameConnection* conn, BitStream* stream );
|
virtual void readPacketData( GameConnection* conn, BitStream* stream );
|
||||||
|
|
|
||||||
|
|
@ -113,9 +113,11 @@ void GuiClockHud::initPersistFields()
|
||||||
|
|
||||||
void GuiClockHud::onRender(Point2I offset, const RectI &updateRect)
|
void GuiClockHud::onRender(Point2I offset, const RectI &updateRect)
|
||||||
{
|
{
|
||||||
|
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||||
|
|
||||||
// Background first
|
// Background first
|
||||||
if (mShowFill)
|
if (mShowFill)
|
||||||
GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor);
|
drawUtil->drawRectFill(updateRect, mFillColor);
|
||||||
|
|
||||||
// Convert ms time into hours, minutes and seconds.
|
// Convert ms time into hours, minutes and seconds.
|
||||||
S32 time = S32(getTime());
|
S32 time = S32(getTime());
|
||||||
|
|
@ -129,13 +131,13 @@ void GuiClockHud::onRender(Point2I offset, const RectI &updateRect)
|
||||||
// Center the text
|
// Center the text
|
||||||
offset.x += (getWidth() - mProfile->mFont->getStrWidth((const UTF8 *)buf)) / 2;
|
offset.x += (getWidth() - mProfile->mFont->getStrWidth((const UTF8 *)buf)) / 2;
|
||||||
offset.y += (getHeight() - mProfile->mFont->getHeight()) / 2;
|
offset.y += (getHeight() - mProfile->mFont->getHeight()) / 2;
|
||||||
GFX->getDrawUtil()->setBitmapModulation(mTextColor);
|
drawUtil->setBitmapModulation(mTextColor);
|
||||||
GFX->getDrawUtil()->drawText(mProfile->mFont, offset, buf);
|
drawUtil->drawText(mProfile->mFont, offset, buf);
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
|
|
||||||
// Border last
|
// Border last
|
||||||
if (mShowFrame)
|
if (mShowFrame)
|
||||||
GFX->getDrawUtil()->drawRect(updateRect, mFrameColor);
|
drawUtil->drawRect(updateRect, mFrameColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,9 +163,11 @@ void GuiHealthTextHud::onRender(Point2I offset, const RectI &updateRect)
|
||||||
mValue = 100 - (100 * control->getDamageValue());
|
mValue = 100 - (100 * control->getDamageValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||||
|
|
||||||
// If enabled draw background first
|
// If enabled draw background first
|
||||||
if (mShowFill)
|
if (mShowFill)
|
||||||
GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor);
|
drawUtil->drawRectFill(updateRect, mFillColor);
|
||||||
|
|
||||||
// Prepare text and center it
|
// Prepare text and center it
|
||||||
S32 val = (S32)mValue;
|
S32 val = (S32)mValue;
|
||||||
|
|
@ -190,11 +192,11 @@ void GuiHealthTextHud::onRender(Point2I offset, const RectI &updateRect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GFX->getDrawUtil()->setBitmapModulation(tColor);
|
drawUtil->setBitmapModulation(tColor);
|
||||||
GFX->getDrawUtil()->drawText(mProfile->mFont, offset, buf);
|
drawUtil->drawText(mProfile->mFont, offset, buf);
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
|
|
||||||
// If enabled draw the border last
|
// If enabled draw the border last
|
||||||
if (mShowFrame)
|
if (mShowFrame)
|
||||||
GFX->getDrawUtil()->drawRect(updateRect, mFrameColor);
|
drawUtil->drawRect(updateRect, mFrameColor);
|
||||||
}
|
}
|
||||||
|
|
@ -196,7 +196,7 @@ void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
|
||||||
|
|
||||||
// Collision info. We're going to be running LOS tests and we
|
// Collision info. We're going to be running LOS tests and we
|
||||||
// don't want to collide with the control object.
|
// don't want to collide with the control object.
|
||||||
static U32 losMask = TerrainObjectType | ShapeBaseObjectType;
|
static U32 losMask = TerrainObjectType | ShapeBaseObjectType | StaticObjectType;
|
||||||
control->disableCollision();
|
control->disableCollision();
|
||||||
|
|
||||||
// All ghosted objects are added to the server connection group,
|
// All ghosted objects are added to the server connection group,
|
||||||
|
|
@ -301,18 +301,20 @@ void GuiShapeNameHud::drawName(Point2I offset, const char *name, F32 opacity)
|
||||||
offset.x -= width / 2;
|
offset.x -= width / 2;
|
||||||
offset.y -= height / 2;
|
offset.y -= height / 2;
|
||||||
|
|
||||||
|
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||||
|
|
||||||
// Background fill first
|
// Background fill first
|
||||||
if (mShowLabelFill)
|
if (mShowLabelFill)
|
||||||
GFX->getDrawUtil()->drawRectFill(RectI(offset, extent), mLabelFillColor);
|
drawUtil->drawRectFill(RectI(offset, extent), mLabelFillColor);
|
||||||
|
|
||||||
// Deal with opacity and draw.
|
// Deal with opacity and draw.
|
||||||
mTextColor.alpha = opacity;
|
mTextColor.alpha = opacity;
|
||||||
GFX->getDrawUtil()->setBitmapModulation(mTextColor);
|
drawUtil->setBitmapModulation(mTextColor);
|
||||||
GFX->getDrawUtil()->drawText(mProfile->mFont, offset + mLabelPadding, name);
|
drawUtil->drawText(mProfile->mFont, offset + mLabelPadding, name);
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
|
|
||||||
// Border last
|
// Border last
|
||||||
if (mShowLabelFrame)
|
if (mShowLabelFrame)
|
||||||
GFX->getDrawUtil()->drawRect(RectI(offset, extent), mLabelFrameColor);
|
drawUtil->drawRect(RectI(offset, extent), mLabelFrameColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ fxFoliageCulledList::fxFoliageCulledList(Box3F SearchBox, fxFoliageCulledList* I
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void fxFoliageCulledList::FindCandidates(Box3F SearchBox, fxFoliageCulledList* InVec)
|
void fxFoliageCulledList::FindCandidates(const Box3F& SearchBox, fxFoliageCulledList* InVec)
|
||||||
{
|
{
|
||||||
// Search the Culled List.
|
// Search the Culled List.
|
||||||
for (U32 i = 0; i < InVec->GetListCount(); i++)
|
for (U32 i = 0; i < InVec->GetListCount(); i++)
|
||||||
|
|
@ -1028,7 +1028,7 @@ void fxFoliageReplicator::SetupBuffers()
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
Box3F fxFoliageReplicator::FetchQuadrant(Box3F Box, U32 Quadrant)
|
Box3F fxFoliageReplicator::FetchQuadrant(const Box3F& Box, U32 Quadrant)
|
||||||
{
|
{
|
||||||
Box3F QuadrantBox;
|
Box3F QuadrantBox;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ public:
|
||||||
fxFoliageCulledList(Box3F SearchBox, fxFoliageCulledList* InVec);
|
fxFoliageCulledList(Box3F SearchBox, fxFoliageCulledList* InVec);
|
||||||
~fxFoliageCulledList() {};
|
~fxFoliageCulledList() {};
|
||||||
|
|
||||||
void FindCandidates(Box3F SearchBox, fxFoliageCulledList* InVec);
|
void FindCandidates(const Box3F& SearchBox, fxFoliageCulledList* InVec);
|
||||||
|
|
||||||
U32 GetListCount(void) { return mCulledObjectSet.size(); };
|
U32 GetListCount(void) { return mCulledObjectSet.size(); };
|
||||||
fxFoliageItem* GetElement(U32 index) { return mCulledObjectSet[index]; };
|
fxFoliageItem* GetElement(U32 index) { return mCulledObjectSet[index]; };
|
||||||
|
|
@ -157,7 +157,7 @@ protected:
|
||||||
|
|
||||||
void SyncFoliageReplicators(void);
|
void SyncFoliageReplicators(void);
|
||||||
|
|
||||||
Box3F FetchQuadrant(Box3F Box, U32 Quadrant);
|
Box3F FetchQuadrant(const Box3F& Box, U32 Quadrant);
|
||||||
void ProcessQuadrant(fxFoliageQuadrantNode* pParentNode, fxFoliageCulledList* pCullList, U32 Quadrant);
|
void ProcessQuadrant(fxFoliageQuadrantNode* pParentNode, fxFoliageCulledList* pCullList, U32 Quadrant);
|
||||||
void ProcessNodeChildren(fxFoliageQuadrantNode* pParentNode, fxFoliageCulledList* pCullList);
|
void ProcessNodeChildren(fxFoliageQuadrantNode* pParentNode, fxFoliageCulledList* pCullList);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1293,7 +1293,7 @@ void Precipitation::interpolateTick(F32 delta)
|
||||||
void Precipitation::processTick(const Move *)
|
void Precipitation::processTick(const Move *)
|
||||||
{
|
{
|
||||||
//nothing to do on the server
|
//nothing to do on the server
|
||||||
if (isServerObject() || mDataBlock == NULL)
|
if (isServerObject() || mDataBlock == NULL || isHidden())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const U32 currTime = Platform::getVirtualMilliseconds();
|
const U32 currTime = Platform::getVirtualMilliseconds();
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,9 @@
|
||||||
#include "scene/sceneManager.h"
|
#include "scene/sceneManager.h"
|
||||||
#define __SCENEMANAGER_H__
|
#define __SCENEMANAGER_H__
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _IDISPLAYDEVICE_H_
|
||||||
|
#include "platform/output/IDisplayDevice.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class NetConnection;
|
class NetConnection;
|
||||||
class ProcessList;
|
class ProcessList;
|
||||||
|
|
@ -418,6 +421,7 @@ public:
|
||||||
|
|
||||||
// Not implemented here, but should return the Camera to world transformation matrix
|
// Not implemented here, but should return the Camera to world transformation matrix
|
||||||
virtual void getCameraTransform (F32 *pos, MatrixF *mat ) { *mat = MatrixF::Identity; }
|
virtual void getCameraTransform (F32 *pos, MatrixF *mat ) { *mat = MatrixF::Identity; }
|
||||||
|
virtual void getEyeCameraTransform ( IDisplayDevice *device, U32 eyeId, MatrixF *mat ) { *mat = MatrixF::Identity; }
|
||||||
|
|
||||||
/// Returns the water object we are colliding with, it is up to derived
|
/// Returns the water object we are colliding with, it is up to derived
|
||||||
/// classes to actually set this object.
|
/// classes to actually set this object.
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,7 @@ GameConnection::GameConnection()
|
||||||
|
|
||||||
GameConnection::~GameConnection()
|
GameConnection::~GameConnection()
|
||||||
{
|
{
|
||||||
|
setDisplayDevice(NULL);
|
||||||
delete mAuthInfo;
|
delete mAuthInfo;
|
||||||
for(U32 i = 0; i < mConnectArgc; i++)
|
for(U32 i = 0; i < mConnectArgc; i++)
|
||||||
dFree(mConnectArgv[i]);
|
dFree(mConnectArgv[i]);
|
||||||
|
|
@ -673,6 +674,30 @@ bool GameConnection::getControlCameraTransform(F32 dt, MatrixF* mat)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GameConnection::getControlCameraEyeTransforms(IDisplayDevice *display, MatrixF *transforms)
|
||||||
|
{
|
||||||
|
GameBase* obj = getCameraObject();
|
||||||
|
if(!obj)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
GameBase* cObj = obj;
|
||||||
|
while((cObj = cObj->getControlObject()) != 0)
|
||||||
|
{
|
||||||
|
if(cObj->useObjsEyePoint())
|
||||||
|
obj = cObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform operation on left & right eyes. For each we need to calculate the world space
|
||||||
|
// of the rotated eye offset and add that onto the camera world space.
|
||||||
|
for (U32 i=0; i<2; i++)
|
||||||
|
{
|
||||||
|
obj->getEyeCameraTransform(display, i, &transforms[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GameConnection::getControlCameraDefaultFov(F32 * fov)
|
bool GameConnection::getControlCameraDefaultFov(F32 * fov)
|
||||||
{
|
{
|
||||||
//find the last control object in the chain (client->player->turret->whatever...)
|
//find the last control object in the chain (client->player->turret->whatever...)
|
||||||
|
|
@ -999,8 +1024,10 @@ bool GameConnection::readDemoStartBlock(BitStream *stream)
|
||||||
|
|
||||||
void GameConnection::demoPlaybackComplete()
|
void GameConnection::demoPlaybackComplete()
|
||||||
{
|
{
|
||||||
static ConsoleValueRef demoPlaybackArgv[1] = { "demoPlaybackComplete" };
|
static const char* demoPlaybackArgv[1] = { "demoPlaybackComplete" };
|
||||||
Sim::postCurrentEvent(Sim::getRootGroup(), new SimConsoleEvent(1, demoPlaybackArgv, false));
|
static StringStackConsoleWrapper demoPlaybackCmd(1, demoPlaybackArgv);
|
||||||
|
|
||||||
|
Sim::postCurrentEvent(Sim::getRootGroup(), new SimConsoleEvent(demoPlaybackCmd.argc, demoPlaybackCmd.argv, false));
|
||||||
Parent::demoPlaybackComplete();
|
Parent::demoPlaybackComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -269,6 +269,10 @@ public:
|
||||||
bool getControlCameraTransform(F32 dt,MatrixF* mat);
|
bool getControlCameraTransform(F32 dt,MatrixF* mat);
|
||||||
bool getControlCameraVelocity(Point3F *vel);
|
bool getControlCameraVelocity(Point3F *vel);
|
||||||
|
|
||||||
|
/// Returns the eye transforms for the control object, using supplemental information
|
||||||
|
/// from the provided IDisplayDevice.
|
||||||
|
bool getControlCameraEyeTransforms(IDisplayDevice *display, MatrixF *transforms);
|
||||||
|
|
||||||
bool getControlCameraDefaultFov(F32 *fov);
|
bool getControlCameraDefaultFov(F32 *fov);
|
||||||
bool getControlCameraFov(F32 *fov);
|
bool getControlCameraFov(F32 *fov);
|
||||||
bool setControlCameraFov(F32 fov);
|
bool setControlCameraFov(F32 fov);
|
||||||
|
|
@ -280,8 +284,8 @@ public:
|
||||||
void setFirstPerson(bool firstPerson);
|
void setFirstPerson(bool firstPerson);
|
||||||
|
|
||||||
bool hasDisplayDevice() const { return mDisplayDevice != NULL; }
|
bool hasDisplayDevice() const { return mDisplayDevice != NULL; }
|
||||||
const IDisplayDevice* getDisplayDevice() const { return mDisplayDevice; }
|
IDisplayDevice* getDisplayDevice() const { return mDisplayDevice; }
|
||||||
void setDisplayDevice(IDisplayDevice* display) { mDisplayDevice = display; }
|
void setDisplayDevice(IDisplayDevice* display) { if (mDisplayDevice) mDisplayDevice->setDrawCanvas(NULL); mDisplayDevice = display; }
|
||||||
void clearDisplayDevice() { mDisplayDevice = NULL; }
|
void clearDisplayDevice() { mDisplayDevice = NULL; }
|
||||||
|
|
||||||
void setControlSchemeParameters(bool absoluteRotation, bool addYawToAbsRot, bool addPitchToAbsRot);
|
void setControlSchemeParameters(bool absoluteRotation, bool addYawToAbsRot, bool addPitchToAbsRot);
|
||||||
|
|
|
||||||
|
|
@ -349,7 +349,12 @@ bool GameProcessCameraQuery(CameraQuery *query)
|
||||||
|
|
||||||
// Provide some default values
|
// Provide some default values
|
||||||
query->projectionOffset = Point2F::Zero;
|
query->projectionOffset = Point2F::Zero;
|
||||||
query->eyeOffset = Point3F::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;
|
||||||
|
|
||||||
F32 cameraFov = 0.0f;
|
F32 cameraFov = 0.0f;
|
||||||
bool fovSet = false;
|
bool fovSet = false;
|
||||||
|
|
@ -358,14 +363,14 @@ bool GameProcessCameraQuery(CameraQuery *query)
|
||||||
// is not open
|
// is not open
|
||||||
if(!gEditingMission && connection->hasDisplayDevice())
|
if(!gEditingMission && connection->hasDisplayDevice())
|
||||||
{
|
{
|
||||||
const IDisplayDevice* display = connection->getDisplayDevice();
|
IDisplayDevice* display = connection->getDisplayDevice();
|
||||||
|
// Note: all eye values are invalid until this is called
|
||||||
|
display->setDrawCanvas(query->drawCanvas);
|
||||||
|
|
||||||
// The connection's display device may want to set the FOV
|
display->setCurrentConnection(connection);
|
||||||
if(display->providesYFOV())
|
|
||||||
{
|
// Display may activate AFTER so we need to call this again just in case
|
||||||
cameraFov = mRadToDeg(display->getYFOV());
|
display->onStartFrame();
|
||||||
fovSet = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The connection's display device may want to set the projection offset
|
// The connection's display device may want to set the projection offset
|
||||||
if(display->providesProjectionOffset())
|
if(display->providesProjectionOffset())
|
||||||
|
|
@ -374,14 +379,34 @@ bool GameProcessCameraQuery(CameraQuery *query)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The connection's display device may want to set the eye offset
|
// The connection's display device may want to set the eye offset
|
||||||
if(display->providesEyeOffset())
|
if(display->providesEyeOffsets())
|
||||||
{
|
{
|
||||||
query->eyeOffset = display->getEyeOffset();
|
display->getEyeOffsets(query->eyeOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Grab field of view for both eyes
|
||||||
|
if (display->providesFovPorts())
|
||||||
|
{
|
||||||
|
display->getFovPorts(query->fovPort);
|
||||||
|
fovSet = true;
|
||||||
|
query->hasFovPort = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grab the latest overriding render view transforms
|
||||||
|
connection->getControlCameraEyeTransforms(display, query->eyeTransforms);
|
||||||
|
|
||||||
|
display->getStereoViewports(query->stereoViewports);
|
||||||
|
display->getStereoTargets(query->stereoTargets);
|
||||||
|
query->hasStereoTargets = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
query->eyeTransforms[0] = query->cameraMatrix;
|
||||||
|
query->eyeTransforms[1] = query->cameraMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the connection's FOV settings if requried
|
// Use the connection's FOV settings if requried
|
||||||
if(!fovSet && !connection->getControlCameraFov(&cameraFov))
|
if(!connection->getControlCameraFov(&cameraFov))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,6 @@ bool GameTSCtrl::onAdd()
|
||||||
if ( !Parent::onAdd() )
|
if ( !Parent::onAdd() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_WATERMARK
|
|
||||||
mWatermark.init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,10 +168,6 @@ void GameTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
|
|
||||||
if(!skipRender || true)
|
if(!skipRender || true)
|
||||||
Parent::onRender(offset, updateRect);
|
Parent::onRender(offset, updateRect);
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_WATERMARK
|
|
||||||
mWatermark.render(getExtent());
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,6 @@
|
||||||
#include "gui/3d/guiTSControl.h"
|
#include "gui/3d/guiTSControl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_WATERMARK
|
|
||||||
#ifndef _WATERMARK_H_
|
|
||||||
#include "demo/watermark/watermark.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class ProjectileData;
|
class ProjectileData;
|
||||||
class GameBase;
|
class GameBase;
|
||||||
|
|
||||||
|
|
@ -45,10 +39,6 @@ class GameTSCtrl : public GuiTSCtrl
|
||||||
private:
|
private:
|
||||||
typedef GuiTSCtrl Parent;
|
typedef GuiTSCtrl Parent;
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_WATERMARK
|
|
||||||
Watermark mWatermark;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void makeScriptCall(const char *func, const GuiEvent &evt) const;
|
void makeScriptCall(const char *func, const GuiEvent &evt) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -291,7 +291,8 @@ bool BtPlayer::_sweep( btVector3 *inOutCurrPos, const btVector3 &disp, Collision
|
||||||
callback.m_collisionFilterGroup = mGhostObject->getBroadphaseHandle()->m_collisionFilterGroup;
|
callback.m_collisionFilterGroup = mGhostObject->getBroadphaseHandle()->m_collisionFilterGroup;
|
||||||
callback.m_collisionFilterMask = mGhostObject->getBroadphaseHandle()->m_collisionFilterMask;
|
callback.m_collisionFilterMask = mGhostObject->getBroadphaseHandle()->m_collisionFilterMask;
|
||||||
|
|
||||||
mGhostObject->convexSweepTest( mColShape, start, end, callback, 0.0f );
|
if (disp.length()>0.0001)
|
||||||
|
mGhostObject->convexSweepTest( mColShape, start, end, callback, 0.0f );
|
||||||
|
|
||||||
inOutCurrPos->setInterpolate3( start.getOrigin(), end.getOrigin(), callback.m_closestHitFraction );
|
inOutCurrPos->setInterpolate3( start.getOrigin(), end.getOrigin(), callback.m_closestHitFraction );
|
||||||
if ( callback.hasHit() )
|
if ( callback.hasHit() )
|
||||||
|
|
@ -434,9 +435,8 @@ void BtPlayer::findContact( SceneObject **contactObject,
|
||||||
if ( other == mGhostObject )
|
if ( other == mGhostObject )
|
||||||
other = (btCollisionObject*)pair.m_pProxy1->m_clientObject;
|
other = (btCollisionObject*)pair.m_pProxy1->m_clientObject;
|
||||||
|
|
||||||
AssertFatal( !outOverlapObjects->contains( PhysicsUserData::getObject( other->getUserPointer() ) ),
|
if (!outOverlapObjects->contains(PhysicsUserData::getObject(other->getUserPointer())))
|
||||||
"Got multiple pairs of the same object!" );
|
outOverlapObjects->push_back( PhysicsUserData::getObject( other->getUserPointer() ) );
|
||||||
outOverlapObjects->push_back( PhysicsUserData::getObject( other->getUserPointer() ) );
|
|
||||||
|
|
||||||
if ( other->getCollisionFlags() & btCollisionObject::CF_NO_CONTACT_RESPONSE )
|
if ( other->getCollisionFlags() & btCollisionObject::CF_NO_CONTACT_RESPONSE )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -1650,6 +1650,7 @@ Player::Player()
|
||||||
|
|
||||||
mLastAbsoluteYaw = 0.0f;
|
mLastAbsoluteYaw = 0.0f;
|
||||||
mLastAbsolutePitch = 0.0f;
|
mLastAbsolutePitch = 0.0f;
|
||||||
|
mLastAbsoluteRoll = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player::~Player()
|
Player::~Player()
|
||||||
|
|
@ -2608,6 +2609,7 @@ void Player::updateMove(const Move* move)
|
||||||
}
|
}
|
||||||
mLastAbsoluteYaw = emove->rotZ[emoveIndex];
|
mLastAbsoluteYaw = emove->rotZ[emoveIndex];
|
||||||
mLastAbsolutePitch = emove->rotX[emoveIndex];
|
mLastAbsolutePitch = emove->rotX[emoveIndex];
|
||||||
|
mLastAbsoluteRoll = emove->rotY[emoveIndex];
|
||||||
|
|
||||||
// Head bank
|
// Head bank
|
||||||
mHead.y = emove->rotY[emoveIndex];
|
mHead.y = emove->rotY[emoveIndex];
|
||||||
|
|
@ -5584,6 +5586,57 @@ void Player::getMuzzleTransform(U32 imageSlot,MatrixF* mat)
|
||||||
*mat = nmat;
|
*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)
|
void Player::getRenderMuzzleTransform(U32 imageSlot,MatrixF* mat)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -439,6 +439,7 @@ protected:
|
||||||
|
|
||||||
F32 mLastAbsoluteYaw; ///< Stores that last absolute yaw value as passed in by ExtendedMove
|
F32 mLastAbsoluteYaw; ///< Stores that last absolute yaw value as passed in by ExtendedMove
|
||||||
F32 mLastAbsolutePitch; ///< Stores that last absolute pitch value as passed in by ExtendedMove
|
F32 mLastAbsolutePitch; ///< Stores that last absolute pitch value as passed in by ExtendedMove
|
||||||
|
F32 mLastAbsoluteRoll; ///< Stores that last absolute roll value as passed in by ExtendedMove
|
||||||
|
|
||||||
S32 mMountPending; ///< mMountPending suppresses tickDelay countdown so players will sit until
|
S32 mMountPending; ///< mMountPending suppresses tickDelay countdown so players will sit until
|
||||||
///< their mount, or another animation, comes through (or 13 seconds elapses).
|
///< their mount, or another animation, comes through (or 13 seconds elapses).
|
||||||
|
|
@ -683,6 +684,7 @@ public:
|
||||||
void getEyeBaseTransform(MatrixF* mat, bool includeBank);
|
void getEyeBaseTransform(MatrixF* mat, bool includeBank);
|
||||||
void getRenderEyeTransform(MatrixF* mat);
|
void getRenderEyeTransform(MatrixF* mat);
|
||||||
void getRenderEyeBaseTransform(MatrixF* mat, bool includeBank);
|
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 getCameraParameters(F32 *min, F32 *max, Point3F *offset, MatrixF *rot);
|
||||||
void getMuzzleTransform(U32 imageSlot,MatrixF* mat);
|
void getMuzzleTransform(U32 imageSlot,MatrixF* mat);
|
||||||
void getRenderMuzzleTransform(U32 imageSlot,MatrixF* mat);
|
void getRenderMuzzleTransform(U32 imageSlot,MatrixF* mat);
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@
|
||||||
#include "scene/sceneRenderState.h"
|
#include "scene/sceneRenderState.h"
|
||||||
#include "scene/sceneObjectLightingPlugin.h"
|
#include "scene/sceneObjectLightingPlugin.h"
|
||||||
#include "T3D/fx/explosion.h"
|
#include "T3D/fx/explosion.h"
|
||||||
#include "T3D/fx/particleEmitter.h"
|
|
||||||
#include "T3D/fx/cameraFXMgr.h"
|
#include "T3D/fx/cameraFXMgr.h"
|
||||||
#include "environment/waterBlock.h"
|
#include "environment/waterBlock.h"
|
||||||
#include "T3D/debris.h"
|
#include "T3D/debris.h"
|
||||||
|
|
@ -154,28 +153,8 @@ ShapeBaseData::ShapeBaseData()
|
||||||
shadowSphereAdjust( 1.0f ),
|
shadowSphereAdjust( 1.0f ),
|
||||||
shapeName( StringTable->insert("") ),
|
shapeName( StringTable->insert("") ),
|
||||||
cloakTexName( StringTable->insert("") ),
|
cloakTexName( StringTable->insert("") ),
|
||||||
mass( 1.0f ),
|
cubeDescId( 0 ),
|
||||||
drag( 0.0f ),
|
reflectorDesc( NULL ),
|
||||||
density( 1.0f ),
|
|
||||||
maxEnergy( 0.0f ),
|
|
||||||
maxDamage( 1.0f ),
|
|
||||||
disabledLevel( 1.0f ),
|
|
||||||
destroyedLevel( 1.0f ),
|
|
||||||
repairRate( 0.0033f ),
|
|
||||||
eyeNode( -1 ),
|
|
||||||
earNode( -1 ),
|
|
||||||
cameraNode( -1 ),
|
|
||||||
damageSequence( -1 ),
|
|
||||||
hulkSequence( -1 ),
|
|
||||||
cameraMaxDist( 0.0f ),
|
|
||||||
cameraMinDist( 0.2f ),
|
|
||||||
cameraDefaultFov( 75.0f ),
|
|
||||||
cameraMinFov( 5.0f ),
|
|
||||||
cameraMaxFov( 120.f ),
|
|
||||||
cameraCanBank( false ),
|
|
||||||
mountedImagesBank( false ),
|
|
||||||
isInvincible( false ),
|
|
||||||
renderWhenDestroyed( true ),
|
|
||||||
debris( NULL ),
|
debris( NULL ),
|
||||||
debrisID( 0 ),
|
debrisID( 0 ),
|
||||||
debrisShapeName( StringTable->insert("") ),
|
debrisShapeName( StringTable->insert("") ),
|
||||||
|
|
@ -183,15 +162,35 @@ ShapeBaseData::ShapeBaseData()
|
||||||
explosionID( 0 ),
|
explosionID( 0 ),
|
||||||
underwaterExplosion( NULL ),
|
underwaterExplosion( NULL ),
|
||||||
underwaterExplosionID( 0 ),
|
underwaterExplosionID( 0 ),
|
||||||
|
mass( 1.0f ),
|
||||||
|
drag( 0.0f ),
|
||||||
|
density( 1.0f ),
|
||||||
|
maxEnergy( 0.0f ),
|
||||||
|
maxDamage( 1.0f ),
|
||||||
|
destroyedLevel( 1.0f ),
|
||||||
|
disabledLevel( 1.0f ),
|
||||||
|
repairRate( 0.0033f ),
|
||||||
|
eyeNode( -1 ),
|
||||||
|
earNode( -1 ),
|
||||||
|
cameraNode( -1 ),
|
||||||
|
cameraMaxDist( 0.0f ),
|
||||||
|
cameraMinDist( 0.2f ),
|
||||||
|
cameraDefaultFov( 75.0f ),
|
||||||
|
cameraMinFov( 5.0f ),
|
||||||
|
cameraMaxFov( 120.f ),
|
||||||
|
cameraCanBank( false ),
|
||||||
|
mountedImagesBank( false ),
|
||||||
|
debrisDetail( -1 ),
|
||||||
|
damageSequence( -1 ),
|
||||||
|
hulkSequence( -1 ),
|
||||||
|
observeThroughObject( false ),
|
||||||
firstPersonOnly( false ),
|
firstPersonOnly( false ),
|
||||||
useEyePoint( false ),
|
useEyePoint( false ),
|
||||||
cubeDescId( 0 ),
|
isInvincible( false ),
|
||||||
reflectorDesc( NULL ),
|
renderWhenDestroyed( true ),
|
||||||
observeThroughObject( false ),
|
|
||||||
computeCRC( false ),
|
computeCRC( false ),
|
||||||
inheritEnergyFromMount( false ),
|
inheritEnergyFromMount( false ),
|
||||||
mCRC( 0 ),
|
mCRC( 0 )
|
||||||
debrisDetail( -1 )
|
|
||||||
{
|
{
|
||||||
dMemset( mountPointNode, -1, sizeof( S32 ) * SceneObject::NumMountPoints );
|
dMemset( mountPointNode, -1, sizeof( S32 ) * SceneObject::NumMountPoints );
|
||||||
}
|
}
|
||||||
|
|
@ -878,46 +877,46 @@ IMPLEMENT_CALLBACK( ShapeBase, validateCameraFov, F32, (F32 fov), (fov),
|
||||||
"@see ShapeBaseData\n\n");
|
"@see ShapeBaseData\n\n");
|
||||||
|
|
||||||
ShapeBase::ShapeBase()
|
ShapeBase::ShapeBase()
|
||||||
: mDrag( 0.0f ),
|
: mDataBlock( NULL ),
|
||||||
mBuoyancy( 0.0f ),
|
mIsAiControlled( false ),
|
||||||
mWaterCoverage( 0.0f ),
|
|
||||||
mLiquidHeight( 0.0f ),
|
|
||||||
mControllingObject( NULL ),
|
mControllingObject( NULL ),
|
||||||
mGravityMod( 1.0f ),
|
mMoveMotion( false ),
|
||||||
mAppliedForce( Point3F::Zero ),
|
mShapeBaseMount( NULL ),
|
||||||
mTimeoutList( NULL ),
|
|
||||||
mDataBlock( NULL ),
|
|
||||||
mShapeInstance( NULL ),
|
mShapeInstance( NULL ),
|
||||||
|
mConvexList( new Convex ),
|
||||||
mEnergy( 0.0f ),
|
mEnergy( 0.0f ),
|
||||||
mRechargeRate( 0.0f ),
|
mRechargeRate( 0.0f ),
|
||||||
|
mMass( 1.0f ),
|
||||||
|
mOneOverMass( 1.0f ),
|
||||||
|
mDrag( 0.0f ),
|
||||||
|
mBuoyancy( 0.0f ),
|
||||||
|
mLiquidHeight( 0.0f ),
|
||||||
|
mWaterCoverage( 0.0f ),
|
||||||
|
mAppliedForce( Point3F::Zero ),
|
||||||
|
mGravityMod( 1.0f ),
|
||||||
|
mDamageFlash( 0.0f ),
|
||||||
|
mWhiteOut( 0.0f ),
|
||||||
|
mFlipFadeVal( false ),
|
||||||
|
mTimeoutList( NULL ),
|
||||||
mDamage( 0.0f ),
|
mDamage( 0.0f ),
|
||||||
mRepairRate( 0.0f ),
|
mRepairRate( 0.0f ),
|
||||||
mRepairReserve( 0.0f ),
|
mRepairReserve( 0.0f ),
|
||||||
mDamageState( Enabled ),
|
mDamageState( Enabled ),
|
||||||
mDamageThread( NULL ),
|
mDamageThread( NULL ),
|
||||||
mHulkThread( NULL ),
|
mHulkThread( NULL ),
|
||||||
mLastRenderFrame( 0 ),
|
damageDir( 0.0f, 0.0f, 1.0f ),
|
||||||
mLastRenderDistance( 0.0f ),
|
|
||||||
mCloaked( false ),
|
mCloaked( false ),
|
||||||
mCloakLevel( 0.0f ),
|
mCloakLevel( 0.0f ),
|
||||||
mDamageFlash( 0.0f ),
|
|
||||||
mWhiteOut( 0.0f ),
|
|
||||||
mIsControlled( false ),
|
|
||||||
mConvexList( new Convex ),
|
|
||||||
mCameraFov( 90.0f ),
|
|
||||||
mFadeOut( true ),
|
mFadeOut( true ),
|
||||||
mFading( false ),
|
mFading( false ),
|
||||||
mFadeVal( 1.0f ),
|
mFadeVal( 1.0f ),
|
||||||
mFadeTime( 1.0f ),
|
|
||||||
mFadeElapsedTime( 0.0f ),
|
mFadeElapsedTime( 0.0f ),
|
||||||
|
mFadeTime( 1.0f ),
|
||||||
mFadeDelay( 0.0f ),
|
mFadeDelay( 0.0f ),
|
||||||
mFlipFadeVal( false ),
|
mCameraFov( 90.0f ),
|
||||||
damageDir( 0.0f, 0.0f, 1.0f ),
|
mIsControlled( false ),
|
||||||
mShapeBaseMount( NULL ),
|
mLastRenderFrame( 0 ),
|
||||||
mMass( 1.0f ),
|
mLastRenderDistance( 0.0f )
|
||||||
mOneOverMass( 1.0f ),
|
|
||||||
mMoveMotion( false ),
|
|
||||||
mIsAiControlled( false )
|
|
||||||
{
|
{
|
||||||
mTypeMask |= ShapeBaseObjectType | LightObjectType;
|
mTypeMask |= ShapeBaseObjectType | LightObjectType;
|
||||||
|
|
||||||
|
|
@ -1192,13 +1191,13 @@ void ShapeBase::onDeleteNotify( SimObject *obj )
|
||||||
Parent::onDeleteNotify( obj );
|
Parent::onDeleteNotify( obj );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShapeBase::onImpact(SceneObject* obj, VectorF vec)
|
void ShapeBase::onImpact(SceneObject* obj, const VectorF& vec)
|
||||||
{
|
{
|
||||||
if (!isGhost())
|
if (!isGhost())
|
||||||
mDataBlock->onImpact_callback( this, obj, vec, vec.len() );
|
mDataBlock->onImpact_callback( this, obj, vec, vec.len() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShapeBase::onImpact(VectorF vec)
|
void ShapeBase::onImpact(const VectorF& vec)
|
||||||
{
|
{
|
||||||
if (!isGhost())
|
if (!isGhost())
|
||||||
mDataBlock->onImpact_callback( this, NULL, vec, vec.len() );
|
mDataBlock->onImpact_callback( this, NULL, vec, vec.len() );
|
||||||
|
|
@ -1969,6 +1968,75 @@ void ShapeBase::getCameraTransform(F32* pos,MatrixF* mat)
|
||||||
mat->mul( gCamFXMgr.getTrans() );
|
mat->mul( gCamFXMgr.getTrans() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShapeBase::getEyeCameraTransform(IDisplayDevice *displayDevice, U32 eyeId, MatrixF *outMat)
|
||||||
|
{
|
||||||
|
MatrixF temp(1);
|
||||||
|
Point3F eyePos;
|
||||||
|
Point3F rotEyePos;
|
||||||
|
|
||||||
|
DisplayPose inPose;
|
||||||
|
displayDevice->getFrameEyePose(&inPose, eyeId);
|
||||||
|
DisplayPose newPose = calcCameraDeltaPose(displayDevice->getCurrentConnection(), inPose);
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
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));
|
||||||
|
|
||||||
|
*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;
|
||||||
|
}
|
||||||
|
|
||||||
void ShapeBase::getCameraParameters(F32 *min,F32* max,Point3F* off,MatrixF* rot)
|
void ShapeBase::getCameraParameters(F32 *min,F32* max,Point3F* off,MatrixF* rot)
|
||||||
{
|
{
|
||||||
*min = mDataBlock->cameraMinDist;
|
*min = mDataBlock->cameraMinDist;
|
||||||
|
|
@ -1977,7 +2045,6 @@ void ShapeBase::getCameraParameters(F32 *min,F32* max,Point3F* off,MatrixF* rot)
|
||||||
rot->identity();
|
rot->identity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
F32 ShapeBase::getDamageFlash() const
|
F32 ShapeBase::getDamageFlash() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,8 @@
|
||||||
#include "console/dynamicTypes.h"
|
#include "console/dynamicTypes.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Need full definition visible for SimObjectPtr<ParticleEmitter>
|
||||||
|
#include "T3D/fx/particleEmitter.h"
|
||||||
|
|
||||||
class GFXCubemap;
|
class GFXCubemap;
|
||||||
class TSShapeInstance;
|
class TSShapeInstance;
|
||||||
|
|
@ -70,8 +72,6 @@ class SceneRenderState;
|
||||||
class TSThread;
|
class TSThread;
|
||||||
class GameConnection;
|
class GameConnection;
|
||||||
struct CameraScopeQuery;
|
struct CameraScopeQuery;
|
||||||
class ParticleEmitter;
|
|
||||||
class ParticleEmitterData;
|
|
||||||
class ProjectileData;
|
class ProjectileData;
|
||||||
class ExplosionData;
|
class ExplosionData;
|
||||||
struct DebrisData;
|
struct DebrisData;
|
||||||
|
|
@ -1104,8 +1104,8 @@ protected:
|
||||||
virtual void shakeCamera( U32 imageSlot );
|
virtual void shakeCamera( U32 imageSlot );
|
||||||
virtual void updateDamageLevel();
|
virtual void updateDamageLevel();
|
||||||
virtual void updateDamageState();
|
virtual void updateDamageState();
|
||||||
virtual void onImpact(SceneObject* obj, VectorF vec);
|
virtual void onImpact(SceneObject* obj, const VectorF& vec);
|
||||||
virtual void onImpact(VectorF vec);
|
virtual void onImpact(const VectorF& vec);
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// The inner prep render function that does the
|
/// The inner prep render function that does the
|
||||||
|
|
@ -1583,6 +1583,13 @@ public:
|
||||||
/// @param mat Camera transform (out)
|
/// @param mat Camera transform (out)
|
||||||
virtual void getCameraTransform(F32* pos,MatrixF* mat);
|
virtual void getCameraTransform(F32* pos,MatrixF* mat);
|
||||||
|
|
||||||
|
/// Gets the view transform for a particular eye, taking into account the current absolute
|
||||||
|
/// 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
|
/// Gets the index of a node inside a mounted image given the name
|
||||||
/// @param imageSlot Image slot
|
/// @param imageSlot Image slot
|
||||||
/// @param nodeName Node name
|
/// @param nodeName Node name
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ TSStatic::TSStatic()
|
||||||
mPlayAmbient = true;
|
mPlayAmbient = true;
|
||||||
mAmbientThread = NULL;
|
mAmbientThread = NULL;
|
||||||
|
|
||||||
mAllowPlayerStep = true;
|
mAllowPlayerStep = false;
|
||||||
|
|
||||||
mConvexList = new Convex;
|
mConvexList = new Convex;
|
||||||
|
|
||||||
|
|
@ -1171,8 +1171,10 @@ DefineEngineMethod( TSStatic, changeMaterial, void, ( const char* mapTo, Materia
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TSMaterialList* shapeMaterialList = object->getShape()->materialList;
|
||||||
|
|
||||||
// Check the mapTo name exists for this shape
|
// Check the mapTo name exists for this shape
|
||||||
S32 matIndex = object->getShape()->materialList->getMaterialNameList().find_next(String(mapTo));
|
S32 matIndex = shapeMaterialList->getMaterialNameList().find_next(String(mapTo));
|
||||||
if (matIndex < 0)
|
if (matIndex < 0)
|
||||||
{
|
{
|
||||||
Con::errorf("TSShape::changeMaterial failed: Invalid mapTo name '%s'", mapTo);
|
Con::errorf("TSShape::changeMaterial failed: Invalid mapTo name '%s'", mapTo);
|
||||||
|
|
@ -1190,13 +1192,13 @@ DefineEngineMethod( TSStatic, changeMaterial, void, ( const char* mapTo, Materia
|
||||||
|
|
||||||
// Replace instances with the new material being traded in. Lets make sure that we only
|
// Replace instances with the new material being traded in. Lets make sure that we only
|
||||||
// target the specific targets per inst, this is actually doing more than we thought
|
// target the specific targets per inst, this is actually doing more than we thought
|
||||||
delete object->getShape()->materialList->mMatInstList[matIndex];
|
delete shapeMaterialList->mMatInstList[matIndex];
|
||||||
object->getShape()->materialList->mMatInstList[matIndex] = newMat->createMatInstance();
|
shapeMaterialList->mMatInstList[matIndex] = newMat->createMatInstance();
|
||||||
|
|
||||||
// Finish up preparing the material instances for rendering
|
// Finish up preparing the material instances for rendering
|
||||||
const GFXVertexFormat *flags = getGFXVertexFormat<GFXVertexPNTTB>();
|
const GFXVertexFormat *flags = getGFXVertexFormat<GFXVertexPNTTB>();
|
||||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||||
object->getShape()->materialList->getMaterialInst(matIndex)->init( features, flags );
|
shapeMaterialList->getMaterialInst(matIndex)->init(features, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineMethod( TSStatic, getModelFile, const char *, (),,
|
DefineEngineMethod( TSStatic, getModelFile, const char *, (),,
|
||||||
|
|
|
||||||
|
|
@ -1060,8 +1060,8 @@ void TurretShape::writePacketData(GameConnection *connection, BitStream *stream)
|
||||||
// Update client regardless of status flags.
|
// Update client regardless of status flags.
|
||||||
Parent::writePacketData(connection, stream);
|
Parent::writePacketData(connection, stream);
|
||||||
|
|
||||||
stream->write(mRot.x);
|
stream->writeSignedFloat(mRot.x / M_2PI_F, 7);
|
||||||
stream->write(mRot.z);
|
stream->writeSignedFloat(mRot.z / M_2PI_F, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TurretShape::readPacketData(GameConnection *connection, BitStream *stream)
|
void TurretShape::readPacketData(GameConnection *connection, BitStream *stream)
|
||||||
|
|
@ -1069,9 +1069,8 @@ void TurretShape::readPacketData(GameConnection *connection, BitStream *stream)
|
||||||
Parent::readPacketData(connection, stream);
|
Parent::readPacketData(connection, stream);
|
||||||
|
|
||||||
Point3F rot(0.0f, 0.0f, 0.0f);
|
Point3F rot(0.0f, 0.0f, 0.0f);
|
||||||
stream->read(&rot.x);
|
rot.x = stream->readSignedFloat(7) * M_2PI_F;
|
||||||
stream->read(&rot.z);
|
rot.z = stream->readSignedFloat(7) * M_2PI_F;
|
||||||
|
|
||||||
_setRotation(rot);
|
_setRotation(rot);
|
||||||
|
|
||||||
mTurretDelta.rot = rot;
|
mTurretDelta.rot = rot;
|
||||||
|
|
@ -1100,8 +1099,8 @@ U32 TurretShape::packUpdate(NetConnection *connection, U32 mask, BitStream *stre
|
||||||
|
|
||||||
if (stream->writeFlag(mask & TurretUpdateMask))
|
if (stream->writeFlag(mask & TurretUpdateMask))
|
||||||
{
|
{
|
||||||
stream->write(mRot.x);
|
stream->writeSignedFloat(mRot.x / M_2PI_F, 7);
|
||||||
stream->write(mRot.z);
|
stream->writeSignedFloat(mRot.z / M_2PI_F, 7);
|
||||||
stream->write(allowManualRotation);
|
stream->write(allowManualRotation);
|
||||||
stream->write(allowManualFire);
|
stream->write(allowManualFire);
|
||||||
}
|
}
|
||||||
|
|
@ -1137,8 +1136,8 @@ void TurretShape::unpackUpdate(NetConnection *connection, BitStream *stream)
|
||||||
if (stream->readFlag())
|
if (stream->readFlag())
|
||||||
{
|
{
|
||||||
Point3F rot(0.0f, 0.0f, 0.0f);
|
Point3F rot(0.0f, 0.0f, 0.0f);
|
||||||
stream->read(&rot.x);
|
rot.x = stream->readSignedFloat(7) * M_2PI_F;
|
||||||
stream->read(&rot.z);
|
rot.z = stream->readSignedFloat(7) * M_2PI_F;
|
||||||
_setRotation(rot);
|
_setRotation(rot);
|
||||||
|
|
||||||
// New delta for client side interpolation
|
// New delta for client side interpolation
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,6 @@
|
||||||
// For the TickMs define... fix this for T2D...
|
// For the TickMs define... fix this for T2D...
|
||||||
#include "T3D/gameBase/processList.h"
|
#include "T3D/gameBase/processList.h"
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
#include "demo/pestTimer/pestTimer.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TORQUE_ENABLE_VFS
|
#ifdef TORQUE_ENABLE_VFS
|
||||||
#include "platform/platformVFS.h"
|
#include "platform/platformVFS.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -309,10 +305,6 @@ void StandardMainLoop::init()
|
||||||
// Hook in for UDP notification
|
// Hook in for UDP notification
|
||||||
Net::smPacketReceive.notify(GNet, &NetInterface::processPacketReceiveEvent);
|
Net::smPacketReceive.notify(GNet, &NetInterface::processPacketReceiveEvent);
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
PestTimerinit();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TORQUE_DEBUG_GUARD
|
#ifdef TORQUE_DEBUG_GUARD
|
||||||
Memory::flagCurrentAllocs( Memory::FLAG_Static );
|
Memory::flagCurrentAllocs( Memory::FLAG_Static );
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -613,11 +605,6 @@ bool StandardMainLoop::doMainLoop()
|
||||||
ThreadPool::processMainThreadWorkItems();
|
ThreadPool::processMainThreadWorkItems();
|
||||||
Sampler::endFrame();
|
Sampler::endFrame();
|
||||||
PROFILE_END_NAMED(MainLoop);
|
PROFILE_END_NAMED(MainLoop);
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
CheckTimer();
|
|
||||||
CheckBlocker();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return keepRunning;
|
return keepRunning;
|
||||||
|
|
|
||||||
|
|
@ -142,21 +142,3 @@ DefineConsoleFunction( getBuildString, const char*, (), , "Get the type of build
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunctionGroupEnd( CompileInformation );
|
ConsoleFunctionGroupEnd( CompileInformation );
|
||||||
|
|
||||||
DefineConsoleFunction( isDemo, bool, (), , "")
|
|
||||||
{
|
|
||||||
#ifdef TORQUE_DEMO
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
DefineConsoleFunction( isWebDemo, bool, (), , "")
|
|
||||||
{
|
|
||||||
#ifdef TORQUE_DEMO
|
|
||||||
return Platform::getWebDeployment();
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
@ -76,9 +76,10 @@ extern "C" {
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
ConsoleValueRef argv[] = {"consoleExportXML"};
|
static const char* exportArgv[1] = { "consoleExportXML" };
|
||||||
|
static StringStackConsoleWrapper exportCmd(1, exportArgv);
|
||||||
|
|
||||||
return entry->cb.mStringCallbackFunc(NULL, 1, argv);
|
return entry->cb.mStringCallbackFunc(NULL, exportCmd.argc, exportCmd.argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
MarshalNativeEntry* script_get_namespace_entry(const char* nameSpace, const char* name)
|
MarshalNativeEntry* script_get_namespace_entry(const char* nameSpace, const char* name)
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ Point3F BoxConvex::getVertex(S32 v)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isOnPlane(Point3F p,PlaneF& plane)
|
inline bool isOnPlane(const Point3F& p,PlaneF& plane)
|
||||||
{
|
{
|
||||||
F32 dist = mDot(plane,p) + plane.d;
|
F32 dist = mDot(plane,p) + plane.d;
|
||||||
return dist < 0.1 && dist > -0.1;
|
return dist < 0.1 && dist > -0.1;
|
||||||
|
|
|
||||||
|
|
@ -310,7 +310,7 @@ protected:
|
||||||
U8 *data; ///< Allocated data (size is BlockSize)
|
U8 *data; ///< Allocated data (size is BlockSize)
|
||||||
U32 size; ///< Bytes used in data
|
U32 size; ///< Bytes used in data
|
||||||
CodeData *next; ///< Next block
|
CodeData *next; ///< Next block
|
||||||
};
|
} CodeData;
|
||||||
|
|
||||||
/// @name Emitted code
|
/// @name Emitted code
|
||||||
/// {
|
/// {
|
||||||
|
|
|
||||||
|
|
@ -1534,9 +1534,16 @@ StringTableEntry getModNameFromPath(const char *path)
|
||||||
void postConsoleInput( RawData data )
|
void postConsoleInput( RawData data )
|
||||||
{
|
{
|
||||||
// Schedule this to happen at the next time event.
|
// Schedule this to happen at the next time event.
|
||||||
|
ConsoleValue values[2];
|
||||||
ConsoleValueRef argv[2];
|
ConsoleValueRef argv[2];
|
||||||
argv[0] = "eval";
|
|
||||||
argv[1] = ( const char* ) data.data;
|
values[0].init();
|
||||||
|
values[0].setStringValue("eval");
|
||||||
|
values[1].init();
|
||||||
|
values[1].setStringValue((const char*)data.data);
|
||||||
|
argv[0].value = &values[0];
|
||||||
|
argv[1].value = &values[1];
|
||||||
|
|
||||||
Sim::postCurrentEvent(Sim::getRootGroup(), new SimConsoleEvent(2, argv, false));
|
Sim::postCurrentEvent(Sim::getRootGroup(), new SimConsoleEvent(2, argv, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1610,36 +1617,6 @@ ConsoleValueRef::ConsoleValueRef(const ConsoleValueRef &ref)
|
||||||
value = ref.value;
|
value = ref.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleValueRef::ConsoleValueRef(const char *newValue) : value(NULL)
|
|
||||||
{
|
|
||||||
*this = newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConsoleValueRef::ConsoleValueRef(const String &newValue) : value(NULL)
|
|
||||||
{
|
|
||||||
*this = (const char*)(newValue.utf8());
|
|
||||||
}
|
|
||||||
|
|
||||||
ConsoleValueRef::ConsoleValueRef(U32 newValue) : value(NULL)
|
|
||||||
{
|
|
||||||
*this = newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConsoleValueRef::ConsoleValueRef(S32 newValue) : value(NULL)
|
|
||||||
{
|
|
||||||
*this = newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConsoleValueRef::ConsoleValueRef(F32 newValue) : value(NULL)
|
|
||||||
{
|
|
||||||
*this = newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConsoleValueRef::ConsoleValueRef(F64 newValue) : value(NULL)
|
|
||||||
{
|
|
||||||
*this = newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConsoleValueRef& ConsoleValueRef::operator=(const ConsoleValueRef &newValue)
|
ConsoleValueRef& ConsoleValueRef::operator=(const ConsoleValueRef &newValue)
|
||||||
{
|
{
|
||||||
value = newValue.value;
|
value = newValue.value;
|
||||||
|
|
@ -1759,12 +1736,34 @@ const char *ConsoleValue::getStringValue()
|
||||||
return sval;
|
return sval;
|
||||||
else if (type == TypeInternalStringStackPtr)
|
else if (type == TypeInternalStringStackPtr)
|
||||||
return STR.mBuffer + (uintptr_t)sval;
|
return STR.mBuffer + (uintptr_t)sval;
|
||||||
if(type == TypeInternalFloat)
|
|
||||||
return Con::getData(TypeF32, &fval, 0);
|
|
||||||
else if(type == TypeInternalInt)
|
|
||||||
return Con::getData(TypeS32, &ival, 0);
|
|
||||||
else
|
else
|
||||||
return Con::getData(type, dataPtr, 0, enumTable);
|
{
|
||||||
|
// We need a string representation, so lets create one
|
||||||
|
const char *internalValue = NULL;
|
||||||
|
|
||||||
|
if(type == TypeInternalFloat)
|
||||||
|
internalValue = Con::getData(TypeF32, &fval, 0);
|
||||||
|
else if(type == TypeInternalInt)
|
||||||
|
internalValue = Con::getData(TypeS32, &ival, 0);
|
||||||
|
else
|
||||||
|
return Con::getData(type, dataPtr, 0, enumTable); // We can't save sval here since it is the same as dataPtr
|
||||||
|
|
||||||
|
if (!internalValue)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
U32 stringLen = dStrlen(internalValue);
|
||||||
|
U32 newLen = ((stringLen + 1) + 15) & ~15; // pad upto next cache line
|
||||||
|
|
||||||
|
if (bufferLen == 0)
|
||||||
|
sval = (char *) dMalloc(newLen);
|
||||||
|
else if(newLen > bufferLen)
|
||||||
|
sval = (char *) dRealloc(sval, newLen);
|
||||||
|
|
||||||
|
dStrcpy(sval, internalValue);
|
||||||
|
bufferLen = newLen;
|
||||||
|
|
||||||
|
return sval;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StringStackPtr ConsoleValue::getStringStackPtr()
|
StringStackPtr ConsoleValue::getStringStackPtr()
|
||||||
|
|
@ -1800,11 +1799,13 @@ void ConsoleValue::setIntValue(U32 val)
|
||||||
{
|
{
|
||||||
fval = (F32)val;
|
fval = (F32)val;
|
||||||
ival = val;
|
ival = val;
|
||||||
if(sval != typeValueEmpty)
|
if(bufferLen > 0)
|
||||||
{
|
{
|
||||||
if (type != TypeInternalStackString && type != TypeInternalStringStackPtr) dFree(sval);
|
dFree(sval);
|
||||||
sval = typeValueEmpty;
|
bufferLen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sval = typeValueEmpty;
|
||||||
type = TypeInternalInt;
|
type = TypeInternalInt;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1825,11 +1826,12 @@ void ConsoleValue::setFloatValue(F32 val)
|
||||||
{
|
{
|
||||||
fval = val;
|
fval = val;
|
||||||
ival = static_cast<U32>(val);
|
ival = static_cast<U32>(val);
|
||||||
if(sval != typeValueEmpty)
|
if(bufferLen > 0)
|
||||||
{
|
{
|
||||||
if (type != TypeInternalStackString && type != TypeInternalStringStackPtr) dFree(sval);
|
dFree(sval);
|
||||||
sval = typeValueEmpty;
|
bufferLen = 0;
|
||||||
}
|
}
|
||||||
|
sval = typeValueEmpty;
|
||||||
type = TypeInternalFloat;
|
type = TypeInternalFloat;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -186,20 +186,23 @@ public:
|
||||||
fval = 0;
|
fval = 0;
|
||||||
sval = typeValueEmpty;
|
sval = typeValueEmpty;
|
||||||
bufferLen = 0;
|
bufferLen = 0;
|
||||||
type = TypeInternalString;
|
type = TypeInternalString;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup()
|
void cleanup()
|
||||||
{
|
{
|
||||||
if (type <= TypeInternalString &&
|
if ((type <= TypeInternalString) && (bufferLen > 0))
|
||||||
sval != typeValueEmpty && type != TypeInternalStackString && type != TypeInternalStringStackPtr)
|
{
|
||||||
dFree(sval);
|
dFree(sval);
|
||||||
|
bufferLen = 0;
|
||||||
|
}
|
||||||
sval = typeValueEmpty;
|
sval = typeValueEmpty;
|
||||||
type = ConsoleValue::TypeInternalString;
|
type = ConsoleValue::TypeInternalString;
|
||||||
ival = 0;
|
ival = 0;
|
||||||
fval = 0;
|
fval = 0;
|
||||||
bufferLen = 0;
|
|
||||||
}
|
}
|
||||||
|
ConsoleValue(){ init(); };
|
||||||
|
~ConsoleValue(){ cleanup(); };
|
||||||
};
|
};
|
||||||
|
|
||||||
// Proxy class for console variables
|
// Proxy class for console variables
|
||||||
|
|
@ -214,12 +217,6 @@ public:
|
||||||
~ConsoleValueRef() { ; }
|
~ConsoleValueRef() { ; }
|
||||||
|
|
||||||
ConsoleValueRef(const ConsoleValueRef &ref);
|
ConsoleValueRef(const ConsoleValueRef &ref);
|
||||||
ConsoleValueRef(const char *value);
|
|
||||||
ConsoleValueRef(const String &ref);
|
|
||||||
ConsoleValueRef(U32 value);
|
|
||||||
ConsoleValueRef(S32 value);
|
|
||||||
ConsoleValueRef(F32 value);
|
|
||||||
ConsoleValueRef(F64 value);
|
|
||||||
|
|
||||||
static ConsoleValueRef fromValue(ConsoleValue *value) { ConsoleValueRef ref; ref.value = value; return ref; }
|
static ConsoleValueRef fromValue(ConsoleValue *value) { ConsoleValueRef ref; ref.value = value; return ref; }
|
||||||
|
|
||||||
|
|
@ -1103,9 +1100,9 @@ struct ConsoleDocFragment
|
||||||
static ConsoleDocFragment* smFirst;
|
static ConsoleDocFragment* smFirst;
|
||||||
|
|
||||||
ConsoleDocFragment( const char* text, const char* inClass = NULL, const char* definition = NULL )
|
ConsoleDocFragment( const char* text, const char* inClass = NULL, const char* definition = NULL )
|
||||||
: mText( text ),
|
: mClass( inClass ),
|
||||||
mClass( inClass ),
|
|
||||||
mDefinition( definition ),
|
mDefinition( definition ),
|
||||||
|
mText( text ),
|
||||||
mNext( smFirst )
|
mNext( smFirst )
|
||||||
{
|
{
|
||||||
smFirst = this;
|
smFirst = this;
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,6 @@
|
||||||
#include "core/util/journal/journal.h"
|
#include "core/util/journal/journal.h"
|
||||||
#include "core/util/uuid.h"
|
#include "core/util/uuid.h"
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
#include "gui/core/guiCanvas.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This is a temporary hack to get tools using the library to
|
// This is a temporary hack to get tools using the library to
|
||||||
// link in this module which contains no other references.
|
// link in this module which contains no other references.
|
||||||
bool LinkConsoleFunctions = false;
|
bool LinkConsoleFunctions = false;
|
||||||
|
|
|
||||||
|
|
@ -512,13 +512,17 @@ void ConsoleValue::setStringValue(const char * value)
|
||||||
*/
|
*/
|
||||||
if (value == typeValueEmpty)
|
if (value == typeValueEmpty)
|
||||||
{
|
{
|
||||||
if (sval && sval != typeValueEmpty && type != TypeInternalStackString && type != TypeInternalStringStackPtr) dFree(sval);
|
if (bufferLen > 0)
|
||||||
sval = typeValueEmpty;
|
{
|
||||||
|
dFree(sval);
|
||||||
bufferLen = 0;
|
bufferLen = 0;
|
||||||
fval = 0.f;
|
}
|
||||||
ival = 0;
|
|
||||||
type = TypeInternalString;
|
sval = typeValueEmpty;
|
||||||
return;
|
fval = 0.f;
|
||||||
|
ival = 0;
|
||||||
|
type = TypeInternalString;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 stringLen = dStrlen(value);
|
U32 stringLen = dStrlen(value);
|
||||||
|
|
@ -541,7 +545,7 @@ void ConsoleValue::setStringValue(const char * value)
|
||||||
// may as well pad to the next cache line
|
// may as well pad to the next cache line
|
||||||
U32 newLen = ((stringLen + 1) + 15) & ~15;
|
U32 newLen = ((stringLen + 1) + 15) & ~15;
|
||||||
|
|
||||||
if(sval == typeValueEmpty || type == TypeInternalStackString || type == TypeInternalStringStackPtr)
|
if(bufferLen == 0)
|
||||||
sval = (char *) dMalloc(newLen);
|
sval = (char *) dMalloc(newLen);
|
||||||
else if(newLen > bufferLen)
|
else if(newLen > bufferLen)
|
||||||
sval = (char *) dRealloc(sval, newLen);
|
sval = (char *) dRealloc(sval, newLen);
|
||||||
|
|
@ -562,11 +566,16 @@ void ConsoleValue::setStackStringValue(const char *value)
|
||||||
|
|
||||||
if(type <= ConsoleValue::TypeInternalString)
|
if(type <= ConsoleValue::TypeInternalString)
|
||||||
{
|
{
|
||||||
|
// sval might still be temporarily present so we need to check and free it
|
||||||
|
if (bufferLen > 0)
|
||||||
|
{
|
||||||
|
dFree(sval);
|
||||||
|
bufferLen = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (value == typeValueEmpty)
|
if (value == typeValueEmpty)
|
||||||
{
|
{
|
||||||
if (sval && sval != typeValueEmpty && type != ConsoleValue::TypeInternalStackString && type != ConsoleValue::TypeInternalStringStackPtr) dFree(sval);
|
|
||||||
sval = typeValueEmpty;
|
sval = typeValueEmpty;
|
||||||
bufferLen = 0;
|
|
||||||
fval = 0.f;
|
fval = 0.f;
|
||||||
ival = 0;
|
ival = 0;
|
||||||
type = TypeInternalString;
|
type = TypeInternalString;
|
||||||
|
|
@ -587,7 +596,7 @@ void ConsoleValue::setStackStringValue(const char *value)
|
||||||
|
|
||||||
type = TypeInternalStackString;
|
type = TypeInternalStackString;
|
||||||
sval = (char*)value;
|
sval = (char*)value;
|
||||||
bufferLen = stringLen;
|
bufferLen = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Con::setData(type, dataPtr, 0, 1, &value, enumTable);
|
Con::setData(type, dataPtr, 0, 1, &value, enumTable);
|
||||||
|
|
@ -598,7 +607,11 @@ void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue)
|
||||||
if(type <= ConsoleValue::TypeInternalString)
|
if(type <= ConsoleValue::TypeInternalString)
|
||||||
{
|
{
|
||||||
const char *value = StringStackPtrRef(ptrValue).getPtr(&STR);
|
const char *value = StringStackPtrRef(ptrValue).getPtr(&STR);
|
||||||
if (sval && sval != typeValueEmpty && type != ConsoleValue::TypeInternalStackString && type != TypeInternalStringStackPtr) dFree(sval);
|
if (bufferLen > 0)
|
||||||
|
{
|
||||||
|
dFree(sval);
|
||||||
|
bufferLen = 0;
|
||||||
|
}
|
||||||
|
|
||||||
U32 stringLen = dStrlen(value);
|
U32 stringLen = dStrlen(value);
|
||||||
if(stringLen < 256)
|
if(stringLen < 256)
|
||||||
|
|
@ -614,7 +627,7 @@ void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue)
|
||||||
|
|
||||||
type = TypeInternalStringStackPtr;
|
type = TypeInternalStringStackPtr;
|
||||||
sval = (char*)(value - STR.mBuffer);
|
sval = (char*)(value - STR.mBuffer);
|
||||||
bufferLen = stringLen;
|
bufferLen = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -680,8 +693,7 @@ Dictionary::Entry* Dictionary::addVariable( const char *name,
|
||||||
Entry *ent = add(StringTable->insert(name));
|
Entry *ent = add(StringTable->insert(name));
|
||||||
|
|
||||||
if ( ent->value.type <= ConsoleValue::TypeInternalString &&
|
if ( ent->value.type <= ConsoleValue::TypeInternalString &&
|
||||||
ent->value.sval != typeValueEmpty &&
|
ent->value.bufferLen > 0 )
|
||||||
ent->value.type != ConsoleValue::TypeInternalStackString && ent->value.type != ConsoleValue::TypeInternalStringStackPtr )
|
|
||||||
dFree(ent->value.sval);
|
dFree(ent->value.sval);
|
||||||
|
|
||||||
ent->value.type = type;
|
ent->value.type = type;
|
||||||
|
|
|
||||||
|
|
@ -50,24 +50,21 @@ bool addConsoleParser(char *ext, fnGetCurrentFile gcf, fnGetCurrentLine gcl, fnP
|
||||||
AssertFatal(ext && gcf && gcl && p && r, "AddConsoleParser called with one or more NULL arguments");
|
AssertFatal(ext && gcf && gcl && p && r, "AddConsoleParser called with one or more NULL arguments");
|
||||||
|
|
||||||
ConsoleParser * pParser = new ConsoleParser;
|
ConsoleParser * pParser = new ConsoleParser;
|
||||||
if(pParser != NULL)
|
|
||||||
{
|
|
||||||
pParser->ext = ext;
|
|
||||||
pParser->getCurrentFile = gcf;
|
|
||||||
pParser->getCurrentLine = gcl;
|
|
||||||
pParser->parse = p;
|
|
||||||
pParser->restart = r;
|
|
||||||
pParser->setScanBuffer = ssb;
|
|
||||||
|
|
||||||
if(def)
|
pParser->ext = ext;
|
||||||
gDefaultParser = pParser;
|
pParser->getCurrentFile = gcf;
|
||||||
|
pParser->getCurrentLine = gcl;
|
||||||
|
pParser->parse = p;
|
||||||
|
pParser->restart = r;
|
||||||
|
pParser->setScanBuffer = ssb;
|
||||||
|
|
||||||
pParser->next = gParserList;
|
if (def)
|
||||||
gParserList = pParser;
|
gDefaultParser = pParser;
|
||||||
|
|
||||||
return true;
|
pParser->next = gParserList;
|
||||||
}
|
gParserList = pParser;
|
||||||
return false;
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleParser * getParserForFile(const char *filename)
|
ConsoleParser * getParserForFile(const char *filename)
|
||||||
|
|
|
||||||
|
|
@ -48,11 +48,7 @@
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
#ifndef Offset
|
#ifndef Offset
|
||||||
#if defined(TORQUE_COMPILER_GCC) && (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))
|
#define Offset(x, cls) offsetof(cls, x)
|
||||||
#define Offset(m,T) ((int)(&((T *)1)->m) - 1)
|
|
||||||
#else
|
|
||||||
#define Offset(x, cls) ((dsize_t)((const char *)&(((cls *)0)->x)-(const char *)0))
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class GFXShader;
|
class GFXShader;
|
||||||
|
|
|
||||||
|
|
@ -706,7 +706,7 @@ static bool dumpEngineDocs( const char *outputFile )
|
||||||
// Dump pre-declarations for any groups we encountered
|
// Dump pre-declarations for any groups we encountered
|
||||||
// so that we don't have to explicitly define them.
|
// so that we don't have to explicitly define them.
|
||||||
HashTable<String,U32>::Iterator iter = smDocGroups.begin();
|
HashTable<String,U32>::Iterator iter = smDocGroups.begin();
|
||||||
for ( ; iter != smDocGroups.end(); iter++ )
|
for (; iter != smDocGroups.end(); ++iter)
|
||||||
stream.writeText( String::ToString( "/*! @addtogroup %s */\r\n\r\n", iter->key.c_str() ) );
|
stream.writeText( String::ToString( "/*! @addtogroup %s */\r\n\r\n", iter->key.c_str() ) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,11 @@ struct EngineFunctionDefaultArguments
|
||||||
|
|
||||||
|
|
||||||
// Need byte-aligned packing for the default argument structures.
|
// Need byte-aligned packing for the default argument structures.
|
||||||
|
#ifdef _WIN64
|
||||||
|
#pragma pack( push, 4 )
|
||||||
|
#else
|
||||||
#pragma pack( push, 1 )
|
#pragma pack( push, 1 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Structure encapsulating default arguments to an engine API function.
|
// Structure encapsulating default arguments to an engine API function.
|
||||||
|
|
|
||||||
|
|
@ -173,8 +173,8 @@ class EngineFieldTable
|
||||||
/// Construct a field table from a NULL-terminated array of Field
|
/// Construct a field table from a NULL-terminated array of Field
|
||||||
/// records.
|
/// records.
|
||||||
EngineFieldTable( const Field* fields )
|
EngineFieldTable( const Field* fields )
|
||||||
: mFields( fields ),
|
: mNumFields( 0 ),
|
||||||
mNumFields( 0 )
|
mFields( fields )
|
||||||
{
|
{
|
||||||
while( fields[ mNumFields ].getName() )
|
while( fields[ mNumFields ].getName() )
|
||||||
mNumFields ++;
|
mNumFields ++;
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ ConsoleValueRef SimConsoleThreadExecCallback::waitForResult()
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (const char*)NULL;
|
return ConsoleValueRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,9 @@ public:
|
||||||
static S32 _smTypeId;
|
static S32 _smTypeId;
|
||||||
|
|
||||||
SimObjectRef()
|
SimObjectRef()
|
||||||
: mId( 0 ),
|
: mName( "" ),
|
||||||
mObject( NULL ),
|
mId( 0 ),
|
||||||
mName( "" )
|
mObject( NULL )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,9 +79,9 @@ class Module
|
||||||
|
|
||||||
Dependency( Mode mode, DependencyType type, Module* parentModule, const char* moduleName )
|
Dependency( Mode mode, DependencyType type, Module* parentModule, const char* moduleName )
|
||||||
: mType( type ),
|
: mType( type ),
|
||||||
mNext( mode == ModeInitialize ? parentModule->mInitDependencies : parentModule->mShutdownDependencies ),
|
|
||||||
mModuleName( moduleName ),
|
mModuleName( moduleName ),
|
||||||
mModule( NULL )
|
mModule( NULL ),
|
||||||
|
mNext( mode == ModeInitialize ? parentModule->mInitDependencies : parentModule->mShutdownDependencies )
|
||||||
{
|
{
|
||||||
if( mode == ModeInitialize )
|
if( mode == ModeInitialize )
|
||||||
parentModule->mInitDependencies = this;
|
parentModule->mInitDependencies = this;
|
||||||
|
|
@ -141,11 +141,12 @@ class Module
|
||||||
}
|
}
|
||||||
|
|
||||||
Module()
|
Module()
|
||||||
: mNext( smFirst ),
|
: mIsInitialized( false ),
|
||||||
|
mNext( smFirst ),
|
||||||
mInitDependencies( NULL ),
|
mInitDependencies( NULL ),
|
||||||
mShutdownDependencies( NULL ),
|
mShutdownDependencies( NULL ),
|
||||||
mOverrides( NULL ),
|
mOverrides( NULL )
|
||||||
mIsInitialized( false )
|
|
||||||
{
|
{
|
||||||
smFirst = this;
|
smFirst = this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,15 +39,12 @@ FileStream *FileStream::createAndOpen(const String &inFileName, Torque::FS::File
|
||||||
{
|
{
|
||||||
FileStream *newStream = new FileStream;
|
FileStream *newStream = new FileStream;
|
||||||
|
|
||||||
if ( newStream )
|
bool success = newStream->open( inFileName, inMode );
|
||||||
{
|
|
||||||
bool success = newStream->open( inFileName, inMode );
|
|
||||||
|
|
||||||
if ( !success )
|
if ( !success )
|
||||||
{
|
{
|
||||||
delete newStream;
|
delete newStream;
|
||||||
newStream = NULL;
|
newStream = NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return newStream;
|
return newStream;
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,12 @@
|
||||||
// These standard functions are not defined on Win32 and other Microsoft platforms...
|
// These standard functions are not defined on Win32 and other Microsoft platforms...
|
||||||
#define strcasecmp _stricmp
|
#define strcasecmp _stricmp
|
||||||
#define strncasecmp _strnicmp
|
#define strncasecmp _strnicmp
|
||||||
#endif
|
|
||||||
#if (_MSC_VER < 1800) && (defined(TORQUE_OS_WIN) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON))
|
#if _MSC_VER < 1800
|
||||||
#define strtof (float)strtod
|
#define strtof (float)strtod
|
||||||
#endif
|
#endif // _MSC_VER < 1800
|
||||||
|
|
||||||
|
#endif // defined(TORQUE_OS_WIN) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON)
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,9 @@
|
||||||
|
|
||||||
#ifndef FASTDELEGATE_H
|
#ifndef FASTDELEGATE_H
|
||||||
#define FASTDELEGATE_H
|
#define FASTDELEGATE_H
|
||||||
#if _MSC_VER > 1000
|
#if defined(_MSC_VER) && (_MSC_VER > 1000)
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif // _MSC_VER > 1000
|
#endif // defined(_MSC_VER) && (_MSC_VER > 1000)
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Configuration options
|
// Configuration options
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class RawDataT
|
||||||
}
|
}
|
||||||
|
|
||||||
RawDataT( T* data, U32 size, bool ownMemory = false )
|
RawDataT( T* data, U32 size, bool ownMemory = false )
|
||||||
: data( data ), size( size ), ownMemory( ownMemory ) {}
|
: ownMemory( ownMemory ), data( data ), size( size ) {}
|
||||||
|
|
||||||
RawDataT(const ThisType& rd)
|
RawDataT(const ThisType& rd)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -567,7 +567,6 @@ String::String(const StringChar *str, SizeType len)
|
||||||
PROFILE_SCOPE(String_char_len_constructor);
|
PROFILE_SCOPE(String_char_len_constructor);
|
||||||
if (str && *str && len!=0)
|
if (str && *str && len!=0)
|
||||||
{
|
{
|
||||||
AssertFatal(len<=dStrlen(str), "String::String: string too short");
|
|
||||||
_string = new ( len ) StringData( str );
|
_string = new ( len ) StringData( str );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -657,6 +656,11 @@ bool String::isEmpty() const
|
||||||
return ( _string == StringData::Empty() );
|
return ( _string == StringData::Empty() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool String::isEmpty(const char* str)
|
||||||
|
{
|
||||||
|
return str == 0 || str[0] == '\0';
|
||||||
|
}
|
||||||
|
|
||||||
bool String::isShared() const
|
bool String::isShared() const
|
||||||
{
|
{
|
||||||
return _string->isShared();
|
return _string->isShared();
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ public:
|
||||||
String();
|
String();
|
||||||
String(const String &str);
|
String(const String &str);
|
||||||
String(const StringChar *str);
|
String(const StringChar *str);
|
||||||
String(const StringChar *str, SizeType size);
|
String(const StringChar *str, SizeType size); ///< Copy from raw data
|
||||||
String(const UTF16 *str);
|
String(const UTF16 *str);
|
||||||
~String();
|
~String();
|
||||||
|
|
||||||
|
|
@ -74,6 +74,7 @@ public:
|
||||||
SizeType size() const; ///< Returns the length of the string in bytes including the NULL terminator.
|
SizeType size() const; ///< Returns the length of the string in bytes including the NULL terminator.
|
||||||
SizeType numChars() const; ///< Returns the length of the string in characters.
|
SizeType numChars() const; ///< Returns the length of the string in characters.
|
||||||
bool isEmpty() const; ///< Is this an empty string [""]?
|
bool isEmpty() const; ///< Is this an empty string [""]?
|
||||||
|
static bool isEmpty(const char*); // is the input empty?
|
||||||
bool isNotEmpty() const { return !isEmpty(); } ///< Is this not an empty string [""]?
|
bool isNotEmpty() const { return !isEmpty(); } ///< Is this not an empty string [""]?
|
||||||
|
|
||||||
/// Erases all characters in a string.
|
/// Erases all characters in a string.
|
||||||
|
|
@ -292,11 +293,10 @@ private:
|
||||||
// causes an ambiguous cast compile error. Making it private is simply
|
// causes an ambiguous cast compile error. Making it private is simply
|
||||||
// more insurance that it isn't used on different compilers.
|
// more insurance that it isn't used on different compilers.
|
||||||
// NOTE: disable on GCC since it causes hyper casting to U32 on gcc.
|
// NOTE: disable on GCC since it causes hyper casting to U32 on gcc.
|
||||||
#ifndef TORQUE_COMPILER_GCC
|
#if !defined(TORQUE_COMPILER_GCC) && !defined(__clang__)
|
||||||
operator const bool() const { return false; }
|
operator const bool() const { return false; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void copy(StringChar *dst, const StringChar *src, U32 size);
|
static void copy(StringChar *dst, const StringChar *src, U32 size);
|
||||||
|
|
||||||
StringData *_string;
|
StringData *_string;
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class UnmanagedVector
|
||||||
UnmanagedVector()
|
UnmanagedVector()
|
||||||
: mCount( 0 ), mArray( NULL ) {}
|
: mCount( 0 ), mArray( NULL ) {}
|
||||||
UnmanagedVector( T* array, U32 count )
|
UnmanagedVector( T* array, U32 count )
|
||||||
: mArray( array ), mCount( count ) {}
|
: mCount( count ), mArray( array ) {}
|
||||||
|
|
||||||
U32 size() const { return mCount; }
|
U32 size() const { return mCount; }
|
||||||
bool empty() const { return ( mCount == 0 ); }
|
bool empty() const { return ( mCount == 0 ); }
|
||||||
|
|
|
||||||
|
|
@ -1091,7 +1091,7 @@ F32 GuiMeshRoadEditorCtrl::getNodeDepth()
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiMeshRoadEditorCtrl::setNodePosition( Point3F pos )
|
void GuiMeshRoadEditorCtrl::setNodePosition(const Point3F& pos)
|
||||||
{
|
{
|
||||||
if ( mSelRoad && mSelNode != -1 )
|
if ( mSelRoad && mSelNode != -1 )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ class GuiMeshRoadEditorCtrl : public EditTSCtrl
|
||||||
void setNodeDepth( F32 depth );
|
void setNodeDepth( F32 depth );
|
||||||
|
|
||||||
Point3F getNodePosition();
|
Point3F getNodePosition();
|
||||||
void setNodePosition( Point3F pos );
|
void setNodePosition(const Point3F& pos);
|
||||||
|
|
||||||
VectorF getNodeNormal();
|
VectorF getNodeNormal();
|
||||||
void setNodeNormal( const VectorF &normal );
|
void setNodeNormal( const VectorF &normal );
|
||||||
|
|
|
||||||
|
|
@ -1235,7 +1235,7 @@ F32 GuiRiverEditorCtrl::getNodeDepth()
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiRiverEditorCtrl::setNodePosition( Point3F pos )
|
void GuiRiverEditorCtrl::setNodePosition(const Point3F& pos)
|
||||||
{
|
{
|
||||||
if ( mSelRiver && mSelNode != -1 )
|
if ( mSelRiver && mSelNode != -1 )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ class GuiRiverEditorCtrl : public EditTSCtrl
|
||||||
void setNodeDepth( F32 depth );
|
void setNodeDepth( F32 depth );
|
||||||
|
|
||||||
Point3F getNodePosition();
|
Point3F getNodePosition();
|
||||||
void setNodePosition( Point3F pos );
|
void setNodePosition(const Point3F& pos);
|
||||||
|
|
||||||
VectorF getNodeNormal();
|
VectorF getNodeNormal();
|
||||||
void setNodeNormal( const VectorF &normal );
|
void setNodeNormal( const VectorF &normal );
|
||||||
|
|
|
||||||
|
|
@ -979,7 +979,7 @@ F32 GuiRoadEditorCtrl::getNodeWidth()
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiRoadEditorCtrl::setNodePosition( Point3F pos )
|
void GuiRoadEditorCtrl::setNodePosition(const Point3F& pos)
|
||||||
{
|
{
|
||||||
if ( mSelRoad && mSelNode != -1 )
|
if ( mSelRoad && mSelNode != -1 )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ class GuiRoadEditorCtrl : public EditTSCtrl
|
||||||
void setNodeWidth( F32 width );
|
void setNodeWidth( F32 width );
|
||||||
|
|
||||||
Point3F getNodePosition();
|
Point3F getNodePosition();
|
||||||
void setNodePosition( Point3F pos );
|
void setNodePosition(const Point3F& pos);
|
||||||
|
|
||||||
void setTextureFile( StringTableEntry file );
|
void setTextureFile( StringTableEntry file );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -637,12 +637,13 @@ void ScatterSky::prepRenderImage( SceneRenderState *state )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Regular sky render instance.
|
// Regular sky render instance.
|
||||||
ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
|
RenderPassManager* renderPass = state->getRenderPass();
|
||||||
|
ObjectRenderInst *ri = renderPass->allocInst<ObjectRenderInst>();
|
||||||
ri->renderDelegate.bind( this, &ScatterSky::_render );
|
ri->renderDelegate.bind( this, &ScatterSky::_render );
|
||||||
ri->type = RenderPassManager::RIT_Sky;
|
ri->type = RenderPassManager::RIT_Sky;
|
||||||
ri->defaultKey = 10;
|
ri->defaultKey = 10;
|
||||||
ri->defaultKey2 = 0;
|
ri->defaultKey2 = 0;
|
||||||
state->getRenderPass()->addInst( ri );
|
renderPass->addInst(ri);
|
||||||
|
|
||||||
// Debug render instance.
|
// Debug render instance.
|
||||||
/*
|
/*
|
||||||
|
|
@ -685,13 +686,13 @@ void ScatterSky::prepRenderImage( SceneRenderState *state )
|
||||||
mMatrixSet->setSceneProjection(GFX->getProjectionMatrix());
|
mMatrixSet->setSceneProjection(GFX->getProjectionMatrix());
|
||||||
mMatrixSet->setWorld(GFX->getWorldMatrix());
|
mMatrixSet->setWorld(GFX->getWorldMatrix());
|
||||||
|
|
||||||
ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
|
ObjectRenderInst *ri = renderPass->allocInst<ObjectRenderInst>();
|
||||||
ri->renderDelegate.bind( this, &ScatterSky::_renderMoon );
|
ri->renderDelegate.bind( this, &ScatterSky::_renderMoon );
|
||||||
ri->type = RenderPassManager::RIT_Sky;
|
ri->type = RenderPassManager::RIT_Sky;
|
||||||
// Render after sky objects and before CloudLayer!
|
// Render after sky objects and before CloudLayer!
|
||||||
ri->defaultKey = 5;
|
ri->defaultKey = 5;
|
||||||
ri->defaultKey2 = 0;
|
ri->defaultKey2 = 0;
|
||||||
state->getRenderPass()->addInst( ri );
|
renderPass->addInst(ri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,6 @@ void ForestEditorCtrl::onSleep()
|
||||||
|
|
||||||
bool ForestEditorCtrl::updateActiveForest( bool createNew )
|
bool ForestEditorCtrl::updateActiveForest( bool createNew )
|
||||||
{
|
{
|
||||||
mForest = dynamic_cast<Forest*>( Sim::findObject( "theForest" ) );
|
|
||||||
Con::executef( this, "onActiveForestUpdated", mForest ? mForest->getIdString() : "", createNew ? "1" : "0" );
|
Con::executef( this, "onActiveForestUpdated", mForest ? mForest->getIdString() : "", createNew ? "1" : "0" );
|
||||||
|
|
||||||
if ( mTool )
|
if ( mTool )
|
||||||
|
|
@ -401,3 +400,12 @@ DefineConsoleMethod( ForestEditorCtrl, isDirty, bool, (), , "" )
|
||||||
{
|
{
|
||||||
return object->isDirty();
|
return object->isDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefineConsoleMethod(ForestEditorCtrl, setActiveForest, void, (const char * obj), , "( Forest obj )")
|
||||||
|
{
|
||||||
|
Forest *forestObject;
|
||||||
|
if (!Sim::findObject(obj, forestObject))
|
||||||
|
return;
|
||||||
|
|
||||||
|
object->setActiveForest(forestObject);
|
||||||
|
}
|
||||||
|
|
@ -86,6 +86,9 @@ class ForestEditorCtrl : public EditTSCtrl
|
||||||
/// Causes the editor to reselect the active forest.
|
/// Causes the editor to reselect the active forest.
|
||||||
bool updateActiveForest( bool createNew );
|
bool updateActiveForest( bool createNew );
|
||||||
|
|
||||||
|
/// Sets the active Forest
|
||||||
|
void setActiveForest(Forest* forestObject) { mForest = forestObject; }
|
||||||
|
|
||||||
/// Returns the active Forest.
|
/// Returns the active Forest.
|
||||||
Forest *getActiveForest() const { return mForest; }
|
Forest *getActiveForest() const { return mForest; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ Point3F Selection<ForestItem>::getOrigin()
|
||||||
|
|
||||||
Selection<ForestItem>::iterator itr = begin();
|
Selection<ForestItem>::iterator itr = begin();
|
||||||
|
|
||||||
for ( ; itr != end(); itr++ )
|
for (; itr != end(); ++itr)
|
||||||
{
|
{
|
||||||
const MatrixF &mat = itr->getTransform();
|
const MatrixF &mat = itr->getTransform();
|
||||||
Point3F wPos;
|
Point3F wPos;
|
||||||
|
|
@ -450,10 +450,11 @@ void ForestSelectionTool::onRender2D()
|
||||||
F32 hscale = wwidth * 2 / F32(mEditor->getWidth());
|
F32 hscale = wwidth * 2 / F32(mEditor->getWidth());
|
||||||
F32 vscale = wheight * 2 / F32(mEditor->getHeight());
|
F32 vscale = wheight * 2 / F32(mEditor->getHeight());
|
||||||
|
|
||||||
F32 left = (mDragRect.point.x - mEditor->getPosition().x) * hscale - wwidth;
|
Point2I editorPosition = mEditor->getPosition();
|
||||||
F32 right = (mDragRect.point.x - mEditor->getPosition().x + mDragRect.extent.x) * hscale - wwidth;
|
F32 left = (mDragRect.point.x - editorPosition.x) * hscale - wwidth;
|
||||||
F32 top = wheight - vscale * (mDragRect.point.y - mEditor->getPosition().y);
|
F32 right = (mDragRect.point.x - editorPosition.x + mDragRect.extent.x) * hscale - wwidth;
|
||||||
F32 bottom = wheight - vscale * (mDragRect.point.y - mEditor->getPosition().y + mDragRect.extent.y);
|
F32 top = wheight - vscale * (mDragRect.point.y - editorPosition.y);
|
||||||
|
F32 bottom = wheight - vscale * (mDragRect.point.y - editorPosition.y + mDragRect.extent.y);
|
||||||
gDragFrustum.set(lastCameraQuery.ortho, left, right, top, bottom, lastCameraQuery.nearPlane, lastCameraQuery.farPlane, lastCameraQuery.cameraMatrix );
|
gDragFrustum.set(lastCameraQuery.ortho, left, right, top, bottom, lastCameraQuery.nearPlane, lastCameraQuery.farPlane, lastCameraQuery.cameraMatrix );
|
||||||
|
|
||||||
mForest->getData()->getItems( gDragFrustum, &mDragSelection );
|
mForest->getData()->getItems( gDragFrustum, &mDragSelection );
|
||||||
|
|
|
||||||
|
|
@ -354,7 +354,7 @@ void Forest::createNewFile()
|
||||||
|
|
||||||
void Forest::saveDataFile( const char *path )
|
void Forest::saveDataFile( const char *path )
|
||||||
{
|
{
|
||||||
if ( path )
|
if ( path && !String::isEmpty(path))
|
||||||
mDataFileName = StringTable->insert( path );
|
mDataFileName = StringTable->insert( path );
|
||||||
|
|
||||||
if ( mData )
|
if ( mData )
|
||||||
|
|
|
||||||
|
|
@ -355,7 +355,7 @@ bool ForestData::castRay( const Point3F &start, const Point3F &end, RayInfo *out
|
||||||
shortest.t = F32_MAX;
|
shortest.t = F32_MAX;
|
||||||
|
|
||||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||||
for ( ; iter != mBuckets.end(); iter++ )
|
for (; iter != mBuckets.end(); ++iter)
|
||||||
{
|
{
|
||||||
if ( iter->value->castRay( start, end, outInfo, rendered ) )
|
if ( iter->value->castRay( start, end, outInfo, rendered ) )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ void ForestData::clear()
|
||||||
// clean up its sub-cells in its destructor.
|
// clean up its sub-cells in its destructor.
|
||||||
|
|
||||||
BucketTable::Iterator iter = mBuckets.begin();
|
BucketTable::Iterator iter = mBuckets.begin();
|
||||||
for ( ; iter != mBuckets.end(); iter++ ) delete iter->value;
|
for (; iter != mBuckets.end(); ++iter) delete iter->value;
|
||||||
mBuckets.clear();
|
mBuckets.clear();
|
||||||
|
|
||||||
mIsDirty = true;
|
mIsDirty = true;
|
||||||
|
|
@ -408,7 +408,7 @@ const ForestItem& ForestData::findItem( ForestItemKey key ) const
|
||||||
|
|
||||||
Vector<const ForestCell*> stack;
|
Vector<const ForestCell*> stack;
|
||||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||||
for ( ; iter != mBuckets.end(); iter++ )
|
for (; iter != mBuckets.end(); ++iter)
|
||||||
stack.push_back( iter->value );
|
stack.push_back( iter->value );
|
||||||
|
|
||||||
// Now loop till we run out of cells.
|
// Now loop till we run out of cells.
|
||||||
|
|
@ -444,7 +444,7 @@ U32 ForestData::getItems( Vector<ForestItem> *outItems ) const
|
||||||
U32 count = 0;
|
U32 count = 0;
|
||||||
|
|
||||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||||
for ( ; iter != mBuckets.end(); iter++ )
|
for (; iter != mBuckets.end(); ++iter)
|
||||||
stack.push_back( iter->value );
|
stack.push_back( iter->value );
|
||||||
|
|
||||||
// Now loop till we run out of cells.
|
// Now loop till we run out of cells.
|
||||||
|
|
@ -520,7 +520,7 @@ U32 ForestData::getItems( const Box3F &box, Vector<ForestItem> *outItems ) const
|
||||||
U32 count = 0;
|
U32 count = 0;
|
||||||
|
|
||||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||||
for ( ; iter != mBuckets.end(); iter++ )
|
for (; iter != mBuckets.end(); ++iter)
|
||||||
stack.push_back( iter->value );
|
stack.push_back( iter->value );
|
||||||
|
|
||||||
// Now loop till we run out of cells.
|
// Now loop till we run out of cells.
|
||||||
|
|
@ -571,7 +571,7 @@ U32 ForestData::getItems( const Point3F &point, F32 radius, Vector<ForestItem> *
|
||||||
U32 count = 0;
|
U32 count = 0;
|
||||||
|
|
||||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||||
for ( ; iter != mBuckets.end(); iter++ )
|
for (; iter != mBuckets.end(); ++iter)
|
||||||
stack.push_back( iter->value );
|
stack.push_back( iter->value );
|
||||||
|
|
||||||
const F32 radiusSq = radius * radius;
|
const F32 radiusSq = radius * radius;
|
||||||
|
|
@ -629,7 +629,7 @@ U32 ForestData::getItems( const Point2F &point, F32 radius, Vector<ForestItem> *
|
||||||
U32 count = 0;
|
U32 count = 0;
|
||||||
|
|
||||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||||
for ( ; iter != mBuckets.end(); iter++ )
|
for (; iter != mBuckets.end(); ++iter)
|
||||||
stack.push_back( iter->value );
|
stack.push_back( iter->value );
|
||||||
|
|
||||||
const F32 radiusSq = radius * radius;
|
const F32 radiusSq = radius * radius;
|
||||||
|
|
@ -686,7 +686,7 @@ U32 ForestData::getItems( const ForestItemData *data, Vector<ForestItem> *outIte
|
||||||
U32 count = 0;
|
U32 count = 0;
|
||||||
|
|
||||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||||
for ( ; iter != mBuckets.end(); iter++ )
|
for (; iter != mBuckets.end(); ++iter)
|
||||||
stack.push_back( iter->value );
|
stack.push_back( iter->value );
|
||||||
|
|
||||||
// Now loop till we run out of cells.
|
// Now loop till we run out of cells.
|
||||||
|
|
@ -724,7 +724,7 @@ void ForestData::getCells( const Frustum &frustum, Vector<ForestCell*> *outCells
|
||||||
PROFILE_SCOPE( ForestData_getCells_frustum );
|
PROFILE_SCOPE( ForestData_getCells_frustum );
|
||||||
|
|
||||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||||
for ( ; iter != mBuckets.end(); iter++ )
|
for (; iter != mBuckets.end(); ++iter)
|
||||||
{
|
{
|
||||||
if ( !frustum.isCulled( iter->value->getBounds() ) )
|
if ( !frustum.isCulled( iter->value->getBounds() ) )
|
||||||
outCells->push_back( iter->value );
|
outCells->push_back( iter->value );
|
||||||
|
|
@ -736,7 +736,7 @@ void ForestData::getCells( Vector<ForestCell*> *outCells ) const
|
||||||
PROFILE_SCOPE( ForestData_getCells_nofrustum );
|
PROFILE_SCOPE( ForestData_getCells_nofrustum );
|
||||||
|
|
||||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||||
for ( ; iter != mBuckets.end(); iter++ )
|
for (; iter != mBuckets.end(); ++iter)
|
||||||
outCells->push_back( iter->value );
|
outCells->push_back( iter->value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -746,7 +746,7 @@ U32 ForestData::getDatablocks( Vector<ForestItemData*> *outVector ) const
|
||||||
U32 count = 0;
|
U32 count = 0;
|
||||||
|
|
||||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||||
for ( ; iter != mBuckets.end(); iter++ )
|
for (; iter != mBuckets.end(); ++iter)
|
||||||
stack.push_back( iter->value );
|
stack.push_back( iter->value );
|
||||||
|
|
||||||
// Now loop till we run out of cells.
|
// Now loop till we run out of cells.
|
||||||
|
|
@ -786,7 +786,7 @@ void ForestData::clearPhysicsRep( Forest *forest )
|
||||||
Vector<ForestCell*> stack;
|
Vector<ForestCell*> stack;
|
||||||
|
|
||||||
BucketTable::Iterator iter = mBuckets.begin();
|
BucketTable::Iterator iter = mBuckets.begin();
|
||||||
for ( ; iter != mBuckets.end(); iter++ )
|
for (; iter != mBuckets.end(); ++iter)
|
||||||
stack.push_back( iter->value );
|
stack.push_back( iter->value );
|
||||||
|
|
||||||
// Now loop till we run out of cells.
|
// Now loop till we run out of cells.
|
||||||
|
|
@ -812,7 +812,7 @@ void ForestData::buildPhysicsRep( Forest *forest )
|
||||||
Vector<ForestCell*> stack;
|
Vector<ForestCell*> stack;
|
||||||
|
|
||||||
BucketTable::Iterator iter = mBuckets.begin();
|
BucketTable::Iterator iter = mBuckets.begin();
|
||||||
for ( ; iter != mBuckets.end(); iter++ )
|
for (; iter != mBuckets.end(); ++iter)
|
||||||
stack.push_back( iter->value );
|
stack.push_back( iter->value );
|
||||||
|
|
||||||
// Now loop till we run out of cells.
|
// Now loop till we run out of cells.
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ ForestWindMgr::ForestWindMgr()
|
||||||
ForestWindMgr::~ForestWindMgr()
|
ForestWindMgr::~ForestWindMgr()
|
||||||
{
|
{
|
||||||
IdToWindMap::Iterator sourceIter = mSources->begin();
|
IdToWindMap::Iterator sourceIter = mSources->begin();
|
||||||
for( ; sourceIter != mSources->end(); sourceIter++ )
|
for (; sourceIter != mSources->end(); ++sourceIter)
|
||||||
delete (*sourceIter).value;
|
delete (*sourceIter).value;
|
||||||
|
|
||||||
delete mSources;
|
delete mSources;
|
||||||
|
|
@ -185,7 +185,7 @@ void ForestWindMgr::processTick()
|
||||||
PROFILE_SCOPE( ForestWindMgr_AdvanceTime_Cleanup );
|
PROFILE_SCOPE( ForestWindMgr_AdvanceTime_Cleanup );
|
||||||
|
|
||||||
IdToWindMap::Iterator sourceIter = mPrevSources->begin();
|
IdToWindMap::Iterator sourceIter = mPrevSources->begin();
|
||||||
for( ; sourceIter != mPrevSources->end(); sourceIter++ )
|
for (; sourceIter != mPrevSources->end(); ++sourceIter)
|
||||||
{
|
{
|
||||||
ForestWindAccumulator *accum = (*sourceIter).value;
|
ForestWindAccumulator *accum = (*sourceIter).value;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ public:
|
||||||
const Vector<S32>& getLOSDetails() const { return mLOSDetails; }
|
const Vector<S32>& getLOSDetails() const { return mLOSDetails; }
|
||||||
|
|
||||||
// ForestItemData
|
// ForestItemData
|
||||||
const Box3F& getObjBox() const { return mShape ? mShape->bounds : Box3F::Invalid; }
|
const Box3F& getObjBox() const { return mShape ? mShape->bounds : Box3F::Zero; }
|
||||||
bool render( TSRenderState *rdata, const ForestItem& item ) const;
|
bool render( TSRenderState *rdata, const ForestItem& item ) const;
|
||||||
ForestCellBatch* allocateBatch() const;
|
ForestCellBatch* allocateBatch() const;
|
||||||
bool canBillboard( const SceneRenderState *state, const ForestItem &item, F32 distToCamera ) const;
|
bool canBillboard( const SceneRenderState *state, const ForestItem &item, F32 distToCamera ) const;
|
||||||
|
|
|
||||||
|
|
@ -695,9 +695,9 @@ GFXShader* GFXD3D9Device::createShader()
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFXD3D9Device::disableShaders()
|
void GFXD3D9Device::disableShaders(bool force)
|
||||||
{
|
{
|
||||||
setShader( NULL );
|
setShader( NULL, force );
|
||||||
setShaderConstBuffer( NULL );
|
setShaderConstBuffer( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -706,25 +706,24 @@ void GFXD3D9Device::disableShaders()
|
||||||
// and to make sure redundant shader states are not being
|
// and to make sure redundant shader states are not being
|
||||||
// sent to the card.
|
// sent to the card.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void GFXD3D9Device::setShader( GFXShader *shader )
|
void GFXD3D9Device::setShader( GFXShader *shader, bool force )
|
||||||
{
|
{
|
||||||
GFXD3D9Shader *d3dShader = static_cast<GFXD3D9Shader*>( shader );
|
GFXD3D9Shader *d3dShader = static_cast<GFXD3D9Shader*>( shader );
|
||||||
|
|
||||||
IDirect3DPixelShader9 *pixShader = ( d3dShader != NULL ? d3dShader->mPixShader : NULL );
|
IDirect3DPixelShader9 *pixShader = ( d3dShader != NULL ? d3dShader->mPixShader : NULL );
|
||||||
IDirect3DVertexShader9 *vertShader = ( d3dShader ? d3dShader->mVertShader : NULL );
|
IDirect3DVertexShader9 *vertShader = ( d3dShader ? d3dShader->mVertShader : NULL );
|
||||||
|
|
||||||
if( pixShader != mLastPixShader )
|
if( pixShader != mLastPixShader || force )
|
||||||
{
|
{
|
||||||
mD3DDevice->SetPixelShader( pixShader );
|
mD3DDevice->SetPixelShader( pixShader );
|
||||||
mLastPixShader = pixShader;
|
mLastPixShader = pixShader;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( vertShader != mLastVertShader )
|
if( vertShader != mLastVertShader || force )
|
||||||
{
|
{
|
||||||
mD3DDevice->SetVertexShader( vertShader );
|
mD3DDevice->SetVertexShader( vertShader );
|
||||||
mLastVertShader = vertShader;
|
mLastVertShader = vertShader;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ inline void D3D9Assert( HRESULT hr, const char *info )
|
||||||
|
|
||||||
// Typedefs
|
// Typedefs
|
||||||
#define D3DX_FUNCTION(fn_name, fn_return, fn_args) \
|
#define D3DX_FUNCTION(fn_name, fn_return, fn_args) \
|
||||||
typedef fn_return (WINAPI *D3DXFNPTR##fn_name##)##fn_args##;
|
typedef fn_return (WINAPI *D3DXFNPTR##fn_name)fn_args;
|
||||||
#include "gfx/D3D9/d3dx9Functions.h"
|
#include "gfx/D3D9/d3dx9Functions.h"
|
||||||
#undef D3DX_FUNCTION
|
#undef D3DX_FUNCTION
|
||||||
|
|
||||||
|
|
@ -238,7 +238,7 @@ protected:
|
||||||
// }
|
// }
|
||||||
|
|
||||||
virtual GFXShader* createShader();
|
virtual GFXShader* createShader();
|
||||||
void disableShaders();
|
void disableShaders(bool force = false);
|
||||||
|
|
||||||
/// Device helper function
|
/// Device helper function
|
||||||
virtual D3DPRESENT_PARAMETERS setupPresentParams( const GFXVideoMode &mode, const HWND &hwnd ) const = 0;
|
virtual D3DPRESENT_PARAMETERS setupPresentParams( const GFXVideoMode &mode, const HWND &hwnd ) const = 0;
|
||||||
|
|
@ -272,7 +272,7 @@ public:
|
||||||
|
|
||||||
virtual F32 getPixelShaderVersion() const { return mPixVersion; }
|
virtual F32 getPixelShaderVersion() const { return mPixVersion; }
|
||||||
virtual void setPixelShaderVersion( F32 version ){ mPixVersion = version; }
|
virtual void setPixelShaderVersion( F32 version ){ mPixVersion = version; }
|
||||||
virtual void setShader( GFXShader *shader );
|
virtual void setShader( GFXShader *shader, bool force = false );
|
||||||
virtual U32 getNumSamplers() const { return mNumSamplers; }
|
virtual U32 getNumSamplers() const { return mNumSamplers; }
|
||||||
virtual U32 getNumRenderTargets() const { return mNumRenderTargets; }
|
virtual U32 getNumRenderTargets() const { return mNumRenderTargets; }
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ extern _D3DDECLTYPE GFXD3D9DeclType[GFXDeclType_COUNT];
|
||||||
|
|
||||||
#define GFXREVERSE_LOOKUP( tablearray, enumprefix, val ) \
|
#define GFXREVERSE_LOOKUP( tablearray, enumprefix, val ) \
|
||||||
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
|
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
|
||||||
if( (S32)tablearray##[i] == val ) \
|
if( (S32)tablearray[i] == val ) \
|
||||||
{ \
|
{ \
|
||||||
val = i; \
|
val = i; \
|
||||||
break; \
|
break; \
|
||||||
|
|
|
||||||
|
|
@ -47,13 +47,13 @@ _D3DDECLTYPE GFXD3D9DeclType[GFXDeclType_COUNT];
|
||||||
|
|
||||||
#define INIT_LOOKUPTABLE( tablearray, enumprefix, type ) \
|
#define INIT_LOOKUPTABLE( tablearray, enumprefix, type ) \
|
||||||
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
|
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
|
||||||
tablearray##[i] = (##type##)GFX_UNINIT_VAL;
|
tablearray[i] = (type)GFX_UNINIT_VAL;
|
||||||
|
|
||||||
#define VALIDATE_LOOKUPTABLE( tablearray, enumprefix ) \
|
#define VALIDATE_LOOKUPTABLE( tablearray, enumprefix ) \
|
||||||
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
|
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
|
||||||
if( (S32)tablearray##[i] == GFX_UNINIT_VAL ) \
|
if( (S32)tablearray[i] == GFX_UNINIT_VAL ) \
|
||||||
Con::warnf( "GFXD3D9EnumTranslate: Unassigned value in " #tablearray ": %i", i ); \
|
Con::warnf( "GFXD3D9EnumTranslate: Unassigned value in " #tablearray ": %i", i ); \
|
||||||
else if( (S32)tablearray##[i] == GFX_UNSUPPORTED_VAL ) \
|
else if( (S32)tablearray[i] == GFX_UNSUPPORTED_VAL ) \
|
||||||
Con::warnf( "GFXD3D9EnumTranslate: Unsupported value in " #tablearray ": %i", i );
|
Con::warnf( "GFXD3D9EnumTranslate: Unsupported value in " #tablearray ": %i", i );
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -918,17 +918,18 @@ void GFont::importStrip(const char *fileName, U32 padding, U32 kerning)
|
||||||
|
|
||||||
// Allocate a new bitmap for this glyph, taking into account kerning and padding.
|
// Allocate a new bitmap for this glyph, taking into account kerning and padding.
|
||||||
glyphList.increment();
|
glyphList.increment();
|
||||||
glyphList.last().bitmap = new GBitmap(mCharInfoList[i].width + kerning + 2*padding, mCharInfoList[i].height + 2*padding, false, strip->getFormat());
|
GlyphMap& lastGlyphMap = glyphList.last();
|
||||||
glyphList.last().charId = i;
|
lastGlyphMap.bitmap = new GBitmap(mCharInfoList[i].width + kerning + 2 * padding, mCharInfoList[i].height + 2 * padding, false, strip->getFormat());
|
||||||
|
lastGlyphMap.charId = i;
|
||||||
|
|
||||||
// Copy the rect.
|
// Copy the rect.
|
||||||
RectI ri(curWidth, getBaseline() - mCharInfoList[i].yOrigin, glyphList.last().bitmap->getWidth(), glyphList.last().bitmap->getHeight());
|
RectI ri(curWidth, getBaseline() - mCharInfoList[i].yOrigin, lastGlyphMap.bitmap->getWidth(), lastGlyphMap.bitmap->getHeight());
|
||||||
Point2I outRi(0,0);
|
Point2I outRi(0,0);
|
||||||
glyphList.last().bitmap->copyRect(strip, ri, outRi);
|
lastGlyphMap.bitmap->copyRect(strip, ri, outRi);
|
||||||
|
|
||||||
// Update glyph attributes.
|
// Update glyph attributes.
|
||||||
mCharInfoList[i].width = glyphList.last().bitmap->getWidth();
|
mCharInfoList[i].width = lastGlyphMap.bitmap->getWidth();
|
||||||
mCharInfoList[i].height = glyphList.last().bitmap->getHeight();
|
mCharInfoList[i].height = lastGlyphMap.bitmap->getHeight();
|
||||||
mCharInfoList[i].xOffset -= kerning + padding;
|
mCharInfoList[i].xOffset -= kerning + padding;
|
||||||
mCharInfoList[i].xIncrement += kerning;
|
mCharInfoList[i].xIncrement += kerning;
|
||||||
mCharInfoList[i].yOffset -= padding;
|
mCharInfoList[i].yOffset -= padding;
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,6 @@ GFXDevice::GFXDevice()
|
||||||
mAllowRender = true;
|
mAllowRender = true;
|
||||||
mCurrentRenderStyle = RS_Standard;
|
mCurrentRenderStyle = RS_Standard;
|
||||||
mCurrentProjectionOffset = Point2F::Zero;
|
mCurrentProjectionOffset = Point2F::Zero;
|
||||||
mStereoEyeOffset = Point3F::Zero;
|
|
||||||
mCanCurrentlyRender = false;
|
mCanCurrentlyRender = false;
|
||||||
mInitialized = false;
|
mInitialized = false;
|
||||||
|
|
||||||
|
|
@ -197,6 +196,9 @@ GFXDevice::GFXDevice()
|
||||||
#elif defined TORQUE_OS_PS3
|
#elif defined TORQUE_OS_PS3
|
||||||
GFXShader::addGlobalMacro( "TORQUE_OS_PS3" );
|
GFXShader::addGlobalMacro( "TORQUE_OS_PS3" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
mStereoTargets[0] = NULL;
|
||||||
|
mStereoTargets[1] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GFXDrawUtil* GFXDevice::getDrawUtil()
|
GFXDrawUtil* GFXDevice::getDrawUtil()
|
||||||
|
|
@ -733,14 +735,14 @@ void GFXDevice::setLight(U32 stage, GFXLightInfo* light)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Set Light Material
|
// Set Light Material
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void GFXDevice::setLightMaterial(GFXLightMaterial mat)
|
void GFXDevice::setLightMaterial(const GFXLightMaterial& mat)
|
||||||
{
|
{
|
||||||
mCurrentLightMaterial = mat;
|
mCurrentLightMaterial = mat;
|
||||||
mLightMaterialDirty = true;
|
mLightMaterialDirty = true;
|
||||||
mStateDirty = true;
|
mStateDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFXDevice::setGlobalAmbientColor(ColorF color)
|
void GFXDevice::setGlobalAmbientColor(const ColorF& color)
|
||||||
{
|
{
|
||||||
if(mGlobalAmbientColor != color)
|
if(mGlobalAmbientColor != color)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,9 @@ public:
|
||||||
/// The device is about to finish rendering a frame
|
/// The device is about to finish rendering a frame
|
||||||
deEndOfFrame,
|
deEndOfFrame,
|
||||||
|
|
||||||
|
/// The device has rendered a frame and ended the scene
|
||||||
|
dePostFrame,
|
||||||
|
|
||||||
/// The device has started rendering a frame's field (such as for side-by-side rendering)
|
/// The device has started rendering a frame's field (such as for side-by-side rendering)
|
||||||
deStartOfField,
|
deStartOfField,
|
||||||
|
|
||||||
|
|
@ -244,7 +247,12 @@ public:
|
||||||
enum GFXDeviceRenderStyles
|
enum GFXDeviceRenderStyles
|
||||||
{
|
{
|
||||||
RS_Standard = 0,
|
RS_Standard = 0,
|
||||||
RS_StereoSideBySide = (1<<0),
|
RS_StereoSideBySide = (1<<0), // Render into current Render Target side-by-side
|
||||||
|
};
|
||||||
|
|
||||||
|
enum GFXDeviceLimits
|
||||||
|
{
|
||||||
|
NumStereoPorts = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -277,7 +285,19 @@ protected:
|
||||||
Point2F mCurrentProjectionOffset;
|
Point2F mCurrentProjectionOffset;
|
||||||
|
|
||||||
/// Eye offset used when using a stereo rendering style
|
/// Eye offset used when using a stereo rendering style
|
||||||
Point3F mStereoEyeOffset;
|
Point3F mStereoEyeOffset[NumStereoPorts];
|
||||||
|
|
||||||
|
MatrixF mStereoEyeTransforms[NumStereoPorts];
|
||||||
|
MatrixF mInverseStereoEyeTransforms[NumStereoPorts];
|
||||||
|
|
||||||
|
/// Fov port settings
|
||||||
|
FovPort mFovPorts[NumStereoPorts];
|
||||||
|
|
||||||
|
/// Destination viewports for stereo rendering
|
||||||
|
RectI mStereoViewports[NumStereoPorts];
|
||||||
|
|
||||||
|
/// Destination targets for stereo rendering
|
||||||
|
GFXTextureTarget* mStereoTargets[NumStereoPorts];
|
||||||
|
|
||||||
/// This will allow querying to see if a device is initialized and ready to
|
/// This will allow querying to see if a device is initialized and ready to
|
||||||
/// have operations performed on it.
|
/// have operations performed on it.
|
||||||
|
|
@ -323,10 +343,50 @@ public:
|
||||||
void setCurrentProjectionOffset(const Point2F& offset) { mCurrentProjectionOffset = offset; }
|
void setCurrentProjectionOffset(const Point2F& offset) { mCurrentProjectionOffset = offset; }
|
||||||
|
|
||||||
/// Get the current eye offset used during stereo rendering
|
/// Get the current eye offset used during stereo rendering
|
||||||
const Point3F& getStereoEyeOffset() { return mStereoEyeOffset; }
|
const Point3F* getStereoEyeOffsets() { return mStereoEyeOffset; }
|
||||||
|
|
||||||
|
const MatrixF* getStereoEyeTransforms() { return mStereoEyeTransforms; }
|
||||||
|
const MatrixF* getInverseStereoEyeTransforms() { return mInverseStereoEyeTransforms; }
|
||||||
|
|
||||||
/// Set the current eye offset used during stereo rendering
|
/// Set the current eye offset used during stereo rendering
|
||||||
void setStereoEyeOffset(const Point3F& offset) { mStereoEyeOffset = offset; }
|
void setStereoEyeOffsets(Point3F *offsets) { dMemcpy(mStereoEyeOffset, offsets, sizeof(Point3F) * NumStereoPorts); }
|
||||||
|
|
||||||
|
void setStereoEyeTransforms(MatrixF *transforms) { dMemcpy(mStereoEyeTransforms, transforms, sizeof(mStereoEyeTransforms)); dMemcpy(mInverseStereoEyeTransforms, transforms, sizeof(mInverseStereoEyeTransforms)); mInverseStereoEyeTransforms[0].inverse(); mInverseStereoEyeTransforms[1].inverse(); }
|
||||||
|
|
||||||
|
/// Set the current eye offset used during stereo rendering. Assumes NumStereoPorts are available.
|
||||||
|
void setStereoFovPort(const FovPort *ports) { dMemcpy(mFovPorts, ports, sizeof(mFovPorts)); }
|
||||||
|
|
||||||
|
/// Get the current eye offset used during stereo rendering
|
||||||
|
const FovPort* getStereoFovPort() { return mFovPorts; }
|
||||||
|
|
||||||
|
/// Sets stereo viewports
|
||||||
|
void setSteroViewports(const RectI *ports) { dMemcpy(mStereoViewports, ports, sizeof(RectI) * NumStereoPorts); }
|
||||||
|
|
||||||
|
/// Sets stereo render targets
|
||||||
|
void setStereoTargets(GFXTextureTarget **targets) { mStereoTargets[0] = targets[0]; mStereoTargets[1] = targets[1]; }
|
||||||
|
|
||||||
|
RectI* getStereoViewports() { return mStereoViewports; }
|
||||||
|
|
||||||
|
/// Activates a stereo render target, setting the correct viewport to render eye contents.
|
||||||
|
/// If eyeId is -1, set a viewport encompassing the entire size of the render targets.
|
||||||
|
void activateStereoTarget(S32 eyeId)
|
||||||
|
{
|
||||||
|
if (eyeId == -1)
|
||||||
|
{
|
||||||
|
if (mStereoTargets[0])
|
||||||
|
{
|
||||||
|
setActiveRenderTarget(mStereoTargets[0], true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (mStereoTargets[eyeId])
|
||||||
|
{
|
||||||
|
setActiveRenderTarget(mStereoTargets[eyeId], false);
|
||||||
|
}
|
||||||
|
setViewport(mStereoViewports[eyeId]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GFXCardProfiler* getCardProfiler() const { return mCardProfiler; }
|
GFXCardProfiler* getCardProfiler() const { return mCardProfiler; }
|
||||||
|
|
||||||
|
|
@ -722,8 +782,8 @@ public:
|
||||||
/// Returns the number of simultaneous render targets supported by the device.
|
/// Returns the number of simultaneous render targets supported by the device.
|
||||||
virtual U32 getNumRenderTargets() const = 0;
|
virtual U32 getNumRenderTargets() const = 0;
|
||||||
|
|
||||||
virtual void setShader( GFXShader *shader ) {}
|
virtual void setShader( GFXShader *shader, bool force = false ) {}
|
||||||
virtual void disableShaders() {} // TODO Remove when T3D 4.0
|
virtual void disableShaders( bool force = false ) {} // TODO Remove when T3D 4.0
|
||||||
|
|
||||||
/// Set the buffer! (Actual set happens on the next draw call, just like textures, state blocks, etc)
|
/// Set the buffer! (Actual set happens on the next draw call, just like textures, state blocks, etc)
|
||||||
void setShaderConstBuffer(GFXShaderConstBuffer* buffer);
|
void setShaderConstBuffer(GFXShaderConstBuffer* buffer);
|
||||||
|
|
@ -841,8 +901,8 @@ public:
|
||||||
/// because of the state caching stuff.
|
/// because of the state caching stuff.
|
||||||
/// @{
|
/// @{
|
||||||
void setLight(U32 stage, GFXLightInfo* light);
|
void setLight(U32 stage, GFXLightInfo* light);
|
||||||
void setLightMaterial(GFXLightMaterial mat);
|
void setLightMaterial(const GFXLightMaterial& mat);
|
||||||
void setGlobalAmbientColor(ColorF color);
|
void setGlobalAmbientColor(const ColorF& color);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -192,13 +192,13 @@ void GFXTextureManager::cleanupPool()
|
||||||
// This texture is unreferenced, so take the time
|
// This texture is unreferenced, so take the time
|
||||||
// now to completely remove it from the pool.
|
// now to completely remove it from the pool.
|
||||||
TexturePoolMap::Iterator unref = iter;
|
TexturePoolMap::Iterator unref = iter;
|
||||||
iter++;
|
++iter;
|
||||||
unref->value = NULL;
|
unref->value = NULL;
|
||||||
mTexturePool.erase( unref );
|
mTexturePool.erase( unref );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
iter++;
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1041,7 +1041,8 @@ void GFXTextureManager::_validateTexParams( const U32 width, const U32 height,
|
||||||
}
|
}
|
||||||
|
|
||||||
// inOutFormat is not modified by this method
|
// inOutFormat is not modified by this method
|
||||||
bool chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
|
GFXCardProfiler* cardProfiler = GFX->getCardProfiler();
|
||||||
|
bool chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
|
||||||
|
|
||||||
if( !chekFmt )
|
if( !chekFmt )
|
||||||
{
|
{
|
||||||
|
|
@ -1057,16 +1058,16 @@ void GFXTextureManager::_validateTexParams( const U32 width, const U32 height,
|
||||||
{
|
{
|
||||||
case GFXFormatR8G8B8:
|
case GFXFormatR8G8B8:
|
||||||
testingFormat = GFXFormatR8G8B8X8;
|
testingFormat = GFXFormatR8G8B8X8;
|
||||||
chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
|
chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GFXFormatA8:
|
case GFXFormatA8:
|
||||||
testingFormat = GFXFormatR8G8B8A8;
|
testingFormat = GFXFormatR8G8B8A8;
|
||||||
chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
|
chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
|
chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,11 +64,11 @@ public:
|
||||||
const GFXVertexFormat *vertexFormat,
|
const GFXVertexFormat *vertexFormat,
|
||||||
U32 vertexSize,
|
U32 vertexSize,
|
||||||
GFXBufferType bufferType )
|
GFXBufferType bufferType )
|
||||||
: mDevice( device ),
|
: mNumVerts( numVerts ),
|
||||||
mVolatileStart( 0 ),
|
|
||||||
mNumVerts( numVerts ),
|
|
||||||
mVertexSize( vertexSize ),
|
mVertexSize( vertexSize ),
|
||||||
mBufferType( bufferType )
|
mBufferType( bufferType ),
|
||||||
|
mDevice( device ),
|
||||||
|
mVolatileStart( 0 )
|
||||||
{
|
{
|
||||||
if ( vertexFormat )
|
if ( vertexFormat )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -114,10 +114,11 @@ void GFXVertexFormat::addElement( const String& semantic, GFXDeclType type, U32
|
||||||
{
|
{
|
||||||
mDirty = true;
|
mDirty = true;
|
||||||
mElements.increment();
|
mElements.increment();
|
||||||
mElements.last().mStreamIndex = stream;
|
GFXVertexElement& lastElement = mElements.last();
|
||||||
mElements.last().mSemantic = semantic.intern();
|
lastElement.mStreamIndex = stream;
|
||||||
mElements.last().mSemanticIndex = index;
|
lastElement.mSemantic = semantic.intern();
|
||||||
mElements.last().mType = type;
|
lastElement.mSemanticIndex = index;
|
||||||
|
lastElement.mType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
const String& GFXVertexFormat::getDescription() const
|
const String& GFXVertexFormat::getDescription() const
|
||||||
|
|
|
||||||
|
|
@ -811,9 +811,9 @@ GFXShader* GFXGLDevice::createShader()
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GFXGLDevice::setShader( GFXShader *shader )
|
void GFXGLDevice::setShader(GFXShader *shader, bool force)
|
||||||
{
|
{
|
||||||
if(mCurrentShader == shader)
|
if(mCurrentShader == shader && !force)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( shader )
|
if ( shader )
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ public:
|
||||||
virtual F32 getPixelShaderVersion() const { return mPixelShaderVersion; }
|
virtual F32 getPixelShaderVersion() const { return mPixelShaderVersion; }
|
||||||
virtual void setPixelShaderVersion( F32 version ) { mPixelShaderVersion = version; }
|
virtual void setPixelShaderVersion( F32 version ) { mPixelShaderVersion = version; }
|
||||||
|
|
||||||
virtual void setShader(GFXShader* shd);
|
virtual void setShader(GFXShader *shader, bool force = false);
|
||||||
|
|
||||||
/// @attention GL cannot check if the given format supports blending or filtering!
|
/// @attention GL cannot check if the given format supports blending or filtering!
|
||||||
virtual GFXFormat selectSupportedFormat(GFXTextureProfile *profile,
|
virtual GFXFormat selectSupportedFormat(GFXTextureProfile *profile,
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include "gui/3d/guiTSControl.h"
|
#include "gui/3d/guiTSControl.h"
|
||||||
|
#include "gui/core/guiOffscreenCanvas.h"
|
||||||
|
|
||||||
#include "console/engineAPI.h"
|
#include "console/engineAPI.h"
|
||||||
#include "scene/sceneManager.h"
|
#include "scene/sceneManager.h"
|
||||||
|
|
@ -34,7 +35,12 @@
|
||||||
#include "scene/reflectionManager.h"
|
#include "scene/reflectionManager.h"
|
||||||
#include "postFx/postEffectManager.h"
|
#include "postFx/postEffectManager.h"
|
||||||
#include "gfx/gfxTransformSaver.h"
|
#include "gfx/gfxTransformSaver.h"
|
||||||
|
#include "gfx/gfxDrawUtil.h"
|
||||||
|
#include "gfx/gfxDebugEvent.h"
|
||||||
|
|
||||||
|
GFXTextureObject *gLastStereoTexture = NULL;
|
||||||
|
|
||||||
|
#define TS_OVERLAY_SCREEN_WIDTH 0.75
|
||||||
|
|
||||||
IMPLEMENT_CONOBJECT( GuiTSCtrl );
|
IMPLEMENT_CONOBJECT( GuiTSCtrl );
|
||||||
|
|
||||||
|
|
@ -51,6 +57,7 @@ ConsoleDocClass( GuiTSCtrl,
|
||||||
);
|
);
|
||||||
|
|
||||||
U32 GuiTSCtrl::smFrameCount = 0;
|
U32 GuiTSCtrl::smFrameCount = 0;
|
||||||
|
bool GuiTSCtrl::smUseLatestDisplayTransform = true;
|
||||||
Vector<GuiTSCtrl*> GuiTSCtrl::smAwakeTSCtrls;
|
Vector<GuiTSCtrl*> GuiTSCtrl::smAwakeTSCtrls;
|
||||||
|
|
||||||
ImplementEnumType( GuiTSRenderStyles,
|
ImplementEnumType( GuiTSRenderStyles,
|
||||||
|
|
@ -60,7 +67,6 @@ ImplementEnumType( GuiTSRenderStyles,
|
||||||
{ GuiTSCtrl::RenderStyleStereoSideBySide, "stereo side by side" },
|
{ GuiTSCtrl::RenderStyleStereoSideBySide, "stereo side by side" },
|
||||||
EndImplementEnumType;
|
EndImplementEnumType;
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
|
@ -153,7 +159,8 @@ GuiTSCtrl::GuiTSCtrl()
|
||||||
mLastCameraQuery.nearPlane = 0.01f;
|
mLastCameraQuery.nearPlane = 0.01f;
|
||||||
|
|
||||||
mLastCameraQuery.projectionOffset = Point2F::Zero;
|
mLastCameraQuery.projectionOffset = Point2F::Zero;
|
||||||
mLastCameraQuery.eyeOffset = Point3F::Zero;
|
mLastCameraQuery.hasFovPort = false;
|
||||||
|
mLastCameraQuery.hasStereoTargets = false;
|
||||||
|
|
||||||
mLastCameraQuery.ortho = false;
|
mLastCameraQuery.ortho = false;
|
||||||
}
|
}
|
||||||
|
|
@ -192,6 +199,8 @@ void GuiTSCtrl::consoleInit()
|
||||||
{
|
{
|
||||||
Con::addVariable("$TSControl::frameCount", TypeS32, &smFrameCount, "The number of frames that have been rendered since this control was created.\n"
|
Con::addVariable("$TSControl::frameCount", TypeS32, &smFrameCount, "The number of frames that have been rendered since this control was created.\n"
|
||||||
"@ingroup Rendering\n");
|
"@ingroup Rendering\n");
|
||||||
|
Con::addVariable("$TSControl::useLatestDisplayTransform", TypeBool, &smUseLatestDisplayTransform, "Use the latest view transform when rendering stereo instead of the one calculated by the last move.\n"
|
||||||
|
"@ingroup Rendering\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -206,6 +215,9 @@ bool GuiTSCtrl::onWake()
|
||||||
"GuiTSCtrl::onWake - This control is already in the awake list!" );
|
"GuiTSCtrl::onWake - This control is already in the awake list!" );
|
||||||
smAwakeTSCtrls.push_back( this );
|
smAwakeTSCtrls.push_back( this );
|
||||||
|
|
||||||
|
// For VR
|
||||||
|
mLastCameraQuery.drawCanvas = getRoot();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -302,11 +314,52 @@ F32 GuiTSCtrl::calculateViewDistance(F32 radius)
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static FovPort CalculateFovPortForCanvas(const RectI viewport, const CameraQuery &cameraQuery)
|
||||||
|
{
|
||||||
|
F32 wwidth;
|
||||||
|
F32 wheight;
|
||||||
|
F32 renderWidth = viewport.extent.x;
|
||||||
|
F32 renderHeight = viewport.extent.y;
|
||||||
|
F32 aspectRatio = renderWidth / renderHeight;
|
||||||
|
|
||||||
|
// Use the FOV to calculate the viewport height scale
|
||||||
|
// then generate the width scale from the aspect ratio.
|
||||||
|
if(!cameraQuery.ortho)
|
||||||
|
{
|
||||||
|
wheight = /*cameraQuery.nearPlane * */ mTan(cameraQuery.fov / 2.0f);
|
||||||
|
wwidth = aspectRatio * wheight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wheight = cameraQuery.fov;
|
||||||
|
wwidth = aspectRatio * wheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
F32 hscale = wwidth * 2.0f / renderWidth;
|
||||||
|
F32 vscale = wheight * 2.0f / renderHeight;
|
||||||
|
|
||||||
|
F32 left = 0.0f * hscale - wwidth;
|
||||||
|
F32 right = renderWidth * hscale - wwidth;
|
||||||
|
F32 top = wheight - vscale * 0.0f;
|
||||||
|
F32 bottom = wheight - vscale * renderHeight;
|
||||||
|
|
||||||
|
FovPort fovPort;
|
||||||
|
fovPort.upTan = top;
|
||||||
|
fovPort.downTan = -bottom;
|
||||||
|
fovPort.leftTan = -left;
|
||||||
|
fovPort.rightTan = right;
|
||||||
|
|
||||||
|
return fovPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
{
|
{
|
||||||
// Save the current transforms so we can restore
|
// Save the current transforms so we can restore
|
||||||
// it for child control rendering below.
|
// it for child control rendering below.
|
||||||
GFXTransformSaver saver;
|
GFXTransformSaver saver;
|
||||||
|
bool renderingToTarget = false;
|
||||||
|
|
||||||
if(!processCameraQuery(&mLastCameraQuery))
|
if(!processCameraQuery(&mLastCameraQuery))
|
||||||
{
|
{
|
||||||
|
|
@ -317,15 +370,70 @@ void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GFXTargetRef origTarget = GFX->getActiveRenderTarget();
|
||||||
|
|
||||||
// Set up the appropriate render style
|
// Set up the appropriate render style
|
||||||
U32 prevRenderStyle = GFX->getCurrentRenderStyle();
|
U32 prevRenderStyle = GFX->getCurrentRenderStyle();
|
||||||
Point2F prevProjectionOffset = GFX->getCurrentProjectionOffset();
|
Point2F prevProjectionOffset = GFX->getCurrentProjectionOffset();
|
||||||
Point3F prevEyeOffset = GFX->getStereoEyeOffset();
|
Point2I renderSize = getExtent();
|
||||||
|
|
||||||
if(mRenderStyle == RenderStyleStereoSideBySide)
|
if(mRenderStyle == RenderStyleStereoSideBySide)
|
||||||
{
|
{
|
||||||
GFX->setCurrentRenderStyle(GFXDevice::RS_StereoSideBySide);
|
GFX->setCurrentRenderStyle(GFXDevice::RS_StereoSideBySide);
|
||||||
GFX->setCurrentProjectionOffset(mLastCameraQuery.projectionOffset);
|
GFX->setCurrentProjectionOffset(mLastCameraQuery.projectionOffset);
|
||||||
GFX->setStereoEyeOffset(mLastCameraQuery.eyeOffset);
|
GFX->setStereoEyeOffsets(mLastCameraQuery.eyeOffset);
|
||||||
|
|
||||||
|
if (!mLastCameraQuery.hasStereoTargets)
|
||||||
|
{
|
||||||
|
// Need to calculate our current viewport here
|
||||||
|
mLastCameraQuery.stereoViewports[0] = updateRect;
|
||||||
|
mLastCameraQuery.stereoViewports[0].extent.x /= 2;
|
||||||
|
mLastCameraQuery.stereoViewports[1] = mLastCameraQuery.stereoViewports[0];
|
||||||
|
mLastCameraQuery.stereoViewports[1].point.x += mLastCameraQuery.stereoViewports[1].extent.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mLastCameraQuery.hasFovPort)
|
||||||
|
{
|
||||||
|
// Need to make our own fovPort
|
||||||
|
mLastCameraQuery.fovPort[0] = CalculateFovPortForCanvas(mLastCameraQuery.stereoViewports[0], mLastCameraQuery);
|
||||||
|
mLastCameraQuery.fovPort[1] = CalculateFovPortForCanvas(mLastCameraQuery.stereoViewports[1], mLastCameraQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
GFX->setStereoFovPort(mLastCameraQuery.fovPort); // NOTE: this specifies fov for BOTH eyes
|
||||||
|
|
||||||
|
GFX->setSteroViewports(mLastCameraQuery.stereoViewports);
|
||||||
|
GFX->setStereoTargets(mLastCameraQuery.stereoTargets);
|
||||||
|
|
||||||
|
MatrixF myTransforms[2];
|
||||||
|
|
||||||
|
if (smUseLatestDisplayTransform)
|
||||||
|
{
|
||||||
|
// Use the view matrix determined from the display device
|
||||||
|
myTransforms[0] = mLastCameraQuery.eyeTransforms[0];
|
||||||
|
myTransforms[1] = mLastCameraQuery.eyeTransforms[1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Use the view matrix determined from the control object
|
||||||
|
myTransforms[0] = mLastCameraQuery.cameraMatrix;
|
||||||
|
myTransforms[1] = mLastCameraQuery.cameraMatrix;
|
||||||
|
|
||||||
|
QuatF qrot = mLastCameraQuery.cameraMatrix;
|
||||||
|
Point3F pos = mLastCameraQuery.cameraMatrix.getPosition();
|
||||||
|
Point3F rotEyePos;
|
||||||
|
|
||||||
|
myTransforms[0].setPosition(pos + qrot.mulP(mLastCameraQuery.eyeOffset[0], &rotEyePos));
|
||||||
|
myTransforms[1].setPosition(pos + qrot.mulP(mLastCameraQuery.eyeOffset[1], &rotEyePos));
|
||||||
|
}
|
||||||
|
|
||||||
|
GFX->setStereoEyeTransforms(myTransforms);
|
||||||
|
|
||||||
|
// Allow render size to originate from the render target
|
||||||
|
if (mLastCameraQuery.stereoTargets[0])
|
||||||
|
{
|
||||||
|
renderSize = mLastCameraQuery.stereoViewports[0].extent;
|
||||||
|
renderingToTarget = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -354,41 +462,37 @@ void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
mLastCameraQuery.cameraMatrix.mul(rotMat);
|
mLastCameraQuery.cameraMatrix.mul(rotMat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up the camera and viewport stuff:
|
|
||||||
F32 wwidth;
|
|
||||||
F32 wheight;
|
|
||||||
F32 renderWidth = (mRenderStyle == RenderStyleStereoSideBySide) ? F32(getWidth())*0.5f : F32(getWidth());
|
|
||||||
F32 renderHeight = F32(getHeight());
|
|
||||||
F32 aspectRatio = renderWidth / renderHeight;
|
|
||||||
|
|
||||||
// Use the FOV to calculate the viewport height scale
|
|
||||||
// then generate the width scale from the aspect ratio.
|
|
||||||
if(!mLastCameraQuery.ortho)
|
|
||||||
{
|
|
||||||
wheight = mLastCameraQuery.nearPlane * mTan(mLastCameraQuery.fov / 2.0f);
|
|
||||||
wwidth = aspectRatio * wheight;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wheight = mLastCameraQuery.fov;
|
|
||||||
wwidth = aspectRatio * wheight;
|
|
||||||
}
|
|
||||||
|
|
||||||
F32 hscale = wwidth * 2.0f / renderWidth;
|
|
||||||
F32 vscale = wheight * 2.0f / renderHeight;
|
|
||||||
|
|
||||||
Frustum frustum;
|
Frustum frustum;
|
||||||
if(mRenderStyle == RenderStyleStereoSideBySide)
|
if(mRenderStyle == RenderStyleStereoSideBySide)
|
||||||
{
|
{
|
||||||
F32 left = 0.0f * hscale - wwidth;
|
// NOTE: these calculations are essentially overridden later by the fov port settings when rendering each eye.
|
||||||
F32 right = renderWidth * hscale - wwidth;
|
MathUtils::makeFovPortFrustum(&frustum, mLastCameraQuery.ortho, mLastCameraQuery.nearPlane, mLastCameraQuery.farPlane, mLastCameraQuery.fovPort[0]);
|
||||||
F32 top = wheight - vscale * 0.0f;
|
|
||||||
F32 bottom = wheight - vscale * renderHeight;
|
|
||||||
|
|
||||||
frustum.set( mLastCameraQuery.ortho, left, right, top, bottom, mLastCameraQuery.nearPlane, mLastCameraQuery.farPlane );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// set up the camera and viewport stuff:
|
||||||
|
F32 wwidth;
|
||||||
|
F32 wheight;
|
||||||
|
F32 renderWidth = F32(renderSize.x);
|
||||||
|
F32 renderHeight = F32(renderSize.y);
|
||||||
|
F32 aspectRatio = renderWidth / renderHeight;
|
||||||
|
|
||||||
|
// Use the FOV to calculate the viewport height scale
|
||||||
|
// then generate the width scale from the aspect ratio.
|
||||||
|
if(!mLastCameraQuery.ortho)
|
||||||
|
{
|
||||||
|
wheight = mLastCameraQuery.nearPlane * mTan(mLastCameraQuery.fov / 2.0f);
|
||||||
|
wwidth = aspectRatio * wheight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wheight = mLastCameraQuery.fov;
|
||||||
|
wwidth = aspectRatio * wheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
F32 hscale = wwidth * 2.0f / renderWidth;
|
||||||
|
F32 vscale = wheight * 2.0f / renderHeight;
|
||||||
|
|
||||||
F32 left = (updateRect.point.x - offset.x) * hscale - wwidth;
|
F32 left = (updateRect.point.x - offset.x) * hscale - wwidth;
|
||||||
F32 right = (updateRect.point.x + updateRect.extent.x - offset.x) * hscale - wwidth;
|
F32 right = (updateRect.point.x + updateRect.extent.x - offset.x) * hscale - wwidth;
|
||||||
F32 top = wheight - vscale * (updateRect.point.y - offset.y);
|
F32 top = wheight - vscale * (updateRect.point.y - offset.y);
|
||||||
|
|
@ -407,15 +511,24 @@ void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
|
|
||||||
RectI tempRect = updateRect;
|
RectI tempRect = updateRect;
|
||||||
|
|
||||||
#ifdef TORQUE_OS_MAC
|
if (!renderingToTarget)
|
||||||
Point2I screensize = getRoot()->getWindowSize();
|
{
|
||||||
tempRect.point.y = screensize.y - (tempRect.point.y + tempRect.extent.y);
|
#ifdef TORQUE_OS_MAC
|
||||||
#endif
|
Point2I screensize = getRoot()->getWindowSize();
|
||||||
|
tempRect.point.y = screensize.y - (tempRect.point.y + tempRect.extent.y);
|
||||||
|
#endif
|
||||||
|
|
||||||
GFX->setViewport( tempRect );
|
GFX->setViewport( tempRect );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Activate stereo RT
|
||||||
|
GFX->activateStereoTarget(-1);
|
||||||
|
}
|
||||||
|
|
||||||
// Clear the zBuffer so GUI doesn't hose object rendering accidentally
|
// Clear the zBuffer so GUI doesn't hose object rendering accidentally
|
||||||
GFX->clear( GFXClearZBuffer , ColorI(20,20,20), 1.0f, 0 );
|
GFX->clear( GFXClearZBuffer , ColorI(20,20,20), 1.0f, 0 );
|
||||||
|
//GFX->clear( GFXClearTarget, ColorI(255,0,0), 1.0f, 0);
|
||||||
|
|
||||||
GFX->setFrustum( frustum );
|
GFX->setFrustum( frustum );
|
||||||
if(mLastCameraQuery.ortho)
|
if(mLastCameraQuery.ortho)
|
||||||
|
|
@ -427,7 +540,7 @@ void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
// We're going to be displaying this render at size of this control in
|
// We're going to be displaying this render at size of this control in
|
||||||
// pixels - let the scene know so that it can calculate e.g. reflections
|
// pixels - let the scene know so that it can calculate e.g. reflections
|
||||||
// correctly for that final display result.
|
// correctly for that final display result.
|
||||||
gClientSceneGraph->setDisplayTargetResolution(getExtent());
|
gClientSceneGraph->setDisplayTargetResolution(renderSize);
|
||||||
|
|
||||||
// Set the GFX world matrix to the world-to-camera transform, but don't
|
// Set the GFX world matrix to the world-to-camera transform, but don't
|
||||||
// change the cameraMatrix in mLastCameraQuery. This is because
|
// change the cameraMatrix in mLastCameraQuery. This is because
|
||||||
|
|
@ -455,20 +568,121 @@ void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
renderWorld(updateRect);
|
renderWorld(updateRect);
|
||||||
DebugDrawer::get()->render();
|
DebugDrawer::get()->render();
|
||||||
|
|
||||||
|
// Render the canvas overlay if its available
|
||||||
|
if (mRenderStyle == RenderStyleStereoSideBySide && mStereoGuiTarget.getPointer())
|
||||||
|
{
|
||||||
|
GFXDEBUGEVENT_SCOPE( StereoGui_Render, ColorI( 255, 0, 0 ) );
|
||||||
|
MatrixF proj(1);
|
||||||
|
|
||||||
|
Frustum originalFrustum = GFX->getFrustum();
|
||||||
|
GFXTextureObject *texObject = mStereoGuiTarget->getTexture(0);
|
||||||
|
const FovPort *currentFovPort = GFX->getStereoFovPort();
|
||||||
|
const MatrixF *eyeTransforms = GFX->getStereoEyeTransforms();
|
||||||
|
const MatrixF *worldEyeTransforms = GFX->getInverseStereoEyeTransforms();
|
||||||
|
const Point3F *eyeOffset = GFX->getStereoEyeOffsets();
|
||||||
|
|
||||||
|
for (U32 i=0; i<2; i++)
|
||||||
|
{
|
||||||
|
GFX->activateStereoTarget(i);
|
||||||
|
Frustum gfxFrustum = originalFrustum;
|
||||||
|
const F32 frustumDepth = gfxFrustum.getNearDist();
|
||||||
|
MathUtils::makeFovPortFrustum(&gfxFrustum, true, gfxFrustum.getNearDist(), gfxFrustum.getFarDist(), currentFovPort[i], eyeTransforms[i]);
|
||||||
|
GFX->setFrustum(gfxFrustum);
|
||||||
|
|
||||||
|
MatrixF eyeWorldTrans(1);
|
||||||
|
eyeWorldTrans.setPosition(Point3F(eyeOffset[i].x,eyeOffset[i].y,eyeOffset[i].z));
|
||||||
|
MatrixF eyeWorld(1);
|
||||||
|
eyeWorld.mul(eyeWorldTrans);
|
||||||
|
eyeWorld.inverse();
|
||||||
|
|
||||||
|
GFX->setWorldMatrix(eyeWorld);
|
||||||
|
GFX->setViewMatrix(MatrixF::Identity);
|
||||||
|
|
||||||
|
if (!mStereoOverlayVB.getPointer())
|
||||||
|
{
|
||||||
|
mStereoOverlayVB.set(GFX, 4, GFXBufferTypeStatic);
|
||||||
|
GFXVertexPCT *verts = mStereoOverlayVB.lock(0, 4);
|
||||||
|
|
||||||
|
F32 texLeft = 0.0f;
|
||||||
|
F32 texRight = 1.0f;
|
||||||
|
F32 texTop = 1.0f;
|
||||||
|
F32 texBottom = 0.0f;
|
||||||
|
|
||||||
|
F32 rectRatio = gfxFrustum.getWidth() / gfxFrustum.getHeight();
|
||||||
|
F32 rectWidth = gfxFrustum.getWidth() * TS_OVERLAY_SCREEN_WIDTH;
|
||||||
|
F32 rectHeight = rectWidth * rectRatio;
|
||||||
|
|
||||||
|
F32 screenLeft = -rectWidth * 0.5;
|
||||||
|
F32 screenRight = rectWidth * 0.5;
|
||||||
|
F32 screenTop = -rectHeight * 0.5;
|
||||||
|
F32 screenBottom = rectHeight * 0.5;
|
||||||
|
|
||||||
|
const F32 fillConv = 0.0f;
|
||||||
|
const F32 frustumDepth = gfxFrustum.getNearDist() + 0.012;
|
||||||
|
verts[0].point.set( screenLeft - fillConv, frustumDepth, screenTop - fillConv );
|
||||||
|
verts[1].point.set( screenRight - fillConv, frustumDepth, screenTop - fillConv );
|
||||||
|
verts[2].point.set( screenLeft - fillConv, frustumDepth, screenBottom - fillConv );
|
||||||
|
verts[3].point.set( screenRight - fillConv, frustumDepth, screenBottom - fillConv );
|
||||||
|
|
||||||
|
verts[0].color = verts[1].color = verts[2].color = verts[3].color = ColorI(255,255,255,255);
|
||||||
|
|
||||||
|
verts[0].texCoord.set( texLeft, texTop );
|
||||||
|
verts[1].texCoord.set( texRight, texTop );
|
||||||
|
verts[2].texCoord.set( texLeft, texBottom );
|
||||||
|
verts[3].texCoord.set( texRight, texBottom );
|
||||||
|
|
||||||
|
mStereoOverlayVB.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mStereoGuiSB.getPointer())
|
||||||
|
{
|
||||||
|
// DrawBitmapStretchSR
|
||||||
|
GFXStateBlockDesc bitmapStretchSR;
|
||||||
|
bitmapStretchSR.setCullMode(GFXCullNone);
|
||||||
|
bitmapStretchSR.setZReadWrite(false, false);
|
||||||
|
bitmapStretchSR.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
|
||||||
|
bitmapStretchSR.samplersDefined = true;
|
||||||
|
|
||||||
|
bitmapStretchSR.samplers[0] = GFXSamplerStateDesc::getClampLinear();
|
||||||
|
bitmapStretchSR.samplers[0].minFilter = GFXTextureFilterPoint;
|
||||||
|
bitmapStretchSR.samplers[0].mipFilter = GFXTextureFilterPoint;
|
||||||
|
bitmapStretchSR.samplers[0].magFilter = GFXTextureFilterPoint;
|
||||||
|
|
||||||
|
mStereoGuiSB = GFX->createStateBlock(bitmapStretchSR);
|
||||||
|
}
|
||||||
|
|
||||||
|
GFX->setVertexBuffer(mStereoOverlayVB);
|
||||||
|
GFX->setStateBlock(mStereoGuiSB);
|
||||||
|
GFX->setTexture( 0, texObject );
|
||||||
|
GFX->setupGenericShaders( GFXDevice::GSModColorTexture );
|
||||||
|
GFX->drawPrimitive( GFXTriangleStrip, 0, 2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Restore the previous matrix state before
|
// Restore the previous matrix state before
|
||||||
// we begin rendering the child controls.
|
// we begin rendering the child controls.
|
||||||
saver.restore();
|
saver.restore();
|
||||||
|
|
||||||
// Restore the render style and any stereo parameters
|
// Restore the render style and any stereo parameters
|
||||||
|
GFX->setActiveRenderTarget(origTarget);
|
||||||
GFX->setCurrentRenderStyle(prevRenderStyle);
|
GFX->setCurrentRenderStyle(prevRenderStyle);
|
||||||
GFX->setCurrentProjectionOffset(prevProjectionOffset);
|
GFX->setCurrentProjectionOffset(prevProjectionOffset);
|
||||||
GFX->setStereoEyeOffset(prevEyeOffset);
|
|
||||||
|
|
||||||
|
if(mRenderStyle == RenderStyleStereoSideBySide && gLastStereoTexture)
|
||||||
|
{
|
||||||
|
GFX->setClipRect(updateRect);
|
||||||
|
GFX->getDrawUtil()->drawBitmapStretch(gLastStereoTexture, updateRect);
|
||||||
|
}
|
||||||
|
|
||||||
// Allow subclasses to render 2D elements.
|
// Allow subclasses to render 2D elements.
|
||||||
GFX->setClipRect(updateRect);
|
GFX->setClipRect(updateRect);
|
||||||
renderGui( offset, updateRect );
|
renderGui( offset, updateRect );
|
||||||
|
|
||||||
renderChildControls(offset, updateRect);
|
if (shouldRenderChildControls())
|
||||||
|
{
|
||||||
|
renderChildControls(offset, updateRect);
|
||||||
|
}
|
||||||
smFrameCount++;
|
smFrameCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -499,6 +713,12 @@ void GuiTSCtrl::drawLineList( const Vector<Point3F> &points, const ColorI color,
|
||||||
drawLine( points[i], points[i+1], color, width );
|
drawLine( points[i], points[i+1], color, width );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiTSCtrl::setStereoGui(GuiOffscreenCanvas *canvas)
|
||||||
|
{
|
||||||
|
mStereoGuiTarget = canvas ? canvas->getTarget() : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// Console Methods.
|
// Console Methods.
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
@ -547,3 +767,10 @@ DefineEngineMethod( GuiTSCtrl, calculateViewDistance, F32, ( F32 radius ),,
|
||||||
{
|
{
|
||||||
return object->calculateViewDistance( radius );
|
return object->calculateViewDistance( radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefineEngineMethod( GuiTSCtrl, setStereoGui, void, ( GuiOffscreenCanvas* canvas ),,
|
||||||
|
"Sets the current stereo texture to an offscreen canvas\n"
|
||||||
|
"@param canvas The desired canvas." )
|
||||||
|
{
|
||||||
|
object->setStereoGui(canvas);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,16 +30,31 @@
|
||||||
#include "math/mMath.h"
|
#include "math/mMath.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _MATTEXTURETARGET_H_
|
||||||
|
#include "materials/matTextureTarget.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class IDisplayDevice;
|
||||||
|
class GuiOffscreenCanvas;
|
||||||
|
|
||||||
struct CameraQuery
|
struct CameraQuery
|
||||||
{
|
{
|
||||||
SimObject* object;
|
SimObject* object;
|
||||||
F32 nearPlane;
|
F32 nearPlane;
|
||||||
F32 farPlane;
|
F32 farPlane;
|
||||||
F32 fov;
|
F32 fov;
|
||||||
|
FovPort fovPort[2]; // fov for each eye
|
||||||
Point2F projectionOffset;
|
Point2F projectionOffset;
|
||||||
Point3F eyeOffset;
|
Point3F eyeOffset[2];
|
||||||
|
MatrixF eyeTransforms[2];
|
||||||
bool ortho;
|
bool ortho;
|
||||||
|
bool hasFovPort;
|
||||||
|
bool hasStereoTargets;
|
||||||
MatrixF cameraMatrix;
|
MatrixF cameraMatrix;
|
||||||
|
RectI stereoViewports[2]; // destination viewports
|
||||||
|
GFXTextureTarget* stereoTargets[2];
|
||||||
|
GuiCanvas* drawCanvas; // Canvas we are drawing to. Needed for VR
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Abstract base class for 3D viewport GUIs.
|
/// Abstract base class for 3D viewport GUIs.
|
||||||
|
|
@ -50,11 +65,12 @@ class GuiTSCtrl : public GuiContainer
|
||||||
public:
|
public:
|
||||||
enum RenderStyles {
|
enum RenderStyles {
|
||||||
RenderStyleStandard = 0,
|
RenderStyleStandard = 0,
|
||||||
RenderStyleStereoSideBySide = (1<<0),
|
RenderStyleStereoSideBySide = (1<<0)
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static U32 smFrameCount;
|
static U32 smFrameCount;
|
||||||
|
static bool smUseLatestDisplayTransform;
|
||||||
F32 mCameraZRot;
|
F32 mCameraZRot;
|
||||||
F32 mForceFOV;
|
F32 mForceFOV;
|
||||||
|
|
||||||
|
|
@ -85,6 +101,10 @@ protected:
|
||||||
/// @see getLastCameraQuery
|
/// @see getLastCameraQuery
|
||||||
CameraQuery mLastCameraQuery;
|
CameraQuery mLastCameraQuery;
|
||||||
|
|
||||||
|
NamedTexTargetRef mStereoGuiTarget;
|
||||||
|
GFXVertexBufferHandle<GFXVertexPCT> mStereoOverlayVB;
|
||||||
|
GFXStateBlockRef mStereoGuiSB;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GuiTSCtrl();
|
GuiTSCtrl();
|
||||||
|
|
@ -155,6 +175,10 @@ public:
|
||||||
|
|
||||||
static const U32& getFrameCount() { return smFrameCount; }
|
static const U32& getFrameCount() { return smFrameCount; }
|
||||||
|
|
||||||
|
bool shouldRenderChildControls() { return mRenderStyle == RenderStyleStandard; }
|
||||||
|
|
||||||
|
void setStereoGui(GuiOffscreenCanvas *canvas);
|
||||||
|
|
||||||
DECLARE_CONOBJECT(GuiTSCtrl);
|
DECLARE_CONOBJECT(GuiTSCtrl);
|
||||||
DECLARE_CATEGORY( "Gui 3D" );
|
DECLARE_CATEGORY( "Gui 3D" );
|
||||||
DECLARE_DESCRIPTION( "Abstract base class for controls that render a 3D viewport." );
|
DECLARE_DESCRIPTION( "Abstract base class for controls that render a 3D viewport." );
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ class GuiContainer : public GuiControl
|
||||||
inline void setAnchorRight(bool val) { mSizingOptions.mAnchorRight = val; }
|
inline void setAnchorRight(bool val) { mSizingOptions.mAnchorRight = val; }
|
||||||
|
|
||||||
ControlSizing getSizingOptions() const { return mSizingOptions; }
|
ControlSizing getSizingOptions() const { return mSizingOptions; }
|
||||||
void setSizingOptions(ControlSizing val) { mSizingOptions = val; }
|
void setSizingOptions(const ControlSizing& val) { mSizingOptions = val; }
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,7 @@ class GuiRolloutCtrl : public GuiTickCtrl
|
||||||
|
|
||||||
DECLARE_CALLBACK( void, onCollapsed, () );
|
DECLARE_CALLBACK( void, onCollapsed, () );
|
||||||
/// @}
|
/// @}
|
||||||
|
virtual void processTick();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -152,7 +153,6 @@ class GuiRolloutCtrl : public GuiTickCtrl
|
||||||
|
|
||||||
// Sizing Animation Functions
|
// Sizing Animation Functions
|
||||||
void animateTo( S32 height );
|
void animateTo( S32 height );
|
||||||
virtual void processTick();
|
|
||||||
|
|
||||||
void collapse() { animateTo( mHeader.extent.y ); }
|
void collapse() { animateTo( mHeader.extent.y ); }
|
||||||
void expand() { animateTo( mExpanded.extent.y ); }
|
void expand() { animateTo( mExpanded.extent.y ); }
|
||||||
|
|
|
||||||
|
|
@ -1091,8 +1091,9 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render Up Arrow.
|
// Render Up Arrow.
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[upArrowBitmap] );
|
drawUtil->clearBitmapModulation();
|
||||||
|
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[upArrowBitmap]);
|
||||||
|
|
||||||
// Update Pos.
|
// Update Pos.
|
||||||
pos.y += mBitmapBounds[upArrowBitmap].extent.y;
|
pos.y += mBitmapBounds[upArrowBitmap].extent.y;
|
||||||
|
|
@ -1118,8 +1119,8 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
|
||||||
if ( trackRect.extent.y > 0 )
|
if ( trackRect.extent.y > 0 )
|
||||||
{
|
{
|
||||||
// Render Track.
|
// Render Track.
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR( mTextureObject, trackRect, mBitmapBounds[trackBitmap] );
|
drawUtil->drawBitmapStretchSR(mTextureObject, trackRect, mBitmapBounds[trackBitmap]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Pos.
|
// Update Pos.
|
||||||
|
|
@ -1137,8 +1138,8 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render Down Arrow.
|
// Render Down Arrow.
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[downArrowBitmap] );
|
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[downArrowBitmap]);
|
||||||
|
|
||||||
// Render the Thumb?
|
// Render the Thumb?
|
||||||
if ( !mVBarEnabled )
|
if ( !mVBarEnabled )
|
||||||
|
|
@ -1163,8 +1164,8 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render Thumb Top.
|
// Render Thumb Top.
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[thumbBitmapTop] );
|
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[thumbBitmapTop]);
|
||||||
|
|
||||||
// Update Pos.
|
// Update Pos.
|
||||||
pos.y += mBitmapBounds[thumbBitmapTop].extent.y;
|
pos.y += mBitmapBounds[thumbBitmapTop].extent.y;
|
||||||
|
|
@ -1179,16 +1180,16 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
|
||||||
if ( thumbRect.extent.y > 0 )
|
if ( thumbRect.extent.y > 0 )
|
||||||
{
|
{
|
||||||
// Render Track.
|
// Render Track.
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR( mTextureObject, thumbRect, mBitmapBounds[thumbBitmapMiddle] );
|
drawUtil->drawBitmapStretchSR(mTextureObject, thumbRect, mBitmapBounds[thumbBitmapMiddle]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Pos.
|
// Update Pos.
|
||||||
pos.y += thumbRect.extent.y;
|
pos.y += thumbRect.extent.y;
|
||||||
|
|
||||||
// Render the Thumb Bottom.
|
// Render the Thumb Bottom.
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[thumbBitmapBottom] );
|
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[thumbBitmapBottom]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -1215,8 +1216,9 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render Up Arrow.
|
// Render Up Arrow.
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[leftArrowBitmap] );
|
drawUtil->clearBitmapModulation();
|
||||||
|
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[leftArrowBitmap]);
|
||||||
|
|
||||||
// Update Pos.
|
// Update Pos.
|
||||||
pos.x += mBitmapBounds[leftArrowBitmap].extent.x;
|
pos.x += mBitmapBounds[leftArrowBitmap].extent.x;
|
||||||
|
|
@ -1242,8 +1244,8 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
|
||||||
if ( trackRect.extent.x > 0 )
|
if ( trackRect.extent.x > 0 )
|
||||||
{
|
{
|
||||||
// Render Track.
|
// Render Track.
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR( mTextureObject, trackRect, mBitmapBounds[trackBitmap] );
|
drawUtil->drawBitmapStretchSR(mTextureObject, trackRect, mBitmapBounds[trackBitmap]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Pos.
|
// Update Pos.
|
||||||
|
|
@ -1261,8 +1263,8 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render Right Arrow.
|
// Render Right Arrow.
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[rightArrowBitmap] );
|
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[rightArrowBitmap]);
|
||||||
|
|
||||||
// Render the Thumb?
|
// Render the Thumb?
|
||||||
if ( !mHBarEnabled )
|
if ( !mHBarEnabled )
|
||||||
|
|
@ -1287,8 +1289,8 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render Thumb Left.
|
// Render Thumb Left.
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[thumbBitmapLeft] );
|
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[thumbBitmapLeft]);
|
||||||
|
|
||||||
// Update Pos.
|
// Update Pos.
|
||||||
pos.x += mBitmapBounds[thumbBitmapLeft].extent.x;
|
pos.x += mBitmapBounds[thumbBitmapLeft].extent.x;
|
||||||
|
|
@ -1303,16 +1305,16 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
|
||||||
if ( thumbRect.extent.x > 0 )
|
if ( thumbRect.extent.x > 0 )
|
||||||
{
|
{
|
||||||
// Render Track.
|
// Render Track.
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR( mTextureObject, thumbRect, mBitmapBounds[thumbBitmapMiddle] );
|
drawUtil->drawBitmapStretchSR(mTextureObject, thumbRect, mBitmapBounds[thumbBitmapMiddle]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Pos.
|
// Update Pos.
|
||||||
pos.x += thumbRect.extent.x;
|
pos.x += thumbRect.extent.x;
|
||||||
|
|
||||||
// Render the Thumb Bottom.
|
// Render the Thumb Bottom.
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[thumbBitmapRight] );
|
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[thumbBitmapRight]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ bool GuiSplitContainer::layoutControls( RectI &clientRect )
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void GuiSplitContainer::solvePanelConstraints( Point2I newDragPos, GuiContainer * firstPanel, GuiContainer * secondPanel, RectI clientRect )
|
void GuiSplitContainer::solvePanelConstraints(Point2I newDragPos, GuiContainer * firstPanel, GuiContainer * secondPanel, const RectI& clientRect)
|
||||||
{
|
{
|
||||||
if( !firstPanel || !secondPanel )
|
if( !firstPanel || !secondPanel )
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ public:
|
||||||
virtual inline Point2I getSplitPoint() { return mSplitPoint; };
|
virtual inline Point2I getSplitPoint() { return mSplitPoint; };
|
||||||
/// The Splitters entire Client Rectangle, this takes into account padding of this control
|
/// The Splitters entire Client Rectangle, this takes into account padding of this control
|
||||||
virtual inline RectI getSplitRect() { return mSplitRect; };
|
virtual inline RectI getSplitRect() { return mSplitRect; };
|
||||||
virtual void solvePanelConstraints( Point2I newDragPos, GuiContainer * firstPanel, GuiContainer * secondPanel, RectI clientRect );
|
virtual void solvePanelConstraints(Point2I newDragPos, GuiContainer * firstPanel, GuiContainer * secondPanel, const RectI& clientRect);
|
||||||
virtual Point2I getMinExtent() const;
|
virtual Point2I getMinExtent() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -548,7 +548,7 @@ void GuiTabBookCtrl::renderTabs( const Point2I &offset, const RectI &tabRect )
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void GuiTabBookCtrl::renderTab( RectI tabRect, GuiTabPageCtrl *tab )
|
void GuiTabBookCtrl::renderTab(const RectI& tabRect, GuiTabPageCtrl *tab)
|
||||||
{
|
{
|
||||||
StringTableEntry text = tab->getText();
|
StringTableEntry text = tab->getText();
|
||||||
ColorI oldColor;
|
ColorI oldColor;
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ class GuiTabBookCtrl : public GuiContainer
|
||||||
/// Tab rendering subroutine, renders one tab with specified options
|
/// Tab rendering subroutine, renders one tab with specified options
|
||||||
/// @param tabRect the rectangle to render the tab into
|
/// @param tabRect the rectangle to render the tab into
|
||||||
/// @param tab pointer to the tab page control for which to render the tab
|
/// @param tab pointer to the tab page control for which to render the tab
|
||||||
void renderTab( RectI tabRect, GuiTabPageCtrl* tab );
|
void renderTab(const RectI& tabRect, GuiTabPageCtrl* tab);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1294,11 +1294,13 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
|
|
||||||
winRect.extent.x += 1;
|
winRect.extent.x += 1;
|
||||||
|
|
||||||
GFX->getDrawUtil()->drawRectFill(winRect, mProfile->mFillColor);
|
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||||
|
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->drawRectFill(winRect, mProfile->mFillColor);
|
||||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset, mBitmapBounds[topBase]);
|
|
||||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[topBase+1].extent.x, offset.y),
|
drawUtil->clearBitmapModulation();
|
||||||
|
drawUtil->drawBitmapSR(mTextureObject, offset, mBitmapBounds[topBase]);
|
||||||
|
drawUtil->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[topBase+1].extent.x, offset.y),
|
||||||
mBitmapBounds[topBase + 1]);
|
mBitmapBounds[topBase + 1]);
|
||||||
|
|
||||||
RectI destRect;
|
RectI destRect;
|
||||||
|
|
@ -1308,7 +1310,7 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
destRect.extent.y = mBitmapBounds[topBase + 2].extent.y;
|
destRect.extent.y = mBitmapBounds[topBase + 2].extent.y;
|
||||||
RectI stretchRect = mBitmapBounds[topBase + 2];
|
RectI stretchRect = mBitmapBounds[topBase + 2];
|
||||||
stretchRect.inset(1,0);
|
stretchRect.inset(1,0);
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||||
|
|
||||||
destRect.point.x = offset.x;
|
destRect.point.x = offset.x;
|
||||||
destRect.point.y = offset.y + mBitmapBounds[topBase].extent.y;
|
destRect.point.y = offset.y + mBitmapBounds[topBase].extent.y;
|
||||||
|
|
@ -1316,7 +1318,7 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
destRect.extent.y = getHeight() - mBitmapBounds[topBase].extent.y - mBitmapBounds[BorderBottomLeft].extent.y;
|
destRect.extent.y = getHeight() - mBitmapBounds[topBase].extent.y - mBitmapBounds[BorderBottomLeft].extent.y;
|
||||||
stretchRect = mBitmapBounds[BorderLeft];
|
stretchRect = mBitmapBounds[BorderLeft];
|
||||||
stretchRect.inset(0,1);
|
stretchRect.inset(0,1);
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||||
|
|
||||||
destRect.point.x = offset.x + getWidth() - mBitmapBounds[BorderRight].extent.x;
|
destRect.point.x = offset.x + getWidth() - mBitmapBounds[BorderRight].extent.x;
|
||||||
destRect.extent.x = mBitmapBounds[BorderRight].extent.x;
|
destRect.extent.x = mBitmapBounds[BorderRight].extent.x;
|
||||||
|
|
@ -1325,10 +1327,10 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
|
|
||||||
stretchRect = mBitmapBounds[BorderRight];
|
stretchRect = mBitmapBounds[BorderRight];
|
||||||
stretchRect.inset(0,1);
|
stretchRect.inset(0,1);
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||||
|
|
||||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset + Point2I(0, getHeight() - mBitmapBounds[BorderBottomLeft].extent.y), mBitmapBounds[BorderBottomLeft]);
|
drawUtil->drawBitmapSR(mTextureObject, offset + Point2I(0, getHeight() - mBitmapBounds[BorderBottomLeft].extent.y), mBitmapBounds[BorderBottomLeft]);
|
||||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset + getExtent() - mBitmapBounds[BorderBottomRight].extent, mBitmapBounds[BorderBottomRight]);
|
drawUtil->drawBitmapSR(mTextureObject, offset + getExtent() - mBitmapBounds[BorderBottomRight].extent, mBitmapBounds[BorderBottomRight]);
|
||||||
|
|
||||||
destRect.point.x = offset.x + mBitmapBounds[BorderBottomLeft].extent.x;
|
destRect.point.x = offset.x + mBitmapBounds[BorderBottomLeft].extent.x;
|
||||||
destRect.extent.x = getWidth() - mBitmapBounds[BorderBottomLeft].extent.x - mBitmapBounds[BorderBottomRight].extent.x;
|
destRect.extent.x = getWidth() - mBitmapBounds[BorderBottomLeft].extent.x - mBitmapBounds[BorderBottomRight].extent.x;
|
||||||
|
|
@ -1338,13 +1340,13 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
stretchRect = mBitmapBounds[BorderBottom];
|
stretchRect = mBitmapBounds[BorderBottom];
|
||||||
stretchRect.inset(1,0);
|
stretchRect.inset(1,0);
|
||||||
|
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||||
|
|
||||||
// Draw the title
|
// Draw the title
|
||||||
// dhc addition: copied/modded from renderJustifiedText, since we enforce a
|
// dhc addition: copied/modded from renderJustifiedText, since we enforce a
|
||||||
// different color usage here. NOTE: it currently CAN overdraw the controls
|
// different color usage here. NOTE: it currently CAN overdraw the controls
|
||||||
// if mis-positioned or 'scrunched' in a small width.
|
// if mis-positioned or 'scrunched' in a small width.
|
||||||
GFX->getDrawUtil()->setBitmapModulation(mProfile->mFontColor);
|
drawUtil->setBitmapModulation(mProfile->mFontColor);
|
||||||
S32 textWidth = mProfile->mFont->getStrWidth((const UTF8 *)mText);
|
S32 textWidth = mProfile->mFont->getStrWidth((const UTF8 *)mText);
|
||||||
Point2I start(0,0);
|
Point2I start(0,0);
|
||||||
|
|
||||||
|
|
@ -1359,7 +1361,7 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
if( textWidth > winRect.extent.x ) start.set( 0, 0 );
|
if( textWidth > winRect.extent.x ) start.set( 0, 0 );
|
||||||
// center the vertical
|
// center the vertical
|
||||||
// start.y = ( winRect.extent.y - ( font->getHeight() - 2 ) ) / 2;
|
// start.y = ( winRect.extent.y - ( font->getHeight() - 2 ) ) / 2;
|
||||||
GFX->getDrawUtil()->drawText( mProfile->mFont, start + offset + mProfile->mTextOffset, mText );
|
drawUtil->drawText( mProfile->mFont, start + offset + mProfile->mTextOffset, mText );
|
||||||
|
|
||||||
// Deal with rendering the titlebar controls
|
// Deal with rendering the titlebar controls
|
||||||
AssertFatal(root, "Unable to get the root GuiCanvas.");
|
AssertFatal(root, "Unable to get the root GuiCanvas.");
|
||||||
|
|
@ -1378,8 +1380,8 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
bmp += BmpHilite;
|
bmp += BmpHilite;
|
||||||
}
|
}
|
||||||
|
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset + mCloseButton.point, mBitmapBounds[bmp]);
|
drawUtil->drawBitmapSR(mTextureObject, offset + mCloseButton.point, mBitmapBounds[bmp]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the maximize button
|
// Draw the maximize button
|
||||||
|
|
@ -1397,8 +1399,8 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
bmp += BmpHilite;
|
bmp += BmpHilite;
|
||||||
}
|
}
|
||||||
|
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, offset + mMaximizeButton.point, mBitmapBounds[bmp] );
|
drawUtil->drawBitmapSR( mTextureObject, offset + mMaximizeButton.point, mBitmapBounds[bmp] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the minimize button
|
// Draw the minimize button
|
||||||
|
|
@ -1416,8 +1418,8 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
bmp += BmpHilite;
|
bmp += BmpHilite;
|
||||||
}
|
}
|
||||||
|
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, offset + mMinimizeButton.point, mBitmapBounds[bmp] );
|
drawUtil->drawBitmapSR( mTextureObject, offset + mMinimizeButton.point, mBitmapBounds[bmp] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !mMinimized )
|
if( !mMinimized )
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,8 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
{
|
{
|
||||||
GFX->setClipRect(updateRect);
|
GFX->setClipRect(updateRect);
|
||||||
|
|
||||||
|
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||||
|
|
||||||
//draw the outline
|
//draw the outline
|
||||||
RectI winRect;
|
RectI winRect;
|
||||||
winRect.point = offset;
|
winRect.point = offset;
|
||||||
|
|
@ -148,11 +150,11 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
winRect.extent.y -= mBitmapBounds[BorderTop].extent.y + mBitmapBounds[BorderBottom].extent.y;
|
winRect.extent.y -= mBitmapBounds[BorderTop].extent.y + mBitmapBounds[BorderBottom].extent.y;
|
||||||
|
|
||||||
if(mProfile->mOpaque)
|
if(mProfile->mOpaque)
|
||||||
GFX->getDrawUtil()->drawRectFill(winRect, mProfile->mFillColor);
|
drawUtil->drawRectFill(winRect, mProfile->mFillColor);
|
||||||
|
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset, mBitmapBounds[BorderTopLeft]);
|
drawUtil->drawBitmapSR(mTextureObject, offset, mBitmapBounds[BorderTopLeft]);
|
||||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[BorderTopRight].extent.x, offset.y),
|
drawUtil->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[BorderTopRight].extent.x, offset.y),
|
||||||
mBitmapBounds[BorderTopRight]);
|
mBitmapBounds[BorderTopRight]);
|
||||||
|
|
||||||
RectI destRect;
|
RectI destRect;
|
||||||
|
|
@ -162,7 +164,7 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
destRect.extent.y = mBitmapBounds[BorderTop].extent.y;
|
destRect.extent.y = mBitmapBounds[BorderTop].extent.y;
|
||||||
RectI stretchRect = mBitmapBounds[BorderTop];
|
RectI stretchRect = mBitmapBounds[BorderTop];
|
||||||
stretchRect.inset(1,0);
|
stretchRect.inset(1,0);
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||||
|
|
||||||
destRect.point.x = offset.x;
|
destRect.point.x = offset.x;
|
||||||
destRect.point.y = offset.y + mBitmapBounds[BorderTopLeft].extent.y;
|
destRect.point.y = offset.y + mBitmapBounds[BorderTopLeft].extent.y;
|
||||||
|
|
@ -170,7 +172,7 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
destRect.extent.y = getHeight() - mBitmapBounds[BorderTopLeft].extent.y - mBitmapBounds[BorderBottomLeft].extent.y;
|
destRect.extent.y = getHeight() - mBitmapBounds[BorderTopLeft].extent.y - mBitmapBounds[BorderBottomLeft].extent.y;
|
||||||
stretchRect = mBitmapBounds[BorderLeft];
|
stretchRect = mBitmapBounds[BorderLeft];
|
||||||
stretchRect.inset(0,1);
|
stretchRect.inset(0,1);
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||||
|
|
||||||
destRect.point.x = offset.x + getWidth() - mBitmapBounds[BorderRight].extent.x;
|
destRect.point.x = offset.x + getWidth() - mBitmapBounds[BorderRight].extent.x;
|
||||||
destRect.extent.x = mBitmapBounds[BorderRight].extent.x;
|
destRect.extent.x = mBitmapBounds[BorderRight].extent.x;
|
||||||
|
|
@ -179,10 +181,10 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
|
|
||||||
stretchRect = mBitmapBounds[BorderRight];
|
stretchRect = mBitmapBounds[BorderRight];
|
||||||
stretchRect.inset(0,1);
|
stretchRect.inset(0,1);
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||||
|
|
||||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset + Point2I(0, getHeight() - mBitmapBounds[BorderBottomLeft].extent.y), mBitmapBounds[BorderBottomLeft]);
|
drawUtil->drawBitmapSR(mTextureObject, offset + Point2I(0, getHeight() - mBitmapBounds[BorderBottomLeft].extent.y), mBitmapBounds[BorderBottomLeft]);
|
||||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset + getExtent() - mBitmapBounds[BorderBottomRight].extent, mBitmapBounds[BorderBottomRight]);
|
drawUtil->drawBitmapSR(mTextureObject, offset + getExtent() - mBitmapBounds[BorderBottomRight].extent, mBitmapBounds[BorderBottomRight]);
|
||||||
|
|
||||||
destRect.point.x = offset.x + mBitmapBounds[BorderBottomLeft].extent.x;
|
destRect.point.x = offset.x + mBitmapBounds[BorderBottomLeft].extent.x;
|
||||||
destRect.extent.x = getWidth() - mBitmapBounds[BorderBottomLeft].extent.x - mBitmapBounds[BorderBottomRight].extent.x;
|
destRect.extent.x = getWidth() - mBitmapBounds[BorderBottomLeft].extent.x - mBitmapBounds[BorderBottomRight].extent.x;
|
||||||
|
|
@ -192,6 +194,6 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
stretchRect = mBitmapBounds[BorderBottom];
|
stretchRect = mBitmapBounds[BorderBottom];
|
||||||
stretchRect.inset(1,0);
|
stretchRect.inset(1,0);
|
||||||
|
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@ void GuiGameListMenuCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
{
|
{
|
||||||
GuiGameListMenuProfile * profile = (GuiGameListMenuProfile *) mProfile;
|
GuiGameListMenuProfile * profile = (GuiGameListMenuProfile *) mProfile;
|
||||||
|
|
||||||
|
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||||
|
|
||||||
F32 xScale = (float) getWidth() / profile->getRowWidth();
|
F32 xScale = (float) getWidth() / profile->getRowWidth();
|
||||||
|
|
||||||
bool profileHasIcons = profile->hasArrows();
|
bool profileHasIcons = profile->hasArrows();
|
||||||
|
|
@ -121,19 +123,19 @@ void GuiGameListMenuCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
}
|
}
|
||||||
|
|
||||||
// render the row bitmap
|
// render the row bitmap
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset, rowExtent), profile->getBitmapArrayRect(buttonTextureIndex));
|
drawUtil->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset, rowExtent), profile->getBitmapArrayRect(buttonTextureIndex));
|
||||||
|
|
||||||
// render the row icon if it has one
|
// render the row icon if it has one
|
||||||
if ((iconIndex != NO_ICON) && profileHasIcons && (! profile->getBitmapArrayRect((U32)iconIndex).extent.isZero()))
|
if ((iconIndex != NO_ICON) && profileHasIcons && (! profile->getBitmapArrayRect((U32)iconIndex).extent.isZero()))
|
||||||
{
|
{
|
||||||
iconIndex += Profile::TEX_FIRST_ICON;
|
iconIndex += Profile::TEX_FIRST_ICON;
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset + iconOffset, iconExtent), profile->getBitmapArrayRect(iconIndex));
|
drawUtil->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset + iconOffset, iconExtent), profile->getBitmapArrayRect(iconIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
// render the row text
|
// render the row text
|
||||||
GFX->getDrawUtil()->setBitmapModulation(fontColor);
|
drawUtil->setBitmapModulation(fontColor);
|
||||||
renderJustifiedText(currentOffset + textOffset, textExtent, (*row)->mLabel);
|
renderJustifiedText(currentOffset + textOffset, textExtent, (*row)->mLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -249,8 +249,9 @@ bool GuiGradientCtrl::onAdd()
|
||||||
{
|
{
|
||||||
Parent::onAdd();
|
Parent::onAdd();
|
||||||
|
|
||||||
S32 l = getBounds().point.x + mSwatchFactor, r = getBounds().point.x + getBounds().extent.x - mSwatchFactor;
|
RectI bounds = getBounds();
|
||||||
S32 t = getBounds().point.y, b = getBounds().point.y + getBounds().extent.y - mSwatchFactor;
|
S32 l = bounds.point.x + mSwatchFactor, r = bounds.point.x + bounds.extent.x - mSwatchFactor;
|
||||||
|
S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y - mSwatchFactor;
|
||||||
mBlendRangeBox = RectI( Point2I(l, t), Point2I(r, b) );
|
mBlendRangeBox = RectI( Point2I(l, t), Point2I(r, b) );
|
||||||
|
|
||||||
setupDefaultRange();
|
setupDefaultRange();
|
||||||
|
|
@ -331,15 +332,17 @@ void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<Col
|
||||||
mBlendRangeBox.point = globalToLocalCoord(Point2I(l, t));
|
mBlendRangeBox.point = globalToLocalCoord(Point2I(l, t));
|
||||||
mBlendRangeBox.extent = globalToLocalCoord(Point2I(r, b));
|
mBlendRangeBox.extent = globalToLocalCoord(Point2I(r, b));
|
||||||
|
|
||||||
|
ColorRange& firstColorRange = colorRange.first();
|
||||||
|
|
||||||
if(colorRange.size() == 1) // Only one color to draw
|
if(colorRange.size() == 1) // Only one color to draw
|
||||||
{
|
{
|
||||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||||
|
|
||||||
PrimBuild::color( colorRange.first().swatch->getColor() );
|
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||||
PrimBuild::vertex2i( l, t );
|
PrimBuild::vertex2i( l, t );
|
||||||
PrimBuild::vertex2i( l, b );
|
PrimBuild::vertex2i( l, b );
|
||||||
|
|
||||||
PrimBuild::color( colorRange.first().swatch->getColor() );
|
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||||
PrimBuild::vertex2i( r, b );
|
PrimBuild::vertex2i( r, b );
|
||||||
PrimBuild::vertex2i( r, t );
|
PrimBuild::vertex2i( r, t );
|
||||||
|
|
||||||
|
|
@ -349,13 +352,13 @@ void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<Col
|
||||||
{
|
{
|
||||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||||
|
|
||||||
PrimBuild::color( colorRange.first().swatch->getColor() );
|
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||||
PrimBuild::vertex2i( l, t );
|
PrimBuild::vertex2i( l, t );
|
||||||
PrimBuild::vertex2i( l, b );
|
PrimBuild::vertex2i( l, b );
|
||||||
|
|
||||||
PrimBuild::color( colorRange.first().swatch->getColor() );
|
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||||
PrimBuild::vertex2i( l + colorRange.first().swatch->getPosition().x, b );
|
PrimBuild::vertex2i(l + firstColorRange.swatch->getPosition().x, b);
|
||||||
PrimBuild::vertex2i( l + colorRange.first().swatch->getPosition().x, t );
|
PrimBuild::vertex2i(l + firstColorRange.swatch->getPosition().x, t);
|
||||||
|
|
||||||
PrimBuild::end();
|
PrimBuild::end();
|
||||||
|
|
||||||
|
|
@ -377,13 +380,15 @@ void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<Col
|
||||||
PrimBuild::end();
|
PrimBuild::end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ColorRange& lastColorRange = colorRange.last();
|
||||||
|
|
||||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||||
|
|
||||||
PrimBuild::color( colorRange.last().swatch->getColor() );
|
PrimBuild::color(lastColorRange.swatch->getColor());
|
||||||
PrimBuild::vertex2i( l + colorRange.last().swatch->getPosition().x, t );
|
PrimBuild::vertex2i(l + lastColorRange.swatch->getPosition().x, t);
|
||||||
PrimBuild::vertex2i( l + colorRange.last().swatch->getPosition().x, b );
|
PrimBuild::vertex2i(l + lastColorRange.swatch->getPosition().x, b);
|
||||||
|
|
||||||
PrimBuild::color( colorRange.last().swatch->getColor() );
|
PrimBuild::color(lastColorRange.swatch->getColor());
|
||||||
PrimBuild::vertex2i( r, b );
|
PrimBuild::vertex2i( r, b );
|
||||||
PrimBuild::vertex2i( r, t );
|
PrimBuild::vertex2i( r, t );
|
||||||
|
|
||||||
|
|
@ -521,7 +526,7 @@ void GuiGradientCtrl::reInitSwatches( GuiGradientCtrl::PickMode )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiGradientCtrl::addColorRange( Point2I pos, ColorF color )
|
void GuiGradientCtrl::addColorRange(Point2I pos, const ColorF& color)
|
||||||
{
|
{
|
||||||
if( pos.x + mSwatchFactor < mBlendRangeBox.point.x &&
|
if( pos.x + mSwatchFactor < mBlendRangeBox.point.x &&
|
||||||
pos.x + mSwatchFactor > mBlendRangeBox.extent.x )
|
pos.x + mSwatchFactor > mBlendRangeBox.extent.x )
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ public:
|
||||||
void inspectPreApply();
|
void inspectPreApply();
|
||||||
void inspectPostApply();
|
void inspectPostApply();
|
||||||
void reInitSwatches( GuiGradientCtrl::PickMode );
|
void reInitSwatches( GuiGradientCtrl::PickMode );
|
||||||
void addColorRange( Point2I pos, ColorF color );
|
void addColorRange(Point2I pos, const ColorF& color);
|
||||||
void removeColorRange( GuiGradientSwatchCtrl* swatch );
|
void removeColorRange( GuiGradientSwatchCtrl* swatch );
|
||||||
void sortColorRange();
|
void sortColorRange();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -677,7 +677,7 @@ DefineEngineMethod( GuiListBoxCtrl, setItemColor, void, (S32 index, ColorF color
|
||||||
object->setItemColor( index, color );
|
object->setItemColor( index, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiListBoxCtrl::setItemColor( S32 index, ColorF color )
|
void GuiListBoxCtrl::setItemColor(S32 index, const ColorF& color)
|
||||||
{
|
{
|
||||||
if ((index >= mItems.size()) || index < 0)
|
if ((index >= mItems.size()) || index < 0)
|
||||||
{
|
{
|
||||||
|
|
@ -748,11 +748,6 @@ S32 GuiListBoxCtrl::insertItem( S32 index, StringTableEntry text, void *itemData
|
||||||
}
|
}
|
||||||
|
|
||||||
LBItem *newItem = new LBItem;
|
LBItem *newItem = new LBItem;
|
||||||
if( !newItem )
|
|
||||||
{
|
|
||||||
Con::warnf("GuiListBoxCtrl::insertItem - error allocating item memory!" );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assign item data
|
// Assign item data
|
||||||
newItem->itemText = StringTable->insert(text, true);
|
newItem->itemText = StringTable->insert(text, true);
|
||||||
|
|
@ -792,11 +787,6 @@ S32 GuiListBoxCtrl::insertItemWithColor( S32 index, StringTableEntry text, Color
|
||||||
}
|
}
|
||||||
|
|
||||||
LBItem *newItem = new LBItem;
|
LBItem *newItem = new LBItem;
|
||||||
if( !newItem )
|
|
||||||
{
|
|
||||||
Con::warnf("GuiListBoxCtrl::insertItem - error allocating item memory!" );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assign item data
|
// Assign item data
|
||||||
newItem->itemText = StringTable->insert(text, true);
|
newItem->itemText = StringTable->insert(text, true);
|
||||||
|
|
@ -1090,7 +1080,7 @@ void GuiListBoxCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
GFX->setClipRect( oldClipRect );
|
GFX->setClipRect( oldClipRect );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiListBoxCtrl::onRenderItem( RectI itemRect, LBItem *item )
|
void GuiListBoxCtrl::onRenderItem(const RectI& itemRect, LBItem *item)
|
||||||
{
|
{
|
||||||
if( item->isSelected )
|
if( item->isSelected )
|
||||||
GFX->getDrawUtil()->drawRectFill( itemRect, mProfile->mFillColorSEL );
|
GFX->getDrawUtil()->drawRectFill( itemRect, mProfile->mFillColorSEL );
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ public:
|
||||||
S32 insertItemWithColor( S32 index, StringTableEntry text, ColorF color = ColorF(-1, -1, -1), void *itemData = NULL);
|
S32 insertItemWithColor( S32 index, StringTableEntry text, ColorF color = ColorF(-1, -1, -1), void *itemData = NULL);
|
||||||
S32 findItemText( StringTableEntry text, bool caseSensitive = false );
|
S32 findItemText( StringTableEntry text, bool caseSensitive = false );
|
||||||
|
|
||||||
void setItemColor(S32 index, ColorF color);
|
void setItemColor(S32 index, const ColorF& color);
|
||||||
void clearItemColor(S32 index);
|
void clearItemColor(S32 index);
|
||||||
|
|
||||||
void deleteItem( S32 index );
|
void deleteItem( S32 index );
|
||||||
|
|
@ -128,7 +128,7 @@ public:
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
virtual void onRender( Point2I offset, const RectI &updateRect );
|
virtual void onRender( Point2I offset, const RectI &updateRect );
|
||||||
virtual void onRenderItem( RectI itemRect, LBItem *item );
|
virtual void onRenderItem(const RectI& itemRect, LBItem *item);
|
||||||
void drawBox( const Point2I &box, S32 size, ColorI &outlineColor, ColorI &boxColor );
|
void drawBox( const Point2I &box, S32 size, ColorI &outlineColor, ColorI &boxColor );
|
||||||
bool renderTooltip( const Point2I &hoverPos, const Point2I& cursorPos, const char* tipText );
|
bool renderTooltip( const Point2I &hoverPos, const Point2I& cursorPos, const char* tipText );
|
||||||
void addFilteredItem( String item );
|
void addFilteredItem( String item );
|
||||||
|
|
|
||||||
|
|
@ -852,6 +852,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
if ( mScrollDir != GuiScrollCtrl::None )
|
if ( mScrollDir != GuiScrollCtrl::None )
|
||||||
autoScroll();
|
autoScroll();
|
||||||
|
|
||||||
|
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||||
|
|
||||||
RectI r( offset, getExtent() );
|
RectI r( offset, getExtent() );
|
||||||
if ( mInAction )
|
if ( mInAction )
|
||||||
{
|
{
|
||||||
|
|
@ -868,30 +870,30 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//renderSlightlyLoweredBox(r, mProfile);
|
//renderSlightlyLoweredBox(r, mProfile);
|
||||||
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColor );
|
drawUtil->drawRectFill( r, mProfile->mFillColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a bitmap over the background?
|
// Draw a bitmap over the background?
|
||||||
if ( mTextureDepressed )
|
if ( mTextureDepressed )
|
||||||
{
|
{
|
||||||
RectI rect(offset, mBitmapBounds);
|
RectI rect(offset, mBitmapBounds);
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureDepressed, rect );
|
drawUtil->drawBitmapStretch( mTextureDepressed, rect );
|
||||||
}
|
}
|
||||||
else if ( mTextureNormal )
|
else if ( mTextureNormal )
|
||||||
{
|
{
|
||||||
RectI rect(offset, mBitmapBounds);
|
RectI rect(offset, mBitmapBounds);
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
|
drawUtil->drawBitmapStretch( mTextureNormal, rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we render a bitmap border or lines?
|
// Do we render a bitmap border or lines?
|
||||||
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
||||||
{
|
{
|
||||||
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
|
drawUtil->drawLine( l, t, l, b, colorWhite );
|
||||||
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
|
drawUtil->drawLine( l, t, r2, t, colorWhite );
|
||||||
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
||||||
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -912,24 +914,24 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorHL );
|
drawUtil->drawRectFill( r, mProfile->mFillColorHL );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a bitmap over the background?
|
// Draw a bitmap over the background?
|
||||||
if ( mTextureNormal )
|
if ( mTextureNormal )
|
||||||
{
|
{
|
||||||
RectI rect( offset, mBitmapBounds );
|
RectI rect( offset, mBitmapBounds );
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
|
drawUtil->drawBitmapStretch( mTextureNormal, rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we render a bitmap border or lines?
|
// Do we render a bitmap border or lines?
|
||||||
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
||||||
{
|
{
|
||||||
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
|
drawUtil->drawLine( l, t, l, b, colorWhite );
|
||||||
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
|
drawUtil->drawLine( l, t, r2, t, colorWhite );
|
||||||
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
||||||
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -942,21 +944,21 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorNA );
|
drawUtil->drawRectFill( r, mProfile->mFillColorNA );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a bitmap over the background?
|
// Draw a bitmap over the background?
|
||||||
if ( mTextureNormal )
|
if ( mTextureNormal )
|
||||||
{
|
{
|
||||||
RectI rect(offset, mBitmapBounds);
|
RectI rect(offset, mBitmapBounds);
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
|
drawUtil->drawBitmapStretch( mTextureNormal, rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we render a bitmap border or lines?
|
// Do we render a bitmap border or lines?
|
||||||
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
||||||
{
|
{
|
||||||
GFX->getDrawUtil()->drawRect( r, mProfile->mBorderColorNA );
|
drawUtil->drawRect( r, mProfile->mBorderColorNA );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// renderSlightlyRaisedBox(r, mProfile); // Used to be the only 'else' condition to mInAction above.
|
// renderSlightlyRaisedBox(r, mProfile); // Used to be the only 'else' condition to mInAction above.
|
||||||
|
|
@ -1027,8 +1029,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
{
|
{
|
||||||
Point2I coloredboxsize( 15, 10 );
|
Point2I coloredboxsize( 15, 10 );
|
||||||
RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y );
|
RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y );
|
||||||
GFX->getDrawUtil()->drawRectFill( r, boxColor);
|
drawUtil->drawRectFill( r, boxColor);
|
||||||
GFX->getDrawUtil()->drawRect( r, ColorI(0,0,0));
|
drawUtil->drawRect( r, ColorI(0,0,0));
|
||||||
|
|
||||||
localStart.x += coloredboxsize.x + mProfile->mTextOffset.x;
|
localStart.x += coloredboxsize.x + mProfile->mTextOffset.x;
|
||||||
}
|
}
|
||||||
|
|
@ -1036,7 +1038,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
// Draw the text
|
// Draw the text
|
||||||
Point2I globalStart = localToGlobalCoord( localStart );
|
Point2I globalStart = localToGlobalCoord( localStart );
|
||||||
ColorI fontColor = mActive ? ( mInAction ? mProfile->mFontColor : mProfile->mFontColorNA ) : mProfile->mFontColorNA;
|
ColorI fontColor = mActive ? ( mInAction ? mProfile->mFontColor : mProfile->mFontColorNA ) : mProfile->mFontColorNA;
|
||||||
GFX->getDrawUtil()->setBitmapModulation( fontColor ); // was: (mProfile->mFontColor);
|
drawUtil->setBitmapModulation( fontColor ); // was: (mProfile->mFontColor);
|
||||||
|
|
||||||
// Get the number of columns in the text
|
// Get the number of columns in the text
|
||||||
S32 colcount = getColumnCount( mText, "\t" );
|
S32 colcount = getColumnCount( mText, "\t" );
|
||||||
|
|
@ -1048,7 +1050,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
|
|
||||||
// Draw the first column
|
// Draw the first column
|
||||||
getColumn( mText, buff, 0, "\t" );
|
getColumn( mText, buff, 0, "\t" );
|
||||||
GFX->getDrawUtil()->drawText( mProfile->mFont, globalStart, buff, mProfile->mFontColors );
|
drawUtil->drawText( mProfile->mFont, globalStart, buff, mProfile->mFontColors );
|
||||||
|
|
||||||
// Draw the second column to the right
|
// Draw the second column to the right
|
||||||
getColumn( mText, buff, 1, "\t" );
|
getColumn( mText, buff, 1, "\t" );
|
||||||
|
|
@ -1059,17 +1061,17 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
||||||
// right cap of the border.
|
// right cap of the border.
|
||||||
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
|
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
|
||||||
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) );
|
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) );
|
||||||
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
|
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - 12, localStart.y ) );
|
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - 12, localStart.y ) );
|
||||||
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
|
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
GFX->getDrawUtil()->drawText( mProfile->mFont, globalStart, mText, mProfile->mFontColors );
|
drawUtil->drawText( mProfile->mFont, globalStart, mText, mProfile->mFontColors );
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're rendering a bitmap border, then it will take care of the arrow.
|
// If we're rendering a bitmap border, then it will take care of the arrow.
|
||||||
|
|
|
||||||
|
|
@ -1034,6 +1034,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
||||||
if ( mScrollDir != GuiScrollCtrl::None )
|
if ( mScrollDir != GuiScrollCtrl::None )
|
||||||
autoScroll();
|
autoScroll();
|
||||||
|
|
||||||
|
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||||
|
|
||||||
RectI r( offset, getExtent() );
|
RectI r( offset, getExtent() );
|
||||||
if ( mInAction )
|
if ( mInAction )
|
||||||
{
|
{
|
||||||
|
|
@ -1050,30 +1052,30 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//renderSlightlyLoweredBox(r, mProfile);
|
//renderSlightlyLoweredBox(r, mProfile);
|
||||||
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColor );
|
drawUtil->drawRectFill( r, mProfile->mFillColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a bitmap over the background?
|
// Draw a bitmap over the background?
|
||||||
if ( mTextureDepressed )
|
if ( mTextureDepressed )
|
||||||
{
|
{
|
||||||
RectI rect(offset, mBitmapBounds);
|
RectI rect(offset, mBitmapBounds);
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureDepressed, rect );
|
drawUtil->drawBitmapStretch( mTextureDepressed, rect );
|
||||||
}
|
}
|
||||||
else if ( mTextureNormal )
|
else if ( mTextureNormal )
|
||||||
{
|
{
|
||||||
RectI rect(offset, mBitmapBounds);
|
RectI rect(offset, mBitmapBounds);
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
|
drawUtil->drawBitmapStretch( mTextureNormal, rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we render a bitmap border or lines?
|
// Do we render a bitmap border or lines?
|
||||||
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
||||||
{
|
{
|
||||||
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
|
drawUtil->drawLine( l, t, l, b, colorWhite );
|
||||||
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
|
drawUtil->drawLine( l, t, r2, t, colorWhite );
|
||||||
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
||||||
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1094,24 +1096,24 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorHL );
|
drawUtil->drawRectFill( r, mProfile->mFillColorHL );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a bitmap over the background?
|
// Draw a bitmap over the background?
|
||||||
if ( mTextureNormal )
|
if ( mTextureNormal )
|
||||||
{
|
{
|
||||||
RectI rect( offset, mBitmapBounds );
|
RectI rect( offset, mBitmapBounds );
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
|
drawUtil->drawBitmapStretch( mTextureNormal, rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we render a bitmap border or lines?
|
// Do we render a bitmap border or lines?
|
||||||
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
||||||
{
|
{
|
||||||
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
|
drawUtil->drawLine( l, t, l, b, colorWhite );
|
||||||
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
|
drawUtil->drawLine( l, t, r2, t, colorWhite );
|
||||||
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
||||||
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1124,21 +1126,21 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorNA );
|
drawUtil->drawRectFill( r, mProfile->mFillColorNA );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a bitmap over the background?
|
// Draw a bitmap over the background?
|
||||||
if ( mTextureNormal )
|
if ( mTextureNormal )
|
||||||
{
|
{
|
||||||
RectI rect(offset, mBitmapBounds);
|
RectI rect(offset, mBitmapBounds);
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
|
drawUtil->drawBitmapStretch( mTextureNormal, rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we render a bitmap border or lines?
|
// Do we render a bitmap border or lines?
|
||||||
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
||||||
{
|
{
|
||||||
GFX->getDrawUtil()->drawRect( r, mProfile->mBorderColorNA );
|
drawUtil->drawRect( r, mProfile->mBorderColorNA );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// renderSlightlyRaisedBox(r, mProfile); // Used to be the only 'else' condition to mInAction above.
|
// renderSlightlyRaisedBox(r, mProfile); // Used to be the only 'else' condition to mInAction above.
|
||||||
|
|
@ -1209,8 +1211,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
||||||
{
|
{
|
||||||
Point2I coloredboxsize( 15, 10 );
|
Point2I coloredboxsize( 15, 10 );
|
||||||
RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y );
|
RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y );
|
||||||
GFX->getDrawUtil()->drawRectFill( r, boxColor);
|
drawUtil->drawRectFill( r, boxColor);
|
||||||
GFX->getDrawUtil()->drawRect( r, ColorI(0,0,0));
|
drawUtil->drawRect( r, ColorI(0,0,0));
|
||||||
|
|
||||||
localStart.x += coloredboxsize.x + mProfile->mTextOffset.x;
|
localStart.x += coloredboxsize.x + mProfile->mTextOffset.x;
|
||||||
}
|
}
|
||||||
|
|
@ -1218,7 +1220,7 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
||||||
// Draw the text
|
// Draw the text
|
||||||
Point2I globalStart = localToGlobalCoord( localStart );
|
Point2I globalStart = localToGlobalCoord( localStart );
|
||||||
ColorI fontColor = mActive ? ( mInAction ? mProfile->mFontColor : mProfile->mFontColorNA ) : mProfile->mFontColorNA;
|
ColorI fontColor = mActive ? ( mInAction ? mProfile->mFontColor : mProfile->mFontColorNA ) : mProfile->mFontColorNA;
|
||||||
GFX->getDrawUtil()->setBitmapModulation( fontColor ); // was: (mProfile->mFontColor);
|
drawUtil->setBitmapModulation( fontColor ); // was: (mProfile->mFontColor);
|
||||||
|
|
||||||
// Get the number of columns in the text
|
// Get the number of columns in the text
|
||||||
S32 colcount = getColumnCount( mText, "\t" );
|
S32 colcount = getColumnCount( mText, "\t" );
|
||||||
|
|
@ -1230,7 +1232,7 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
||||||
|
|
||||||
// Draw the first column
|
// Draw the first column
|
||||||
getColumn( mText, buff, 0, "\t" );
|
getColumn( mText, buff, 0, "\t" );
|
||||||
GFX->getDrawUtil()->drawText( mProfile->mFont, globalStart, buff, mProfile->mFontColors );
|
drawUtil->drawText( mProfile->mFont, globalStart, buff, mProfile->mFontColors );
|
||||||
|
|
||||||
// Draw the second column to the right
|
// Draw the second column to the right
|
||||||
getColumn( mText, buff, 1, "\t" );
|
getColumn( mText, buff, 1, "\t" );
|
||||||
|
|
@ -1241,17 +1243,17 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
||||||
// right cap of the border.
|
// right cap of the border.
|
||||||
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
|
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
|
||||||
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) );
|
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) );
|
||||||
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
|
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - 12, localStart.y ) );
|
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - 12, localStart.y ) );
|
||||||
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
|
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
GFX->getDrawUtil()->drawText( mProfile->mFont, globalStart, mText, mProfile->mFontColors );
|
drawUtil->drawText( mProfile->mFont, globalStart, mText, mProfile->mFontColors );
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're rendering a bitmap border, then it will take care of the arrow.
|
// If we're rendering a bitmap border, then it will take care of the arrow.
|
||||||
|
|
|
||||||
|
|
@ -363,6 +363,8 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
Point2I ext(getWidth() - mShiftExtent, getHeight());
|
Point2I ext(getWidth() - mShiftExtent, getHeight());
|
||||||
RectI thumb = mThumb;
|
RectI thumb = mThumb;
|
||||||
|
|
||||||
|
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||||
|
|
||||||
if( mHasTexture )
|
if( mHasTexture )
|
||||||
{
|
{
|
||||||
if(mTicks > 0)
|
if(mTicks > 0)
|
||||||
|
|
@ -402,12 +404,12 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
S32 index = SliderButtonNormal;
|
S32 index = SliderButtonNormal;
|
||||||
if(mMouseOver)
|
if(mMouseOver)
|
||||||
index = SliderButtonHighlight;
|
index = SliderButtonHighlight;
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
drawUtil->clearBitmapModulation();
|
||||||
|
|
||||||
//left border
|
//left border
|
||||||
GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject, Point2I(offset.x,offset.y), mBitmapBounds[SliderLineLeft]);
|
drawUtil->drawBitmapSR(mProfile->mTextureObject, Point2I(offset.x,offset.y), mBitmapBounds[SliderLineLeft]);
|
||||||
//right border
|
//right border
|
||||||
GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[SliderLineRight].extent.x, offset.y), mBitmapBounds[SliderLineRight]);
|
drawUtil->drawBitmapSR(mProfile->mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[SliderLineRight].extent.x, offset.y), mBitmapBounds[SliderLineRight]);
|
||||||
|
|
||||||
|
|
||||||
//draw our center piece to our slider control's border and stretch it
|
//draw our center piece to our slider control's border and stretch it
|
||||||
|
|
@ -421,11 +423,11 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
stretchRect = mBitmapBounds[SliderLineCenter];
|
stretchRect = mBitmapBounds[SliderLineCenter];
|
||||||
stretchRect.inset(1,0);
|
stretchRect.inset(1,0);
|
||||||
|
|
||||||
GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject, destRect, stretchRect);
|
drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, destRect, stretchRect);
|
||||||
|
|
||||||
//draw our control slider button
|
//draw our control slider button
|
||||||
thumb.point += pos;
|
thumb.point += pos;
|
||||||
GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject,Point2I(thumb.point.x,offset.y ),mBitmapBounds[index]);
|
drawUtil->drawBitmapSR(mProfile->mTextureObject,Point2I(thumb.point.x,offset.y ),mBitmapBounds[index]);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (getWidth() >= getHeight())
|
else if (getWidth() >= getHeight())
|
||||||
|
|
@ -490,8 +492,8 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
||||||
else if(textStart.x + txt_w > offset.x+getWidth())
|
else if(textStart.x + txt_w > offset.x+getWidth())
|
||||||
textStart.x -=((textStart.x + txt_w) - (offset.x+getWidth()));
|
textStart.x -=((textStart.x + txt_w) - (offset.x+getWidth()));
|
||||||
|
|
||||||
GFX->getDrawUtil()->setBitmapModulation(mProfile->mFontColor);
|
drawUtil->setBitmapModulation(mProfile->mFontColor);
|
||||||
GFX->getDrawUtil()->drawText(mProfile->mFont, textStart, buf, mProfile->mFontColors);
|
drawUtil->drawText(mProfile->mFont, textStart, buf, mProfile->mFontColors);
|
||||||
}
|
}
|
||||||
renderChildControls(offset, updateRect);
|
renderChildControls(offset, updateRect);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4641,6 +4641,8 @@ S32 GuiTreeViewCtrl::findItemByValue(const char *name)
|
||||||
{
|
{
|
||||||
for (S32 i = 0; i < mItems.size(); i++)
|
for (S32 i = 0; i < mItems.size(); i++)
|
||||||
{
|
{
|
||||||
|
if (!mItems[i])
|
||||||
|
continue;
|
||||||
if( mItems[i]->mState.test( Item::InspectorData ) )
|
if( mItems[i]->mState.test( Item::InspectorData ) )
|
||||||
continue;
|
continue;
|
||||||
if (mItems[i] && dStrcmp(mItems[i]->getValue(),name) == 0)
|
if (mItems[i] && dStrcmp(mItems[i]->getValue(),name) == 0)
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
#include "gfx/video/videoCapture.h"
|
#include "gfx/video/videoCapture.h"
|
||||||
#include "lighting/lightManager.h"
|
#include "lighting/lightManager.h"
|
||||||
#include "core/strings/stringUnit.h"
|
#include "core/strings/stringUnit.h"
|
||||||
|
#include "gui/core/guiOffscreenCanvas.h"
|
||||||
|
|
||||||
#ifndef TORQUE_TGB_ONLY
|
#ifndef TORQUE_TGB_ONLY
|
||||||
#include "scene/sceneObject.h"
|
#include "scene/sceneObject.h"
|
||||||
|
|
@ -126,7 +127,8 @@ GuiCanvas::GuiCanvas(): GuiControl(),
|
||||||
mMouseDownPoint(0.0f,0.0f),
|
mMouseDownPoint(0.0f,0.0f),
|
||||||
mPlatformWindow(NULL),
|
mPlatformWindow(NULL),
|
||||||
mLastRenderMs(0),
|
mLastRenderMs(0),
|
||||||
mDisplayWindow(true)
|
mDisplayWindow(true),
|
||||||
|
mMenuBarCtrl(NULL)
|
||||||
{
|
{
|
||||||
setBounds(0, 0, 640, 480);
|
setBounds(0, 0, 640, 480);
|
||||||
mAwake = true;
|
mAwake = true;
|
||||||
|
|
@ -142,23 +144,12 @@ GuiCanvas::GuiCanvas(): GuiControl(),
|
||||||
#else
|
#else
|
||||||
mNumFences = 0;
|
mNumFences = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
mPurchaseScreen = NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiCanvas::~GuiCanvas()
|
GuiCanvas::~GuiCanvas()
|
||||||
{
|
{
|
||||||
SAFE_DELETE(mPlatformWindow);
|
SAFE_DELETE(mPlatformWindow);
|
||||||
SAFE_DELETE_ARRAY( mFences );
|
SAFE_DELETE_ARRAY( mFences );
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
// if (mPurchaseScreen)
|
|
||||||
// {
|
|
||||||
// SAFE_DELETE(mPurchaseScreen);
|
|
||||||
// }
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
@ -280,13 +271,6 @@ bool GuiCanvas::onAdd()
|
||||||
// Define the menu bar for this canvas (if any)
|
// Define the menu bar for this canvas (if any)
|
||||||
Con::executef(this, "onCreateMenu");
|
Con::executef(this, "onCreateMenu");
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
mPurchaseScreen = new PurchaseScreen;
|
|
||||||
mPurchaseScreen->init();
|
|
||||||
|
|
||||||
mLastPurchaseHideTime = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Sim::findObject("PlatformGenericMenubar", mMenuBarCtrl);
|
Sim::findObject("PlatformGenericMenubar", mMenuBarCtrl);
|
||||||
|
|
||||||
return parentRet;
|
return parentRet;
|
||||||
|
|
@ -294,11 +278,6 @@ bool GuiCanvas::onAdd()
|
||||||
|
|
||||||
void GuiCanvas::onRemove()
|
void GuiCanvas::onRemove()
|
||||||
{
|
{
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
if (mPurchaseScreen && mPurchaseScreen->isAwake())
|
|
||||||
removeObject(mPurchaseScreen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// And the process list
|
// And the process list
|
||||||
Process::remove(this, &GuiCanvas::paint);
|
Process::remove(this, &GuiCanvas::paint);
|
||||||
|
|
||||||
|
|
@ -508,6 +487,55 @@ bool GuiCanvas::isCursorShown()
|
||||||
return mPlatformWindow->isCursorVisible();
|
return mPlatformWindow->isCursorVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GuiCanvas::cursorClick(S32 buttonId, bool isDown)
|
||||||
|
{
|
||||||
|
InputEventInfo inputEvent;
|
||||||
|
inputEvent.deviceType = MouseDeviceType;
|
||||||
|
inputEvent.deviceInst = 0;
|
||||||
|
inputEvent.objType = SI_BUTTON;
|
||||||
|
inputEvent.objInst = (InputObjectInstances)(KEY_BUTTON0 + buttonId);
|
||||||
|
inputEvent.modifier = (InputModifiers)0;
|
||||||
|
inputEvent.ascii = 0;
|
||||||
|
inputEvent.action = isDown ? SI_MAKE : SI_BREAK;
|
||||||
|
inputEvent.fValue = isDown ? 1.0 : 0.0;
|
||||||
|
|
||||||
|
processMouseEvent(inputEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GuiCanvas::cursorNudge(F32 x, F32 y)
|
||||||
|
{
|
||||||
|
// Generate a base Movement along and Axis event
|
||||||
|
InputEventInfo inputEvent;
|
||||||
|
inputEvent.deviceType = MouseDeviceType;
|
||||||
|
inputEvent.deviceInst = 0;
|
||||||
|
inputEvent.objType = SI_AXIS;
|
||||||
|
inputEvent.modifier = (InputModifiers)0;
|
||||||
|
inputEvent.ascii = 0;
|
||||||
|
|
||||||
|
// Generate delta movement along each axis
|
||||||
|
Point2F cursDelta(x, y);
|
||||||
|
|
||||||
|
// If X axis changed, generate a relative event
|
||||||
|
if(mFabs(cursDelta.x) > 0.1)
|
||||||
|
{
|
||||||
|
inputEvent.objInst = SI_XAXIS;
|
||||||
|
inputEvent.action = SI_MOVE;
|
||||||
|
inputEvent.fValue = cursDelta.x;
|
||||||
|
processMouseEvent(inputEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If Y axis changed, generate a relative event
|
||||||
|
if(mFabs(cursDelta.y) > 0.1)
|
||||||
|
{
|
||||||
|
inputEvent.objInst = SI_YAXIS;
|
||||||
|
inputEvent.action = SI_MOVE;
|
||||||
|
inputEvent.fValue = cursDelta.y;
|
||||||
|
processMouseEvent(inputEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
processMouseEvent(inputEvent);
|
||||||
|
}
|
||||||
|
|
||||||
void GuiCanvas::addAcceleratorKey(GuiControl *ctrl, U32 index, U32 keyCode, U32 modifier)
|
void GuiCanvas::addAcceleratorKey(GuiControl *ctrl, U32 index, U32 keyCode, U32 modifier)
|
||||||
{
|
{
|
||||||
if (keyCode > 0 && ctrl)
|
if (keyCode > 0 && ctrl)
|
||||||
|
|
@ -709,13 +737,21 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent)
|
||||||
// 'mCursorPt' basically is an accumulation of errors and the number of bugs that have cropped up with
|
// 'mCursorPt' basically is an accumulation of errors and the number of bugs that have cropped up with
|
||||||
// the GUI clicking stuff where it is not supposed to are probably all to blame on this.
|
// the GUI clicking stuff where it is not supposed to are probably all to blame on this.
|
||||||
|
|
||||||
// Need to query platform for specific things
|
S32 mouseDoubleClickWidth = 12;
|
||||||
AssertISV(mPlatformWindow, "GuiCanvas::processMouseEvent - no window present!");
|
S32 mouseDoubleClickHeight = 12;
|
||||||
PlatformCursorController *pController = mPlatformWindow->getCursorController();
|
U32 mouseDoubleClickTime = 500;
|
||||||
AssertFatal(pController != NULL, "GuiCanvas::processInputEvent - No Platform Controller Found")
|
|
||||||
|
|
||||||
//copy the modifier into the new event
|
// Query platform for mouse info if its available
|
||||||
mLastEvent.modifier = inputEvent.modifier;
|
PlatformCursorController *pController = mPlatformWindow ? mPlatformWindow->getCursorController() : NULL;
|
||||||
|
if (pController)
|
||||||
|
{
|
||||||
|
mouseDoubleClickWidth = pController->getDoubleClickWidth();
|
||||||
|
mouseDoubleClickHeight = pController->getDoubleClickHeight();
|
||||||
|
mouseDoubleClickTime = pController->getDoubleClickTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
//copy the modifier into the new event
|
||||||
|
mLastEvent.modifier = inputEvent.modifier;
|
||||||
|
|
||||||
if(inputEvent.objType == SI_AXIS &&
|
if(inputEvent.objType == SI_AXIS &&
|
||||||
(inputEvent.objInst == SI_XAXIS || inputEvent.objInst == SI_YAXIS))
|
(inputEvent.objInst == SI_XAXIS || inputEvent.objInst == SI_YAXIS))
|
||||||
|
|
@ -747,7 +783,7 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent)
|
||||||
// moving too much.
|
// moving too much.
|
||||||
Point2F movement = mMouseDownPoint - mCursorPt;
|
Point2F movement = mMouseDownPoint - mCursorPt;
|
||||||
|
|
||||||
if ((mAbs((S32)movement.x) > pController->getDoubleClickWidth()) || (mAbs((S32)movement.y) > pController->getDoubleClickHeight() ) )
|
if ((mAbs((S32)movement.x) > mouseDoubleClickWidth) || (mAbs((S32)movement.y) > mouseDoubleClickHeight ) )
|
||||||
{
|
{
|
||||||
mLeftMouseLast = false;
|
mLeftMouseLast = false;
|
||||||
mMiddleMouseLast = false;
|
mMiddleMouseLast = false;
|
||||||
|
|
@ -799,7 +835,7 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent)
|
||||||
if (mLeftMouseLast)
|
if (mLeftMouseLast)
|
||||||
{
|
{
|
||||||
//if it was within the double click time count the clicks
|
//if it was within the double click time count the clicks
|
||||||
if (curTime - mLastMouseDownTime <= pController->getDoubleClickTime())
|
if (curTime - mLastMouseDownTime <= mouseDoubleClickTime)
|
||||||
mLastMouseClickCount++;
|
mLastMouseClickCount++;
|
||||||
else
|
else
|
||||||
mLastMouseClickCount = 1;
|
mLastMouseClickCount = 1;
|
||||||
|
|
@ -833,7 +869,7 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent)
|
||||||
if (mRightMouseLast)
|
if (mRightMouseLast)
|
||||||
{
|
{
|
||||||
//if it was within the double click time count the clicks
|
//if it was within the double click time count the clicks
|
||||||
if (curTime - mLastMouseDownTime <= pController->getDoubleClickTime())
|
if (curTime - mLastMouseDownTime <= mouseDoubleClickTime)
|
||||||
mLastMouseClickCount++;
|
mLastMouseClickCount++;
|
||||||
else
|
else
|
||||||
mLastMouseClickCount = 1;
|
mLastMouseClickCount = 1;
|
||||||
|
|
@ -864,7 +900,7 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent)
|
||||||
if (mMiddleMouseLast)
|
if (mMiddleMouseLast)
|
||||||
{
|
{
|
||||||
//if it was within the double click time count the clicks
|
//if it was within the double click time count the clicks
|
||||||
if (curTime - mLastMouseDownTime <= pController->getDoubleClickTime())
|
if (curTime - mLastMouseDownTime <= mouseDoubleClickTime)
|
||||||
mLastMouseClickCount++;
|
mLastMouseClickCount++;
|
||||||
else
|
else
|
||||||
mLastMouseClickCount = 1;
|
mLastMouseClickCount = 1;
|
||||||
|
|
@ -1303,11 +1339,6 @@ bool GuiCanvas::rootMouseWheelDown(const GuiEvent &event)
|
||||||
|
|
||||||
void GuiCanvas::setContentControl(GuiControl *gui)
|
void GuiCanvas::setContentControl(GuiControl *gui)
|
||||||
{
|
{
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
if (mPurchaseScreen->isForceExit())
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Skip out if we got passed NULL (why would that happen?)
|
// Skip out if we got passed NULL (why would that happen?)
|
||||||
if(!gui)
|
if(!gui)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1376,11 +1407,6 @@ GuiControl *GuiCanvas::getContentControl()
|
||||||
|
|
||||||
void GuiCanvas::pushDialogControl(GuiControl *gui, S32 layer, bool center)
|
void GuiCanvas::pushDialogControl(GuiControl *gui, S32 layer, bool center)
|
||||||
{
|
{
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
if (mPurchaseScreen->isForceExit())
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( center )
|
if( center )
|
||||||
gui->setPosition( getExtent().x / 2 - gui->getExtent().x / 2,
|
gui->setPosition( getExtent().x / 2 - gui->getExtent().x / 2,
|
||||||
getExtent().y / 2 - gui->getExtent().y / 2 );
|
getExtent().y / 2 - gui->getExtent().y / 2 );
|
||||||
|
|
@ -1768,6 +1794,21 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */)
|
||||||
|
|
||||||
PROFILE_END();
|
PROFILE_END();
|
||||||
|
|
||||||
|
// Render all offscreen canvas objects here since we may need them in the render loop
|
||||||
|
if (GuiOffscreenCanvas::sList.size() != 0)
|
||||||
|
{
|
||||||
|
// Reset the entire state since oculus shit will have barfed it.
|
||||||
|
GFX->disableShaders(true);
|
||||||
|
GFX->updateStates(true);
|
||||||
|
|
||||||
|
for (Vector<GuiOffscreenCanvas*>::iterator itr = GuiOffscreenCanvas::sList.begin(); itr != GuiOffscreenCanvas::sList.end(); itr++)
|
||||||
|
{
|
||||||
|
(*itr)->renderFrame(false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
GFX->setActiveRenderTarget(renderTarget);
|
||||||
|
}
|
||||||
|
|
||||||
// Can't render if waiting for device to reset.
|
// Can't render if waiting for device to reset.
|
||||||
if ( !beginSceneRes )
|
if ( !beginSceneRes )
|
||||||
{
|
{
|
||||||
|
|
@ -1882,10 +1923,6 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */)
|
||||||
// this situation is necessary because it needs to take the screenshot
|
// this situation is necessary because it needs to take the screenshot
|
||||||
// before the buffers swap
|
// before the buffers swap
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_TIMEOUT
|
|
||||||
checkTimeOut();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PROFILE_END();
|
PROFILE_END();
|
||||||
|
|
||||||
// Fence logic here, because this is where endScene is called.
|
// Fence logic here, because this is where endScene is called.
|
||||||
|
|
@ -1908,6 +1945,7 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */)
|
||||||
GFX->endScene();
|
GFX->endScene();
|
||||||
PROFILE_END();
|
PROFILE_END();
|
||||||
|
|
||||||
|
GFX->getDeviceEventSignal().trigger( GFXDevice::dePostFrame );
|
||||||
swapBuffers();
|
swapBuffers();
|
||||||
|
|
||||||
GuiCanvas::getGuiCanvasFrameSignal().trigger(false);
|
GuiCanvas::getGuiCanvasFrameSignal().trigger(false);
|
||||||
|
|
@ -2761,3 +2799,16 @@ ConsoleMethod( GuiCanvas, hideWindow, void, 2, 2, "" )
|
||||||
WindowManager->setDisplayWindow(false);
|
WindowManager->setDisplayWindow(false);
|
||||||
object->getPlatformWindow()->setDisplayWindow(false);
|
object->getPlatformWindow()->setDisplayWindow(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConsoleMethod( GuiCanvas, cursorClick, void, 4, 4, "button, isDown" )
|
||||||
|
{
|
||||||
|
const S32 buttonId = dAtoi(argv[2]);
|
||||||
|
const bool isDown = dAtob(argv[3]);
|
||||||
|
|
||||||
|
object->cursorClick(buttonId, isDown);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConsoleMethod( GuiCanvas, cursorNudge, void, 4, 4, "x, y" )
|
||||||
|
{
|
||||||
|
object->cursorNudge(dAtof(argv[2]), dAtof(argv[3]));
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,6 @@
|
||||||
#include "windowManager/platformWindowMgr.h"
|
#include "windowManager/platformWindowMgr.h"
|
||||||
#include "gfx/gfxFence.h"
|
#include "gfx/gfxFence.h"
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
#ifndef _PURCHASESCREEN_H_
|
|
||||||
#include "demo/purchase/purchaseScreen.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// A canvas on which rendering occurs.
|
/// A canvas on which rendering occurs.
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
@ -331,6 +325,10 @@ public:
|
||||||
|
|
||||||
/// Returns true if the cursor is being rendered.
|
/// Returns true if the cursor is being rendered.
|
||||||
virtual bool isCursorShown();
|
virtual bool isCursorShown();
|
||||||
|
|
||||||
|
void cursorClick(S32 buttonId, bool isDown);
|
||||||
|
|
||||||
|
void cursorNudge(F32 x, F32 y);
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
///used by the tooltip resource
|
///used by the tooltip resource
|
||||||
|
|
@ -438,21 +436,6 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const U32 MAX_GAMEPADS = 4; ///< The maximum number of supported gamepads
|
static const U32 MAX_GAMEPADS = 4; ///< The maximum number of supported gamepads
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_PURCHASE
|
|
||||||
private:
|
|
||||||
PurchaseScreen* mPurchaseScreen;
|
|
||||||
U32 mLastPurchaseHideTime;
|
|
||||||
|
|
||||||
public:
|
|
||||||
void showPurchaseScreen(bool show, bool startBlocker, const char* location, bool doExit);
|
|
||||||
void updatePurchaseScreen(const char* value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TORQUE_DEMO_TIMEOUT
|
|
||||||
private:
|
|
||||||
void checkTimeOut();
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -465,6 +465,8 @@ bool GuiControl::defaultTooltipRender( const Point2I &hoverPos, const Point2I &c
|
||||||
|
|
||||||
GFont *font = mTooltipProfile->mFont;
|
GFont *font = mTooltipProfile->mFont;
|
||||||
|
|
||||||
|
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||||
|
|
||||||
// Support for multi-line tooltip text...
|
// Support for multi-line tooltip text...
|
||||||
|
|
||||||
Vector<U32> startLineOffsets, lineLengths;
|
Vector<U32> startLineOffsets, lineLengths;
|
||||||
|
|
@ -521,12 +523,12 @@ bool GuiControl::defaultTooltipRender( const Point2I &hoverPos, const Point2I &c
|
||||||
GFX->setClipRect( rect );
|
GFX->setClipRect( rect );
|
||||||
|
|
||||||
// Draw Filler bit, then border on top of that
|
// Draw Filler bit, then border on top of that
|
||||||
GFX->getDrawUtil()->drawRectFill( rect, mTooltipProfile->mFillColor );
|
drawUtil->drawRectFill( rect, mTooltipProfile->mFillColor );
|
||||||
GFX->getDrawUtil()->drawRect( rect, mTooltipProfile->mBorderColor );
|
drawUtil->drawRect( rect, mTooltipProfile->mBorderColor );
|
||||||
|
|
||||||
// Draw the text centered in the tool tip box...
|
// Draw the text centered in the tool tip box...
|
||||||
|
|
||||||
GFX->getDrawUtil()->setBitmapModulation( mTooltipProfile->mFontColor );
|
drawUtil->setBitmapModulation( mTooltipProfile->mFontColor );
|
||||||
|
|
||||||
for ( U32 i = 0; i < lineLengths.size(); i++ )
|
for ( U32 i = 0; i < lineLengths.size(); i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -534,7 +536,7 @@ bool GuiControl::defaultTooltipRender( const Point2I &hoverPos, const Point2I &c
|
||||||
const UTF8 *line = renderTip.c_str() + startLineOffsets[i];
|
const UTF8 *line = renderTip.c_str() + startLineOffsets[i];
|
||||||
U32 lineLen = lineLengths[i];
|
U32 lineLen = lineLengths[i];
|
||||||
|
|
||||||
GFX->getDrawUtil()->drawTextN( font, start + offset, line, lineLen, mProfile->mFontColors );
|
drawUtil->drawTextN( font, start + offset, line, lineLen, mProfile->mFontColors );
|
||||||
}
|
}
|
||||||
|
|
||||||
GFX->setClipRect( oldClip );
|
GFX->setClipRect( oldClip );
|
||||||
|
|
@ -2380,7 +2382,8 @@ void GuiControl::getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent
|
||||||
// so set it back before we change it again.
|
// so set it back before we change it again.
|
||||||
|
|
||||||
PlatformWindow *pWindow = static_cast<GuiCanvas*>(getRoot())->getPlatformWindow();
|
PlatformWindow *pWindow = static_cast<GuiCanvas*>(getRoot())->getPlatformWindow();
|
||||||
AssertFatal(pWindow != NULL,"GuiControl without owning platform window! This should not be possible.");
|
if (!pWindow)
|
||||||
|
return;
|
||||||
PlatformCursorController *pController = pWindow->getCursorController();
|
PlatformCursorController *pController = pWindow->getCursorController();
|
||||||
AssertFatal(pController != NULL,"PlatformWindow without an owned CursorController!");
|
AssertFatal(pController != NULL,"PlatformWindow without an owned CursorController!");
|
||||||
|
|
||||||
|
|
|
||||||
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