Beispiel #1
0
  void Font_FT::Glyph::render(Video &vr, const Point2f &position, const float &vratio) const {
    const float x = int(position.x * vratio + 0.5f) / vratio;
    const float y = int(position.y * vratio + 0.5f) / vratio;

    Quadrilateral<Vertex2f_Texture> rect(
      (Vertex2f_Texture(Point2f(m_upper_left_point.x + x, m_upper_left_point.y + y), m_upper_left_texel)) ,
      (Vertex2f_Texture(Point2f(m_upper_left_point.x + x, m_lower_right_point.y + y), Point2f(m_upper_left_texel.x, m_lower_right_texel.y))) ,
      (Vertex2f_Texture(Point2f(m_lower_right_point.x + x, m_lower_right_point.y + y), m_lower_right_texel)) ,
      (Vertex2f_Texture(Point2f(m_lower_right_point.x + x, m_upper_left_point.y + y), Point2f(m_lower_right_texel.x, m_upper_left_texel.y))) );

    vr.render(rect);
  }
Beispiel #2
0
  void Font_FT::Glyph::render(Video &vr, const Point3f &position, const Vector3f &right, const Vector3f &down) const {
    const Vector3f scaled_right = (m_lower_right_point.x - m_upper_left_point.x) * right;
    const Vector3f scaled_down = (m_lower_right_point.y - m_upper_left_point.y) * down;

    const Point3f &ul = position + m_upper_left_point.x * right + m_upper_left_point.y * down;
    const Point3f ll = ul + scaled_down;
    const Point3f lr = ll + scaled_right;
    const Point3f ur = ul + scaled_right;

    Quadrilateral<Vertex3f_Texture> rect(
      (Vertex3f_Texture(ul, m_upper_left_texel)) ,
      (Vertex3f_Texture(ll, Point2f(m_upper_left_texel.x, m_lower_right_texel.y))) ,
      (Vertex3f_Texture(lr, m_lower_right_texel)) ,
      (Vertex3f_Texture(ur, Point2f(m_lower_right_texel.x, m_upper_left_texel.y))) );

    vr.render(rect);
  }