Fix incorrect normal after texture auto unwrapped
glTF normal export temporarily disabled.master
parent
debdd79a7a
commit
ec47c20919
|
@ -26,7 +26,7 @@ GltfFileWriter::GltfFileWriter(MeshResultContext &resultContext,
|
|||
const std::map<int, AutoRiggerVertexWeights> *resultRigWeights,
|
||||
const QString &filename) :
|
||||
m_filename(filename),
|
||||
m_outputNormal(true),
|
||||
m_outputNormal(false),
|
||||
m_outputAnimation(true),
|
||||
m_outputUv(true),
|
||||
m_testOutputAsWhole(false)
|
||||
|
@ -221,6 +221,7 @@ GltfFileWriter::GltfFileWriter(MeshResultContext &resultContext,
|
|||
m_json["accessors"][bufferViewIndex]["min"] = {minX, minY, minZ};
|
||||
bufferViewIndex++;
|
||||
|
||||
/*
|
||||
if (m_outputNormal) {
|
||||
bufferViewFromOffset = (int)binaries.size();
|
||||
m_json["bufferViews"][bufferViewIndex]["buffer"] = 0;
|
||||
|
@ -243,7 +244,7 @@ GltfFileWriter::GltfFileWriter(MeshResultContext &resultContext,
|
|||
m_json["accessors"][bufferViewIndex]["count"] = part.second.vertices.size();
|
||||
m_json["accessors"][bufferViewIndex]["type"] = "VEC3";
|
||||
bufferViewIndex++;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (m_outputUv) {
|
||||
bufferViewFromOffset = (int)binaries.size();
|
||||
|
|
|
@ -252,7 +252,7 @@ MeshLoader::MeshLoader(MeshResultContext &resultContext) :
|
|||
for (auto i = 0; i < 3; i++) {
|
||||
int vertexIndex = it.indicies[i];
|
||||
const ResultVertex *srcVert = &part.second.vertices[vertexIndex];
|
||||
const QVector3D *srcNormal = &part.second.interpolatedVertexNormals[vertexIndex];
|
||||
const QVector3D *srcNormal = &part.second.interpolatedTriangleVertexNormals[x * 3 + i];
|
||||
const ResultVertexUv *srcUv = &part.second.vertexUvs[vertexIndex];
|
||||
//const Material *srcMaterial = &part.second.material;
|
||||
const QVector3D *srcTangent = &part.second.triangleTangents[x];
|
||||
|
|
|
@ -339,7 +339,6 @@ void MeshResultContext::calculateResultParts(std::map<QUuid, ResultPart> &parts)
|
|||
bool isSeamVertex = m_seamVertices.end() != m_seamVertices.find(triangle.indicies[i]);
|
||||
if (isNewVertex || isSeamVertex) {
|
||||
int newIndex = resultPart.vertices.size();
|
||||
resultPart.interpolatedVertexNormals.push_back(normal);
|
||||
resultPart.verticesOldIndicies.push_back(triangle.indicies[i]);
|
||||
resultPart.vertices.push_back(vertices[triangle.indicies[i]]);
|
||||
ResultVertexUv vertexUv;
|
||||
|
@ -352,6 +351,7 @@ void MeshResultContext::calculateResultParts(std::map<QUuid, ResultPart> &parts)
|
|||
} else {
|
||||
newTriangle.indicies[i] = it->second;
|
||||
}
|
||||
resultPart.interpolatedTriangleVertexNormals.push_back(normal);
|
||||
}
|
||||
resultPart.triangles.push_back(newTriangle);
|
||||
resultPart.uvs.push_back(triangleUvs()[x]);
|
||||
|
|
|
@ -57,7 +57,7 @@ struct ResultPart
|
|||
Material material;
|
||||
std::vector<ResultVertex> vertices;
|
||||
std::vector<int> verticesOldIndicies;
|
||||
std::vector<QVector3D> interpolatedVertexNormals;
|
||||
std::vector<QVector3D> interpolatedTriangleVertexNormals;
|
||||
std::vector<ResultTriangle> triangles;
|
||||
std::vector<ResultTriangleUv> uvs;
|
||||
std::vector<ResultVertexUv> vertexUvs;
|
||||
|
|
Loading…
Reference in New Issue