WIP, commit to be able to pull stuff down
This commit is contained in:
@@ -18,7 +18,7 @@ public:
|
|||||||
const glm::mat4& Matrix() const { return m_RawModel->m_Matrix; }
|
const glm::mat4& Matrix() const { return m_RawModel->m_Matrix; }
|
||||||
const RawModel::Vertex* Vertices() const { return m_RawModel->Vertices(); }
|
const RawModel::Vertex* Vertices() const { return m_RawModel->Vertices(); }
|
||||||
unsigned int NumberOfVertices() const { return m_RawModel->NumVertices(); }
|
unsigned int NumberOfVertices() const { return m_RawModel->NumVertices(); }
|
||||||
bool isSkined() const { return m_RawModel->isSkined; }
|
bool isSkined() const { return m_RawModel->isSkined(); }
|
||||||
GLuint VAO;
|
GLuint VAO;
|
||||||
GLuint ElementBuffer;
|
GLuint ElementBuffer;
|
||||||
RawModel* m_RawModel;
|
RawModel* m_RawModel;
|
||||||
|
|||||||
@@ -68,30 +68,41 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Vertex* Vertices() const {
|
const Vertex* Vertices() const {
|
||||||
if (isSkined) {
|
if (hasSkin) {
|
||||||
return m_SkinedVertices.data();
|
return m_SkinedVertices.data();
|
||||||
} else {
|
} else {
|
||||||
return m_Vertices.data();
|
return m_Vertices.data();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
unsigned int VertexSize() const {
|
||||||
|
if (hasSkin) {
|
||||||
|
return sizeof(SkinedVertex);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return sizeof(Vertex);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
unsigned int NumVertices() const {
|
unsigned int NumVertices() const {
|
||||||
if (isSkined) {
|
if (hasSkin) {
|
||||||
return m_SkinedVertices.size();
|
return m_SkinedVertices.size();
|
||||||
} else {
|
} else {
|
||||||
return m_Vertices.size();
|
return m_Vertices.size();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool isSkined() const { return hasSkin; };
|
||||||
|
|
||||||
std::vector<MaterialGroup> MaterialGroups;
|
std::vector<MaterialGroup> MaterialGroups;
|
||||||
bool isSkined;
|
|
||||||
|
|
||||||
std::vector<unsigned int> m_Indices;
|
std::vector<unsigned int> m_Indices;
|
||||||
Skeleton* m_Skeleton = nullptr;
|
Skeleton* m_Skeleton = nullptr;
|
||||||
glm::mat4 m_Matrix;
|
glm::mat4 m_Matrix;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool hasSkin;
|
||||||
std::vector<Vertex> m_Vertices;
|
std::vector<Vertex> m_Vertices;
|
||||||
std::vector<SkinedVertex> m_SkinedVertices;
|
std::vector<SkinedVertex> m_SkinedVertices;
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,7 @@ Model::Model(std::string fileName)
|
|||||||
glGenBuffers(1, &buffer);
|
glGenBuffers(1, &buffer);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||||
|
|
||||||
if (m_RawModel->isSkined) {
|
glBufferData(GL_ARRAY_BUFFER, m_RawModel->NumVertices() * m_RawModel->VertexSize(), m_RawModel->Vertices(), GL_STATIC_DRAW);
|
||||||
glBufferData(GL_ARRAY_BUFFER, m_RawModel->NumVertices() * sizeof(RawModel::SkinedVertex), m_RawModel->Vertices(), GL_STATIC_DRAW);
|
|
||||||
} else {
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, m_RawModel->NumVertices() * sizeof(RawModel::Vertex), m_RawModel->Vertices(), GL_STATIC_DRAW);
|
|
||||||
}
|
|
||||||
|
|
||||||
glGenBuffers(1, &ElementBuffer);
|
glGenBuffers(1, &ElementBuffer);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ElementBuffer);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ElementBuffer);
|
||||||
@@ -41,7 +37,7 @@ Model::Model(std::string fileName)
|
|||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||||
std::vector<int> structSizes;
|
std::vector<int> structSizes;
|
||||||
if (m_RawModel->isSkined) {
|
if (m_RawModel->isSkined()) {
|
||||||
structSizes = { 3, 3, 3, 3, 2, 4, 4 };
|
structSizes = { 3, 3, 3, 3, 2, 4, 4 };
|
||||||
} else {
|
} else {
|
||||||
structSizes = { 3, 3, 3, 3, 2 };
|
structSizes = { 3, 3, 3, 3, 2 };
|
||||||
@@ -60,7 +56,7 @@ Model::Model(std::string fileName)
|
|||||||
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
||||||
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
||||||
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
||||||
if (m_RawModel->isSkined) {
|
if (m_RawModel->isSkined()) {
|
||||||
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
||||||
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
glVertexAttribPointer(element, structSizes[element], GL_FLOAT, GL_FALSE, stride, (GLvoid*)(sizeof(GLfloat) * (offset += structSizes[element - 1]))); element++;
|
||||||
}
|
}
|
||||||
@@ -72,7 +68,7 @@ Model::Model(std::string fileName)
|
|||||||
glEnableVertexAttribArray(2);
|
glEnableVertexAttribArray(2);
|
||||||
glEnableVertexAttribArray(3);
|
glEnableVertexAttribArray(3);
|
||||||
glEnableVertexAttribArray(4);
|
glEnableVertexAttribArray(4);
|
||||||
if (m_RawModel->isSkined) {
|
if (m_RawModel->isSkined()) {
|
||||||
glEnableVertexAttribArray(5);
|
glEnableVertexAttribArray(5);
|
||||||
glEnableVertexAttribArray(6);
|
glEnableVertexAttribArray(6);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ void RawModelCustom::ReadMeshFile(std::string filePath)
|
|||||||
void RawModelCustom::ReadMeshFileHeader(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
void RawModelCustom::ReadMeshFileHeader(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
||||||
{
|
{
|
||||||
#ifdef BOOST_LITTLE_ENDIAN
|
#ifdef BOOST_LITTLE_ENDIAN
|
||||||
isSkined = *(unsigned int*)(fileData + offset);
|
hasSkin = *(bool*)(fileData + offset);
|
||||||
offset += sizeof(bool);
|
offset += sizeof(bool);
|
||||||
if (isSkined) {
|
if (hasSkin) {
|
||||||
m_SkinedVertices.resize(*(unsigned int*)(fileData + offset));
|
m_SkinedVertices.resize(*(unsigned int*)(fileData + offset));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -64,7 +64,7 @@ void RawModelCustom::ReadMesh(unsigned int& offset, char* fileData, unsigned int
|
|||||||
void RawModelCustom::ReadVertices(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
void RawModelCustom::ReadVertices(unsigned int& offset, char* fileData, unsigned int& fileByteSize)
|
||||||
{
|
{
|
||||||
#ifdef BOOST_LITTLE_ENDIAN
|
#ifdef BOOST_LITTLE_ENDIAN
|
||||||
if (isSkined) {
|
if (hasSkin) {
|
||||||
if (offset + m_SkinedVertices.size() * sizeof(SkinedVertex) > fileByteSize) {
|
if (offset + m_SkinedVertices.size() * sizeof(SkinedVertex) > fileByteSize) {
|
||||||
throw Resource::FailedLoadingException("Reading skined vertices failed");
|
throw Resource::FailedLoadingException("Reading skined vertices failed");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,9 +82,16 @@ bool Material::findColorTexture(MaterialNode& material_node, MFnDependencyNode&
|
|||||||
workspace);
|
workspace);
|
||||||
FullPath = FullPath.substr(workspace.length());
|
FullPath = FullPath.substr(workspace.length());
|
||||||
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
||||||
material_node.ColorMapFile = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
|
||||||
|
|
||||||
material_node.ColorMapFileLength = material_node.ColorMapFile.length() + 1;
|
MaterialNode::Texture newTexture;
|
||||||
|
|
||||||
|
newTexture.FileName = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||||
|
newTexture.FileNameLength = newTexture.FileName.length() + 1;
|
||||||
|
|
||||||
|
newTexture.UVTiling[0] = TextureNode.findPlug("RepeatU").asFloat();
|
||||||
|
newTexture.UVTiling[1] = TextureNode.findPlug("RepeatV").asFloat();
|
||||||
|
|
||||||
|
material_node.ColorMaps.push_back(newTexture);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,8 +124,16 @@ bool Material::findNormalTexture(MaterialNode& material_node, MFnDependencyNode&
|
|||||||
workspace);
|
workspace);
|
||||||
FullPath = FullPath.substr(workspace.length());
|
FullPath = FullPath.substr(workspace.length());
|
||||||
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
||||||
material_node.NormalMapFile = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
|
||||||
material_node.NormalMapFileLength = material_node.NormalMapFile.length() + 1;
|
MaterialNode::Texture newTexture;
|
||||||
|
|
||||||
|
newTexture.FileName = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||||
|
newTexture.FileNameLength = newTexture.FileName.length() + 1;
|
||||||
|
|
||||||
|
newTexture.UVTiling[0] = TextureNode.findPlug("RepeatU").asFloat();
|
||||||
|
newTexture.UVTiling[1] = TextureNode.findPlug("RepeatV").asFloat();
|
||||||
|
|
||||||
|
material_node.NormalMaps.push_back(newTexture);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,8 +162,16 @@ bool Material::findSpecularTexture(MaterialNode& material_node, MFnDependencyNod
|
|||||||
workspace);
|
workspace);
|
||||||
FullPath = FullPath.substr(workspace.length());
|
FullPath = FullPath.substr(workspace.length());
|
||||||
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
||||||
material_node.SpecularMapFile = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
|
||||||
material_node.SpecularMapFileLength = material_node.SpecularMapFile.length() + 1;
|
MaterialNode::Texture newTexture;
|
||||||
|
|
||||||
|
newTexture.FileName = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||||
|
newTexture.FileNameLength = newTexture.FileName.length() + 1;
|
||||||
|
|
||||||
|
newTexture.UVTiling[0] = TextureNode.findPlug("RepeatU").asFloat();
|
||||||
|
newTexture.UVTiling[1] = TextureNode.findPlug("RepeatV").asFloat();
|
||||||
|
|
||||||
|
material_node.SpecularMaps.push_back(newTexture);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,14 +197,29 @@ bool Material::findIncandescenceTexture(MaterialNode& material_node, MFnDependen
|
|||||||
workspace);
|
workspace);
|
||||||
FullPath = FullPath.substr(workspace.length());
|
FullPath = FullPath.substr(workspace.length());
|
||||||
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
FullPath = FullPath.substr(FullPath.find_first_of("/") + 1);
|
||||||
material_node.IncandescenceMapFile = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
|
||||||
material_node.IncandescenceMapFileLength = material_node.IncandescenceMapFile.length() + 1;
|
MaterialNode::Texture newTexture;
|
||||||
|
|
||||||
|
newTexture.FileName = FullPath.erase(FullPath.find_last_of("."), FullPath.find_last_of(".") - FullPath.size());
|
||||||
|
newTexture.FileNameLength = newTexture.FileName.length() + 1;
|
||||||
|
|
||||||
|
newTexture.UVTiling[0] = TextureNode.findPlug("RepeatU").asFloat();
|
||||||
|
newTexture.UVTiling[1] = TextureNode.findPlug("RepeatV").asFloat();
|
||||||
|
|
||||||
|
material_node.IncandescenceMaps.push_back(newTexture);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
||||||
|
return findSplatTextures(material_node.IncandescenceMaps, MFnDependencyNode(AllConnections[i].node()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Material::findSplatTextures(std::vector<MaterialNode::Texture>& textureVector, MFnDependencyNode& node) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the absolute path for all textures. Use for copying texture files.
|
// Returns the absolute path for all textures. Use for copying texture files.
|
||||||
std::vector<std::string>* Material::TexturePaths()
|
std::vector<std::string>* Material::TexturePaths()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,51 +11,87 @@
|
|||||||
#include "OutputData.h"
|
#include "OutputData.h"
|
||||||
#include "Mesh.h"
|
#include "Mesh.h"
|
||||||
|
|
||||||
|
|
||||||
|
//#define ColorMapSplat 1
|
||||||
|
//#define SpecularMapSplat 1 << 1
|
||||||
|
//#define NormalMapSplat 1 << 2
|
||||||
|
//#define IncandescenceMapSplat 1 << 3
|
||||||
|
|
||||||
class MaterialNode : public OutputData
|
class MaterialNode : public OutputData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
class Texture : public OutputData {
|
||||||
|
public:
|
||||||
|
unsigned int FileNameLength = 0;
|
||||||
|
std::string FileName;
|
||||||
|
float UVTiling[2]{ 1.0f, 1.0f };
|
||||||
|
|
||||||
|
virtual void WriteBinary(std::ostream& out)
|
||||||
|
{
|
||||||
|
out.write((char*)&FileNameLength, sizeof(unsigned int));
|
||||||
|
out.write(FileName.c_str(), FileNameLength);
|
||||||
|
out.write((char*)&UVTiling, sizeof(float) * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void WriteASCII(std::ostream& out) const
|
||||||
|
{
|
||||||
|
out << "FileNameLength: " << FileNameLength << endl;
|
||||||
|
out << "FileName: " << FileName << endl;
|
||||||
|
out << "UV tiling: " << UVTiling[0] << " " << UVTiling[1] << endl;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
std::string Name;
|
std::string Name;
|
||||||
|
|
||||||
float ReflectionFactor;
|
float ReflectionFactor;
|
||||||
float SpecularExponent;
|
float SpecularExponent;
|
||||||
|
|
||||||
float DiffuseColor[3]{ 1.0f, 1.0f, 1.0f };
|
float DiffuseColor[3]{ 1.0f, 1.0f, 1.0f };
|
||||||
unsigned int ColorMapFileLength = 0;
|
float SpecularColor[3]{ 1.0f, 1.0f, 1.0f };
|
||||||
std::string ColorMapFile;
|
float IncandescenceColor[3]{ 1.0f, 1.0f, 1.0f };
|
||||||
|
|
||||||
float SpecularColor[3]{ 1.0f, 1.0f, 1.0f };
|
unsigned int IndexStart;
|
||||||
unsigned int SpecularMapFileLength = 0;
|
unsigned int IndexEnd;
|
||||||
std::string SpecularMapFile;
|
|
||||||
|
|
||||||
unsigned int NormalMapFileLength = 0;
|
char NumColormaps = 0;
|
||||||
std::string NormalMapFile;
|
char NumSpecularMap = 0;
|
||||||
|
char NumNormalMap = 0;
|
||||||
|
char NumIncandescenceMap = 0;
|
||||||
|
|
||||||
float IncandescenceColor[3]{ 1.0f, 1.0f, 1.0f };
|
std::vector<Texture> ColorMaps;
|
||||||
unsigned int IncandescenceMapFileLength = 0;
|
std::vector<Texture> SpecularMaps;
|
||||||
std::string IncandescenceMapFile;
|
std::vector<Texture> NormalMaps;
|
||||||
|
std::vector<Texture> IncandescenceMaps;
|
||||||
unsigned int IndexStart;
|
|
||||||
unsigned int IndexEnd;
|
|
||||||
|
|
||||||
virtual void WriteBinary(std::ostream& out)
|
virtual void WriteBinary(std::ostream& out)
|
||||||
{
|
{
|
||||||
out.write((char*)&ColorMapFileLength, sizeof(unsigned int));
|
|
||||||
out.write((char*)&NormalMapFileLength, sizeof(unsigned int));
|
|
||||||
out.write((char*)&SpecularMapFileLength, sizeof(unsigned int));
|
|
||||||
out.write((char*)&IncandescenceMapFileLength, sizeof(unsigned int));
|
|
||||||
|
|
||||||
out.write((char*)&SpecularExponent, sizeof(float));
|
out.write((char*)&SpecularExponent, sizeof(float));
|
||||||
out.write((char*)&ReflectionFactor, sizeof(float));
|
out.write((char*)&ReflectionFactor, sizeof(float));
|
||||||
|
|
||||||
out.write((char*)&DiffuseColor, sizeof(float) * 3);
|
out.write((char*)&DiffuseColor, sizeof(float) * 3);
|
||||||
out.write((char*)&SpecularColor, sizeof(float) * 3);
|
out.write((char*)&SpecularColor, sizeof(float) * 3);
|
||||||
out.write((char*)&IncandescenceColor, sizeof(float) * 3);
|
out.write((char*)&IncandescenceColor, sizeof(float) * 3);
|
||||||
|
|
||||||
out.write((char*)&IndexStart, sizeof(unsigned int));
|
out.write((char*)&IndexStart, sizeof(unsigned int));
|
||||||
out.write((char*)&IndexEnd, sizeof(unsigned int));
|
out.write((char*)&IndexEnd, sizeof(unsigned int));
|
||||||
|
|
||||||
out.write(ColorMapFile.c_str(), ColorMapFileLength);
|
out.write((char*)&NumColormaps, sizeof(char));
|
||||||
out.write(NormalMapFile.c_str(), NormalMapFileLength);
|
out.write((char*)&NumSpecularMap, sizeof(char));
|
||||||
out.write(SpecularMapFile.c_str(), SpecularMapFileLength);
|
out.write((char*)&NumNormalMap, sizeof(char));
|
||||||
out.write(IncandescenceMapFile.c_str(), IncandescenceMapFileLength);
|
out.write((char*)&NumIncandescenceMap, sizeof(char));
|
||||||
|
|
||||||
|
for(auto aTexture : ColorMaps) {
|
||||||
|
aTexture.WriteBinary(out);
|
||||||
|
}
|
||||||
|
for (auto aTexture : SpecularMaps) {
|
||||||
|
aTexture.WriteBinary(out);
|
||||||
|
}
|
||||||
|
for (auto aTexture : NormalMaps) {
|
||||||
|
aTexture.WriteBinary(out);
|
||||||
|
}
|
||||||
|
for (auto aTexture : IncandescenceMaps) {
|
||||||
|
aTexture.WriteBinary(out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void WriteASCII(std::ostream& out) const
|
virtual void WriteASCII(std::ostream& out) const
|
||||||
@@ -63,11 +99,6 @@ public:
|
|||||||
out << "New Material _ not in binary" << endl;
|
out << "New Material _ not in binary" << endl;
|
||||||
out << "number of indices: " << Name << " _ not in binary" << endl;
|
out << "number of indices: " << Name << " _ not in binary" << endl;
|
||||||
|
|
||||||
out << "ColorMapFile length: " << ColorMapFileLength << endl;
|
|
||||||
out << "NormalMapFile length: " << NormalMapFileLength << endl;
|
|
||||||
out << "SpecularMapFile length: " << SpecularMapFileLength << endl;
|
|
||||||
out << "IncandescenceMapFile length: " << IncandescenceMapFileLength << endl;
|
|
||||||
|
|
||||||
out << "SpecularExponent: " << SpecularExponent << endl;
|
out << "SpecularExponent: " << SpecularExponent << endl;
|
||||||
out << "ReflectionFactor: " << ReflectionFactor << endl;
|
out << "ReflectionFactor: " << ReflectionFactor << endl;
|
||||||
out << "DiffuseColor: " << DiffuseColor[0] << " " << DiffuseColor[1] << " " << DiffuseColor[2] << endl;
|
out << "DiffuseColor: " << DiffuseColor[0] << " " << DiffuseColor[1] << " " << DiffuseColor[2] << endl;
|
||||||
@@ -76,17 +107,37 @@ public:
|
|||||||
out << "IndexStart: " << IndexStart << endl;
|
out << "IndexStart: " << IndexStart << endl;
|
||||||
out << "IndexEnd: " << IndexEnd << endl;
|
out << "IndexEnd: " << IndexEnd << endl;
|
||||||
|
|
||||||
if (ColorMapFileLength > 0)
|
if (NumColormaps > 0)
|
||||||
out << "ColorMapFile: " << ColorMapFile << endl;
|
out << "NumColormaps: " << NumColormaps << endl;
|
||||||
|
|
||||||
if (NormalMapFileLength > 0)
|
if (NumSpecularMap > 0)
|
||||||
out << "NormalMapFile: " << NormalMapFile << endl;
|
out << "NumSpecularMap: " << NumSpecularMap << endl;
|
||||||
|
|
||||||
if (SpecularMapFileLength > 0)
|
if (NumNormalMap > 0)
|
||||||
out << "SpecularMapFile: " << SpecularMapFile << endl;
|
out << "NumNormalMap: " << NumNormalMap << endl;
|
||||||
|
|
||||||
if (IncandescenceMapFileLength > 0)
|
if (NumIncandescenceMap > 0)
|
||||||
out << "IncandescenceMapFile: " << IncandescenceMapFile << endl;
|
out << "NumIncandescenceMap: " << NumIncandescenceMap << endl;
|
||||||
|
|
||||||
|
out << "ColorMaps _ not in binary " << endl;
|
||||||
|
for (auto aTexture : ColorMaps) {
|
||||||
|
aTexture.WriteASCII(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
out << "SpecularMaps _ not in binary " << endl;
|
||||||
|
for (auto aTexture : SpecularMaps) {
|
||||||
|
aTexture.WriteASCII(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
out << "NormalMaps _ not in binary " << endl;
|
||||||
|
for (auto aTexture : NormalMaps) {
|
||||||
|
aTexture.WriteASCII(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
out << "IncandescenceMaps _ not in binary " << endl;
|
||||||
|
for (auto aTexture : IncandescenceMaps) {
|
||||||
|
aTexture.WriteASCII(out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -107,6 +158,7 @@ private:
|
|||||||
bool findNormalTexture(MaterialNode& material_node, MFnDependencyNode& node);
|
bool findNormalTexture(MaterialNode& material_node, MFnDependencyNode& node);
|
||||||
bool findSpecularTexture(MaterialNode& material_node, MFnDependencyNode& node);
|
bool findSpecularTexture(MaterialNode& material_node, MFnDependencyNode& node);
|
||||||
bool findIncandescenceTexture(MaterialNode& material_node, MFnDependencyNode& node);
|
bool findIncandescenceTexture(MaterialNode& material_node, MFnDependencyNode& node);
|
||||||
|
bool findSplatTextures(std::vector<MaterialNode::Texture>& textureVector, MFnDependencyNode& node);
|
||||||
void grabLambertProperties(MaterialNode& material_node, MFnDependencyNode& node);
|
void grabLambertProperties(MaterialNode& material_node, MFnDependencyNode& node);
|
||||||
void grabBlinnProperties(MaterialNode& material_node, MFnDependencyNode& node);
|
void grabBlinnProperties(MaterialNode& material_node, MFnDependencyNode& node);
|
||||||
void grabPhongProperties(MaterialNode& material_node, MFnDependencyNode& node);
|
void grabPhongProperties(MaterialNode& material_node, MFnDependencyNode& node);
|
||||||
|
|||||||
@@ -40,8 +40,9 @@
|
|||||||
<PlatformToolset>v140</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
@@ -77,6 +78,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<TargetExt>.mll</TargetExt>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@@ -135,7 +137,7 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>NDEBUG;QT_DLL;QT_NO_DEBUG;QT_NO_IMPORT_QT47_QML;UNICODE;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;QT_DLL;QT_NO_DEBUG;QT_NO_IMPORT_QT47_QML;UNICODE;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>C:\Program Files\Autodesk\Maya2016\include;.\GeneratedFiles;.\GeneratedFiles\$(ConfigurationName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<DebugInformationFormat>
|
<DebugInformationFormat>
|
||||||
</DebugInformationFormat>
|
</DebugInformationFormat>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
@@ -144,7 +146,7 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
|
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||||
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>qtmain.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>qtmain.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
|||||||
@@ -228,8 +228,7 @@ Animation Skeleton::GetAnimData(std::string animationName, int startFrame, int e
|
|||||||
unsigned int jointID = 0;
|
unsigned int jointID = 0;
|
||||||
while (!jointIt.isDone()) {
|
while (!jointIt.isDone()) {
|
||||||
MFnTransform thisJoint(jointIt.currentItem());
|
MFnTransform thisJoint(jointIt.currentItem());
|
||||||
MMatrix transformationMatrix = thisJoint.transformationMatrix();
|
MTransformationMatrix TransformationMatrix = thisJoint.transformationMatrix();
|
||||||
|
|
||||||
double doubleMat[4][4];
|
double doubleMat[4][4];
|
||||||
|
|
||||||
if (currentFrame != startFrame){
|
if (currentFrame != startFrame){
|
||||||
@@ -263,6 +262,7 @@ Animation Skeleton::GetAnimData(std::string animationName, int startFrame, int e
|
|||||||
|
|
||||||
transformationMatrix.get(doubleMat);
|
transformationMatrix.get(doubleMat);
|
||||||
|
|
||||||
|
//Save transformationMatrix to joinCheckMap
|
||||||
joinCheckMap[thisJoint.name().asChar()][0][0] = doubleMat[0][0];
|
joinCheckMap[thisJoint.name().asChar()][0][0] = doubleMat[0][0];
|
||||||
joinCheckMap[thisJoint.name().asChar()][0][1] = doubleMat[0][1];
|
joinCheckMap[thisJoint.name().asChar()][0][1] = doubleMat[0][1];
|
||||||
joinCheckMap[thisJoint.name().asChar()][0][2] = doubleMat[0][2];
|
joinCheckMap[thisJoint.name().asChar()][0][2] = doubleMat[0][2];
|
||||||
@@ -280,32 +280,32 @@ Animation Skeleton::GetAnimData(std::string animationName, int startFrame, int e
|
|||||||
joinCheckMap[thisJoint.name().asChar()][3][2] = doubleMat[3][2];
|
joinCheckMap[thisJoint.name().asChar()][3][2] = doubleMat[3][2];
|
||||||
joinCheckMap[thisJoint.name().asChar()][3][3] = doubleMat[3][3];
|
joinCheckMap[thisJoint.name().asChar()][3][3] = doubleMat[3][3];
|
||||||
|
|
||||||
MPlug thisJointBindPose = thisJoint.findPlug("bindPose");
|
if (currentFrame == startFrame) {
|
||||||
MDataHandle DataHandle;
|
MPlug thisJointBindPose = thisJoint.findPlug("bindPose");
|
||||||
thisJointBindPose.getValue(DataHandle);
|
MDataHandle DataHandle;
|
||||||
MFnMatrixData MartixFn(DataHandle.data());
|
thisJointBindPose.getValue(DataHandle);
|
||||||
MMatrix thisJointBindPoseMatrix = MartixFn.matrix();
|
MFnMatrixData MartixFn(DataHandle.data());
|
||||||
|
MMatrix thisJointBindPoseMatrix = MartixFn.matrix();
|
||||||
|
|
||||||
MFnTransform Parent(thisJoint.parent(0), &status);
|
MFnTransform Parent(thisJoint.parent(0), &status);
|
||||||
if (status == MS::kSuccess && thisJoint.parent(0).apiType() == MFn::kJoint) {
|
if (status == MS::kSuccess && thisJoint.parent(0).apiType() == MFn::kJoint) {
|
||||||
MTransformationMatrix Matrix = Parent.transformation();
|
MTransformationMatrix Matrix = Parent.transformation();
|
||||||
MPlug parentBindPose = Parent.findPlug("bindPose");
|
MPlug parentBindPose = Parent.findPlug("bindPose");
|
||||||
MDataHandle DataHandle;
|
MDataHandle DataHandle;
|
||||||
parentBindPose.getValue(DataHandle);
|
parentBindPose.getValue(DataHandle);
|
||||||
MFnMatrixData MartixFn(DataHandle.data());
|
MFnMatrixData MartixFn(DataHandle.data());
|
||||||
MMatrix parentBindPoseMatrix = MartixFn.matrix();
|
MMatrix parentBindPoseMatrix = MartixFn.matrix();
|
||||||
|
|
||||||
thisJointBindPoseMatrix = thisJointBindPoseMatrix * parentBindPoseMatrix.inverse();
|
thisJointBindPoseMatrix = thisJointBindPoseMatrix * parentBindPoseMatrix.inverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
MTransformationMatrix TransformationMatrix = thisJoint.transformation();
|
if (thisJointBindPoseMatrix.isEquivalent(TransformationMatrix.asMatrix())) {
|
||||||
|
jointID++;
|
||||||
if (thisJointBindPoseMatrix.isEquivalent(TransformationMatrix.asMatrix())) {
|
jointIt.next();
|
||||||
jointID++;
|
MGlobal::displayError(MString() + thisJoint.name() + " is in bindPose");
|
||||||
jointIt.next();
|
continue;
|
||||||
MGlobal::displayError(MString() + thisJoint.name() + " is in bindPose");
|
}
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
MObject jointOrientObj = thisJoint.attribute("jointOrient");
|
MObject jointOrientObj = thisJoint.attribute("jointOrient");
|
||||||
MFnNumericAttribute jointOrient(jointOrientObj);
|
MFnNumericAttribute jointOrient(jointOrientObj);
|
||||||
|
|||||||
Reference in New Issue
Block a user