mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2024-12-29 03:19:44 +00:00
Enable VBO sharing for terrain geometry
This commit is contained in:
parent
5666e02546
commit
b978153edb
@ -218,6 +218,9 @@ namespace Terrain
|
||||
}
|
||||
}
|
||||
|
||||
// Assign a VBO here to enable state sharing between different Geometries.
|
||||
uvs->setVertexBufferObject(new osg::VertexBufferObject);
|
||||
|
||||
mUvBufferMap[mNumVerts] = uvs;
|
||||
return uvs;
|
||||
}
|
||||
@ -238,6 +241,9 @@ namespace Terrain
|
||||
else
|
||||
buffer = createIndexBuffer<osg::DrawElementsUInt>(flags, verts);
|
||||
|
||||
// Assign a EBO here to enable state sharing between different Geometries.
|
||||
buffer->setElementBufferObject(new osg::ElementBufferObject);
|
||||
|
||||
mIndexBufferMap[flags] = buffer;
|
||||
return buffer;
|
||||
}
|
||||
|
@ -104,6 +104,11 @@ void TerrainGrid::loadCell(int x, int y)
|
||||
osg::ref_ptr<osg::Vec3Array> normals (new osg::Vec3Array);
|
||||
osg::ref_ptr<osg::Vec4Array> colors (new osg::Vec4Array);
|
||||
|
||||
osg::ref_ptr<osg::VertexBufferObject> vbo (new osg::VertexBufferObject);
|
||||
positions->setVertexBufferObject(vbo);
|
||||
normals->setVertexBufferObject(vbo);
|
||||
colors->setVertexBufferObject(vbo);
|
||||
|
||||
mStorage->fillVertexBuffers(0, 1, center, positions, normals, colors);
|
||||
|
||||
osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry);
|
||||
|
Loading…
Reference in New Issue
Block a user