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


C++ GFXStateBlockDesc::setAlphaTest方法代码示例

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


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

示例1: _initCorona

void Sun::_initCorona()
{
   if ( isServerObject() )
      return;
      
   // Load texture...

   if ( mCoronaTextureName.isNotEmpty() )      
      mCoronaTexture.set( mCoronaTextureName, &GFXDefaultStaticDiffuseProfile, "CoronaTexture" );            

   // Make stateblock...

   if ( mCoronaSB.isNull() )
   {
      GFXStateBlockDesc desc;
      desc.setCullMode( GFXCullNone );
      desc.setAlphaTest( true, GFXCmpGreaterEqual, 1 );
      desc.setZReadWrite( false, false );
      desc.setBlend( true, GFXBlendSrcColor, GFXBlendOne );
      desc.samplersDefined = true;
      desc.samplers[0].textureColorOp = GFXTOPModulate;
      desc.samplers[0].colorArg1 = GFXTATexture;
      desc.samplers[0].colorArg2 = GFXTADiffuse;
      desc.samplers[0].alphaOp = GFXTOPModulate;
      desc.samplers[0].alphaArg1 = GFXTATexture;
      desc.samplers[0].alphaArg2 = GFXTADiffuse;

      mCoronaSB = GFX->createStateBlock(desc);

      desc.setFillModeWireframe();
      mCoronaWireframeSB = GFX->createStateBlock(desc);
   }
}
开发者ID:adhistac,项目名称:ee-client-2-0,代码行数:33,代码来源:sun.cpp

示例2: init

void ShadowMaterialHook::init( BaseMatInstance *inMat )
{
   if( !inMat->isValid() )
      return;

   // Tweak the feature data to include just what we need.
   FeatureSet features;
   features.addFeature( MFT_VertTransform );
   features.addFeature( MFT_DiffuseMap );
   features.addFeature( MFT_TexAnim );
   features.addFeature( MFT_AlphaTest );
   features.addFeature( MFT_Visibility );

   // Actually we want to include features from the inMat
   // if they operate on the preTransform verts so things
   // like wind/deformation effects will also affect the shadow.
   const FeatureSet &inFeatures = inMat->getFeatures();
   for ( U32 i = 0; i < inFeatures.getCount(); i++ )
   {      
      const FeatureType& ft = inFeatures.getAt(i);
      
      if ( ft.getGroup() == MFG_PreTransform )
         features.addFeature( ft );
   }

   // Do instancing in shadows if we can.
   if ( inFeatures.hasFeature( MFT_UseInstancing ) )
      features.addFeature( MFT_UseInstancing );

   Material *shadowMat = (Material*)inMat->getMaterial();
   if ( dynamic_cast<CustomMaterial*>( shadowMat ) )
   {
      // This is a custom material... who knows what it really does, but
      // if it wasn't already filtered out of the shadow render then just
      // give it some default depth out material.
      shadowMat = MATMGR->getMaterialDefinitionByName( "AL_DefaultShadowMaterial" );
   }

   // By default we want to disable some states
   // that the material might enable for us.
   GFXStateBlockDesc forced;
   forced.setBlend( false );
   forced.setAlphaTest( false );

   // We should force on zwrite as the prepass
   // will disable it by default.
   forced.setZReadWrite( true, true );
   
   // TODO: Should we render backfaces for 
   // shadows or does the ESM take care of 
   // all our acne issues?
   //forced.setCullMode( GFXCullCW );

   // Vector, and spotlights use the same shadow material.
   BaseMatInstance *newMat = new ShadowMatInstance( shadowMat );
   newMat->setUserObject( inMat->getUserObject() );
   newMat->getFeaturesDelegate().bind( &ShadowMaterialHook::_overrideFeatures );
   newMat->addStateBlockDesc( forced );
   if( !newMat->init( features, inMat->getVertexFormat() ) )
   {
      SAFE_DELETE( newMat );
      newMat = MATMGR->createWarningMatInstance();
   }
   
   mShadowMat[ShadowType_Spot] = newMat;

   newMat = new ShadowMatInstance( shadowMat );
   newMat->setUserObject( inMat->getUserObject() );
   newMat->getFeaturesDelegate().bind( &ShadowMaterialHook::_overrideFeatures );
   forced.setCullMode( GFXCullCW );   
   newMat->addStateBlockDesc( forced );
   forced.cullDefined = false;
   newMat->addShaderMacro( "CUBE_SHADOW_MAP", "" );
   newMat->init( features, inMat->getVertexFormat() );
   mShadowMat[ShadowType_CubeMap] = newMat;
   
   // A dual paraboloid shadow rendered in a single draw call.
   features.addFeature( MFT_ParaboloidVertTransform );
   features.addFeature( MFT_IsSinglePassParaboloid );
   features.removeFeature( MFT_VertTransform );
   newMat = new ShadowMatInstance( shadowMat );
   newMat->setUserObject( inMat->getUserObject() );
   GFXStateBlockDesc noCull( forced );
   noCull.setCullMode( GFXCullNone );
   newMat->addStateBlockDesc( noCull );
   newMat->getFeaturesDelegate().bind( &ShadowMaterialHook::_overrideFeatures );
   newMat->init( features, inMat->getVertexFormat() );
   mShadowMat[ShadowType_DualParaboloidSinglePass] = newMat;

   // Regular dual paraboloid shadow.
   features.addFeature( MFT_ParaboloidVertTransform );
   features.removeFeature( MFT_IsSinglePassParaboloid );
   features.removeFeature( MFT_VertTransform );
   newMat = new ShadowMatInstance( shadowMat );
   newMat->setUserObject( inMat->getUserObject() );
   newMat->addStateBlockDesc( forced );
   newMat->getFeaturesDelegate().bind( &ShadowMaterialHook::_overrideFeatures );
   newMat->init( features, inMat->getVertexFormat() );
   mShadowMat[ShadowType_DualParaboloid] = newMat;

//.........这里部分代码省略.........
开发者ID:campadrenalin,项目名称:terminal-overload,代码行数:101,代码来源:shadowMatHook.cpp


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