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


C++ GFXStateBlockDesc类代码示例

本文整理汇总了C++中GFXStateBlockDesc的典型用法代码示例。如果您正苦于以下问题:C++ GFXStateBlockDesc类的具体用法?C++ GFXStateBlockDesc怎么用?C++ GFXStateBlockDesc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GFXStateBlockDesc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SAFE_DELETE

void SkyBox::_initMaterial()
{
   if ( mMatInstance )
      SAFE_DELETE( mMatInstance );

   if ( mMaterial )
      mMatInstance = mMaterial->createMatInstance();
   else
      mMatInstance = MATMGR->createMatInstance( "WarningMaterial" );

   // We want to disable culling and z write.
   GFXStateBlockDesc desc;
   desc.setCullMode( GFXCullNone );
   desc.setBlend( true );
   desc.setZReadWrite( true, false );
   mMatInstance->addStateBlockDesc( desc );

   // Also disable lighting on the skybox material by default.
   FeatureSet features = MATMGR->getDefaultFeatures();
   features.removeFeature( MFT_RTLighting );
   features.removeFeature( MFT_Visibility );
   features.addFeature(MFT_SkyBox);

   // Now initialize the material.
   mMatInstance->init(features, getGFXVertexFormat<GFXVertexPNT>());
}
开发者ID:nev7n,项目名称:Torque3D,代码行数:26,代码来源:skyBox.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: _initStateBlockTemplates

/// Creates the default state blocks for a list of render states
void ProcessedMaterial::_initRenderStateStateBlocks( RenderPassData *rpd )
{
    GFXStateBlockDesc stateTranslucent;
    GFXStateBlockDesc stateGlow;
    GFXStateBlockDesc stateReflect;
    GFXStateBlockDesc statePass;

    _initStateBlockTemplates( stateTranslucent, stateGlow, stateReflect );
    _initPassStateBlock( rpd, statePass );

    // Ok, we've got our templates set up, let's combine them together based on state and
    // create our state blocks.
    for (U32 i = 0; i < RenderPassData::STATE_MAX; i++)
    {
        GFXStateBlockDesc stateFinal;

        if (i & RenderPassData::STATE_REFLECT)
            stateFinal.addDesc(stateReflect);
        if (i & RenderPassData::STATE_TRANSLUCENT)
            stateFinal.addDesc(stateTranslucent);
        if (i & RenderPassData::STATE_GLOW)
            stateFinal.addDesc(stateGlow);

        stateFinal.addDesc(statePass);

        if (i & RenderPassData::STATE_WIREFRAME)
            stateFinal.fillMode = GFXFillWireframe;

        GFXStateBlockRef sb = GFX->createStateBlock(stateFinal);
        rpd->mRenderStates[i] = sb;
    }
}
开发者ID:belzilep,项目名称:Torque3D,代码行数:33,代码来源:processedMaterial.cpp

示例4: setGlobalBounds

bool CloudLayer::onAdd()
{
   if ( !Parent::onAdd() )
      return false;

   setGlobalBounds();
   resetWorldBox();

   addToScene();

   if ( isClientObject() )
   {
      _initTexture();
      _initBuffers();

      // Find ShaderData
      ShaderData *shaderData;
      mShader = Sim::findObject( "CloudLayerShader", shaderData ) ? 
                  shaderData->getShader() : NULL;
      if ( !mShader )
      {
         Con::errorf( "CloudLayer::onAdd - could not find CloudLayerShader" );
         return false;
      }

      // Create ShaderConstBuffer and Handles
      mShaderConsts = mShader->allocConstBuffer();
      mModelViewProjSC = mShader->getShaderConstHandle( "$modelView" );
      mEyePosWorldSC = mShader->getShaderConstHandle( "$eyePosWorld" );
      mSunVecSC = mShader->getShaderConstHandle( "$sunVec" );
      mTexOffsetSC[0] = mShader->getShaderConstHandle( "$texOffset0" );
      mTexOffsetSC[1] = mShader->getShaderConstHandle( "$texOffset1" );
      mTexOffsetSC[2] = mShader->getShaderConstHandle( "$texOffset2" );
      mTexScaleSC = mShader->getShaderConstHandle( "$texScale" );
      mAmbientColorSC = mShader->getShaderConstHandle( "$ambientColor" );
      mSunColorSC = mShader->getShaderConstHandle( "$sunColor" );
      mCoverageSC = mShader->getShaderConstHandle( "$cloudCoverage" );
      mExposureSC = mShader->getShaderConstHandle( "$cloudExposure" );
      mBaseColorSC = mShader->getShaderConstHandle( "$cloudBaseColor" );
      mNormalHeightMapSC = mShader->getShaderConstHandle( "$normalHeightMap" );

      // Create StateBlocks
      GFXStateBlockDesc desc;
      desc.setCullMode( GFXCullNone );
      desc.setBlend( true );
      desc.setZReadWrite( false, false );
      desc.samplersDefined = true;
      desc.samplers[0].addressModeU = GFXAddressWrap;
      desc.samplers[0].addressModeV = GFXAddressWrap;
      desc.samplers[0].addressModeW = GFXAddressWrap;
      desc.samplers[0].magFilter = GFXTextureFilterLinear;
      desc.samplers[0].minFilter = GFXTextureFilterLinear;
      desc.samplers[0].mipFilter = GFXTextureFilterLinear;
      desc.samplers[0].textureColorOp = GFXTOPModulate;

      mStateblock = GFX->createStateBlock( desc );   
   }

   return true;
}
开发者ID:practicing01,项目名称:Torque3D,代码行数:60,代码来源:cloudLayer.cpp

