diff --git a/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj b/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj
index 50577919..a9154ac7 100644
--- a/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj
+++ b/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj
@@ -175,6 +175,7 @@
+
@@ -198,7 +199,9 @@
+
+
Moc%27ing Menu.h...
.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp
diff --git a/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj.filters b/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj.filters
index cf4a5a35..be5b36b1 100644
--- a/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj.filters
+++ b/tools/MayaExporter/MayaExporter/MayaExporter.vcxproj.filters
@@ -59,6 +59,9 @@
Source Files
+
+ Source Files
+
@@ -87,5 +90,11 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
\ No newline at end of file
diff --git a/tools/MayaExporter/MayaExporter/MayaIncludes.h b/tools/MayaExporter/MayaExporter/MayaIncludes.h
index 4a810787..0e490208 100644
--- a/tools/MayaExporter/MayaExporter/MayaIncludes.h
+++ b/tools/MayaExporter/MayaExporter/MayaIncludes.h
@@ -36,6 +36,7 @@
#include
#include
#include
+#include
// Wrappers
diff --git a/tools/MayaExporter/MayaExporter/Menu.cpp b/tools/MayaExporter/MayaExporter/Menu.cpp
index ae5b1732..ed09ec25 100644
--- a/tools/MayaExporter/MayaExporter/Menu.cpp
+++ b/tools/MayaExporter/MayaExporter/Menu.cpp
@@ -215,8 +215,12 @@ void Menu::ExportAll(bool)
cout << m_ExportPath->text().toLocal8Bit().constData() << endl;
}
+ m_File.ASCIIFilePath("C:/Users/Nickelodion/Desktop/coolASCII.txt");
+ m_File.binaryFilePath("C:/Users/Nickelodion/Desktop/coolSoptunz.bin");
+
if(m_ExportAnimationsButton->isChecked())
GetSkeletonData();
+
}
void Menu::CancelClicked(bool)
@@ -298,8 +302,10 @@ void Menu::GetSkeletonData()
}
//print out all bind poses
+ m_File.OpenFiles();
for (auto aBindPose : allBindPoses)
{
+ m_File.writeToFiles(&aBindPose);
MGlobal::displayInfo(MString() + "BindPose Skeleton name: " + aBindPose.Name.c_str());
for (int i = 0; i < aBindPose.Joints.size(); i++)
{
@@ -312,21 +318,25 @@ void Menu::GetSkeletonData()
}
//Print out all skeletons for all frames
+
MGlobal::displayInfo(MString() + allSkeletons.size());
for (auto frameSkeletons : allSkeletons)
{
for (auto aSkeleton : frameSkeletons)
{
MGlobal::displayInfo(MString() + aSkeleton.Name.c_str());
+ //m_File.writeToFiles(&aSkeleton);
for (auto joint : aSkeleton.Joints)
{
+ //m_File.writeToFiles(&joint);
//MGlobal::displayInfo(MString() + joint.Translation[0] + " " + joint.Translation[1] + " " + joint.Translation[2]);
//MGlobal::displayInfo(MString() + joint.Rotation[0] + " " + joint.Rotation[1] + " " + joint.Rotation[2]);
//MGlobal::displayInfo(MString() + joint.Scale[0] + " " + joint.Scale[1] + " " + joint.Scale[2]);
}
}
- }*/
+ }
}
+ m_File.CloseFiles();
}
Menu::~Menu()
diff --git a/tools/MayaExporter/MayaExporter/Menu.h b/tools/MayaExporter/MayaExporter/Menu.h
index 81ec2834..0174cbc3 100644
--- a/tools/MayaExporter/MayaExporter/Menu.h
+++ b/tools/MayaExporter/MayaExporter/Menu.h
@@ -37,6 +37,7 @@
#include "Material.h"
#include "Mesh.h"
#include "Skeleton.h"
+#include "WriteToFile.h"
class Menu : public QWidget
{
@@ -86,6 +87,8 @@ private:
Material* m_MaterialHandler = nullptr;
Skeleton* m_SkeletonHandler = nullptr;
+
+ WriteToFile m_File;
};
#endif
\ No newline at end of file
diff --git a/tools/MayaExporter/MayaExporter/Mesh.cpp b/tools/MayaExporter/MayaExporter/Mesh.cpp
index fa52fc8e..3965daf8 100644
--- a/tools/MayaExporter/MayaExporter/Mesh.cpp
+++ b/tools/MayaExporter/MayaExporter/Mesh.cpp
@@ -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 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);
+ //}
}
}
diff --git a/tools/MayaExporter/MayaExporter/Mesh.h b/tools/MayaExporter/MayaExporter/Mesh.h
index 0ba9624d..00b88654 100644
--- a/tools/MayaExporter/MayaExporter/Mesh.h
+++ b/tools/MayaExporter/MayaExporter/Mesh.h
@@ -4,13 +4,25 @@
#include