fixing fuckeries

This commit is contained in:
sam gateau 2018-09-07 11:14:12 -07:00
parent d979d02139
commit fa72910ac1

View file

@ -734,8 +734,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
clusterIndices[i] = (uint8_t)(fbxMesh.clusterIndices[i]); clusterIndices[i] = (uint8_t)(fbxMesh.clusterIndices[i]);
} }
vertBuffer->setSubData(clusterIndicesOffset, clusterIndicesSize, (const gpu::Byte*) clusterIndices.constData()); vertBuffer->setSubData(clusterIndicesOffset, clusterIndicesSize, (const gpu::Byte*) clusterIndices.constData());
} } else {
else {
vertBuffer->setSubData(clusterIndicesOffset, clusterIndicesSize, (const gpu::Byte*) fbxMesh.clusterIndices.constData()); vertBuffer->setSubData(clusterIndicesOffset, clusterIndicesSize, (const gpu::Byte*) fbxMesh.clusterIndices.constData());
} }
} }
@ -763,15 +762,14 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
bool interleaveNormalsTangents = true; bool interleaveNormalsTangents = true;
// If has blend shapes allocate and assign buffers for pos and tangents now // If has blend shapes allocate and assign buffers for pos and tangents now
hasBlendShapes = true;
if (hasBlendShapes) { if (hasBlendShapes) {
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());
auto tangentBuffer = std::make_shared<gpu::Buffer>(); auto normalsAndTangentsBuffer = std::make_shared<gpu::Buffer>();
tangentBuffer->setData(normalsAndTangentsSize, (const gpu::Byte*) vertBuffer->getData() + normalsAndTangentsOffset); normalsAndTangentsBuffer->setData(normalsAndTangentsSize, (const gpu::Byte*) vertBuffer->getData() + normalsAndTangentsOffset);
vertexBufferStream->addBuffer(tangentBuffer, 0, normalsAndTangentsStride); vertexBufferStream->addBuffer(normalsAndTangentsBuffer, 0, normalsAndTangentsStride);
// update channels and attribBuffer size accordingly // update channels and attribBuffer size accordingly
interleavePositions = false; interleavePositions = false;
@ -814,8 +812,7 @@ void FBXReader::buildModelMesh(FBXMesh& extractedMesh, const QString& url) {
if (texCoords1Size) { if (texCoords1Size) {
vertexFormat->setAttribute(gpu::Stream::TEXCOORD1, attribChannel, texCoordsElement, bufOffset); vertexFormat->setAttribute(gpu::Stream::TEXCOORD1, attribChannel, texCoordsElement, bufOffset);
bufOffset += texCoordsElement.getSize(); bufOffset += texCoordsElement.getSize();
} } else if (texCoordsSize) {
else if (texCoordsSize) {
vertexFormat->setAttribute(gpu::Stream::TEXCOORD1, attribChannel, texCoordsElement, bufOffset - texCoordsElement.getSize()); vertexFormat->setAttribute(gpu::Stream::TEXCOORD1, attribChannel, texCoordsElement, bufOffset - texCoordsElement.getSize());
} }
if (clusterIndicesSize) { if (clusterIndicesSize) {