Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
outlinebuilder.h
Go to the documentation of this file.
1 
18 #ifndef ION_TEXT_OUTLINEBUILDER_H_
19 #define ION_TEXT_OUTLINEBUILDER_H_
20 
22 #include "ion/math/vector.h"
23 #include "ion/text/builder.h"
24 
25 namespace ion {
26 namespace text {
27 
48 class ION_API OutlineBuilder : public Builder {
49  public:
50  OutlineBuilder(const FontImagePtr& font_image,
51  const gfxutils::ShaderManagerPtr& shader_manager,
52  const base::AllocatorPtr& allocator);
53 
57  bool SetSdfPadding(float padding);
58  bool SetTextColor(const math::VectorBase4f& color);
59  bool SetOutlineColor(const math::VectorBase4f& color);
60  bool SetOutlineWidth(float width);
61  bool SetHalfSmoothWidth(float width);
62 
63  protected:
66  ~OutlineBuilder() override;
67 
69  const gfx::ShaderInputRegistryPtr GetShaderInputRegistry() override;
70  void GetShaderStrings(std::string* id_string,
71  std::string* vertex_source,
72  std::string* fragment_source) override;
73  void UpdateUniforms(const gfx::ShaderInputRegistryPtr& registry,
74  gfx::Node* node) override;
75  void BindAttributes(const gfx::AttributeArrayPtr& attr_array,
76  const gfx::BufferObjectPtr& buffer_object) override;
77  base::AllocVector<char> BuildVertexData(const Layout& layout,
78  size_t* vertex_size,
79  size_t* num_vertices) override;
80 
81  private:
83  struct Vertex {
84  Vertex() {}
85  Vertex(const math::Point3f& position_in,
86  const math::Point2f& texture_coords_in,
87  const math::Vector3f& font_pixel_vec_in)
88  : position(position_in),
89  texture_coords(texture_coords_in),
90  font_pixel_vec(font_pixel_vec_in) {}
91  math::Point3f position;
92  math::Point2f texture_coords;
96  math::Vector3f font_pixel_vec;
97  };
98 };
99 
102 
103 } // namespace text
104 } // namespace ion
105 
106 #endif // ION_TEXT_OUTLINEBUILDER_H_
std::string text
base::ReferentPtr< OutlineBuilder >::Type OutlineBuilderPtr
Convenience typedef for shared pointer to an OutlineBuilder.
Point2f texture_coords
Definition: shapeutils.cc:74
Point3f position
Definition: shapeutils.cc:67
A Layout instance specifies how glyphs are arranged to form text.
Definition: layout.h:127
int width
OutlineBuilder is a derived Builder class that can render text with outlines.
Builder is an abstract base class for building graphics objects used to render text.
Definition: builder.h:45
A Node instance represents a node in a scene graph.
Definition: node.h:45
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
Definition: sharedptr.h:60
This class can be used in place of std::vector to allow an Ion Allocator to be used for memory alloca...
Definition: allocvector.h:50