| 133 | } |
| 134 | |
| 135 | void Tr2GrannyPrimitiveSet::GetBatchesImpl( ITriRenderBatchAccumulator* accumulator, const Tr2PerObjectData* perObjectData, Tr2Material* effect, GetBatchesReason reason ) |
| 136 | { |
| 137 | if( !m_vertexBuffer.IsValid() ) |
| 138 | { |
| 139 | return; |
| 140 | } |
| 141 | |
| 142 | if( m_vertexDeclHandle == Tr2EffectStateManager::UNINITIALIZED_DECLARATION ) |
| 143 | { |
| 144 | return; |
| 145 | } |
| 146 | |
| 147 | Tr2RenderBatch batch; |
| 148 | batch.SetMaterial( effect ); |
| 149 | batch.SetPerObjectData( perObjectData ); |
| 150 | batch.SetVertexDeclaration( m_vertexDeclHandle ); |
| 151 | batch.SetStreamSource( 0, m_vertexBuffer, sizeof( TriangleVertex ) ); |
| 152 | if( m_renderSolid || reason == GetBatchesReason::Picking ) |
| 153 | { |
| 154 | batch.SetInidices( m_triangleIndexBuffer, m_triangleIndexBuffer.GetDesc().stride ); |
| 155 | if( reason == GetBatchesReason::Picking && ( m_pickingPrimitiveCount > 0 ) ) |
| 156 | { |
| 157 | batch.SetDrawIndexedInstanced( m_pickingPrimitiveCount * 3, 1, m_pickingIndexOffset, 0, 0 ); |
| 158 | } |
| 159 | else |
| 160 | { |
| 161 | batch.SetDrawIndexedInstanced( ( m_primitiveCount - m_pickingPrimitiveCount ) * 3, 1, 0, 0, 0 ); |
| 162 | } |
| 163 | } |
| 164 | else |
| 165 | { |
| 166 | batch.SetInidices( m_lineIndexBuffer, m_lineIndexBuffer.GetDesc().stride ); |
| 167 | batch.SetTopology( TOP_LINES ); |
| 168 | batch.SetDrawIndexedInstanced( ( m_primitiveCount - m_pickingPrimitiveCount ) * 6, 1, 0, 0, 0 ); |
| 169 | } |
| 170 | accumulator->Commit( batch ); |
| 171 | } |
| 172 | |
| 173 | |
| 174 | bool Tr2GrannyPrimitiveSet::OnModified( Be::Var* value ) |
nothing calls this directly
no test coverage detected