Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
CascadedShadowMapsGenerator.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef DVD_CSM_GENERATOR_H_
34#define DVD_CSM_GENERATOR_H_
35
36#include "ShadowMap.h"
38
39namespace Divide {
40
41class Quad3D;
42class Camera;
43class Pipeline;
44class GFXDevice;
45class ShaderBuffer;
46class ShaderProgram;
48
49struct DebugView;
50
51FWD_DECLARE_MANAGED_CLASS(SceneGraphNode);
52
56 public:
57 explicit CascadedShadowMapsGenerator(GFXDevice& context);
59
60 void render(const Camera& playerCamera, Light& light, U16 lightIndex, GFX::CommandBuffer& bufferInOut, GFX::MemoryBarrierCommand& memCmdInOut) override;
61 void generateWorldAO( const Camera& playerCamera, GFX::CommandBuffer& bufferInOut, GFX::MemoryBarrierCommand& memCmdInOut );
62
63 protected:
64 using SplitDepths = std::array<F32, Config::Lighting::MAX_CSM_SPLITS_PER_LIGHT>;
65
66 SplitDepths calculateSplitDepths( DirectionalLightComponent& light, const vec2<F32> nearFarPlanes) const noexcept;
67
68 void applyFrustumSplits(DirectionalLightComponent& light, const Camera& shadowCamera, U8 numSplits) const;
69
70 void updateMSAASampleCount(U8 sampleCount) override;
71
72 protected:
73 void blurTarget( U16 layerOffset, U16 layerCount, GFX::CommandBuffer& bufferInOut );
74
75 protected:
78 Handle<ShaderProgram> _blurDepthMapShader = INVALID_HANDLE<ShaderProgram>;
79 Handle<ShaderProgram> _blurAOMapShader = INVALID_HANDLE<ShaderProgram>;
83};
84
85}; // namespace Divide
86
87#endif //DVD_CSM_GENERATOR_H_
#define FWD_DECLARE_MANAGED_CLASS(T)
void render(const Camera &playerCamera, Light &light, U16 lightIndex, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut) override
void generateWorldAO(const Camera &playerCamera, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
void applyFrustumSplits(DirectionalLightComponent &light, const Camera &shadowCamera, U8 numSplits) const
void blurTarget(U16 layerOffset, U16 layerCount, GFX::CommandBuffer &bufferInOut)
std::array< F32, Config::Lighting::MAX_CSM_SPLITS_PER_LIGHT > SplitDepths
void updateMSAASampleCount(U8 sampleCount) override
SplitDepths calculateSplitDepths(DirectionalLightComponent &light, const vec2< F32 > nearFarPlanes) const noexcept
Rough around the edges Adapter pattern abstracting the actual rendering API and access to the GPU.
Definition: GFXDevice.h:215
A light object placed in the scene at a certain position.
Definition: Light.h:58
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
uint8_t U8
DirectionalLightComponent(SceneGraphNode *sgn, PlatformContext &context)
uint16_t U16