vsg  1.0.4
VulkanSceneGraph library
View.h
1 #pragma once
2 
3 /* <editor-fold desc="MIT License">
4 
5 Copyright(c) 2018 Robert Osfield
6 
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:
8 
9 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 
13 </editor-fold> */
14 
15 #include <vsg/app/Camera.h>
16 #include <vsg/app/Window.h>
17 #include <vsg/nodes/Group.h>
18 #include <vsg/state/ViewDependentState.h>
19 
20 namespace vsg
21 {
22 
24  class VSG_DECLSPEC View : public Inherit<Group, View>
25  {
26  public:
27  View();
28 
29  explicit View(ref_ptr<Camera> in_camera, ref_ptr<Node> in_scenegraph = {});
30 
31  template<class N, class V>
32  static void t_accept(N& node, V& visitor)
33  {
34  if ((visitor.traversalMask & (visitor.overrideMask | node.mask)) == MASK_OFF) return;
35 
36  auto cached_traversalMask = visitor.traversalMask;
37 
38  visitor.traversalMask = visitor.traversalMask & node.mask;
39 
40  visitor.apply(node);
41 
42  visitor.traversalMask = cached_traversalMask;
43  }
44 
45  void accept(Visitor& visitor) override { t_accept(*this, visitor); }
46  void accept(ConstVisitor& visitor) const override { t_accept(*this, visitor); }
47  void accept(RecordTraversal& visitor) const override { t_accept(*this, visitor); }
48 
51 
53  const uint32_t viewID = 0;
54 
58  Mask mask = MASK_ALL;
59 
61  std::vector<ref_ptr<Bin>> bins;
62 
65 
67  GraphicsPipelineStates overridePipelineStates;
68 
69  protected:
70  virtual ~View();
71  };
72  VSG_type_name(vsg::View);
73 
74 } // namespace vsg
Definition: ConstVisitor.h:140
Definition: Inherit.h:28
RecordTraversal traverses a scene graph doing view frustum culling and invoking state/commands to rec...
Definition: RecordTraversal.h:59
View class is Group class that pairs a Camera that defines the view with a subgraph that defines the ...
Definition: View.h:25
ref_ptr< ViewDependentState > viewDependentState
view dependent state used for positional state like lighting, texgen and clipping
Definition: View.h:64
GraphicsPipelineStates overridePipelineStates
override states for customization of graphics pipelines for this view
Definition: View.h:67
Mask mask
Definition: View.h:58
std::vector< ref_ptr< Bin > > bins
bins
Definition: View.h:61
ref_ptr< Camera > camera
camera controls the viewport state and projection and view matrices
Definition: View.h:50
Definition: Visitor.h:140
Definition: ref_ptr.h:22