vsg  1.1.0
VulkanSceneGraph library
TextGroup.h
1 #pragma once
2 
3 /* <editor-fold desc="MIT License">
4 
5 Copyright(c) 2022 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/text/Text.h>
16 
17 namespace vsg
18 {
26  class VSG_DECLSPEC TextGroup : public vsg::Inherit<vsg::Node, TextGroup>
27  {
28  public:
29  template<class N, class V>
30  static void t_traverse(N& node, V& visitor)
31  {
32  if (node.technique) node.technique->accept(visitor);
33  for (auto& child : node.children) child->accept(visitor);
34  }
35 
36  void traverse(Visitor& visitor) override { t_traverse(*this, visitor); }
37  void traverse(ConstVisitor& visitor) const override { t_traverse(*this, visitor); }
38  void traverse(RecordTraversal& visitor) const override
39  {
40  if (technique) technique->accept(visitor);
41  }
42 
43  int compare(const Object& rhs) const override;
44 
45  void read(Input& input) override;
46  void write(Output& output) const override;
47 
48  ref_ptr<Font> font;
49  ref_ptr<ShaderSet> shaderSet;
50  ref_ptr<TextTechnique> technique;
51 
52  using Children = std::vector<ref_ptr<Text>, allocator_affinity_nodes<ref_ptr<Text>>>;
53  Children children;
54 
55  void addChild(ref_ptr<Text> text);
56 
59  virtual void setup(uint32_t minimumAllocation = 0, ref_ptr<const Options> options = {});
60  };
61  VSG_type_name(vsg::TextGroup);
62 } // namespace vsg
Definition: ConstVisitor.h:147
Definition: Inherit.h:28
Definition: Input.h:44
Definition: Object.h:42
Definition: Output.h:41
RecordTraversal traverses a scene graph doing view frustum culling and invoking state/commands to rec...
Definition: RecordTraversal.h:61
Definition: TextGroup.h:27
virtual void setup(uint32_t minimumAllocation=0, ref_ptr< const Options > options={})
int compare(const Object &rhs) const override
compare two objects, return -1 if this object is less than rhs, return 0 if it's equal,...
Definition: Visitor.h:147
Definition: ref_ptr.h:22
std container adapter for allocating with MEMORY_AFFINITY_NODES
Definition: Allocator.h:138