| 1141 | |
| 1142 | |
| 1143 | void EveSpaceObject2::GetShadowBatches( ITriRenderBatchAccumulator* batches, const Tr2PerObjectData* perObjectData, float shadowPixelSize ) |
| 1144 | { |
| 1145 | if( !m_mesh || !m_mesh->GetDisplay() ) |
| 1146 | { |
| 1147 | return; |
| 1148 | } |
| 1149 | |
| 1150 | TriGeometryRes* geomRes = m_mesh->GetGeometryResource(); |
| 1151 | if( !geomRes || !geomRes->IsGood() ) |
| 1152 | { |
| 1153 | return; |
| 1154 | } |
| 1155 | int meshIx = m_mesh->GetMeshIndex(); |
| 1156 | auto lod = geomRes->GetMeshLod( meshIx, shadowPixelSize ); |
| 1157 | if( !lod || !lod->m_allocationsValid ) |
| 1158 | { |
| 1159 | return; |
| 1160 | } |
| 1161 | |
| 1162 | for( TriRenderBatchAreaBlocksWithSharedMaterial& shadowMeshArea : m_shadowMeshOpaqueAreas ) |
| 1163 | { |
| 1164 | auto& shadowAreas = shadowMeshArea.m_areaBlockVector; |
| 1165 | Tr2Material* shadowShader = shadowMeshArea.m_shaderMaterial; |
| 1166 | for( auto& areaBlock : shadowAreas ) |
| 1167 | { |
| 1168 | if( auto primCount = GetPrimitiveCount( *lod, areaBlock.m_startIndex, areaBlock.m_count ) ) |
| 1169 | { |
| 1170 | Tr2RenderBatch batch; |
| 1171 | batch.SetMaterial( shadowShader ); |
| 1172 | batch.SetGeometry( lod->m_mesh->m_vertexDeclarationHandle, lod->m_vertexAllocation, lod->m_indexAllocation ); |
| 1173 | batch.SetPerObjectData( perObjectData ); |
| 1174 | batch.SetDrawIndexedInstanced( |
| 1175 | primCount * 3, |
| 1176 | 1, |
| 1177 | lod->m_indexAllocation.GetStartIndex() + lod->m_areas[areaBlock.m_startIndex].m_firstIndex, |
| 1178 | lod->m_vertexAllocation.GetOffset() / lod->m_vertexAllocation.GetStride(), |
| 1179 | 0 ); |
| 1180 | batches->Commit( batch ); |
| 1181 | } |
| 1182 | } |
| 1183 | } |
| 1184 | } |
| 1185 | |
| 1186 | Tr2PerObjectData* EveSpaceObject2::GetShadowPerObjectData( ITriRenderBatchAccumulator* accumulator ) |
| 1187 | { |
nothing calls this directly
no test coverage detected