mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +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
|
|
@ -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!");
|
||||
|
||||
|
|
|
|||
|
|
@ -41,15 +41,17 @@ void renderRaisedBox( const RectI &bounds, GuiControlProfile *profile )
|
|||
S32 l = bounds.point.x, r = bounds.point.x + bounds.extent.x - 1;
|
||||
S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y - 1;
|
||||
|
||||
GFX->getDrawUtil()->drawRectFill( bounds, profile->mFillColor);
|
||||
GFX->getDrawUtil()->drawLine(l, t, l, b - 1, colorWhite);
|
||||
GFX->getDrawUtil()->drawLine(l, t, r - 1, t, colorWhite);
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
GFX->getDrawUtil()->drawLine(l, b, r, b, colorBlack);
|
||||
GFX->getDrawUtil()->drawLine(r, b - 1, r, t, colorBlack);
|
||||
drawUtil->drawRectFill( bounds, profile->mFillColor);
|
||||
drawUtil->drawLine(l, t, l, b - 1, colorWhite);
|
||||
drawUtil->drawLine(l, t, r - 1, t, colorWhite);
|
||||
|
||||
GFX->getDrawUtil()->drawLine(l + 1, b - 1, r - 1, b - 1, profile->mBorderColor);
|
||||
GFX->getDrawUtil()->drawLine(r - 1, b - 2, r - 1, t + 1, profile->mBorderColor);
|
||||
drawUtil->drawLine(l, b, r, b, colorBlack);
|
||||
drawUtil->drawLine(r, b - 1, r, t, colorBlack);
|
||||
|
||||
drawUtil->drawLine(l + 1, b - 1, r - 1, b - 1, profile->mBorderColor);
|
||||
drawUtil->drawLine(r - 1, b - 2, r - 1, t + 1, profile->mBorderColor);
|
||||
}
|
||||
|
||||
void renderSlightlyRaisedBox( const RectI &bounds, GuiControlProfile *profile )
|
||||
|
|
@ -70,16 +72,18 @@ void renderLoweredBox( const RectI &bounds, GuiControlProfile *profile )
|
|||
S32 l = bounds.point.x, r = bounds.point.x + bounds.extent.x - 1;
|
||||
S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y - 1;
|
||||
|
||||
GFX->getDrawUtil()->drawRectFill( bounds, profile->mFillColor);
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
GFX->getDrawUtil()->drawLine(l, b, r, b, colorWhite);
|
||||
GFX->getDrawUtil()->drawLine(r, b - 1, r, t, colorWhite);
|
||||
drawUtil->drawRectFill( bounds, profile->mFillColor);
|
||||
|
||||
GFX->getDrawUtil()->drawLine(l, t, r - 1, t, colorBlack);
|
||||
GFX->getDrawUtil()->drawLine(l, t + 1, l, b - 1, colorBlack);
|
||||
drawUtil->drawLine(l, b, r, b, colorWhite);
|
||||
drawUtil->drawLine(r, b - 1, r, t, colorWhite);
|
||||
|
||||
GFX->getDrawUtil()->drawLine(l + 1, t + 1, r - 2, t + 1, profile->mBorderColor);
|
||||
GFX->getDrawUtil()->drawLine(l + 1, t + 2, l + 1, b - 2, profile->mBorderColor);
|
||||
drawUtil->drawLine(l, t, r - 1, t, colorBlack);
|
||||
drawUtil->drawLine(l, t + 1, l, b - 1, colorBlack);
|
||||
|
||||
drawUtil->drawLine(l + 1, t + 1, r - 2, t + 1, profile->mBorderColor);
|
||||
drawUtil->drawLine(l + 1, t + 2, l + 1, b - 2, profile->mBorderColor);
|
||||
}
|
||||
|
||||
void renderSlightlyLoweredBox( const RectI &bounds, GuiControlProfile *profile )
|
||||
|
|
@ -87,11 +91,13 @@ void renderSlightlyLoweredBox( const RectI &bounds, GuiControlProfile *profile )
|
|||
S32 l = bounds.point.x + 1, r = bounds.point.x + bounds.extent.x - 1;
|
||||
S32 t = bounds.point.y + 1, b = bounds.point.y + bounds.extent.y - 1;
|
||||
|
||||
GFX->getDrawUtil()->drawRectFill( bounds, profile->mFillColor);
|
||||
GFX->getDrawUtil()->drawLine(l, b, r, b, profile->mBorderColor);
|
||||
GFX->getDrawUtil()->drawLine(r, t, r, b - 1, profile->mBorderColor);
|
||||
GFX->getDrawUtil()->drawLine(l, t, l, b - 1, profile->mBorderColor);
|
||||
GFX->getDrawUtil()->drawLine(l + 1, t, r - 1, t, profile->mBorderColor);
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
drawUtil->drawRectFill( bounds, profile->mFillColor);
|
||||
drawUtil->drawLine(l, b, r, b, profile->mBorderColor);
|
||||
drawUtil->drawLine(r, t, r, b - 1, profile->mBorderColor);
|
||||
drawUtil->drawLine(l, t, l, b - 1, profile->mBorderColor);
|
||||
drawUtil->drawLine(l + 1, t, r - 1, t, profile->mBorderColor);
|
||||
}
|
||||
|
||||
void renderBorder( const RectI &bounds, GuiControlProfile *profile )
|
||||
|
|
|
|||
273
Engine/source/gui/core/guiOffscreenCanvas.cpp
Normal file
273
Engine/source/gui/core/guiOffscreenCanvas.cpp
Normal file
|
|
@ -0,0 +1,273 @@
|
|||
#include "gui/core/guiOffscreenCanvas.h"
|
||||
#include "gfx/gfxDrawUtil.h"
|
||||
#include "gfx/gfxTextureManager.h"
|
||||
#include "gfx/gfxAPI.h"
|
||||
#include "gfx/gfxDebugEvent.h"
|
||||
|
||||
#include "console/consoleTypes.h"
|
||||
#include "console/console.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(GuiOffscreenCanvas);
|
||||
|
||||
Vector<GuiOffscreenCanvas*> GuiOffscreenCanvas::sList;
|
||||
|
||||
GuiOffscreenCanvas::GuiOffscreenCanvas()
|
||||
{
|
||||
mTargetFormat = GFXFormatR8G8B8A8;
|
||||
mTargetSize = Point2I(256,256);
|
||||
mTargetName = "offscreenCanvas";
|
||||
mTargetDirty = true;
|
||||
mDynamicTarget = false;
|
||||
}
|
||||
|
||||
GuiOffscreenCanvas::~GuiOffscreenCanvas()
|
||||
{
|
||||
}
|
||||
|
||||
void GuiOffscreenCanvas::initPersistFields()
|
||||
{
|
||||
addField( "targetSize", TypePoint2I, Offset( mTargetSize, GuiOffscreenCanvas ),"" );
|
||||
addField( "targetFormat", TypeGFXFormat, Offset( mTargetFormat, GuiOffscreenCanvas ), "");
|
||||
addField( "targetName", TypeRealString, Offset( mTargetName, GuiOffscreenCanvas ), "");
|
||||
addField( "dynamicTarget", TypeBool, Offset( mDynamicTarget, GuiOffscreenCanvas ), "");
|
||||
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
bool GuiOffscreenCanvas::onAdd()
|
||||
{
|
||||
if (GuiControl::onAdd()) // jamesu - skip GuiCanvas onAdd since it sets up GFX which is bad
|
||||
{
|
||||
// ensure that we have a cursor
|
||||
setCursor(dynamic_cast<GuiCursor*>(Sim::findObject("DefaultCursor")));
|
||||
|
||||
mRenderFront = true;
|
||||
sList.push_back(this);
|
||||
|
||||
//Con::printf("Registering target %s...", mTargetName.c_str());
|
||||
mNamedTarget.registerWithName( mTargetName );
|
||||
|
||||
_setupTargets();
|
||||
|
||||
GFXTextureManager::addEventDelegate( this, &GuiOffscreenCanvas::_onTextureEvent );
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void GuiOffscreenCanvas::onRemove()
|
||||
{
|
||||
GFXTextureManager::removeEventDelegate( this, &GuiOffscreenCanvas::_onTextureEvent );
|
||||
|
||||
_teardownTargets();
|
||||
|
||||
U32 idx = sList.find_next(this);
|
||||
if (idx != (U32)-1)
|
||||
{
|
||||
sList.erase(idx);
|
||||
}
|
||||
|
||||
mTarget = NULL;
|
||||
mTargetTexture = NULL;
|
||||
|
||||
Parent::onRemove();
|
||||
}
|
||||
|
||||
void GuiOffscreenCanvas::_setupTargets()
|
||||
{
|
||||
_teardownTargets();
|
||||
|
||||
if (!mTarget.isValid())
|
||||
{
|
||||
mTarget = GFX->allocRenderToTextureTarget();
|
||||
}
|
||||
|
||||
// Update color
|
||||
if (!mTargetTexture.isValid() || mTargetSize != mTargetTexture.getWidthHeight())
|
||||
{
|
||||
mTargetTexture.set( mTargetSize.x, mTargetSize.y, mTargetFormat, &GFXDefaultRenderTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ), 1, 0 );
|
||||
}
|
||||
|
||||
mTarget->attachTexture( GFXTextureTarget::RenderSlot(GFXTextureTarget::Color0), mTargetTexture );
|
||||
mNamedTarget.setTexture(0, mTargetTexture);
|
||||
}
|
||||
|
||||
void GuiOffscreenCanvas::_teardownTargets()
|
||||
{
|
||||
mNamedTarget.release();
|
||||
mTargetTexture = NULL;
|
||||
mTargetDirty = true;
|
||||
}
|
||||
|
||||
void GuiOffscreenCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */)
|
||||
{
|
||||
if (!mTargetDirty)
|
||||
return;
|
||||
|
||||
#ifdef TORQUE_ENABLE_GFXDEBUGEVENTS
|
||||
char buf[256];
|
||||
dSprintf(buf, sizeof(buf), "OffsceenCanvas %s", getName() ? getName() : getIdString());
|
||||
GFXDEBUGEVENT_SCOPE_EX(GuiOffscreenCanvas_renderFrame, ColorI::GREEN, buf);
|
||||
#endif
|
||||
|
||||
PROFILE_START(OffscreenCanvasPreRender);
|
||||
|
||||
#ifdef TORQUE_GFX_STATE_DEBUG
|
||||
GFX->getDebugStateManager()->startFrame();
|
||||
#endif
|
||||
|
||||
if (mTarget->getSize() != mTargetSize)
|
||||
{
|
||||
_setupTargets();
|
||||
mNamedTarget.setViewport( RectI( Point2I::Zero, mTargetSize ) );
|
||||
}
|
||||
|
||||
// Make sure the root control is the size of the canvas.
|
||||
Point2I size = mTarget->getSize();
|
||||
|
||||
if(size.x == 0 || size.y == 0)
|
||||
{
|
||||
PROFILE_END();
|
||||
return;
|
||||
}
|
||||
|
||||
RectI screenRect(0, 0, size.x, size.y);
|
||||
|
||||
maintainSizing();
|
||||
|
||||
//preRender (recursive) all controls
|
||||
preRender();
|
||||
|
||||
PROFILE_END();
|
||||
|
||||
// Are we just doing pre-render?
|
||||
if(preRenderOnly)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
resetUpdateRegions();
|
||||
|
||||
PROFILE_START(OffscreenCanvasRenderControls);
|
||||
|
||||
GuiCursor *mouseCursor = NULL;
|
||||
bool cursorVisible = true;
|
||||
|
||||
Point2I cursorPos((S32)mCursorPt.x, (S32)mCursorPt.y);
|
||||
mouseCursor = mDefaultCursor;
|
||||
|
||||
mLastCursorEnabled = cursorVisible;
|
||||
mLastCursor = mouseCursor;
|
||||
mLastCursorPt = cursorPos;
|
||||
|
||||
// Set active target
|
||||
GFX->pushActiveRenderTarget();
|
||||
GFX->setActiveRenderTarget(mTarget);
|
||||
|
||||
// Clear the current viewport area
|
||||
GFX->setViewport( screenRect );
|
||||
GFX->clear( GFXClearTarget, ColorF(0,0,0,0), 1.0f, 0 );
|
||||
|
||||
resetUpdateRegions();
|
||||
|
||||
// Make sure we have a clean matrix state
|
||||
// before we start rendering anything!
|
||||
GFX->setWorldMatrix( MatrixF::Identity );
|
||||
GFX->setViewMatrix( MatrixF::Identity );
|
||||
GFX->setProjectionMatrix( MatrixF::Identity );
|
||||
|
||||
RectI contentRect(Point2I(0,0), mTargetSize);
|
||||
{
|
||||
// Render active GUI Dialogs
|
||||
for(iterator i = begin(); i != end(); i++)
|
||||
{
|
||||
// Get the control
|
||||
GuiControl *contentCtrl = static_cast<GuiControl*>(*i);
|
||||
|
||||
GFX->setClipRect( contentRect );
|
||||
GFX->setStateBlock(mDefaultGuiSB);
|
||||
|
||||
contentCtrl->onRender(contentCtrl->getPosition(), contentRect);
|
||||
}
|
||||
|
||||
// Fill Blue if no Dialogs
|
||||
if(this->size() == 0)
|
||||
GFX->clear( GFXClearTarget, ColorF(0,0,1,1), 1.0f, 0 );
|
||||
|
||||
GFX->setClipRect( contentRect );
|
||||
|
||||
// Draw cursor
|
||||
//
|
||||
if (mCursorEnabled && mouseCursor && mShowCursor)
|
||||
{
|
||||
Point2I pos((S32)mCursorPt.x, (S32)mCursorPt.y);
|
||||
Point2I spot = mouseCursor->getHotSpot();
|
||||
|
||||
pos -= spot;
|
||||
mouseCursor->render(pos);
|
||||
}
|
||||
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
}
|
||||
|
||||
mTarget->resolve();
|
||||
GFX->popActiveRenderTarget();
|
||||
|
||||
PROFILE_END();
|
||||
|
||||
// Keep track of the last time we rendered.
|
||||
mLastRenderMs = Platform::getRealMilliseconds();
|
||||
mTargetDirty = mDynamicTarget;
|
||||
}
|
||||
|
||||
Point2I GuiOffscreenCanvas::getWindowSize()
|
||||
{
|
||||
return mTargetSize;
|
||||
}
|
||||
|
||||
Point2I GuiOffscreenCanvas::getCursorPos()
|
||||
{
|
||||
return Point2I(mCursorPt.x, mCursorPt.y);
|
||||
}
|
||||
|
||||
void GuiOffscreenCanvas::setCursorPos(const Point2I &pt)
|
||||
{
|
||||
mCursorPt.x = F32( pt.x );
|
||||
mCursorPt.y = F32( pt.y );
|
||||
}
|
||||
|
||||
void GuiOffscreenCanvas::showCursor(bool state)
|
||||
{
|
||||
mShowCursor = state;
|
||||
}
|
||||
|
||||
bool GuiOffscreenCanvas::isCursorShown()
|
||||
{
|
||||
return mShowCursor;
|
||||
}
|
||||
|
||||
void GuiOffscreenCanvas::_onTextureEvent( GFXTexCallbackCode code )
|
||||
{
|
||||
switch(code)
|
||||
{
|
||||
case GFXZombify:
|
||||
_teardownTargets();
|
||||
break;
|
||||
|
||||
case GFXResurrect:
|
||||
_setupTargets();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiOffscreenCanvas, resetTarget, void, (), , "")
|
||||
{
|
||||
object->_setupTargets();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiOffscreenCanvas, markDirty, void, (), , "")
|
||||
{
|
||||
object->markDirty();
|
||||
}
|
||||
|
||||
63
Engine/source/gui/core/guiOffscreenCanvas.h
Normal file
63
Engine/source/gui/core/guiOffscreenCanvas.h
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
#ifndef _GUIOFFSCREENCANVAS_H_
|
||||
#define _GUIOFFSCREENCANVAS_H_
|
||||
|
||||
#include "math/mMath.h"
|
||||
#include "gui/core/guiCanvas.h"
|
||||
#include "core/util/tVector.h"
|
||||
|
||||
#ifndef _MATTEXTURETARGET_H_
|
||||
#include "materials/matTextureTarget.h"
|
||||
#endif
|
||||
|
||||
class GuiTextureDebug;
|
||||
|
||||
class GuiOffscreenCanvas : public GuiCanvas
|
||||
{
|
||||
public:
|
||||
typedef GuiCanvas Parent;
|
||||
|
||||
GuiOffscreenCanvas();
|
||||
~GuiOffscreenCanvas();
|
||||
|
||||
bool onAdd();
|
||||
void onRemove();
|
||||
|
||||
void renderFrame(bool preRenderOnly, bool bufferSwap);
|
||||
|
||||
Point2I getWindowSize();
|
||||
|
||||
Point2I getCursorPos();
|
||||
void setCursorPos(const Point2I &pt);
|
||||
void showCursor(bool state);
|
||||
bool isCursorShown();
|
||||
|
||||
void _onTextureEvent( GFXTexCallbackCode code );
|
||||
|
||||
void _setupTargets();
|
||||
void _teardownTargets();
|
||||
|
||||
NamedTexTargetRef getTarget() { return &mNamedTarget; }
|
||||
|
||||
void markDirty() { mTargetDirty = true; }
|
||||
|
||||
static void initPersistFields();
|
||||
|
||||
DECLARE_CONOBJECT(GuiOffscreenCanvas);
|
||||
|
||||
protected:
|
||||
GFXTextureTargetRef mTarget;
|
||||
NamedTexTarget mNamedTarget;
|
||||
GFXTexHandle mTargetTexture;
|
||||
|
||||
GFXFormat mTargetFormat;
|
||||
Point2I mTargetSize;
|
||||
String mTargetName;
|
||||
|
||||
bool mTargetDirty;
|
||||
bool mDynamicTarget;
|
||||
|
||||
public:
|
||||
static Vector<GuiOffscreenCanvas*> sList;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -47,8 +47,6 @@ U32 GuiImageList::Insert( const char* texturePath, GFXTextureProfile *Type )
|
|||
{
|
||||
TextureEntry *t = new TextureEntry;
|
||||
|
||||
if ( ! t ) return -1;
|
||||
|
||||
t->TexturePath = StringTable->insert(texturePath);
|
||||
if ( *t->TexturePath )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -564,31 +564,25 @@ void GuiInspector::refresh()
|
|||
ungroup = new GuiInspectorGroup( "Ungrouped", this );
|
||||
ungroup->setHeaderHidden( true );
|
||||
ungroup->setCanCollapse( false );
|
||||
if( ungroup != NULL )
|
||||
{
|
||||
ungroup->registerObject();
|
||||
mGroups.push_back( ungroup );
|
||||
addObject( ungroup );
|
||||
}
|
||||
|
||||
ungroup->registerObject();
|
||||
mGroups.push_back( ungroup );
|
||||
addObject( ungroup );
|
||||
}
|
||||
|
||||
// Put the 'transform' group first
|
||||
GuiInspectorGroup *transform = new GuiInspectorGroup( "Transform", this );
|
||||
if( transform != NULL )
|
||||
{
|
||||
transform->registerObject();
|
||||
mGroups.push_back( transform );
|
||||
addObject( transform );
|
||||
}
|
||||
|
||||
transform->registerObject();
|
||||
mGroups.push_back(transform);
|
||||
addObject(transform);
|
||||
|
||||
// Always create the 'general' group (for fields without a group)
|
||||
GuiInspectorGroup *general = new GuiInspectorGroup( "General", this );
|
||||
if( general != NULL )
|
||||
{
|
||||
general->registerObject();
|
||||
mGroups.push_back( general );
|
||||
addObject( general );
|
||||
}
|
||||
|
||||
general->registerObject();
|
||||
mGroups.push_back(general);
|
||||
addObject(general);
|
||||
|
||||
// Create the inspector groups for static fields.
|
||||
|
||||
|
|
@ -606,25 +600,23 @@ void GuiInspector::refresh()
|
|||
if( !group && !isGroupFiltered( itr->pGroupname ) )
|
||||
{
|
||||
GuiInspectorGroup *group = new GuiInspectorGroup( itr->pGroupname, this );
|
||||
if( group != NULL )
|
||||
|
||||
group->registerObject();
|
||||
if( !group->getNumFields() )
|
||||
{
|
||||
group->registerObject();
|
||||
if( !group->getNumFields() )
|
||||
{
|
||||
#ifdef DEBUG_SPEW
|
||||
Platform::outputDebugString( "[GuiInspector] Removing empty group '%s'",
|
||||
group->getCaption().c_str() );
|
||||
#endif
|
||||
#ifdef DEBUG_SPEW
|
||||
Platform::outputDebugString( "[GuiInspector] Removing empty group '%s'",
|
||||
group->getCaption().c_str() );
|
||||
#endif
|
||||
|
||||
// The group ended up having no fields. Remove it.
|
||||
group->deleteObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
mGroups.push_back( group );
|
||||
addObject( group );
|
||||
}
|
||||
}
|
||||
// The group ended up having no fields. Remove it.
|
||||
group->deleteObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
mGroups.push_back( group );
|
||||
addObject( group );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -634,12 +626,10 @@ void GuiInspector::refresh()
|
|||
if ( !isGroupFiltered( "Dynamic Fields" ) )
|
||||
{
|
||||
GuiInspectorGroup *dynGroup = new GuiInspectorDynamicGroup( "Dynamic Fields", this);
|
||||
if( dynGroup != NULL )
|
||||
{
|
||||
dynGroup->registerObject();
|
||||
mGroups.push_back( dynGroup );
|
||||
addObject( dynGroup );
|
||||
}
|
||||
|
||||
dynGroup->registerObject();
|
||||
mGroups.push_back( dynGroup );
|
||||
addObject( dynGroup );
|
||||
}
|
||||
|
||||
if( mShowCustomFields && mTargets.size() == 1 )
|
||||
|
|
|
|||
|
|
@ -57,10 +57,6 @@ GuiControl* GuiInspectorTypeMenuBase::constructEditControl()
|
|||
{
|
||||
GuiControl* retCtrl = new GuiPopUpMenuCtrl();
|
||||
|
||||
// If we couldn't construct the control, bail!
|
||||
if( retCtrl == NULL )
|
||||
return retCtrl;
|
||||
|
||||
GuiPopUpMenuCtrl *menu = dynamic_cast<GuiPopUpMenuCtrl*>(retCtrl);
|
||||
|
||||
// Let's make it look pretty.
|
||||
|
|
@ -218,25 +214,21 @@ GuiControl* GuiInspectorTypeMaterialName::construct(const char* command)
|
|||
//return retCtrl;
|
||||
mBrowseButton = new GuiBitmapButtonCtrl();
|
||||
|
||||
if ( mBrowseButton != NULL )
|
||||
{
|
||||
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
||||
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
||||
|
||||
char szBuffer[512];
|
||||
dSprintf( szBuffer, 512, command, getId());
|
||||
mBrowseButton->setField( "Command", szBuffer );
|
||||
dSprintf( szBuffer, 512, command, getId());
|
||||
mBrowseButton->setField( "Command", szBuffer );
|
||||
|
||||
//temporary static button name
|
||||
char bitmapName[512] = "tools/materialEditor/gui/change-material-btn";
|
||||
mBrowseButton->setBitmap( bitmapName );
|
||||
//temporary static button name
|
||||
char bitmapName[512] = "tools/materialEditor/gui/change-material-btn";
|
||||
mBrowseButton->setBitmap( bitmapName );
|
||||
|
||||
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
||||
mBrowseButton->registerObject();
|
||||
addObject( mBrowseButton );
|
||||
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
||||
mBrowseButton->registerObject();
|
||||
addObject( mBrowseButton );
|
||||
|
||||
// Position
|
||||
mBrowseButton->resize( browseRect.point, browseRect.extent );
|
||||
}
|
||||
// Position
|
||||
mBrowseButton->resize( browseRect.point, browseRect.extent );
|
||||
|
||||
return retCtrl;
|
||||
}
|
||||
|
|
@ -328,25 +320,21 @@ GuiControl* GuiInspectorTypeTerrainMaterialName::construct(const char* command)
|
|||
//return retCtrl;
|
||||
mBrowseButton = new GuiBitmapButtonCtrl();
|
||||
|
||||
if ( mBrowseButton != NULL )
|
||||
{
|
||||
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
||||
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
||||
|
||||
char szBuffer[512];
|
||||
dSprintf( szBuffer, 512, command, getId());
|
||||
mBrowseButton->setField( "Command", szBuffer );
|
||||
dSprintf( szBuffer, 512, command, getId());
|
||||
mBrowseButton->setField( "Command", szBuffer );
|
||||
|
||||
//temporary static button name
|
||||
char bitmapName[512] = "tools/gui/images/layers-btn";
|
||||
mBrowseButton->setBitmap( bitmapName );
|
||||
//temporary static button name
|
||||
char bitmapName[512] = "tools/gui/images/layers-btn";
|
||||
mBrowseButton->setBitmap( bitmapName );
|
||||
|
||||
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
||||
mBrowseButton->registerObject();
|
||||
addObject( mBrowseButton );
|
||||
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
||||
mBrowseButton->registerObject();
|
||||
addObject( mBrowseButton );
|
||||
|
||||
// Position
|
||||
mBrowseButton->resize( browseRect.point, browseRect.extent );
|
||||
}
|
||||
// Position
|
||||
mBrowseButton->resize( browseRect.point, browseRect.extent );
|
||||
|
||||
return retCtrl;
|
||||
}
|
||||
|
|
@ -414,10 +402,6 @@ GuiControl* GuiInspectorTypeCheckBox::constructEditControl()
|
|||
{
|
||||
GuiControl* retCtrl = new GuiCheckBoxCtrl();
|
||||
|
||||
// If we couldn't construct the control, bail!
|
||||
if( retCtrl == NULL )
|
||||
return retCtrl;
|
||||
|
||||
GuiCheckBoxCtrl *check = dynamic_cast<GuiCheckBoxCtrl*>(retCtrl);
|
||||
|
||||
// Let's make it look pretty.
|
||||
|
|
@ -485,10 +469,6 @@ GuiControl* GuiInspectorTypeFileName::constructEditControl()
|
|||
{
|
||||
GuiControl* retCtrl = new GuiTextEditCtrl();
|
||||
|
||||
// If we couldn't construct the control, bail!
|
||||
if( retCtrl == NULL )
|
||||
return retCtrl;
|
||||
|
||||
// Let's make it look pretty.
|
||||
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditRightProfile" );
|
||||
retCtrl->setDataField( StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile" );
|
||||
|
|
@ -504,20 +484,17 @@ GuiControl* GuiInspectorTypeFileName::constructEditControl()
|
|||
|
||||
mBrowseButton = new GuiButtonCtrl();
|
||||
|
||||
if( mBrowseButton != NULL )
|
||||
{
|
||||
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
||||
char szBuffer[512];
|
||||
dSprintf( szBuffer, 512, "getLoadFilename(\"*.*|*.*\", \"%d.apply\", %d.getData());", getId(), getId() );
|
||||
mBrowseButton->setField( "Command", szBuffer );
|
||||
mBrowseButton->setField( "text", "..." );
|
||||
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorButtonProfile" );
|
||||
mBrowseButton->registerObject();
|
||||
addObject( mBrowseButton );
|
||||
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
||||
|
||||
// Position
|
||||
mBrowseButton->resize( browseRect.point, browseRect.extent );
|
||||
}
|
||||
dSprintf( szBuffer, 512, "getLoadFilename(\"*.*|*.*\", \"%d.apply\", %d.getData());", getId(), getId() );
|
||||
mBrowseButton->setField( "Command", szBuffer );
|
||||
mBrowseButton->setField( "text", "..." );
|
||||
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorButtonProfile" );
|
||||
mBrowseButton->registerObject();
|
||||
addObject( mBrowseButton );
|
||||
|
||||
// Position
|
||||
mBrowseButton->resize( browseRect.point, browseRect.extent );
|
||||
|
||||
return retCtrl;
|
||||
}
|
||||
|
|
@ -769,23 +746,20 @@ GuiControl* GuiInspectorTypeShapeFilename::constructEditControl()
|
|||
|
||||
// Create "Open in ShapeEditor" button
|
||||
mShapeEdButton = new GuiBitmapButtonCtrl();
|
||||
if ( mShapeEdButton != NULL )
|
||||
{
|
||||
char szBuffer[512];
|
||||
dSprintf( szBuffer, sizeof(szBuffer), "ShapeEditorPlugin.open(%d.getText());", retCtrl->getId() );
|
||||
mShapeEdButton->setField( "Command", szBuffer );
|
||||
|
||||
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
|
||||
mShapeEdButton->setBitmap( bitmapName );
|
||||
dSprintf(szBuffer, sizeof(szBuffer), "ShapeEditorPlugin.open(%d.getText());", retCtrl->getId());
|
||||
mShapeEdButton->setField("Command", szBuffer);
|
||||
|
||||
mShapeEdButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
||||
mShapeEdButton->setDataField( StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile" );
|
||||
mShapeEdButton->setDataField( StringTable->insert("hovertime"), NULL, "1000" );
|
||||
mShapeEdButton->setDataField( StringTable->insert("tooltip"), NULL, "Open this file in the Shape Editor" );
|
||||
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
|
||||
mShapeEdButton->setBitmap(bitmapName);
|
||||
|
||||
mShapeEdButton->registerObject();
|
||||
addObject( mShapeEdButton );
|
||||
}
|
||||
mShapeEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
|
||||
mShapeEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
|
||||
mShapeEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000");
|
||||
mShapeEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the Shape Editor");
|
||||
|
||||
mShapeEdButton->registerObject();
|
||||
addObject(mShapeEdButton);
|
||||
|
||||
return retCtrl;
|
||||
}
|
||||
|
|
@ -842,10 +816,6 @@ GuiControl* GuiInspectorTypeCommand::constructEditControl()
|
|||
{
|
||||
GuiButtonCtrl* retCtrl = new GuiButtonCtrl();
|
||||
|
||||
// If we couldn't construct the control, bail!
|
||||
if( retCtrl == NULL )
|
||||
return retCtrl;
|
||||
|
||||
// Let's make it look pretty.
|
||||
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile" );
|
||||
|
||||
|
|
@ -926,25 +896,21 @@ GuiControl* GuiInspectorTypeRectUV::constructEditControl()
|
|||
//return retCtrl;
|
||||
mBrowseButton = new GuiBitmapButtonCtrl();
|
||||
|
||||
if ( mBrowseButton != NULL )
|
||||
{
|
||||
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
||||
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
||||
|
||||
char szBuffer[512];
|
||||
dSprintf( szBuffer, 512, "uvEditor.showDialog(\"%d.apply\", %d, %d.getText());", getId(), mInspector->getInspectObject()->getId(), retCtrl->getId());
|
||||
mBrowseButton->setField( "Command", szBuffer );
|
||||
dSprintf( szBuffer, 512, "uvEditor.showDialog(\"%d.apply\", %d, %d.getText());", getId(), mInspector->getInspectObject()->getId(), retCtrl->getId());
|
||||
mBrowseButton->setField( "Command", szBuffer );
|
||||
|
||||
//temporary static button name
|
||||
char bitmapName[512] = "tools/gui/images/uv-editor-btn";
|
||||
mBrowseButton->setBitmap( bitmapName );
|
||||
//temporary static button name
|
||||
char bitmapName[512] = "tools/gui/images/uv-editor-btn";
|
||||
mBrowseButton->setBitmap( bitmapName );
|
||||
|
||||
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
||||
mBrowseButton->registerObject();
|
||||
addObject( mBrowseButton );
|
||||
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
||||
mBrowseButton->registerObject();
|
||||
addObject( mBrowseButton );
|
||||
|
||||
// Position
|
||||
mBrowseButton->resize( browseRect.point, browseRect.extent );
|
||||
}
|
||||
// Position
|
||||
mBrowseButton->resize( browseRect.point, browseRect.extent );
|
||||
|
||||
return retCtrl;
|
||||
}
|
||||
|
|
@ -1084,10 +1050,6 @@ GuiControl* GuiInspectorTypeColor::constructEditControl()
|
|||
{
|
||||
GuiControl* retCtrl = new GuiTextEditCtrl();
|
||||
|
||||
// If we couldn't construct the control, bail!
|
||||
if( retCtrl == NULL )
|
||||
return retCtrl;
|
||||
|
||||
// Let's make it look pretty.
|
||||
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile" );
|
||||
|
||||
|
|
@ -1101,46 +1063,42 @@ GuiControl* GuiInspectorTypeColor::constructEditControl()
|
|||
|
||||
mBrowseButton = new GuiSwatchButtonCtrl();
|
||||
|
||||
if ( mBrowseButton != NULL )
|
||||
{
|
||||
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
||||
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorSwatchButtonProfile" );
|
||||
mBrowseButton->registerObject();
|
||||
addObject( mBrowseButton );
|
||||
RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
||||
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorSwatchButtonProfile" );
|
||||
mBrowseButton->registerObject();
|
||||
addObject( mBrowseButton );
|
||||
|
||||
char szColor[512];
|
||||
if( _getColorConversionFunction() )
|
||||
dSprintf( szColor, 512, "%s( %d.color )", _getColorConversionFunction(), mBrowseButton->getId() );
|
||||
else
|
||||
dSprintf( szColor, 512, "%d.color", mBrowseButton->getId() );
|
||||
char szColor[2048];
|
||||
if( _getColorConversionFunction() )
|
||||
dSprintf( szColor, 512, "%s( %d.color )", _getColorConversionFunction(), mBrowseButton->getId() );
|
||||
else
|
||||
dSprintf( szColor, 512, "%d.color", mBrowseButton->getId() );
|
||||
|
||||
// If the inspector supports the alternate undo recording path,
|
||||
// use this here.
|
||||
// If the inspector supports the alternate undo recording path,
|
||||
// use this here.
|
||||
|
||||
char szBuffer[2048];
|
||||
GuiInspector* inspector = getInspector();
|
||||
if( inspector->isMethod( "onInspectorPreFieldModification" ) )
|
||||
{
|
||||
dSprintf( szBuffer, sizeof( szBuffer ),
|
||||
"%d.onInspectorPreFieldModification(\"%s\",\"%s\"); %s(%s, \"%d.onInspectorPostFieldModification(); %d.applyWithoutUndo\", %d.getRoot(), \"%d.applyWithoutUndo\", \"%d.onInspectorDiscardFieldModification(); %%unused=\");",
|
||||
inspector->getId(), getRawFieldName(), getArrayIndex(),
|
||||
mColorFunction, szColor, inspector->getId(), getId(),
|
||||
getId(),
|
||||
getId(),
|
||||
inspector->getId()
|
||||
);
|
||||
}
|
||||
else
|
||||
dSprintf( szBuffer, sizeof( szBuffer ),
|
||||
"%s(%s, \"%d.apply\", %d.getRoot());",
|
||||
mColorFunction, szColor, getId(), getId() );
|
||||
|
||||
mBrowseButton->setConsoleCommand( szBuffer );
|
||||
mBrowseButton->setUseMouseEvents( true ); // Allow drag&drop.
|
||||
|
||||
// Position
|
||||
mBrowseButton->resize( browseRect.point, browseRect.extent );
|
||||
GuiInspector* inspector = getInspector();
|
||||
if( inspector->isMethod( "onInspectorPreFieldModification" ) )
|
||||
{
|
||||
dSprintf( szBuffer, sizeof( szBuffer ),
|
||||
"%d.onInspectorPreFieldModification(\"%s\",\"%s\"); %s(%s, \"%d.onInspectorPostFieldModification(); %d.applyWithoutUndo\", %d.getRoot(), \"%d.applyWithoutUndo\", \"%d.onInspectorDiscardFieldModification(); %%unused=\");",
|
||||
inspector->getId(), getRawFieldName(), getArrayIndex(),
|
||||
mColorFunction, szColor, inspector->getId(), getId(),
|
||||
getId(),
|
||||
getId(),
|
||||
inspector->getId()
|
||||
);
|
||||
}
|
||||
else
|
||||
dSprintf( szBuffer, sizeof( szBuffer ),
|
||||
"%s(%s, \"%d.apply\", %d.getRoot());",
|
||||
mColorFunction, szColor, getId(), getId() );
|
||||
|
||||
mBrowseButton->setConsoleCommand( szBuffer );
|
||||
mBrowseButton->setUseMouseEvents( true ); // Allow drag&drop.
|
||||
|
||||
// Position
|
||||
mBrowseButton->resize( browseRect.point, browseRect.extent );
|
||||
|
||||
return retCtrl;
|
||||
}
|
||||
|
|
@ -1277,10 +1235,6 @@ GuiControl* GuiInspectorTypeS32::constructEditControl()
|
|||
{
|
||||
GuiControl* retCtrl = new GuiTextEditSliderCtrl();
|
||||
|
||||
// If we couldn't construct the control, bail!
|
||||
if( retCtrl == NULL )
|
||||
return retCtrl;
|
||||
|
||||
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile" );
|
||||
|
||||
// Don't forget to register ourselves
|
||||
|
|
|
|||
|
|
@ -1288,12 +1288,13 @@ void GuiMenuBar::onMouseUp(const GuiEvent &event)
|
|||
|
||||
void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
|
||||
{
|
||||
|
||||
RectI ctrlRect(offset, getExtent());
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
//if opaque, fill the update rect with the fill color
|
||||
if (mProfile->mOpaque)
|
||||
GFX->getDrawUtil()->drawRectFill(RectI(offset, getExtent()), mProfile->mFillColor);
|
||||
drawUtil->drawRectFill(RectI(offset, getExtent()), mProfile->mFillColor);
|
||||
|
||||
//if there's a border, draw the border
|
||||
if (mProfile->mBorder)
|
||||
|
|
@ -1337,20 +1338,20 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
|
|||
Point2I bitmapstart(start);
|
||||
bitmapstart.y = walk->bounds.point.y + ( walk->bounds.extent.y - rect.extent.y ) / 2;
|
||||
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
GFX->getDrawUtil()->drawBitmapSR( mProfile->mTextureObject, offset + bitmapstart, rect);
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapSR( mProfile->mTextureObject, offset + bitmapstart, rect);
|
||||
|
||||
// Should we also draw the text?
|
||||
if(!walk->drawBitmapOnly)
|
||||
{
|
||||
start.x += mBitmapMargin;
|
||||
GFX->getDrawUtil()->setBitmapModulation( fontColor );
|
||||
GFX->getDrawUtil()->drawText( mProfile->mFont, start + offset, walk->text, mProfile->mFontColors );
|
||||
drawUtil->setBitmapModulation( fontColor );
|
||||
drawUtil->drawText( mProfile->mFont, start + offset, walk->text, mProfile->mFontColors );
|
||||
}
|
||||
} else
|
||||
{
|
||||
GFX->getDrawUtil()->setBitmapModulation( fontColor );
|
||||
GFX->getDrawUtil()->drawText( mProfile->mFont, start + offset, walk->text, mProfile->mFontColors );
|
||||
drawUtil->setBitmapModulation( fontColor );
|
||||
drawUtil->drawText( mProfile->mFont, start + offset, walk->text, mProfile->mFontColors );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1633,7 +1634,7 @@ void GuiMenuBar::closeMenu()
|
|||
}
|
||||
|
||||
// Called when a menu item is highlighted by the mouse
|
||||
void GuiMenuBar::highlightedMenuItem(S32 selectionIndex, RectI bounds, Point2I cellSize)
|
||||
void GuiMenuBar::highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Point2I cellSize)
|
||||
{
|
||||
S32 selstore = selectionIndex;
|
||||
|
||||
|
|
@ -1787,7 +1788,7 @@ void GuiMenuBar::onAction()
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
// Performs an action when a menu item that is a submenu is selected/highlighted
|
||||
void GuiMenuBar::onSubmenuAction(S32 selectionIndex, RectI bounds, Point2I cellSize)
|
||||
void GuiMenuBar::onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2I cellSize)
|
||||
{
|
||||
if(!mouseOverSubmenu)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -182,12 +182,12 @@ public:
|
|||
static void addSubmenuItem(Menu *menu, MenuItem *submenu, MenuItem *newMenuItem );
|
||||
static void removeSubmenuItem(MenuItem *menuItem, MenuItem *submenuItem);
|
||||
static void clearSubmenuItems(MenuItem *menuitem);
|
||||
void onSubmenuAction(S32 selectionIndex, RectI bounds, Point2I cellSize);
|
||||
void onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2I cellSize);
|
||||
void closeSubmenu();
|
||||
void checkSubmenuMouseMove(const GuiEvent &event);
|
||||
MenuItem *findHitMenuItem(Point2I mousePoint);
|
||||
|
||||
void highlightedMenuItem(S32 selectionIndex, RectI bounds, Point2I cellSize); // Called whenever a menu item is highlighted by the mouse
|
||||
void highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Point2I cellSize); // Called whenever a menu item is highlighted by the mouse
|
||||
|
||||
// display/mouse functions
|
||||
|
||||
|
|
|
|||
|
|
@ -287,33 +287,35 @@ void GuiRectHandles::onRender(Point2I offset, const RectI &updateRect)
|
|||
Point2I size(extent.x*mHandleRect.extent.x, extent.y*mHandleRect.extent.y);
|
||||
RectI box(offset+pos, size);
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
// Draw border
|
||||
GFX->getDrawUtil()->drawRect(box, handleColor);
|
||||
drawUtil->drawRect(box, handleColor);
|
||||
|
||||
// Draw each handle
|
||||
Point2I handleSize(mHandleSize, mHandleSize);
|
||||
RectI handleRect(box.point, handleSize);
|
||||
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Upper left
|
||||
drawUtil->drawRectFill(handleRect, handleColor); // Upper left
|
||||
handleRect.point = Point2I(box.point.x+size.x-handleSize.x, box.point.y);
|
||||
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Upper right
|
||||
drawUtil->drawRectFill(handleRect, handleColor); // Upper right
|
||||
handleRect.point = Point2I(box.point.x, box.point.y+size.y-handleSize.y);
|
||||
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Lower left
|
||||
drawUtil->drawRectFill(handleRect, handleColor); // Lower left
|
||||
handleRect.point = Point2I(box.point.x+size.x-handleSize.x, box.point.y+size.y-handleSize.y);
|
||||
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Lower right
|
||||
drawUtil->drawRectFill(handleRect, handleColor); // Lower right
|
||||
|
||||
Point2I halfSize = size / 2;
|
||||
Point2I halfHandleSize = handleSize / 2;
|
||||
handleRect.point = Point2I(box.point.x+halfSize.x-halfHandleSize.x, box.point.y);
|
||||
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Upper middle
|
||||
drawUtil->drawRectFill(handleRect, handleColor); // Upper middle
|
||||
handleRect.point = Point2I(box.point.x+halfSize.x-halfHandleSize.x, box.point.y+size.y-handleSize.y);
|
||||
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Lower middle
|
||||
drawUtil->drawRectFill(handleRect, handleColor); // Lower middle
|
||||
handleRect.point = Point2I(box.point.x, box.point.y+halfSize.y-halfHandleSize.y);
|
||||
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Left middle
|
||||
drawUtil->drawRectFill(handleRect, handleColor); // Left middle
|
||||
handleRect.point = Point2I(box.point.x+size.x-handleSize.x, box.point.y+halfSize.y-halfHandleSize.y);
|
||||
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Right middle
|
||||
drawUtil->drawRectFill(handleRect, handleColor); // Right middle
|
||||
|
||||
handleRect.point = Point2I(box.point.x+halfSize.x-halfHandleSize.x, box.point.y+halfSize.y-halfHandleSize.y);
|
||||
GFX->getDrawUtil()->drawRectFill(handleRect, handleColor); // Middle
|
||||
drawUtil->drawRectFill(handleRect, handleColor); // Middle
|
||||
|
||||
renderChildControls(offset, updateRect);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -330,10 +330,11 @@ void GuiShapeEdPreview::setCurrentDetail(S32 dl)
|
|||
{
|
||||
if ( mModel )
|
||||
{
|
||||
S32 smallest = mModel->getShape()->mSmallestVisibleDL;
|
||||
mModel->getShape()->mSmallestVisibleDL = mModel->getShape()->details.size()-1;
|
||||
TSShape* shape = mModel->getShape();
|
||||
S32 smallest = shape->mSmallestVisibleDL;
|
||||
shape->mSmallestVisibleDL = shape->details.size() - 1;
|
||||
mModel->setCurrentDetail( dl );
|
||||
mModel->getShape()->mSmallestVisibleDL = smallest;
|
||||
shape->mSmallestVisibleDL = smallest;
|
||||
|
||||
// Match the camera distance to this detail if necessary
|
||||
//@todo if ( !gui->mFixedDetail )
|
||||
|
|
@ -359,19 +360,21 @@ bool GuiShapeEdPreview::setObjectModel(const char* modelName)
|
|||
mModel = new TSShapeInstance( model, true );
|
||||
AssertFatal( mModel, avar("GuiShapeEdPreview: Failed to load model %s. Please check your model name and load a valid model.", modelName ));
|
||||
|
||||
TSShape* shape = mModel->getShape();
|
||||
|
||||
// Initialize camera values:
|
||||
mOrbitPos = mModel->getShape()->center;
|
||||
mOrbitPos = shape->center;
|
||||
|
||||
// Set camera move and zoom speed according to model size
|
||||
mMoveSpeed = mModel->getShape()->radius / sMoveScaler;
|
||||
mZoomSpeed = mModel->getShape()->radius / sZoomScaler;
|
||||
mMoveSpeed = shape->radius / sMoveScaler;
|
||||
mZoomSpeed = shape->radius / sZoomScaler;
|
||||
|
||||
// Reset node selection
|
||||
mHoverNode = -1;
|
||||
mSelectedNode = -1;
|
||||
mSelectedObject = -1;
|
||||
mSelectedObjDetail = 0;
|
||||
mProjectedNodes.setSize( mModel->getShape()->nodes.size() );
|
||||
mProjectedNodes.setSize( shape->nodes.size() );
|
||||
|
||||
// Reset detail stats
|
||||
mCurrentDL = 0;
|
||||
|
|
@ -511,8 +514,6 @@ bool GuiShapeEdPreview::mountShape(const char* modelName, const char* nodeName,
|
|||
return false;
|
||||
|
||||
TSShapeInstance* tsi = new TSShapeInstance( model, true );
|
||||
if ( !tsi )
|
||||
return false;
|
||||
|
||||
if ( slot == -1 )
|
||||
{
|
||||
|
|
@ -683,9 +684,11 @@ void GuiShapeEdPreview::refreshShape()
|
|||
mModel->initNodeTransforms();
|
||||
mModel->initMeshObjects();
|
||||
|
||||
mProjectedNodes.setSize( mModel->getShape()->nodes.size() );
|
||||
TSShape* shape = mModel->getShape();
|
||||
|
||||
if ( mSelectedObject >= mModel->getShape()->objects.size() )
|
||||
mProjectedNodes.setSize( shape->nodes.size() );
|
||||
|
||||
if ( mSelectedObject >= shape->objects.size() )
|
||||
{
|
||||
mSelectedObject = -1;
|
||||
mSelectedObjDetail = 0;
|
||||
|
|
@ -694,22 +697,22 @@ void GuiShapeEdPreview::refreshShape()
|
|||
// Re-compute the collision mesh stats
|
||||
mColMeshes = 0;
|
||||
mColPolys = 0;
|
||||
for ( S32 i = 0; i < mModel->getShape()->details.size(); i++ )
|
||||
for ( S32 i = 0; i < shape->details.size(); i++ )
|
||||
{
|
||||
const TSShape::Detail& det = mModel->getShape()->details[i];
|
||||
const String& detName = mModel->getShape()->getName( det.nameIndex );
|
||||
const TSShape::Detail& det = shape->details[i];
|
||||
const String& detName = shape->getName( det.nameIndex );
|
||||
if ( ( det.subShapeNum < 0 ) || !detName.startsWith( "collision-" ) )
|
||||
continue;
|
||||
|
||||
mColPolys += det.polyCount;
|
||||
|
||||
S32 od = det.objectDetailNum;
|
||||
S32 start = mModel->getShape()->subShapeFirstObject[det.subShapeNum];
|
||||
S32 end = start + mModel->getShape()->subShapeNumObjects[det.subShapeNum];
|
||||
S32 start = shape->subShapeFirstObject[det.subShapeNum];
|
||||
S32 end = start + shape->subShapeNumObjects[det.subShapeNum];
|
||||
for ( S32 j = start; j < end; j++ )
|
||||
{
|
||||
const TSShape::Object &obj = mModel->getShape()->objects[j];
|
||||
const TSMesh* mesh = ( od < obj.numMeshes ) ? mModel->getShape()->meshes[obj.startMeshIndex + od] : NULL;
|
||||
const TSShape::Object &obj = shape->objects[j];
|
||||
const TSMesh* mesh = ( od < obj.numMeshes ) ? shape->meshes[obj.startMeshIndex + od] : NULL;
|
||||
if ( mesh )
|
||||
mColMeshes++;
|
||||
}
|
||||
|
|
@ -1542,10 +1545,12 @@ void GuiShapeEdPreview::renderSunDirection() const
|
|||
GFXStateBlockDesc desc;
|
||||
desc.setZReadWrite( true, true );
|
||||
|
||||
GFX->getDrawUtil()->drawArrow( desc, start, end, color );
|
||||
GFX->getDrawUtil()->drawArrow( desc, start + up, end + up, color );
|
||||
GFX->getDrawUtil()->drawArrow( desc, start + right, end + right, color );
|
||||
GFX->getDrawUtil()->drawArrow( desc, start + up + right, end + up + right, color );
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
drawUtil->drawArrow( desc, start, end, color );
|
||||
drawUtil->drawArrow( desc, start + up, end + up, color );
|
||||
drawUtil->drawArrow( desc, start + right, end + right, color );
|
||||
drawUtil->drawArrow( desc, start + up + right, end + up + right, color );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -167,12 +167,10 @@ GuiInspectorField* GuiInspectorGroup::constructField( S32 fieldType )
|
|||
|
||||
|
||||
GuiInspectorDatablockField *dbFieldClass = new GuiInspectorDatablockField( typeClassName );
|
||||
if( dbFieldClass != NULL )
|
||||
{
|
||||
// return our new datablock field with correct datablock type enumeration info
|
||||
return dbFieldClass;
|
||||
}
|
||||
}
|
||||
|
||||
// return our new datablock field with correct datablock type enumeration info
|
||||
return dbFieldClass;
|
||||
}
|
||||
|
||||
// Nope, not a datablock. So maybe it has a valid inspector field override we can use?
|
||||
if(!cbt->getInspectorFieldType())
|
||||
|
|
|
|||
|
|
@ -52,13 +52,10 @@ void GuiVariableInspector::loadVars( String searchStr )
|
|||
group->setCaption( "Global Variables" );
|
||||
group->mSearchString = searchStr;
|
||||
|
||||
if( group != NULL )
|
||||
{
|
||||
group->registerObject();
|
||||
mGroups.push_back( group );
|
||||
addObject( group );
|
||||
}
|
||||
|
||||
group->registerObject();
|
||||
mGroups.push_back( group );
|
||||
addObject( group );
|
||||
|
||||
//group->inspectGroup();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,8 +206,10 @@ void GuiProgressBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
mDim = getHeight();
|
||||
else
|
||||
mDim = getWidth();
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
drawUtil->clearBitmapModulation();
|
||||
|
||||
if(mNumberOfBitmaps == 1)
|
||||
{
|
||||
|
|
@ -218,14 +220,14 @@ void GuiProgressBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
//drawing stretch bitmap
|
||||
RectI progressRect = ctrlRect;
|
||||
progressRect.extent.x = width;
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject, progressRect, mProfile->mBitmapArrayRects[0]);
|
||||
drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, progressRect, mProfile->mBitmapArrayRects[0]);
|
||||
}
|
||||
}
|
||||
else if(mNumberOfBitmaps >= 3)
|
||||
{
|
||||
//drawing left-end bitmap
|
||||
RectI progressRectLeft(ctrlRect.point.x, ctrlRect.point.y, mDim, mDim);
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject, progressRectLeft, mProfile->mBitmapArrayRects[0]);
|
||||
drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, progressRectLeft, mProfile->mBitmapArrayRects[0]);
|
||||
|
||||
//draw the progress with image
|
||||
S32 width = (S32)((F32)(getWidth()) * mProgress);
|
||||
|
|
@ -237,11 +239,11 @@ void GuiProgressBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
progressRect.extent.x = (width - mDim - mDim);
|
||||
if (progressRect.extent.x < 0)
|
||||
progressRect.extent.x = 0;
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject, progressRect, mProfile->mBitmapArrayRects[1]);
|
||||
drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, progressRect, mProfile->mBitmapArrayRects[1]);
|
||||
|
||||
//drawing right-end bitmap
|
||||
RectI progressRectRight(progressRect.point.x + progressRect.extent.x, ctrlRect.point.y, mDim, mDim );
|
||||
GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject, progressRectRight, mProfile->mBitmapArrayRects[2]);
|
||||
drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, progressRectRight, mProfile->mBitmapArrayRects[2]);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -249,7 +251,7 @@ void GuiProgressBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
//if there's a border, draw it
|
||||
if (mProfile->mBorder)
|
||||
GFX->getDrawUtil()->drawRect(ctrlRect, mProfile->mBorderColor);
|
||||
drawUtil->drawRect(ctrlRect, mProfile->mBorderColor);
|
||||
|
||||
Parent::onRender( offset, updateRect );
|
||||
|
||||
|
|
|
|||
|
|
@ -575,12 +575,13 @@ void MessageVector::registerSpectator(SpectatorCallback callBack, void *spectato
|
|||
}
|
||||
|
||||
mSpectators.increment();
|
||||
mSpectators.last().callback = callBack;
|
||||
mSpectators.last().key = spectatorKey;
|
||||
SpectatorRef& lastSpectatorRef = mSpectators.last();
|
||||
lastSpectatorRef.callback = callBack;
|
||||
lastSpectatorRef.key = spectatorKey;
|
||||
|
||||
// Need to message this spectator of all the lines currently inserted...
|
||||
for (i = 0; i < mMessageLines.size(); i++) {
|
||||
(*mSpectators.last().callback)(mSpectators.last().key,
|
||||
(*lastSpectatorRef.callback)(lastSpectatorRef.key,
|
||||
LineInserted, i);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -918,7 +918,7 @@ void DICreateUndoAction::initPersistFields()
|
|||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
void DICreateUndoAction::addDecal( DecalInstance decal )
|
||||
void DICreateUndoAction::addDecal(const DecalInstance& decal)
|
||||
{
|
||||
mDecalInstance = decal;
|
||||
mDatablockId = decal.mDataBlock->getId();
|
||||
|
|
@ -1006,7 +1006,7 @@ void DIDeleteUndoAction::initPersistFields()
|
|||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
void DIDeleteUndoAction::deleteDecal( DecalInstance decal )
|
||||
void DIDeleteUndoAction::deleteDecal(const DecalInstance& decal)
|
||||
{
|
||||
mDecalInstance = decal;
|
||||
mDatablockId = decal.mDataBlock->getId();
|
||||
|
|
@ -1094,7 +1094,7 @@ void DBDeleteUndoAction::initPersistFields()
|
|||
Parent::initPersistFields();
|
||||
}
|
||||
|
||||
void DBDeleteUndoAction::deleteDecal( DecalInstance decal )
|
||||
void DBDeleteUndoAction::deleteDecal(const DecalInstance& decal)
|
||||
{
|
||||
mDecalInstanceVec.increment();
|
||||
mDecalInstanceVec.last() = decal;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public:
|
|||
DICreateUndoAction( const UTF8* actionName = "Create Decal " );
|
||||
virtual ~DICreateUndoAction();
|
||||
|
||||
void addDecal( DecalInstance decal );
|
||||
void addDecal(const DecalInstance& decal);
|
||||
|
||||
// UndoAction
|
||||
virtual void undo();
|
||||
|
|
@ -159,7 +159,7 @@ public:
|
|||
virtual ~DIDeleteUndoAction();
|
||||
|
||||
///
|
||||
void deleteDecal( DecalInstance decal );
|
||||
void deleteDecal(const DecalInstance& decal);
|
||||
|
||||
// UndoAction
|
||||
virtual void undo();
|
||||
|
|
@ -188,7 +188,7 @@ public:
|
|||
DBDeleteUndoAction( const UTF8* actionName = "Delete Decal Datablock" );
|
||||
virtual ~DBDeleteUndoAction();
|
||||
|
||||
void deleteDecal( DecalInstance decal );
|
||||
void deleteDecal(const DecalInstance& decal);
|
||||
|
||||
// UndoAction
|
||||
virtual void undo();
|
||||
|
|
|
|||
|
|
@ -357,9 +357,6 @@ GBitmap * GuiMissionAreaCtrl::createTerrainBitmap()
|
|||
|
||||
GBitmap * bitmap = new GBitmap(mTerrainBlock->getBlockSize(), mTerrainBlock->getBlockSize(), false, GFXFormatR8G8B8 );
|
||||
|
||||
if(!bitmap)
|
||||
return NULL;
|
||||
|
||||
// get the min/max
|
||||
F32 min, max;
|
||||
mTerrainBlock->getMinMaxHeight(&min, &max);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ template<class T> inline void Selection<T>::offset( const Point3F &delta )
|
|||
{
|
||||
typename Selection<T>::iterator itr = this->begin();
|
||||
|
||||
for ( ; itr != this->end(); itr++ )
|
||||
for (; itr != this->end(); ++itr)
|
||||
offsetObject( *itr, delta );
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ template<class T> inline void Selection<T>::rotate( const EulerF &delta )
|
|||
typename Selection<T>::iterator itr = this->begin();
|
||||
Point3F origin = getOrigin();
|
||||
|
||||
for ( ; itr != this->end(); itr++ )
|
||||
for (; itr != this->end(); ++itr)
|
||||
rotateObject( *itr, delta, origin );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1449,14 +1449,15 @@ void TerrainEditor::renderSelection( const Selection & sel, const ColorF & inCol
|
|||
// walk the points in the selection
|
||||
for(U32 i = 0; i < sel.size(); i++)
|
||||
{
|
||||
Point2I gPos = sel[i].mGridPoint.gridPos;
|
||||
GridPoint selectedGridPoint = sel[i].mGridPoint;
|
||||
Point2I gPos = selectedGridPoint.gridPos;
|
||||
|
||||
GFXVertexPC *verts = &(vertexBuffer[i * 5]);
|
||||
|
||||
bool center = gridToWorld(sel[i].mGridPoint, verts[0].point);
|
||||
gridToWorld(Point2I(gPos.x + 1, gPos.y), verts[1].point, sel[i].mGridPoint.terrainBlock);
|
||||
gridToWorld(Point2I(gPos.x + 1, gPos.y + 1), verts[2].point, sel[i].mGridPoint.terrainBlock);
|
||||
gridToWorld(Point2I(gPos.x, gPos.y + 1), verts[3].point, sel[i].mGridPoint.terrainBlock);
|
||||
bool center = gridToWorld(selectedGridPoint, verts[0].point);
|
||||
gridToWorld(Point2I(gPos.x + 1, gPos.y), verts[1].point, selectedGridPoint.terrainBlock);
|
||||
gridToWorld(Point2I(gPos.x + 1, gPos.y + 1), verts[2].point, selectedGridPoint.terrainBlock);
|
||||
gridToWorld(Point2I(gPos.x, gPos.y + 1), verts[3].point, selectedGridPoint.terrainBlock);
|
||||
verts[4].point = verts[0].point;
|
||||
|
||||
F32 weight = sel[i].mWeight;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@
|
|||
#include "console/simObjectMemento.h"
|
||||
#endif
|
||||
|
||||
class GuiInspectorField;
|
||||
// Need full definition visible for SimObjectPtr<GuiInspectorField>
|
||||
#include "gui/editor/inspector/field.h"
|
||||
|
||||
class GuiInspector;
|
||||
|
||||
class MECreateUndoAction : public UndoAction
|
||||
|
|
|
|||
|
|
@ -1631,10 +1631,11 @@ void WorldEditor::renderScreenObj( SceneObject *obj, const Point3F& projPos, con
|
|||
// Save an IconObject for performing icon-click testing later.
|
||||
|
||||
mIcons.increment();
|
||||
mIcons.last().object = obj;
|
||||
mIcons.last().rect = renderRect;
|
||||
mIcons.last().dist = projPos.z;
|
||||
mIcons.last().alpha = iconAlpha;
|
||||
IconObject& lastIcon = mIcons.last();
|
||||
lastIcon.object = obj;
|
||||
lastIcon.rect = renderRect;
|
||||
lastIcon.dist = projPos.z;
|
||||
lastIcon.alpha = iconAlpha;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue