本文整理汇总了C++中GFXDrawUtil类的典型用法代码示例。如果您正苦于以下问题:C++ GFXDrawUtil类的具体用法?C++ GFXDrawUtil怎么用?C++ GFXDrawUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GFXDrawUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRenderTransform
void Trigger::renderObject( ObjectRenderInst *ri,
SceneRenderState *state,
BaseMatInstance *overrideMat )
{
if(overrideMat)
return;
GFXStateBlockDesc desc;
desc.setZReadWrite( true, false );
desc.setBlend( true );
// Trigger polyhedrons are set up with outward facing normals and CCW ordering
// so can't enable backface culling.
desc.setCullMode( GFXCullNone );
GFXTransformSaver saver;
MatrixF mat = getRenderTransform();
mat.scale( getScale() );
GFX->multWorld( mat );
GFXDrawUtil *drawer = GFX->getDrawUtil();
drawer->drawPolyhedron( desc, mTriggerPolyhedron, ColorI( 255, 192, 0, 45 ) );
// Render wireframe.
desc.setFillModeWireframe();
drawer->drawPolyhedron( desc, mTriggerPolyhedron, ColorI::BLACK );
}
示例2: AssertFatal
void ForestWindEmitter::_renderEmitterInfo( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat )
{
if ( overrideMat )
return;
GFXTransformSaver saver;
GFXDrawUtil *drawer = GFX->getDrawUtil();
AssertFatal( drawer, "Got NULL GFXDrawUtil!" );
const Point3F &pos = getPosition();
const VectorF &windVec = mWind->getDirection();
GFXStateBlockDesc desc;
desc.setBlend( true );
desc.setZReadWrite( true, false );
// Draw an arrow pointing
// in the wind direction.
drawer->drawArrow( desc, pos, pos + (windVec * mWindStrength), ColorI( 0, 0, 255, 255 ) );//Point3F( -235.214, 219.589, 34.0991 ), Point3F( -218.814, 244.731, 37.5587 ), ColorI( 255, 255, 0, 255 ) );//
drawer->drawArrow( desc, pos, pos + (mWind->getTarget() * mWindStrength ), ColorI( 255, 0, 0, 85 ) );
// Draw a 2D circle for the wind radius.
if ( isRadialEmitter() )
drawer->drawSphere( desc, mWindRadius, pos, ColorI( 255, 0, 0, 80 ) );
}
示例3: getRenderTransform
void SceneSpace::_renderObject( ObjectRenderInst* ri, SceneRenderState* state, BaseMatInstance* overrideMat )
{
if( overrideMat )
return;
if( !mEditorRenderMaterial )
{
// We have no material for rendering so just render
// a plain box.
GFXTransformSaver saver;
MatrixF mat = getRenderTransform();
mat.scale( getScale() );
GFX->multWorld( mat );
GFXStateBlockDesc desc;
desc.setZReadWrite( true, false );
desc.setBlend( true );
desc.setCullMode( GFXCullNone );
GFXDrawUtil *drawer = GFX->getDrawUtil();
drawer->drawCube( desc, mObjBox, _getDefaultEditorSolidColor() );
// Render black wireframe.
desc.setFillModeWireframe();
drawer->drawCube( desc, mObjBox, _getDefaultEditorWireframeColor() );
}
else
{
//RDTODO
}
}
示例4: getBounds
void GuiRiverEditorCtrl::_drawRiverControlNodes( River *river, const ColorI &color )
{
if ( !River::smShowSpline )
return;
RectI bounds = getBounds();
GFXDrawUtil *drawer = GFX->getDrawUtil();
bool isSelected = ( river == mSelRiver );
bool isHighlighted = ( river == mHoverRiver );
for ( U32 i = 0; i < river->mNodes.size(); i++ )
{
if ( false && isSelected && mSelNode == i )
continue;
const Point3F &wpos = river->mNodes[i].point;
Point3F spos;
project( wpos, &spos );
if ( spos.z > 1.0f )
continue;
Point2I posi;
posi.x = spos.x;
posi.y = spos.y;
if ( !bounds.pointInRect( posi ) )
continue;
ColorI theColor = color;
Point2I nodeHalfSize = mNodeHalfSize;
if ( isHighlighted && mHoverNode == i )
{
//theColor = mHoverNodeColor;
nodeHalfSize += Point2I(2,2);
}
if ( isSelected )
{
if ( mSelNode == i )
{
theColor.set(0,0,255);
}
else if ( i == 0 )
{
theColor.set(0,255,0);
}
else if ( i == river->mNodes.size() - 1 )
{
theColor.set(255,0,0);
}
}
drawer->drawRectFill( posi - nodeHalfSize, posi + nodeHalfSize, theColor );
}
}
示例5: PROFILE_SCOPE
void Forest::_renderCellBounds( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat )
{
PROFILE_SCOPE( Forest_RenderCellBounds );
if ( overrideMat )
return;
GFXTransformSaver saver;
MatrixF projBias(true);
const Frustum frustum = GFX->getFrustum();
MathUtils::getZBiasProjectionMatrix( 0.001f, frustum, &projBias );
GFX->setProjectionMatrix( projBias );
VectorF extents;
Point3F pos;
// Get top level cells
Vector<ForestCell*> cellStack;
mData->getCells( &cellStack );
// Holds child cells we need to render as we encounter them.
Vector<ForestCell*> frontier;
GFXDrawUtil *drawer = GFX->getDrawUtil();
GFXStateBlockDesc desc;
desc.setZReadWrite( true, false );
desc.setBlend( true );
desc.setFillModeWireframe();
while ( !cellStack.empty() )
{
while ( !cellStack.empty() )
{
const ForestCell *cell = cellStack.last();
cellStack.pop_back();
Box3F box = cell->getBounds();
drawer->drawCube( desc, box, ColorI( 0, 255, 0 ) );
RectF rect = cell->getRect();
box.minExtents.set( rect.point.x, rect.point.y, box.minExtents.z );
box.maxExtents.set( rect.point.x + rect.extent.x, rect.point.y + rect.extent.y, box.minExtents.z );
drawer->drawCube( desc, box, ColorI::RED );
// If this cell has children, add them to the frontier.
if ( !cell->isLeaf() )
cell->getChildren( &frontier );
}
// Now the frontier becomes the cellStack and we empty the frontier.
cellStack = frontier;
frontier.clear();
}
}
示例6: renderSimple
void NavPath::renderSimple(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat)
{
if(overrideMat)
return;
if(state->isReflectPass() || !(isSelected() || mAlwaysRender))
return;
GFXDrawUtil *drawer = GFX->getDrawUtil();
GFXStateBlockDesc desc;
desc.setZReadWrite(true, false);
desc.setBlend(true);
desc.setCullMode(GFXCullNone);
if(isSelected())
{
drawer->drawCube(desc, getWorldBox(), ColorI(136, 255, 228, 5));
desc.setFillModeWireframe();
drawer->drawCube(desc, getWorldBox(), ColorI::BLACK);
}
desc.setZReadWrite(!mXray, false);
ColorI pathColour(255, 0, 255);
if(!mIsLooping)
{
desc.setFillModeSolid();
if(mFromSet) drawer->drawCube(desc, Point3F(0.2f, 0.2f, 0.2f), mFrom, pathColour);
if(mToSet) drawer->drawCube(desc, Point3F(0.2f, 0.2f, 0.2f), mTo, pathColour);
}
GFXStateBlockRef sb = GFX->createStateBlock(desc);
GFX->setStateBlock(sb);
PrimBuild::color3i(pathColour.red, pathColour.green, pathColour.blue);
PrimBuild::begin(GFXLineStrip, mPoints.size());
for (U32 i = 0; i < mPoints.size(); i++)
PrimBuild::vertex3fv(mPoints[i]);
PrimBuild::end();
if(mRenderSearch && getServerObject())
{
NavPath *np = static_cast<NavPath*>(getServerObject());
if(np->mQuery && !dtStatusSucceed(np->mStatus))
{
duDebugDrawTorque dd;
dd.overrideColor(duRGBA(250, 20, 20, 255));
duDebugDrawNavMeshNodes(&dd, *np->mQuery);
dd.render();
}
}
}
示例7: renderSlightlyRaisedBox
void renderSlightlyRaisedBox( 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;
GFXDrawUtil *drawer = GFX->getDrawUtil();
drawer->drawRectFill( bounds, profile->mFillColor);
drawer->drawLine(l, t, l, b, profile->mBorderColor);
drawer->drawLine(l, t, r, t, profile->mBorderColor);
drawer->drawLine(l + 1, b, r, b, profile->mBorderColor);
drawer->drawLine(r, t + 1, r, b - 1, profile->mBorderColor);
}
示例8: renderDebugNodes
void TSShapeInstance::renderDebugNodes()
{
GFXDrawUtil *drawUtil = GFX->getDrawUtil();
ColorI color( 255, 0, 0, 255 );
GFXStateBlockDesc desc;
desc.setBlend( false );
desc.setZReadWrite( false, false );
for ( U32 i = 0; i < mNodeTransforms.size(); i++ )
drawUtil->drawTransform( desc, mNodeTransforms[i], NULL, NULL );
}
示例9: PROFILE_SCOPE
void GuiDecalEditorCtrl::renderScene(const RectI & updateRect)
{
PROFILE_SCOPE( GuiDecalEditorCtrl_renderScene );
GFXTransformSaver saver;
RectI bounds = getBounds();
ColorI hlColor(0,255,0,255);
ColorI regColor(255,0,0,255);
ColorI selColor(0,0,255,255);
ColorI color;
GFXDrawUtil *drawUtil = GFX->getDrawUtil();
GFXStateBlockDesc desc;
desc.setBlend( true );
desc.setZReadWrite( true, false );
// Draw 3D stuff here.
if ( mSELDecal )
{
mGizmo->renderGizmo( mLastCameraQuery.cameraMatrix, mLastCameraQuery.fov );
mSELEdgeVerts.clear();
if ( gDecalManager->clipDecal( mSELDecal, &mSELEdgeVerts ) )
_renderDecalEdge( mSELEdgeVerts, ColorI( 255, 255, 255, 255 ) );
const F32 &decalSize = mSELDecal->mSize;
Point3F boxSize( decalSize, decalSize, decalSize );
MatrixF worldMat( true );
mSELDecal->getWorldMatrix( &worldMat, true );
drawUtil->drawObjectBox( desc, boxSize, mSELDecal->mPosition, worldMat, ColorI( 255, 255, 255, 255 ) );
}
if ( mHLDecal )
{
mHLEdgeVerts.clear();
if ( gDecalManager->clipDecal( mHLDecal, &mHLEdgeVerts ) )
_renderDecalEdge( mHLEdgeVerts, ColorI( 255, 255, 255, 255 ) );
const F32 &decalSize = mHLDecal->mSize;
Point3F boxSize( decalSize, decalSize, decalSize );
MatrixF worldMat( true );
mHLDecal->getWorldMatrix( &worldMat, true );
drawUtil->drawObjectBox( desc, boxSize, mHLDecal->mPosition, worldMat, ColorI( 255, 255, 255, 255 ) );
}
}
示例10: PROFILE_SCOPE
void NavMesh::render(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat)
{
if(overrideMat)
return;
if(state->isReflectPass())
return;
PROFILE_SCOPE(NavMesh_Render);
GFXDrawUtil *drawer = GFX->getDrawUtil();
GFXStateBlockDesc desc;
desc.setZReadWrite(true, false);
desc.setBlend(true);
desc.setCullMode(GFXCullNone);
drawer->drawCube(desc, getWorldBox(), ColorI(136, 255, 228, 45));
desc.setFillModeWireframe();
drawer->drawCube(desc, getWorldBox(), ColorI::BLACK);
// Recast debug draw
duDebugDrawTorque dd;
NetObject *no = getServerObject();
if(no && isSelected())
{
NavMesh *n = static_cast<NavMesh*>(no);
RenderMode mode = mRenderMode;
bool build = n->mBuilding;
if(build)
{
mode = RENDER_NAVMESH;
dd.overrideColour(duRGBA(255, 0, 0, 80));
}
n->mNavMeshLock.lock();
switch(mode)
{
case RENDER_NAVMESH: if(n->nm) duDebugDrawNavMesh (&dd, *n->nm, 0); break;
case RENDER_CONTOURS: if(n->cs) duDebugDrawContours (&dd, *n->cs); break;
case RENDER_POLYMESH: if(n->pm) duDebugDrawPolyMesh (&dd, *n->pm); break;
case RENDER_DETAILMESH: if(n->pmd) duDebugDrawPolyMeshDetail (&dd, *n->pmd); break;
case RENDER_PORTALS: if(n->nm) duDebugDrawNavMeshPortals (&dd, *n->nm); break;
}
if(n->cs && mRenderConnections && !build) duDebugDrawRegionConnections(&dd, *n->cs);
if(n->mInPolys && mRenderInput && !build) n->mInPolys->render();
n->mNavMeshLock.unlock();
}
}
示例11: AssertFatal
void ForestWindEmitter::_renderEmitterInfo( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat )
{
if ( overrideMat )
return;
GFXTransformSaver saver;
GFXDrawUtil *drawer = GFX->getDrawUtil();
AssertFatal( drawer, "Got NULL GFXDrawUtil!" );
const Point3F &pos = getPosition();
const VectorF &windVec = mWind->getDirection();
GFXStateBlockDesc desc;
desc.setBlend( true );
desc.setZReadWrite( true, false );
// Draw an arrow pointing
// in the wind direction.
drawer->drawArrow( desc, pos, pos + (windVec * mWindStrength), ColorI( 0, 0, 255, 255 ) );//Point3F( -235.214, 219.589, 34.0991 ), Point3F( -218.814, 244.731, 37.5587 ), ColorI( 255, 255, 0, 255 ) );//
drawer->drawArrow( desc, pos, pos + (mWind->getTarget() * mWindStrength ), ColorI( 255, 0, 0, 85 ) );
S32 useRadius = mWindRadius;
// Draw a 2D circle for the wind radius.
if ( isRadialEmitter() )
{
//WLE - Vince
//So the problem is that when your inside the sphere it won't render so it might make someone
//think that it's not working right. So what I did was determine if the camera is inside the sphere.
//If the camera is inside the sphere, then I find the distance from the center of the sphere to the camera
//Round down and use that as the radius to draw the sphere.
//That way if someone zooms in or out, their screen is still showing the sphere.
GameConnection * gc = GameConnection::getConnectionToServer();
GameBase* gb = gc->getCameraObject();
if (gb)
{
Point3F camPos = gb->getPosition();
if ( getPosition().isInsideSphere( camPos, mWindRadius ) )
useRadius = getPosition().distanceTo(camPos);
}
drawer->drawSphere( desc, useRadius, pos, ColorI( 255, 0, 0, 80 ) );
}
}
示例12: GFXDEBUGEVENT_SCOPE
void EditTSCtrl::renderMissionArea()
{
MissionArea* obj = MissionArea::getServerObject();
if ( !obj )
return;
if ( !mRenderMissionArea && !obj->isSelected() )
return;
GFXDEBUGEVENT_SCOPE( Editor_renderMissionArea, ColorI::WHITE );
F32 minHeight = 0.0f;
F32 maxHeight = 0.0f;
TerrainBlock* terrain = getActiveTerrain();
if ( terrain )
{
terrain->getMinMaxHeight( &minHeight, &maxHeight );
Point3F pos = terrain->getPosition();
maxHeight += pos.z + mMissionAreaHeightAdjust;
minHeight += pos.z - mMissionAreaHeightAdjust;
}
const RectI& area = obj->getArea();
Box3F areaBox( area.point.x,
area.point.y,
minHeight,
area.point.x + area.extent.x,
area.point.y + area.extent.y,
maxHeight );
GFXDrawUtil* drawer = GFX->getDrawUtil();
GFXStateBlockDesc desc;
desc.setCullMode( GFXCullNone );
desc.setBlend( true );
desc.setZReadWrite( false, false );
desc.setFillModeSolid();
drawer->drawCube( desc, areaBox, mMissionAreaFillColor );
desc.setFillModeWireframe();
drawer->drawCube( desc, areaBox, mMissionAreaFrameColor );
}
示例13: renderFixedBitmapBordersFilled
// Render out the fixed bitmap borders based on a multiplier into the bitmap array
// It renders left and right caps, with a sizable fill area in the middle to reach
// the x extent. It does not stretch in the y direction.
void renderFixedBitmapBordersFilled( const RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile )
{
// Indices into the bitmap array
S32 numBitmaps = 3;
S32 borderLeft = numBitmaps * baseMultiplier - numBitmaps;
S32 fill = 1 + borderLeft;
S32 borderRight = 2 + borderLeft;
GFXDrawUtil *drawer = GFX->getDrawUtil();
drawer->clearBitmapModulation();
if(profile->mBitmapArrayRects.size() >= (numBitmaps * baseMultiplier))
{
RectI destRect;
RectI stretchRect;
RectI* mBitmapBounds = profile->mBitmapArrayRects.address();
// Draw all corners first.
//left border
drawer->drawBitmapSR(profile->mTextureObject,Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[borderLeft]);
//right border
drawer->drawBitmapSR(profile->mTextureObject,Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[borderRight].extent.x,bounds.point.y),mBitmapBounds[borderRight]);
// End drawing corners
// Begin drawing fill
//fill stretch
destRect.point.x = bounds.point.x + mBitmapBounds[borderLeft].extent.x;
destRect.extent.x = (bounds.extent.x) - mBitmapBounds[borderLeft].extent.x - mBitmapBounds[borderRight].extent.x;
destRect.extent.y = mBitmapBounds[fill].extent.y;
destRect.point.y = bounds.point.y;
//stretch it
stretchRect = mBitmapBounds[fill];
stretchRect.inset(1,0);
//draw it
drawer->drawBitmapStretchSR(profile->mTextureObject,destRect,stretchRect);
// End drawing fill
}
}
示例14: rect
void GuiTheoraCtrl::onRender(Point2I offset, const RectI &updateRect)
{
if( mDone && mIsLooping )
mTheoraTexture.play();
const RectI rect(offset, getBounds().extent);
if( mTheoraTexture.isReady() )
{
mTheoraTexture.refresh();
if( mTheoraTexture.isPlaying()
|| mTheoraTexture.isPaused() )
{
// Draw the frame.
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTheoraTexture.getTexture(), rect );
// Draw frame info, if requested.
if( mRenderDebugInfo )
{
String info = String::ToString( "Frame Number: %i | Frame Time: %.2fs | Playback Time: %.2fs | Dropped: %i",
mTheoraTexture.getFrameNumber(),
mTheoraTexture.getFrameTime(),
F32( mTheoraTexture.getPosition() ) / 1000.f,
mTheoraTexture.getNumDroppedFrames() );
drawUtil->setBitmapModulation( mProfile->mFontColors[ 0 ] );
drawUtil->drawText( mProfile->mFont, localToGlobalCoord( Point2I( 0, 0 ) ), info, mProfile->mFontColors );
}
}
else
mDone = true;
}
else
GFX->getDrawUtil()->drawRectFill(rect, mBackgroundColor); // black rect
renderChildControls(offset, updateRect);
}
示例15: renderRect
void GuiSwatchButtonCtrl::onRender( Point2I offset, const RectI &updateRect )
{
bool highlight = mMouseOver;
ColorI borderColor = mActive ? ( highlight ? mProfile->mBorderColorHL : mProfile->mBorderColor ) : mProfile->mBorderColorNA;
RectI renderRect( offset, getExtent() );
if ( !highlight )
renderRect.inset( 1, 1 );
GFXDrawUtil *drawer = GFX->getDrawUtil();
drawer->clearBitmapModulation();
// Draw background transparency grid texture...
if ( mGrid.isValid() )
drawer->drawBitmapStretch( mGrid, renderRect );
// Draw swatch color as fill...
if (!mUseSRGB)
drawer->drawRectFill( renderRect, mSwatchColor.toGamma() );
else
drawer->drawRectFill(renderRect, mSwatchColor);
// Draw any borders...
drawer->drawRect( renderRect, borderColor );
}