本文整理汇总了C++中GFXStateBlockDesc::setZReadWrite方法的典型用法代码示例。如果您正苦于以下问题:C++ GFXStateBlockDesc::setZReadWrite方法的具体用法?C++ GFXStateBlockDesc::setZReadWrite怎么用?C++ GFXStateBlockDesc::setZReadWrite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFXStateBlockDesc
的用法示例。
在下文中一共展示了GFXStateBlockDesc::setZReadWrite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
}
示例2: 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);
}
示例3: _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);
}
}
示例4: _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
}
}
示例5: 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 );
}
示例6: _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>());
}
示例7: _debugRender
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();
}
示例8: _renderEmitterInfo
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 ) );
}
示例9: 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;
}
示例10: 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);
}
示例11: _renderCellBounds
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();
}
}
示例12: setupStateBlocks
void DebugDrawer::setupStateBlocks()
{
GFXStateBlockDesc d;
d.setCullMode(GFXCullNone);
mRenderZOnSB = GFX->createStateBlock(d);
d.setZReadWrite(false);
mRenderZOffSB = GFX->createStateBlock(d);
}
示例13: onAdd
bool GuiNavEditorCtrl::onAdd()
{
if(!Parent::onAdd())
return false;
GFXStateBlockDesc desc;
desc.fillMode = GFXFillSolid;
desc.setBlend(false);
desc.setZReadWrite(false, false);
desc.setCullMode(GFXCullNone);
mZDisableSB = GFX->createStateBlock(desc);
desc.setZReadWrite(true, true);
mZEnableSB = GFX->createStateBlock(desc);
SceneManager::getPreRenderSignal().notify(this, &GuiNavEditorCtrl::_prepRenderImage);
return true;
}
示例14: 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 );
}
示例15: 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 );
}