Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
basicbuilder.h
Go to the documentation of this file.
1 
18 #ifndef ION_TEXT_BASICBUILDER_H_
19 #define ION_TEXT_BASICBUILDER_H_
20 
22 #include "ion/math/vector.h"
23 #include "ion/text/builder.h"
24 
25 namespace ion {
26 namespace text {
27 
38 class ION_API BasicBuilder : public Builder {
39  public:
40  BasicBuilder(const FontImagePtr& font_image,
41  const gfxutils::ShaderManagerPtr& shader_manager,
42  const base::AllocatorPtr& allocator);
43 
47  bool SetSdfPadding(float padding);
48  bool SetTextColor(const math::VectorBase4f& color);
49 
50  protected:
53  ~BasicBuilder() override;
54 
56  const gfx::ShaderInputRegistryPtr GetShaderInputRegistry() override;
57  void GetShaderStrings(std::string* id_string,
58  std::string* vertex_source,
59  std::string* fragment_source) override;
60  void UpdateUniforms(const gfx::ShaderInputRegistryPtr& registry,
61  gfx::Node* node) override;
62  void BindAttributes(const gfx::AttributeArrayPtr& attr_array,
63  const gfx::BufferObjectPtr& buffer_object) override;
64  base::AllocVector<char> BuildVertexData(const Layout& layout,
65  size_t* vertex_size,
66  size_t* num_vertices) override;
67 
68  private:
70  struct Vertex {
71  Vertex() {}
72  Vertex(const math::Point3f& position_in,
73  const math::Point2f& texture_coords_in)
74  : position(position_in), texture_coords(texture_coords_in) {}
75  math::Point3f position;
76  math::Point2f texture_coords;
77  };
78 };
79 
82 
83 } // namespace text
84 } // namespace ion
85 
86 #endif // ION_TEXT_BASICBUILDER_H_
std::string text
Point2f texture_coords
Definition: shapeutils.cc:74
Point3f position
Definition: shapeutils.cc:67
BasicBuilder is a derived Builder class that uses a very basic shader to render text.
Definition: basicbuilder.h:38
A Layout instance specifies how glyphs are arranged to form text.
Definition: layout.h:127
base::ReferentPtr< BasicBuilder >::Type BasicBuilderPtr
Convenience typedef for shared pointer to a BasicBuilder.
Definition: basicbuilder.h:81
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