本文整理汇总了C++中GFXStateBlockDesc::setCullMode方法的典型用法代码示例。如果您正苦于以下问题:C++ GFXStateBlockDesc::setCullMode方法的具体用法?C++ GFXStateBlockDesc::setCullMode怎么用?C++ GFXStateBlockDesc::setCullMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFXStateBlockDesc
的用法示例。
在下文中一共展示了GFXStateBlockDesc::setCullMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _initMaterial
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>());
}
示例2: _renderObject
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
}
}
示例3: 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 );
}
示例4: 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);
}
示例5: _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);
}
}
示例6: onAdd
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;
}
示例7: allocateAndRegister
BaseMatInstance * MaterialManager::createMeshDebugMatInstance(const ColorF &meshColor)
{
String meshDebugStr = String::ToString( "Torque_MeshDebug_%d", meshColor.getRGBAPack() );
Material *debugMat;
if (!Sim::findObject(meshDebugStr,debugMat))
{
debugMat = allocateAndRegister( meshDebugStr );
debugMat->mDiffuse[0] = meshColor;
debugMat->mEmissive[0] = true;
}
BaseMatInstance *debugMatInstance = NULL;
if( debugMat != NULL )
{
debugMatInstance = debugMat->createMatInstance();
GFXStateBlockDesc desc;
desc.setCullMode(GFXCullNone);
desc.fillMode = GFXFillWireframe;
debugMatInstance->addStateBlockDesc(desc);
// Disable fog and other stuff.
FeatureSet debugFeatures;
debugFeatures.addFeature( MFT_DiffuseColor );
debugMatInstance->init( debugFeatures, getGFXVertexFormat<GFXVertexPCN>() );
}
return debugMatInstance;
}
示例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);
}
示例9: setupStateBlocks
void DebugDrawer::setupStateBlocks()
{
GFXStateBlockDesc d;
d.setCullMode(GFXCullNone);
mRenderZOnSB = GFX->createStateBlock(d);
d.setZReadWrite(false);
mRenderZOffSB = GFX->createStateBlock(d);
}
示例10: 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();
}
}
}
示例11: onAdd
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;
}
示例12: renderObject
void Lightning::renderObject(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance* overrideMat)
{
if (overrideMat)
return;
if (mLightningSB.isNull())
{
GFXStateBlockDesc desc;
desc.setBlend( true, GFXBlendSrcAlpha, GFXBlendOne);
desc.setCullMode(GFXCullNone);
desc.zWriteEnable = false;
desc.samplersDefined = true;
desc.samplers[0].magFilter = GFXTextureFilterLinear;
desc.samplers[0].minFilter = GFXTextureFilterLinear;
desc.samplers[0].addressModeU = GFXAddressWrap;
desc.samplers[0].addressModeV = GFXAddressWrap;
mLightningSB = GFX->createStateBlock(desc);
}
GFX->setStateBlock(mLightningSB);
Strike* walk = mStrikeListHead;
while (walk != NULL)
{
GFX->setTexture(0, mDataBlock->strikeTextures[0]);
for( U32 i=0; i<3; i++ )
{
if( walk->bolt[i].isFading )
{
F32 alpha = 1.0f - walk->bolt[i].percentFade;
if( alpha < 0.0f ) alpha = 0.0f;
PrimBuild::color4f( fadeColor.red, fadeColor.green, fadeColor.blue, alpha );
}
else
{
PrimBuild::color4f( color.red, color.green, color.blue, color.alpha );
}
walk->bolt[i].render( state->getCameraPosition() );
}
walk = walk->next;
}
//GFX->setZWriteEnable(true);
//GFX->setAlphaTestEnable(false);
//GFX->setAlphaBlendEnable(false);
}
示例13: _setupStateBlocks
void GFXDrawUtil::_setupStateBlocks()
{
// DrawBitmapStretchSR
GFXStateBlockDesc bitmapStretchSR;
bitmapStretchSR.setCullMode(GFXCullNone);
bitmapStretchSR.setZReadWrite(false);
bitmapStretchSR.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
bitmapStretchSR.samplersDefined = true;
// Linear: Create wrap SB
bitmapStretchSR.samplers[0] = GFXSamplerStateDesc::getWrapLinear();
mBitmapStretchWrapLinearSB = mDevice->createStateBlock(bitmapStretchSR);
// Linear: Create clamp SB
bitmapStretchSR.samplers[0] = GFXSamplerStateDesc::getClampLinear();
mBitmapStretchLinearSB = mDevice->createStateBlock(bitmapStretchSR);
// Point:
bitmapStretchSR.samplers[0].minFilter = GFXTextureFilterPoint;
bitmapStretchSR.samplers[0].mipFilter = GFXTextureFilterPoint;
bitmapStretchSR.samplers[0].magFilter = GFXTextureFilterPoint;
// Point: Create clamp SB, last created clamped so no work required here
mBitmapStretchSB = mDevice->createStateBlock(bitmapStretchSR);
// Point: Create wrap SB, have to do this manually because getWrapLinear doesn't
bitmapStretchSR.samplers[0].addressModeU = GFXAddressWrap;
bitmapStretchSR.samplers[0].addressModeV = GFXAddressWrap;
bitmapStretchSR.samplers[0].addressModeW = GFXAddressWrap;
mBitmapStretchWrapSB = mDevice->createStateBlock(bitmapStretchSR);
GFXStateBlockDesc rectFill;
rectFill.setCullMode(GFXCullNone);
rectFill.setZReadWrite(false);
rectFill.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
mRectFillSB = mDevice->createStateBlock(rectFill);
}
示例14: render
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();
}
}
示例15: onAdd
bool GuiRoadEditorCtrl::onAdd()
{
if( !Parent::onAdd() )
return false;
mRoadSet = DecalRoad::getServerSet();
GFXStateBlockDesc desc;
desc.setCullMode( GFXCullNone );
desc.setBlend(false);
desc.setZReadWrite( false, false );
mZDisableSB = GFX->createStateBlock(desc);
return true;
}