示例5: onRender

void GuiGradientCtrl::onRender(Point2I offset, const RectI& updateRect)
{
   if (mStateBlock.isNull())
   {
      GFXStateBlockDesc desc;
      desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
      desc.setZReadWrite(false);
      desc.zWriteEnable = false;
      desc.setCullMode(GFXCullNone);
      mStateBlock = GFX->createStateBlock( desc );
   }

   RectI boundsRect(offset, getExtent()); 
   renderColorBox(boundsRect);

   if (mPositionChanged) 
   {
      mPositionChanged = false;

      // Now do onAction() if we are allowed
      if (mActionOnMove) 
			onAction();  
   }
   
   //render the children
   renderChildControls( offset, updateRect);
}
开发者ID:03050903,项目名称:Torque3D,代码行数:27,代码来源:guiGradientCtrl.cpp

示例6: renderObject

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

示例7: ColorI

void DecalRoad::_debugRender( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance* )
{
   //if ( mStateBlock.isNull() )
   //   return;

   GFX->enterDebugEvent( ColorI( 255, 0, 0 ), "DecalRoad_debugRender" );
   GFXTransformSaver saver;

   //GFX->setStateBlock( mStateBlock );      

   Point3F size(1,1,1);
   ColorI color( 255, 0, 0, 255 );

   GFXStateBlockDesc desc;
   desc.setZReadWrite( true, false );
   desc.setBlend( true );
   desc.fillMode = GFXFillWireframe;

   if ( smShowBatches )  
   {
      for ( U32 i = 0; i < mBatches.size(); i++ )   
      {
         const Box3F &box = mBatches[i].bounds;         
         GFX->getDrawUtil()->drawCube( desc, box, ColorI(255,100,100,255) );         
      }
   }

   //GFX->leaveDebugEvent();
}
开发者ID:Adrellias,项目名称:Torque3D-DaveWork,代码行数:29,代码来源:decalRoad.cpp

示例8: onRender

void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
{
   if (mStateBlock.isNull())
   {
      GFXStateBlockDesc desc;
      desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
      desc.setZReadWrite(false);
      desc.zWriteEnable = false;
      desc.setCullMode(GFXCullNone);
      mStateBlock = GFX->createStateBlock( desc );
   }

   RectI boundsRect(offset, getExtent()); 
   renderColorBox(boundsRect);

   if (mPositionChanged) 
   {
      mPositionChanged = false;
      Point2I extent = getRoot()->getExtent();
      // If we are anything but a pallete, change the pick color
      if (mDisplayMode != pPallet)
      {
         Point2I resolution = getRoot()->getExtent();

         U32 buf_x = offset.x + mSelectorPos.x + 1;
         U32 buf_y = ( extent.y - ( offset.y + mSelectorPos.y + 1 ) );
         if(GFX->getAdapterType() != OpenGL)
            buf_y = resolution.y - buf_y;

         GFXTexHandle bb( resolution.x, 
                          resolution.y, 
                          GFXFormatR8G8B8A8, &GFXDefaultRenderTargetProfile, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__) );
         
         Point2I tmpPt( buf_x, buf_y );

         GFXTarget *targ = GFX->getActiveRenderTarget();
         targ->resolveTo( bb );
         
         GBitmap bmp( bb.getWidth(), bb.getHeight() );

         bb.copyToBmp( &bmp );
         
         //bmp.writePNGDebug( "foo.png" );

         ColorI tmp;
         bmp.getColor( buf_x, buf_y, tmp );

         mPickColor = (ColorF)tmp;

         // Now do onAction() if we are allowed
         if (mActionOnMove) 
            onAction();
      }
      
   }
   
   //render the children
   renderChildControls( offset, updateRect);
}
开发者ID:souxiaosou,项目名称:OmniEngine.Net,代码行数:59,代码来源:guiColorPicker.cpp

