mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 23:09:52 +02:00
position are used correctly for evaluting bounds in the Mesh
This commit is contained in:
parent
15f54ac47d
commit
21f65d8a78
2 changed files with 7 additions and 5 deletions
|
@ -781,7 +781,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
|
||||||
attribChannel = 2;
|
attribChannel = 2;
|
||||||
|
|
||||||
totalAttribBufferSize = totalVertsSize - positionsSize - normalsAndTangentsSize;
|
totalAttribBufferSize = totalVertsSize - positionsSize - normalsAndTangentsSize;
|
||||||
} else {
|
} /*else {
|
||||||
auto posBuffer = std::make_shared<gpu::Buffer>();
|
auto posBuffer = std::make_shared<gpu::Buffer>();
|
||||||
posBuffer->setData(positionsSize, (const gpu::Byte*) vertBuffer->getData() + positionsOffset);
|
posBuffer->setData(positionsSize, (const gpu::Byte*) vertBuffer->getData() + positionsOffset);
|
||||||
vertexBufferStream->addBuffer(posBuffer, 0, positionElement.getSize());
|
vertexBufferStream->addBuffer(posBuffer, 0, positionElement.getSize());
|
||||||
|
@ -794,7 +794,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
|
||||||
attribChannel = 1;
|
attribChannel = 1;
|
||||||
|
|
||||||
totalAttribBufferSize = totalVertsSize - positionsSize;
|
totalAttribBufferSize = totalVertsSize - positionsSize;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Define the vertex format, compute the offset for each attributes as we append them to the vertex format
|
// Define the vertex format, compute the offset for each attributes as we append them to the vertex format
|
||||||
gpu::Offset bufOffset = 0;
|
gpu::Offset bufOffset = 0;
|
||||||
|
|
|
@ -120,7 +120,8 @@ Box Mesh::evalPartBound(int partNum) const {
|
||||||
for (;index != endIndex; index++) {
|
for (;index != endIndex; index++) {
|
||||||
// skip primitive restart indices
|
// skip primitive restart indices
|
||||||
if ((*index) != PRIMITIVE_RESTART_INDEX) {
|
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;
|
Box partBound;
|
||||||
auto index = _indexBuffer.cbegin<uint>() + (*part)._startIndex;
|
auto index = _indexBuffer.cbegin<uint>() + (*part)._startIndex;
|
||||||
auto endIndex = index + (*part)._numIndices;
|
auto endIndex = index + (*part)._numIndices;
|
||||||
auto vertices = &_vertexBuffer.get<Vec3>((*part)._baseVertex);
|
//auto vertices = &_vertexBuffer.get<Vec3>((*part)._baseVertex);
|
||||||
for (;index != endIndex; index++) {
|
for (;index != endIndex; index++) {
|
||||||
// skip primitive restart indices
|
// skip primitive restart indices
|
||||||
if ((*index) != (uint) PRIMITIVE_RESTART_INDEX) {
|
if ((*index) != (uint) PRIMITIVE_RESTART_INDEX) {
|
||||||
partBound += vertices[(*index)];
|
//partBound += vertices[(*index)];
|
||||||
|
partBound += _vertexBuffer.get<Vec3>((*part)._baseVertex + (*index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue