vsg  1.1.0
VulkanSceneGraph library
1 #pragma once
3 /* <editor-fold desc="MIT License">
5 Copyright(c) 2018 Robert Osfield
7 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 </editor-fold> */
15 #include <vsg/core/Array.h>
16 #include <vsg/core/Array2D.h>
17 #include <vsg/core/Array3D.h>
18 #include <vsg/core/Mask.h>
19 #include <vsg/core/Value.h>
21 namespace vsg
22 {
23  // forward declare core Objects
24  class Objects;
25  class External;
27  // forward declare node classes
28  class Node;
29  class Commands;
30  class Group;
31  class QuadGroup;
32  class LOD;
33  class PagedLOD;
34  class StateGroup;
35  class CullGroup;
36  class CullNode;
37  class MatrixTransform;
38  class Transform;
39  class Geometry;
40  class VertexDraw;
41  class VertexIndexDraw;
42  class DepthSorted;
43  class Bin;
44  class Switch;
45  class Light;
46  class AmbientLight;
47  class DirectionalLight;
48  class PointLight;
49  class SpotLight;
51  // forward declare text classes
52  class Text;
53  class TextGroup;
54  class TextTechnique;
55  class TextLayout;
57  // forward declare vulkan classes
58  class BufferInfo;
59  class Compilable;
60  class Command;
61  class StateCommand;
62  class StateSwitch;
63  class CommandBuffer;
64  class RenderPass;
65  class BindDescriptorSet;
66  class BindDescriptorSets;
67  class BindViewDescriptorSets;
68  class Descriptor;
69  class DescriptorBuffer;
70  class DescriptorImage;
71  class DescriptorSet;
72  class BindVertexBuffers;
73  class BindIndexBuffer;
74  class BindComputePipeline;
75  class BindGraphicsPipeline;
76  class BindRayTracingPipeline;
77  class GraphicsPipeline;
78  class ComputePipeline;
79  class RayTracingPipeline;
80  class Draw;
81  class DrawIndexed;
82  class ShaderStage;
83  class GraphicsPipelineState;
84  class VertexInputState;
85  class InputAssemblyState;
86  class TessellationState;
87  class ViewportState;
88  class RasterizationState;
89  class MultisampleState;
90  class DepthStencilState;
91  class ColorBlendState;
92  class DynamicState;
93  class ResourceHints;
94  class ClearAttachments;
95  class ClearColorImage;
96  class ClearDepthStencilImage;
97  class QueryPool;
98  class ResetQueryPool;
99  class BeginQuery;
100  class EndQuery;
101  class WriteTimestamp;
102  class CopyQueryPoolResults;
104  // forward declare rtx classes
105  class DrawMeshTasks;
106  class DrawMeshTasksIndirect;
107  class DrawMeshTasksIndirectCount;
109  // forward declare ui events classes
110  class UIEvent;
111  class WindowEvent;
112  class ExposeWindowEvent;
113  class ConfigureWindowEvent;
114  class CloseWindowEvent;
115  class FocusInEvent;
116  class FocusOutEvent;
117  class KeyEvent;
118  class KeyPressEvent;
119  class KeyReleaseEvent;
120  class PointerEvent;
121  class ButtonPressEvent;
122  class ButtonReleaseEvent;
123  class MoveEvent;
124  class TouchEvent;
125  class TouchDownEvent;
126  class TouchUpEvent;
127  class TouchMoveEvent;
128  class ScrollWheelEvent;
129  class TerminateEvent;
130  class FrameEvent;
132  // forward declare util classes
133  class AnimationPath;
134  class ShaderCompileSettings;
136  // forward declare viewer classes
137  class Camera;
138  class CommandGraph;
139  class RenderGraph;
140  class View;
141  class Viewer;
143  // forward declare general classes
144  class FrameStamp;
146  class VSG_DECLSPEC Visitor : public Object
147  {
148  public:
149  Visitor();
151  Mask traversalMask = MASK_ALL;
152  Mask overrideMask = MASK_OFF;
154  virtual void apply(Object&);
155  virtual void apply(Objects&);
156  virtual void apply(External&);
157  virtual void apply(Data&);
159  // Values
160  virtual void apply(stringValue&);
161  virtual void apply(wstringValue&);
162  virtual void apply(boolValue&);
163  virtual void apply(intValue&);
164  virtual void apply(uintValue&);
165  virtual void apply(floatValue&);
166  virtual void apply(doubleValue&);
167  virtual void apply(vec2Value&);
168  virtual void apply(vec3Value&);
169  virtual void apply(vec4Value&);
170  virtual void apply(dvec2Value&);
171  virtual void apply(dvec3Value&);
172  virtual void apply(dvec4Value&);
173  virtual void apply(bvec2Value&);
174  virtual void apply(bvec3Value&);
175  virtual void apply(bvec4Value&);
176  virtual void apply(ubvec2Value&);
177  virtual void apply(ubvec3Value&);
178  virtual void apply(ubvec4Value&);
179  virtual void apply(svec2Value&);
180  virtual void apply(svec3Value&);
181  virtual void apply(svec4Value&);
182  virtual void apply(usvec2Value&);
183  virtual void apply(usvec3Value&);
184  virtual void apply(usvec4Value&);
185  virtual void apply(ivec2Value&);
186  virtual void apply(ivec3Value&);
187  virtual void apply(ivec4Value&);
188  virtual void apply(uivec2Value&);
189  virtual void apply(uivec3Value&);
190  virtual void apply(uivec4Value&);
192  // Arrays
193  virtual void apply(byteArray&);
194  virtual void apply(ubyteArray&);
195  virtual void apply(shortArray&);
196  virtual void apply(ushortArray&);
197  virtual void apply(intArray&);
198  virtual void apply(uintArray&);
199  virtual void apply(floatArray&);
200  virtual void apply(doubleArray&);
201  virtual void apply(vec2Array&);
202  virtual void apply(vec3Array&);
203  virtual void apply(vec4Array&);
204  virtual void apply(dvec2Array&);
205  virtual void apply(dvec3Array&);
206  virtual void apply(dvec4Array&);
207  virtual void apply(bvec2Array&);
208  virtual void apply(bvec3Array&);
209  virtual void apply(bvec4Array&);
210  virtual void apply(svec2Array&);
211  virtual void apply(svec3Array&);
212  virtual void apply(svec4Array&);
213  virtual void apply(ivec2Array&);
214  virtual void apply(ivec3Array&);
215  virtual void apply(ivec4Array&);
216  virtual void apply(ubvec2Array&);
217  virtual void apply(ubvec3Array&);
218  virtual void apply(ubvec4Array&);
219  virtual void apply(usvec2Array&);
220  virtual void apply(usvec3Array&);
221  virtual void apply(usvec4Array&);
222  virtual void apply(uivec2Array&);
223  virtual void apply(uivec3Array&);
224  virtual void apply(uivec4Array&);
225  virtual void apply(mat4Array&);
226  virtual void apply(dmat4Array&);
227  virtual void apply(block64Array&);
228  virtual void apply(block128Array&);
230  // Array2Ds
231  virtual void apply(ubyteArray2D&);
232  virtual void apply(ushortArray2D&);
233  virtual void apply(uintArray2D&);
234  virtual void apply(floatArray2D&);
235  virtual void apply(doubleArray2D&);
236  virtual void apply(vec2Array2D&);
237  virtual void apply(vec3Array2D&);
238  virtual void apply(vec4Array2D&);
239  virtual void apply(dvec2Array2D&);
240  virtual void apply(dvec3Array2D&);
241  virtual void apply(dvec4Array2D&);
242  virtual void apply(bvec2Array2D&);
243  virtual void apply(bvec3Array2D&);
244  virtual void apply(bvec4Array2D&);
245  virtual void apply(svec2Array2D&);
246  virtual void apply(svec3Array2D&);
247  virtual void apply(svec4Array2D&);
248  virtual void apply(ivec2Array2D&);
249  virtual void apply(ivec3Array2D&);
250  virtual void apply(ivec4Array2D&);
251  virtual void apply(ubvec2Array2D&);
252  virtual void apply(ubvec3Array2D&);
253  virtual void apply(ubvec4Array2D&);
254  virtual void apply(usvec2Array2D&);
255  virtual void apply(usvec3Array2D&);
256  virtual void apply(usvec4Array2D&);
257  virtual void apply(uivec2Array2D&);
258  virtual void apply(uivec3Array2D&);
259  virtual void apply(uivec4Array2D&);
260  virtual void apply(block64Array2D&);
261  virtual void apply(block128Array2D&);
263  // Array3Ds
264  virtual void apply(ubyteArray3D&);
265  virtual void apply(ushortArray3D&);
266  virtual void apply(uintArray3D&);
267  virtual void apply(floatArray3D&);
268  virtual void apply(doubleArray3D&);
269  virtual void apply(vec2Array3D&);
270  virtual void apply(vec3Array3D&);
271  virtual void apply(vec4Array3D&);
272  virtual void apply(dvec2Array3D&);
273  virtual void apply(dvec3Array3D&);
274  virtual void apply(dvec4Array3D&);
275  virtual void apply(ubvec2Array3D&);
276  virtual void apply(ubvec3Array3D&);
277  virtual void apply(ubvec4Array3D&);
278  virtual void apply(block64Array3D&);
279  virtual void apply(block128Array3D&);
281  // Nodes
282  virtual void apply(Node&);
283  virtual void apply(Compilable&);
284  virtual void apply(Commands&);
285  virtual void apply(Group&);
286  virtual void apply(QuadGroup&);
287  virtual void apply(LOD&);
288  virtual void apply(PagedLOD&);
289  virtual void apply(StateGroup&);
290  virtual void apply(CullGroup&);
291  virtual void apply(CullNode&);
292  virtual void apply(MatrixTransform&);
293  virtual void apply(Transform&);
294  virtual void apply(Geometry&);
295  virtual void apply(VertexDraw&);
296  virtual void apply(VertexIndexDraw&);
297  virtual void apply(DepthSorted&);
298  virtual void apply(Bin&);
299  virtual void apply(Switch&);
300  virtual void apply(Light&);
301  virtual void apply(AmbientLight&);
302  virtual void apply(DirectionalLight&);
303  virtual void apply(PointLight&);
304  virtual void apply(SpotLight&);
306  // text
307  virtual void apply(Text&);
308  virtual void apply(TextGroup&);
309  virtual void apply(TextTechnique&);
310  virtual void apply(TextLayout&);
312  // Vulkan nodes
313  virtual void apply(BufferInfo&);
314  virtual void apply(Command&);
315  virtual void apply(StateCommand&);
316  virtual void apply(StateSwitch&);
317  virtual void apply(CommandBuffer&);
318  virtual void apply(RenderPass&);
319  virtual void apply(BindDescriptorSet&);
320  virtual void apply(BindDescriptorSets&);
321  virtual void apply(BindViewDescriptorSets&);
322  virtual void apply(Descriptor&);
323  virtual void apply(DescriptorBuffer&);
324  virtual void apply(DescriptorImage&);
325  virtual void apply(DescriptorSet&);
326  virtual void apply(BindVertexBuffers&);
327  virtual void apply(BindIndexBuffer&);
328  virtual void apply(BindComputePipeline&);
329  virtual void apply(BindGraphicsPipeline&);
330  virtual void apply(BindRayTracingPipeline&);
331  virtual void apply(GraphicsPipeline&);
332  virtual void apply(ComputePipeline&);
333  virtual void apply(RayTracingPipeline&);
334  virtual void apply(GraphicsPipelineState&);
335  virtual void apply(ShaderStage&);
336  virtual void apply(VertexInputState&);
337  virtual void apply(InputAssemblyState&);
338  virtual void apply(TessellationState&);
339  virtual void apply(ViewportState&);
340  virtual void apply(RasterizationState&);
341  virtual void apply(MultisampleState&);
342  virtual void apply(DepthStencilState&);
343  virtual void apply(ColorBlendState&);
344  virtual void apply(DynamicState&);
345  virtual void apply(ResourceHints&);
346  virtual void apply(Draw&);
347  virtual void apply(DrawIndexed&);
348  virtual void apply(ClearAttachments&);
349  virtual void apply(ClearColorImage&);
350  virtual void apply(ClearDepthStencilImage&);
351  virtual void apply(QueryPool&);
352  virtual void apply(ResetQueryPool&);
353  virtual void apply(BeginQuery&);
354  virtual void apply(EndQuery&);
355  virtual void apply(WriteTimestamp&);
356  virtual void apply(CopyQueryPoolResults&);
358  // mesh shading classes
359  virtual void apply(DrawMeshTasks&);
360  virtual void apply(DrawMeshTasksIndirect&);
361  virtual void apply(DrawMeshTasksIndirectCount&);
363  // ui events
364  virtual void apply(UIEvent&);
365  virtual void apply(WindowEvent&);
366  virtual void apply(ExposeWindowEvent&);
367  virtual void apply(ConfigureWindowEvent&);
368  virtual void apply(CloseWindowEvent&);
369  virtual void apply(FocusInEvent&);
370  virtual void apply(FocusOutEvent&);
371  virtual void apply(KeyEvent&);
372  virtual void apply(KeyPressEvent&);
373  virtual void apply(KeyReleaseEvent&);
374  virtual void apply(PointerEvent&);
375  virtual void apply(ButtonPressEvent&);
376  virtual void apply(ButtonReleaseEvent&);
377  virtual void apply(MoveEvent&);
378  virtual void apply(TouchEvent&);
379  virtual void apply(TouchDownEvent&);
380  virtual void apply(TouchUpEvent&);
381  virtual void apply(TouchMoveEvent&);
382  virtual void apply(ScrollWheelEvent&);
383  virtual void apply(TerminateEvent&);
384  virtual void apply(FrameEvent&);
386  // utils
387  virtual void apply(AnimationPath&);
388  virtual void apply(ShaderCompileSettings&);
390  // viewer
391  virtual void apply(Camera&);
392  virtual void apply(CommandGraph&);
393  virtual void apply(RenderGraph&);
394  virtual void apply(View&);
395  virtual void apply(Viewer&);
397  // general classes
398  virtual void apply(FrameStamp&);
399  };
401  // provide Value<>::accept() implementation
402  template<typename T>
403  void Value<T>::accept(Visitor& visitor) { visitor.apply(*this); }
405  // provide Array<>::accept() implementation
406  template<typename T>
407  void Array<T>::accept(Visitor& visitor) { visitor.apply(*this); }
409  // provide Array2D<>::accept() implementation
410  template<typename T>
411  void Array2D<T>::accept(Visitor& visitor) { visitor.apply(*this); }
413  // provide Array3D<>::accept() implementation
414  template<typename T>
415  void Array3D<T>::accept(Visitor& visitor) { visitor.apply(*this); }
417 } // namespace vsg
AmbientLight represents an ambient light source.
Definition: Light.h:42
Definition: AnimationPath.h:27
BeginQuery command encapsulates vkCmdBeginQuery call and associated functionality.
Definition: BeginQuery.h:22
Definition: Bin.h:24
BindComputePipeline state command encapsulates the vkCmdBindPipeline call for a ComputePipeline.
Definition: ComputePipeline.h:65
Definition: BindDescriptorSet.h:90
BindDescriptorSets state command encapsulates vkCmdBindDescriptorSets call and associated settings fo...
Definition: BindDescriptorSet.h:25
BindGraphicsPipeline state command encapsulates the vkCmdBindPipeline call for a GraphicsPipeline.
Definition: GraphicsPipeline.h:105
BindIndexBuffer command encapsulates vkCmdBindIndexBuffer call and associated settings.
Definition: BindIndexBuffer.h:28
BindRayTracingPipeline state command encapsulates vkCmdBindPipeline for a RayTracingPipeline.
Definition: RayTracingPipeline.h:85
BindVertexBuffers command encapsulates vkCmdBindVertexBuffers call and associated settings.
Definition: BindVertexBuffers.h:25
Definition: ViewDependentState.h:53
BufferInfo encapsulates the settings that map to VkDescriptorBufferInfo.
Definition: BufferInfo.h:27
ButtonPressEvent represents a button press event.
Definition: PointerEvent.h:55
ButtonReleaseEvent represents a button release event.
Definition: PointerEvent.h:72
Definition: Camera.h:27
ClearAttachments command encapsulates vkCmdClearAttachments functionality and associated settings.
Definition: ClearAttachments.h:22
ClearColorImage command encapsulates vkCmdClearColorImage functionality and associated settings.
Definition: ClearImage.h:23
ClearDepthStencilImage command encapsulates vkCmdClearDepthStencilImage functionality and associated ...
Definition: ClearImage.h:38
CloseWindowEvent represents a window close event.
Definition: WindowEvent.h:87
ColorBlendState encapsulates VkPipelineColorBlendStateCreateInfo settings passed when setting up Grap...
Definition: ColorBlendState.h:22
CommandBuffer encapsulates VkCommandBuffer.
Definition: CommandBuffer.h:27
CommandGraph is a group node that sits at the top of the scene graph and manages the recording of its...
Definition: CommandGraph.h:27
Command base class for encapsulating vkCmd* calls and associated settings.
Definition: Command.h:23
Definition: Commands.h:29
Base class for encapsulating nodes that have Vulkan objects associated with them that will need compi...
Definition: Compilable.h:23
ComputePipeline encapsulates compute VkPipeline and the VkComputePipelineCreateInfo settings used to ...
Definition: ComputePipeline.h:24
ConfigureWindowEvent represents a window configure event - such as changes to the size of the window.
Definition: WindowEvent.h:64
CopyQueryPoolResults commands encapsulates vkCmdCopyQueryPoolResults and associated settings.
Definition: CopyQueryPoolResults.h:23
CullNode that enables view frustum culling on a list of children.
Definition: CullGroup.h:23
Definition: CullNode.h:25
Definition: Data.h:110
Definition: DepthSorted.h:27
DepthStencilState encapsulates VkPipelineDepthStencilStateCreateInfo settings passed when setting up ...
Definition: DepthStencilState.h:22
Definition: DescriptorBuffer.h:24
Definition: DescriptorImage.h:24
DescriptorSet encapsulates VkDescriptorSet and VkDescriptorSetAllocateInfo settings used to describe ...
Definition: DescriptorSet.h:26
Definition: Descriptor.h:26
DirectionalLight represents a directional light source - used for light sources that are treated as i...
Definition: Light.h:54
DrawIndexed command encapsulates vkCmdDrawIndexed call and associated settings.
Definition: DrawIndexed.h:24
DrawMeshTasksIndirectCount command encapsulates vkCmdDrawMeshTasksIndirectCountEXT call and associate...
Definition: DrawMeshTasksIndirectCount.h:23
DrawMeshTasksIndirect command encapsulates vkCmdDrawMeshTasksIndirectEXT call and associated paramete...
Definition: DrawMeshTasksIndirect.h:23
Definition: DrawMeshTasks.h:22
Draw command encapsulates vkCmdDraw call and associated settings.
Definition: Draw.h:24
DynamicState encapsulates VkPipelineDynamicStateCreateInfo settings passed when setting up GraphicsPi...
Definition: DynamicState.h:22
encapsulation of vkCmdEndQuery
Definition: EndQuery.h:22
ExposeWindowEvent represents a window expose event.
Definition: WindowEvent.h:41
Definition: External.h:31
FocusInEvent represents a window acquiring focus event.
Definition: WindowEvent.h:98
FocusOutEvent represents a window losing focus event.
Definition: WindowEvent.h:109
Definition: ApplicationEvent.h:37
FrameStamp represents the time and frame count of a specific frame.
Definition: FrameStamp.h:22
Definition: Geometry.h:30
Definition: GraphicsPipeline.h:29
GraphicsPipeline encapsulates graphics VkPipeline and the VkGraphicsPipelineCreateInfo settings used ...
Definition: GraphicsPipeline.h:55
Group node provides a list of children.
Definition: Group.h:24
InputAssemblyState encapsulates VkPipelineInputAssemblyStateCreateInfo settings passed when setting u...
Definition: InputAssemblyState.h:22
KeyEvent is a base class for key events.
Definition: KeyEvent.h:286
KeyPressEvent represents a key press event.
Definition: KeyEvent.h:309
KeyReleaseEvent represents a key release event.
Definition: KeyEvent.h:320
Definition: LOD.h:33
Definition: Light.h:25
Definition: MatrixTransform.h:24
MoveEvent represents a pointer move event.
Definition: PointerEvent.h:89
MultisampleState encapsulates VkPipelineMultisampleStateCreateInfo settings passed when setting up Gr...
Definition: MultisampleState.h:22
Definition: Node.h:24
Definition: Object.h:42
Simple container class that has a list of vsg::Object as children.
Definition: Objects.h:25
Definition: PagedLOD.h:36
PointLight represents a local point light source where all light radiants event from the light positi...
Definition: Light.h:68
PointerEvent is a base class for mouse pointer events.
Definition: PointerEvent.h:34
Definition: QuadGroup.h:29
QueryPool encapsulates the VkQueryPool and the VkQueryPoolCreateInfo settings used to set it up.
Definition: QueryPool.h:23
RasterizationState encapsulates VkPipelineRasterizationStateCreateInfo settings passed when setting u...
Definition: RasterizationState.h:22
Definition: RayTracingPipeline.h:26
Definition: RenderGraph.h:28
RenderPass encapsulation of VkRenderPass.
Definition: RenderPass.h:86
ResetQueryPool command encapsulates vkCmdResetQueryPool functionality.
Definition: ResetQueryPool.h:23
ResourceHints provides settings that help preallocation of Vulkan resources and memory.
Definition: ResourceHints.h:23
ScrollWheelEvent represents a scroll wheel event.
Definition: ScrollWheelEvent.h:22
Definition: ShaderModule.h:28
ShaderStage encapsulates VkPipelineShaderStageCreateInfo settings passed when setting up GraphicsPipe...
Definition: ShaderStage.h:24
SpotLight represents a local point light source whose intensity varies as a spot light.
Definition: Light.h:82
Definition: StateCommand.h:24
Definition: StateGroup.h:32
Definition: StateSwitch.h:22
Switch node for toggling on/off recording of children.
Definition: Switch.h:25
TerminateEvent represents an application termination event.
Definition: ApplicationEvent.h:24
TessellationState encapsulates VkPipelineTessellationStateCreateInfo settings passed when setting up ...
Definition: TessellationState.h:22
Definition: TextGroup.h:27
Definition: TextLayout.h:35
Definition: TextTechnique.h:25
Definition: Text.h:30
TouchDownEvent represents a touch down event.
Definition: TouchEvent.h:45
TouchEvent is a base class for touch events.
Definition: TouchEvent.h:24
TouchMoveEvent represents a touch move event.
Definition: TouchEvent.h:67
TouchUpEvent represents a touch up event.
Definition: TouchEvent.h:56
Transform node is a pure virtual base class for positioning/scaling/rotating subgraphs.
Definition: Transform.h:22
UIEvent is a base class for user interface events.
Definition: UIEvent.h:28
Definition: Value.h:39
Definition: VertexDraw.h:25
Definition: VertexIndexDraw.h:25
VertexInputState encapsulates VkPipelineVertexInputStateCreateInfo settings passed when setting up Gr...
Definition: VertexInputState.h:22
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: Viewer.h:31
ViewportState encapsulates VkPipelineViewportStateCreateInfo settings passed when setting up Graphics...
Definition: ViewportState.h:24
Definition: Visitor.h:147
WindowEvent is the base class for events related to a window.
Definition: WindowEvent.h:24
WriteTimestamp command encapsulates vkCmdWriteTimestamp call and settings passed to it.
Definition: WriteTimestamp.h:22