------------------------------------------------------------- Description: This is a helper function for Tr2Model to separate the code for Arguments: areaType - the TriBatchType as enumerated in ITr2Renderable -------------------------------------------------------------
| 150 | // areaType - the TriBatchType as enumerated in ITr2Renderable |
| 151 | // ------------------------------------------------------------- |
| 152 | void 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 | |
| 200 | void Tr2Model::AddMesh( Tr2Mesh* mesh ) |
| 201 | { |
nothing calls this directly
no test coverage detected