mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +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/ZoneWriting.lua"
|
||||||
include "src/ZoneCommon.lua"
|
include "src/ZoneCommon.lua"
|
||||||
include "src/ObjCommon.lua"
|
include "src/ObjCommon.lua"
|
||||||
|
include "src/ObjImage.lua"
|
||||||
include "src/ObjLoading.lua"
|
include "src/ObjLoading.lua"
|
||||||
include "src/ObjWriting.lua"
|
include "src/ObjWriting.lua"
|
||||||
include "tools/scripts/raw.lua"
|
include "tools/scripts/raw.lua"
|
||||||
@ -142,6 +143,7 @@ group "Components"
|
|||||||
ZoneLoading:project()
|
ZoneLoading:project()
|
||||||
ZoneWriting:project()
|
ZoneWriting:project()
|
||||||
ObjCommon:project()
|
ObjCommon:project()
|
||||||
|
ObjImage:project()
|
||||||
ObjLoading:project()
|
ObjLoading:project()
|
||||||
ObjWriting:project()
|
ObjWriting:project()
|
||||||
group ""
|
group ""
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
// #include <d3d9.h>
|
// #include <d3d9.h>
|
||||||
#include "Game/IAsset.h"
|
#include "Game/IAsset.h"
|
||||||
#include "Image/Texture.h"
|
|
||||||
|
|
||||||
#include "IW3_Assets.h"
|
#include "IW3_Assets.h"
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include "Utils/Pack.h"
|
#include "Utils/Pack.h"
|
||||||
|
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
using namespace IW4;
|
using namespace IW4;
|
||||||
|
|
||||||
int Common::StringTable_HashString(const char* str)
|
int Common::StringTable_HashString(const char* str)
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
// #include <d3d9.h>
|
// #include <d3d9.h>
|
||||||
#include "Game/IAsset.h"
|
#include "Game/IAsset.h"
|
||||||
#include "Image/Texture.h"
|
|
||||||
|
|
||||||
#include "IW4_Assets.h"
|
#include "IW4_Assets.h"
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include "Utils/Pack.h"
|
#include "Utils/Pack.h"
|
||||||
|
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
using namespace IW5;
|
using namespace IW5;
|
||||||
|
|
||||||
int Common::StringTable_HashString(const char* str)
|
int Common::StringTable_HashString(const char* str)
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
// #include <d3d9.h>
|
// #include <d3d9.h>
|
||||||
#include "Game/IAsset.h"
|
#include "Game/IAsset.h"
|
||||||
#include "Image/Texture.h"
|
|
||||||
|
|
||||||
#include "IW5_Assets.h"
|
#include "IW5_Assets.h"
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
// #include <d3d9.h>
|
// #include <d3d9.h>
|
||||||
#include "Game/IAsset.h"
|
#include "Game/IAsset.h"
|
||||||
#include "Image/Texture.h"
|
|
||||||
|
|
||||||
#include "T5_Assets.h"
|
#include "T5_Assets.h"
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
// #include <d3d11.h>
|
// #include <d3d11.h>
|
||||||
#include "Game/IAsset.h"
|
#include "Game/IAsset.h"
|
||||||
#include "Image/Texture.h"
|
|
||||||
|
|
||||||
#include "T6_Assets.h"
|
#include "T6_Assets.h"
|
||||||
|
|
||||||
|
@ -38,13 +38,11 @@ function ImageConverter:project()
|
|||||||
|
|
||||||
self:include(includes)
|
self:include(includes)
|
||||||
Utils:include(includes)
|
Utils:include(includes)
|
||||||
ObjLoading:include(includes)
|
ObjImage:include(includes)
|
||||||
ObjWriting:include(includes)
|
|
||||||
|
|
||||||
Raw:use()
|
Raw:use()
|
||||||
|
|
||||||
links:linkto(Utils)
|
links:linkto(Utils)
|
||||||
links:linkto(ObjLoading)
|
links:linkto(ObjImage)
|
||||||
links:linkto(ObjWriting)
|
|
||||||
links:linkall()
|
links:linkall()
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#include "ImageConverterArgs.h"
|
#include "ImageConverterArgs.h"
|
||||||
|
|
||||||
#include "GitVersion.h"
|
#include "GitVersion.h"
|
||||||
#include "ObjLoading.h"
|
|
||||||
#include "ObjWriting.h"
|
|
||||||
#include "Utils/Arguments/UsageInformation.h"
|
#include "Utils/Arguments/UsageInformation.h"
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
@ -109,8 +107,6 @@ void ImageConverterArgs::PrintVersion()
|
|||||||
void ImageConverterArgs::SetVerbose(const bool isVerbose)
|
void ImageConverterArgs::SetVerbose(const bool isVerbose)
|
||||||
{
|
{
|
||||||
m_verbose = isVerbose;
|
m_verbose = isVerbose;
|
||||||
ObjLoading::Configuration.Verbose = isVerbose;
|
|
||||||
ObjWriting::Configuration.Verbose = isVerbose;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImageConverterArgs::ParseArgs(const int argc, const char** argv, bool& shouldContinue)
|
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)
|
function ObjLoading:include(includes)
|
||||||
if includes:handle(self:name()) then
|
if includes:handle(self:name()) then
|
||||||
ObjCommon:include(includes)
|
ObjCommon:include(includes)
|
||||||
|
ObjImage:include(includes)
|
||||||
ZoneCommon:include(includes)
|
ZoneCommon:include(includes)
|
||||||
includedirs {
|
includedirs {
|
||||||
path.join(ProjectFolder(), "ObjLoading")
|
path.join(ProjectFolder(), "ObjLoading")
|
||||||
@ -14,6 +15,7 @@ function ObjLoading:link(links)
|
|||||||
links:add(self:name())
|
links:add(self:name())
|
||||||
links:linkto(Utils)
|
links:linkto(Utils)
|
||||||
links:linkto(ObjCommon)
|
links:linkto(ObjCommon)
|
||||||
|
links:linkto(ObjImage)
|
||||||
links:linkto(ZoneCommon)
|
links:linkto(ZoneCommon)
|
||||||
links:linkto(minilzo)
|
links:linkto(minilzo)
|
||||||
links:linkto(minizip)
|
links:linkto(minizip)
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include "Game/IW4/IW4.h"
|
#include "Game/IW4/IW4.h"
|
||||||
#include "Utils/MemoryManager.h"
|
#include "Utils/MemoryManager.h"
|
||||||
|
|
||||||
|
#include <istream>
|
||||||
|
|
||||||
namespace IW4
|
namespace IW4
|
||||||
{
|
{
|
||||||
bool LoadLeaderboardAsJson(std::istream& stream, LeaderboardDef& leaderboard, MemoryManager* memory);
|
bool LoadLeaderboardAsJson(std::istream& stream, LeaderboardDef& leaderboard, MemoryManager* memory);
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include "Game/IW5/IW5.h"
|
#include "Game/IW5/IW5.h"
|
||||||
#include "Utils/MemoryManager.h"
|
#include "Utils/MemoryManager.h"
|
||||||
|
|
||||||
|
#include <istream>
|
||||||
|
|
||||||
namespace IW5
|
namespace IW5
|
||||||
{
|
{
|
||||||
bool LoadLeaderboardAsJson(std::istream& stream, LeaderboardDef& leaderboard, MemoryManager* memory);
|
bool LoadLeaderboardAsJson(std::istream& stream, LeaderboardDef& leaderboard, MemoryManager* memory);
|
||||||
|
@ -3,6 +3,7 @@ ObjWriting = {}
|
|||||||
function ObjWriting:include(includes)
|
function ObjWriting:include(includes)
|
||||||
if includes:handle(self:name()) then
|
if includes:handle(self:name()) then
|
||||||
ObjCommon:include(includes)
|
ObjCommon:include(includes)
|
||||||
|
ObjImage:include(includes)
|
||||||
ObjLoading:include(includes)
|
ObjLoading:include(includes)
|
||||||
ZoneCommon:include(includes)
|
ZoneCommon:include(includes)
|
||||||
includedirs {
|
includedirs {
|
||||||
@ -15,6 +16,7 @@ function ObjWriting:link(links)
|
|||||||
links:add(self:name())
|
links:add(self:name())
|
||||||
links:linkto(Utils)
|
links:linkto(Utils)
|
||||||
links:linkto(ObjCommon)
|
links:linkto(ObjCommon)
|
||||||
|
links:linkto(ObjImage)
|
||||||
links:linkto(ObjLoading)
|
links:linkto(ObjLoading)
|
||||||
links:linkto(ZoneCommon)
|
links:linkto(ZoneCommon)
|
||||||
links:linkto(minilzo)
|
links:linkto(minilzo)
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <set>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
@ -45,9 +45,11 @@ function ObjCommonTests:project()
|
|||||||
|
|
||||||
self:include(includes)
|
self:include(includes)
|
||||||
ObjCommon:include(includes)
|
ObjCommon:include(includes)
|
||||||
|
ObjImage:include(includes)
|
||||||
catch2:include(includes)
|
catch2:include(includes)
|
||||||
|
|
||||||
links:linkto(ObjCommon)
|
links:linkto(ObjCommon)
|
||||||
|
links:linkto(ObjImage)
|
||||||
links:linkto(catch2)
|
links:linkto(catch2)
|
||||||
links:linkall()
|
links:linkall()
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user