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 static void SetupDecalEmissive(
38 const Math::mat4 transform,
39 const Resources::ResourceId emissive);
40
42 static void SetAlbedoTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId albedo);
44 static void SetNormalTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId normal);
46 static void SetMaterialTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId material);
48 static void SetEmissiveTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId emissive);
49
51 static void SetTransform(const Graphics::GraphicsEntityId id, const Math::mat4 transform);
54
57
58#ifndef PUBLIC_BUILD
60 static void OnRenderDebug(uint32_t flags);
61#endif
62
63private:
64
70 enum
71 {
75 };
76 typedef Ids::IdAllocator<
82
83 enum
84 {
88 };
89 typedef Ids::IdAllocator<
90 Resources::ResourceId,
91 Resources::ResourceId,
92 Resources::ResourceId
95
96 enum
97 {
99 };
100 typedef Ids::IdAllocator<
101 Resources::ResourceId
104
108 static void Dealloc(Graphics::ContextEntityId id);
109
110};
111} // namespace Decals
Definition decalcontext.h:15
DecalType
Definition decalcontext.h:66
@ EmissiveDecal
Definition decalcontext.h:68
@ PBRDecal
Definition decalcontext.h:67
static void Dealloc(Graphics::ContextEntityId id)
deallocate a slice
Definition decalcontext.cc:392
Ids::IdAllocator< Math::mat4, DecalType, Ids::Id32 > GenericDecalAllocator
Definition decalcontext.h:80
static void Create()
setup decal context
Definition decalcontext.cc:65
@ Decal_Type
Definition decalcontext.h:73
@ Decal_TypedId
Definition decalcontext.h:74
@ Decal_Transform
Definition decalcontext.h:72
@ DecalPBR_Albedo
Definition decalcontext.h:85
@ DecalPBR_Normal
Definition decalcontext.h:86
@ DecalPBR_Material
Definition decalcontext.h:87
Ids::IdAllocator< Resources::ResourceId, Resources::ResourceId, Resources::ResourceId > PBRDecalAllocator
Definition decalcontext.h:93
static Math::mat4 GetTransform(const Graphics::GraphicsEntityId id)
get transform of decal
Definition decalcontext.cc:253
virtual ~DecalContext()
destructor
Definition decalcontext.cc:57
@ DecalEmissive_Emissive
Definition decalcontext.h:98
static void SetAlbedoTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId albedo)
set albedo texture for a PBR decal
Definition decalcontext.cc:195
static void UpdateViewDependentResources(const Ptr< Graphics::View > &view, const Graphics::FrameContext &ctx)
update view dependent resources
Definition decalcontext.cc:263
static Graphics::ContextEntityId Alloc()
allocate a new slice for this context
Definition decalcontext.cc:383
static void SetupDecalPBR(const Graphics::GraphicsEntityId id, const Math::mat4 transform, const Resources::ResourceId albedo, const Resources::ResourceId normal, const Resources::ResourceId material)
setup as albedo-normal-material decal
Definition decalcontext.cc:151
static void OnRenderDebug(uint32_t flags)
render debug
Definition decalcontext.cc:346
Ids::IdAllocator< Resources::ResourceId > EmissiveDecalAllocator
Definition decalcontext.h:102
static GenericDecalAllocator genericDecalAllocator
Definition decalcontext.h:81
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:207
static EmissiveDecalAllocator emissiveDecalAllocator
Definition decalcontext.h:103
static void Discard()
discard decal context
Definition decalcontext.cc:143
static void SetMaterialTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId material)
set material texture for a PBR decal
Definition decalcontext.cc:219
static void SetupDecalEmissive(const Graphics::GraphicsEntityId id, const Math::mat4 transform, const Resources::ResourceId emissive)
setup as emissive decal
Definition decalcontext.cc:177
static void SetEmissiveTexture(const Graphics::GraphicsEntityId id, const Resources::ResourceId emissive)
set emissive texture for a PBR decal
Definition decalcontext.cc:231
static PBRDecalAllocator pbrDecalAllocator
Definition decalcontext.h:94
static void SetTransform(const Graphics::GraphicsEntityId id, const Math::mat4 transform)
set transform of decal
Definition decalcontext.cc:243
Definition graphicscontext.h:165
An ID allocator associates an id with a slice in an N number of arrays.
Definition idallocator.h:39
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
The Decal context manages the decal system and entities and rendering.
Definition decalcontext.cc:23
uint32_t Id32
Definition id.h:138
Definition graphicscontext.h:133
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