Importing custom mesh without material.

This commit is contained in:
antc13
2016-01-18 19:37:55 +01:00
parent 16c39df439
commit 2a3009212a
21 changed files with 402 additions and 248 deletions
+64 -5
View File
@@ -5,21 +5,80 @@
#include <array>
#include <algorithm>
#include <cmath>
#include <map>
#include "MayaIncludes.h"
#include "OutputData.h"
#include "Mesh.h"
struct MaterialNode
class MaterialNode : public OutputData
{
public:
std::string Name;
std::array<float, 4> Color;
std::array<float, 3> Incandescence;
std::array<float, 3> Specular;
float ReflectionFactor;
float SpecularExponent;
float SpecularExponent;
unsigned int ColorMapFileLength = 0;
std::string ColorMapFile;
unsigned int SpecularMapFileLength = 0;
std::string SpecularMapFile;
unsigned int NormalMapFileLength = 0;
std::string NormalMapFile;
unsigned int IncandescenceMapFileLength = 0;
std::string IncandescenceMapFile;
unsigned int IndexStart;
unsigned int IndexEnd;
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*)&ReflectionFactor, sizeof(float));
out.write((char*)&IndexStart, sizeof(unsigned int));
out.write((char*)&IndexEnd, sizeof(unsigned int));
out.write(ColorMapFile.c_str(), ColorMapFileLength);
out.write(NormalMapFile.c_str(), NormalMapFileLength);
out.write(SpecularMapFile.c_str(), SpecularMapFileLength);
out.write(IncandescenceMapFile.c_str(), IncandescenceMapFileLength);
}
virtual void WriteASCII(std::ostream& out) const
{
out << "New Material _ 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 << "ReflectionFactor: " << ReflectionFactor << endl;
out << "IndexStart: " << IndexStart << endl;
out << "IndexEnd: " << IndexEnd << endl;
out << "ColorMapFile length: " << ColorMapFileLength << endl;
if (ColorMapFileLength > 0)
out << "ColorMapFile: " << ColorMapFile << endl;
if (NormalMapFileLength > 0)
out << "NormalMapFile: " << NormalMapFile << endl;
if (SpecularMapFileLength > 0)
out << "SpecularMapFile: " << SpecularMapFile << endl;
if (IncandescenceMapFileLength > 0)
out << "IncandescenceMapFile: " << IncandescenceMapFile << endl;
}
};
class Material