MCPcopy Create free account
hub / github.com/carbonengine/trinity / RenderPicking

Method RenderPicking

trinity/Tr2PrimitiveScene.cpp:208–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208bool Tr2PrimitiveScene::RenderPicking(
209 ITriRenderBatchAccumulator* pOpaquePickingBatches,
210 ITriRenderBatchAccumulator* pPickingBatches,
211 PickComponents pass )
212{
213 USE_MAIN_THREAD_RENDER_CONTEXT();
214 renderContext.m_esm.SetInvertedDepthTest( true );
215 ON_BLOCK_EXIT( [&] { renderContext.m_esm.SetInvertedDepthTest( false ); } );
216
217 // Use a shader variable for identifying which components are expected.
218 // We can't use situations here because the flags might change during a single
219 // frame.
220 Vector4 componentsParam = Vector4(
221 ( pass & PICK_OBJECT ) ? 1.0f : 0.0f,
222 ( pass & PICK_AREA ) ? 1.0f : 0.0f,
223 ( pass & PICK_POSITION ) ? 1.0f : 0.0f,
224 ( pass & PICK_UV ) ? 1.0f : 0.0f );
225
226 GlobalStore().RegisterVariable( "PickingComponents", componentsParam );
227
228 // Get the pick buffer
229 Tr2PickBuffer& pickBuffer = GetPickBuffer();
230
231 if( !pickBuffer.BeginRendering( 0, renderContext ) )
232 {
233 return false;
234 }
235
236 if( pPickingBatches && RenderPickingAreasForComponents( pass ) )
237 {
238 pPickingBatches->Finalize();
239
240 renderContext.m_esm.ApplyStandardStates( Tr2EffectStateManager::RM_PICKING );
241 renderContext.RenderBatchesForPicking( pPickingBatches, DEFAULT_TECHNIQUE );
242 }
243
244 if( !pickBuffer.EndRendering( renderContext ) )
245 {
246 return false;
247 }
248
249 return true;
250}
251
252const std::vector<ITr2Renderable*>& Tr2PrimitiveScene::GetPickingObjectsToRender( const Vector3& dirWorld )
253{

Callers

nothing calls this directly

Calls 9

SetInvertedDepthTestMethod · 0.80
RegisterVariableMethod · 0.80
FinalizeMethod · 0.80
ApplyStandardStatesMethod · 0.80
EndRenderingMethod · 0.80
Vector4Class · 0.50
BeginRenderingMethod · 0.45

Tested by

no test coverage detected