Fixed bad VoxelBuffer indexing for non-cubic volumes

This commit is contained in:
Marc Gilleron 2019-04-26 03:35:00 +01:00
parent b85e696b7b
commit 8c6defee09

View File

@ -87,11 +87,11 @@ public:
} }
_FORCE_INLINE_ unsigned int index(unsigned int x, unsigned int y, unsigned int z) const { _FORCE_INLINE_ unsigned int index(unsigned int x, unsigned int y, unsigned int z) const {
return (z * _size.z + x) * _size.x + y; return y + _size.y * (x + _size.x * z);
} }
// _FORCE_INLINE_ unsigned int row_index(unsigned int x, unsigned int y, unsigned int z) const { // _FORCE_INLINE_ unsigned int row_index(unsigned int x, unsigned int y, unsigned int z) const {
// return (z * _size.z + x) * _size.x; // return _size.y * (x + _size.x * z);
// } // }
// TODO Rename get_cells_count() // TODO Rename get_cells_count()