1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-31 20:15:32 +00:00

Create a separate vertex buffer for each UV set

This commit is contained in:
scrawl 2013-04-08 14:54:19 +02:00
parent 9e08497f02
commit a5c868c9f5

View file

@ -992,17 +992,19 @@ class NIFMeshLoader : Ogre::ManualResourceLoader
size_t numUVs = data->uvlist.size();
if(numUVs)
{
size_t elemSize = Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT2);
vbuf = hwBufMgr->createVertexBuffer(elemSize, srcVerts.size()*numUVs,
Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY, true);
for(size_t i = 0;i < numUVs;i++)
{
size_t elemSize = Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT2);
vbuf = hwBufMgr->createVertexBuffer(elemSize, srcVerts.size(),
Ogre::HardwareBuffer::HBU_STATIC);
const std::vector<Ogre::Vector2> &uvlist = data->uvlist[i];
vbuf->writeData(i*srcVerts.size()*elemSize, elemSize*srcVerts.size(), &uvlist[0], true);
decl->addElement(nextBuf, i*srcVerts.size()*elemSize, Ogre::VET_FLOAT2,
vbuf->writeData(0, elemSize*srcVerts.size(), &uvlist[0], true);
decl->addElement(nextBuf, 0, Ogre::VET_FLOAT2,
Ogre::VES_TEXTURE_COORDINATES, i);
bind->setBinding(nextBuf++, vbuf);
}
bind->setBinding(nextBuf++, vbuf);
}
// Triangle faces