mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-21 00:25:44 +00:00
Create Default materials for iw4
This commit is contained in:
parent
f0edfc5939
commit
6d622e6ae1
17
src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMaterial.cpp
Normal file
17
src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMaterial.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "AssetLoaderMaterial.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "ObjLoading.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "Pool/GlobalAssetPool.h"
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
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/IW4/AssetLoaders/AssetLoaderMaterial.h
Normal file
14
src/ObjLoading/Game/IW4/AssetLoaders/AssetLoaderMaterial.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "AssetLoading/BasicAssetLoader.h"
|
||||
#include "SearchPath/ISearchPath.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
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 "ObjLoading.h"
|
||||
#include "AssetLoaders/AssetLoaderLocalizeEntry.h"
|
||||
#include "AssetLoaders/AssetLoaderMaterial.h"
|
||||
#include "AssetLoaders/AssetLoaderMenuList.h"
|
||||
#include "AssetLoaders/AssetLoaderRawFile.h"
|
||||
#include "AssetLoading/AssetLoadingManager.h"
|
||||
@ -25,7 +26,7 @@ ObjLoader::ObjLoader()
|
||||
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, 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_VERTEXSHADER, MaterialVertexShader))
|
||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_VERTEXDECL, MaterialVertexDeclaration))
|
||||
|
Loading…
x
Reference in New Issue
Block a user