vsg  1.1.0
VulkanSceneGraph library
StandardLayout.h
1 #pragma once
2 
3 /* <editor-fold desc="MIT License">
4 
5 Copyright(c) 2020 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/core/Array.h>
16 #include <vsg/text/TextLayout.h>
17 
18 namespace vsg
19 {
20 
21  class VSG_DECLSPEC StandardLayout : public Inherit<TextLayout, StandardLayout>
22  {
23  public:
24  void read(Input& input) override;
25  void write(Output& output) const override;
26 
27  enum Alignment
28  {
29  BASELINE_ALIGNMENT,
30  LEFT_ALIGNMENT,
31  TOP_ALIGNMENT = LEFT_ALIGNMENT,
32  CENTER_ALIGNMENT,
33  RIGHT_ALIGNMENT,
34  BOTTOM_ALIGNMENT = RIGHT_ALIGNMENT
35  };
36 
37  enum GlyphLayout
38  {
39  LEFT_TO_RIGHT_LAYOUT,
40  RIGHT_TO_LEFT_LAYOUT,
41  VERTICAL_LAYOUT
42  };
43 
44  Alignment horizontalAlignment = BASELINE_ALIGNMENT;
45  Alignment verticalAlignment = BASELINE_ALIGNMENT;
46  GlyphLayout glyphLayout = LEFT_TO_RIGHT_LAYOUT;
47  vec3 position = vec3(0.0f, 0.0f, 0.0f);
48  vec3 horizontal = vec3(1.0f, 0.0f, 0.0f);
49  vec3 vertical = vec3(0.0f, 1.0f, 0.0f);
50  vec4 color = vec4(1.0f, 1.0f, 1.0f, 1.0f);
51  vec4 outlineColor = vec4(0.0f, 0.0f, 0.0f, 1.0f);
52  float outlineWidth = 0.0f;
53  bool billboard = false;
54  float billboardAutoScaleDistance = 0.0f;
55 
56  bool requiresBillboard() const override { return billboard; }
57  void layout(const Data* text, const Font& font, TextQuads& texQuads) override;
58  vec2 alignment(const Data* text, const Font& font) const override;
59  dbox extents(const Data* text, const Font& font) const override;
60  };
61  VSG_type_name(vsg::StandardLayout);
62 
63 } // namespace vsg
Definition: Data.h:110
Definition: Font.h:24
Definition: Inherit.h:28
Definition: Input.h:44
Definition: Output.h:41
Definition: StandardLayout.h:22