Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
CubeShadowMapGenerator.cpp
Go to the documentation of this file.
1
2
4
16
17namespace Divide {
18namespace {
20};
21
24{
25 Console::printfn(LOCALE_STR("LIGHT_CREATE_SHADOW_FB"), "Single Shadow Map");
26 g_shadowSettings = context.context().config().rendering.shadowMapping;
27}
28
29void CubeShadowMapGenerator::render([[maybe_unused]] const Camera& playerCamera, Light& light, U16 lightIndex, GFX::CommandBuffer& bufferInOut, GFX::MemoryBarrierCommand& memCmdInOut) {
31
32 const vec3<F32> lightPos = light.sgn()->get<TransformComponent>()->getWorldPosition();
33
34 auto cmd = GFX::EnqueueCommand<GFX::BeginDebugScopeCommand>(bufferInOut);
35 Util::StringFormat( cmd->_scopeName, "Cube Shadow Pass Light: [ {} ]", lightIndex );
36 cmd->_scopeId = lightIndex;
37
38 RenderPassParams params = {};
40 params._sourceNode = light.sgn();
41 params._refreshLightData = false;
46
47 mat4<F32> viewProjMatrix[6];
50 light.sgn()->get<TransformComponent>()->getWorldPosition(),
51 vec2<F32>(0.01f, light.range() * 1.1f),
52 bufferInOut,
53 memCmdInOut,
54 viewProjMatrix);
55
56 for (U8 i = 0u; i < 6u; ++i)
57 {
58 light.setShadowLightPos( i, lightPos);
59 light.setShadowFloatValue(i, light.range() * 1.1f );
60 light.setShadowVPMatrix( i, mat4<F32>::Multiply(viewProjMatrix[i], MAT4_BIAS_ZERO_ONE_Z ));
61 }
62
63 GFX::EnqueueCommand<GFX::EndDebugScopeCommand>(bufferInOut);
64}
65
66void CubeShadowMapGenerator::updateMSAASampleCount([[maybe_unused]] const U8 sampleCount) noexcept {
68}
69
70} //namespace Divide
#define LOCALE_STR(X)
Definition: Localization.h:91
#define DIVIDE_UNEXPECTED_CALL()
#define PROFILE_SCOPE_AUTO(CATEGORY)
Definition: Profiler.h:87
void render(const Camera &playerCamera, Light &light, U16 lightIndex, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut) override
void updateMSAASampleCount(U8 sampleCount) noexcept override
Rough around the edges Adapter pattern abstracting the actual rendering API and access to the GPU.
Definition: GFXDevice.h:215
void generateCubeMap(RenderPassParams &params, U16 arrayOffset, const vec3< F32 > &pos, vec2< F32 > zPlanes, GFX::CommandBuffer &commandsInOut, GFX::MemoryBarrierCommand &memCmdInOut, mat4< F32 > *viewProjectionOut=nullptr)
Generate a cube texture and store it in the provided RenderTarget.
Definition: GFXDevice.cpp:1501
A light object placed in the scene at a certain position.
Definition: Light.h:58
void setShadowFloatValue(const U8 index, const F32 newValue) noexcept
Definition: Light.inl:60
void setShadowLightPos(const U8 index, const vec3< F32 > &newValue) noexcept
Definition: Light.inl:62
void setShadowVPMatrix(const U8 index, const mat4< F32 > &newValue) noexcept
Definition: Light.inl:58
U16 getShadowArrayOffset() const noexcept
Definition: Light.inl:79
PlatformContext & context() noexcept
Configuration & config() noexcept
const ShadowType _type
Definition: ShadowMap.h:83
static const RenderTargetHandle & getShadowMap(LightType type)
Definition: ShadowMap.cpp:495
vec3< F32 > getWorldPosition() const
Return the position.
constexpr Optick::Category::Type Graphics
Definition: Profiler.h:60
Str StringFormat(const char *fmt, Args &&...args)
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
static constexpr U32 RT_DEPTH_ATTACHMENT_IDX
Definition: RTAttachment.h:71
static const mat4< F32 > MAT4_BIAS_ZERO_ONE_Z
Definition: MathMatrices.h:720
uint8_t U8
uint16_t U16
ShadowType
Definition: ShadowMap.h:40
RTClearEntry DEFAULT_CLEAR_ENTRY
constexpr auto to_base(const Type value) -> Type
struct Divide::Configuration::Rendering::ShadowMapping shadowMapping
struct Divide::Configuration::Rendering rendering
static NO_INLINE void printfn(const char *format, T &&... args)
const SceneGraphNode * _sourceNode
RTDrawDescriptor _targetDescriptorMainPass
RTClearDescriptor _clearDescriptorMainPass
RenderTargetID _targetID
Definition: RenderTarget.h:47