From 9b83919815f6a6ce5d73da1c28483970d0ca5589 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 3 Feb 2021 14:22:28 -0600 Subject: added dev/MinGfx/ --- .../docs/html/classmingfx_1_1_quick_shapes.html | 844 +++++++++++++++++++++ 1 file changed, 844 insertions(+) create mode 100644 dev/MinGfx/docs/html/classmingfx_1_1_quick_shapes.html (limited to 'dev/MinGfx/docs/html/classmingfx_1_1_quick_shapes.html') diff --git a/dev/MinGfx/docs/html/classmingfx_1_1_quick_shapes.html b/dev/MinGfx/docs/html/classmingfx_1_1_quick_shapes.html new file mode 100644 index 0000000..f499aff --- /dev/null +++ b/dev/MinGfx/docs/html/classmingfx_1_1_quick_shapes.html @@ -0,0 +1,844 @@ + + + + + + + +MinGfx Toolkit: mingfx::QuickShapes Class Reference + + + + + + + + + + + + +
+
+ + + + + + +
+
MinGfx Toolkit +  1.0 +
+
A minimal library for writing cross-platform (Windows, OSX, linux) graphics programs.
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
mingfx::QuickShapes Class Reference
+
+
+

Detailed Description

+

This class provides a quick way to draw shapes for use in debugging or simple scenes.

+

You can specify the color for each shape as part of the Draw...() call. Other lighting parameters (the intensity of the light, advanced material properties) are pre-set to reasonable defaults that apply to all of the shapes drawn. You can edit these if you wish, but note that the intent of this class is just to provide a quick way to draw shapes – this is not the right tool to use if you wish to do quality renderings and use multiple types of materials.

+

Example usage: ~~~ define a new QuickShapes object during initialization, or as a class member variable QuickShapes quick_shapes;

+

void DrawUsingOpenGL() { later, in your draw routine, use it to draw shapes Matrix4 view = Matrix4::LookAt(Point3(0,0,3), Point3(0,0,0), Vector3(0,1,0)); Matrix4 proj = Matrix4::Perspective(60.0, aspect_ratio(), 0.1, 10.0);

+

Matrix4 m_cube = Matrix4::Translation(Vector3(-2.5,0,0)) * Matrix4::Scale(Vector3(0.5, 0.5, 0.5)); quick_shapes.DrawCube(m_cube, view, proj, Color(1,1,1));

+

Matrix4 m_sphere = Matrix4::Scale(Vector3(2.5, 2.5, 2.5)); quick_shapes.DrawSphere(m_sphere, view, proj, Color(1,1,1));

+

Matrix4 m_loop; std::vector<Point3> loop; loop.push_back(Point3( 4.0, 4.0, -4.0)); loop.push_back(Point3(-4.0, 4.0, -4.0)); loop.push_back(Point3(-4.0, 4.0, 4.0)); loop.push_back(Point3( 4.0, 4.0, 4.0)); quick_shapes.DrawLines(m_loop, view, proj, Color(1,1,1), loop, QuickShapes::LinesType::LINE_LOOP, 0.1); } ~~~

+ +

Definition at line 69 of file quick_shapes.h.

+
+

#include <quick_shapes.h>

+ + + + +

+Public Types

enum class  LinesType { LINES +, LINE_STRIP +, LINE_LOOP + }
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 QuickShapes ()
 
virtual ~QuickShapes ()
 
void DrawCube (const Matrix4 &modelMatrix, const Matrix4 &viewMatrix, const Matrix4 &projectionMatrix, const Color &color)
 Draws a cube with extents -1 to 1 given the model, view, and projection matrices provided and using the supplied color as a material property. More...
 
void DrawCylinder (const Matrix4 &modelMatrix, const Matrix4 &viewMatrix, const Matrix4 &projectionMatrix, const Color &color)
 Draws a cylinder with radius 1 and height y=-1 to 1 given the model, view, and projection matrices provided and using the supplied color as a material property. More...
 
void DrawCone (const Matrix4 &modelMatrix, const Matrix4 &viewMatrix, const Matrix4 &projectionMatrix, const Color &color)
 Draws a cone with radius 1 and height y=-1 to 1 given the model, view, and projection matrices provided and using the supplied color as a material property. More...
 
void DrawSphere (const Matrix4 &modelMatrix, const Matrix4 &viewMatrix, const Matrix4 &projectionMatrix, const Color &color)
 Draws a sphere with radius 1 given the model, view, and projection matrices provided and using the supplied color as a material property. More...
 
void DrawBrush (const Matrix4 &modelMatrix, const Matrix4 &viewMatrix, const Matrix4 &projectionMatrix, const Color &color)
 Draws the classic 3D paintbrush cursor from the 2001 Keefe et al. More...
 
