mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
Add non-loading implementation for AssetLoaderMaterial for IW5 to be able to create default materials
This commit is contained in:
parent
13dfbc9bbb
commit
9dde58c064
18
src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMaterial.cpp
Normal file
18
src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMaterial.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "AssetLoaderMaterial.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "ObjLoading.h"
|
||||||
|
#include "Game/IW5/IW5.h"
|
||||||
|
#include "Pool/GlobalAssetPool.h"
|
||||||
|
|
||||||
|
using namespace IW5;
|
||||||
|
|
||||||
|
void* AssetLoaderMaterial::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
|
||||||
|
{
|
||||||
|
auto* material = memory->Create<Material>();
|
||||||
|
memset(material, 0, sizeof(Material));
|
||||||
|
material->info.name = memory->Dup(assetName.c_str());
|
||||||
|
|
||||||
|
return material;
|
||||||
|
}
|
14
src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMaterial.h
Normal file
14
src/ObjLoading/Game/IW5/AssetLoaders/AssetLoaderMaterial.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Game/IW5/IW5.h"
|
||||||
|
#include "AssetLoading/BasicAssetLoader.h"
|
||||||
|
#include "SearchPath/ISearchPath.h"
|
||||||
|
|
||||||
|
namespace IW5
|
||||||
|
{
|
||||||
|
class AssetLoaderMaterial final : public BasicAssetLoader<ASSET_TYPE_MATERIAL, Material>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
|
||||||
|
};
|
||||||
|
}
|
@ -5,6 +5,7 @@
|
|||||||
#include "ObjContainer/IPak/IPak.h"
|
#include "ObjContainer/IPak/IPak.h"
|
||||||
#include "ObjLoading.h"
|
#include "ObjLoading.h"
|
||||||
#include "AssetLoaders/AssetLoaderLocalizeEntry.h"
|
#include "AssetLoaders/AssetLoaderLocalizeEntry.h"
|
||||||
|
#include "AssetLoaders/AssetLoaderMaterial.h"
|
||||||
#include "AssetLoaders/AssetLoaderMenuDef.h"
|
#include "AssetLoaders/AssetLoaderMenuDef.h"
|
||||||
#include "AssetLoaders/AssetLoaderMenuList.h"
|
#include "AssetLoaders/AssetLoaderMenuList.h"
|
||||||
#include "AssetLoaders/AssetLoaderRawFile.h"
|
#include "AssetLoaders/AssetLoaderRawFile.h"
|
||||||
@ -27,7 +28,7 @@ ObjLoader::ObjLoader()
|
|||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_XANIMPARTS, XAnimParts))
|
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_XANIMPARTS, XAnimParts))
|
||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_XMODEL_SURFS, XModelSurfs))
|
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_XMODEL_SURFS, XModelSurfs))
|
||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_XMODEL, XModel))
|
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_XMODEL, XModel))
|
||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_MATERIAL, Material))
|
REGISTER_ASSET_LOADER(AssetLoaderMaterial)
|
||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_PIXELSHADER, MaterialPixelShader))
|
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_PIXELSHADER, MaterialPixelShader))
|
||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader))
|
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_VERTEXSHADER, MaterialVertexShader))
|
||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration))
|
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user