#include #include "CMDL.hpp" #include "DNAMP1.hpp" namespace Retro { namespace DNAMP1 { bool CMDL::ReadToBlender(HECL::BlenderConnection& conn, Athena::io::IStreamReader& reader) { reader.setEndian(Athena::BigEndian); CMDL::Header head; head.read(reader); if (head.magic != 0xDEADBABE) { Log.report(LogVisor::Error, "invalid CMDL magic"); return false; } if (head.version != 2) { Log.report(LogVisor::Error, "invalid CMDL version for MP1"); return false; } /* Open Py Stream */ HECL::BlenderConnection::PyOutStream os = conn.beginPythonOut(); os << "import bmesh\n"; os << "bm = bmesh.new()\n"; for (size_t s=0 ; s vertPos; std::unique_ptr vertNorm; typedef atInt16 ShortVec3[3]; std::unique_ptr vertNormShort; std::unique_ptr vertUVs; typedef atInt16 ShortVec2[2]; std::unique_ptr vertUVsShort; bool visitedDLOffsets = false; if (s < head.matSetCount) { MaterialSet matSet; matSet.read(reader); } else { switch (s-head.matSetCount) { case 0: { /* Positions */ size_t vertCount = head.secSizes[s] / 12; vertPos.reset(new atVec3f[vertCount]); for (size_t i=0 ; i