Vulkan Schnee
0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
MaterialAsset.cpp
Go to the documentation of this file.
1
#include "
Engine/Material/MaterialAsset.h
"
2
#include "
Engine/Material/MaterialData.h
"
3
#include "
Engine/Ecs/EcsData.h
"
4
5
namespace
EngineCore
{
6
MaterialAsset::MaterialAsset
(
const
Asset::Path
& assetPath,
bool
initWithDefaultData ) :
AssetBase
( initWithDefaultData )
7
{
8
9
}
10
11
void
MaterialAsset::unload
()
12
{
13
AssetBase::unload();
14
type
=
PipelineNames::NORMALS_SHADER
;
15
}
16
17
void
MaterialAsset::updateLoadingState
()
18
{
19
if
(
data
== entt::null)
20
{
21
loadingState
=
Asset::CpuLoadingState::UNLOADED
;
22
return
;
23
}
24
25
// Check for any of the material component types
26
// These are the actual material data classes used as ECS components (from MaterialData.h)
27
if
(
mainRegistry
.any_of<
28
NormalMaterialData
,
29
DiffuseFlatColorMaterialData
,
30
DiffuseShaderMaterialData
,
31
MovableDiffuseShaderMaterialData
,
32
L0ShaderMaterialData
,
33
L1ShaderMaterialData
,
34
L2ShaderMaterialData
,
35
DynamicTexturesMaterialData
,
36
StaticLightmapMaterialData
>(
data
))
37
{
38
loadingState
=
Asset::CpuLoadingState::LOADED
;
39
return
;
40
}
41
42
// Entity exists but no material component yet - still loading
43
if
(
loadingState
==
Asset::CpuLoadingState::UNLOADED
)
44
{
45
loadingState
=
Asset::CpuLoadingState::LOADING
;
46
}
47
}
48
}
// namespace EngineCore
EcsData.h
MaterialAsset.h
MaterialData.h
Asset::AssetBase::data
entt::entity data
Definition
Asset.h:98
Asset::AssetBase::AssetBase
AssetBase(bool initializeDefaultEntity=false)
Definition
Asset.h:52
Asset::AssetBase::loadingState
CpuLoadingState loadingState
Definition
Asset.h:95
Asset::AssetBase::mainRegistry
entt::registry & mainRegistry
Definition
Asset.h:97
EngineCore::DiffuseFlatColorMaterialData
Material data for an Object which displays a flat color.
Definition
MaterialData.h:54
EngineCore::DiffuseShaderMaterialData
diffuse shader
Definition
MaterialData.h:74
EngineCore::DynamicTexturesMaterialData
Dynamic textures material with PBR and lightmap support.
Definition
MaterialData.h:312
EngineCore::L0ShaderMaterialData
Definition
MaterialData.h:194
EngineCore::L1ShaderMaterialData
L1 Spherical Harmoics shader.
Definition
MaterialData.h:232
EngineCore::L2ShaderMaterialData
Definition
MaterialData.h:268
EngineCore::MaterialAsset::MaterialAsset
MaterialAsset(const Asset::Path &assetPath, bool initWithDefaultData=false)
Definition
MaterialAsset.cpp:6
EngineCore::MaterialAsset::unload
void unload() override
Unload data.
Definition
MaterialAsset.cpp:11
EngineCore::MaterialAsset::type
PipelineNames type
Definition
MaterialAsset.h:164
EngineCore::MaterialAsset::updateLoadingState
void updateLoadingState() override
Updates the loading state based on presence of material ECS components.
Definition
MaterialAsset.cpp:17
EngineCore::MovableDiffuseShaderMaterialData
Moveable diffuse shader with PBR and lightmap support.
Definition
MaterialData.h:104
EngineCore::NormalMaterialData
Material data for an object which displays its normals.
Definition
MaterialData.h:32
EngineCore::StaticLightmapMaterialData
Static lightmap material with PBR support.
Definition
MaterialData.h:410
Asset::LOADED
@ LOADED
All components of the asset have been loaded, and it is ready to be used.
Definition
Asset.h:39
Asset::LOADING
@ LOADING
While the asset is currently being processed in the asset pipeline.
Definition
Asset.h:35
Asset::UNLOADED
@ UNLOADED
When the asset is not loaded yet but the frame is already existing for the heavy data to be loaded in...
Definition
Asset.h:26
EngineCore
Log category system implementation.
Definition
CameraComponent.cpp:8
EngineCore::NORMALS_SHADER
@ NORMALS_SHADER
Definition
MaterialTypes.h:13
Asset::Path
Definition
AssetPath.h:5
Engine
src
Engine
Materials
MaterialAsset.cpp
Generated by
1.14.0