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

Method RunQuery

trinity/Eve/EveOccluder.cpp:150–185  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Performs two render calls with different states: with and without depth-test to get the visibility. WARNING: a query might not return a value immediatly, if it still "runs", don't do anything and wait until it finishes Arguments: renderContext - current render context frustum - the current view frustum of

Source from the content-addressed store, hash-verified

148// transform - parent transform of the lensflare to turn this into a 2d sprite
149// --------------------------------------------------------------------------------
150void EveOccluder::RunQuery( Tr2RenderContext& renderContext, const EveUpdateContext& updateContext, const Matrix& transform, uint32_t bufferOffset, float fogWeight )
151{
152 // visible?
153 if( !m_display )
154 {
155 return;
156 }
157
158 GlobalStore().RegisterVariable( "OcclusionBufferOffset", *reinterpret_cast<float*>( &bufferOffset ) );
159 GlobalStore().RegisterVariable( "OcclusionFogWeight", fogWeight );
160
161 // prepare batches for rendering
162 renderContext.m_esm.ApplyStandardStates( Tr2EffectStateManager::RM_OPAQUE );
163 // collect renderables from sprite, so we can pass the parent transform and EveTransform handles
164 // all of the view update for us
165 std::vector<ITr2Renderable*> renderables;
166 EveUpdateContext dummyContext;
167 for( auto& sprite : m_sprites )
168 {
169 sprite->UpdateSyncronous( dummyContext );
170 sprite->UpdateVisibility( updateContext, transform );
171 sprite->GetRenderables( renderables, nullptr );
172 }
173 // collect batches from renderables (only from decal area, nothing else is important for
174 // occlusion queries)
175 for( auto& renderable : renderables )
176 {
177 Tr2PerObjectData* objectData = renderable->GetPerObjectData( m_batches.get() );
178 renderable->GetBatches( m_batches.get(), TRIBATCHTYPE_OPAQUE, objectData );
179 }
180 m_batches->Finalize();
181
182 renderContext.RenderBatches( m_batches.get() );
183 // cleanup
184 m_batches->Clear();
185}

Callers 2

RunOcclusionQueriesMethod · 0.80

Calls 11

RegisterVariableMethod · 0.80
ApplyStandardStatesMethod · 0.80
getMethod · 0.80
FinalizeMethod · 0.80
RenderBatchesMethod · 0.80
UpdateSyncronousMethod · 0.45
UpdateVisibilityMethod · 0.45
GetRenderablesMethod · 0.45
GetPerObjectDataMethod · 0.45
GetBatchesMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected