//----------------------------------------------------------------------------// void DirectFBGeometryBuffer::appendGeometry(const Vertex* const vbuff, uint vertex_count) { IDirectFBSurface* t = d_activeTexture ? d_activeTexture->getDirectFBSurface() : 0; // create a new batch if there are no batches yet, or if the active texture // differs from that used by the current batch. if (d_batches.empty() || (t != d_batches.back().first)) d_batches.push_back(BatchInfo(t, 0)); // update size of current batch d_batches.back().second += vertex_count; // buffer these vertices DFBVertex vd; const Vertex* vs = vbuff; for (uint i = 0; i < vertex_count; ++i, ++vs) { // copy vertex info the buffer, converting from CEGUI::Vertex to // something directly usable by DirectFB as needed. vd.x = vs->position.d_x; vd.y = vs->position.d_y; vd.z = vs->position.d_z; vd.w = 1.0f; //vd.diffuse = vs->colour_val.getARGB(); vd.s = vs->tex_coords.d_x; vd.t = vs->tex_coords.d_y; d_vertices.push_back(vd); } }
//----------------------------------------------------------------------------// void Direct3D10GeometryBuffer::appendGeometry(const Vertex* const vbuff, uint vertex_count) { const ID3D10ShaderResourceView* srv = d_activeTexture ? d_activeTexture->getDirect3DShaderResourceView() : 0; // create a new batch if there are no batches yet, or if the active texture // differs from that used by the current batch. if (d_batches.empty() || (srv != d_batches.back().first)) d_batches.push_back(BatchInfo(srv, 0)); // update size of current batch d_batches.back().second += vertex_count; // buffer these vertices D3DVertex vd; const Vertex* vs = vbuff; for (uint i = 0; i < vertex_count; ++i, ++vs) { // copy vertex info the buffer, converting from CEGUI::Vertex to // something directly usable by D3D as needed. vd.x = vs->position.d_x; vd.y = vs->position.d_y; vd.z = vs->position.d_z; vd.diffuse = vs->colour_val.getARGB(); vd.tu = vs->tex_coords.d_x; vd.tv = vs->tex_coords.d_y; d_vertices.push_back(vd); } d_bufferSynched = false; }
//----------------------------------------------------------------------------// void IrrlichtGeometryBuffer::appendGeometry(const Vertex* const vbuff, uint vertex_count) { // see if we should start a new batch irr::video::ITexture* t = d_activeTexture ? d_activeTexture->getIrrlichtTexture() : 0; if (d_batches.empty() || d_batches.back().first != t) d_batches.push_back(BatchInfo(t, 0)); // buffer these vertices const irr::u16 idx_start = d_batches.back().second; irr::video::S3DVertex v; for (uint i = 0; i < vertex_count; ++i) { const Vertex& vs = vbuff[i]; v.Pos.X = vs.position.d_x + d_texelOffset; v.Pos.Y = vs.position.d_y + d_texelOffset; v.Pos.Z = vs.position.d_z; v.TCoords.X = vs.tex_coords.d_x; v.TCoords.Y = vs.tex_coords.d_y; v.Color.set(vs.colour_val.getARGB()); d_vertices.push_back(v); d_indices.push_back(idx_start + i); } // update size of current batch d_batches.back().second += vertex_count; }
//----------------------------------------------------------------------------// void Direct3D9GeometryBuffer::performBatchManagement() { const LPDIRECT3DTEXTURE9 t = d_activeTexture ? d_activeTexture->getDirect3D9Texture() : 0; // create a new batch if there are no batches yet, or if the active texture // differs from that used by the current batch. if (d_batches.empty() || (t != d_batches.back().first)) d_batches.push_back(BatchInfo(t, 0)); }
//----------------------------------------------------------------------------// void OpenGLGeometryBuffer::performBatchManagement() { const GLuint gltex = d_activeTexture ? d_activeTexture->getOpenGLTexture() : 0; // create a new batch if there are no batches yet, or if the active texture // differs from that used by the current batch. if (d_batches.empty() || (gltex != d_batches.back().first)) d_batches.push_back(BatchInfo(gltex, 0)); }
void FlowVRCegGeometryBuffer::setActiveTexture(Texture* texture) { // std::cout << "FlowVRCegGeometryBuffer[" << this << "]::setActiveTexture() -- " << this << " changed texture from: " << m_activeTexture // << " [" << (m_activeTexture ? static_cast<FlowVRCegTexture*>(m_activeTexture)->getFileName():"NULL") << "] to texture @ " << texture // << " [" << (texture ? static_cast<FlowVRCegTexture*>(texture)->getFileName():"NULL") << "]" << std::endl; m_activeTexture = texture; if( m_activeTexture ) { BATCHMAP::iterator cit = m_batchInfos.find( m_activeTexture ); if( cit == m_batchInfos.end() ) { m_batchInfos[ m_activeTexture ] = BatchInfo(); activeBatch = &m_batchInfos[ m_activeTexture ]; } else { activeBatch = &(*cit).second; } } else activeBatch = NULL; }