Spitting out files WIP
This commit is contained in:
@@ -25,26 +25,48 @@ void Mesh::GetMeshData(MObject object)
|
||||
MVector normal;
|
||||
MPoint pos;
|
||||
float2 UV;
|
||||
double biTangent[3];
|
||||
double biNormal[3];
|
||||
VertexLayout thisVertex;
|
||||
MFloatVectorArray biTangents;
|
||||
MFloatVectorArray biNormals;
|
||||
|
||||
mesh.getTangents(biTangents, MSpace::kObject, NULL);
|
||||
mesh.getBinormals(biNormals, MSpace::kObject, NULL);
|
||||
|
||||
MGlobal::displayInfo("Befor Loop");
|
||||
MItMeshFaceVertex faceVert(object);
|
||||
int intDummy = 0;
|
||||
for (MItMeshPolygon meshPolyIter(object); !meshPolyIter.isDone(); meshPolyIter.next()) {
|
||||
vector<UINT> localVertexToGlobalIndex;
|
||||
meshPolyIter.getVertices(vertices);
|
||||
|
||||
meshPolyIter.getTriangles(dummy, triangleList);
|
||||
UINT indexOffset = verticesData.size();
|
||||
|
||||
MGlobal::displayInfo("Befor Second Loop");
|
||||
for (UINT i = 0; i < vertices.length(); i++) {
|
||||
vertexIndex = meshPolyIter.vertexIndex(i);
|
||||
pos = meshPolyIter.point(i);
|
||||
pos.get(thisVertex.Pos);
|
||||
|
||||
meshPolyIter.getNormal(i, normal);
|
||||
faceVert.setIndex(meshPolyIter.index(), i, intDummy, intDummy);
|
||||
MGlobal::displayInfo("In Second Loop");
|
||||
faceVert.position().get(thisVertex.Pos);
|
||||
faceVert.getNormal(normal);
|
||||
thisVertex.Normal[0] = normal[0];
|
||||
thisVertex.Normal[1] = normal[1];
|
||||
thisVertex.Normal[2] = normal[2];
|
||||
|
||||
meshPolyIter.getUV(i, UV);
|
||||
MFloatVector biTangent = biTangents[faceVert.tangentId()];
|
||||
//MVector tmp = faceVert.getTangent(MSpace::kObject, NULL);
|
||||
//tmp.get(biTangent);
|
||||
thisVertex.BiTangent[0] = biTangent[0];
|
||||
thisVertex.BiTangent[1] = biTangent[1];
|
||||
thisVertex.BiTangent[2] = biTangent[2];
|
||||
|
||||
MFloatVector biNormal = biNormals[faceVert.tangentId()];
|
||||
//faceVert.getBinormal().get(biNormal);
|
||||
thisVertex.BiNormal[0] = biNormal[0];
|
||||
thisVertex.BiNormal[1] = biNormal[1];
|
||||
thisVertex.BiNormal[2] = biNormal[2];
|
||||
|
||||
faceVert.getUV(UV);
|
||||
thisVertex.Uv[0] = UV[0];
|
||||
thisVertex.Uv[1] = UV[1];
|
||||
|
||||
@@ -53,14 +75,18 @@ void Mesh::GetMeshData(MObject object)
|
||||
|
||||
cout << "Pos: " << thisVertex.Pos[0] << "/" << thisVertex.Pos[1] << "/" << thisVertex.Pos[2] << endl;
|
||||
cout << "Normals: " << thisVertex.Normal[0] << "/" << thisVertex.Normal[1] << "/" << thisVertex.Normal[2] << endl;
|
||||
cout << "Bi-Normals: " << thisVertex.BiNormal[0] << "/" << thisVertex.BiNormal[1] << "/" << thisVertex.BiNormal[2] << endl;
|
||||
cout << "Bi-Tangents: " << thisVertex.BiTangent[0] << "/" << thisVertex.BiTangent[1] << "/" << thisVertex.BiTangent[2] << endl;
|
||||
cout << "UV: " << thisVertex.Uv[0] << "/" << thisVertex.Uv[1] << endl;
|
||||
}
|
||||
for (UINT i = 0; i < triangleList.length(); i++) {
|
||||
UINT k = 0;
|
||||
while (localVertexToGlobalIndex[k] != triangleList[i])
|
||||
k++;
|
||||
indexArray.push_back(indexOffset + k);
|
||||
}
|
||||
MGlobal::displayInfo("Befor Third Loop");
|
||||
|
||||
//for (UINT i = 0; i < triangleList.length(); i++) {
|
||||
// UINT k = 0;
|
||||
// while (localVertexToGlobalIndex[k] != triangleList[i])
|
||||
// k++;
|
||||
// indexArray.push_back(indexOffset + k);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user