MCPcopy Create free account
hub / github.com/OpenNFS/OpenNFS / DumpToObj

Function DumpToObj

src/Loaders/nfs2_loader.cpp:9–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7using namespace TrackUtils;
8
9void DumpToObj(int block_Idx, PS1::GEO::BLOCK_HEADER *geoBlockHeader, PS1::GEO::BLOCK_3D *vertices, PS1::GEO::BLOCK_3D *normals, PS1::GEO::POLY_3D *polygons) {
10 std::ofstream obj_dump;
11 std::stringstream obj_name;
12 obj_name << "./assets/psx_test/ps1_geo_" << block_Idx << ".obj";
13 obj_dump.open(obj_name.str());
14
15 /* Print Part name*/
16 obj_dump << "o " << "PS1_Test" << std::endl;
17 for (uint32_t i = 0; i < geoBlockHeader->nVerts; ++i) {
18 obj_dump << "v " << vertices[i].x << " " << vertices[i].y << " " << vertices[i].z << std::endl;
19 }
20
21 // TODO: How can these be normals if there aren't enough for Per vertex? On PSX they're likely per polygon
22 for (uint32_t i = 0; i < geoBlockHeader->nNormals; ++i) {
23 obj_dump << "vn " << normals[i].x << " " << normals[i].y << " " << normals[i].z << std::endl;
24 }
25
26 obj_dump.close();
27}
28
29template<>
30std::vector<CarModel> NFS2<PC>::LoadGEO(const std::string &geo_path, std::map<unsigned int, Texture> car_textures, std::map<std::string, uint32_t> remapped_texture_ids) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected