mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Issue found with PVS-Studio:
Many instances of a function or expression being used repeatedly, which can lower performance. Fixed it in these cases by creating on local var, reference or pointer that's used instead.
This commit is contained in:
parent
ec63398042
commit
2002d74b78
|
|
@ -113,9 +113,11 @@ void GuiClockHud::initPersistFields()
|
|||
|
||||
void GuiClockHud::onRender(Point2I offset, const RectI &updateRect)
|
||||
{
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
// Background first
|
||||
if (mShowFill)
|
||||
GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor);
|
||||
drawUtil->drawRectFill(updateRect, mFillColor);
|
||||
|
||||
// Convert ms time into hours, minutes and seconds.
|
||||
S32 time = S32(getTime());
|
||||
|
|
@ -129,13 +131,13 @@ void GuiClockHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
// Center the text
|
||||
offset.x += (getWidth() - mProfile->mFont->getStrWidth((const UTF8 *)buf)) / 2;
|
||||
offset.y += (getHeight() - mProfile->mFont->getHeight()) / 2;
|
||||
GFX->getDrawUtil()->setBitmapModulation(mTextColor);
|
||||
GFX->getDrawUtil()->drawText(mProfile->mFont, offset, buf);
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
drawUtil->setBitmapModulation(mTextColor);
|
||||
drawUtil->drawText(mProfile->mFont, offset, buf);
|
||||
drawUtil->clearBitmapModulation();
|
||||
|
||||
// Border last
|
||||
if (mShowFrame)
|
||||
GFX->getDrawUtil()->drawRect(updateRect, mFrameColor);
|
||||
drawUtil->drawRect(updateRect, mFrameColor);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -162,10 +162,12 @@ void GuiHealthTextHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
else
|
||||
mValue = 100 - (100 * control->getDamageValue());
|
||||
}
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
// If enabled draw background first
|
||||
if (mShowFill)
|
||||
GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor);
|
||||
drawUtil->drawRectFill(updateRect, mFillColor);
|
||||
|
||||
// Prepare text and center it
|
||||
S32 val = (S32)mValue;
|
||||
|
|
@ -190,11 +192,11 @@ void GuiHealthTextHud::onRender(Point2I offset, const RectI &updateRect)
|
|||
}
|
||||
}
|
||||
|
||||
GFX->getDrawUtil()->setBitmapModulation(tColor);
|
||||
GFX->getDrawUtil()->drawText(mProfile->mFont, offset, buf);
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
drawUtil->setBitmapModulation(tColor);
|
||||
drawUtil->drawText(mProfile->mFont, offset, buf);
|
||||
drawUtil->clearBitmapModulation();
|
||||
|
||||
// If enabled draw the border last
|
||||
if (mShowFrame)
|
||||
GFX->getDrawUtil()->drawRect(updateRect, mFrameColor);
|
||||
drawUtil->drawRect(updateRect, mFrameColor);
|
||||
}
|
||||
|
|
@ -301,18 +301,20 @@ void GuiShapeNameHud::drawName(Point2I offset, const char *name, F32 opacity)
|
|||
offset.x -= width / 2;
|
||||
offset.y -= height / 2;
|
||||
|
||||
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
|
||||
|
||||
// Background fill first
|
||||
if (mShowLabelFill)
|
||||
GFX->getDrawUtil()->drawRectFill(RectI(offset, extent), mLabelFillColor);
|
||||
drawUtil->drawRectFill(RectI(offset, extent), mLabelFillColor);
|
||||
|
||||
// Deal with opacity and draw.
|
||||
mTextColor.alpha = opacity;
|
||||
GFX->getDrawUtil()->setBitmapModulation(mTextColor);
|
||||
GFX->getDrawUtil()->drawText(mProfile->mFont, offset + mLabelPadding, name);
|
||||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
drawUtil->setBitmapModulation(mTextColor);
|
||||
drawUtil->drawText(mProfile->mFont, offset + mLabelPadding, name);
|
||||
drawUtil->clearBitmapModulation();
|
||||
|
||||
// Border last
|
||||
if (mShowLabelFrame)
|
||||
GFX->getDrawUtil()->drawRect(RectI(offset, extent), mLabelFrameColor);
|
||||
drawUtil->drawRect(RectI(offset, extent), mLabelFrameColor);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1171,8 +1171,10 @@ DefineEngineMethod( TSStatic, changeMaterial, void, ( const char* mapTo, Materia
|
|||
return;
|
||||
}
|
||||
|
||||
TSMaterialList* shapeMaterialList = object->getShape()->materialList;
|
||||
|
||||
// Check the mapTo name exists for this shape
|
||||
S32 matIndex = object->getShape()->materialList->getMaterialNameList().find_next(String(mapTo));
|
||||
S32 matIndex = shapeMaterialList->getMaterialNameList().find_next(String(mapTo));
|
||||
if (matIndex < 0)
|
||||
{
|
||||
Con::errorf("TSShape::changeMaterial failed: Invalid mapTo name '%s'", mapTo);
|
||||
|
|
@ -1190,13 +1192,13 @@ DefineEngineMethod( TSStatic, changeMaterial, void, ( const char* mapTo, Materia
|
|||
|
||||
// Replace instances with the new material being traded in. Lets make sure that we only
|
||||
// target the specific targets per inst, this is actually doing more than we thought
|
||||
delete object->getShape()->materialList->mMatInstList[matIndex];
|
||||
object->getShape()->materialList->mMatInstList[matIndex] = newMat->createMatInstance();
|
||||
delete shapeMaterialList->mMatInstList[matIndex];
|
||||
shapeMaterialList->mMatInstList[matIndex] = newMat->createMatInstance();
|
||||
|
||||
// Finish up preparing the material instances for rendering
|
||||
const GFXVertexFormat *flags = getGFXVertexFormat<GFXVertexPNTTB>();
|
||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||
object->getShape()->materialList->getMaterialInst(matIndex)->init( features, flags );
|
||||
shapeMaterialList->getMaterialInst(matIndex)->init(features, flags);
|
||||
}
|
||||
|
||||
DefineEngineMethod( TSStatic, getModelFile, const char *, (),,
|
||||
|
|
|
|||
|
|
@ -637,12 +637,13 @@ void ScatterSky::prepRenderImage( SceneRenderState *state )
|
|||
return;
|
||||
|
||||
// Regular sky render instance.
|
||||
ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
|
||||
RenderPassManager* renderPass = state->getRenderPass();
|
||||
ObjectRenderInst *ri = renderPass->allocInst<ObjectRenderInst>();
|
||||
ri->renderDelegate.bind( this, &ScatterSky::_render );
|
||||
ri->type = RenderPassManager::RIT_Sky;
|
||||
ri->defaultKey = 10;
|
||||
ri->defaultKey2 = 0;
|
||||
state->getRenderPass()->addInst( ri );
|
||||
renderPass->addInst(ri);
|
||||
|
||||
// Debug render instance.
|
||||
/*
|
||||
|
|
@ -685,13 +686,13 @@ void ScatterSky::prepRenderImage( SceneRenderState *state )
|
|||
mMatrixSet->setSceneProjection(GFX->getProjectionMatrix());
|
||||
mMatrixSet->setWorld(GFX->getWorldMatrix());
|
||||
|
||||
ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
|
||||
ObjectRenderInst *ri = renderPass->allocInst<ObjectRenderInst>();
|
||||
ri->renderDelegate.bind( this, &ScatterSky::_renderMoon );
|
||||
ri->type = RenderPassManager::RIT_Sky;
|
||||
// Render after sky objects and before CloudLayer!
|
||||
ri->defaultKey = 5;
|
||||
ri->defaultKey2 = 0;
|
||||
state->getRenderPass()->addInst( ri );
|
||||
renderPass->addInst(ri);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -450,10 +450,11 @@ void ForestSelectionTool::onRender2D()
|
|||
F32 hscale = wwidth * 2 / F32(mEditor->getWidth());
|
||||
F32 vscale = wheight * 2 / F32(mEditor->getHeight());
|
||||
|
||||
F32 left = (mDragRect.point.x - mEditor->getPosition().x) * hscale - wwidth;
|
||||
F32 right = (mDragRect.point.x - mEditor->getPosition().x + mDragRect.extent.x) * hscale - wwidth;
|
||||
F32 top = wheight - vscale * (mDragRect.point.y - mEditor->getPosition().y);
|
||||
F32 bottom = wheight - vscale * (mDragRect.point.y - mEditor->getPosition().y + mDragRect.extent.y);
|
||||
Point2I editorPosition = mEditor->getPosition();
|
||||
F32 left = (mDragRect.point.x - editorPosition.x) * hscale - wwidth;
|
||||
F32 right = (mDragRect.point.x - editorPosition.x + mDragRect.extent.x) * hscale - wwidth;
|
||||
F32 top = wheight - vscale * (mDragRect.point.y - editorPosition.y);
|
||||
F32 bottom = wheight - vscale * (mDragRect.point.y - editorPosition.y + mDragRect.extent.y);
|
||||
gDragFrustum.set(lastCameraQuery.ortho, left, right, top, bottom, lastCameraQuery.nearPlane, lastCameraQuery.farPlane, lastCameraQuery.cameraMatrix );
|
||||
|
||||
mForest->getData()->getItems( gDragFrustum, &mDragSelection );
|
||||
|
|
|
|||
|
|
@ -918,17 +918,18 @@ void GFont::importStrip(const char *fileName, U32 padding, U32 kerning)
|
|||
|
||||
// Allocate a new bitmap for this glyph, taking into account kerning and padding.
|
||||
glyphList.increment();
|
||||
glyphList.last().bitmap = new GBitmap(mCharInfoList[i].width + kerning + 2*padding, mCharInfoList[i].height + 2*padding, false, strip->getFormat());
|
||||
glyphList.last().charId = i;
|
||||
GlyphMap& lastGlyphMap = glyphList.last();
|
||||
lastGlyphMap.bitmap = new GBitmap(mCharInfoList[i].width + kerning + 2 * padding, mCharInfoList[i].height + 2 * padding, false, strip->getFormat());
|
||||
lastGlyphMap.charId = i;
|
||||
|
||||
// Copy the rect.
|
||||
RectI ri(curWidth, getBaseline() - mCharInfoList[i].yOrigin, glyphList.last().bitmap->getWidth(), glyphList.last().bitmap->getHeight());
|
||||
RectI ri(curWidth, getBaseline() - mCharInfoList[i].yOrigin, lastGlyphMap.bitmap->getWidth(), lastGlyphMap.bitmap->getHeight());
|
||||
Point2I outRi(0,0);
|
||||
glyphList.last().bitmap->copyRect(strip, ri, outRi);
|
||||
lastGlyphMap.bitmap->copyRect(strip, ri, outRi);
|
||||
|
||||
// Update glyph attributes.
|
||||
mCharInfoList[i].width = glyphList.last().bitmap->getWidth();
|
||||
mCharInfoList[i].height = glyphList.last().bitmap->getHeight();
|
||||
mCharInfoList[i].width = lastGlyphMap.bitmap->getWidth();
|
||||
mCharInfoList[i].height = lastGlyphMap.bitmap->getHeight();
|
||||
mCharInfoList[i].xOffset -= kerning + padding;
|
||||
mCharInfoList[i].xIncrement += kerning;
|
||||
mCharInfoList[i].yOffset -= padding;
|
||||
|
|
|
|||
|
|
@ -1041,7 +1041,8 @@ void GFXTextureManager::_validateTexParams( const U32 width, const U32 height,
|
|||
}
|
||||
|
||||
// inOutFormat is not modified by this method
|
||||
bool chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
|
||||
GFXCardProfiler* cardProfiler = GFX->getCardProfiler();
|
||||
bool chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
|
||||
|
||||
if( !chekFmt )
|
||||
{
|
||||
|
|
@ -1057,16 +1058,16 @@ void GFXTextureManager::_validateTexParams( const U32 width, const U32 height,
|
|||
{
|
||||
case GFXFormatR8G8B8:
|
||||
testingFormat = GFXFormatR8G8B8X8;
|
||||
chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
|
||||
chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
|
||||
break;
|
||||
|
||||
case GFXFormatA8:
|
||||
testingFormat = GFXFormatR8G8B8A8;
|
||||
chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
|
||||
chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
|
||||
break;
|
||||
|
||||
default:
|
||||
chekFmt = GFX->getCardProfiler()->checkFormat( testingFormat, profile, autoGenSupp );
|
||||
chekFmt = cardProfiler->checkFormat(testingFormat, profile, autoGenSupp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,10 +114,11 @@ void GFXVertexFormat::addElement( const String& semantic, GFXDeclType type, U32
|
|||
{
|
||||
mDirty = true;
|
||||
mElements.increment();
|
||||
mElements.last().mStreamIndex = stream;
|
||||
mElements.last().mSemantic = semantic.intern();
|
||||
mElements.last().mSemanticIndex = index;
|
||||
mElements.last().mType = type;
|
||||
GFXVertexElement& lastElement = mElements.last();
|
||||
lastElement.mStreamIndex = stream;
|
||||
lastElement.mSemantic = semantic.intern();
|
||||
lastElement.mSemanticIndex = index;
|
||||
lastElement.mType = type;
|
||||
}
|
||||
|
||||
const String& GFXVertexFormat::getDescription() const
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -1278,12 +1278,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)
|
||||
|
|
@ -1327,20 +1328,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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -683,9 +686,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 +699,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 +1547,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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1012,13 +1012,14 @@ void SceneLighting::processCache()
|
|||
// go through and remove the best candidate first (sorted reverse)
|
||||
while(((curCacheSize >> 10) > quota) && files.size())
|
||||
{
|
||||
curCacheSize -= files.last().mFileObject->getSize();
|
||||
CacheEntry& lastFile = files.last();
|
||||
curCacheSize -= lastFile.mFileObject->getSize();
|
||||
|
||||
// no sneaky names
|
||||
if(!dStrstr(files.last().mFileName, ".."))
|
||||
if (!dStrstr(lastFile.mFileName, ".."))
|
||||
{
|
||||
Con::warnf("Removing lighting file '%s'.", files.last().mFileName);
|
||||
dFileDelete(files.last().mFileName);
|
||||
Con::warnf("Removing lighting file '%s'.", lastFile.mFileName);
|
||||
dFileDelete(lastFile.mFileName);
|
||||
}
|
||||
|
||||
files.pop_back();
|
||||
|
|
|
|||
|
|
@ -811,14 +811,16 @@ void PostEffect::_setupConstants( const SceneRenderState *state )
|
|||
lightDir.y * (6378.0f * 1000.0f),
|
||||
lightDir.z * (6378.0f * 1000.0f) );
|
||||
|
||||
RectI viewPort = GFX->getViewport();
|
||||
|
||||
// Get the screen space sun position.
|
||||
MathUtils::mProjectWorldToScreen( lightPos, &sunPos, GFX->getViewport(), tmp, proj );
|
||||
MathUtils::mProjectWorldToScreen(lightPos, &sunPos, viewPort, tmp, proj);
|
||||
|
||||
// And normalize it to the 0 to 1 range.
|
||||
sunPos.x -= (F32)GFX->getViewport().point.x;
|
||||
sunPos.y -= (F32)GFX->getViewport().point.y;
|
||||
sunPos.x /= (F32)GFX->getViewport().extent.x;
|
||||
sunPos.y /= (F32)GFX->getViewport().extent.y;
|
||||
sunPos.x -= (F32)viewPort.point.x;
|
||||
sunPos.y -= (F32)viewPort.point.y;
|
||||
sunPos.x /= (F32)viewPort.extent.x;
|
||||
sunPos.y /= (F32)viewPort.extent.y;
|
||||
|
||||
mShaderConsts->set( mScreenSunPosSC, Point2F( sunPos.x, sunPos.y ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -815,8 +815,10 @@ bool SceneCullingState::isOccludedByTerrain( SceneObject* object ) const
|
|||
if( !terrain )
|
||||
continue;
|
||||
|
||||
MatrixF terrWorldTransform = terrain->getWorldTransform();
|
||||
|
||||
Point3F localCamPos = getCameraState().getViewPosition();
|
||||
terrain->getWorldTransform().mulP( localCamPos );
|
||||
terrWorldTransform.mulP(localCamPos);
|
||||
F32 height;
|
||||
terrain->getHeight( Point2F( localCamPos.x, localCamPos.y ), &height );
|
||||
bool aboveTerrain = ( height <= localCamPos.z );
|
||||
|
|
@ -837,10 +839,10 @@ bool SceneCullingState::isOccludedByTerrain( SceneObject* object ) const
|
|||
Point3F ll(rBox.maxExtents.x, rBox.minExtents.y, rBox.maxExtents.z);
|
||||
Point3F lr(rBox.maxExtents.x, rBox.maxExtents.y, rBox.maxExtents.z);
|
||||
|
||||
terrain->getWorldTransform().mulP(ul);
|
||||
terrain->getWorldTransform().mulP(ur);
|
||||
terrain->getWorldTransform().mulP(ll);
|
||||
terrain->getWorldTransform().mulP(lr);
|
||||
terrWorldTransform.mulP(ul);
|
||||
terrWorldTransform.mulP(ur);
|
||||
terrWorldTransform.mulP(ll);
|
||||
terrWorldTransform.mulP(lr);
|
||||
|
||||
Point3F xBaseL0_s = ul - localCamPos;
|
||||
Point3F xBaseL0_e = lr - localCamPos;
|
||||
|
|
|
|||
|
|
@ -1353,15 +1353,16 @@ F32 SceneContainer::containerSearchCurrRadiusDist()
|
|||
return 0.0;
|
||||
|
||||
Point3F pos;
|
||||
(*mSearchList[mCurrSearchPos])->getWorldBox().getCenter(&pos);
|
||||
Box3F worldBox = (*mSearchList[mCurrSearchPos])->getWorldBox();
|
||||
worldBox.getCenter(&pos);
|
||||
|
||||
F32 dist = (pos - mSearchReferencePoint).len();
|
||||
|
||||
F32 min = (*mSearchList[mCurrSearchPos])->getWorldBox().len_x();
|
||||
if ((*mSearchList[mCurrSearchPos])->getWorldBox().len_y() < min)
|
||||
min = (*mSearchList[mCurrSearchPos])->getWorldBox().len_y();
|
||||
if ((*mSearchList[mCurrSearchPos])->getWorldBox().len_z() < min)
|
||||
min = (*mSearchList[mCurrSearchPos])->getWorldBox().len_z();
|
||||
F32 min = worldBox.len_x();
|
||||
if (worldBox.len_y() < min)
|
||||
min = worldBox.len_y();
|
||||
if (worldBox.len_z() < min)
|
||||
min = worldBox.len_z();
|
||||
|
||||
dist -= min;
|
||||
if (dist < 0)
|
||||
|
|
|
|||
|
|
@ -279,10 +279,11 @@ void TerrainConvex::getFeatures(const MatrixF& mat,const VectorF& n, ConvexFeatu
|
|||
cf->mFaceList.increment(numFaces);
|
||||
for (i = 0; i < numFaces; i++)
|
||||
{
|
||||
cf->mFaceList[faceListStart + i].normal = normal[fp[i * 4 + 0]];
|
||||
cf->mFaceList[faceListStart + i].vertex[0] = vertexCount + fp[i * 4 + 1];
|
||||
cf->mFaceList[faceListStart + i].vertex[1] = vertexCount + fp[i * 4 + 2];
|
||||
cf->mFaceList[faceListStart + i].vertex[2] = vertexCount + fp[i * 4 + 3];
|
||||
ConvexFeature::Face& face = cf->mFaceList[faceListStart + i];
|
||||
face.normal = normal[fp[i * 4 + 0]];
|
||||
face.vertex[0] = vertexCount + fp[i * 4 + 1];
|
||||
face.vertex[1] = vertexCount + fp[i * 4 + 2];
|
||||
face.vertex[2] = vertexCount + fp[i * 4 + 3];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -283,11 +283,12 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu
|
|||
|
||||
// Create the 3space node
|
||||
shape->nodes.increment();
|
||||
shape->nodes.last().nameIndex = shape->addName(nodeName);
|
||||
shape->nodes.last().parentIndex = parentIndex;
|
||||
shape->nodes.last().firstObject = -1;
|
||||
shape->nodes.last().firstChild = -1;
|
||||
shape->nodes.last().nextSibling = -1;
|
||||
TSShape::Node& lastNode = shape->nodes.last();
|
||||
lastNode.nameIndex = shape->addName(nodeName);
|
||||
lastNode.parentIndex = parentIndex;
|
||||
lastNode.firstObject = -1;
|
||||
lastNode.firstChild = -1;
|
||||
lastNode.nextSibling = -1;
|
||||
|
||||
// Add the AppNode to a matching list (so AppNodes can be accessed using 3space
|
||||
// node indices)
|
||||
|
|
@ -323,12 +324,14 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu
|
|||
appNode->getBool("BB::INCLUDE_POLES", includePoles);
|
||||
|
||||
S32 detIndex = shape->addDetail( "bbDetail", size, -1 );
|
||||
shape->details[detIndex].bbEquatorSteps = numEquatorSteps;
|
||||
shape->details[detIndex].bbPolarSteps = numPolarSteps;
|
||||
shape->details[detIndex].bbDetailLevel = dl;
|
||||
shape->details[detIndex].bbDimension = dim;
|
||||
shape->details[detIndex].bbIncludePoles = includePoles;
|
||||
shape->details[detIndex].bbPolarAngle = polarAngle;
|
||||
|
||||
TSShape::Detail& detIndexDetail = shape->details[detIndex];
|
||||
detIndexDetail.bbEquatorSteps = numEquatorSteps;
|
||||
detIndexDetail.bbPolarSteps = numPolarSteps;
|
||||
detIndexDetail.bbDetailLevel = dl;
|
||||
detIndexDetail.bbDimension = dim;
|
||||
detIndexDetail.bbIncludePoles = includePoles;
|
||||
detIndexDetail.bbPolarAngle = polarAngle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -462,10 +465,11 @@ void TSShapeLoader::generateObjects()
|
|||
if (!lastName || (meshNames[iMesh] != *lastName))
|
||||
{
|
||||
shape->objects.increment();
|
||||
shape->objects.last().nameIndex = shape->addName(meshNames[iMesh]);
|
||||
shape->objects.last().nodeIndex = subshape->objNodes[iMesh];
|
||||
shape->objects.last().startMeshIndex = appMeshes.size();
|
||||
shape->objects.last().numMeshes = 0;
|
||||
TSShape::Object& lastObject = shape->objects.last();
|
||||
lastObject.nameIndex = shape->addName(meshNames[iMesh]);
|
||||
lastObject.nodeIndex = subshape->objNodes[iMesh];
|
||||
lastObject.startMeshIndex = appMeshes.size();
|
||||
lastObject.numMeshes = 0;
|
||||
lastName = &meshNames[iMesh];
|
||||
}
|
||||
|
||||
|
|
@ -1190,10 +1194,12 @@ void TSShapeLoader::install()
|
|||
shape->meshes.push_back(NULL);
|
||||
|
||||
shape->objects.increment();
|
||||
shape->objects.last().nameIndex = shape->addName("dummy");
|
||||
shape->objects.last().nodeIndex = 0;
|
||||
shape->objects.last().startMeshIndex = 0;
|
||||
shape->objects.last().numMeshes = 1;
|
||||
|
||||
TSShape::Object& lastObject = shape->objects.last();
|
||||
lastObject.nameIndex = shape->addName("dummy");
|
||||
lastObject.nodeIndex = 0;
|
||||
lastObject.startMeshIndex = 0;
|
||||
lastObject.numMeshes = 1;
|
||||
|
||||
shape->objectStates.increment();
|
||||
shape->objectStates.last().frameIndex = 0;
|
||||
|
|
|
|||
|
|
@ -88,16 +88,18 @@ void TSShapeInstance::animateNodes(S32 ss)
|
|||
{
|
||||
TSThread * th = mThreadList[i];
|
||||
|
||||
if (th->getSequence()->isBlend())
|
||||
const TSShape::Sequence* threadSequence = th->getSequence();
|
||||
|
||||
if (threadSequence->isBlend())
|
||||
{
|
||||
// blend sequences need default (if not set by other sequence)
|
||||
// break rather than continue because the rest will be blends too
|
||||
firstBlend = i;
|
||||
break;
|
||||
}
|
||||
rotBeenSet.takeAway(th->getSequence()->rotationMatters);
|
||||
tranBeenSet.takeAway(th->getSequence()->translationMatters);
|
||||
scaleBeenSet.takeAway(th->getSequence()->scaleMatters);
|
||||
rotBeenSet.takeAway(threadSequence->rotationMatters);
|
||||
tranBeenSet.takeAway(threadSequence->translationMatters);
|
||||
scaleBeenSet.takeAway(threadSequence->scaleMatters);
|
||||
}
|
||||
rotBeenSet.takeAway(mCallbackNodes);
|
||||
rotBeenSet.takeAway(mHandsOffNodes);
|
||||
|
|
@ -576,9 +578,12 @@ void TSShapeInstance::handleBlendSequence(TSThread * thread, S32 a, S32 b)
|
|||
S32 jrot=0;
|
||||
S32 jtrans=0;
|
||||
S32 jscale=0;
|
||||
TSIntegerSet nodeMatters = thread->getSequence()->translationMatters;
|
||||
nodeMatters.overlap(thread->getSequence()->rotationMatters);
|
||||
nodeMatters.overlap(thread->getSequence()->scaleMatters);
|
||||
|
||||
const TSShape::Sequence* threadSequence = thread->getSequence();
|
||||
|
||||
TSIntegerSet nodeMatters = threadSequence->translationMatters;
|
||||
nodeMatters.overlap(threadSequence->rotationMatters);
|
||||
nodeMatters.overlap(threadSequence->scaleMatters);
|
||||
nodeMatters.takeAway(mHandsOffNodes);
|
||||
S32 start = nodeMatters.start();
|
||||
S32 end = b;
|
||||
|
|
@ -587,50 +592,50 @@ void TSShapeInstance::handleBlendSequence(TSThread * thread, S32 a, S32 b)
|
|||
// skip nodes outside of this detail
|
||||
if (start<a || mDisableBlendNodes.test(nodeIndex))
|
||||
{
|
||||
if (thread->getSequence()->rotationMatters.test(nodeIndex))
|
||||
if (threadSequence->rotationMatters.test(nodeIndex))
|
||||
jrot++;
|
||||
if (thread->getSequence()->translationMatters.test(nodeIndex))
|
||||
if (threadSequence->translationMatters.test(nodeIndex))
|
||||
jtrans++;
|
||||
if (thread->getSequence()->scaleMatters.test(nodeIndex))
|
||||
if (threadSequence->scaleMatters.test(nodeIndex))
|
||||
jscale++;
|
||||
continue;
|
||||
}
|
||||
|
||||
MatrixF mat(true);
|
||||
if (thread->getSequence()->rotationMatters.test(nodeIndex))
|
||||
if (threadSequence->rotationMatters.test(nodeIndex))
|
||||
{
|
||||
QuatF q1,q2;
|
||||
mShape->getRotation(*thread->getSequence(),thread->keyNum1,jrot,&q1);
|
||||
mShape->getRotation(*thread->getSequence(),thread->keyNum2,jrot,&q2);
|
||||
mShape->getRotation(*threadSequence,thread->keyNum1,jrot,&q1);
|
||||
mShape->getRotation(*threadSequence,thread->keyNum2,jrot,&q2);
|
||||
QuatF quat;
|
||||
TSTransform::interpolate(q1,q2,thread->keyPos,&quat);
|
||||
TSTransform::setMatrix(quat,&mat);
|
||||
jrot++;
|
||||
}
|
||||
|
||||
if (thread->getSequence()->translationMatters.test(nodeIndex))
|
||||
if (threadSequence->translationMatters.test(nodeIndex))
|
||||
{
|
||||
const Point3F & p1 = mShape->getTranslation(*thread->getSequence(),thread->keyNum1,jtrans);
|
||||
const Point3F & p2 = mShape->getTranslation(*thread->getSequence(),thread->keyNum2,jtrans);
|
||||
const Point3F & p1 = mShape->getTranslation(*threadSequence,thread->keyNum1,jtrans);
|
||||
const Point3F & p2 = mShape->getTranslation(*threadSequence,thread->keyNum2,jtrans);
|
||||
Point3F p;
|
||||
TSTransform::interpolate(p1,p2,thread->keyPos,&p);
|
||||
mat.setColumn(3,p);
|
||||
jtrans++;
|
||||
}
|
||||
|
||||
if (thread->getSequence()->scaleMatters.test(nodeIndex))
|
||||
if (threadSequence->scaleMatters.test(nodeIndex))
|
||||
{
|
||||
if (thread->getSequence()->animatesUniformScale())
|
||||
if (threadSequence->animatesUniformScale())
|
||||
{
|
||||
F32 s1 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum1,jscale);
|
||||
F32 s2 = mShape->getUniformScale(*thread->getSequence(),thread->keyNum2,jscale);
|
||||
F32 s1 = mShape->getUniformScale(*threadSequence,thread->keyNum1,jscale);
|
||||
F32 s2 = mShape->getUniformScale(*threadSequence,thread->keyNum2,jscale);
|
||||
F32 scale = TSTransform::interpolate(s1,s2,thread->keyPos);
|
||||
TSTransform::applyScale(scale,&mat);
|
||||
}
|
||||
else if (animatesAlignedScale())
|
||||
{
|
||||
Point3F s1 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum1,jscale);
|
||||
Point3F s2 = mShape->getAlignedScale(*thread->getSequence(),thread->keyNum2,jscale);
|
||||
Point3F s1 = mShape->getAlignedScale(*threadSequence,thread->keyNum1,jscale);
|
||||
Point3F s2 = mShape->getAlignedScale(*threadSequence,thread->keyNum2,jscale);
|
||||
Point3F scale;
|
||||
TSTransform::interpolate(s1,s2,thread->keyPos,&scale);
|
||||
TSTransform::applyScale(scale,&mat);
|
||||
|
|
@ -638,8 +643,8 @@ void TSShapeInstance::handleBlendSequence(TSThread * thread, S32 a, S32 b)
|
|||
else
|
||||
{
|
||||
TSScale s1,s2;
|
||||
mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum1,jscale,&s1);
|
||||
mShape->getArbitraryScale(*thread->getSequence(),thread->keyNum2,jscale,&s2);
|
||||
mShape->getArbitraryScale(*threadSequence,thread->keyNum1,jscale,&s1);
|
||||
mShape->getArbitraryScale(*threadSequence,thread->keyNum2,jscale,&s2);
|
||||
TSScale scale;
|
||||
TSTransform::interpolate(s1,s2,thread->keyPos,&scale);
|
||||
TSTransform::applyScale(scale,&mat);
|
||||
|
|
@ -686,15 +691,17 @@ void TSShapeInstance::animateVisibility(S32 ss)
|
|||
{
|
||||
TSThread * th = mThreadList[i];
|
||||
|
||||
const TSShape::Sequence* threadSequence = th->getSequence();
|
||||
|
||||
// For better or worse, object states are stored together (frame,
|
||||
// matFrame, visibility all in one structure). Thus, indexing into
|
||||
// object state array for animation for any of these attributes needs to
|
||||
// take into account whether or not the other attributes are also animated.
|
||||
// The object states should eventually be separated (like the node states were)
|
||||
// in order to save memory and save the following step.
|
||||
TSIntegerSet objectMatters = th->getSequence()->frameMatters;
|
||||
objectMatters.overlap(th->getSequence()->matFrameMatters);
|
||||
objectMatters.overlap(th->getSequence()->visMatters);
|
||||
TSIntegerSet objectMatters = threadSequence->frameMatters;
|
||||
objectMatters.overlap(threadSequence->matFrameMatters);
|
||||
objectMatters.overlap(threadSequence->visMatters);
|
||||
|
||||
// skip to beginning of this sub-shape
|
||||
S32 j=0;
|
||||
|
|
@ -702,10 +709,10 @@ void TSShapeInstance::animateVisibility(S32 ss)
|
|||
S32 end = b;
|
||||
for (S32 objectIndex = start; objectIndex<end; objectMatters.next(objectIndex), j++)
|
||||
{
|
||||
if (!beenSet.test(objectIndex) && th->getSequence()->visMatters.test(objectIndex))
|
||||
if (!beenSet.test(objectIndex) && threadSequence->visMatters.test(objectIndex))
|
||||
{
|
||||
F32 state1 = mShape->getObjectState(*th->getSequence(),th->keyNum1,j).vis;
|
||||
F32 state2 = mShape->getObjectState(*th->getSequence(),th->keyNum2,j).vis;
|
||||
F32 state1 = mShape->getObjectState(*threadSequence,th->keyNum1,j).vis;
|
||||
F32 state2 = mShape->getObjectState(*threadSequence,th->keyNum2,j).vis;
|
||||
if ((state1-state2) * (state1-state2) > 0.99f)
|
||||
// goes from 0 to 1 -- discreet jump
|
||||
mMeshObjects[objectIndex].visible = th->keyPos<0.5f ? state1 : state2;
|
||||
|
|
@ -747,15 +754,17 @@ void TSShapeInstance::animateFrame(S32 ss)
|
|||
{
|
||||
TSThread * th = mThreadList[i];
|
||||
|
||||
const TSShape::Sequence* threadSequence = th->getSequence();
|
||||
|
||||
// For better or worse, object states are stored together (frame,
|
||||
// matFrame, visibility all in one structure). Thus, indexing into
|
||||
// object state array for animation for any of these attributes needs to
|
||||
// take into account whether or not the other attributes are also animated.
|
||||
// The object states should eventually be separated (like the node states were)
|
||||
// in order to save memory and save the following step.
|
||||
TSIntegerSet objectMatters = th->getSequence()->frameMatters;
|
||||
objectMatters.overlap(th->getSequence()->matFrameMatters);
|
||||
objectMatters.overlap(th->getSequence()->visMatters);
|
||||
TSIntegerSet objectMatters = threadSequence->frameMatters;
|
||||
objectMatters.overlap(threadSequence->matFrameMatters);
|
||||
objectMatters.overlap(threadSequence->visMatters);
|
||||
|
||||
// skip to beginning of this sub-shape
|
||||
S32 j=0;
|
||||
|
|
@ -763,10 +772,10 @@ void TSShapeInstance::animateFrame(S32 ss)
|
|||
S32 end = b;
|
||||
for (S32 objectIndex = start; objectIndex<end; objectMatters.next(objectIndex), j++)
|
||||
{
|
||||
if (!beenSet.test(objectIndex) && th->getSequence()->frameMatters.test(objectIndex))
|
||||
if (!beenSet.test(objectIndex) && threadSequence->frameMatters.test(objectIndex))
|
||||
{
|
||||
S32 key = (th->keyPos<0.5f) ? th->keyNum1 : th->keyNum2;
|
||||
mMeshObjects[objectIndex].frame = mShape->getObjectState(*th->getSequence(),key,j).frameIndex;
|
||||
mMeshObjects[objectIndex].frame = mShape->getObjectState(*threadSequence,key,j).frameIndex;
|
||||
|
||||
// record change so that later threads don't over-write us...
|
||||
beenSet.set(objectIndex);
|
||||
|
|
@ -802,15 +811,17 @@ void TSShapeInstance::animateMatFrame(S32 ss)
|
|||
{
|
||||
TSThread * th = mThreadList[i];
|
||||
|
||||
const TSShape::Sequence* threadSequence = th->getSequence();
|
||||
|
||||
// For better or worse, object states are stored together (frame,
|
||||
// matFrame, visibility all in one structure). Thus, indexing into
|
||||
// object state array for animation for any of these attributes needs to
|
||||
// take into account whether or not the other attributes are also animated.
|
||||
// The object states should eventually be separated (like the node states were)
|
||||
// in order to save memory and save the following step.
|
||||
TSIntegerSet objectMatters = th->getSequence()->frameMatters;
|
||||
objectMatters.overlap(th->getSequence()->matFrameMatters);
|
||||
objectMatters.overlap(th->getSequence()->visMatters);
|
||||
TSIntegerSet objectMatters = threadSequence->frameMatters;
|
||||
objectMatters.overlap(threadSequence->matFrameMatters);
|
||||
objectMatters.overlap(threadSequence->visMatters);
|
||||
|
||||
// skip to beginining of this sub-shape
|
||||
S32 j=0;
|
||||
|
|
@ -818,10 +829,10 @@ void TSShapeInstance::animateMatFrame(S32 ss)
|
|||
S32 end = b;
|
||||
for (S32 objectIndex = start; objectIndex<end; objectMatters.next(objectIndex), j++)
|
||||
{
|
||||
if (!beenSet.test(objectIndex) && th->getSequence()->matFrameMatters.test(objectIndex))
|
||||
if (!beenSet.test(objectIndex) && threadSequence->matFrameMatters.test(objectIndex))
|
||||
{
|
||||
S32 key = (th->keyPos<0.5f) ? th->keyNum1 : th->keyNum2;
|
||||
mMeshObjects[objectIndex].matFrame = mShape->getObjectState(*th->getSequence(),key,j).matFrameIndex;
|
||||
mMeshObjects[objectIndex].matFrame = mShape->getObjectState(*threadSequence,key,j).matFrameIndex;
|
||||
|
||||
// record change so that later threads don't over-write us...
|
||||
beenSet.set(objectIndex);
|
||||
|
|
|
|||
|
|
@ -171,19 +171,21 @@ void TSShapeInstance::dump(Stream & stream)
|
|||
bool foundSkin = false;
|
||||
for (i=0; i<mShape->objects.size(); i++)
|
||||
{
|
||||
if (mShape->objects[i].nodeIndex<0) // must be a skin
|
||||
TSShape::Object& currentObject = mShape->objects[i];
|
||||
|
||||
if (currentObject.nodeIndex<0) // must be a skin
|
||||
{
|
||||
if (!foundSkin)
|
||||
dumpLine("\r\n Skins:\r\n");
|
||||
foundSkin=true;
|
||||
const char * skinName = "";
|
||||
S32 nameIndex = mShape->objects[i].nameIndex;
|
||||
S32 nameIndex = currentObject.nameIndex;
|
||||
if (nameIndex>=0)
|
||||
skinName = mShape->getName(nameIndex);
|
||||
dumpLine(avar(" Skin %s with following details: ",skinName));
|
||||
for (S32 num=0; num<mShape->objects[i].numMeshes; num++)
|
||||
for (S32 num=0; num<currentObject.numMeshes; num++)
|
||||
{
|
||||
if (mShape->meshes[mShape->objects[i].startMeshIndex + num])
|
||||
if (mShape->meshes[currentObject.startMeshIndex + num])
|
||||
dumpLine(avar(" %i",(S32)mShape->details[num].size));
|
||||
}
|
||||
dumpLine("\r\n");
|
||||
|
|
|
|||
|
|
@ -447,11 +447,13 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF
|
|||
cf->mVertexList[base + indices[start + j + 2]]);
|
||||
|
||||
cf->mFaceList.increment();
|
||||
cf->mFaceList.last().normal = plane;
|
||||
|
||||
cf->mFaceList.last().vertex[0] = base + indices[start + j + 0];
|
||||
cf->mFaceList.last().vertex[1] = base + indices[start + j + 1];
|
||||
cf->mFaceList.last().vertex[2] = base + indices[start + j + 2];
|
||||
ConvexFeature::Face& lastFace = cf->mFaceList.last();
|
||||
lastFace.normal = plane;
|
||||
|
||||
lastFace.vertex[0] = base + indices[start + j + 0];
|
||||
lastFace.vertex[1] = base + indices[start + j + 1];
|
||||
lastFace.vertex[2] = base + indices[start + j + 2];
|
||||
|
||||
for ( U32 l = 0; l < 3; l++ )
|
||||
{
|
||||
|
|
@ -514,8 +516,9 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF
|
|||
S32 k;
|
||||
for ( k = 0; k < cf->mEdgeList.size(); k++ )
|
||||
{
|
||||
if ( cf->mEdgeList[k].vertex[0] == newEdge0 &&
|
||||
cf->mEdgeList[k].vertex[1] == newEdge1)
|
||||
ConvexFeature::Edge currentEdge = cf->mEdgeList[k];
|
||||
if (currentEdge.vertex[0] == newEdge0 &&
|
||||
currentEdge.vertex[1] == newEdge1)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
|
|
@ -1437,10 +1440,12 @@ void TSSkinMesh::createBatchData()
|
|||
}
|
||||
|
||||
bt->_tmpVec->increment();
|
||||
bt->_tmpVec->last().vert = batchData.initialVerts[curTransform.vertexIndex];
|
||||
bt->_tmpVec->last().normal = batchData.initialNorms[curTransform.vertexIndex];
|
||||
bt->_tmpVec->last().weight = transformOp.weight;
|
||||
bt->_tmpVec->last().vidx = curTransform.vertexIndex;
|
||||
|
||||
BatchData::BatchedVertWeight& tempLast = bt->_tmpVec->last();
|
||||
tempLast.vert = batchData.initialVerts[curTransform.vertexIndex];
|
||||
tempLast.normal = batchData.initialNorms[curTransform.vertexIndex];
|
||||
tempLast.weight = transformOp.weight;
|
||||
tempLast.vidx = curTransform.vertexIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -443,10 +443,11 @@ void MeshFit::addSphere( F32 radius, const Point3F& center )
|
|||
mesh->computeBounds();
|
||||
|
||||
mMeshes.increment();
|
||||
mMeshes.last().type = MeshFit::Sphere;
|
||||
mMeshes.last().transform.identity();
|
||||
mMeshes.last().transform.setPosition( center );
|
||||
mMeshes.last().tsmesh = mesh;
|
||||
MeshFit::Mesh& lastMesh = mMeshes.last();
|
||||
lastMesh.type = MeshFit::Sphere;
|
||||
lastMesh.transform.identity();
|
||||
lastMesh.transform.setPosition(center);
|
||||
lastMesh.tsmesh = mesh;
|
||||
}
|
||||
|
||||
void MeshFit::fitSphere()
|
||||
|
|
@ -603,11 +604,12 @@ void MeshFit::fitK_DOP( const Vector<Point3F>& planes )
|
|||
|
||||
// Create TSMesh from convex hull
|
||||
mMeshes.increment();
|
||||
mMeshes.last().type = MeshFit::Hull;
|
||||
mMeshes.last().transform.identity();
|
||||
mMeshes.last().tsmesh = createTriMesh( result.mOutputVertices, result.mNumOutputVertices,
|
||||
MeshFit::Mesh& lastMesh = mMeshes.last();
|
||||
lastMesh.type = MeshFit::Hull;
|
||||
lastMesh.transform.identity();
|
||||
lastMesh.tsmesh = createTriMesh(result.mOutputVertices, result.mNumOutputVertices,
|
||||
result.mIndices, result.mNumFaces );
|
||||
mMeshes.last().tsmesh->computeBounds();
|
||||
lastMesh.tsmesh->computeBounds();
|
||||
}
|
||||
|
||||
//---------------------------
|
||||
|
|
@ -702,10 +704,11 @@ void MeshFit::fitConvexHulls( U32 depth, F32 mergeThreshold, F32 concavityThresh
|
|||
{
|
||||
// Create TSMesh from convex hull
|
||||
mMeshes.increment();
|
||||
mMeshes.last().type = MeshFit::Hull;
|
||||
mMeshes.last().transform.identity();
|
||||
mMeshes.last().tsmesh = createTriMesh( result.mVertices, result.mVcount, result.mIndices, result.mTcount );
|
||||
mMeshes.last().tsmesh->computeBounds();
|
||||
MeshFit::Mesh& lastMesh = mMeshes.last();
|
||||
lastMesh.type = MeshFit::Hull;
|
||||
lastMesh.transform.identity();
|
||||
lastMesh.tsmesh = createTriMesh(result.mVertices, result.mVcount, result.mIndices, result.mTcount);
|
||||
lastMesh.tsmesh->computeBounds();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -286,13 +286,15 @@ void TSThread::activateTriggers(F32 a, F32 b)
|
|||
S32 bIndex = numTriggers+firstTrigger; // initialized to handle case where pos past all triggers
|
||||
for (i=firstTrigger; i<numTriggers+firstTrigger; i++)
|
||||
{
|
||||
TSShape::Trigger currentTrigger = shape->triggers[i];
|
||||
|
||||
// is a between this trigger and previous one...
|
||||
if (a>lastPos && a<=shape->triggers[i].pos)
|
||||
if (a>lastPos && a <= currentTrigger.pos)
|
||||
aIndex = i;
|
||||
// is b between this trigger and previous one...
|
||||
if (b>lastPos && b<=shape->triggers[i].pos)
|
||||
if (b>lastPos && b <= currentTrigger.pos)
|
||||
bIndex = i;
|
||||
lastPos = shape->triggers[i].pos;
|
||||
lastPos = currentTrigger.pos;
|
||||
}
|
||||
|
||||
// activate triggers between aIndex and bIndex (depends on direction)
|
||||
|
|
@ -578,19 +580,21 @@ void TSShapeInstance::transitionToSequence(TSThread * thread, S32 seq, F32 pos,
|
|||
setDirty(AllDirtyMask);
|
||||
mGroundThread = NULL;
|
||||
|
||||
if (mScaleCurrentlyAnimated && !thread->getSequence()->animatesScale())
|
||||
const TSShape::Sequence* threadSequence = thread->getSequence();
|
||||
|
||||
if (mScaleCurrentlyAnimated && !threadSequence->animatesScale())
|
||||
checkScaleCurrentlyAnimated();
|
||||
else if (!mScaleCurrentlyAnimated && thread->getSequence()->animatesScale())
|
||||
else if (!mScaleCurrentlyAnimated && threadSequence->animatesScale())
|
||||
mScaleCurrentlyAnimated=true;
|
||||
|
||||
mTransitionRotationNodes.overlap(thread->transitionData.oldRotationNodes);
|
||||
mTransitionRotationNodes.overlap(thread->getSequence()->rotationMatters);
|
||||
mTransitionRotationNodes.overlap(threadSequence->rotationMatters);
|
||||
|
||||
mTransitionTranslationNodes.overlap(thread->transitionData.oldTranslationNodes);
|
||||
mTransitionTranslationNodes.overlap(thread->getSequence()->translationMatters);
|
||||
mTransitionTranslationNodes.overlap(threadSequence->translationMatters);
|
||||
|
||||
mTransitionScaleNodes.overlap(thread->transitionData.oldScaleNodes);
|
||||
mTransitionScaleNodes.overlap(thread->getSequence()->scaleMatters);
|
||||
mTransitionScaleNodes.overlap(threadSequence->scaleMatters);
|
||||
|
||||
// if we aren't already in the list of transition threads, add us now
|
||||
S32 i;
|
||||
|
|
|
|||
|
|
@ -182,10 +182,11 @@ BOOL Win32WindowManager::MonitorRegionEnumProc(HMONITOR hMonitor, HDC hdcMonitor
|
|||
Vector<RectI> * regions = (Vector<RectI>*)dwData;
|
||||
|
||||
regions->increment();
|
||||
regions->last().point.x = lprcMonitor->left;
|
||||
regions->last().point.y = lprcMonitor->top;
|
||||
regions->last().extent.x = lprcMonitor->right - lprcMonitor->left;
|
||||
regions->last().extent.y = lprcMonitor->bottom - lprcMonitor->top;
|
||||
RectI& lastRegion = regions->last();
|
||||
lastRegion.point.x = lprcMonitor->left;
|
||||
lastRegion.point.y = lprcMonitor->top;
|
||||
lastRegion.extent.x = lprcMonitor->right - lprcMonitor->left;
|
||||
lastRegion.extent.y = lprcMonitor->bottom - lprcMonitor->top;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue