Nebula
Loading...
Searching...
No Matches
decalcontext.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
9//------------------------------------------------------------------------------
11namespace Decals
12{
13
15{
17public:
21 virtual ~DecalContext();
22
24 static void Create();
26 static void Discard();
27
29 static void SetupDecalPBR(
31 const Math::mat4 transform,
32 const Resources::ResourceId albedo,
33 const Resources::ResourceId normal,
34 const Resources::ResourceId material,
36 );
38 static void SetupDecalEmissive(
40 const Math::mat4 transform,
41 const Resources::ResourceId emissive,
43 );
44
46 static void SetAlbedoTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId albedo);
48 static void SetNormalTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId normal);
50 static void SetMaterialTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId material);
52 static void SetEmissiveTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId emissive);
53
55 static void SetTransform(const Graphics::GraphicsEntityId id, const Math::mat4 transform);
58
60 static void UpdateDecals(const Graphics::FrameContext& ctx);
61
62#ifndef PUBLIC_BUILD
64 static void OnRenderDebug(uint32_t flags);
65#endif
66
67private:
68
74 enum
75 {
80 };
81 typedef Ids::IdAllocator<
88
89 enum
90 {
94 };
95 typedef Ids::IdAllocator<
96 Resources::ResourceId,
97 Resources::ResourceId,
98 Resources::ResourceId
101
102 enum
103 {
105 };
106 typedef Ids::IdAllocator<
107 Resources::ResourceId
110
114 static void Dealloc(Graphics::ContextEntityId id);
115
116};
117} // namespace Decals
DecalType
Definition decalcontext.h:70
@ EmissiveDecal
Definition decalcontext.h:72
@ PBRDecal
Definition decalcontext.h:71
@ DecalEmissive_Emissive
Definition decalcontext.h:104
static void Dealloc(Graphics::ContextEntityId id)
deallocate a slice
Definition decalcontext.cc:410
static void Create()
setup decal context
Definition decalcontext.cc:65
Ids::IdAllocator< Math::mat4, DecalType, Ids::Id32, Graphics::StageMask > GenericDecalAllocator
Definition decalcontext.h:86
@ Decal_Type
Definition decalcontext.h:77
@ Decal_TypedId
Definition decalcontext.h:78
@ Decal_Transform
Definition decalcontext.h:76
@ Decal_StageMask
Definition decalcontext.h:79
static Math::mat4 GetTransform(const Graphics::GraphicsEntityId id)
get transform of decal
Definition decalcontext.cc:263
virtual ~DecalContext()
destructor
Definition decalcontext.cc:57
static void SetAlbedoTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId albedo)
set albedo texture for a PBR decal
Definition decalcontext.cc:190
static void SetupDecalEmissive(const Graphics::GraphicsEntityId id, const Math::mat4 transform, const Resources::ResourceId emissive, const Graphics::StageMask stageMask=Graphics::PRIMARY_STAGE_MASK)
setup as emissive decal
Definition decalcontext.cc:169
static Graphics::ContextEntityId Alloc()
allocate a new slice for this context
Definition decalcontext.cc:401
static void SetupDecalPBR(const Graphics::GraphicsEntityId id, const Math::mat4 transform, const Resources::ResourceId albedo, const Resources::ResourceId normal, const Resources::ResourceId material, const Graphics::StageMask stageMask=Graphics::PRIMARY_STAGE_MASK)
setup as albedo-normal-material decal
Definition decalcontext.cc:140
static void OnRenderDebug(uint32_t flags)
render debug
Definition decalcontext.cc:364
Ids::IdAllocator< Resources::ResourceId > EmissiveDecalAllocator
Definition decalcontext.h:108
static GenericDecalAllocator genericDecalAllocator
Definition decalcontext.h:87
Ids::IdAllocator< Resources::ResourceId, Resources::ResourceId, Resources::ResourceId > PBRDecalAllocator
Definition decalcontext.h:99
@ DecalPBR_Albedo
Definition decalcontext.h:91
@ DecalPBR_Normal
Definition decalcontext.h:92
@ DecalPBR_Material
Definition decalcontext.h:93
static void UpdateDecals(const Graphics::FrameContext &ctx)
update view dependent resources
Definition decalcontext.cc:273
DecalContext()
constructor
Definition decalcontext.cc:50
static void SetNormalTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId normal)
set normal texture for a PBR decal
Definition decalcontext.cc:205
static EmissiveDecalAllocator emissiveDecalAllocator
Definition decalcontext.h:109
static void Discard()
discard decal context
Definition decalcontext.cc:132
static void SetMaterialTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId material)
set material texture for a PBR decal
Definition decalcontext.cc:220
static void SetEmissiveTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId emissive)
set emissive texture for a PBR decal
Definition decalcontext.cc:235
static PBRDecalAllocator pbrDecalAllocator
Definition decalcontext.h:100
static void SetTransform(const Graphics::GraphicsEntityId id, const Math::mat4 transform)
set transform of decal
Definition decalcontext.cc:250
Definition graphicscontext.h:175
An ID allocator associates an id with a slice in an N number of arrays.
Definition idallocator.h:39
The Decal context manages the decal system and entities and rendering.
Definition decalcontext.cc:23
static constexpr StageMask PRIMARY_STAGE_MASK
Definition view.h:24
uint16_t StageMask
Definition view.h:23
uint32_t Id32
Definition id.h:138
Definition graphicscontext.h:143
Definition graphicsserver.h:31
The graphics entity is only an Id, to which we can attach GraphicsContexts.
Definition graphicsentity.h:16
A 4x4 single point precision float matrix.
Definition mat4.h:49