示例9: 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

示例10: setupStateBlocks

void DebugDrawer::setupStateBlocks()
{
   GFXStateBlockDesc d;

   d.setCullMode(GFXCullNone);
   mRenderZOnSB = GFX->createStateBlock(d);
   
   d.setZReadWrite(false);
   mRenderZOffSB = GFX->createStateBlock(d);
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:10,代码来源:debugDraw.cpp

示例11: renderBounds

void TerrCell::renderBounds() const
{
   ColorI color;
   color.interpolate( ColorI::RED, ColorI::GREEN, (F32)mLevel / 3.0f );

   GFXStateBlockDesc desc;
   desc.setZReadWrite( true, false );
   desc.fillMode = GFXFillWireframe;
   
   GFX->getDrawUtil()->drawCube( desc, mBounds, color );
}
开发者ID:fr1tz,项目名称:terminal-overload,代码行数:11,代码来源:terrCell.cpp

示例12: color

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

示例13: renderDebug

void PxCapsulePlayer::renderDebug( ObjectRenderInst *ri, SceneState *state, BaseMatInstance *overrideMat )
{
   Point3F center = pxCast<Point3F>( mCapsuleController->getDebugPosition() );   
   F32 radius = mCapsuleController->getRadius();
   F32 height = mCapsuleController->getHeight();

   GFXStateBlockDesc desc;
   desc.setBlend( true );
   desc.setZReadWrite( true, false );

   GFX->getDrawUtil()->drawCapsule( desc, center, radius, height, ColorI(100,100,200,160) );
}
开发者ID:adhistac,项目名称:ee-client-2-0,代码行数:12,代码来源:pxCapsulePlayer.cpp

示例14: 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

示例15: setGlobalBounds

bool BasicClouds::onAdd()
{
   if ( !Parent::onAdd() )
      return false;

   setGlobalBounds();
   resetWorldBox();

   addToScene();

   if ( isClientObject() )
   {
      _initTexture();
      _initBuffers();

      // Find ShaderData
      ShaderData *shaderData;
      mShader = Sim::findObject( "BasicCloudsShader", shaderData ) ? shaderData->getShader() : NULL;
      if ( !mShader )
      {
         Con::errorf( "BasicClouds::onAdd - could not find BasicCloudsShader" );
         return false;
      }

      // Create ShaderConstBuffer and Handles
      mShaderConsts = mShader->allocConstBuffer();
      mModelViewProjSC = mShader->getShaderConstHandle( "$modelView" );
      mTimeSC = mShader->getShaderConstHandle( "$accumTime" );
      mTexScaleSC = mShader->getShaderConstHandle( "$texScale" );
      mTexDirectionSC = mShader->getShaderConstHandle( "$texDirection" );
      mTexOffsetSC = mShader->getShaderConstHandle( "$texOffset" );
      mDiffuseMapSC = mShader->getShaderConstHandle( "$diffuseMap" );

      // Create StateBlocks
      GFXStateBlockDesc desc;
      desc.setCullMode( GFXCullNone );
      desc.setBlend( true );
      desc.setZReadWrite( false, false );
      desc.samplersDefined = true;
      desc.samplers[0].addressModeU = GFXAddressWrap;
      desc.samplers[0].addressModeV = GFXAddressWrap;
      desc.samplers[0].addressModeW = GFXAddressWrap;
      desc.samplers[0].magFilter = GFXTextureFilterLinear;
      desc.samplers[0].minFilter = GFXTextureFilterLinear;
      desc.samplers[0].mipFilter = GFXTextureFilterLinear;
      desc.samplers[0].textureColorOp = GFXTOPModulate;
      
      mStateblock = GFX->createStateBlock( desc );      
   }

   return true;
}
开发者ID:1414648814,项目名称:Torque3D,代码行数:52,代码来源:basicClouds.cpp


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