| 80 | } |
| 81 | |
| 82 | void* OgreTexture::lock(TextureUsage _access) |
| 83 | { |
| 84 | if (_access == TextureUsage::Write) |
| 85 | { |
| 86 | return mTexture->getBuffer()->lock(Ogre::HardwareBuffer::HBL_WRITE_ONLY); |
| 87 | } |
| 88 | |
| 89 | // здесь проверить режим создания, и возможно так залочить без пиксель бокса |
| 90 | |
| 91 | // для чтения копируем в пиксель бокс |
| 92 | delete[] (uint8*)mTmpData.data; |
| 93 | mTmpData.data = nullptr; |
| 94 | |
| 95 | mTmpData = |
| 96 | Ogre::PixelBox(mTexture->getWidth(), mTexture->getHeight(), mTexture->getDepth(), mTexture->getFormat()); |
| 97 | mTmpData.data = new uint8[mTexture->getBuffer()->getSizeInBytes()]; |
| 98 | |
| 99 | mTexture->getBuffer()->blitToMemory(mTmpData); |
| 100 | |
| 101 | return mTmpData.data; |
| 102 | } |
| 103 | |
| 104 | void OgreTexture::unlock() |
| 105 | { |