void DrawLineSegment (const Matrix4 &modelMatrix, const Matrix4 &viewMatrix, const Matrix4 &projectionMatrix, const Color &color, const Point3 &p1, const Point3 &p2, float radius)
 Draws a cylinder between the two points. More...
 
void DrawLines (const Matrix4 &modelMatrix, const Matrix4 &viewMatrix, const Matrix4 &projectionMatrix, const Color &color, const std::vector< Point3 > &points, LinesType linesType, float radius)
 Draws a series of line segments. More...
 
void DrawArrow (const Matrix4 &modelMatrix, const Matrix4 &viewMatrix, const Matrix4 &projectionMatrix, const Color &color, Point3 p, Vector3 dir, float radius)
 Draws an arrow originating at point p and extending in the direction and length specified by dir. More...
 
void DrawAxes (const Matrix4 &modelMatrix, const Matrix4 &viewMatrix, const Matrix4 &projectionMatrix)
 Draws a right handed set of axes at the coordinate frame specified by the modelMatrix. More...
 
void DrawSquare (const Matrix4 &modelMatrix, const Matrix4 &viewMatrix, const Matrix4 &projectionMatrix, const Color &color)
 Draws a square in the X-Y plane with extents -1 to 1 and normal in the +Y direction. More...
 
void DrawSquare (const Matrix4 &modelMatrix, const Matrix4 &viewMatrix, const Matrix4 &projectionMatrix, const Color &color, const Texture2D &texture)
 Draws a square, which you can deform into some other shape by adjusting the model matrix, and applies a texture to it. More...
 
void DrawFullscreenTexture (const Color &color, const Texture2D &texture)
 Draws a background texture across the whole screen. More...
 
DefaultShaderdefault_shader ()
 Returns a pointer to the default shader used internally by the Draw class so that you may change the default lighting properties if you wish. More...
 
DefaultShader::MaterialPropertiesmaterial ()
 Returns a pointer to the default material properties for the shapes so that you may adjust the reflectance properties used by all the shapes if needed. More...
 
+

Member Enumeration Documentation

+ +

◆ LinesType

+ +
+
+ + + + + +
+ + + + +
enum mingfx::QuickShapes::LinesType
+
+strong
+
+ + + + +
Enumerator
LINES 
LINE_STRIP 
LINE_LOOP 
+ +

Definition at line 134 of file quick_shapes.h.

+ +
+
+

Constructor & Destructor Documentation

+ +

◆ QuickShapes()

+ +
+
+ + + + + + + +
mingfx::QuickShapes::QuickShapes ()
+
+ +
+
+ +

◆ ~QuickShapes()

+ +
+
+ + + + + +
+ + + + + + + +
virtual mingfx::QuickShapes::~QuickShapes ()
+
+virtual
+
+ +
+
+

Member Function Documentation

+ +

◆ default_shader()

+ +
+
+ + + + + + + +
DefaultShader* mingfx::QuickShapes::default_shader ()
+
+ +

Returns a pointer to the default shader used internally by the Draw class so that you may change the default lighting properties if you wish.

+ +
+
+ +

◆ DrawArrow()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void mingfx::QuickShapes::DrawArrow (const Matrix4modelMatrix,
const Matrix4viewMatrix,
const Matrix4projectionMatrix,
const Colorcolor,
Point3 p,
Vector3 dir,
float radius 
)
+
+ +

Draws an arrow originating at point p and extending in the direction and length specified by dir.

+

radius is the radius of the cylinder used to draw the shaft of the arrow.

+ +
+
+ +

◆ DrawAxes()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void mingfx::QuickShapes::DrawAxes (const Matrix4modelMatrix,
const Matrix4viewMatrix,
const Matrix4projectionMatrix 
)
+
+ +

Draws a right handed set of axes at the coordinate frame specified by the modelMatrix.

+

The arrows are 1 unit in length and colored based on the axis: X=red, Y=green, Z=blue.

+ +
+
+ +

◆ DrawBrush()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void mingfx::QuickShapes::DrawBrush (const Matrix4modelMatrix,
const Matrix4viewMatrix,
const Matrix4projectionMatrix,
const Colorcolor 
)
+
+ +

Draws the classic 3D paintbrush cursor from the 2001 Keefe et al.

+

CavePainting paper. The tip of the brush is at (0,0,0), the front flat edge runs along the X axis, and the handle runs in the +Z direction.

+ +
+
+ +

◆ DrawCone()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void mingfx::QuickShapes::DrawCone (const Matrix4modelMatrix,
const Matrix4viewMatrix,
const Matrix4projectionMatrix,
const Colorcolor 
)
+
+ +

Draws a cone with radius 1 and height y=-1 to 1 given the model, view, and projection matrices provided and using the supplied color as a material property.

+ +
+
+ +

