mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 07:18:11 -05:00
chore: add ObjCompiling component
This commit is contained in:
8
src/ObjCompiling/Game/IW3/ObjCompilerIW3.cpp
Normal file
8
src/ObjCompiling/Game/IW3/ObjCompilerIW3.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include "ObjCompilerIW3.h"
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
ObjCompilerResult ObjCompiler::CompileAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName) const
|
||||
{
|
||||
return ObjCompilerResult::NO_COMPILATION_DONE;
|
||||
}
|
12
src/ObjCompiling/Game/IW3/ObjCompilerIW3.h
Normal file
12
src/ObjCompiling/Game/IW3/ObjCompilerIW3.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "IObjCompiler.h"
|
||||
|
||||
namespace IW3
|
||||
{
|
||||
class ObjCompiler final : public IObjCompiler
|
||||
{
|
||||
public:
|
||||
ObjCompilerResult CompileAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName) const override;
|
||||
};
|
||||
} // namespace IW3
|
8
src/ObjCompiling/Game/IW4/ObjCompilerIW4.cpp
Normal file
8
src/ObjCompiling/Game/IW4/ObjCompilerIW4.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include "ObjCompilerIW4.h"
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
ObjCompilerResult ObjCompiler::CompileAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName) const
|
||||
{
|
||||
return ObjCompilerResult::NO_COMPILATION_DONE;
|
||||
}
|
12
src/ObjCompiling/Game/IW4/ObjCompilerIW4.h
Normal file
12
src/ObjCompiling/Game/IW4/ObjCompilerIW4.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "IObjCompiler.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
class ObjCompiler final : public IObjCompiler
|
||||
{
|
||||
public:
|
||||
ObjCompilerResult CompileAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName) const override;
|
||||
};
|
||||
} // namespace IW4
|
8
src/ObjCompiling/Game/IW5/ObjCompilerIW5.cpp
Normal file
8
src/ObjCompiling/Game/IW5/ObjCompilerIW5.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include "ObjCompilerIW5.h"
|
||||
|
||||
using namespace IW5;
|
||||
|
||||
ObjCompilerResult ObjCompiler::CompileAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName) const
|
||||
{
|
||||
return ObjCompilerResult::NO_COMPILATION_DONE;
|
||||
}
|
12
src/ObjCompiling/Game/IW5/ObjCompilerIW5.h
Normal file
12
src/ObjCompiling/Game/IW5/ObjCompilerIW5.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "IObjCompiler.h"
|
||||
|
||||
namespace IW5
|
||||
{
|
||||
class ObjCompiler final : public IObjCompiler
|
||||
{
|
||||
public:
|
||||
ObjCompilerResult CompileAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName) const override;
|
||||
};
|
||||
} // namespace IW5
|
8
src/ObjCompiling/Game/T5/ObjCompilerT5.cpp
Normal file
8
src/ObjCompiling/Game/T5/ObjCompilerT5.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include "ObjCompilerT5.h"
|
||||
|
||||
using namespace T5;
|
||||
|
||||
ObjCompilerResult ObjCompiler::CompileAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName) const
|
||||
{
|
||||
return ObjCompilerResult::NO_COMPILATION_DONE;
|
||||
}
|
12
src/ObjCompiling/Game/T5/ObjCompilerT5.h
Normal file
12
src/ObjCompiling/Game/T5/ObjCompilerT5.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "IObjCompiler.h"
|
||||
|
||||
namespace T5
|
||||
{
|
||||
class ObjCompiler final : public IObjCompiler
|
||||
{
|
||||
public:
|
||||
ObjCompilerResult CompileAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName) const override;
|
||||
};
|
||||
} // namespace T5
|
8
src/ObjCompiling/Game/T6/ObjCompilerT6.cpp
Normal file
8
src/ObjCompiling/Game/T6/ObjCompilerT6.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include "ObjCompilerT6.h"
|
||||
|
||||
using namespace T6;
|
||||
|
||||
ObjCompilerResult ObjCompiler::CompileAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName) const
|
||||
{
|
||||
return ObjCompilerResult::NO_COMPILATION_DONE;
|
||||
}
|
12
src/ObjCompiling/Game/T6/ObjCompilerT6.h
Normal file
12
src/ObjCompiling/Game/T6/ObjCompilerT6.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "IObjCompiler.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class ObjCompiler final : public IObjCompiler
|
||||
{
|
||||
public:
|
||||
ObjCompilerResult CompileAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName) const override;
|
||||
};
|
||||
} // namespace T6
|
27
src/ObjCompiling/IObjCompiler.cpp
Normal file
27
src/ObjCompiling/IObjCompiler.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include "IObjCompiler.h"
|
||||
|
||||
#include "Game/IW3/ObjCompilerIW3.h"
|
||||
#include "Game/IW4/ObjCompilerIW4.h"
|
||||
#include "Game/IW5/ObjCompilerIW5.h"
|
||||
#include "Game/T5/ObjCompilerT5.h"
|
||||
#include "Game/T6/ObjCompilerT6.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
const IObjCompiler* IObjCompiler::GetObjCompilerForGame(GameId game)
|
||||
{
|
||||
static const IObjCompiler* objCompilers[static_cast<unsigned>(GameId::COUNT)]{
|
||||
new IW3::ObjCompiler(),
|
||||
new IW4::ObjCompiler(),
|
||||
new IW5::ObjCompiler(),
|
||||
new T5::ObjCompiler(),
|
||||
new T6::ObjCompiler(),
|
||||
};
|
||||
static_assert(std::extent_v<decltype(objCompilers)> == static_cast<unsigned>(GameId::COUNT));
|
||||
|
||||
assert(static_cast<unsigned>(game) < static_cast<unsigned>(GameId::COUNT));
|
||||
const auto* result = objCompilers[static_cast<unsigned>(game)];
|
||||
assert(result);
|
||||
|
||||
return result;
|
||||
}
|
30
src/ObjCompiling/IObjCompiler.h
Normal file
30
src/ObjCompiling/IObjCompiler.h
Normal file
@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "AssetLoading/AssetLoadingContext.h"
|
||||
#include "SearchPath/ISearchPath.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
enum class ObjCompilerResult : std::uint8_t
|
||||
{
|
||||
COMPILED,
|
||||
NO_COMPILATION_DONE,
|
||||
FAILURE
|
||||
};
|
||||
|
||||
class IObjCompiler
|
||||
{
|
||||
public:
|
||||
IObjCompiler() = default;
|
||||
virtual ~IObjCompiler() = default;
|
||||
IObjCompiler(const IObjCompiler& other) = default;
|
||||
IObjCompiler(IObjCompiler&& other) noexcept = default;
|
||||
IObjCompiler& operator=(const IObjCompiler& other) = default;
|
||||
IObjCompiler& operator=(IObjCompiler&& other) noexcept = default;
|
||||
|
||||
virtual ObjCompilerResult CompileAssetForZone(AssetLoadingContext& context, asset_type_t assetType, const std::string& assetName) const = 0;
|
||||
|
||||
static const IObjCompiler* GetObjCompilerForGame(GameId game);
|
||||
};
|
Reference in New Issue
Block a user