From 342403a02f8063903d0f38327430721d4d0ae331 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Mon, 20 Sep 2021 18:15:14 -0500 Subject: do ass1 --- dev/MinGfx/docs/html/text__shader_8h_source.html | 458 +++++++++++------------ 1 file changed, 229 insertions(+), 229 deletions(-) (limited to 'dev/MinGfx/docs/html/text__shader_8h_source.html') diff --git a/dev/MinGfx/docs/html/text__shader_8h_source.html b/dev/MinGfx/docs/html/text__shader_8h_source.html index 7c88741..9147294 100644 --- a/dev/MinGfx/docs/html/text__shader_8h_source.html +++ b/dev/MinGfx/docs/html/text__shader_8h_source.html @@ -1,229 +1,229 @@ - - - - - - - -MinGfx Toolkit: src/text_shader.h Source File - - - - - - - - - - - - -
-
- - - - - - -
-
MinGfx Toolkit -  1.0 -
-
A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.
-
-
- - - - - - - - -
-
- - -
- -
- - -
-
-
-
text_shader.h
-
-
-Go to the documentation of this file.
1 /*
-
2  This file is part of the MinGfx Project.
-
3 
-
4  Copyright (c) 2017,2018 Regents of the University of Minnesota.
-
5  All Rights Reserved.
-
6 
-
7  Original Author(s) of this File:
-
8  Dan Keefe, 2018, University of Minnesota
-
9 
-
10  Author(s) of Significant Updates/Modifications to the File:
-
11  ...
-
12  */
-
13 
-
14 #ifndef SRC_TEXT_SHADER_H_
-
15 #define SRC_TEXT_SHADER_H_
-
16 
-
17 #include <string>
-
18 #include <map>
-
19 
-
20 #include "matrix4.h"
-
21 #include "mesh.h"
-
22 #include "shader_program.h"
-
23 #include "texture2d.h"
-
24 
-
25 // disable warnings for this 3rd party code
-
26 #pragma warning ( push, 0 )
-
27 #include <stb_truetype.h>
-
28 #pragma warning ( pop )
-
29 
-
30 namespace mingfx {
-
31 
-
32 
-
33 
-
36 class TextShader {
-
37 public:
- -
39  virtual ~TextShader();
-
40 
-
45  bool Init(const std::string &font_file, int native_font_size);
-
46 
-
47  enum class HorizAlign {
- - - -
51  };
-
52 
-
53  enum class VertAlign {
- - - - -
58  };
-
59 
-
60  class TextFormat {
-
61  public:
-
62  // constructor sets defaults
- -
64  size(0.1f),
-
65  color(1,1,1,1),
-
66  h_align(HorizAlign::HORIZ_ALIGN_CENTER),
-
67  v_align(VertAlign::VERT_ALIGN_BASELINE) {}
-
68 
-
69  float size;
- - - -
73  };
-
74 
-
75 
-
76  //void Draw2D(const Point2 &pos,
-
77  // const std::string &text, TextFormat format, bool cache=false);
-
78 
-
79 
-
80  void Draw3D(const Matrix4 &model, const Matrix4 &view, const Matrix4 &projection,
-
81  const std::string &text, TextFormat format, bool cache=false);
-
82 
-
83 
-
84  Vector2 TextExtents(const std::string &text, TextFormat format, bool cache=false);
-
85 
- -
87 
-
88 private:
-
89  Texture2D atlas_;
-
90  float native_font_size_;
-
91 
-
92  stbtt_packedchar chardata_[128];
-
93 
-
94  struct MeshData {
-
95  Mesh mesh;
-
96  Point2 min;
-
97  Point2 max;
-
98  };
-
99 
-
100  void SetTextMesh(const std::string &text, MeshData *md);
-
101 
-
102  std::map<std::string, MeshData> cache_;
-
103  MeshData tmp_md_;
-
104 
-
105  ShaderProgram shader_;
-
106 };
-
107 
-
108 } // end namespace
-
109 
-
110 #endif
-
Represents a 4-component (R,G,B,A) color, stored internally in a float array to be compatable with Op...
Definition: color.h:41
-
A 4x4 transformation matrix stored internally as an array of floats in column-major order so as to be...
Definition: matrix4.h:50
-
A triangle mesh data structure that can be rendered with a ShaderProgram like DefaultShader.
Definition: mesh.h:127
-
A 2D Point with floating point coordinates, used for storing 2D texture coordinates,...
Definition: point2.h:28
-
A wrapper around GLSL shader programs.
- - - - - - - - -
void Draw3D(const Matrix4 &model, const Matrix4 &view, const Matrix4 &projection, const std::string &text, TextFormat format, bool cache=false)
-
virtual ~TextShader()
-
float native_font_size()
- - - - - -
Vector2 TextExtents(const std::string &text, TextFormat format, bool cache=false)
-
bool Init(const std::string &font_file, int native_font_size)
Call this from within the InitOpenGL() function since it will initialize not just the Font's internal...
- - - - -
A wrapper around a 2D texture that supports loading images from files or setting texture color data d...
Definition: texture2d.h:42
-
A 2D Vector with floating point coordinates, used for storing 2D translations, mouse movements,...
Definition: vector2.h:28
- - -
Namespace for the MinGfx Toolkit.
Definition: aabb.h:21
- - -
- - - - - + + + + + + + +MinGfx Toolkit: src/text_shader.h Source File + + + + + + + + + + + + +
+
+ + + + + + +
+
MinGfx Toolkit +  1.0 +
+
A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
text_shader.h
+
+
+Go to the documentation of this file.
1 /*
+
2  This file is part of the MinGfx Project.
+
3 
+
4  Copyright (c) 2017,2018 Regents of the University of Minnesota.
+
5  All Rights Reserved.
+
6 
+
7  Original Author(s) of this File:
+
8  Dan Keefe, 2018, University of Minnesota
+
9 
+
10  Author(s) of Significant Updates/Modifications to the File:
+
11  ...
+
12  */
+
13 
+
14 #ifndef SRC_TEXT_SHADER_H_
+
15 #define SRC_TEXT_SHADER_H_
+
16 
+
17 #include <string>
+
18 #include <map>
+
19 
+
20 #include "matrix4.h"
+
21 #include "mesh.h"
+
22 #include "shader_program.h"
+
23 #include "texture2d.h"
+
24 
+
25 // disable warnings for this 3rd party code
+
26 #pragma warning ( push, 0 )
+
27 #include <stb_truetype.h>
+
28 #pragma warning ( pop )
+
29 
+
30 namespace mingfx {
+
31 
+
32 
+
33 
+
36 class TextShader {
+
37 public:
+ +
39  virtual ~TextShader();
+
40 
+
45  bool Init(const std::string &font_file, int native_font_size);
+
46 
+
47  enum class HorizAlign {
+ + + +
51  };
+
52 
+
53  enum class VertAlign {
+ + + + +
58  };
+
59 
+
60  class TextFormat {
+
61  public:
+
62  // constructor sets defaults
+ +
64  size(0.1f),
+
65  color(1,1,1,1),
+
66  h_align(HorizAlign::HORIZ_ALIGN_CENTER),
+
67  v_align(VertAlign::VERT_ALIGN_BASELINE) {}
+
68 
+
69  float size;
+ + + +
73  };
+
74 
+
75 
+
76  //void Draw2D(const Point2 &pos,
+
77  // const std::string &text, TextFormat format, bool cache=false);
+
78 
+
79 
+
80  void Draw3D(const Matrix4 &model, const Matrix4 &view, const Matrix4 &projection,
+
81  const std::string &text, TextFormat format, bool cache=false);
+
82 
+
83 
+
84  Vector2 TextExtents(const std::string &text, TextFormat format, bool cache=false);
+
85 
+ +
87 
+
88 private:
+
89  Texture2D atlas_;
+
90  float native_font_size_;
+
91 
+
92  stbtt_packedchar chardata_[128];
+
93 
+
94  struct MeshData {
+
95  Mesh mesh;
+
96  Point2 min;
+
97  Point2 max;
+
98  };
+
99 
+
100  void SetTextMesh(const std::string &text, MeshData *md);
+
101 
+
102  std::map<std::string, MeshData> cache_;
+
103  MeshData tmp_md_;
+
104 
+
105  ShaderProgram shader_;
+
106 };
+
107 
+
108 } // end namespace
+
109 
+
110 #endif
+
Represents a 4-component (R,G,B,A) color, stored internally in a float array to be compatable with Op...
Definition: color.h:41
+
A 4x4 transformation matrix stored internally as an array of floats in column-major order so as to be...
Definition: matrix4.h:50
+
A triangle mesh data structure that can be rendered with a ShaderProgram like DefaultShader.
Definition: mesh.h:127
+
A 2D Point with floating point coordinates, used for storing 2D texture coordinates,...
Definition: point2.h:28
+
A wrapper around GLSL shader programs.
+ + + + + + + + +
void Draw3D(const Matrix4 &model, const Matrix4 &view, const Matrix4 &projection, const std::string &text, TextFormat format, bool cache=false)
+
virtual ~TextShader()
+
float native_font_size()
+ + + + + +
Vector2 TextExtents(const std::string &text, TextFormat format, bool cache=false)
+
bool Init(const std::string &font_file, int native_font_size)
Call this from within the InitOpenGL() function since it will initialize not just the Font's internal...
+ + + + +
A wrapper around a 2D texture that supports loading images from files or setting texture color data d...
Definition: texture2d.h:42
+
A 2D Vector with floating point coordinates, used for storing 2D translations, mouse movements,...
Definition: vector2.h:28
+ + +
Namespace for the MinGfx Toolkit.
Definition: aabb.h:21
+ + +
+ + + + + -- cgit v1.2.3