Exemplo n.º 1
0
Arquivo: DCLN.cpp Projeto: AxioDL/urde
bool DCLN::Cook(const hecl::ProjectPath& outPath, const std::vector<Mesh>& meshes) {
  DCLN dcln;
  dcln.colCount = atUint32(meshes.size());
  for (const Mesh& mesh : meshes) {
    dcln.collision.emplace_back();
    Collision& colOut = dcln.collision.back();
    DeafBabeBuildFromBlender(colOut, mesh);
    colOut.root = std::move(*OBBTreeBuilder::buildCol<Collision::Node>(mesh));
    colOut.memSize = atUint32(colOut.root.getMemoryUsage());
  }

#if DCLN_DUMP_OBB
  hecl::blender::Connection& conn = hecl::blender::SharedBlenderToken.getBlenderConnection();
  conn.createBlend(outPath.getWithExtension(_SYS_STR(".blend")), hecl::blender::BlendType::ColMesh);
  dcln.sendToBlender(conn, "BLAH");
  conn.saveBlend();
#endif

  athena::io::FileWriter w(outPath.getAbsolutePath());
  dcln.write(w);
  int64_t rem = w.position() % 32;
  if (rem)
    for (int64_t i = 0; i < 32 - rem; ++i)
      w.writeUByte(0xff);
  return true;
}
Exemplo n.º 2
0
 static bool Extract(const SpecBase& dataSpec,
                     PAKEntryReadStream& rs,
                     const hecl::ProjectPath& outPath,
                     PAKRouter<PAKBridge>& pakRouter,
                     const PAK::Entry& entry,
                     bool force,
                     std::function<void(const hecl::SystemChar*)> fileChanged)
 {
     MLVL mlvl;
     mlvl.read(rs);
     FILE* fp = hecl::Fopen(outPath.getWithExtension(_S(".yaml"), true).getAbsolutePath().c_str(), _S("wb"));
     mlvl.toYAMLFile(fp);
     fclose(fp);
     hecl::BlenderConnection& conn = hecl::BlenderConnection::SharedConnection();
     return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,
                                       entry, force, fileChanged);
 }