Updated hecl

This commit is contained in:
Jack Andersen 2015-10-14 13:07:29 -10:00
parent 804f0c8b7d
commit d95e11ce3e
8 changed files with 30 additions and 33 deletions

View File

@ -1027,7 +1027,7 @@ bool ReadCMDLToBlender(HECL::BlenderConnection& conn,
template <class MaterialSet, class SurfaceHeader, atUint32 Version> template <class MaterialSet, class SurfaceHeader, atUint32 Version>
bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath, const Mesh& mesh) bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath, const Mesh& mesh)
{ {
Athena::io::FileWriter writer(outPath.getAbsolutePath()); //Athena::io::FileWriter writer(outPath.getAbsolutePath());
Header head; Header head;
head.magic = 0xDEADBABE; head.magic = 0xDEADBABE;
@ -1042,23 +1042,19 @@ bool WriteCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& inPath
/* Build material sets */ /* Build material sets */
{ {
HECL::Frontend::Frontend FE; HECL::Frontend::Frontend FE;
int setIdx = 0;
for (const std::vector<Mesh::Material>& mset : mesh.materialSets) for (const std::vector<Mesh::Material>& mset : mesh.materialSets)
{ {
int matIdx = 0;
for (const Mesh::Material& mat : mset) for (const Mesh::Material& mat : mset)
{ {
std::string diagName = HECL::SysFormat(_S("%s:%d:%d"), inPath.getLastComponent(), setIdx, matIdx); std::string diagName = HECL::Format("%s:%s", inPath.getLastComponentUTF8(), mat.name.c_str());
HECL::Frontend::IR matIR = FE.compileSource(mat.source, diagName); HECL::Frontend::IR matIR = FE.compileSource(mat.source, diagName);
HECL::Backend::GX matGX; HECL::Backend::GX matGX;
matGX.reset(matIR); matGX.reset(matIR, FE.getDiagnostics());
++matIdx;
} }
++setIdx;
} }
} }
head.write(writer); //head.write(writer);
return true; return true;

View File

@ -45,10 +45,11 @@ struct CMDL
return conn.saveBlend(); return conn.saveBlend();
} }
static bool Cook(const DNACMDL::Mesh& mesh, static bool Cook(const HECL::ProjectPath& outPath,
const HECL::ProjectPath& outPath) const HECL::ProjectPath& inPath,
const DNACMDL::Mesh& mesh)
{ {
return true; return DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(outPath, inPath, mesh);
} }
}; };

View File

@ -124,19 +124,19 @@ void SpecBase::doCook(const HECL::ProjectPath& path, const HECL::ProjectPath& co
case HECL::BlenderConnection::TypeMesh: case HECL::BlenderConnection::TypeMesh:
{ {
HECL::BlenderConnection::DataStream ds = conn.beginData(); HECL::BlenderConnection::DataStream ds = conn.beginData();
cookMesh(path, ds, cookedPath); cookMesh(cookedPath, path, ds);
break; break;
} }
case HECL::BlenderConnection::TypeActor: case HECL::BlenderConnection::TypeActor:
{ {
HECL::BlenderConnection::DataStream ds = conn.beginData(); HECL::BlenderConnection::DataStream ds = conn.beginData();
cookActor(path, ds, cookedPath); cookActor(cookedPath, path, ds);
break; break;
} }
case HECL::BlenderConnection::TypeArea: case HECL::BlenderConnection::TypeArea:
{ {
HECL::BlenderConnection::DataStream ds = conn.beginData(); HECL::BlenderConnection::DataStream ds = conn.beginData();
cookArea(path, ds, cookedPath); cookArea(cookedPath, path, ds);
break; break;
} }
default: break; default: break;
@ -145,7 +145,7 @@ void SpecBase::doCook(const HECL::ProjectPath& path, const HECL::ProjectPath& co
else if (HECL::IsPathYAML(path)) else if (HECL::IsPathYAML(path))
{ {
FILE* fp = HECL::Fopen(path.getAbsolutePath().c_str(), _S("r")); FILE* fp = HECL::Fopen(path.getAbsolutePath().c_str(), _S("r"));
cookYAML(fp, cookedPath); cookYAML(cookedPath, path, fp);
} }
} }

View File

@ -46,11 +46,11 @@ struct SpecBase : HECL::Database::IDataSpec
/* Cook handlers */ /* Cook handlers */
using BlendStream = HECL::BlenderConnection::DataStream; using BlendStream = HECL::BlenderConnection::DataStream;
using Mesh = BlendStream::Mesh; using Mesh = BlendStream::Mesh;
virtual void cookMesh(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const=0;
virtual void cookActor(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const=0;
virtual void cookArea(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const=0;
virtual void cookYAML(FILE* in, const HECL::ProjectPath& out) const=0;
virtual void cookMesh(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const=0;
virtual void cookActor(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const=0;
virtual void cookArea(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const=0;
virtual void cookYAML(const HECL::ProjectPath& out, const HECL::ProjectPath& in, FILE* fin) const=0;
const HECL::ProjectPath& getMasterShaderPath() const {return m_masterShader;} const HECL::ProjectPath& getMasterShaderPath() const {return m_masterShader;}

View File

@ -280,21 +280,21 @@ struct SpecMP1 : SpecBase
return false; return false;
} }
void cookMesh(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const void cookMesh(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const
{ {
Mesh mesh = ds.compileMesh(); Mesh mesh = ds.compileMesh();
DNAMP1::CMDL::Cook(mesh, out); DNAMP1::CMDL::Cook(out, in, mesh);
} }
void cookActor(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const void cookActor(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const
{ {
} }
void cookArea(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const void cookArea(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const
{ {
} }
void cookYAML(FILE* in, const HECL::ProjectPath& out) const void cookYAML(const HECL::ProjectPath& out, const HECL::ProjectPath& in, FILE* fin) const
{ {
} }
}; };

View File

@ -270,19 +270,19 @@ struct SpecMP2 : SpecBase
return false; return false;
} }
void cookMesh(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const void cookMesh(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const
{ {
} }
void cookActor(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const void cookActor(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const
{ {
} }
void cookArea(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const void cookArea(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const
{ {
} }
void cookYAML(FILE* in, const HECL::ProjectPath& out) const void cookYAML(const HECL::ProjectPath& out, const HECL::ProjectPath& in, FILE* fin) const
{ {
} }
}; };

View File

@ -453,19 +453,19 @@ struct SpecMP3 : SpecBase
return false; return false;
} }
void cookMesh(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const void cookMesh(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const
{ {
} }
void cookActor(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const void cookActor(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const
{ {
} }
void cookArea(const HECL::ProjectPath& in, BlendStream& ds, const HECL::ProjectPath& out) const void cookArea(const HECL::ProjectPath& out, const HECL::ProjectPath& in, BlendStream& ds) const
{ {
} }
void cookYAML(FILE* in, const HECL::ProjectPath& out) const void cookYAML(const HECL::ProjectPath& out, const HECL::ProjectPath& in, FILE* fin) const
{ {
} }
}; };

2
hecl

@ -1 +1 @@
Subproject commit abb371d22ba32982f87c174d494756e0477c21c1 Subproject commit 18f692317a8b043fbf52bad6efffd043ae7a352d