GteFont.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
11 #include <Graphics/GteTextEffect.h>
13 
14 namespace gte
15 {
16 
18 {
19 public:
20  // Construction.
21  Font(std::shared_ptr<ProgramFactory> const& factory, unsigned int width, unsigned int height,
22  char const* texels, float const* characterData, unsigned int maxMessageLength);
23 
24  // Member access.
25  inline std::shared_ptr<VertexBuffer> const& GetVertexBuffer() const;
26  inline std::shared_ptr<IndexBuffer> const& GetIndexBuffer() const;
27  inline std::shared_ptr<TextEffect> const& GetTextEffect() const;
28 
29  // Populate the vertex buffer for the specified string.
30  void Typeset(int viewportWidth, int viewportHeight, int x, int y,
31  Vector4<float> const& color, std::string const& message) const;
32 
33 protected:
34  unsigned int mMaxMessageLength;
35  std::shared_ptr<VertexBuffer> mVertexBuffer;
36  std::shared_ptr<IndexBuffer> mIndexBuffer;
37  std::shared_ptr<Texture2> mTexture;
38  std::shared_ptr<TextEffect> mTextEffect;
39  float mCharacterData[257];
40 
41  // Shader source code as strings.
44  static std::string const msHLSLSource;
45  static std::string const* msVSSource[ProgramFactory::PF_NUM_API];
46  static std::string const* msPSSource[ProgramFactory::PF_NUM_API];
47 };
48 
49 
50 inline std::shared_ptr<VertexBuffer> const& Font::GetVertexBuffer() const
51 {
52  return mVertexBuffer;
53 }
54 
55 inline std::shared_ptr<IndexBuffer> const& Font::GetIndexBuffer() const
56 {
57  return mIndexBuffer;
58 }
59 
60 inline std::shared_ptr<TextEffect> const& Font::GetTextEffect() const
61 {
62  return mTextEffect;
63 }
64 
65 
66 }
std::shared_ptr< VertexBuffer > const & GetVertexBuffer() const
Definition: GteFont.h:50
GLint GLsizei width
Definition: glcorearb.h:98
GLuint color
Definition: glcorearb.h:1256
std::shared_ptr< TextEffect > const & GetTextEffect() const
Definition: GteFont.h:60
GLint GLenum GLint x
Definition: glcorearb.h:404
GLsizei const GLchar *const * string
Definition: glcorearb.h:809
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2538
static std::string const msGLSLVSSource
Definition: GteFont.h:42
GLint GLsizei GLsizei height
Definition: glcorearb.h:98
static std::string const msGLSLPSSource
Definition: GteFont.h:43
std::shared_ptr< IndexBuffer > const & GetIndexBuffer() const
Definition: GteFont.h:55
std::shared_ptr< IndexBuffer > mIndexBuffer
Definition: GteFont.h:36
std::shared_ptr< Texture2 > mTexture
Definition: GteFont.h:37
static std::string const msHLSLSource
Definition: GteFont.h:44
GLint y
Definition: glcorearb.h:98
std::shared_ptr< VertexBuffer > mVertexBuffer
Definition: GteFont.h:35
std::shared_ptr< TextEffect > mTextEffect
Definition: GteFont.h:38
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63
unsigned int mMaxMessageLength
Definition: GteFont.h:34


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 03:59:59