◆ DrawCube()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void mingfx::QuickShapes::DrawCube (const Matrix4modelMatrix,
const Matrix4viewMatrix,
const Matrix4projectionMatrix,
const Colorcolor 
)
+
+ +

Draws a cube with extents -1 to 1 given the model, view, and projection matrices provided and using the supplied color as a material property.

+ +
+
+ +

◆ DrawCylinder()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void mingfx::QuickShapes::DrawCylinder (const Matrix4modelMatrix,
const Matrix4viewMatrix,
const Matrix4projectionMatrix,
const Colorcolor 
)
+
+ +

Draws a cylinder with radius 1 and height y=-1 to 1 given the model, view, and projection matrices provided and using the supplied color as a material property.

+ +
+
+ +

◆ DrawFullscreenTexture()

+ +
+
+ + + + + + + + + + + + + + + + + + +
void mingfx::QuickShapes::DrawFullscreenTexture (const Colorcolor,
const Texture2Dtexture 
)
+
+ +

Draws a background texture across the whole screen.

+

Typically, you will want to do this before any other draw calls.

+ +
+
+ +

◆ DrawLines()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void mingfx::QuickShapes::DrawLines (const Matrix4modelMatrix,
const Matrix4viewMatrix,
const Matrix4projectionMatrix,
const Colorcolor,
const std::vector< Point3 > & points,
LinesType linesType,
float radius 
)
+
+ +

Draws a series of line segments.

+

Using linesType=LINES connects each consecutive pair of points in the points array with a line. A linesType=LINE_STRIP will connect each point to the next. And, a linesType=LINE_LOOP will connect each point to the next and in addition connect the last to the first. Example:

Matrix4 model;
+
Matrix4 view = Matrix4::LookAt(Point3(0,0,3), Point3(0,0,0), Vector3(0,1,0));
+
Matrix4 proj = Matrix4::Perspective(60.0, aspect_ratio(), 0.1, 10.0);
+
std::vector<Point3> loop;
+
loop.push_back(Point3( 4.0, 4.0, -4.0));
+
loop.push_back(Point3(-4.0, 4.0, -4.0));
+
loop.push_back(Point3(-4.0, 4.0, 4.0));
+
loop.push_back(Point3( 4.0, 4.0, 4.0));
+
quick_shapes.DrawLines(model, view, proj, Color(1,1,1), loop, QuickShapes::LinesType::LINE_LOOP, 0.1);
+
static Matrix4 Perspective(float fov_y_in_degrees, float aspect_ratio, float near_plane_dist, float far_plane_dist)
Returns a perspective projection matrix equivalent to the one gluPerspective creates.
+
static Matrix4 LookAt(Point3 eye, Point3 target, Vector3 up)
Returns a view matrix that centers the camera at the 'eye' position and orients it to look at the des...
+ +
+
+
+ +

◆ DrawLineSegment()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void mingfx::QuickShapes::DrawLineSegment (const Matrix4modelMatrix,
const Matrix4viewMatrix,
const Matrix4projectionMatrix,
const Colorcolor,
const Point3p1,
const Point3p2,
float radius 
)
+
+ +

Draws a cylinder between the two points.

+ +
+
+ +

◆ DrawSphere()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void mingfx::QuickShapes::DrawSphere (const Matrix4modelMatrix,
const Matrix4viewMatrix,
const Matrix4projectionMatrix,
const Colorcolor 
)
+
+ +

Draws a sphere with radius 1 given the model, view, and projection matrices provided and using the supplied color as a material property.

+ +
+
+ +

◆ DrawSquare() [1/2]

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void mingfx::QuickShapes::DrawSquare (const Matrix4modelMatrix,
const Matrix4viewMatrix,
const Matrix4projectionMatrix,
const Colorcolor 
)
+
+ +

Draws a square in the X-Y plane with extents -1 to 1 and normal in the +Y direction.

+

Uses the model, view, and projection matrices provided and the supplied color as a material property.

+ +
+
+ +

◆ DrawSquare() [2/2]

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void mingfx::QuickShapes::DrawSquare (const Matrix4modelMatrix,
const Matrix4viewMatrix,
const Matrix4projectionMatrix,
const Colorcolor,
const Texture2Dtexture 
)
+
+ +

Draws a square, which you can deform into some other shape by adjusting the model matrix, and applies a texture to it.

+

The texture must already be bound to the OpenGL textureID provided. The square lies in the X-Y plane with extents -1 to 1 and normal in the +Y direction. No lighting is applied.

+ +
+
+ +

◆ material()

+ +
+
+ + + + + + + +
DefaultShader::MaterialProperties* mingfx::QuickShapes::material ()
+
+ +

Returns a pointer to the default material properties for the shapes so that you may adjust the reflectance properties used by all the shapes if needed.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + + -- cgit v1.2.3