HMDL support added

This commit is contained in:
Jack Andersen 2015-11-14 13:42:58 -10:00
parent 79cf5f12ca
commit bbc977cc79
5 changed files with 23 additions and 9 deletions

View File

@ -4,6 +4,10 @@ if(MSVC)
# Shaddup MSVC # Shaddup MSVC
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__SSE__=1 -D_CRT_SECURE_NO_WARNINGS=1 -DD_SCL_SECURE_NO_WARNINGS=1 /wd4267 /wd4244 /wd4305) add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__SSE__=1 -D_CRT_SECURE_NO_WARNINGS=1 -DD_SCL_SECURE_NO_WARNINGS=1 /wd4267 /wd4244 /wd4305)
else() else()
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
message(WARNING "GCC needs -fpermissive for nested type redeclarations; expect lotsa warnings!!")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar -fno-exceptions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar -fno-exceptions")
endif() endif()

View File

@ -53,7 +53,7 @@ struct SurfaceHeader_1_2 : BigDNA
Align<32> align; Align<32> align;
static constexpr bool UseMatrixSkinning() {return false;} static constexpr bool UseMatrixSkinning() {return false;}
constexpr atInt16 skinMatrixBankIdx() const {return -1;} static constexpr atInt16 skinMatrixBankIdx() {return -1;}
}; };
struct SurfaceHeader_3 : BigDNA struct SurfaceHeader_3 : BigDNA
@ -1322,7 +1322,7 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
head.aabbMin = mesh.aabbMin.val; head.aabbMin = mesh.aabbMin.val;
head.aabbMax = mesh.aabbMax.val; head.aabbMax = mesh.aabbMax.val;
head.matSetCount = mesh.materialSets.size(); head.matSetCount = mesh.materialSets.size();
head.secCount = head.matSetCount + 5 + mesh.surfaces.size(); head.secCount = head.matSetCount + 4 + mesh.surfaces.size();
head.secSizes.reserve(head.secCount); head.secSizes.reserve(head.secCount);
/* Lengths of padding to insert while writing */ /* Lengths of padding to insert while writing */
@ -1484,6 +1484,9 @@ bool WriteHMDLCMDL(const HECL::ProjectPath& outPath, const HECL::ProjectPath& in
++padIt; ++padIt;
} }
/* Ensure final surface's alignment writes zeros */
writer.seek(-1, Athena::Current);
writer.writeUByte(0);
writer.close(); writer.close();
return true; return true;
} }

View File

@ -46,10 +46,7 @@ struct CMDL
(conn, rs, pakRouter, entry, dataSpec, loadRp); (conn, rs, pakRouter, entry, dataSpec, loadRp);
conn.saveBlend(); conn.saveBlend();
#if 1 #if 0
return true;
#endif
/* Cook and re-extract test */ /* Cook and re-extract test */
HECL::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true); HECL::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true);
HECL::BlenderConnection::DataStream ds = conn.beginData(); HECL::BlenderConnection::DataStream ds = conn.beginData();
@ -64,6 +61,16 @@ struct CMDL
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1_2, 2> DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1_2, 2>
(conn, reader, pakRouter, entry, dataSpec, loadRp); (conn, reader, pakRouter, entry, dataSpec, loadRp);
return conn.saveBlend(); return conn.saveBlend();
#elif 1
/* HMDL cook test */
HECL::ProjectPath tempOut = outPath.getWithExtension(_S(".recook"), true);
HECL::BlenderConnection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(HECL::TopologyTriStrips, 16);
ds.close();
DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_1_2, 2>(tempOut, outPath, mesh);
#endif
return true;
} }
static void Name(const SpecBase& dataSpec, static void Name(const SpecBase& dataSpec,

View File

@ -1224,8 +1224,8 @@ HMDLMaterialSet::Material::Material(HECL::Frontend::Frontend& FE,
continue; continue;
std::vector<atVec4f> gameArgs; std::vector<atVec4f> gameArgs;
gameArgs.reserve(inst.getChildCount() - 1); gameArgs.reserve(sourceInst.getChildCount() - 1);
for (int i=1 ; i<inst.getChildCount() ; ++i) for (int i=1 ; i<sourceInst.getChildCount() ; ++i)
{ {
const HECL::Frontend::IR::Instruction& ci = sourceInst.getChildInst(heclIr, i); const HECL::Frontend::IR::Instruction& ci = sourceInst.getChildInst(heclIr, i);
gameArgs.push_back(ci.getImmVec()); gameArgs.push_back(ci.getImmVec());

2
hecl

@ -1 +1 @@
Subproject commit d4460a3970f70e56248464533448169f81301ce3 Subproject commit 7cd80353038c90e84cdf8fa912f6920369bef080