mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
refactor: extract image code into single component
This commit is contained in:
parent
a2d70c17ba
commit
2dccd423af
@ -126,6 +126,7 @@ include "src/ZoneLoading.lua"
|
||||
include "src/ZoneWriting.lua"
|
||||
include "src/ZoneCommon.lua"
|
||||
include "src/ObjCommon.lua"
|
||||
include "src/ObjImage.lua"
|
||||
include "src/ObjLoading.lua"
|
||||
include "src/ObjWriting.lua"
|
||||
include "tools/scripts/raw.lua"
|
||||
@ -142,6 +143,7 @@ group "Components"
|
||||
ZoneLoading:project()
|
||||
ZoneWriting:project()
|
||||
ObjCommon:project()
|
||||
ObjImage:project()
|
||||
ObjLoading:project()
|
||||
ObjWriting:project()
|
||||
group ""
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
// #include <d3d9.h>
|
||||
#include "Game/IAsset.h"
|
||||
#include "Image/Texture.h"
|
||||
|
||||
#include "IW3_Assets.h"
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include "Utils/Pack.h"
|
||||
|
||||
#include <cctype>
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
int Common::StringTable_HashString(const char* str)
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
// #include <d3d9.h>
|
||||
#include "Game/IAsset.h"
|
||||
#include "Image/Texture.h"
|
||||
|
||||
#include "IW4_Assets.h"
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include "Utils/Pack.h"
|
||||
|
||||
#include <cctype>
|
||||
|
||||
using namespace IW5;
|
||||
|
||||
int Common::StringTable_HashString(const char* str)
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
// #include <d3d9.h>
|
||||
#include "Game/IAsset.h"
|
||||
#include "Image/Texture.h"
|
||||
|
||||
#include "IW5_Assets.h"
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
// #include <d3d9.h>
|
||||
#include "Game/IAsset.h"
|
||||
#include "Image/Texture.h"
|
||||
|
||||
#include "T5_Assets.h"
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
// #include <d3d11.h>
|
||||
#include "Game/IAsset.h"
|
||||
#include "Image/Texture.h"
|
||||
|
||||
#include "T6_Assets.h"
|
||||
|
||||
|
@ -38,13 +38,11 @@ function ImageConverter:project()
|
||||
|
||||
self:include(includes)
|
||||
Utils:include(includes)
|
||||
ObjLoading:include(includes)
|
||||
ObjWriting:include(includes)
|
||||
ObjImage:include(includes)
|
||||
|
||||
Raw:use()
|
||||
|
||||
links:linkto(Utils)
|
||||
links:linkto(ObjLoading)
|
||||
links:linkto(ObjWriting)
|
||||
links:linkto(ObjImage)
|
||||
links:linkall()
|
||||
end
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include "ImageConverterArgs.h"
|
||||
|
||||
#include "GitVersion.h"
|
||||
#include "ObjLoading.h"
|
||||
#include "ObjWriting.h"
|
||||
#include "Utils/Arguments/UsageInformation.h"
|
||||
|
||||
#include <format>
|
||||
@ -109,8 +107,6 @@ void ImageConverterArgs::PrintVersion()
|
||||
void ImageConverterArgs::SetVerbose(const bool isVerbose)
|
||||
{
|
||||
m_verbose = isVerbose;
|
||||
ObjLoading::Configuration.Verbose = isVerbose;
|
||||
ObjWriting::Configuration.Verbose = isVerbose;
|
||||
}
|
||||
|
||||
bool ImageConverterArgs::ParseArgs(const int argc, const char** argv, bool& shouldContinue)
|
||||
|
47
src/ObjImage.lua
Normal file
47
src/ObjImage.lua
Normal file
@ -0,0 +1,47 @@
|
||||
ObjImage = {}
|
||||
|
||||
function ObjImage:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ObjImage")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function ObjImage:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(Utils)
|
||||
end
|
||||
|
||||
function ObjImage:use()
|
||||
|
||||
end
|
||||
|
||||
function ObjImage:name()
|
||||
return "ObjImage"
|
||||
end
|
||||
|
||||
function ObjImage:project()
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/src/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
|
||||
files {
|
||||
path.join(folder, "ObjImage/**.h"),
|
||||
path.join(folder, "ObjImage/**.cpp")
|
||||
}
|
||||
|
||||
vpaths {
|
||||
["*"] = {
|
||||
path.join(folder, "ObjImage")
|
||||
}
|
||||
}
|
||||
|
||||
self:include(includes)
|
||||
Utils:include(includes)
|
||||
end
|
@ -3,6 +3,7 @@ ObjLoading = {}
|
||||
function ObjLoading:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
ObjCommon:include(includes)
|
||||
ObjImage:include(includes)
|
||||
ZoneCommon:include(includes)
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ObjLoading")
|
||||
@ -14,6 +15,7 @@ function ObjLoading:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(Utils)
|
||||
links:linkto(ObjCommon)
|
||||
links:linkto(ObjImage)
|
||||
links:linkto(ZoneCommon)
|
||||
links:linkto(minilzo)
|
||||
links:linkto(minizip)
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "Utils/MemoryManager.h"
|
||||
|
||||
#include <istream>
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
bool LoadLeaderboardAsJson(std::istream& stream, LeaderboardDef& leaderboard, MemoryManager* memory);
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "Game/IW5/IW5.h"
|
||||
#include "Utils/MemoryManager.h"
|
||||
|
||||
#include <istream>
|
||||
|
||||
namespace IW5
|
||||
{
|
||||
bool LoadLeaderboardAsJson(std::istream& stream, LeaderboardDef& leaderboard, MemoryManager* memory);
|
||||
|
@ -3,6 +3,7 @@ ObjWriting = {}
|
||||
function ObjWriting:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
ObjCommon:include(includes)
|
||||
ObjImage:include(includes)
|
||||
ObjLoading:include(includes)
|
||||
ZoneCommon:include(includes)
|
||||
includedirs {
|
||||
@ -15,6 +16,7 @@ function ObjWriting:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(Utils)
|
||||
links:linkto(ObjCommon)
|
||||
links:linkto(ObjImage)
|
||||
links:linkto(ObjLoading)
|
||||
links:linkto(ZoneCommon)
|
||||
links:linkto(minilzo)
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <type_traits>
|
||||
|
||||
|
@ -45,9 +45,11 @@ function ObjCommonTests:project()
|
||||
|
||||
self:include(includes)
|
||||
ObjCommon:include(includes)
|
||||
ObjImage:include(includes)
|
||||
catch2:include(includes)
|
||||
|
||||
links:linkto(ObjCommon)
|
||||
links:linkto(ObjImage)
|
||||
links:linkto(catch2)
|
||||
links:linkall()
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user