MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / prepRenderImage

Method prepRenderImage

Engine/source/forest/forestRender.cpp:64–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64void Forest::prepRenderImage( SceneRenderState *state )
65{
66 PROFILE_SCOPE(Forest_RenderCells);
67
68 // TODO: Fix stats.
69 /*
70 ForestCellVector &theCells = mData->getCells();
71 smTotalCells += theCells.size();
72
73 // Don't render if we don't have a grid!
74 if ( theCells.empty() )
75 return false;
76 */
77
78 // Prepare to render.
79 GFXTransformSaver saver;
80
81 // Figure out the grid range in the viewing area.
82 const bool isReflectPass = state->isReflectPass();
83
84 const F32 cullScale = isReflectPass ? mReflectionLodScalar : 1.0f;
85
86 // If we need to update our cached
87 // zone state then do it now.
88 if ( mZoningDirty )
89 {
90 mZoningDirty = false;
91
92 Vector<ForestCell*> cells;
93 mData->getCells( &cells );
94 for ( U32 i=0; i < cells.size(); i++ )
95 cells[i]->_updateZoning( getSceneManager()->getZoneManager() );
96 }
97
98 // TODO: Move these into the TSForestItemData as something we
99 // setup once and don't do per-instance.
100
101 // Set up the TS render state.
102 TSRenderState rdata;
103 rdata.setSceneState( state );
104
105 // Use origin sort on all forest elements as
106 // its alot cheaper than the bounds sort.
107 rdata.setOriginSort( true );
108
109 // We may have some forward lit materials in
110 // the forest, so pass down a LightQuery for it.
111 LightQuery lightQuery;
112 rdata.setLightQuery( &lightQuery );
113 Frustum culler = state->getCullingFrustum();
114
115 // Adjust the far distance if the cull scale has changed.
116 if ( !mIsEqual( cullScale, 1.0f ) )
117 {
118 const F32 visFarDist = culler.getFarDist() * cullScale;
119 culler.setFarDist( visFarDist );
120 }
121

Callers

nothing calls this directly

Calls 15

mIsEqualFunction · 0.85
isReflectPassMethod · 0.80
getCellsMethod · 0.80
_updateZoningMethod · 0.80
getZoneManagerMethod · 0.80
setSceneStateMethod · 0.80
setOriginSortMethod · 0.80
setLightQueryMethod · 0.80
getFarDistMethod · 0.80
setFarDistMethod · 0.80
getDrawUtilMethod · 0.80
clearBitmapModulationMethod · 0.80

Tested by

no test coverage detected