15#include <vsg/app/CommandGraph.h>
16#include <vsg/app/RenderGraph.h>
17#include <vsg/io/Logger.h>
18#include <vsg/lighting/Light.h>
19#include <vsg/nodes/Switch.h>
20#include <vsg/state/BindDescriptorSet.h>
21#include <vsg/state/DescriptorBuffer.h>
22#include <vsg/state/DescriptorImage.h>
23#include <vsg/utils/ShaderSet.h>
31 class VSG_DECLSPEC ViewDescriptorSetLayout :
public Inherit<DescriptorSetLayout, ViewDescriptorSetLayout>
34 ViewDescriptorSetLayout();
36 VkDescriptorSetLayout
vk(uint32_t deviceID)
const override {
return _viewDescriptorSetLayout ? _viewDescriptorSetLayout->vk(deviceID) : 0; }
40 void read(
Input& input)
override;
41 void write(
Output& output)
const override;
43 void compile(
Context& context)
override;
53 class VSG_DECLSPEC BindViewDescriptorSets :
public Inherit<StateCommand, BindViewDescriptorSets>
56 BindViewDescriptorSets();
58 BindViewDescriptorSets(VkPipelineBindPoint in_bindPoint,
PipelineLayout* in_pipelineLayout, uint32_t in_firstSet) :
59 Inherit(1 + in_firstSet),
60 pipelineBindPoint(in_bindPoint),
61 layout(in_pipelineLayout),
67 VkPipelineBindPoint pipelineBindPoint;
73 template<
class N,
class V>
74 static void t_traverse(N& bds, V& visitor)
76 if (bds.layout) bds.layout->accept(visitor);
79 void traverse(
Visitor& visitor)
override { t_traverse(*
this, visitor); }
80 void traverse(ConstVisitor& visitor)
const override { t_traverse(*
this, visitor); }
82 void read(Input& input)
override;
83 void write(Output& output)
const override;
86 void compile(Context& context)
override;
88 void record(CommandBuffer& commandBuffer)
const override;
91 virtual ~BindViewDescriptorSets() {}
93 VSG_type_name(vsg::BindViewDescriptorSets);
105 class VSG_DECLSPEC ViewDependentState :
public Inherit<Object, ViewDependentState>
108 explicit ViewDependentState(
View* in_view);
110 template<
class N,
class V>
111 static void t_traverse(N& node, V& visitor)
113 node.descriptorSet->accept(visitor);
114 if (node.preRenderCommandGraph) node.preRenderCommandGraph->accept(visitor);
117 void traverse(
Visitor& visitor)
override { t_traverse(*
this, visitor); }
118 void traverse(
ConstVisitor& visitor)
const override { t_traverse(*
this, visitor); }
122 std::vector<std::pair<dmat4, const AmbientLight*>> ambientLights;
123 std::vector<std::pair<dmat4, const DirectionalLight*>> directionalLights;
124 std::vector<std::pair<dmat4, const PointLight*>> pointLights;
125 std::vector<std::pair<dmat4, const SpotLight*>> spotLights;
130 virtual void clear();
131 virtual void bindDescriptorSets(
CommandBuffer& commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet);
133 virtual void compile(
Context& context);
135 View* view =
nullptr;
152 double maxShadowDistance = 1e8;
153 double shadowMapBias = 0.005;
163 bool compiled =
false;
173 mutable std::vector<ShadowMap> shadowMaps;
176 ~ViewDependentState();
int compare(const Object &rhs_object) const override
compare two objects, return -1 if this object is less than rhs, return 0 if it's equal,...
CommandBuffer encapsulates VkCommandBuffer.
Definition CommandBuffer.h:27
Definition ConstVisitor.h:175
PipelineLayout encapsulates VkPipelineLayout and the VkPipelineLayoutCreateInfo settings used to set ...
Definition PipelineLayout.h:27
RecordTraversal traverses a scene graph doing view frustum culling and invoking state/commands to rec...
Definition RecordTraversal.h:70
ResourceRequirements provides a container for various Vulkan resource requirements that can be used t...
Definition ResourceRequirements.h:30
Definition ViewDependentState.h:106
Definition ViewDependentState.h:32
VkDescriptorSetLayout vk(uint32_t deviceID) const override
Vulkan VkDescriptorSetLayout handle.
Definition ViewDependentState.h:36
int compare(const Object &rhs_object) const override
compare two objects, return -1 if this object is less than rhs, return 0 if it's equal,...
View is a Group class that pairs a Camera that defines the view with a subgraph that defines the scen...
Definition View.h:36
Definition ViewDependentState.h:168