position are used correctly for evaluting bounds in the Mesh

This commit is contained in:
sam gateau 2018-09-05 17:50:06 -07:00
parent 15f54ac47d
commit 21f65d8a78
2 changed files with 7 additions and 5 deletions

View file

@ -781,7 +781,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
attribChannel = 2;
totalAttribBufferSize = totalVertsSize - positionsSize - normalsAndTangentsSize;
} else {
} /*else {
auto posBuffer = std::make_shared<gpu::Buffer>();
posBuffer->setData(positionsSize, (const gpu::Byte*) vertBuffer->getData() + positionsOffset);
vertexBufferStream->addBuffer(posBuffer, 0, positionElement.getSize());
@ -794,7 +794,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
attribChannel = 1;
totalAttribBufferSize = totalVertsSize - positionsSize;
}
}*/
// Define the vertex format, compute the offset for each attributes as we append them to the vertex format
gpu::Offset bufOffset = 0;

View file

@ -120,7 +120,8 @@ Box Mesh::evalPartBound(int partNum) const {
for (;index != endIndex; index++) {
// skip primitive restart indices
if ((*index) != PRIMITIVE_RESTART_INDEX) {
box += vertices[(*index)];
// box += vertices[(*index)];
box += _vertexBuffer.get<Vec3>(part._baseVertex + (*index));
}
}
}
@ -137,11 +138,12 @@ Box Mesh::evalPartsBound(int partStart, int partEnd) const {
Box partBound;
auto index = _indexBuffer.cbegin<uint>() + (*part)._startIndex;
auto endIndex = index + (*part)._numIndices;
auto vertices = &_vertexBuffer.get<Vec3>((*part)._baseVertex);
//auto vertices = &_vertexBuffer.get<Vec3>((*part)._baseVertex);
for (;index != endIndex; index++) {
// skip primitive restart indices
if ((*index) != (uint) PRIMITIVE_RESTART_INDEX) {
partBound += vertices[(*index)];
//partBound += vertices[(*index)];
partBound += _vertexBuffer.get<Vec3>((*part)._baseVertex + (*index));
}
}