[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/libs/kgllib/core/kgllib
From:       Rivo Laks <rivolaks () hot ! ee>
Date:       2008-08-16 15:03:29
Message-ID: 1218899009.564752.16280.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 847998 by rivol:

If the Batch is using a shared buffer then its indices have to be increased by the \
vertex  offset of the batch.

 M  +12 -1     batch.cpp  


--- trunk/playground/libs/kgllib/core/kgllib/batch.cpp #847997:847998
@@ -185,7 +185,18 @@
         mBuffer->addTexCoords(mTexcoords, mVertexCount, mBufferOffset);
     }
     if (mIndices) {
-        mBuffer->addIndices(reinterpret_cast<unsigned int*>(mIndices), mIndexCount, \
mBufferIndexOffset); +        if (mBufferOffset) {
+            // If our vertices have offset, then we must add this offset to every \
index. +            // Create temporary index array
+            unsigned int* offsetIndices = new unsigned int[mIndexCount];
+            for (int i = 0; i < mIndexCount; i++) {
+                offsetIndices[i] = reinterpret_cast<unsigned int*>(mIndices)[i] + \
mBufferOffset; +            }
+            mBuffer->addIndices(offsetIndices, mIndexCount, mBufferIndexOffset);
+            delete[] offsetIndices;
+        } else {
+            mBuffer->addIndices(reinterpret_cast<unsigned int*>(mIndices), \
mIndexCount, mBufferIndexOffset); +        }
     }
     mBuffer->unbind();
     //qDebug() << "Batch::update(): all done";


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic