Max2
03-06-2006 18:35:19
Hi I don't know if I should write here, but I don't understand how this piece of code works
what I don't understand is
and than u use
but from the API the lock function should return void, so how can u use pInt to get data from the buffer ?
pInt[k] ??? what is it ?? and
Pint[k] + offset... so u copy to the MeshFaces the indexes of the ibuf like u were using
readData (size_t offset, size_t length, void *pDest)
did I get ir right ??
sorry for the stupid question but I don't get it.
if ( use32bitindexes ) {
unsigned int* pInt = static_cast<unsigned int*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
size_t offset = (submesh->useSharedVertices)? shared_offset : current_offset;
for ( size_t k = 0; k < numTris*3; ++k) {
mMeshFaces[index_offset] = pInt[k] + static_cast<unsigned int>(offset);
//mMaterials[index_offset++] = currentMaterialIndex;
}
}
else {
unsigned short* pShort = reinterpret_cast<unsigned short*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
size_t offset = (submesh->useSharedVertices)? shared_offset : current_offset;
for ( size_t k = 0; k < numTris*3; ++k) {
mMeshFaces[index_offset] = static_cast<unsigned int>(pShort[k]) + static_cast<unsigned int>(offset);
//mMaterials[index_offset++] = currentMaterialIndex;
}
}
what I don't understand is
unsigned int* pInt = static_cast<unsigned int*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
and than u use
mMeshFaces[index_offset] = pInt[k] + static_cast<unsigned int>(offset);
but from the API the lock function should return void, so how can u use pInt to get data from the buffer ?
pInt[k] ??? what is it ?? and
Pint[k] + offset... so u copy to the MeshFaces the indexes of the ibuf like u were using
readData (size_t offset, size_t length, void *pDest)
did I get ir right ??
sorry for the stupid question but I don't get it.