vsg 1.1.3
VulkanSceneGraph library
Loading...
Searching...
No Matches
CpuLayoutTechnique.h
1#pragma once
2
3/* <editor-fold desc="MIT License">
4
5Copyright(c) 2020 Robert Osfield
6
7Permission 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
9The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
11THE 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/commands/BindIndexBuffer.h>
16#include <vsg/commands/BindVertexBuffers.h>
17#include <vsg/commands/DrawIndexed.h>
18#include <vsg/nodes/StateGroup.h>
19#include <vsg/text/Font.h>
20#include <vsg/text/TextLayout.h>
21#include <vsg/text/TextTechnique.h>
22
23namespace vsg
24{
25
26 class VSG_DECLSPEC CpuLayoutTechnique : public Inherit<TextTechnique, CpuLayoutTechnique>
27 {
28 public:
29 template<class N, class V>
30 static void t_traverse(N& node, V& visitor)
31 {
32 if (node.scenegraph) node.scenegraph->accept(visitor);
33 }
34
35 void traverse(Visitor& visitor) override { t_traverse(*this, visitor); }
36 void traverse(ConstVisitor& visitor) const override { t_traverse(*this, visitor); }
37 void traverse(RecordTraversal& visitor) const override { t_traverse(*this, visitor); }
38
39 void setup(Text* text, uint32_t minimumAllocation = 0, ref_ptr<const Options> options = {}) override;
40 void setup(TextGroup* textGroup, uint32_t minimumAllocation = 0, ref_ptr<const Options> options = {}) override;
41 dbox extents() const override { return textExtents; }
42
43 virtual ref_ptr<Node> createRenderingSubgraph(ref_ptr<ShaderSet> shaderSet, ref_ptr<Font> font, bool billboard, TextQuads& textQuads, uint32_t minimumAllocation);
44
45 // implementation data structure
46 dbox textExtents;
47 ref_ptr<Node> scenegraph;
48
49 ref_ptr<vec3Array> vertices;
50 ref_ptr<vec4Array> colors;
51 ref_ptr<vec4Array> outlineColors;
52 ref_ptr<floatArray> outlineWidths;
53 ref_ptr<vec3Array> texcoords;
54 ref_ptr<vec4Array> centerAndAutoScaleDistances;
55 ref_ptr<Data> indices;
56 ref_ptr<DrawIndexed> drawIndexed;
57
58 ref_ptr<BindVertexBuffers> bindVertexBuffers;
59 ref_ptr<BindIndexBuffer> bindIndexBuffer;
60 };
61 VSG_type_name(vsg::CpuLayoutTechnique);
62
63} // namespace vsg
Definition ConstVisitor.h:172
Definition CpuLayoutTechnique.h:27
Definition Inherit.h:28
RecordTraversal traverses a scene graph doing view frustum culling and invoking state/commands to rec...
Definition RecordTraversal.h:69
Definition TextGroup.h:27
Definition Text.h:30
Definition Visitor.h:172
Definition ref_ptr.h:22