mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Merge pull request #1838 from rextimmy/terrain_cullface
re-enable face culling for the terrain
This commit is contained in:
commit
0db0a53333
|
|
@ -152,11 +152,17 @@ void TerrainCellMaterial::_updateDefaultAnisotropy()
|
||||||
} // for ( U32 m=0; m < pass.materials.size(); m++ )
|
} // for ( U32 m=0; m < pass.materials.size(); m++ )
|
||||||
|
|
||||||
// Set the updated stateblock.
|
// Set the updated stateblock.
|
||||||
|
desc.setCullMode( GFXCullCCW );
|
||||||
pass.stateBlock = GFX->createStateBlock( desc );
|
pass.stateBlock = GFX->createStateBlock( desc );
|
||||||
|
|
||||||
|
//reflection
|
||||||
|
desc.setCullMode( GFXCullCW );
|
||||||
|
pass.reflectionStateBlock = GFX->createStateBlock(desc);
|
||||||
|
|
||||||
// Create the wireframe state blocks.
|
// Create the wireframe state blocks.
|
||||||
GFXStateBlockDesc wireframe( desc );
|
GFXStateBlockDesc wireframe( desc );
|
||||||
wireframe.fillMode = GFXFillWireframe;
|
wireframe.fillMode = GFXFillWireframe;
|
||||||
|
wireframe.setCullMode( GFXCullCCW );
|
||||||
pass.wireframeStateBlock = GFX->createStateBlock( wireframe );
|
pass.wireframeStateBlock = GFX->createStateBlock( wireframe );
|
||||||
|
|
||||||
} // for ( U32 p=0; i < (*iter)->mPasses.size(); p++ )
|
} // for ( U32 p=0; i < (*iter)->mPasses.size(); p++ )
|
||||||
|
|
@ -668,15 +674,17 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
|
||||||
if ( prePassMat )
|
if ( prePassMat )
|
||||||
desc.addDesc( RenderPrePassMgr::getOpaqueStenciWriteDesc( false ) );
|
desc.addDesc( RenderPrePassMgr::getOpaqueStenciWriteDesc( false ) );
|
||||||
|
|
||||||
// Shut off culling for prepass materials (reflection support).
|
desc.setCullMode( GFXCullCCW );
|
||||||
if ( prePassMat )
|
pass->stateBlock = GFX->createStateBlock(desc);
|
||||||
desc.setCullMode( GFXCullNone );
|
|
||||||
|
|
||||||
pass->stateBlock = GFX->createStateBlock( desc );
|
//reflection stateblock
|
||||||
|
desc.setCullMode( GFXCullCW );
|
||||||
|
pass->reflectionStateBlock = GFX->createStateBlock(desc);
|
||||||
|
|
||||||
// Create the wireframe state blocks.
|
// Create the wireframe state blocks.
|
||||||
GFXStateBlockDesc wireframe( desc );
|
GFXStateBlockDesc wireframe( desc );
|
||||||
wireframe.fillMode = GFXFillWireframe;
|
wireframe.fillMode = GFXFillWireframe;
|
||||||
|
wireframe.setCullMode( GFXCullCCW );
|
||||||
pass->wireframeStateBlock = GFX->createStateBlock( wireframe );
|
pass->wireframeStateBlock = GFX->createStateBlock( wireframe );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -776,6 +784,8 @@ bool TerrainCellMaterial::setupPass( const SceneRenderState *state,
|
||||||
|
|
||||||
if ( sceneData.wireframe )
|
if ( sceneData.wireframe )
|
||||||
GFX->setStateBlock( pass.wireframeStateBlock );
|
GFX->setStateBlock( pass.wireframeStateBlock );
|
||||||
|
else if ( state->isReflectPass( ))
|
||||||
|
GFX->setStateBlock( pass.reflectionStateBlock );
|
||||||
else
|
else
|
||||||
GFX->setStateBlock( pass.stateBlock );
|
GFX->setStateBlock( pass.stateBlock );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ protected:
|
||||||
|
|
||||||
GFXStateBlockRef stateBlock;
|
GFXStateBlockRef stateBlock;
|
||||||
GFXStateBlockRef wireframeStateBlock;
|
GFXStateBlockRef wireframeStateBlock;
|
||||||
|
GFXStateBlockRef reflectionStateBlock;
|
||||||
|
|
||||||
GFXShaderConstHandle *modelViewProjConst;
|
GFXShaderConstHandle *modelViewProjConst;
|
||||||
GFXShaderConstHandle *worldViewOnly;
|
GFXShaderConstHandle *worldViewOnly;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue