diff options
Diffstat (limited to 'ZAPD/ZDisplayList.cpp')
| -rw-r--r-- | ZAPD/ZDisplayList.cpp | 471 |
1 files changed, 159 insertions, 312 deletions
diff --git a/ZAPD/ZDisplayList.cpp b/ZAPD/ZDisplayList.cpp index fafdd99..9d71bff 100644 --- a/ZAPD/ZDisplayList.cpp +++ b/ZAPD/ZDisplayList.cpp @@ -34,20 +34,12 @@ ZDisplayList::ZDisplayList(ZFile* nParent) : ZResource(nParent) fileData = vector<uint8_t>(); instructions = vector<uint64_t>(); - vertices = map<uint32_t, vector<Vertex>>(); vtxDeclarations = map<uint32_t, string>(); otherDLists = vector<ZDisplayList*>(); - textures = map<uint32_t, ZTexture*>(); - texDeclarations = map<uint32_t, std::string>(); } ZDisplayList::~ZDisplayList() { - for (auto t : textures) - { - delete t.second; - } - for (auto o : otherDLists) { delete o; @@ -62,7 +54,6 @@ void ZDisplayList::ExtractFromXML(tinyxml2::XMLElement* reader, rawDataIndex = nRawDataIndex; ParseXML(reader); - // name = reader->Attribute("Name"); fileData = nRawData; int32_t rawDataSize = ZDisplayList::GetDListLength( nRawData, rawDataIndex, @@ -511,36 +502,19 @@ int32_t ZDisplayList::OptimizationCheck_LoadTextureBlock(int32_t startIndex, str texAddr = Seg2Filespace(data, parent->baseAddress); int32_t segmentNumber = GETSEGNUM(data); - lastTexSeg = (data & 0xFF000000); - - Declaration* texDecl = nullptr; + lastTexSeg = segmentNumber; - if (parent != nullptr && - segmentNumber != 2) // HACK: Until we have declarations use segment addresses, - // we'll exclude scene references... - { - texDecl = parent->GetDeclaration(texAddr); - - if (texDecl == nullptr) - texDecl = parent->GetDeclaration(data); - } + ZFile* auxParent = parent; + if (parent->segment != segmentNumber && Globals::Instance->HasSegment(segmentNumber)) + auxParent = Globals::Instance->segmentRefFiles.at(segmentNumber); - if (texAddr != 0) - { - if (texDecl != nullptr) - texStr = StringHelper::Sprintf("%s", texDecl->varName.c_str()); - else if (segmentNumber == 2) - texStr = StringHelper::Sprintf("%sTex_%06X", scene->GetName().c_str(), texAddr); - else if (!Globals::Instance->HasSegment( - segmentNumber)) // Probably an external asset we are unable to track - texStr = StringHelper::Sprintf("0x%06X", data); - else - texStr = StringHelper::Sprintf("%sTex_%06X", prefix.c_str(), texAddr); - } - else if (segmentNumber != 3) - texStr = StringHelper::Sprintf("0x%06X", data); + Declaration* decl = auxParent->GetDeclaration(texAddr); + if (Globals::Instance->HasSegment(segmentNumber) && decl != nullptr) + texStr = decl->varName; + else if (lastTexture != nullptr) + texStr = lastTexture->GetName(); else - texStr = StringHelper::Sprintf("0"); + texStr = auxParent->GetDeclarationPtrName(data & 0xFFFFFFFF); } // gsDPSetTile @@ -879,12 +853,15 @@ void ZDisplayList::Opcode_G_VTX(uint64_t data, char* line) if (nn > 0) { - vector<Vertex> vtxList = vector<Vertex>(); + std::vector<ZVtx> vtxList; vtxList.reserve(nn); for (int32_t i = 0; i < nn; i++) { - Vertex vtx = Vertex(fileData, currentPtr); + ZVtx vtx(parent); + vtx.SetRawData(fileData); + vtx.SetRawDataIndex(currentPtr); + vtx.ParseRawData(); vtxList.push_back(vtx); currentPtr += 16; @@ -955,9 +932,7 @@ void ZDisplayList::Opcode_G_SETTIMG(uint64_t data, std::string prefix, char* lin sprintf(texStr, "%sTex_%06X", prefix.c_str(), texAddress); else { - { - sprintf(texStr, "0x%08lX", data & 0xFFFFFFFF); - } + sprintf(texStr, "0x%08lX", data & 0xFFFFFFFF); } sprintf(line, "gsDPSetTextureImage(%s, %s, %i, %s),", fmtTbl[fmt].c_str(), @@ -1559,12 +1534,42 @@ string ZDisplayList::GetSourceOutputHeader(const std::string& prefix) static int32_t GfxdCallback_FormatSingleEntry(void) { + ZDisplayList* self = static_cast<ZDisplayList*>(gfxd_udata_get()); gfxd_puts("\t"); gfxd_macro_dflt(); gfxd_puts(","); + auto macroId = gfxd_macro_id(); + + switch (macroId) + { + case gfxd_SP1Triangle: + case gfxd_SP2Triangles: + if (self->lastTexture != nullptr && self->lastTexture->IsColorIndexed() && + !self->lastTexture->HasTlut()) + { + auto tex = self->lastTexture; + auto tlut = self->lastTlut; + + if (Globals::Instance->verbosity >= VERBOSITY_DEBUG) + { + if (tlut != nullptr) + printf("CI texture '%s' (0x%X), TLUT: '%s' (0x%X)\n", tex->GetName().c_str(), + tex->GetRawDataIndex(), tlut->GetName().c_str(), + tlut->GetRawDataIndex()); + else + printf("CI texture '%s' (0x%X), TLUT: null\n", tex->GetName().c_str(), + tex->GetRawDataIndex()); + } + + if (tlut != nullptr && !tex->HasTlut()) + tex->SetTlut(tlut); + } + break; + } + // dont print a new line after the last command - if (gfxd_macro_id() != gfxd_SPEndDisplayList) + if (macroId != gfxd_SPEndDisplayList) { gfxd_puts("\n"); } @@ -1578,8 +1583,8 @@ static int32_t GfxdCallback_Vtx(uint32_t seg, int32_t count) uint32_t vtxOffset = Seg2Filespace(seg, self->parent->baseAddress); string vtxName = ""; - if (!Globals::Instance->HasSegment( - GETSEGNUM(seg))) // Probably an external asset we are unable to track + // Probably an external asset we are unable to track + if (!Globals::Instance->HasSegment(GETSEGNUM(seg))) { vtxName = StringHelper::Sprintf("0x%08X", seg); } @@ -1615,13 +1620,17 @@ static int32_t GfxdCallback_Vtx(uint32_t seg, int32_t count) if (count > 0) { - vector<Vertex> vtxList = vector<Vertex>(); + std::vector<ZVtx> vtxList; vtxList.reserve(count); uint32_t currentPtr = vtxOffset; for (int32_t i = 0; i < count; i++) { - Vertex vtx = Vertex(self->fileData, currentPtr); + ZVtx vtx(self->parent); + vtx.SetRawData(self->fileData); + vtx.SetRawDataIndex(currentPtr); + vtx.ParseRawData(); + vtxList.push_back(vtx); currentPtr += 16; } @@ -1641,29 +1650,7 @@ static int32_t GfxdCallback_Texture(segptr_t seg, int32_t fmt, int32_t siz, int3 { ZDisplayList* self = static_cast<ZDisplayList*>(gfxd_udata_get()); uint32_t texOffset = Seg2Filespace(seg, self->parent->baseAddress); - uint32_t texSegNum = GETSEGNUM(seg); - Declaration* texDecl = nullptr; - string texName = ""; - - if (self->parent != nullptr && - texSegNum != SEGMENT_SCENE) // HACK: Until we have declarations use segment addresses, - // we'll exclude scene references... - { - texDecl = self->parent->GetDeclaration(texOffset); - - if (texDecl == nullptr) - texDecl = self->parent->GetDeclaration(seg); - } - - if (!Globals::Instance->HasSegment( - texSegNum)) // Probably an external asset we are unable to track - texName = StringHelper::Sprintf("0x%08X", seg); - else if (texDecl != nullptr) - texName = StringHelper::Sprintf("%s", texDecl->varName.c_str()); - else if (texSegNum == 2) - texName = StringHelper::Sprintf("%sTex_%06X", self->scene->GetName().c_str(), texOffset); - else - texName = StringHelper::Sprintf("%sTex_%06X", self->curPrefix.c_str(), texOffset); + int32_t texSegNum = GETSEGNUM(seg); self->lastTexWidth = width; self->lastTexHeight = height; @@ -1676,6 +1663,20 @@ static int32_t GfxdCallback_Texture(segptr_t seg, int32_t fmt, int32_t siz, int3 self->TextureGenCheck(self->curPrefix); + std::string texName = ""; + + ZFile* auxParent = self->parent; + if (self->parent->segment != texSegNum && Globals::Instance->HasSegment(texSegNum)) + auxParent = Globals::Instance->segmentRefFiles.at(texSegNum); + + Declaration* decl = auxParent->GetDeclaration(texOffset); + if (Globals::Instance->HasSegment(texSegNum) && decl != nullptr) + texName = decl->varName; + else if (self->lastTexture != nullptr) + texName = self->lastTexture->GetName(); + else + texName = auxParent->GetDeclarationPtrName(seg); + gfxd_puts(texName.c_str()); return 1; @@ -1685,28 +1686,7 @@ static int32_t GfxdCallback_Palette(uint32_t seg, int32_t idx, int32_t count) { ZDisplayList* self = static_cast<ZDisplayList*>(gfxd_udata_get()); uint32_t palOffset = Seg2Filespace(seg, self->parent->baseAddress); - uint32_t palSegNum = GETSEGNUM(seg); - Declaration* palDecl = nullptr; - string palName = ""; - - if (self->parent != nullptr && palSegNum != 2) // HACK: Until we have declarations use segment - // addresses, we'll exclude scene references... - { - palDecl = self->parent->GetDeclaration(palOffset); - - if (palDecl == nullptr) - palDecl = self->parent->GetDeclaration(seg); - } - - if (!Globals::Instance->HasSegment( - palSegNum)) // Probably an external asset we are unable to track - palName = StringHelper::Sprintf("0x%08X", seg); - else if (palDecl != nullptr) - palName = StringHelper::Sprintf("%s", palDecl->varName.c_str()); - else if (palSegNum == 2) - palName = StringHelper::Sprintf("%sTex_%06X", self->scene->GetName().c_str(), palOffset); - else - palName = StringHelper::Sprintf("%sTex_%06X", self->curPrefix.c_str(), palOffset); + int32_t palSegNum = GETSEGNUM(seg); self->lastTexWidth = sqrt(count); self->lastTexHeight = sqrt(count); @@ -1718,6 +1698,21 @@ static int32_t GfxdCallback_Palette(uint32_t seg, int32_t idx, int32_t count) self->lastTexIsPalette = true; self->TextureGenCheck(self->curPrefix); + + std::string palName = ""; + + ZFile* auxParent = self->parent; + if (self->parent->segment != palSegNum && Globals::Instance->HasSegment(palSegNum)) + auxParent = Globals::Instance->segmentRefFiles.at(palSegNum); + + Declaration* decl = auxParent->GetDeclaration(palOffset); + if (Globals::Instance->HasSegment(palSegNum) && decl != nullptr) + palName = decl->varName; + else if (self->lastTlut != nullptr) + palName = self->lastTlut->GetName(); + else + palName = auxParent->GetDeclarationPtrName(seg); + gfxd_puts(palName.c_str()); return 1; @@ -1727,20 +1722,7 @@ static int32_t GfxdCallback_DisplayList(uint32_t seg) { ZDisplayList* self = static_cast<ZDisplayList*>(gfxd_udata_get()); uint32_t dListOffset = GETSEGOFFSET(seg); - uint32_t dListSegNum = GETSEGNUM(seg); - Declaration* dListDecl = nullptr; - string dListName = ""; - - if (self->parent != nullptr) - dListDecl = self->parent->GetDeclaration(dListOffset); - - if (!Globals::Instance->HasSegment( - dListSegNum)) // Probably an external asset we are unable to track - dListName = StringHelper::Sprintf("0x%08X", seg); - else if (dListDecl != nullptr) - dListName = StringHelper::Sprintf("%s", dListDecl->varName.c_str()); - else - dListName = StringHelper::Sprintf("%sDL_%06X", self->curPrefix.c_str(), dListOffset); + int32_t dListSegNum = GETSEGNUM(seg); if ((dListSegNum <= 6) && Globals::Instance->HasSegment(dListSegNum)) { @@ -1752,6 +1734,12 @@ static int32_t GfxdCallback_DisplayList(uint32_t seg) self->otherDLists.push_back(newDList); } + ZFile* auxParent = self->parent; + if (self->parent->segment != dListSegNum && Globals::Instance->HasSegment(dListSegNum)) + auxParent = Globals::Instance->segmentRefFiles.at(dListSegNum); + + std::string dListName = auxParent->GetDeclarationPtrName(seg); + gfxd_puts(dListName.c_str()); return 1; @@ -1802,10 +1790,7 @@ string ZDisplayList::GetSourceOutputCode(const std::string& prefix) // Iterate through our vertex lists, connect intersecting lists. if (vertices.size() > 0) { - vector<pair<int32_t, vector<Vertex>>> verticesSorted(vertices.begin(), vertices.end()); - - sort(verticesSorted.begin(), verticesSorted.end(), - [](const auto& lhs, const auto& rhs) { return lhs.first < rhs.first; }); + vector<pair<int32_t, vector<ZVtx>>> verticesSorted(vertices.begin(), vertices.end()); for (size_t i = 0; i < verticesSorted.size() - 1; i++) { @@ -1840,20 +1825,18 @@ string ZDisplayList::GetSourceOutputCode(const std::string& prefix) parent->defines += defines; // Generate Vertex Declarations - for (pair<int32_t, vector<Vertex>> item : vertices) + for (auto& item : vertices) { string declaration = ""; - int32_t curAddr = item.first; + uint32_t curAddr = item.first; - for (Vertex vtx : item.second) + for (auto vtx : item.second) { if (curAddr != item.first) declaration += "\n"; - declaration += - StringHelper::Sprintf(" VTX(%i, %i, %i, %i, %i, %i, %i, %i, %i),", vtx.x, - vtx.y, vtx.z, vtx.s, vtx.t, vtx.r, vtx.g, vtx.b, vtx.a); + declaration += vtx.GetBodySourceCode(); curAddr += 16; } @@ -1873,116 +1856,9 @@ string ZDisplayList::GetSourceOutputCode(const std::string& prefix) // Check for texture intersections { - if (scene != nullptr && scene->textures.size() != 0) + if (scene != nullptr) { - vector<pair<uint32_t, ZTexture*>> texturesSorted(scene->textures.begin(), - scene->textures.end()); - - sort(texturesSorted.begin(), texturesSorted.end(), - [](const auto& lhs, const auto& rhs) { return lhs.first < rhs.first; }); - - for (size_t i = 0; i < texturesSorted.size() - 1; i++) - { - int32_t texSize = scene->textures[texturesSorted[i].first]->GetRawDataSize(); - - if ((texturesSorted[i].first + texSize) > texturesSorted[i + 1].first) - { - defines += StringHelper::Sprintf( - "#define %sTex_%06X ((u32)%sTex_%06X + 0x%06X)\n", scene->GetName().c_str(), - texturesSorted[i + 1].first, scene->GetName().c_str(), - texturesSorted[i].first, - texturesSorted[i + 1].first - texturesSorted[i].first); - - scene->parent->declarations.erase(texturesSorted[i + 1].first); - scene->textures.erase(texturesSorted[i + 1].first); - texturesSorted.erase(texturesSorted.begin() + i + 1); - - i--; - } - } - - scene->extDefines += defines; - } - - { - vector<pair<uint32_t, ZTexture*>> texturesSorted(textures.begin(), textures.end()); - - sort(texturesSorted.begin(), texturesSorted.end(), - [](const auto& lhs, const auto& rhs) { return lhs.first < rhs.first; }); - - for (size_t i = 0; i < texturesSorted.size() - 1; i++) - { - if (texturesSorted.size() == 0) // ????? - break; - - int32_t texSize = textures[texturesSorted[i].first]->GetRawDataSize(); - - if ((texturesSorted[i].first + texSize) > texturesSorted[i + 1].first) - { - // int32_t intersectAmt = (texturesSorted[i].first + texSize) - texturesSorted[i - // + 1].first; - - // If we're working with a palette, resize it to its "real" dimensions - if (texturesSorted[i].second->isPalette) - { - texturesSorted[i].second->SetWidth( - (texturesSorted[i + 1].first - texturesSorted[i].first) / 2); - texturesSorted[i].second->SetHeight(1); - } - else - { - defines += StringHelper::Sprintf( - "#define %sTex_%06X ((u32)%sTex_%06X + 0x%06X)\n", prefix.c_str(), - texturesSorted[i + 1].first, prefix.c_str(), texturesSorted[i].first, - texturesSorted[i + 1].first - texturesSorted[i].first); - - textures.erase(texturesSorted[i + 1].first); - texturesSorted.erase(texturesSorted.begin() + i + 1); - - i--; - } - } - } - } - - // Generate Texture Declarations - for (pair<int32_t, ZTexture*> item : textures) - { - string declaration = ""; - - declaration += item.second->GetSourceOutputCode(prefix); - texDeclarations[item.first] = declaration; - - if (parent != nullptr) - { - if (parent->GetDeclaration(item.first) == nullptr) - { - // TEXTURE POOL CHECK - std::string texOutPath = - item.second->GetPoolOutPath(Globals::Instance->outputPath.string()); - std::string texOutName = item.second->GetName(); - - auto start = chrono::steady_clock::now(); - item.second->Save(texOutPath); - auto end = chrono::steady_clock::now(); - auto diff = chrono::duration_cast<chrono::milliseconds>(end - start).count(); - - if (Globals::Instance->verbosity >= VERBOSITY_DEBUG) - printf("SAVED IMAGE TO %s in %ims\n", Globals::Instance->outputPath.c_str(), - (int32_t)diff); - - auto filepath = Globals::Instance->outputPath / - Path::GetFileNameWithoutExtension(item.second->GetName()); - std::string incStr = - StringHelper::Sprintf("%s.%s.inc.c", filepath.c_str(), - item.second->GetExternalExtension().c_str()); - std::string texName = - StringHelper::Sprintf("%sTex_%06X", prefix.c_str(), item.first); - - parent->AddDeclarationIncludeArray( - item.first, incStr, item.second->GetRawDataSize(), "u64", texName, 0); - } - } + defines += scene->extDefines; } } @@ -1999,10 +1875,7 @@ string ZDisplayList::GetSourceOutputCode(const std::string& prefix) // Iterate through our vertex lists, connect intersecting lists. if (vertices.size() > 0) { - vector<pair<uint32_t, vector<Vertex>>> verticesSorted(vertices.begin(), vertices.end()); - - sort(verticesSorted.begin(), verticesSorted.end(), - [](const auto& lhs, const auto& rhs) { return lhs.first < rhs.first; }); + vector<pair<uint32_t, vector<ZVtx>>> verticesSorted(vertices.begin(), vertices.end()); for (size_t i = 0; i < verticesSorted.size() - 1; i++) { @@ -2031,19 +1904,19 @@ string ZDisplayList::GetSourceOutputCode(const std::string& prefix) // Generate Vertex Declarations vector<int32_t> vtxKeys; - for (pair<int32_t, vector<Vertex>> item : vertices) + for (auto& item : vertices) vtxKeys.push_back(item.first); // for (pair<int32_t, vector<Vertex>> item : vertices) for (size_t i = 0; i < vtxKeys.size(); i++) { - vector<Vertex> item = vertices[vtxKeys[i]]; + auto& item = vertices[vtxKeys[i]]; string declaration = ""; int32_t curAddr = vtxKeys[i]; - for (Vertex vtx : item) + for (auto& vtx : item) { if (curAddr != vtxKeys[i]) declaration += "\n"; @@ -2167,9 +2040,8 @@ std::string ZDisplayList::ProcessGfxDis(const std::string& prefix) void ZDisplayList::TextureGenCheck(string prefix) { - if (TextureGenCheck(fileData, textures, scene, parent, prefix, lastTexWidth, lastTexHeight, - lastTexAddr, lastTexSeg, lastTexFmt, lastTexSiz, lastTexLoaded, - lastTexIsPalette)) + if (TextureGenCheck(fileData, scene, parent, prefix, lastTexWidth, lastTexHeight, lastTexAddr, + lastTexSeg, lastTexFmt, lastTexSiz, lastTexLoaded, lastTexIsPalette, this)) { lastTexAddr = 0; lastTexLoaded = false; @@ -2177,14 +2049,19 @@ void ZDisplayList::TextureGenCheck(string prefix) } } -bool ZDisplayList::TextureGenCheck(vector<uint8_t> fileData, map<uint32_t, ZTexture*>& textures, - ZRoom* scene, ZFile* parent, string prefix, int32_t texWidth, - int32_t texHeight, uint32_t texAddr, uint32_t texSeg, - F3DZEXTexFormats texFmt, F3DZEXTexSizes texSiz, bool texLoaded, - bool texIsPalette) +bool ZDisplayList::TextureGenCheck(vector<uint8_t> fileData, ZRoom* scene, ZFile* parent, + string prefix, int32_t texWidth, int32_t texHeight, + uint32_t texAddr, uint32_t texSeg, F3DZEXTexFormats texFmt, + F3DZEXTexSizes texSiz, bool texLoaded, bool texIsPalette, + ZDisplayList* self) { int32_t segmentNumber = GETSEGNUM(texSeg); + if (!texIsPalette) + self->lastTexture = nullptr; + else + self->lastTlut = nullptr; + if (Globals::Instance->verbosity >= VERBOSITY_DEBUG) printf("TextureGenCheck seg=%i width=%i height=%i ispal=%i addr=0x%06X\n", segmentNumber, texWidth, texHeight, texIsPalette, texAddr); @@ -2194,36 +2071,55 @@ bool ZDisplayList::TextureGenCheck(vector<uint8_t> fileData, map<uint32_t, ZText { if (segmentNumber != SEGMENT_SCENE) { - ZTexture* tex = - ZTexture::FromBinary(TexFormatToTexType(texFmt, texSiz), fileData, texAddr, - StringHelper::Sprintf("%sTex_%06X", prefix.c_str(), texAddr), - texWidth, texHeight, parent); - tex->isPalette = texIsPalette; - textures[texAddr] = tex; - return true; + if (texAddr < parent->GetRawData().size()) + { + ZTexture* tex = parent->GetTextureResource(texAddr); + if (tex != nullptr) + tex->isPalette = texIsPalette; + else + { + tex = new ZTexture(parent); + tex->FromBinary(fileData, texAddr, texWidth, texHeight, + TexFormatToTexType(texFmt, texSiz), texIsPalette); + parent->AddTextureResource(texAddr, tex); + } + + if (!texIsPalette) + self->lastTexture = tex; + else + self->lastTlut = tex; + + return true; + } } - else + else if (scene != nullptr) { - ZTexture* tex = ZTexture::FromBinary( - TexFormatToTexType(texFmt, texSiz), scene->GetRawData(), texAddr, - StringHelper::Sprintf("%sTex_%06X", Globals::Instance->lastScene->GetName().c_str(), - texAddr), - texWidth, texHeight, parent); - - if (scene != nullptr) + if (scene->parent->GetDeclaration(texAddr) == nullptr) { - scene->textures[texAddr] = tex; + ZTexture* tex = scene->parent->GetTextureResource(texAddr); + if (tex != nullptr) + tex->isPalette = texIsPalette; + else + { + tex = new ZTexture(scene->parent); + tex->FromBinary(scene->GetRawData(), texAddr, texWidth, texHeight, + TexFormatToTexType(texFmt, texSiz), texIsPalette); + + scene->parent->AddTextureResource(texAddr, tex); + } + + if (!texIsPalette) + self->lastTexture = tex; + else + self->lastTlut = tex; auto filepath = Globals::Instance->outputPath / Path::GetFileNameWithoutExtension(tex->GetName()); - scene->parent->AddDeclarationIncludeArray( - texAddr, - StringHelper::Sprintf("%s.%s.inc.c", filepath.c_str(), - tex->GetExternalExtension().c_str()), - tex->GetRawDataSize(), "u64", - StringHelper::Sprintf("%sTex_%06X", - Globals::Instance->lastScene->GetName().c_str(), texAddr), - 0); + auto filename = StringHelper::Sprintf("%s.%s.inc.c", filepath.c_str(), + tex->GetExternalExtension().c_str()); + scene->parent->AddDeclarationIncludeArray(texAddr, filename, tex->GetRawDataSize(), + tex->GetSourceTypeName(), tex->GetName(), + 0); } return true; } @@ -2275,10 +2171,6 @@ TextureType ZDisplayList::TexFormatToTexType(F3DZEXTexFormats fmt, F3DZEXTexSize return TextureType::RGBA16bpp; } -void ZDisplayList::Save(const std::string& outFolder) -{ -} - void ZDisplayList::GenerateHLIntermediette(HLFileIntermediette& hlFile) { HLModelIntermediette* mdl = (HLModelIntermediette*)&hlFile; @@ -2310,48 +2202,3 @@ size_t ZDisplayList::GetRawDataSize() { return instructions.size() * 8; } - -Vertex::Vertex() -{ - x = 0; - y = 0; - z = 0; - flag = 0; - s = 0; - t = 0; - r = 0; - g = 0; - b = 0; - a = 0; -} - -Vertex::Vertex(int16_t nX, int16_t nY, int16_t nZ, uint16_t nFlag, int16_t nS, int16_t nT, - uint8_t nR, uint8_t nG, uint8_t nB, uint8_t nA) -{ - x = nX; - y = nY; - z = nZ; - flag = nFlag; - s = nS; - t = nT; - r = nR; - g = nG; - b = nB; - a = nA; -} - -Vertex::Vertex(std::vector<uint8_t> rawData, uint32_t rawDataIndex) -{ - const uint8_t* data = rawData.data(); - - x = BitConverter::ToInt16BE(data, rawDataIndex + 0); - y = BitConverter::ToInt16BE(data, rawDataIndex + 2); - z = BitConverter::ToInt16BE(data, rawDataIndex + 4); - flag = BitConverter::ToInt16BE(data, rawDataIndex + 6); - s = BitConverter::ToInt16BE(data, rawDataIndex + 8); - t = BitConverter::ToInt16BE(data, rawDataIndex + 10); - r = data[rawDataIndex + 12]; - g = data[rawDataIndex + 13]; - b = data[rawDataIndex + 14]; - a = data[rawDataIndex + 15]; -} |
