Browse Source

Fix index buffer offset in MeshView.

I'm not sure why I marked this as bug instead of fixing this directly.
The mesh test now fully passes.
pull/51/head
Vladimír Vondruš 13 years ago
parent
commit
314a47399b
  1. 4
      src/MeshView.cpp
  2. 2
      src/MeshView.h

4
src/MeshView.cpp

@ -34,7 +34,7 @@ MeshView& MeshView::setIndexRange(Int first, Int count, UnsignedInt start, Unsig
MeshView& MeshView::setIndexRange(Int first, Int count, UnsignedInt, UnsignedInt)
#endif
{
_indexOffset = first*_original->indexSize();
_indexOffset = _original->_indexOffset + first*_original->indexSize();
_indexCount = count;
#ifndef MAGNUM_TARGET_GLES2
_indexStart = start;
@ -45,7 +45,7 @@ MeshView& MeshView::setIndexRange(Int first, Int count, UnsignedInt, UnsignedInt
void MeshView::draw() {
#ifndef MAGNUM_TARGET_GLES2
_original->drawInternal(_firstVertex, _vertexCount, _indexOffset, _indexCount, _indexStart, _indexEnd);
_original->drawInternal(_firstVertex, _vertexCount, _indexOffset, _indexCount, _indexStart, _indexEnd);
#else
_original->drawInternal(_firstVertex, _vertexCount, _indexOffset, _indexCount);
#endif

2
src/MeshView.h

@ -49,8 +49,6 @@ no draw commands are issued when calling @ref draw().
You must ensure that the original mesh remains available for whole view
lifetime.
@todo Might cause issues when there are more data than just indices in index
buffer (wrongly computed offset)
*/
class MAGNUM_EXPORT MeshView {
public:

Loading…
Cancel
Save