mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-10-06 20:25:35 +00:00
ZoneLoading: Extract all obj dumping relevant parts to ObjWriting component
This commit is contained in:
1 parent
e8de3a3f39
commit
00b3322cb2
28 files changed
+143
-37
No files matched your search
@@ -100,6 +100,9 @@ include "src/ZoneCodeGenerator.lua"
|
||||
include "src/ZoneCommon.lua"
|
||||
include "src/ZoneLoading.lua"
|
||||
include "src/ZoneWriting.lua"
|
||||
include "src/ZoneCommon.lua"
|
||||
include "src/ObjLoading.lua"
|
||||
include "src/ObjWriting.lua"
|
||||
|
||||
-- Components group: All projects assist or are part of a tool
|
||||
group "Components"
|
||||
@@ -110,6 +113,8 @@ group "Components"
|
||||
ZoneCommon:project()
|
||||
ZoneLoading:project()
|
||||
ZoneWriting:project()
|
||||
ObjLoading:project()
|
||||
ObjWriting:project()
|
||||
group ""
|
||||
|
||||
-- Tools group: All projects that compile into the final tools
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
ObjLoading = {}
|
||||
|
||||
function ObjLoading:include()
|
||||
ZoneCommon:include()
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ObjLoading")
|
||||
}
|
||||
end
|
||||
|
||||
function ObjLoading:link()
|
||||
Utils:link()
|
||||
ZoneCommon:link()
|
||||
links {
|
||||
"ObjLoading"
|
||||
}
|
||||
end
|
||||
|
||||
function ObjLoading:use()
|
||||
|
||||
end
|
||||
|
||||
function ObjLoading:project()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "ObjLoading"
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/src/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
|
||||
files {
|
||||
path.join(folder, "ObjLoading/**.h"),
|
||||
path.join(folder, "ObjLoading/**.cpp")
|
||||
}
|
||||
|
||||
vpaths {
|
||||
["*"] = {
|
||||
path.join(folder, "ObjLoading")
|
||||
}
|
||||
}
|
||||
|
||||
self:include()
|
||||
Utils:include()
|
||||
end
|
||||
@@ -0,0 +1,44 @@
|
||||
ObjWriting = {}
|
||||
|
||||
function ObjWriting:include()
|
||||
ZoneCommon:include()
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ObjWriting")
|
||||
}
|
||||
end
|
||||
|
||||
function ObjWriting:link()
|
||||
Utils:link()
|
||||
ZoneCommon:link()
|
||||
links {
|
||||
"ObjWriting"
|
||||
}
|
||||
end
|
||||
|
||||
function ObjWriting:use()
|
||||
|
||||
end
|
||||
|
||||
function ObjWriting:project()
|
||||
local folder = ProjectFolder();
|
||||
|
||||
project "ObjWriting"
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/src/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
|
||||
files {
|
||||
path.join(folder, "ObjWriting/**.h"),
|
||||
path.join(folder, "ObjWriting/**.cpp")
|
||||
}
|
||||
|
||||
vpaths {
|
||||
["*"] = {
|
||||
path.join(folder, "ObjWriting")
|
||||
}
|
||||
}
|
||||
|
||||
self:include()
|
||||
Utils:include()
|
||||
end
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,32 @@
|
||||
#include "ObjWriting.h"
|
||||
#include "Dumping/IZoneDumper.h"
|
||||
#include "Game/T6/ZoneDumperT6.h"
|
||||
|
||||
IZoneDumper* zoneDumper[]
|
||||
{
|
||||
new ZoneDumperT6()
|
||||
};
|
||||
|
||||
bool ObjWriting::DumpZone(Zone* zone, const std::string& basePath)
|
||||
{
|
||||
for (auto dumper : zoneDumper)
|
||||
{
|
||||
if (dumper->CanHandleZone(zone))
|
||||
{
|
||||
if (dumper->DumpZone(zone, basePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
printf("Dumper for zone '%s' failed!\n", zone->m_name.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ObjWriting::WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic)
|
||||
{
|
||||
return file->Printf("// %s", "Insert zone definition here") > 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "Zone/Zone.h"
|
||||
#include "Utils/FileAPI.h"
|
||||
#include <string>
|
||||
|
||||
class ObjWriting
|
||||
{
|
||||
public:
|
||||
static bool DumpZone(Zone* zone, const std::string& basePath);
|
||||
static bool WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic);
|
||||
};
|
||||
@@ -31,7 +31,9 @@ function Unlinker:project()
|
||||
self:include()
|
||||
Utils:include()
|
||||
ZoneLoading:include()
|
||||
ObjWriting:include()
|
||||
|
||||
Utils:link()
|
||||
ZoneLoading:link()
|
||||
ObjWriting:link()
|
||||
end
|
||||
@@ -1,8 +1,10 @@
|
||||
#include "Utils/Arguments/ArgumentParser.h"
|
||||
#include "Utils/Arguments/UsageInformation.h"
|
||||
#include "ZoneLoading.h"
|
||||
#include "ObjWriting.h"
|
||||
#include "ContentPrinter.h"
|
||||
#include "Utils/PathUtils.h"
|
||||
#include "Utils/FileAPI.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <regex>
|
||||
@@ -96,8 +98,8 @@ bool HandleZone(Zone* zone, ArgumentParser* argumentParser)
|
||||
|
||||
if (zoneDefinitionFile.IsOpen())
|
||||
{
|
||||
ZoneLoading::WriteZoneDefinition(zone, &zoneDefinitionFile, minimalisticZoneDefinition);
|
||||
ZoneLoading::DumpZone(zone, outputFolderPath);
|
||||
ObjWriting::WriteZoneDefinition(zone, &zoneDefinitionFile, minimalisticZoneDefinition);
|
||||
ObjWriting::DumpZone(zone, outputFolderPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
#include "ZoneLoading.h"
|
||||
#include "Utils/PathUtils.h"
|
||||
#include "Dumping/IZoneDumper.h"
|
||||
|
||||
#include "Game/T6/ZoneLoaderFactoryT6.h"
|
||||
#include "Game/T6/ZoneDumperT6.h"
|
||||
|
||||
IZoneLoaderFactory* zoneLoaderFactories[]
|
||||
{
|
||||
new ZoneLoaderFactoryT6()
|
||||
};
|
||||
|
||||
IZoneDumper* zoneDumper[]
|
||||
{
|
||||
new ZoneDumperT6()
|
||||
};
|
||||
|
||||
Zone* ZoneLoading::LoadZone(const std::string& path)
|
||||
{
|
||||
std::string zoneName = utils::Path::GetFilenameWithoutExtension(path);
|
||||
@@ -49,27 +41,3 @@ Zone* ZoneLoading::LoadZone(const std::string& path)
|
||||
file.Close();
|
||||
return loadedZone;
|
||||
}
|
||||
|
||||
bool ZoneLoading::DumpZone(Zone* zone, const std::string& basePath)
|
||||
{
|
||||
for(auto dumper : zoneDumper)
|
||||
{
|
||||
if(dumper->CanHandleZone(zone))
|
||||
{
|
||||
if(dumper->DumpZone(zone, basePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
printf("Dumper for zone '%s' failed!\n", zone->m_name.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ZoneLoading::WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic)
|
||||
{
|
||||
return file->Printf("// %s", "Insert zone definition here") > 0;
|
||||
}
|
||||
@@ -1,12 +1,9 @@
|
||||
#pragma once
|
||||
#include "Zone/Zone.h"
|
||||
#include <string>
|
||||
#include "Utils/FileAPI.h"
|
||||
|
||||
class ZoneLoading
|
||||
{
|
||||
public:
|
||||
static Zone* LoadZone(const std::string& path);
|
||||
static bool DumpZone(Zone* zone, const std::string& basePath);
|
||||
static bool WriteZoneDefinition(Zone* zone, FileAPI::File* file, bool minimalistic);
|
||||
};
|
||||
Reference in new issue
Block a user