src/Graphics/Text.cpp
// Add a glyph quad to the vertex array
Add a glyph quad to the vertex array
Add a glyph quad to the vertex array
void addGlyphQuad(std::vector<ngf::Vertex> &vertices, glm::vec2 position,
                  const ngf::Color &color, const ngf::Glyph &glyph, const ngf::Texture &texture) {
  float left = glyph.bounds.min.x;
  float top = glyph.bounds.min.y;
  float right = glyph.bounds.max.x;
  float bottom = glyph.bounds.max.y;
  int u1 = glyph.textureRect.min.x;
  int v1 = glyph.textureRect.min.y;
  int u2 = glyph.textureRect.max.x - 1;
  int v2 = glyph.textureRect.max.y - 1;
  vertices.push_back(
      ngf::Vertex{{position.x + left, position.y + top}, color, normalize(texture, {u1, v1})});
  vertices.push_back(
      ngf::Vertex{{position.x + right, position.y + top}, color, normalize(texture, {u2, v1})});
  vertices.push_back(
      ngf::Vertex{{position.x + left, position.y + bottom}, color, normalize(texture, {u1, v2})});
  vertices.push_back(
      ngf::Vertex{{position.x + left, position.y + bottom}, color, normalize(texture, {u1, v2})});
  vertices.push_back(
      ngf::Vertex{{position.x + right, position.y + top}, color, normalize(texture, {u2, v1})});
  vertices.push_back(
      ngf::Vertex{{position.x + right, position.y + bottom}, color, normalize(texture, {u2, v2})});
}
void addGlyphQuad ( std :: vector < ngf :: Vertex > & vertices , glm :: vec2 position , const ngf :: Color & color , const ngf :: Glyph & glyph , const ngf :: Texture & texture ) { float left = glyph . bounds . min . x ; float top = glyph . bounds . min . y ; float right = glyph . bounds . max . x ; float bottom = glyph . bounds . max . y ; int u1 = glyph . textureRect . min . x ; int v1 = glyph . textureRect . min . y ; int u2 = glyph . textureRect . max . x - 1 ; int v2 = glyph . textureRect . max . y - 1 ; vertices . push_back ( ngf :: Vertex { { position . x + left , position . y + top } , color , normalize ( texture , { u1 , v1 } ) } ) ; vertices . push_back ( ngf :: Vertex { { position . x + right , position . y + top } , color , normalize ( texture , { u2 , v1 } ) } ) ; vertices . push_back ( ngf :: Vertex { { position . x + left , position . y + bottom } , color , normalize ( texture , { u1 , v2 } ) } ) ; vertices . push_back ( ngf :: Vertex { { position . x + left , position . y + bottom } , color , normalize ( texture , { u1 , v2 } ) } ) ; vertices . push_back ( ngf :: Vertex { { position . x + right , position . y + top } , color , normalize ( texture , { u2 , v1 } ) } ) ; vertices . push_back ( ngf :: Vertex { { position . x + right , position . y + bottom } , color , normalize ( texture , { u2 , v2 } ) } ) ; }
Add a glyph quad to the vertex array
Add a glyph quad to the vertex array