mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-17 19:31:01 +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(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/temp" CACHE PATH "default install path" FORCE )
|
||||
|
||||
if("${TORQUE_APP_NAME}" STREQUAL "")
|
||||
message(FATAL_ERROR "Please set TORQUE_APP_NAME first")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ void daeStringTable::clear()
|
|||
{
|
||||
unsigned int i;
|
||||
for (i=0;i<_stringBuffersList.getCount();i++)
|
||||
#if _MSC_VER <= 1200
|
||||
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
|
||||
delete [] (char *) _stringBuffersList[i];
|
||||
#else
|
||||
delete [] _stringBuffersList[i];
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ NvSimpleTypes.h : Defines basic data types for integers and floats.
|
|||
typedef float NxF32;
|
||||
typedef double NxF64;
|
||||
|
||||
#elif LINUX
|
||||
#elif defined(LINUX)
|
||||
typedef long long NxI64;
|
||||
typedef signed int NxI32;
|
||||
typedef signed short NxI16;
|
||||
|
|
@ -101,7 +101,7 @@ NvSimpleTypes.h : Defines basic data types for integers and floats.
|
|||
typedef float NxF32;
|
||||
typedef double NxF64;
|
||||
|
||||
#elif __APPLE__
|
||||
#elif defined(__APPLE__)
|
||||
typedef long long NxI64;
|
||||
typedef signed int NxI32;
|
||||
typedef signed short NxI16;
|
||||
|
|
@ -115,7 +115,7 @@ NvSimpleTypes.h : Defines basic data types for integers and floats.
|
|||
typedef float NxF32;
|
||||
typedef double NxF64;
|
||||
|
||||
#elif __CELLOS_LV2__
|
||||
#elif defined(__CELLOS_LV2__)
|
||||
typedef long long NxI64;
|
||||
typedef signed int NxI32;
|
||||
typedef signed short NxI16;
|
||||
|
|
@ -129,7 +129,7 @@ NvSimpleTypes.h : Defines basic data types for integers and floats.
|
|||
typedef float NxF32;
|
||||
typedef double NxF64;
|
||||
|
||||
#elif _XBOX
|
||||
#elif defined(_XBOX)
|
||||
typedef __int64 NxI64;
|
||||
typedef signed int NxI32;
|
||||
typedef signed short NxI16;
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ void AIPlayer::setAimObject( GameBase *targetObject )
|
|||
* @param targetObject The object to target
|
||||
* @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;
|
||||
mTargetInLOS = false;
|
||||
|
|
@ -725,24 +725,20 @@ bool AIPlayer::setPathDestination(const Point3F &pos)
|
|||
|
||||
// Create a new path.
|
||||
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();
|
||||
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
|
||||
delete path;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(path->success())
|
||||
{
|
||||
|
|
@ -831,11 +827,15 @@ void AIPlayer::followObject(SceneObject *obj, F32 radius)
|
|||
if(!isServerObject())
|
||||
return;
|
||||
|
||||
if ((mFollowData.lastPos - obj->getPosition()).len()<mMoveTolerance)
|
||||
return;
|
||||
|
||||
if(setPathDestination(obj->getPosition()))
|
||||
{
|
||||
clearCover();
|
||||
mFollowData.object = obj;
|
||||
mFollowData.radius = radius;
|
||||
mFollowData.lastPos = obj->getPosition();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,10 +122,12 @@ private:
|
|||
SimObjectPtr<SceneObject> object;
|
||||
/// Distance at whcih to follow.
|
||||
F32 radius;
|
||||
Point3F lastPos;
|
||||
/// Default constructor.
|
||||
FollowData() : object(NULL)
|
||||
{
|
||||
radius = 5.0f;
|
||||
lastPos = Point3F::Zero;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -161,7 +163,7 @@ public:
|
|||
|
||||
// Targeting and aiming sets/gets
|
||||
void setAimObject( GameBase *targetObject );
|
||||
void setAimObject( GameBase *targetObject, Point3F offset );
|
||||
void setAimObject(GameBase *targetObject, const Point3F& offset);
|
||||
GameBase* getAimObject() const { return mAimObject; }
|
||||
void setAimLocation( const Point3F &location );
|
||||
Point3F getAimLocation() const { return mAimLocation; }
|
||||
|
|
|
|||
|
|
@ -279,6 +279,7 @@ Camera::Camera()
|
|||
|
||||
mLastAbsoluteYaw = 0.0f;
|
||||
mLastAbsolutePitch = 0.0f;
|
||||
mLastAbsoluteRoll = 0.0f;
|
||||
|
||||
// For NewtonFlyMode
|
||||
mNewtonRotation = false;
|
||||
|
|
@ -379,6 +380,57 @@ void Camera::getCameraTransform(F32* pos, MatrixF* mat)
|
|||
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()
|
||||
|
|
@ -547,6 +599,7 @@ void Camera::processTick(const Move* move)
|
|||
|
||||
mLastAbsoluteYaw = emove->rotZ[emoveIndex];
|
||||
mLastAbsolutePitch = emove->rotX[emoveIndex];
|
||||
mLastAbsoluteRoll = emove->rotY[emoveIndex];
|
||||
|
||||
// Bank
|
||||
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 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
|
||||
/// @{
|
||||
|
|
@ -235,6 +236,8 @@ class Camera: public ShapeBase
|
|||
virtual void processTick( const Move* move );
|
||||
virtual void interpolateTick( F32 delta);
|
||||
virtual void getCameraTransform( F32* pos,MatrixF* mat );
|
||||
virtual void getEyeCameraTransform( IDisplayDevice *display, U32 eyeId, MatrixF *outMat );
|
||||
virtual DisplayPose calcCameraDeltaPose(GameConnection *con, const DisplayPose& inPose);
|
||||
|
||||
virtual void writePacketData( GameConnection* conn, BitStream* stream );
|
||||
virtual void readPacketData( GameConnection* conn, BitStream* stream );
|
||||
|
|
|
|||
|
|
@ -113,9 +113,11 @@ void GuiClockHud::initPersistFields()
|
|||
|
||||
void GuiClockHud::onRender(Point2I offset, const RectI &updateRect)
|
||||
{
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
// Background first
|
||||
if (mShowFill)
|
||||
GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor);
|
||||
drawUtil->drawRectFill(updateRect, mFillColor);
|
||||
|
||||
// Convert ms time into hours, minutes and seconds.
|
||||
S32 time = S32(getTime());
|
||||
|
|
@ -129,13 +131,13 @@ void GuiClockHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
// Center the text
|
||||
offset.x += (getWidth() - mProfile->mFont->getStrWidth((const UTF8 *)buf)) / 2;
|
||||
offset.y += (getHeight() - mProfile->mFont->getHeight()) / 2;
|
||||
GFX->getDrawUtil()->setBitmapModulation(mTextColor);
|
||||
GFX->getDrawUtil()->drawText(mProfile->mFont, offset, buf);
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
drawUtil->setBitmapModulation(mTextColor);
|
||||
drawUtil->drawText(mProfile->mFont, offset, buf);
|
||||
drawUtil->clearBitmapModulation();
|
||||
|
||||
// Border last
|
||||
if (mShowFrame)
|
||||
GFX->getDrawUtil()->drawRect(updateRect, mFrameColor);
|
||||
drawUtil->drawRect(updateRect, mFrameColor);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -162,10 +162,12 @@ void GuiHealthTextHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
else
|
||||
mValue = 100 - (100 * control->getDamageValue());
|
||||
}
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
// If enabled draw background first
|
||||
if (mShowFill)
|
||||
GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor);
|
||||
drawUtil->drawRectFill(updateRect, mFillColor);
|
||||
|
||||
// Prepare text and center it
|
||||
S32 val = (S32)mValue;
|
||||
|
|
@ -190,11 +192,11 @@ void GuiHealthTextHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
}
|
||||
}
|
||||
|
||||
GFX->getDrawUtil()->setBitmapModulation(tColor);
|
||||
GFX->getDrawUtil()->drawText(mProfile->mFont, offset, buf);
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
drawUtil->setBitmapModulation(tColor);
|
||||
drawUtil->drawText(mProfile->mFont, offset, buf);
|
||||
drawUtil->clearBitmapModulation();
|
||||
|
||||
// If enabled draw the border last
|
||||
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
|
||||
// don't want to collide with the control object.
|
||||
static U32 losMask = TerrainObjectType | ShapeBaseObjectType;
|
||||
static U32 losMask = TerrainObjectType | ShapeBaseObjectType | StaticObjectType;
|
||||
control->disableCollision();
|
||||
|
||||
// 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.y -= height / 2;
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
// Background fill first
|
||||
if (mShowLabelFill)
|
||||
GFX->getDrawUtil()->drawRectFill(RectI(offset, extent), mLabelFillColor);
|
||||
drawUtil->drawRectFill(RectI(offset, extent), mLabelFillColor);
|
||||
|
||||
// Deal with opacity and draw.
|
||||
mTextColor.alpha = opacity;
|
||||
GFX->getDrawUtil()->setBitmapModulation(mTextColor);
|
||||
GFX->getDrawUtil()->drawText(mProfile->mFont, offset + mLabelPadding, name);
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
drawUtil->setBitmapModulation(mTextColor);
|
||||
drawUtil->drawText(mProfile->mFont, offset + mLabelPadding, name);
|
||||
drawUtil->clearBitmapModulation();
|
||||
|
||||
// Border last
|
||||
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.
|
||||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public:
|
|||
fxFoliageCulledList(Box3F SearchBox, fxFoliageCulledList* InVec);
|
||||
~fxFoliageCulledList() {};
|
||||
|
||||
void FindCandidates(Box3F SearchBox, fxFoliageCulledList* InVec);
|
||||
void FindCandidates(const Box3F& SearchBox, fxFoliageCulledList* InVec);
|
||||
|
||||
U32 GetListCount(void) { return mCulledObjectSet.size(); };
|
||||
fxFoliageItem* GetElement(U32 index) { return mCulledObjectSet[index]; };
|
||||
|
|
@ -157,7 +157,7 @@ protected:
|
|||
|
||||
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 ProcessNodeChildren(fxFoliageQuadrantNode* pParentNode, fxFoliageCulledList* pCullList);
|
||||
|
||||
|
|
|
|||
|
|
@ -1293,7 +1293,7 @@ void Precipitation::interpolateTick(F32 delta)
|
|||
void Precipitation::processTick(const Move *)
|
||||
{
|
||||
//nothing to do on the server
|
||||
if (isServerObject() || mDataBlock == NULL)
|
||||
if (isServerObject() || mDataBlock == NULL || isHidden())
|
||||
return;
|
||||
|
||||
const U32 currTime = Platform::getVirtualMilliseconds();
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@
|
|||
#include "scene/sceneManager.h"
|
||||
#define __SCENEMANAGER_H__
|
||||
#endif
|
||||
#ifndef _IDISPLAYDEVICE_H_
|
||||
#include "platform/output/IDisplayDevice.h"
|
||||
#endif
|
||||
|
||||
class NetConnection;
|
||||
class ProcessList;
|
||||
|
|
@ -418,6 +421,7 @@ public:
|
|||
|
||||
// Not implemented here, but should return the Camera to world transformation matrix
|
||||
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
|
||||
/// classes to actually set this object.
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ GameConnection::GameConnection()
|
|||
|
||||
GameConnection::~GameConnection()
|
||||
{
|
||||
setDisplayDevice(NULL);
|
||||
delete mAuthInfo;
|
||||
for(U32 i = 0; i < mConnectArgc; i++)
|
||||
dFree(mConnectArgv[i]);
|
||||
|
|
@ -673,6 +674,30 @@ bool GameConnection::getControlCameraTransform(F32 dt, MatrixF* mat)
|
|||
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)
|
||||
{
|
||||
//find the last control object in the chain (client->player->turret->whatever...)
|
||||
|
|
@ -999,8 +1024,10 @@ bool GameConnection::readDemoStartBlock(BitStream *stream)
|
|||
|
||||
void GameConnection::demoPlaybackComplete()
|
||||
{
|
||||
static ConsoleValueRef demoPlaybackArgv[1] = { "demoPlaybackComplete" };
|
||||
Sim::postCurrentEvent(Sim::getRootGroup(), new SimConsoleEvent(1, demoPlaybackArgv, false));
|
||||
static const char* demoPlaybackArgv[1] = { "demoPlaybackComplete" };
|
||||
static StringStackConsoleWrapper demoPlaybackCmd(1, demoPlaybackArgv);
|
||||
|
||||
Sim::postCurrentEvent(Sim::getRootGroup(), new SimConsoleEvent(demoPlaybackCmd.argc, demoPlaybackCmd.argv, false));
|
||||
Parent::demoPlaybackComplete();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -269,6 +269,10 @@ public:
|
|||
bool getControlCameraTransform(F32 dt,MatrixF* mat);
|
||||
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 getControlCameraFov(F32 *fov);
|
||||
bool setControlCameraFov(F32 fov);
|
||||
|
|
@ -280,8 +284,8 @@ public:
|
|||
void setFirstPerson(bool firstPerson);
|
||||
|
||||
bool hasDisplayDevice() const { return mDisplayDevice != NULL; }
|
||||
const IDisplayDevice* getDisplayDevice() const { return mDisplayDevice; }
|
||||
void setDisplayDevice(IDisplayDevice* display) { mDisplayDevice = display; }
|
||||
IDisplayDevice* getDisplayDevice() const { return mDisplayDevice; }
|
||||
void setDisplayDevice(IDisplayDevice* display) { if (mDisplayDevice) mDisplayDevice->setDrawCanvas(NULL); mDisplayDevice = display; }
|
||||
void clearDisplayDevice() { mDisplayDevice = NULL; }
|
||||
|
||||
void setControlSchemeParameters(bool absoluteRotation, bool addYawToAbsRot, bool addPitchToAbsRot);
|
||||
|
|
|
|||
|
|
@ -349,8 +349,13 @@ bool GameProcessCameraQuery(CameraQuery *query)
|
|||
|
||||
// Provide some default values
|
||||
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;
|
||||
bool fovSet = false;
|
||||
|
||||
|
|
@ -358,14 +363,14 @@ bool GameProcessCameraQuery(CameraQuery *query)
|
|||
// is not open
|
||||
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
|
||||
if(display->providesYFOV())
|
||||
{
|
||||
cameraFov = mRadToDeg(display->getYFOV());
|
||||
fovSet = true;
|
||||
}
|
||||
display->setCurrentConnection(connection);
|
||||
|
||||
// Display may activate AFTER so we need to call this again just in case
|
||||
display->onStartFrame();
|
||||
|
||||
// The connection's display device may want to set the projection offset
|
||||
if(display->providesProjectionOffset())
|
||||
|
|
@ -374,14 +379,34 @@ bool GameProcessCameraQuery(CameraQuery *query)
|
|||
}
|
||||
|
||||
// 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
|
||||
if(!fovSet && !connection->getControlCameraFov(&cameraFov))
|
||||
if(!connection->getControlCameraFov(&cameraFov))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,10 +55,6 @@ bool GameTSCtrl::onAdd()
|
|||
if ( !Parent::onAdd() )
|
||||
return false;
|
||||
|
||||
#ifdef TORQUE_DEMO_WATERMARK
|
||||
mWatermark.init();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -172,10 +168,6 @@ void GameTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
if(!skipRender || true)
|
||||
Parent::onRender(offset, updateRect);
|
||||
|
||||
#ifdef TORQUE_DEMO_WATERMARK
|
||||
mWatermark.render(getExtent());
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -30,12 +30,6 @@
|
|||
#include "gui/3d/guiTSControl.h"
|
||||
#endif
|
||||
|
||||
#ifdef TORQUE_DEMO_WATERMARK
|
||||
#ifndef _WATERMARK_H_
|
||||
#include "demo/watermark/watermark.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class ProjectileData;
|
||||
class GameBase;
|
||||
|
||||
|
|
@ -45,10 +39,6 @@ class GameTSCtrl : public GuiTSCtrl
|
|||
private:
|
||||
typedef GuiTSCtrl Parent;
|
||||
|
||||
#ifdef TORQUE_DEMO_WATERMARK
|
||||
Watermark mWatermark;
|
||||
#endif
|
||||
|
||||
void makeScriptCall(const char *func, const GuiEvent &evt) const;
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -290,8 +290,9 @@ bool BtPlayer::_sweep( btVector3 *inOutCurrPos, const btVector3 &disp, Collision
|
|||
BtPlayerSweepCallback callback( mGhostObject, disp.normalized() );
|
||||
callback.m_collisionFilterGroup = mGhostObject->getBroadphaseHandle()->m_collisionFilterGroup;
|
||||
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 );
|
||||
if ( callback.hasHit() )
|
||||
|
|
@ -434,9 +435,8 @@ void BtPlayer::findContact( SceneObject **contactObject,
|
|||
if ( other == mGhostObject )
|
||||
other = (btCollisionObject*)pair.m_pProxy1->m_clientObject;
|
||||
|
||||
AssertFatal( !outOverlapObjects->contains( PhysicsUserData::getObject( other->getUserPointer() ) ),
|
||||
"Got multiple pairs of the same object!" );
|
||||
outOverlapObjects->push_back( PhysicsUserData::getObject( other->getUserPointer() ) );
|
||||
if (!outOverlapObjects->contains(PhysicsUserData::getObject(other->getUserPointer())))
|
||||
outOverlapObjects->push_back( PhysicsUserData::getObject( other->getUserPointer() ) );
|
||||
|
||||
if ( other->getCollisionFlags() & btCollisionObject::CF_NO_CONTACT_RESPONSE )
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -1650,6 +1650,7 @@ Player::Player()
|
|||
|
||||
mLastAbsoluteYaw = 0.0f;
|
||||
mLastAbsolutePitch = 0.0f;
|
||||
mLastAbsoluteRoll = 0.0f;
|
||||
}
|
||||
|
||||
Player::~Player()
|
||||
|
|
@ -2608,6 +2609,7 @@ void Player::updateMove(const Move* move)
|
|||
}
|
||||
mLastAbsoluteYaw = emove->rotZ[emoveIndex];
|
||||
mLastAbsolutePitch = emove->rotX[emoveIndex];
|
||||
mLastAbsoluteRoll = emove->rotY[emoveIndex];
|
||||
|
||||
// Head bank
|
||||
mHead.y = emove->rotY[emoveIndex];
|
||||
|
|
@ -5584,6 +5586,57 @@ void Player::getMuzzleTransform(U32 imageSlot,MatrixF* mat)
|
|||
*mat = nmat;
|
||||
}
|
||||
|
||||
DisplayPose Player::calcCameraDeltaPose(GameConnection *con, const DisplayPose& inPose)
|
||||
{
|
||||
// NOTE: this is intended to be similar to updateMove
|
||||
DisplayPose outPose;
|
||||
outPose.orientation = getRenderTransform().toEuler();
|
||||
outPose.position = inPose.position;
|
||||
|
||||
if (con && con->getControlSchemeAbsoluteRotation())
|
||||
{
|
||||
// Pitch
|
||||
outPose.orientation.x = (inPose.orientation.x - mLastAbsolutePitch);
|
||||
|
||||
// Constrain the range of mRot.x
|
||||
while (outPose.orientation.x < -M_PI_F)
|
||||
outPose.orientation.x += M_2PI_F;
|
||||
while (outPose.orientation.x > M_PI_F)
|
||||
outPose.orientation.x -= M_2PI_F;
|
||||
|
||||
// Yaw
|
||||
|
||||
// Rotate (heading) head or body?
|
||||
if ((isMounted() && getMountNode() == 0) || (con && !con->isFirstPerson()))
|
||||
{
|
||||
// Rotate head
|
||||
outPose.orientation.z = (inPose.orientation.z - mLastAbsoluteYaw);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Rotate body
|
||||
outPose.orientation.z = (inPose.orientation.z - mLastAbsoluteYaw);
|
||||
}
|
||||
|
||||
// Constrain the range of mRot.z
|
||||
while (outPose.orientation.z < 0.0f)
|
||||
outPose.orientation.z += M_2PI_F;
|
||||
while (outPose.orientation.z > M_2PI_F)
|
||||
outPose.orientation.z -= M_2PI_F;
|
||||
|
||||
// Bank
|
||||
if (mDataBlock->cameraCanBank)
|
||||
{
|
||||
outPose.orientation.y = (inPose.orientation.y - mLastAbsoluteRoll);
|
||||
}
|
||||
|
||||
// Constrain the range of mRot.y
|
||||
while (outPose.orientation.y > M_PI_F)
|
||||
outPose.orientation.y -= M_2PI_F;
|
||||
}
|
||||
|
||||
return outPose;
|
||||
}
|
||||
|
||||
void Player::getRenderMuzzleTransform(U32 imageSlot,MatrixF* mat)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -439,6 +439,7 @@ protected:
|
|||
|
||||
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 mLastAbsoluteRoll; ///< Stores that last absolute roll value as passed in by ExtendedMove
|
||||
|
||||
S32 mMountPending; ///< mMountPending suppresses tickDelay countdown so players will sit until
|
||||
///< their mount, or another animation, comes through (or 13 seconds elapses).
|
||||
|
|
@ -683,6 +684,7 @@ public:
|
|||
void getEyeBaseTransform(MatrixF* mat, bool includeBank);
|
||||
void getRenderEyeTransform(MatrixF* mat);
|
||||
void getRenderEyeBaseTransform(MatrixF* mat, bool includeBank);
|
||||
virtual DisplayPose calcCameraDeltaPose(GameConnection *con, const DisplayPose& inPose);
|
||||
void getCameraParameters(F32 *min, F32 *max, Point3F *offset, MatrixF *rot);
|
||||
void getMuzzleTransform(U32 imageSlot,MatrixF* mat);
|
||||
void getRenderMuzzleTransform(U32 imageSlot,MatrixF* mat);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@
|
|||
#include "scene/sceneRenderState.h"
|
||||
#include "scene/sceneObjectLightingPlugin.h"
|
||||
#include "T3D/fx/explosion.h"
|
||||
#include "T3D/fx/particleEmitter.h"
|
||||
#include "T3D/fx/cameraFXMgr.h"
|
||||
#include "environment/waterBlock.h"
|
||||
#include "T3D/debris.h"
|
||||
|
|
@ -154,28 +153,8 @@ ShapeBaseData::ShapeBaseData()
|
|||
shadowSphereAdjust( 1.0f ),
|
||||
shapeName( StringTable->insert("") ),
|
||||
cloakTexName( StringTable->insert("") ),
|
||||
mass( 1.0f ),
|
||||
drag( 0.0f ),
|
||||
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 ),
|
||||
cubeDescId( 0 ),
|
||||
reflectorDesc( NULL ),
|
||||
debris( NULL ),
|
||||
debrisID( 0 ),
|
||||
debrisShapeName( StringTable->insert("") ),
|
||||
|
|
@ -183,15 +162,35 @@ ShapeBaseData::ShapeBaseData()
|
|||
explosionID( 0 ),
|
||||
underwaterExplosion( NULL ),
|
||||
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 ),
|
||||
useEyePoint( false ),
|
||||
cubeDescId( 0 ),
|
||||
reflectorDesc( NULL ),
|
||||
observeThroughObject( false ),
|
||||
isInvincible( false ),
|
||||
renderWhenDestroyed( true ),
|
||||
computeCRC( false ),
|
||||
inheritEnergyFromMount( false ),
|
||||
mCRC( 0 ),
|
||||
debrisDetail( -1 )
|
||||
mCRC( 0 )
|
||||
{
|
||||
dMemset( mountPointNode, -1, sizeof( S32 ) * SceneObject::NumMountPoints );
|
||||
}
|
||||
|
|
@ -878,46 +877,46 @@ IMPLEMENT_CALLBACK( ShapeBase, validateCameraFov, F32, (F32 fov), (fov),
|
|||
"@see ShapeBaseData\n\n");
|
||||
|
||||
ShapeBase::ShapeBase()
|
||||
: mDrag( 0.0f ),
|
||||
mBuoyancy( 0.0f ),
|
||||
mWaterCoverage( 0.0f ),
|
||||
mLiquidHeight( 0.0f ),
|
||||
: mDataBlock( NULL ),
|
||||
mIsAiControlled( false ),
|
||||
mControllingObject( NULL ),
|
||||
mGravityMod( 1.0f ),
|
||||
mAppliedForce( Point3F::Zero ),
|
||||
mTimeoutList( NULL ),
|
||||
mDataBlock( NULL ),
|
||||
mMoveMotion( false ),
|
||||
mShapeBaseMount( NULL ),
|
||||
mShapeInstance( NULL ),
|
||||
mConvexList( new Convex ),
|
||||
mEnergy( 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 ),
|
||||
mRepairRate( 0.0f ),
|
||||
mRepairReserve( 0.0f ),
|
||||
mDamageState( Enabled ),
|
||||
mDamageThread( NULL ),
|
||||
mHulkThread( NULL ),
|
||||
mLastRenderFrame( 0 ),
|
||||
mLastRenderDistance( 0.0f ),
|
||||
damageDir( 0.0f, 0.0f, 1.0f ),
|
||||
mCloaked( false ),
|
||||
mCloakLevel( 0.0f ),
|
||||
mDamageFlash( 0.0f ),
|
||||
mWhiteOut( 0.0f ),
|
||||
mIsControlled( false ),
|
||||
mConvexList( new Convex ),
|
||||
mCameraFov( 90.0f ),
|
||||
mFadeOut( true ),
|
||||
mFading( false ),
|
||||
mFadeVal( 1.0f ),
|
||||
mFadeTime( 1.0f ),
|
||||
mFadeElapsedTime( 0.0f ),
|
||||
mFadeTime( 1.0f ),
|
||||
mFadeDelay( 0.0f ),
|
||||
mFlipFadeVal( false ),
|
||||
damageDir( 0.0f, 0.0f, 1.0f ),
|
||||
mShapeBaseMount( NULL ),
|
||||
mMass( 1.0f ),
|
||||
mOneOverMass( 1.0f ),
|
||||
mMoveMotion( false ),
|
||||
mIsAiControlled( false )
|
||||
mCameraFov( 90.0f ),
|
||||
mIsControlled( false ),
|
||||
mLastRenderFrame( 0 ),
|
||||
mLastRenderDistance( 0.0f )
|
||||
{
|
||||
mTypeMask |= ShapeBaseObjectType | LightObjectType;
|
||||
|
||||
|
|
@ -1192,13 +1191,13 @@ void ShapeBase::onDeleteNotify( SimObject *obj )
|
|||
Parent::onDeleteNotify( obj );
|
||||
}
|
||||
|
||||
void ShapeBase::onImpact(SceneObject* obj, VectorF vec)
|
||||
void ShapeBase::onImpact(SceneObject* obj, const VectorF& vec)
|
||||
{
|
||||
if (!isGhost())
|
||||
mDataBlock->onImpact_callback( this, obj, vec, vec.len() );
|
||||
}
|
||||
|
||||
void ShapeBase::onImpact(VectorF vec)
|
||||
void ShapeBase::onImpact(const VectorF& vec)
|
||||
{
|
||||
if (!isGhost())
|
||||
mDataBlock->onImpact_callback( this, NULL, vec, vec.len() );
|
||||
|
|
@ -1969,6 +1968,75 @@ void ShapeBase::getCameraTransform(F32* pos,MatrixF* mat)
|
|||
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)
|
||||
{
|
||||
*min = mDataBlock->cameraMinDist;
|
||||
|
|
@ -1977,7 +2045,6 @@ void ShapeBase::getCameraParameters(F32 *min,F32* max,Point3F* off,MatrixF* rot)
|
|||
rot->identity();
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
F32 ShapeBase::getDamageFlash() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@
|
|||
#include "console/dynamicTypes.h"
|
||||
#endif
|
||||
|
||||
// Need full definition visible for SimObjectPtr<ParticleEmitter>
|
||||
#include "T3D/fx/particleEmitter.h"
|
||||
|
||||
class GFXCubemap;
|
||||
class TSShapeInstance;
|
||||
|
|
@ -70,8 +72,6 @@ class SceneRenderState;
|
|||
class TSThread;
|
||||
class GameConnection;
|
||||
struct CameraScopeQuery;
|
||||
class ParticleEmitter;
|
||||
class ParticleEmitterData;
|
||||
class ProjectileData;
|
||||
class ExplosionData;
|
||||
struct DebrisData;
|
||||
|
|
@ -1104,8 +1104,8 @@ protected:
|
|||
virtual void shakeCamera( U32 imageSlot );
|
||||
virtual void updateDamageLevel();
|
||||
virtual void updateDamageState();
|
||||
virtual void onImpact(SceneObject* obj, VectorF vec);
|
||||
virtual void onImpact(VectorF vec);
|
||||
virtual void onImpact(SceneObject* obj, const VectorF& vec);
|
||||
virtual void onImpact(const VectorF& vec);
|
||||
/// @}
|
||||
|
||||
/// The inner prep render function that does the
|
||||
|
|
@ -1583,6 +1583,13 @@ public:
|
|||
/// @param mat Camera transform (out)
|
||||
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
|
||||
/// @param imageSlot Image slot
|
||||
/// @param nodeName Node name
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ TSStatic::TSStatic()
|
|||
mPlayAmbient = true;
|
||||
mAmbientThread = NULL;
|
||||
|
||||
mAllowPlayerStep = true;
|
||||
mAllowPlayerStep = false;
|
||||
|
||||
mConvexList = new Convex;
|
||||
|
||||
|
|
@ -1171,8 +1171,10 @@ DefineEngineMethod( TSStatic, changeMaterial, void, ( const char* mapTo, Materia
|
|||
return;
|
||||
}
|
||||
|
||||
TSMaterialList* shapeMaterialList = object->getShape()->materialList;
|
||||
|
||||
// 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)
|
||||
{
|
||||
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
|
||||
// target the specific targets per inst, this is actually doing more than we thought
|
||||
delete object->getShape()->materialList->mMatInstList[matIndex];
|
||||
object->getShape()->materialList->mMatInstList[matIndex] = newMat->createMatInstance();
|
||||
delete shapeMaterialList->mMatInstList[matIndex];
|
||||
shapeMaterialList->mMatInstList[matIndex] = newMat->createMatInstance();
|
||||
|
||||
// Finish up preparing the material instances for rendering
|
||||
const GFXVertexFormat *flags = getGFXVertexFormat<GFXVertexPNTTB>();
|
||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||
object->getShape()->materialList->getMaterialInst(matIndex)->init( features, flags );
|
||||
shapeMaterialList->getMaterialInst(matIndex)->init(features, flags);
|
||||
}
|
||||
|
||||
DefineEngineMethod( TSStatic, getModelFile, const char *, (),,
|
||||
|
|
|
|||
|
|
@ -1059,9 +1059,9 @@ void TurretShape::writePacketData(GameConnection *connection, BitStream *stream)
|
|||
{
|
||||
// Update client regardless of status flags.
|
||||
Parent::writePacketData(connection, stream);
|
||||
|
||||
stream->write(mRot.x);
|
||||
stream->write(mRot.z);
|
||||
|
||||
stream->writeSignedFloat(mRot.x / M_2PI_F, 7);
|
||||
stream->writeSignedFloat(mRot.z / M_2PI_F, 7);
|
||||
}
|
||||
|
||||
void TurretShape::readPacketData(GameConnection *connection, BitStream *stream)
|
||||
|
|
@ -1069,9 +1069,8 @@ void TurretShape::readPacketData(GameConnection *connection, BitStream *stream)
|
|||
Parent::readPacketData(connection, stream);
|
||||
|
||||
Point3F rot(0.0f, 0.0f, 0.0f);
|
||||
stream->read(&rot.x);
|
||||
stream->read(&rot.z);
|
||||
|
||||
rot.x = stream->readSignedFloat(7) * M_2PI_F;
|
||||
rot.z = stream->readSignedFloat(7) * M_2PI_F;
|
||||
_setRotation(rot);
|
||||
|
||||
mTurretDelta.rot = rot;
|
||||
|
|
@ -1100,8 +1099,8 @@ U32 TurretShape::packUpdate(NetConnection *connection, U32 mask, BitStream *stre
|
|||
|
||||
if (stream->writeFlag(mask & TurretUpdateMask))
|
||||
{
|
||||
stream->write(mRot.x);
|
||||
stream->write(mRot.z);
|
||||
stream->writeSignedFloat(mRot.x / M_2PI_F, 7);
|
||||
stream->writeSignedFloat(mRot.z / M_2PI_F, 7);
|
||||
stream->write(allowManualRotation);
|
||||
stream->write(allowManualFire);
|
||||
}
|
||||
|
|
@ -1137,8 +1136,8 @@ void TurretShape::unpackUpdate(NetConnection *connection, BitStream *stream)
|
|||
if (stream->readFlag())
|
||||
{
|
||||
Point3F rot(0.0f, 0.0f, 0.0f);
|
||||
stream->read(&rot.x);
|
||||
stream->read(&rot.z);
|
||||
rot.x = stream->readSignedFloat(7) * M_2PI_F;
|
||||
rot.z = stream->readSignedFloat(7) * M_2PI_F;
|
||||
_setRotation(rot);
|
||||
|
||||
// New delta for client side interpolation
|
||||
|
|
|
|||
|
|
@ -61,10 +61,6 @@
|
|||
// For the TickMs define... fix this for T2D...
|
||||
#include "T3D/gameBase/processList.h"
|
||||
|
||||
#ifdef TORQUE_DEMO_PURCHASE
|
||||
#include "demo/pestTimer/pestTimer.h"
|
||||
#endif
|
||||
|
||||
#ifdef TORQUE_ENABLE_VFS
|
||||
#include "platform/platformVFS.h"
|
||||
#endif
|
||||
|
|
@ -309,10 +305,6 @@ void StandardMainLoop::init()
|
|||
// Hook in for UDP notification
|
||||
Net::smPacketReceive.notify(GNet, &NetInterface::processPacketReceiveEvent);
|
||||
|
||||
#ifdef TORQUE_DEMO_PURCHASE
|
||||
PestTimerinit();
|
||||
#endif
|
||||
|
||||
#ifdef TORQUE_DEBUG_GUARD
|
||||
Memory::flagCurrentAllocs( Memory::FLAG_Static );
|
||||
#endif
|
||||
|
|
@ -613,11 +605,6 @@ bool StandardMainLoop::doMainLoop()
|
|||
ThreadPool::processMainThreadWorkItems();
|
||||
Sampler::endFrame();
|
||||
PROFILE_END_NAMED(MainLoop);
|
||||
|
||||
#ifdef TORQUE_DEMO_PURCHASE
|
||||
CheckTimer();
|
||||
CheckBlocker();
|
||||
#endif
|
||||
}
|
||||
|
||||
return keepRunning;
|
||||
|
|
|
|||
|
|
@ -142,21 +142,3 @@ DefineConsoleFunction( getBuildString, const char*, (), , "Get the type of build
|
|||
}
|
||||
|
||||
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)
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ Point3F BoxConvex::getVertex(S32 v)
|
|||
return p;
|
||||
}
|
||||
|
||||
inline bool isOnPlane(Point3F p,PlaneF& plane)
|
||||
inline bool isOnPlane(const Point3F& p,PlaneF& plane)
|
||||
{
|
||||
F32 dist = mDot(plane,p) + plane.d;
|
||||
return dist < 0.1 && dist > -0.1;
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ protected:
|
|||
U8 *data; ///< Allocated data (size is BlockSize)
|
||||
U32 size; ///< Bytes used in data
|
||||
CodeData *next; ///< Next block
|
||||
};
|
||||
} CodeData;
|
||||
|
||||
/// @name Emitted code
|
||||
/// {
|
||||
|
|
|
|||
|
|
@ -1534,9 +1534,16 @@ StringTableEntry getModNameFromPath(const char *path)
|
|||
void postConsoleInput( RawData data )
|
||||
{
|
||||
// Schedule this to happen at the next time event.
|
||||
ConsoleValue values[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));
|
||||
}
|
||||
|
||||
|
|
@ -1610,36 +1617,6 @@ ConsoleValueRef::ConsoleValueRef(const ConsoleValueRef &ref)
|
|||
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)
|
||||
{
|
||||
value = newValue.value;
|
||||
|
|
@ -1759,12 +1736,34 @@ const char *ConsoleValue::getStringValue()
|
|||
return sval;
|
||||
else if (type == TypeInternalStringStackPtr)
|
||||
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
|
||||
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()
|
||||
|
|
@ -1800,11 +1799,13 @@ void ConsoleValue::setIntValue(U32 val)
|
|||
{
|
||||
fval = (F32)val;
|
||||
ival = val;
|
||||
if(sval != typeValueEmpty)
|
||||
if(bufferLen > 0)
|
||||
{
|
||||
if (type != TypeInternalStackString && type != TypeInternalStringStackPtr) dFree(sval);
|
||||
sval = typeValueEmpty;
|
||||
dFree(sval);
|
||||
bufferLen = 0;
|
||||
}
|
||||
|
||||
sval = typeValueEmpty;
|
||||
type = TypeInternalInt;
|
||||
}
|
||||
else
|
||||
|
|
@ -1825,11 +1826,12 @@ void ConsoleValue::setFloatValue(F32 val)
|
|||
{
|
||||
fval = val;
|
||||
ival = static_cast<U32>(val);
|
||||
if(sval != typeValueEmpty)
|
||||
if(bufferLen > 0)
|
||||
{
|
||||
if (type != TypeInternalStackString && type != TypeInternalStringStackPtr) dFree(sval);
|
||||
sval = typeValueEmpty;
|
||||
dFree(sval);
|
||||
bufferLen = 0;
|
||||
}
|
||||
sval = typeValueEmpty;
|
||||
type = TypeInternalFloat;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -186,20 +186,23 @@ public:
|
|||
fval = 0;
|
||||
sval = typeValueEmpty;
|
||||
bufferLen = 0;
|
||||
type = TypeInternalString;
|
||||
type = TypeInternalString;
|
||||
}
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
if (type <= TypeInternalString &&
|
||||
sval != typeValueEmpty && type != TypeInternalStackString && type != TypeInternalStringStackPtr)
|
||||
if ((type <= TypeInternalString) && (bufferLen > 0))
|
||||
{
|
||||
dFree(sval);
|
||||
bufferLen = 0;
|
||||
}
|
||||
sval = typeValueEmpty;
|
||||
type = ConsoleValue::TypeInternalString;
|
||||
ival = 0;
|
||||
fval = 0;
|
||||
bufferLen = 0;
|
||||
}
|
||||
ConsoleValue(){ init(); };
|
||||
~ConsoleValue(){ cleanup(); };
|
||||
};
|
||||
|
||||
// Proxy class for console variables
|
||||
|
|
@ -214,12 +217,6 @@ public:
|
|||
~ConsoleValueRef() { ; }
|
||||
|
||||
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; }
|
||||
|
||||
|
|
@ -1103,9 +1100,9 @@ struct ConsoleDocFragment
|
|||
static ConsoleDocFragment* smFirst;
|
||||
|
||||
ConsoleDocFragment( const char* text, const char* inClass = NULL, const char* definition = NULL )
|
||||
: mText( text ),
|
||||
mClass( inClass ),
|
||||
: mClass( inClass ),
|
||||
mDefinition( definition ),
|
||||
mText( text ),
|
||||
mNext( smFirst )
|
||||
{
|
||||
smFirst = this;
|
||||
|
|
|
|||
|
|
@ -34,10 +34,6 @@
|
|||
#include "core/util/journal/journal.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
|
||||
// link in this module which contains no other references.
|
||||
bool LinkConsoleFunctions = false;
|
||||
|
|
|
|||
|
|
@ -512,13 +512,17 @@ void ConsoleValue::setStringValue(const char * value)
|
|||
*/
|
||||
if (value == typeValueEmpty)
|
||||
{
|
||||
if (sval && sval != typeValueEmpty && type != TypeInternalStackString && type != TypeInternalStringStackPtr) dFree(sval);
|
||||
sval = typeValueEmpty;
|
||||
if (bufferLen > 0)
|
||||
{
|
||||
dFree(sval);
|
||||
bufferLen = 0;
|
||||
fval = 0.f;
|
||||
ival = 0;
|
||||
type = TypeInternalString;
|
||||
return;
|
||||
}
|
||||
|
||||
sval = typeValueEmpty;
|
||||
fval = 0.f;
|
||||
ival = 0;
|
||||
type = TypeInternalString;
|
||||
return;
|
||||
}
|
||||
|
||||
U32 stringLen = dStrlen(value);
|
||||
|
|
@ -541,7 +545,7 @@ void ConsoleValue::setStringValue(const char * value)
|
|||
// may as well pad to the next cache line
|
||||
U32 newLen = ((stringLen + 1) + 15) & ~15;
|
||||
|
||||
if(sval == typeValueEmpty || type == TypeInternalStackString || type == TypeInternalStringStackPtr)
|
||||
if(bufferLen == 0)
|
||||
sval = (char *) dMalloc(newLen);
|
||||
else if(newLen > bufferLen)
|
||||
sval = (char *) dRealloc(sval, newLen);
|
||||
|
|
@ -562,11 +566,16 @@ void ConsoleValue::setStackStringValue(const char *value)
|
|||
|
||||
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 (sval && sval != typeValueEmpty && type != ConsoleValue::TypeInternalStackString && type != ConsoleValue::TypeInternalStringStackPtr) dFree(sval);
|
||||
sval = typeValueEmpty;
|
||||
bufferLen = 0;
|
||||
fval = 0.f;
|
||||
ival = 0;
|
||||
type = TypeInternalString;
|
||||
|
|
@ -587,7 +596,7 @@ void ConsoleValue::setStackStringValue(const char *value)
|
|||
|
||||
type = TypeInternalStackString;
|
||||
sval = (char*)value;
|
||||
bufferLen = stringLen;
|
||||
bufferLen = 0;
|
||||
}
|
||||
else
|
||||
Con::setData(type, dataPtr, 0, 1, &value, enumTable);
|
||||
|
|
@ -598,7 +607,11 @@ void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue)
|
|||
if(type <= ConsoleValue::TypeInternalString)
|
||||
{
|
||||
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);
|
||||
if(stringLen < 256)
|
||||
|
|
@ -614,7 +627,7 @@ void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue)
|
|||
|
||||
type = TypeInternalStringStackPtr;
|
||||
sval = (char*)(value - STR.mBuffer);
|
||||
bufferLen = stringLen;
|
||||
bufferLen = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -680,8 +693,7 @@ Dictionary::Entry* Dictionary::addVariable( const char *name,
|
|||
Entry *ent = add(StringTable->insert(name));
|
||||
|
||||
if ( ent->value.type <= ConsoleValue::TypeInternalString &&
|
||||
ent->value.sval != typeValueEmpty &&
|
||||
ent->value.type != ConsoleValue::TypeInternalStackString && ent->value.type != ConsoleValue::TypeInternalStringStackPtr )
|
||||
ent->value.bufferLen > 0 )
|
||||
dFree(ent->value.sval);
|
||||
|
||||
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");
|
||||
|
||||
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)
|
||||
gDefaultParser = pParser;
|
||||
pParser->ext = ext;
|
||||
pParser->getCurrentFile = gcf;
|
||||
pParser->getCurrentLine = gcl;
|
||||
pParser->parse = p;
|
||||
pParser->restart = r;
|
||||
pParser->setScanBuffer = ssb;
|
||||
|
||||
pParser->next = gParserList;
|
||||
gParserList = pParser;
|
||||
if (def)
|
||||
gDefaultParser = pParser;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
pParser->next = gParserList;
|
||||
gParserList = pParser;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ConsoleParser * getParserForFile(const char *filename)
|
||||
|
|
|
|||
|
|
@ -48,11 +48,7 @@
|
|||
/// @{
|
||||
|
||||
#ifndef Offset
|
||||
#if defined(TORQUE_COMPILER_GCC) && (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))
|
||||
#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
|
||||
#define Offset(x, cls) offsetof(cls, x)
|
||||
#endif
|
||||
|
||||
class GFXShader;
|
||||
|
|
|
|||
|
|
@ -706,7 +706,7 @@ static bool dumpEngineDocs( const char *outputFile )
|
|||
// Dump pre-declarations for any groups we encountered
|
||||
// so that we don't have to explicitly define them.
|
||||
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() ) );
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,11 @@ struct EngineFunctionDefaultArguments
|
|||
|
||||
|
||||
// Need byte-aligned packing for the default argument structures.
|
||||
#ifdef _WIN64
|
||||
#pragma pack( push, 4 )
|
||||
#else
|
||||
#pragma pack( push, 1 )
|
||||
#endif
|
||||
|
||||
|
||||
// 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
|
||||
/// records.
|
||||
EngineFieldTable( const Field* fields )
|
||||
: mFields( fields ),
|
||||
mNumFields( 0 )
|
||||
: mNumFields( 0 ),
|
||||
mFields( fields )
|
||||
{
|
||||
while( fields[ mNumFields ].getName() )
|
||||
mNumFields ++;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ ConsoleValueRef SimConsoleThreadExecCallback::waitForResult()
|
|||
return retVal;
|
||||
}
|
||||
|
||||
return (const char*)NULL;
|
||||
return ConsoleValueRef();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ public:
|
|||
static S32 _smTypeId;
|
||||
|
||||
SimObjectRef()
|
||||
: mId( 0 ),
|
||||
mObject( NULL ),
|
||||
mName( "" )
|
||||
: mName( "" ),
|
||||
mId( 0 ),
|
||||
mObject( NULL )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -178,4 +178,4 @@ public:
|
|||
};
|
||||
|
||||
|
||||
#endif // _SIMOBJECTREF_H_
|
||||
#endif // _SIMOBJECTREF_H_
|
||||
|
|
|
|||
|
|
@ -79,9 +79,9 @@ class Module
|
|||
|
||||
Dependency( Mode mode, DependencyType type, Module* parentModule, const char* moduleName )
|
||||
: mType( type ),
|
||||
mNext( mode == ModeInitialize ? parentModule->mInitDependencies : parentModule->mShutdownDependencies ),
|
||||
mModuleName( moduleName ),
|
||||
mModule( NULL )
|
||||
mModule( NULL ),
|
||||
mNext( mode == ModeInitialize ? parentModule->mInitDependencies : parentModule->mShutdownDependencies )
|
||||
{
|
||||
if( mode == ModeInitialize )
|
||||
parentModule->mInitDependencies = this;
|
||||
|
|
@ -141,11 +141,12 @@ class Module
|
|||
}
|
||||
|
||||
Module()
|
||||
: mNext( smFirst ),
|
||||
: mIsInitialized( false ),
|
||||
mNext( smFirst ),
|
||||
mInitDependencies( NULL ),
|
||||
mShutdownDependencies( NULL ),
|
||||
mOverrides( NULL ),
|
||||
mIsInitialized( false )
|
||||
mOverrides( NULL )
|
||||
|
||||
{
|
||||
smFirst = this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,15 +39,12 @@ FileStream *FileStream::createAndOpen(const String &inFileName, Torque::FS::File
|
|||
{
|
||||
FileStream *newStream = new FileStream;
|
||||
|
||||
if ( newStream )
|
||||
{
|
||||
bool success = newStream->open( inFileName, inMode );
|
||||
bool success = newStream->open( inFileName, inMode );
|
||||
|
||||
if ( !success )
|
||||
{
|
||||
delete newStream;
|
||||
newStream = NULL;
|
||||
}
|
||||
if ( !success )
|
||||
{
|
||||
delete newStream;
|
||||
newStream = NULL;
|
||||
}
|
||||
|
||||
return newStream;
|
||||
|
|
|
|||
|
|
@ -36,10 +36,12 @@
|
|||
// These standard functions are not defined on Win32 and other Microsoft platforms...
|
||||
#define strcasecmp _stricmp
|
||||
#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
|
||||
#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
|
||||
#define FASTDELEGATE_H
|
||||
#if _MSC_VER > 1000
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1000)
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER > 1000)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Configuration options
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class RawDataT
|
|||
}
|
||||
|
||||
RawDataT( T* data, U32 size, bool ownMemory = false )
|
||||
: data( data ), size( size ), ownMemory( ownMemory ) {}
|
||||
: ownMemory( ownMemory ), data( data ), size( size ) {}
|
||||
|
||||
RawDataT(const ThisType& rd)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -567,7 +567,6 @@ String::String(const StringChar *str, SizeType len)
|
|||
PROFILE_SCOPE(String_char_len_constructor);
|
||||
if (str && *str && len!=0)
|
||||
{
|
||||
AssertFatal(len<=dStrlen(str), "String::String: string too short");
|
||||
_string = new ( len ) StringData( str );
|
||||
}
|
||||
else
|
||||
|
|
@ -657,6 +656,11 @@ bool String::isEmpty() const
|
|||
return ( _string == StringData::Empty() );
|
||||
}
|
||||
|
||||
bool String::isEmpty(const char* str)
|
||||
{
|
||||
return str == 0 || str[0] == '\0';
|
||||
}
|
||||
|
||||
bool String::isShared() const
|
||||
{
|
||||
return _string->isShared();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public:
|
|||
String();
|
||||
String(const String &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();
|
||||
|
||||
|
|
@ -74,6 +74,7 @@ public:
|
|||
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.
|
||||
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 [""]?
|
||||
|
||||
/// Erases all characters in a string.
|
||||
|
|
@ -292,11 +293,10 @@ private:
|
|||
// causes an ambiguous cast compile error. Making it private is simply
|
||||
// more insurance that it isn't used on different compilers.
|
||||
// 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; }
|
||||
#endif
|
||||
|
||||
|
||||
static void copy(StringChar *dst, const StringChar *src, U32 size);
|
||||
|
||||
StringData *_string;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class UnmanagedVector
|
|||
UnmanagedVector()
|
||||
: mCount( 0 ), mArray( NULL ) {}
|
||||
UnmanagedVector( T* array, U32 count )
|
||||
: mArray( array ), mCount( count ) {}
|
||||
: mCount( count ), mArray( array ) {}
|
||||
|
||||
U32 size() const { return mCount; }
|
||||
bool empty() const { return ( mCount == 0 ); }
|
||||
|
|
|
|||
|
|
@ -1091,7 +1091,7 @@ F32 GuiMeshRoadEditorCtrl::getNodeDepth()
|
|||
return 0.0f;
|
||||
}
|
||||
|
||||
void GuiMeshRoadEditorCtrl::setNodePosition( Point3F pos )
|
||||
void GuiMeshRoadEditorCtrl::setNodePosition(const Point3F& pos)
|
||||
{
|
||||
if ( mSelRoad && mSelNode != -1 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ class GuiMeshRoadEditorCtrl : public EditTSCtrl
|
|||
void setNodeDepth( F32 depth );
|
||||
|
||||
Point3F getNodePosition();
|
||||
void setNodePosition( Point3F pos );
|
||||
void setNodePosition(const Point3F& pos);
|
||||
|
||||
VectorF getNodeNormal();
|
||||
void setNodeNormal( const VectorF &normal );
|
||||
|
|
|
|||
|
|
@ -1235,7 +1235,7 @@ F32 GuiRiverEditorCtrl::getNodeDepth()
|
|||
return 0.0f;
|
||||
}
|
||||
|
||||
void GuiRiverEditorCtrl::setNodePosition( Point3F pos )
|
||||
void GuiRiverEditorCtrl::setNodePosition(const Point3F& pos)
|
||||
{
|
||||
if ( mSelRiver && mSelNode != -1 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class GuiRiverEditorCtrl : public EditTSCtrl
|
|||
void setNodeDepth( F32 depth );
|
||||
|
||||
Point3F getNodePosition();
|
||||
void setNodePosition( Point3F pos );
|
||||
void setNodePosition(const Point3F& pos);
|
||||
|
||||
VectorF getNodeNormal();
|
||||
void setNodeNormal( const VectorF &normal );
|
||||
|
|
|
|||
|
|
@ -979,7 +979,7 @@ F32 GuiRoadEditorCtrl::getNodeWidth()
|
|||
return 0.0f;
|
||||
}
|
||||
|
||||
void GuiRoadEditorCtrl::setNodePosition( Point3F pos )
|
||||
void GuiRoadEditorCtrl::setNodePosition(const Point3F& pos)
|
||||
{
|
||||
if ( mSelRoad && mSelNode != -1 )
|
||||
{
|
||||
|
|
@ -1109,4 +1109,4 @@ DefineConsoleMethod( GuiRoadEditorCtrl, deleteRoad, void, (), , "" )
|
|||
DefineConsoleMethod(GuiRoadEditorCtrl, setSelectedNode, void, (S32 node), , "")
|
||||
{
|
||||
object->setSelectedNode(node);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class GuiRoadEditorCtrl : public EditTSCtrl
|
|||
void setNodeWidth( F32 width );
|
||||
|
||||
Point3F getNodePosition();
|
||||
void setNodePosition( Point3F pos );
|
||||
void setNodePosition(const Point3F& pos);
|
||||
|
||||
void setTextureFile( StringTableEntry file );
|
||||
|
||||
|
|
|
|||
|
|
@ -637,12 +637,13 @@ void ScatterSky::prepRenderImage( SceneRenderState *state )
|
|||
return;
|
||||
|
||||
// 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->type = RenderPassManager::RIT_Sky;
|
||||
ri->defaultKey = 10;
|
||||
ri->defaultKey2 = 0;
|
||||
state->getRenderPass()->addInst( ri );
|
||||
renderPass->addInst(ri);
|
||||
|
||||
// Debug render instance.
|
||||
/*
|
||||
|
|
@ -685,13 +686,13 @@ void ScatterSky::prepRenderImage( SceneRenderState *state )
|
|||
mMatrixSet->setSceneProjection(GFX->getProjectionMatrix());
|
||||
mMatrixSet->setWorld(GFX->getWorldMatrix());
|
||||
|
||||
ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
|
||||
ObjectRenderInst *ri = renderPass->allocInst<ObjectRenderInst>();
|
||||
ri->renderDelegate.bind( this, &ScatterSky::_renderMoon );
|
||||
ri->type = RenderPassManager::RIT_Sky;
|
||||
// Render after sky objects and before CloudLayer!
|
||||
ri->defaultKey = 5;
|
||||
ri->defaultKey2 = 0;
|
||||
state->getRenderPass()->addInst( ri );
|
||||
renderPass->addInst(ri);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ void ForestEditorCtrl::onSleep()
|
|||
|
||||
bool ForestEditorCtrl::updateActiveForest( bool createNew )
|
||||
{
|
||||
mForest = dynamic_cast<Forest*>( Sim::findObject( "theForest" ) );
|
||||
Con::executef( this, "onActiveForestUpdated", mForest ? mForest->getIdString() : "", createNew ? "1" : "0" );
|
||||
|
||||
if ( mTool )
|
||||
|
|
@ -400,4 +399,13 @@ DefineConsoleMethod( ForestEditorCtrl, deleteMeshSafe, void, ( const char * obj
|
|||
DefineConsoleMethod( ForestEditorCtrl, isDirty, bool, (), , "" )
|
||||
{
|
||||
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.
|
||||
bool updateActiveForest( bool createNew );
|
||||
|
||||
/// Sets the active Forest
|
||||
void setActiveForest(Forest* forestObject) { mForest = forestObject; }
|
||||
|
||||
/// Returns the active Forest.
|
||||
Forest *getActiveForest() const { return mForest; }
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ Point3F Selection<ForestItem>::getOrigin()
|
|||
|
||||
Selection<ForestItem>::iterator itr = begin();
|
||||
|
||||
for ( ; itr != end(); itr++ )
|
||||
for (; itr != end(); ++itr)
|
||||
{
|
||||
const MatrixF &mat = itr->getTransform();
|
||||
Point3F wPos;
|
||||
|
|
@ -450,10 +450,11 @@ void ForestSelectionTool::onRender2D()
|
|||
F32 hscale = wwidth * 2 / F32(mEditor->getWidth());
|
||||
F32 vscale = wheight * 2 / F32(mEditor->getHeight());
|
||||
|
||||
F32 left = (mDragRect.point.x - mEditor->getPosition().x) * hscale - wwidth;
|
||||
F32 right = (mDragRect.point.x - mEditor->getPosition().x + mDragRect.extent.x) * hscale - wwidth;
|
||||
F32 top = wheight - vscale * (mDragRect.point.y - mEditor->getPosition().y);
|
||||
F32 bottom = wheight - vscale * (mDragRect.point.y - mEditor->getPosition().y + mDragRect.extent.y);
|
||||
Point2I editorPosition = mEditor->getPosition();
|
||||
F32 left = (mDragRect.point.x - editorPosition.x) * hscale - wwidth;
|
||||
F32 right = (mDragRect.point.x - editorPosition.x + mDragRect.extent.x) * hscale - wwidth;
|
||||
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 );
|
||||
|
||||
mForest->getData()->getItems( gDragFrustum, &mDragSelection );
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ void Forest::createNewFile()
|
|||
|
||||
void Forest::saveDataFile( const char *path )
|
||||
{
|
||||
if ( path )
|
||||
if ( path && !String::isEmpty(path))
|
||||
mDataFileName = StringTable->insert( path );
|
||||
|
||||
if ( mData )
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ bool ForestData::castRay( const Point3F &start, const Point3F &end, RayInfo *out
|
|||
shortest.t = F32_MAX;
|
||||
|
||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||
for ( ; iter != mBuckets.end(); iter++ )
|
||||
for (; iter != mBuckets.end(); ++iter)
|
||||
{
|
||||
if ( iter->value->castRay( start, end, outInfo, rendered ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ void ForestData::clear()
|
|||
// clean up its sub-cells in its destructor.
|
||||
|
||||
BucketTable::Iterator iter = mBuckets.begin();
|
||||
for ( ; iter != mBuckets.end(); iter++ ) delete iter->value;
|
||||
for (; iter != mBuckets.end(); ++iter) delete iter->value;
|
||||
mBuckets.clear();
|
||||
|
||||
mIsDirty = true;
|
||||
|
|
@ -408,7 +408,7 @@ const ForestItem& ForestData::findItem( ForestItemKey key ) const
|
|||
|
||||
Vector<const ForestCell*> stack;
|
||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||
for ( ; iter != mBuckets.end(); iter++ )
|
||||
for (; iter != mBuckets.end(); ++iter)
|
||||
stack.push_back( iter->value );
|
||||
|
||||
// Now loop till we run out of cells.
|
||||
|
|
@ -444,7 +444,7 @@ U32 ForestData::getItems( Vector<ForestItem> *outItems ) const
|
|||
U32 count = 0;
|
||||
|
||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||
for ( ; iter != mBuckets.end(); iter++ )
|
||||
for (; iter != mBuckets.end(); ++iter)
|
||||
stack.push_back( iter->value );
|
||||
|
||||
// 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;
|
||||
|
||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||
for ( ; iter != mBuckets.end(); iter++ )
|
||||
for (; iter != mBuckets.end(); ++iter)
|
||||
stack.push_back( iter->value );
|
||||
|
||||
// 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;
|
||||
|
||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||
for ( ; iter != mBuckets.end(); iter++ )
|
||||
for (; iter != mBuckets.end(); ++iter)
|
||||
stack.push_back( iter->value );
|
||||
|
||||
const F32 radiusSq = radius * radius;
|
||||
|
|
@ -629,7 +629,7 @@ U32 ForestData::getItems( const Point2F &point, F32 radius, Vector<ForestItem> *
|
|||
U32 count = 0;
|
||||
|
||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||
for ( ; iter != mBuckets.end(); iter++ )
|
||||
for (; iter != mBuckets.end(); ++iter)
|
||||
stack.push_back( iter->value );
|
||||
|
||||
const F32 radiusSq = radius * radius;
|
||||
|
|
@ -686,7 +686,7 @@ U32 ForestData::getItems( const ForestItemData *data, Vector<ForestItem> *outIte
|
|||
U32 count = 0;
|
||||
|
||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||
for ( ; iter != mBuckets.end(); iter++ )
|
||||
for (; iter != mBuckets.end(); ++iter)
|
||||
stack.push_back( iter->value );
|
||||
|
||||
// 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 );
|
||||
|
||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||
for ( ; iter != mBuckets.end(); iter++ )
|
||||
for (; iter != mBuckets.end(); ++iter)
|
||||
{
|
||||
if ( !frustum.isCulled( iter->value->getBounds() ) )
|
||||
outCells->push_back( iter->value );
|
||||
|
|
@ -736,7 +736,7 @@ void ForestData::getCells( Vector<ForestCell*> *outCells ) const
|
|||
PROFILE_SCOPE( ForestData_getCells_nofrustum );
|
||||
|
||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||
for ( ; iter != mBuckets.end(); iter++ )
|
||||
for (; iter != mBuckets.end(); ++iter)
|
||||
outCells->push_back( iter->value );
|
||||
}
|
||||
|
||||
|
|
@ -746,7 +746,7 @@ U32 ForestData::getDatablocks( Vector<ForestItemData*> *outVector ) const
|
|||
U32 count = 0;
|
||||
|
||||
BucketTable::ConstIterator iter = mBuckets.begin();
|
||||
for ( ; iter != mBuckets.end(); iter++ )
|
||||
for (; iter != mBuckets.end(); ++iter)
|
||||
stack.push_back( iter->value );
|
||||
|
||||
// Now loop till we run out of cells.
|
||||
|
|
@ -786,7 +786,7 @@ void ForestData::clearPhysicsRep( Forest *forest )
|
|||
Vector<ForestCell*> stack;
|
||||
|
||||
BucketTable::Iterator iter = mBuckets.begin();
|
||||
for ( ; iter != mBuckets.end(); iter++ )
|
||||
for (; iter != mBuckets.end(); ++iter)
|
||||
stack.push_back( iter->value );
|
||||
|
||||
// Now loop till we run out of cells.
|
||||
|
|
@ -812,7 +812,7 @@ void ForestData::buildPhysicsRep( Forest *forest )
|
|||
Vector<ForestCell*> stack;
|
||||
|
||||
BucketTable::Iterator iter = mBuckets.begin();
|
||||
for ( ; iter != mBuckets.end(); iter++ )
|
||||
for (; iter != mBuckets.end(); ++iter)
|
||||
stack.push_back( iter->value );
|
||||
|
||||
// Now loop till we run out of cells.
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ ForestWindMgr::ForestWindMgr()
|
|||
ForestWindMgr::~ForestWindMgr()
|
||||
{
|
||||
IdToWindMap::Iterator sourceIter = mSources->begin();
|
||||
for( ; sourceIter != mSources->end(); sourceIter++ )
|
||||
for (; sourceIter != mSources->end(); ++sourceIter)
|
||||
delete (*sourceIter).value;
|
||||
|
||||
delete mSources;
|
||||
|
|
@ -185,7 +185,7 @@ void ForestWindMgr::processTick()
|
|||
PROFILE_SCOPE( ForestWindMgr_AdvanceTime_Cleanup );
|
||||
|
||||
IdToWindMap::Iterator sourceIter = mPrevSources->begin();
|
||||
for( ; sourceIter != mPrevSources->end(); sourceIter++ )
|
||||
for (; sourceIter != mPrevSources->end(); ++sourceIter)
|
||||
{
|
||||
ForestWindAccumulator *accum = (*sourceIter).value;
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public:
|
|||
const Vector<S32>& getLOSDetails() const { return mLOSDetails; }
|
||||
|
||||
// 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;
|
||||
ForestCellBatch* allocateBatch() const;
|
||||
bool canBillboard( const SceneRenderState *state, const ForestItem &item, F32 distToCamera ) const;
|
||||
|
|
|
|||
|
|
@ -695,9 +695,9 @@ GFXShader* GFXD3D9Device::createShader()
|
|||
return shader;
|
||||
}
|
||||
|
||||
void GFXD3D9Device::disableShaders()
|
||||
void GFXD3D9Device::disableShaders(bool force)
|
||||
{
|
||||
setShader( NULL );
|
||||
setShader( NULL, force );
|
||||
setShaderConstBuffer( NULL );
|
||||
}
|
||||
|
||||
|
|
@ -706,25 +706,24 @@ void GFXD3D9Device::disableShaders()
|
|||
// and to make sure redundant shader states are not being
|
||||
// sent to the card.
|
||||
//-----------------------------------------------------------------------------
|
||||
void GFXD3D9Device::setShader( GFXShader *shader )
|
||||
void GFXD3D9Device::setShader( GFXShader *shader, bool force )
|
||||
{
|
||||
GFXD3D9Shader *d3dShader = static_cast<GFXD3D9Shader*>( shader );
|
||||
|
||||
IDirect3DPixelShader9 *pixShader = ( d3dShader != NULL ? d3dShader->mPixShader : NULL );
|
||||
IDirect3DVertexShader9 *vertShader = ( d3dShader ? d3dShader->mVertShader : NULL );
|
||||
|
||||
if( pixShader != mLastPixShader )
|
||||
if( pixShader != mLastPixShader || force )
|
||||
{
|
||||
mD3DDevice->SetPixelShader( pixShader );
|
||||
mLastPixShader = pixShader;
|
||||
}
|
||||
|
||||
if( vertShader != mLastVertShader )
|
||||
if( vertShader != mLastVertShader || force )
|
||||
{
|
||||
mD3DDevice->SetVertexShader( vertShader );
|
||||
mLastVertShader = vertShader;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ inline void D3D9Assert( HRESULT hr, const char *info )
|
|||
|
||||
// Typedefs
|
||||
#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"
|
||||
#undef D3DX_FUNCTION
|
||||
|
||||
|
|
@ -238,7 +238,7 @@ protected:
|
|||
// }
|
||||
|
||||
virtual GFXShader* createShader();
|
||||
void disableShaders();
|
||||
void disableShaders(bool force = false);
|
||||
|
||||
/// Device helper function
|
||||
virtual D3DPRESENT_PARAMETERS setupPresentParams( const GFXVideoMode &mode, const HWND &hwnd ) const = 0;
|
||||
|
|
@ -272,7 +272,7 @@ public:
|
|||
|
||||
virtual F32 getPixelShaderVersion() const { return mPixVersion; }
|
||||
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 getNumRenderTargets() const { return mNumRenderTargets; }
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ extern _D3DDECLTYPE GFXD3D9DeclType[GFXDeclType_COUNT];
|
|||
|
||||
#define GFXREVERSE_LOOKUP( tablearray, enumprefix, val ) \
|
||||
for( S32 i = enumprefix##_FIRST; i < enumprefix##_COUNT; i++ ) \
|
||||
if( (S32)tablearray##[i] == val ) \
|
||||
if( (S32)tablearray[i] == val ) \
|
||||
{ \
|
||||
val = i; \
|
||||
break; \
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@ _D3DDECLTYPE GFXD3D9DeclType[GFXDeclType_COUNT];
|
|||
|
||||
#define INIT_LOOKUPTABLE( tablearray, enumprefix, type ) \
|
||||
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 ) \
|
||||
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 ); \
|
||||
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 );
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
glyphList.increment();
|
||||
glyphList.last().bitmap = new GBitmap(mCharInfoList[i].width + kerning + 2*padding, mCharInfoList[i].height + 2*padding, false, strip->getFormat());
|
||||
glyphList.last().charId = i;
|
||||
GlyphMap& lastGlyphMap = glyphList.last();
|
||||
lastGlyphMap.bitmap = new GBitmap(mCharInfoList[i].width + kerning + 2 * padding, mCharInfoList[i].height + 2 * padding, false, strip->getFormat());
|
||||
lastGlyphMap.charId = i;
|
||||
|
||||
// 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);
|
||||
glyphList.last().bitmap->copyRect(strip, ri, outRi);
|
||||
lastGlyphMap.bitmap->copyRect(strip, ri, outRi);
|
||||
|
||||
// Update glyph attributes.
|
||||
mCharInfoList[i].width = glyphList.last().bitmap->getWidth();
|
||||
mCharInfoList[i].height = glyphList.last().bitmap->getHeight();
|
||||
mCharInfoList[i].width = lastGlyphMap.bitmap->getWidth();
|
||||
mCharInfoList[i].height = lastGlyphMap.bitmap->getHeight();
|
||||
mCharInfoList[i].xOffset -= kerning + padding;
|
||||
mCharInfoList[i].xIncrement += kerning;
|
||||
mCharInfoList[i].yOffset -= padding;
|
||||
|
|
|
|||
|
|
@ -161,7 +161,6 @@ GFXDevice::GFXDevice()
|
|||
mAllowRender = true;
|
||||
mCurrentRenderStyle = RS_Standard;
|
||||
mCurrentProjectionOffset = Point2F::Zero;
|
||||
mStereoEyeOffset = Point3F::Zero;
|
||||
mCanCurrentlyRender = false;
|
||||
mInitialized = false;
|
||||
|
||||
|
|
@ -197,6 +196,9 @@ GFXDevice::GFXDevice()
|
|||
#elif defined TORQUE_OS_PS3
|
||||
GFXShader::addGlobalMacro( "TORQUE_OS_PS3" );
|
||||
#endif
|
||||
|
||||
mStereoTargets[0] = NULL;
|
||||
mStereoTargets[1] = NULL;
|
||||
}
|
||||
|
||||
GFXDrawUtil* GFXDevice::getDrawUtil()
|
||||
|
|
@ -733,14 +735,14 @@ void GFXDevice::setLight(U32 stage, GFXLightInfo* light)
|
|||
//-----------------------------------------------------------------------------
|
||||
// Set Light Material
|
||||
//-----------------------------------------------------------------------------
|
||||
void GFXDevice::setLightMaterial(GFXLightMaterial mat)
|
||||
void GFXDevice::setLightMaterial(const GFXLightMaterial& mat)
|
||||
{
|
||||
mCurrentLightMaterial = mat;
|
||||
mLightMaterialDirty = true;
|
||||
mStateDirty = true;
|
||||
}
|
||||
|
||||
void GFXDevice::setGlobalAmbientColor(ColorF color)
|
||||
void GFXDevice::setGlobalAmbientColor(const ColorF& color)
|
||||
{
|
||||
if(mGlobalAmbientColor != color)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -213,6 +213,9 @@ public:
|
|||
/// The device is about to finish rendering a frame
|
||||
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)
|
||||
deStartOfField,
|
||||
|
||||
|
|
@ -244,7 +247,12 @@ public:
|
|||
enum GFXDeviceRenderStyles
|
||||
{
|
||||
RS_Standard = 0,
|
||||
RS_StereoSideBySide = (1<<0),
|
||||
RS_StereoSideBySide = (1<<0), // Render into current Render Target side-by-side
|
||||
};
|
||||
|
||||
enum GFXDeviceLimits
|
||||
{
|
||||
NumStereoPorts = 2
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
@ -277,7 +285,19 @@ protected:
|
|||
Point2F mCurrentProjectionOffset;
|
||||
|
||||
/// 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
|
||||
/// have operations performed on it.
|
||||
|
|
@ -323,10 +343,50 @@ public:
|
|||
void setCurrentProjectionOffset(const Point2F& offset) { mCurrentProjectionOffset = offset; }
|
||||
|
||||
/// 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
|
||||
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; }
|
||||
|
||||
|
|
@ -722,8 +782,8 @@ public:
|
|||
/// Returns the number of simultaneous render targets supported by the device.
|
||||
virtual U32 getNumRenderTargets() const = 0;
|
||||
|
||||
virtual void setShader( GFXShader *shader ) {}
|
||||
virtual void disableShaders() {} // TODO Remove when T3D 4.0
|
||||
virtual void setShader( GFXShader *shader, bool force = false ) {}
|
||||
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)
|
||||
void setShaderConstBuffer(GFXShaderConstBuffer* buffer);
|
||||
|
|
@ -841,8 +901,8 @@ public:
|
|||
/// because of the state caching stuff.
|
||||
/// @{
|
||||
void setLight(U32 stage, GFXLightInfo* light);
|
||||
void setLightMaterial(GFXLightMaterial mat);
|
||||
void setGlobalAmbientColor(ColorF color);
|
||||
void setLightMaterial(const GFXLightMaterial& mat);
|
||||
void setGlobalAmbientColor(const ColorF& color);
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
|
|||
|
|
@ -192,13 +192,13 @@ void GFXTextureManager::cleanupPool()
|
|||
// This texture is unreferenced, so take the time
|
||||
// now to completely remove it from the pool.
|
||||
TexturePoolMap::Iterator unref = iter;
|
||||
iter++;
|
||||
++iter;
|
||||
unref->value = NULL;
|
||||
mTexturePool.erase( unref );
|
||||
continue;
|
||||
}
|
||||
|
||||
iter++;
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1041,7 +1041,8 @@ void GFXTextureManager::_validateTexParams( const U32 width, const U32 height,
|
|||
}
|
||||
|
||||
// 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 )
|
||||
{
|
||||
|
|
@ -1057,16 +1058,16 @@ void GFXTextureManager::_validateTexParams( const U32 width, const U32 height,
|
|||
{
|
||||
case GFXFormatR8G8B8:
|
||||
testingFormat = GFXFormatR8G8B8X8;
|
||||
chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
|
||||
chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
|
||||
break;
|
||||
|
||||
case GFXFormatA8:
|
||||
testingFormat = GFXFormatR8G8B8A8;
|
||||
chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
|
||||
chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
|
||||
break;
|
||||
|
||||
default:
|
||||
chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
|
||||
chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,11 +64,11 @@ public:
|
|||
const GFXVertexFormat *vertexFormat,
|
||||
U32 vertexSize,
|
||||
GFXBufferType bufferType )
|
||||
: mDevice( device ),
|
||||
mVolatileStart( 0 ),
|
||||
mNumVerts( numVerts ),
|
||||
: mNumVerts( numVerts ),
|
||||
mVertexSize( vertexSize ),
|
||||
mBufferType( bufferType )
|
||||
mBufferType( bufferType ),
|
||||
mDevice( device ),
|
||||
mVolatileStart( 0 )
|
||||
{
|
||||
if ( vertexFormat )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -114,10 +114,11 @@ void GFXVertexFormat::addElement( const String& semantic, GFXDeclType type, U32
|
|||
{
|
||||
mDirty = true;
|
||||
mElements.increment();
|
||||
mElements.last().mStreamIndex = stream;
|
||||
mElements.last().mSemantic = semantic.intern();
|
||||
mElements.last().mSemanticIndex = index;
|
||||
mElements.last().mType = type;
|
||||
GFXVertexElement& lastElement = mElements.last();
|
||||
lastElement.mStreamIndex = stream;
|
||||
lastElement.mSemantic = semantic.intern();
|
||||
lastElement.mSemanticIndex = index;
|
||||
lastElement.mType = type;
|
||||
}
|
||||
|
||||
const String& GFXVertexFormat::getDescription() const
|
||||
|
|
|
|||
|
|
@ -811,9 +811,9 @@ GFXShader* GFXGLDevice::createShader()
|
|||
return shader;
|
||||
}
|
||||
|
||||
void GFXGLDevice::setShader( GFXShader *shader )
|
||||
void GFXGLDevice::setShader(GFXShader *shader, bool force)
|
||||
{
|
||||
if(mCurrentShader == shader)
|
||||
if(mCurrentShader == shader && !force)
|
||||
return;
|
||||
|
||||
if ( shader )
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public:
|
|||
virtual F32 getPixelShaderVersion() const { return mPixelShaderVersion; }
|
||||
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!
|
||||
virtual GFXFormat selectSupportedFormat(GFXTextureProfile *profile,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "platform/platform.h"
|
||||
#include "gui/3d/guiTSControl.h"
|
||||
#include "gui/core/guiOffscreenCanvas.h"
|
||||
|
||||
#include "console/engineAPI.h"
|
||||
#include "scene/sceneManager.h"
|
||||
|
|
@ -34,7 +35,12 @@
|
|||
#include "scene/reflectionManager.h"
|
||||
#include "postFx/postEffectManager.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 );
|
||||
|
||||
|
|
@ -51,6 +57,7 @@ ConsoleDocClass( GuiTSCtrl,
|
|||
);
|
||||
|
||||
U32 GuiTSCtrl::smFrameCount = 0;
|
||||
bool GuiTSCtrl::smUseLatestDisplayTransform = true;
|
||||
Vector<GuiTSCtrl*> GuiTSCtrl::smAwakeTSCtrls;
|
||||
|
||||
ImplementEnumType( GuiTSRenderStyles,
|
||||
|
|
@ -60,7 +67,6 @@ ImplementEnumType( GuiTSRenderStyles,
|
|||
{ GuiTSCtrl::RenderStyleStereoSideBySide, "stereo side by side" },
|
||||
EndImplementEnumType;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace
|
||||
|
|
@ -153,7 +159,8 @@ GuiTSCtrl::GuiTSCtrl()
|
|||
mLastCameraQuery.nearPlane = 0.01f;
|
||||
|
||||
mLastCameraQuery.projectionOffset = Point2F::Zero;
|
||||
mLastCameraQuery.eyeOffset = Point3F::Zero;
|
||||
mLastCameraQuery.hasFovPort = false;
|
||||
mLastCameraQuery.hasStereoTargets = 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"
|
||||
"@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!" );
|
||||
smAwakeTSCtrls.push_back( this );
|
||||
|
||||
// For VR
|
||||
mLastCameraQuery.drawCanvas = getRoot();
|
||||
|
||||
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)
|
||||
{
|
||||
// Save the current transforms so we can restore
|
||||
// it for child control rendering below.
|
||||
GFXTransformSaver saver;
|
||||
bool renderingToTarget = false;
|
||||
|
||||
if(!processCameraQuery(&mLastCameraQuery))
|
||||
{
|
||||
|
|
@ -317,15 +370,70 @@ void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
return;
|
||||
}
|
||||
|
||||
GFXTargetRef origTarget = GFX->getActiveRenderTarget();
|
||||
|
||||
// Set up the appropriate render style
|
||||
U32 prevRenderStyle = GFX->getCurrentRenderStyle();
|
||||
Point2F prevProjectionOffset = GFX->getCurrentProjectionOffset();
|
||||
Point3F prevEyeOffset = GFX->getStereoEyeOffset();
|
||||
Point2I renderSize = getExtent();
|
||||
|
||||
if(mRenderStyle == RenderStyleStereoSideBySide)
|
||||
{
|
||||
GFX->setCurrentRenderStyle(GFXDevice::RS_StereoSideBySide);
|
||||
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
|
||||
{
|
||||
|
|
@ -354,41 +462,37 @@ void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
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;
|
||||
if(mRenderStyle == RenderStyleStereoSideBySide)
|
||||
{
|
||||
F32 left = 0.0f * hscale - wwidth;
|
||||
F32 right = renderWidth * hscale - wwidth;
|
||||
F32 top = wheight - vscale * 0.0f;
|
||||
F32 bottom = wheight - vscale * renderHeight;
|
||||
|
||||
frustum.set( mLastCameraQuery.ortho, left, right, top, bottom, mLastCameraQuery.nearPlane, mLastCameraQuery.farPlane );
|
||||
// NOTE: these calculations are essentially overridden later by the fov port settings when rendering each eye.
|
||||
MathUtils::makeFovPortFrustum(&frustum, mLastCameraQuery.ortho, mLastCameraQuery.nearPlane, mLastCameraQuery.farPlane, mLastCameraQuery.fovPort[0]);
|
||||
}
|
||||
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 right = (updateRect.point.x + updateRect.extent.x - offset.x) * hscale - wwidth;
|
||||
F32 top = wheight - vscale * (updateRect.point.y - offset.y);
|
||||
|
|
@ -407,15 +511,24 @@ void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
RectI tempRect = updateRect;
|
||||
|
||||
#ifdef TORQUE_OS_MAC
|
||||
Point2I screensize = getRoot()->getWindowSize();
|
||||
tempRect.point.y = screensize.y - (tempRect.point.y + tempRect.extent.y);
|
||||
#endif
|
||||
if (!renderingToTarget)
|
||||
{
|
||||
#ifdef TORQUE_OS_MAC
|
||||
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
|
||||
GFX->clear( GFXClearZBuffer , ColorI(20,20,20), 1.0f, 0 );
|
||||
//GFX->clear( GFXClearTarget, ColorI(255,0,0), 1.0f, 0);
|
||||
|
||||
GFX->setFrustum( frustum );
|
||||
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
|
||||
// pixels - let the scene know so that it can calculate e.g. reflections
|
||||
// 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
|
||||
// change the cameraMatrix in mLastCameraQuery. This is because
|
||||
|
|
@ -455,20 +568,121 @@ void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
renderWorld(updateRect);
|
||||
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
|
||||
// we begin rendering the child controls.
|
||||
saver.restore();
|
||||
|
||||
// Restore the render style and any stereo parameters
|
||||
GFX->setActiveRenderTarget(origTarget);
|
||||
GFX->setCurrentRenderStyle(prevRenderStyle);
|
||||
GFX->setCurrentProjectionOffset(prevProjectionOffset);
|
||||
GFX->setStereoEyeOffset(prevEyeOffset);
|
||||
|
||||
|
||||
if(mRenderStyle == RenderStyleStereoSideBySide && gLastStereoTexture)
|
||||
{
|
||||
GFX->setClipRect(updateRect);
|
||||
GFX->getDrawUtil()->drawBitmapStretch(gLastStereoTexture, updateRect);
|
||||
}
|
||||
|
||||
// Allow subclasses to render 2D elements.
|
||||
GFX->setClipRect(updateRect);
|
||||
renderGui( offset, updateRect );
|
||||
|
||||
renderChildControls(offset, updateRect);
|
||||
if (shouldRenderChildControls())
|
||||
{
|
||||
renderChildControls(offset, updateRect);
|
||||
}
|
||||
smFrameCount++;
|
||||
}
|
||||
|
||||
|
|
@ -499,6 +713,12 @@ void GuiTSCtrl::drawLineList( const Vector<Point3F> &points, const ColorI color,
|
|||
drawLine( points[i], points[i+1], color, width );
|
||||
}
|
||||
|
||||
|
||||
void GuiTSCtrl::setStereoGui(GuiOffscreenCanvas *canvas)
|
||||
{
|
||||
mStereoGuiTarget = canvas ? canvas->getTarget() : NULL;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Console Methods.
|
||||
//=============================================================================
|
||||
|
|
@ -547,3 +767,10 @@ DefineEngineMethod( GuiTSCtrl, calculateViewDistance, F32, ( F32 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"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _MATTEXTURETARGET_H_
|
||||
#include "materials/matTextureTarget.h"
|
||||
#endif
|
||||
|
||||
class IDisplayDevice;
|
||||
class GuiOffscreenCanvas;
|
||||
|
||||
struct CameraQuery
|
||||
{
|
||||
SimObject* object;
|
||||
F32 nearPlane;
|
||||
F32 farPlane;
|
||||
F32 fov;
|
||||
FovPort fovPort[2]; // fov for each eye
|
||||
Point2F projectionOffset;
|
||||
Point3F eyeOffset;
|
||||
Point3F eyeOffset[2];
|
||||
MatrixF eyeTransforms[2];
|
||||
bool ortho;
|
||||
bool hasFovPort;
|
||||
bool hasStereoTargets;
|
||||
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.
|
||||
|
|
@ -50,11 +65,12 @@ class GuiTSCtrl : public GuiContainer
|
|||
public:
|
||||
enum RenderStyles {
|
||||
RenderStyleStandard = 0,
|
||||
RenderStyleStereoSideBySide = (1<<0),
|
||||
RenderStyleStereoSideBySide = (1<<0)
|
||||
};
|
||||
|
||||
protected:
|
||||
static U32 smFrameCount;
|
||||
static bool smUseLatestDisplayTransform;
|
||||
F32 mCameraZRot;
|
||||
F32 mForceFOV;
|
||||
|
||||
|
|
@ -83,7 +99,11 @@ protected:
|
|||
|
||||
/// The last camera query set in onRender.
|
||||
/// @see getLastCameraQuery
|
||||
CameraQuery mLastCameraQuery;
|
||||
CameraQuery mLastCameraQuery;
|
||||
|
||||
NamedTexTargetRef mStereoGuiTarget;
|
||||
GFXVertexBufferHandle<GFXVertexPCT> mStereoOverlayVB;
|
||||
GFXStateBlockRef mStereoGuiSB;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -155,6 +175,10 @@ public:
|
|||
|
||||
static const U32& getFrameCount() { return smFrameCount; }
|
||||
|
||||
bool shouldRenderChildControls() { return mRenderStyle == RenderStyleStandard; }
|
||||
|
||||
void setStereoGui(GuiOffscreenCanvas *canvas);
|
||||
|
||||
DECLARE_CONOBJECT(GuiTSCtrl);
|
||||
DECLARE_CATEGORY( "Gui 3D" );
|
||||
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; }
|
||||
|
||||
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, () );
|
||||
/// @}
|
||||
virtual void processTick();
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -152,7 +153,6 @@ class GuiRolloutCtrl : public GuiTickCtrl
|
|||
|
||||
// Sizing Animation Functions
|
||||
void animateTo( S32 height );
|
||||
virtual void processTick();
|
||||
|
||||
void collapse() { animateTo( mHeader.extent.y ); }
|
||||
void expand() { animateTo( mExpanded.extent.y ); }
|
||||
|
|
|
|||
|
|
@ -1091,8 +1091,9 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
|
|||
}
|
||||
|
||||
// Render Up Arrow.
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[upArrowBitmap] );
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[upArrowBitmap]);
|
||||
|
||||
// Update Pos.
|
||||
pos.y += mBitmapBounds[upArrowBitmap].extent.y;
|
||||
|
|
@ -1118,8 +1119,8 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
|
|||
if ( trackRect.extent.y > 0 )
|
||||
{
|
||||
// Render Track.
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR( mTextureObject, trackRect, mBitmapBounds[trackBitmap] );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretchSR(mTextureObject, trackRect, mBitmapBounds[trackBitmap]);
|
||||
}
|
||||
|
||||
// Update Pos.
|
||||
|
|
@ -1137,8 +1138,8 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
|
|||
}
|
||||
|
||||
// Render Down Arrow.
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[downArrowBitmap] );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[downArrowBitmap]);
|
||||
|
||||
// Render the Thumb?
|
||||
if ( !mVBarEnabled )
|
||||
|
|
@ -1163,8 +1164,8 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
|
|||
}
|
||||
|
||||
// Render Thumb Top.
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[thumbBitmapTop] );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[thumbBitmapTop]);
|
||||
|
||||
// Update Pos.
|
||||
pos.y += mBitmapBounds[thumbBitmapTop].extent.y;
|
||||
|
|
@ -1179,16 +1180,16 @@ void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
|
|||
if ( thumbRect.extent.y > 0 )
|
||||
{
|
||||
// Render Track.
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR( mTextureObject, thumbRect, mBitmapBounds[thumbBitmapMiddle] );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretchSR(mTextureObject, thumbRect, mBitmapBounds[thumbBitmapMiddle]);
|
||||
}
|
||||
|
||||
// Update Pos.
|
||||
pos.y += thumbRect.extent.y;
|
||||
|
||||
// Render the Thumb Bottom.
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[thumbBitmapBottom] );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[thumbBitmapBottom]);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -1215,8 +1216,9 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
|
|||
}
|
||||
|
||||
// Render Up Arrow.
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[leftArrowBitmap] );
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[leftArrowBitmap]);
|
||||
|
||||
// Update Pos.
|
||||
pos.x += mBitmapBounds[leftArrowBitmap].extent.x;
|
||||
|
|
@ -1242,8 +1244,8 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
|
|||
if ( trackRect.extent.x > 0 )
|
||||
{
|
||||
// Render Track.
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR( mTextureObject, trackRect, mBitmapBounds[trackBitmap] );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretchSR(mTextureObject, trackRect, mBitmapBounds[trackBitmap]);
|
||||
}
|
||||
|
||||
// Update Pos.
|
||||
|
|
@ -1261,8 +1263,8 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
|
|||
}
|
||||
|
||||
// Render Right Arrow.
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[rightArrowBitmap] );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[rightArrowBitmap]);
|
||||
|
||||
// Render the Thumb?
|
||||
if ( !mHBarEnabled )
|
||||
|
|
@ -1287,8 +1289,8 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
|
|||
}
|
||||
|
||||
// Render Thumb Left.
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[thumbBitmapLeft] );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapSR(mTextureObject, pos, mBitmapBounds[thumbBitmapLeft]);
|
||||
|
||||
// Update Pos.
|
||||
pos.x += mBitmapBounds[thumbBitmapLeft].extent.x;
|
||||
|
|
@ -1303,16 +1305,16 @@ void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
|
|||
if ( thumbRect.extent.x > 0 )
|
||||
{
|
||||
// Render Track.
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR( mTextureObject, thumbRect, mBitmapBounds[thumbBitmapMiddle] );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretchSR(mTextureObject, thumbRect, mBitmapBounds[thumbBitmapMiddle]);
|
||||
}
|
||||
|
||||
// Update Pos.
|
||||
pos.x += thumbRect.extent.x;
|
||||
|
||||
// Render the Thumb Bottom.
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, pos, mBitmapBounds[thumbBitmapRight] );
|
||||
drawUtil->clearBitmapModulation();
|
||||
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 )
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public:
|
|||
virtual inline Point2I getSplitPoint() { return mSplitPoint; };
|
||||
/// The Splitters entire Client Rectangle, this takes into account padding of this control
|
||||
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;
|
||||
|
||||
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();
|
||||
ColorI oldColor;
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ class GuiTabBookCtrl : public GuiContainer
|
|||
/// Tab rendering subroutine, renders one tab with specified options
|
||||
/// @param tabRect the rectangle to render the tab into
|
||||
/// @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;
|
||||
|
||||
GFX->getDrawUtil()->drawRectFill(winRect, mProfile->mFillColor);
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset, mBitmapBounds[topBase]);
|
||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[topBase+1].extent.x, offset.y),
|
||||
drawUtil->drawRectFill(winRect, mProfile->mFillColor);
|
||||
|
||||
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]);
|
||||
|
||||
RectI destRect;
|
||||
|
|
@ -1308,7 +1310,7 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
destRect.extent.y = mBitmapBounds[topBase + 2].extent.y;
|
||||
RectI stretchRect = mBitmapBounds[topBase + 2];
|
||||
stretchRect.inset(1,0);
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||
|
||||
destRect.point.x = offset.x;
|
||||
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;
|
||||
stretchRect = mBitmapBounds[BorderLeft];
|
||||
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.extent.x = mBitmapBounds[BorderRight].extent.x;
|
||||
|
|
@ -1325,10 +1327,10 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
stretchRect = mBitmapBounds[BorderRight];
|
||||
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]);
|
||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset + getExtent() - mBitmapBounds[BorderBottomRight].extent, mBitmapBounds[BorderBottomRight]);
|
||||
drawUtil->drawBitmapSR(mTextureObject, offset + Point2I(0, getHeight() - mBitmapBounds[BorderBottomLeft].extent.y), mBitmapBounds[BorderBottomLeft]);
|
||||
drawUtil->drawBitmapSR(mTextureObject, offset + getExtent() - mBitmapBounds[BorderBottomRight].extent, mBitmapBounds[BorderBottomRight]);
|
||||
|
||||
destRect.point.x = offset.x + mBitmapBounds[BorderBottomLeft].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.inset(1,0);
|
||||
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||
|
||||
// Draw the title
|
||||
// dhc addition: copied/modded from renderJustifiedText, since we enforce a
|
||||
// different color usage here. NOTE: it currently CAN overdraw the controls
|
||||
// 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);
|
||||
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 );
|
||||
// center the vertical
|
||||
// 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
|
||||
AssertFatal(root, "Unable to get the root GuiCanvas.");
|
||||
|
|
@ -1378,8 +1380,8 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
bmp += BmpHilite;
|
||||
}
|
||||
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset + mCloseButton.point, mBitmapBounds[bmp]);
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapSR(mTextureObject, offset + mCloseButton.point, mBitmapBounds[bmp]);
|
||||
}
|
||||
|
||||
// Draw the maximize button
|
||||
|
|
@ -1397,8 +1399,8 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
bmp += BmpHilite;
|
||||
}
|
||||
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, offset + mMaximizeButton.point, mBitmapBounds[bmp] );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapSR( mTextureObject, offset + mMaximizeButton.point, mBitmapBounds[bmp] );
|
||||
}
|
||||
|
||||
// Draw the minimize button
|
||||
|
|
@ -1416,8 +1418,8 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
bmp += BmpHilite;
|
||||
}
|
||||
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR( mTextureObject, offset + mMinimizeButton.point, mBitmapBounds[bmp] );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapSR( mTextureObject, offset + mMinimizeButton.point, mBitmapBounds[bmp] );
|
||||
}
|
||||
|
||||
if( !mMinimized )
|
||||
|
|
|
|||
|
|
@ -136,6 +136,8 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
{
|
||||
GFX->setClipRect(updateRect);
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
//draw the outline
|
||||
RectI winRect;
|
||||
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;
|
||||
|
||||
if(mProfile->mOpaque)
|
||||
GFX->getDrawUtil()->drawRectFill(winRect, mProfile->mFillColor);
|
||||
drawUtil->drawRectFill(winRect, mProfile->mFillColor);
|
||||
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset, mBitmapBounds[BorderTopLeft]);
|
||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[BorderTopRight].extent.x, offset.y),
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapSR(mTextureObject, offset, mBitmapBounds[BorderTopLeft]);
|
||||
drawUtil->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[BorderTopRight].extent.x, offset.y),
|
||||
mBitmapBounds[BorderTopRight]);
|
||||
|
||||
RectI destRect;
|
||||
|
|
@ -162,7 +164,7 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
destRect.extent.y = mBitmapBounds[BorderTop].extent.y;
|
||||
RectI stretchRect = mBitmapBounds[BorderTop];
|
||||
stretchRect.inset(1,0);
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
|
||||
|
||||
destRect.point.x = offset.x;
|
||||
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;
|
||||
stretchRect = mBitmapBounds[BorderLeft];
|
||||
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.extent.x = mBitmapBounds[BorderRight].extent.x;
|
||||
|
|
@ -179,10 +181,10 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
stretchRect = mBitmapBounds[BorderRight];
|
||||
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]);
|
||||
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset + getExtent() - mBitmapBounds[BorderBottomRight].extent, mBitmapBounds[BorderBottomRight]);
|
||||
drawUtil->drawBitmapSR(mTextureObject, offset + Point2I(0, getHeight() - mBitmapBounds[BorderBottomLeft].extent.y), mBitmapBounds[BorderBottomLeft]);
|
||||
drawUtil->drawBitmapSR(mTextureObject, offset + getExtent() - mBitmapBounds[BorderBottomRight].extent, mBitmapBounds[BorderBottomRight]);
|
||||
|
||||
destRect.point.x = offset.x + mBitmapBounds[BorderBottomLeft].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.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;
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
F32 xScale = (float) getWidth() / profile->getRowWidth();
|
||||
|
||||
bool profileHasIcons = profile->hasArrows();
|
||||
|
|
@ -121,19 +123,19 @@ void GuiGameListMenuCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
}
|
||||
|
||||
// render the row bitmap
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset, rowExtent), profile->getBitmapArrayRect(buttonTextureIndex));
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset, rowExtent), profile->getBitmapArrayRect(buttonTextureIndex));
|
||||
|
||||
// render the row icon if it has one
|
||||
if ((iconIndex != NO_ICON) && profileHasIcons && (! profile->getBitmapArrayRect((U32)iconIndex).extent.isZero()))
|
||||
{
|
||||
iconIndex += Profile::TEX_FIRST_ICON;
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset + iconOffset, iconExtent), profile->getBitmapArrayRect(iconIndex));
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset + iconOffset, iconExtent), profile->getBitmapArrayRect(iconIndex));
|
||||
}
|
||||
|
||||
// render the row text
|
||||
GFX->getDrawUtil()->setBitmapModulation(fontColor);
|
||||
drawUtil->setBitmapModulation(fontColor);
|
||||
renderJustifiedText(currentOffset + textOffset, textExtent, (*row)->mLabel);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -249,8 +249,9 @@ bool GuiGradientCtrl::onAdd()
|
|||
{
|
||||
Parent::onAdd();
|
||||
|
||||
S32 l = getBounds().point.x + mSwatchFactor, r = getBounds().point.x + getBounds().extent.x - mSwatchFactor;
|
||||
S32 t = getBounds().point.y, b = getBounds().point.y + getBounds().extent.y - mSwatchFactor;
|
||||
RectI bounds = getBounds();
|
||||
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) );
|
||||
|
||||
setupDefaultRange();
|
||||
|
|
@ -330,16 +331,18 @@ void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<Col
|
|||
// Update local dimensions
|
||||
mBlendRangeBox.point = globalToLocalCoord(Point2I(l, t));
|
||||
mBlendRangeBox.extent = globalToLocalCoord(Point2I(r, b));
|
||||
|
||||
ColorRange& firstColorRange = colorRange.first();
|
||||
|
||||
if(colorRange.size() == 1) // Only one color to draw
|
||||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
|
||||
PrimBuild::color( colorRange.first().swatch->getColor() );
|
||||
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i( l, t );
|
||||
PrimBuild::vertex2i( l, b );
|
||||
|
||||
PrimBuild::color( colorRange.first().swatch->getColor() );
|
||||
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i( r, b );
|
||||
PrimBuild::vertex2i( r, t );
|
||||
|
||||
|
|
@ -349,13 +352,13 @@ void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<Col
|
|||
{
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
|
||||
PrimBuild::color( colorRange.first().swatch->getColor() );
|
||||
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i( l, t );
|
||||
PrimBuild::vertex2i( l, b );
|
||||
|
||||
PrimBuild::color( colorRange.first().swatch->getColor() );
|
||||
PrimBuild::vertex2i( l + colorRange.first().swatch->getPosition().x, b );
|
||||
PrimBuild::vertex2i( l + colorRange.first().swatch->getPosition().x, t );
|
||||
PrimBuild::color(firstColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i(l + firstColorRange.swatch->getPosition().x, b);
|
||||
PrimBuild::vertex2i(l + firstColorRange.swatch->getPosition().x, t);
|
||||
|
||||
PrimBuild::end();
|
||||
|
||||
|
|
@ -377,13 +380,15 @@ void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<Col
|
|||
PrimBuild::end();
|
||||
}
|
||||
|
||||
ColorRange& lastColorRange = colorRange.last();
|
||||
|
||||
PrimBuild::begin( GFXTriangleFan, 4 );
|
||||
|
||||
PrimBuild::color( colorRange.last().swatch->getColor() );
|
||||
PrimBuild::vertex2i( l + colorRange.last().swatch->getPosition().x, t );
|
||||
PrimBuild::vertex2i( l + colorRange.last().swatch->getPosition().x, b );
|
||||
PrimBuild::color(lastColorRange.swatch->getColor());
|
||||
PrimBuild::vertex2i(l + lastColorRange.swatch->getPosition().x, t);
|
||||
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, 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 &&
|
||||
pos.x + mSwatchFactor > mBlendRangeBox.extent.x )
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ public:
|
|||
void inspectPreApply();
|
||||
void inspectPostApply();
|
||||
void reInitSwatches( GuiGradientCtrl::PickMode );
|
||||
void addColorRange( Point2I pos, ColorF color );
|
||||
void addColorRange(Point2I pos, const ColorF& color);
|
||||
void removeColorRange( GuiGradientSwatchCtrl* swatch );
|
||||
void sortColorRange();
|
||||
|
||||
|
|
|
|||
|
|
@ -677,7 +677,7 @@ DefineEngineMethod( GuiListBoxCtrl, setItemColor, void, (S32 index, ColorF 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)
|
||||
{
|
||||
|
|
@ -748,11 +748,6 @@ S32 GuiListBoxCtrl::insertItem( S32 index, StringTableEntry text, void *itemData
|
|||
}
|
||||
|
||||
LBItem *newItem = new LBItem;
|
||||
if( !newItem )
|
||||
{
|
||||
Con::warnf("GuiListBoxCtrl::insertItem - error allocating item memory!" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Assign item data
|
||||
newItem->itemText = StringTable->insert(text, true);
|
||||
|
|
@ -792,11 +787,6 @@ S32 GuiListBoxCtrl::insertItemWithColor( S32 index, StringTableEntry text, Color
|
|||
}
|
||||
|
||||
LBItem *newItem = new LBItem;
|
||||
if( !newItem )
|
||||
{
|
||||
Con::warnf("GuiListBoxCtrl::insertItem - error allocating item memory!" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Assign item data
|
||||
newItem->itemText = StringTable->insert(text, true);
|
||||
|
|
@ -1090,7 +1080,7 @@ void GuiListBoxCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
GFX->setClipRect( oldClipRect );
|
||||
}
|
||||
|
||||
void GuiListBoxCtrl::onRenderItem( RectI itemRect, LBItem *item )
|
||||
void GuiListBoxCtrl::onRenderItem(const RectI& itemRect, LBItem *item)
|
||||
{
|
||||
if( item->isSelected )
|
||||
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 findItemText( StringTableEntry text, bool caseSensitive = false );
|
||||
|
||||
void setItemColor(S32 index, ColorF color);
|
||||
void setItemColor(S32 index, const ColorF& color);
|
||||
void clearItemColor(S32 index);
|
||||
|
||||
void deleteItem( S32 index );
|
||||
|
|
@ -128,7 +128,7 @@ public:
|
|||
|
||||
// Rendering
|
||||
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 );
|
||||
bool renderTooltip( const Point2I &hoverPos, const Point2I& cursorPos, const char* tipText );
|
||||
void addFilteredItem( String item );
|
||||
|
|
|
|||
|
|
@ -852,6 +852,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
if ( mScrollDir != GuiScrollCtrl::None )
|
||||
autoScroll();
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
RectI r( offset, getExtent() );
|
||||
if ( mInAction )
|
||||
{
|
||||
|
|
@ -868,30 +870,30 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
else
|
||||
{
|
||||
//renderSlightlyLoweredBox(r, mProfile);
|
||||
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColor );
|
||||
drawUtil->drawRectFill( r, mProfile->mFillColor );
|
||||
}
|
||||
|
||||
// Draw a bitmap over the background?
|
||||
if ( mTextureDepressed )
|
||||
{
|
||||
RectI rect(offset, mBitmapBounds);
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureDepressed, rect );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretch( mTextureDepressed, rect );
|
||||
}
|
||||
else if ( mTextureNormal )
|
||||
{
|
||||
RectI rect(offset, mBitmapBounds);
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretch( mTextureNormal, rect );
|
||||
}
|
||||
|
||||
// Do we render a bitmap border or lines?
|
||||
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
||||
{
|
||||
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
|
||||
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
|
||||
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
||||
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
||||
drawUtil->drawLine( l, t, l, b, colorWhite );
|
||||
drawUtil->drawLine( l, t, r2, t, colorWhite );
|
||||
drawUtil->drawLine( l + 1, b, r2, b, 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
|
||||
{
|
||||
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorHL );
|
||||
drawUtil->drawRectFill( r, mProfile->mFillColorHL );
|
||||
}
|
||||
|
||||
// Draw a bitmap over the background?
|
||||
if ( mTextureNormal )
|
||||
{
|
||||
RectI rect( offset, mBitmapBounds );
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretch( mTextureNormal, rect );
|
||||
}
|
||||
|
||||
// Do we render a bitmap border or lines?
|
||||
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
||||
{
|
||||
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
|
||||
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
|
||||
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
||||
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
||||
drawUtil->drawLine( l, t, l, b, colorWhite );
|
||||
drawUtil->drawLine( l, t, r2, t, colorWhite );
|
||||
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
||||
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -942,21 +944,21 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
}
|
||||
else
|
||||
{
|
||||
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorNA );
|
||||
drawUtil->drawRectFill( r, mProfile->mFillColorNA );
|
||||
}
|
||||
|
||||
// Draw a bitmap over the background?
|
||||
if ( mTextureNormal )
|
||||
{
|
||||
RectI rect(offset, mBitmapBounds);
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretch( mTextureNormal, rect );
|
||||
}
|
||||
|
||||
// Do we render a bitmap border or lines?
|
||||
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.
|
||||
|
|
@ -1027,8 +1029,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
{
|
||||
Point2I coloredboxsize( 15, 10 );
|
||||
RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y );
|
||||
GFX->getDrawUtil()->drawRectFill( r, boxColor);
|
||||
GFX->getDrawUtil()->drawRect( r, ColorI(0,0,0));
|
||||
drawUtil->drawRectFill( r, boxColor);
|
||||
drawUtil->drawRect( r, ColorI(0,0,0));
|
||||
|
||||
localStart.x += coloredboxsize.x + mProfile->mTextOffset.x;
|
||||
}
|
||||
|
|
@ -1036,7 +1038,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
// Draw the text
|
||||
Point2I globalStart = localToGlobalCoord( localStart );
|
||||
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
|
||||
S32 colcount = getColumnCount( mText, "\t" );
|
||||
|
|
@ -1048,7 +1050,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
|
||||
// Draw the first column
|
||||
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
|
||||
getColumn( mText, buff, 1, "\t" );
|
||||
|
|
@ -1059,17 +1061,17 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
|
|||
// right cap of the border.
|
||||
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -1034,6 +1034,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
|||
if ( mScrollDir != GuiScrollCtrl::None )
|
||||
autoScroll();
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
RectI r( offset, getExtent() );
|
||||
if ( mInAction )
|
||||
{
|
||||
|
|
@ -1050,30 +1052,30 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
|||
else
|
||||
{
|
||||
//renderSlightlyLoweredBox(r, mProfile);
|
||||
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColor );
|
||||
drawUtil->drawRectFill( r, mProfile->mFillColor );
|
||||
}
|
||||
|
||||
// Draw a bitmap over the background?
|
||||
if ( mTextureDepressed )
|
||||
{
|
||||
RectI rect(offset, mBitmapBounds);
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureDepressed, rect );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretch( mTextureDepressed, rect );
|
||||
}
|
||||
else if ( mTextureNormal )
|
||||
{
|
||||
RectI rect(offset, mBitmapBounds);
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretch( mTextureNormal, rect );
|
||||
}
|
||||
|
||||
// Do we render a bitmap border or lines?
|
||||
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
||||
{
|
||||
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
|
||||
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
|
||||
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
||||
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
||||
drawUtil->drawLine( l, t, l, b, colorWhite );
|
||||
drawUtil->drawLine( l, t, r2, t, colorWhite );
|
||||
drawUtil->drawLine( l + 1, b, r2, b, 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
|
||||
{
|
||||
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorHL );
|
||||
drawUtil->drawRectFill( r, mProfile->mFillColorHL );
|
||||
}
|
||||
|
||||
// Draw a bitmap over the background?
|
||||
if ( mTextureNormal )
|
||||
{
|
||||
RectI rect( offset, mBitmapBounds );
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretch( mTextureNormal, rect );
|
||||
}
|
||||
|
||||
// Do we render a bitmap border or lines?
|
||||
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
|
||||
{
|
||||
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
|
||||
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
|
||||
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
||||
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
||||
drawUtil->drawLine( l, t, l, b, colorWhite );
|
||||
drawUtil->drawLine( l, t, r2, t, colorWhite );
|
||||
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
|
||||
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1124,21 +1126,21 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
|||
}
|
||||
else
|
||||
{
|
||||
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorNA );
|
||||
drawUtil->drawRectFill( r, mProfile->mFillColorNA );
|
||||
}
|
||||
|
||||
// Draw a bitmap over the background?
|
||||
if ( mTextureNormal )
|
||||
{
|
||||
RectI rect(offset, mBitmapBounds);
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapStretch( mTextureNormal, rect );
|
||||
}
|
||||
|
||||
// Do we render a bitmap border or lines?
|
||||
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.
|
||||
|
|
@ -1209,8 +1211,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
|||
{
|
||||
Point2I coloredboxsize( 15, 10 );
|
||||
RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y );
|
||||
GFX->getDrawUtil()->drawRectFill( r, boxColor);
|
||||
GFX->getDrawUtil()->drawRect( r, ColorI(0,0,0));
|
||||
drawUtil->drawRectFill( r, boxColor);
|
||||
drawUtil->drawRect( r, ColorI(0,0,0));
|
||||
|
||||
localStart.x += coloredboxsize.x + mProfile->mTextOffset.x;
|
||||
}
|
||||
|
|
@ -1218,7 +1220,7 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
|||
// Draw the text
|
||||
Point2I globalStart = localToGlobalCoord( localStart );
|
||||
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
|
||||
S32 colcount = getColumnCount( mText, "\t" );
|
||||
|
|
@ -1230,7 +1232,7 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
// Draw the first column
|
||||
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
|
||||
getColumn( mText, buff, 1, "\t" );
|
||||
|
|
@ -1241,17 +1243,17 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
|
|||
// right cap of the border.
|
||||
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -363,6 +363,8 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
Point2I ext(getWidth() - mShiftExtent, getHeight());
|
||||
RectI thumb = mThumb;
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
if( mHasTexture )
|
||||
{
|
||||
if(mTicks > 0)
|
||||
|
|
@ -402,12 +404,12 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
S32 index = SliderButtonNormal;
|
||||
if(mMouseOver)
|
||||
index = SliderButtonHighlight;
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
drawUtil->clearBitmapModulation();
|
||||
|
||||
//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
|
||||
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
|
||||
|
|
@ -421,11 +423,11 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
stretchRect = mBitmapBounds[SliderLineCenter];
|
||||
stretchRect.inset(1,0);
|
||||
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject, destRect, stretchRect);
|
||||
drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, destRect, stretchRect);
|
||||
|
||||
//draw our control slider button
|
||||
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())
|
||||
|
|
@ -490,8 +492,8 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
else if(textStart.x + txt_w > offset.x+getWidth())
|
||||
textStart.x -=((textStart.x + txt_w) - (offset.x+getWidth()));
|
||||
|
||||
GFX->getDrawUtil()->setBitmapModulation(mProfile->mFontColor);
|
||||
GFX->getDrawUtil()->drawText(mProfile->mFont, textStart, buf, mProfile->mFontColors);
|
||||
drawUtil->setBitmapModulation(mProfile->mFontColor);
|
||||
drawUtil->drawText(mProfile->mFont, textStart, buf, mProfile->mFontColors);
|
||||
}
|
||||
renderChildControls(offset, updateRect);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4641,6 +4641,8 @@ S32 GuiTreeViewCtrl::findItemByValue(const char *name)
|
|||
{
|
||||
for (S32 i = 0; i < mItems.size(); i++)
|
||||
{
|
||||
if (!mItems[i])
|
||||
continue;
|
||||
if( mItems[i]->mState.test( Item::InspectorData ) )
|
||||
continue;
|
||||
if (mItems[i] && dStrcmp(mItems[i]->getValue(),name) == 0)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "gfx/video/videoCapture.h"
|
||||
#include "lighting/lightManager.h"
|
||||
#include "core/strings/stringUnit.h"
|
||||
#include "gui/core/guiOffscreenCanvas.h"
|
||||
|
||||
#ifndef TORQUE_TGB_ONLY
|
||||
#include "scene/sceneObject.h"
|
||||
|
|
@ -126,7 +127,8 @@ GuiCanvas::GuiCanvas(): GuiControl(),
|
|||
mMouseDownPoint(0.0f,0.0f),
|
||||
mPlatformWindow(NULL),
|
||||
mLastRenderMs(0),
|
||||
mDisplayWindow(true)
|
||||
mDisplayWindow(true),
|
||||
mMenuBarCtrl(NULL)
|
||||
{
|
||||
setBounds(0, 0, 640, 480);
|
||||
mAwake = true;
|
||||
|
|
@ -142,23 +144,12 @@ GuiCanvas::GuiCanvas(): GuiControl(),
|
|||
#else
|
||||
mNumFences = 0;
|
||||
#endif
|
||||
|
||||
#ifdef TORQUE_DEMO_PURCHASE
|
||||
mPurchaseScreen = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
GuiCanvas::~GuiCanvas()
|
||||
{
|
||||
SAFE_DELETE(mPlatformWindow);
|
||||
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)
|
||||
Con::executef(this, "onCreateMenu");
|
||||
|
||||
#ifdef TORQUE_DEMO_PURCHASE
|
||||
mPurchaseScreen = new PurchaseScreen;
|
||||
mPurchaseScreen->init();
|
||||
|
||||
mLastPurchaseHideTime = 0;
|
||||
#endif
|
||||
|
||||
Sim::findObject("PlatformGenericMenubar", mMenuBarCtrl);
|
||||
|
||||
return parentRet;
|
||||
|
|
@ -294,11 +278,6 @@ bool GuiCanvas::onAdd()
|
|||
|
||||
void GuiCanvas::onRemove()
|
||||
{
|
||||
#ifdef TORQUE_DEMO_PURCHASE
|
||||
if (mPurchaseScreen && mPurchaseScreen->isAwake())
|
||||
removeObject(mPurchaseScreen);
|
||||
#endif
|
||||
|
||||
// And the process list
|
||||
Process::remove(this, &GuiCanvas::paint);
|
||||
|
||||
|
|
@ -508,6 +487,55 @@ bool GuiCanvas::isCursorShown()
|
|||
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)
|
||||
{
|
||||
if (keyCode > 0 && ctrl)
|
||||
|
|
@ -708,14 +736,22 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent)
|
|||
//
|
||||
// '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.
|
||||
|
||||
// Need to query platform for specific things
|
||||
AssertISV(mPlatformWindow, "GuiCanvas::processMouseEvent - no window present!");
|
||||
PlatformCursorController *pController = mPlatformWindow->getCursorController();
|
||||
AssertFatal(pController != NULL, "GuiCanvas::processInputEvent - No Platform Controller Found")
|
||||
|
||||
//copy the modifier into the new event
|
||||
mLastEvent.modifier = inputEvent.modifier;
|
||||
S32 mouseDoubleClickWidth = 12;
|
||||
S32 mouseDoubleClickHeight = 12;
|
||||
U32 mouseDoubleClickTime = 500;
|
||||
|
||||
// Query platform for mouse info if its available
|
||||
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 &&
|
||||
(inputEvent.objInst == SI_XAXIS || inputEvent.objInst == SI_YAXIS))
|
||||
|
|
@ -747,7 +783,7 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent)
|
|||
// moving too much.
|
||||
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;
|
||||
mMiddleMouseLast = false;
|
||||
|
|
@ -799,7 +835,7 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent)
|
|||
if (mLeftMouseLast)
|
||||
{
|
||||
//if it was within the double click time count the clicks
|
||||
if (curTime - mLastMouseDownTime <= pController->getDoubleClickTime())
|
||||
if (curTime - mLastMouseDownTime <= mouseDoubleClickTime)
|
||||
mLastMouseClickCount++;
|
||||
else
|
||||
mLastMouseClickCount = 1;
|
||||
|
|
@ -833,7 +869,7 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent)
|
|||
if (mRightMouseLast)
|
||||
{
|
||||
//if it was within the double click time count the clicks
|
||||
if (curTime - mLastMouseDownTime <= pController->getDoubleClickTime())
|
||||
if (curTime - mLastMouseDownTime <= mouseDoubleClickTime)
|
||||
mLastMouseClickCount++;
|
||||
else
|
||||
mLastMouseClickCount = 1;
|
||||
|
|
@ -864,7 +900,7 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent)
|
|||
if (mMiddleMouseLast)
|
||||
{
|
||||
//if it was within the double click time count the clicks
|
||||
if (curTime - mLastMouseDownTime <= pController->getDoubleClickTime())
|
||||
if (curTime - mLastMouseDownTime <= mouseDoubleClickTime)
|
||||
mLastMouseClickCount++;
|
||||
else
|
||||
mLastMouseClickCount = 1;
|
||||
|
|
@ -1303,11 +1339,6 @@ bool GuiCanvas::rootMouseWheelDown(const GuiEvent &event)
|
|||
|
||||
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?)
|
||||
if(!gui)
|
||||
return;
|
||||
|
|
@ -1376,11 +1407,6 @@ GuiControl *GuiCanvas::getContentControl()
|
|||
|
||||
void GuiCanvas::pushDialogControl(GuiControl *gui, S32 layer, bool center)
|
||||
{
|
||||
#ifdef TORQUE_DEMO_PURCHASE
|
||||
if (mPurchaseScreen->isForceExit())
|
||||
return;
|
||||
#endif
|
||||
|
||||
if( center )
|
||||
gui->setPosition( getExtent().x / 2 - gui->getExtent().x / 2,
|
||||
getExtent().y / 2 - gui->getExtent().y / 2 );
|
||||
|
|
@ -1768,6 +1794,21 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */)
|
|||
|
||||
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.
|
||||
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
|
||||
// before the buffers swap
|
||||
|
||||
#ifdef TORQUE_DEMO_TIMEOUT
|
||||
checkTimeOut();
|
||||
#endif
|
||||
|
||||
PROFILE_END();
|
||||
|
||||
// Fence logic here, because this is where endScene is called.
|
||||
|
|
@ -1907,7 +1944,8 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */)
|
|||
PROFILE_START(GFXEndScene);
|
||||
GFX->endScene();
|
||||
PROFILE_END();
|
||||
|
||||
|
||||
GFX->getDeviceEventSignal().trigger( GFXDevice::dePostFrame );
|
||||
swapBuffers();
|
||||
|
||||
GuiCanvas::getGuiCanvasFrameSignal().trigger(false);
|
||||
|
|
@ -2761,3 +2799,16 @@ ConsoleMethod( GuiCanvas, hideWindow, void, 2, 2, "" )
|
|||
WindowManager->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 "gfx/gfxFence.h"
|
||||
|
||||
#ifdef TORQUE_DEMO_PURCHASE
|
||||
#ifndef _PURCHASESCREEN_H_
|
||||
#include "demo/purchase/purchaseScreen.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/// A canvas on which rendering occurs.
|
||||
///
|
||||
///
|
||||
|
|
@ -331,6 +325,10 @@ public:
|
|||
|
||||
/// Returns true if the cursor is being rendered.
|
||||
virtual bool isCursorShown();
|
||||
|
||||
void cursorClick(S32 buttonId, bool isDown);
|
||||
|
||||
void cursorNudge(F32 x, F32 y);
|
||||
/// @}
|
||||
|
||||
///used by the tooltip resource
|
||||
|
|
@ -438,21 +436,6 @@ public:
|
|||
|
||||
private:
|
||||
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
|
||||
|
|
|
|||
|
|
@ -465,6 +465,8 @@ bool GuiControl::defaultTooltipRender( const Point2I &hoverPos, const Point2I &c
|
|||
|
||||
GFont *font = mTooltipProfile->mFont;
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
// Support for multi-line tooltip text...
|
||||
|
||||
Vector<U32> startLineOffsets, lineLengths;
|
||||
|
|
@ -521,12 +523,12 @@ bool GuiControl::defaultTooltipRender( const Point2I &hoverPos, const Point2I &c
|
|||
GFX->setClipRect( rect );
|
||||
|
||||
// Draw Filler bit, then border on top of that
|
||||
GFX->getDrawUtil()->drawRectFill( rect, mTooltipProfile->mFillColor );
|
||||
GFX->getDrawUtil()->drawRect( rect, mTooltipProfile->mBorderColor );
|
||||
drawUtil->drawRectFill( rect, mTooltipProfile->mFillColor );
|
||||
drawUtil->drawRect( rect, mTooltipProfile->mBorderColor );
|
||||
|
||||
// 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++ )
|
||||
{
|
||||
|
|
@ -534,7 +536,7 @@ bool GuiControl::defaultTooltipRender( const Point2I &hoverPos, const Point2I &c
|
|||
const UTF8 *line = renderTip.c_str() + startLineOffsets[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 );
|
||||
|
|
@ -2380,7 +2382,8 @@ void GuiControl::getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent
|
|||
// so set it back before we change it again.
|
||||
|
||||
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();
|
||||
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