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

Method GetBatchesFromMesh

trinity/Tr2Model.cpp:152–198  ·  view source on GitHub ↗

------------------------------------------------------------- Description: This is a helper function for Tr2Model to separate the code for Arguments: areaType - the TriBatchType as enumerated in ITr2Renderable -------------------------------------------------------------

Source from the content-addressed store, hash-verified

150// areaType - the TriBatchType as enumerated in ITr2Renderable
151// -------------------------------------------------------------
152void Tr2Model::GetBatchesFromMesh( Tr2Mesh* mesh,
153 TriBatchType batchType,
154 ITriRenderBatchAccumulator* batches,
155 Matrix* pm,
156 const Tr2PerObjectData* data )
157{
158 if( !mesh->GetDisplay() )
159 {
160 return;
161 }
162
163 Tr2MeshAreaVector* areas = mesh->GetAreas( batchType );
164
165 if( !areas )
166 {
167 return;
168 }
169
170 TriGeometryRes* geomRes = mesh->GetGeometryResource();
171 if( !geomRes || !geomRes->IsGood() )
172 {
173 return;
174 }
175 int meshIx = mesh->GetMeshIndex();
176 TriGeometryResLodData* lod = geomRes->GetMeshLod( meshIx, 0 );
177 if( !lod || !lod->m_allocationsValid )
178 {
179 return;
180 }
181
182 for( auto& area : *areas )
183 {
184 auto shader = area->GetMaterialInterface();
185
186 if( !area->GetDisplay() )
187 {
188 continue;
189 }
190 if( !shader )
191 {
192 continue;
193 }
194
195 auto batch = CreateGeometryBatch( lod, area, data );
196 batches->Commit( batch );
197 }
198}
199
200void Tr2Model::AddMesh( Tr2Mesh* mesh )
201{

Callers

nothing calls this directly

Calls 9

CreateGeometryBatchFunction · 0.85
GetAreasMethod · 0.80
GetGeometryResourceMethod · 0.80
GetMeshIndexMethod · 0.80
GetMaterialInterfaceMethod · 0.80
GetDisplayMethod · 0.45
IsGoodMethod · 0.45
GetMeshLodMethod · 0.45
CommitMethod · 0.45

Tested by

no test coverage detected