| 302 | } |
| 303 | |
| 304 | void EveChildLineSet::UpdateBuffer( Tr2RenderContext& renderContext ) |
| 305 | { |
| 306 | unsigned points, total = 0; |
| 307 | for( auto it = begin( m_lines ); it != end( m_lines ); ++it ) |
| 308 | { |
| 309 | ( *it )->GetPointCount( points ); |
| 310 | total += points; |
| 311 | } |
| 312 | m_totalObjectCount = total; |
| 313 | |
| 314 | if( !m_vertexBuffer.IsValid() || m_vertexBuffer.GetDesc().count < m_totalObjectCount ) |
| 315 | { |
| 316 | USE_MAIN_THREAD_RENDER_CONTEXT(); |
| 317 | m_vertexBuffer.Create( |
| 318 | m_stride, |
| 319 | uint32_t( m_totalObjectCount ), |
| 320 | Tr2GpuUsage::VERTEX_BUFFER, |
| 321 | Tr2CpuUsage::WRITE_OFTEN, |
| 322 | nullptr, |
| 323 | renderContext ); |
| 324 | } |
| 325 | |
| 326 | uint8_t* data; |
| 327 | |
| 328 | CR_RETURN( m_vertexBuffer.MapForWriting( data, renderContext ) ); |
| 329 | |
| 330 | for( auto it = begin( m_lines ); it != end( m_lines ); ++it ) |
| 331 | { |
| 332 | ( *it )->UpdateBuffer( renderContext, data, m_worldTransform, m_stride ); |
| 333 | } |
| 334 | |
| 335 | m_vertexBuffer.UnmapForWriting( renderContext ); |
| 336 | } |
| 337 | |
| 338 | void EveChildLineSet::CreateSpriteVertexDeclaration() |
| 339 | { |
no test coverage detected