当前位置: 首页>>代码示例>>C++>>正文


C++ GFXDrawUtil类代码示例

本文整理汇总了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 );
}
开发者ID:souxiaosou,项目名称:OmniEngine.Net,代码行数:31,代码来源:trigger.cpp

示例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 ) );
}
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:27,代码来源:forestWindEmitter.cpp

示例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
   }
}
开发者ID:03050903,项目名称:Torque3D,代码行数:35,代码来源:sceneSpace.cpp

示例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 );
   }
}
开发者ID:adhistac,项目名称:ee-client-2-0,代码行数:60,代码来源:guiRiverEditorCtrl.cpp

示例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();
    }
}
开发者ID:RasterCode,项目名称:Torque3D,代码行数:59,代码来源:forestRender.cpp

示例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();
      }
   }
}
开发者ID:Dwarf-King,项目名称:OmniEngine.Net,代码行数:54,代码来源:navPath.cpp

示例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);
}
开发者ID:03050903,项目名称:Torque3D,代码行数:12,代码来源:guiDefaultControlRender.cpp

示例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 );
}
开发者ID:mray,项目名称:terminal-overload,代码行数:12,代码来源:tsShapeInstance.cpp

示例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 ) );
   }
} 
开发者ID:BadBehavior,项目名称:BadBehavior_T3D,代码行数:52,代码来源:guiDecalEditorCtrl.cpp

示例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();
      }
   }
开发者ID:belzilep,项目名称:Torque3D,代码行数:48,代码来源:navMesh.cpp

示例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 ) );
   }
}
开发者ID:souxiaosou,项目名称:OmniEngine.Net,代码行数:45,代码来源:forestWindEmitter.cpp

示例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 );
}
开发者ID:souxiaosou,项目名称:OmniEngine.Net,代码行数:45,代码来源:editTSCtrl.cpp

示例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
   }
}
开发者ID:03050903,项目名称:Torque3D,代码行数:45,代码来源:guiDefaultControlRender.cpp

示例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);
}
开发者ID:belzilep,项目名称:Torque3D,代码行数:41,代码来源:guiTheoraCtrl.cpp

示例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 );
}
开发者ID:J0linar,项目名称:Torque3D,代码行数:26,代码来源:guiSwatchButtonCtrl.cpp


注:本文中的GFXDrawUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。