------------------------------------------------------------- Description: Creates render batches for line set. Arguments: batches - Render batch accumulator batchType - Type of batches to gather data - Per-object data -------------------------------------------------------------
| 1101 | // data - Per-object data |
| 1102 | // ------------------------------------------------------------- |
| 1103 | void Tr2CurveLineSet::GetBatchImpl( ITriRenderBatchAccumulator* accumulator, const Tr2PerObjectData* perObjectData, Tr2Material* effect ) |
| 1104 | { |
| 1105 | if( !effect || !m_vertexBuffer.IsValid() || m_vertexDeclHandle == Tr2EffectStateManager::UNINITIALIZED_DECLARATION ) |
| 1106 | { |
| 1107 | return; |
| 1108 | } |
| 1109 | |
| 1110 | Tr2RenderBatch batch; |
| 1111 | batch.SetMaterial( effect ); |
| 1112 | batch.SetPerObjectData( perObjectData ); |
| 1113 | |
| 1114 | float maxDepth = Tr2Renderer::GetFrustumRadius(); |
| 1115 | |
| 1116 | Vector3 center( m_boundingSphere.x, m_boundingSphere.y, m_boundingSphere.z ); |
| 1117 | center -= Tr2Renderer::GetViewPosition(); |
| 1118 | float z = std::min( std::max( ( Length( center ) + m_depthOffset ) / maxDepth, 0.f ), 1.f ); |
| 1119 | |
| 1120 | unsigned int depth = (unsigned int)( (float)0xFFFFFFF * ( 1.0f - z ) ); |
| 1121 | batch.m_depth = depth; |
| 1122 | |
| 1123 | batch.SetVertexDeclaration( m_vertexDeclHandle ); |
| 1124 | batch.SetStreamSource( 0, m_vertexBuffer, sizeof( LineVertex ) ); |
| 1125 | batch.SetDrawInstanced( 6 * m_currentSubmittedLineCount, 1, 0, 0 ); |
| 1126 | accumulator->Commit( batch ); |
| 1127 | } |
| 1128 | |
| 1129 | // ------------------------------------------------------------------------------------------------------ |
| 1130 | // Description: |
nothing calls this directly
no test coverage detected