Josh's Graphics Library
|
Drawing functions for primitive 3D Shapes. More...
Functions | |
void | Init (const Vector2 &window_size, float fov, float far_plane) |
Initializes internals for 3D rendering. Probably will be rethought later. More... | |
void | ChangeFOV (float fov) |
Helper function to conveniently change the Field-Of-View. More... | |
void | ChangeFarPlane (float far_plane) |
Helper function to change the far-plane, which is the cutoff distance for rendering. More... | |
void | Begin () |
Open a 3-D rendering context with the underlying graphics system (In this case& by default OpenGL). More... | |
void | End () |
Closes a 3-D rendering context with the underlying graphics system (In this case& by default OpenGL). More... | |
void | SetMatrix (const std::vector< GLfloat > &matrix, const Vector2 &window_size) |
void | DrawLine (const Color4 &color, const Vector3 &A, const Vector3 &B, float thickness=1.f) |
Draws a line in 3D space. More... | |
void | DrawCubicBezierCurve (const Color4 &color, const Vector3 &controlA, const Vector3 &pointA, const Vector3 &pointB, const Vector3 &controlB, int subdivisions=10, float thickness=1) |
Draws a smooth, curved line segment between two control points, with the curve controlled by the two inner points. More... | |
void | WireframeIcosahedron (const Color4 &color, const Vector3 &position, float radius, float thickness=1.f) |
Draws the outline of an Icosahedron in 3D space. More... | |
void | FillIcosahedron (const Color4 &color, const Vector3 &position, float radius) |
Draws a solid Icosahedron in 3D space. More... | |
void | WireframeSphere (const Color4 &color, const Vector3 &position, float radius, float thickness=1.f, uint sectors=10, uint stacks=10) |
Draws the outline of a Sphere in 3D space. More... | |
void | WireframeSphere (const Color4 &color, const Sphere &sphere, float thickness=1.f, uint sectors=10, uint stacks=10) |
Draws the outline of a Sphere in 3D space. More... | |
void | WireframeIcosphere (const Color4 &color, const Vector3 &position, float radius, float thickness=1.f, unsigned int subdivisions=10) |
Draws the outline of an Icosphere in 3D space. More... | |
void | WireframeIcosphere (const Color4 &color, const Sphere &sphere, float thickness=1.f, unsigned int subdivisions=10) |
Draws the outline of an Icosphere in 3D space. More... | |
void | WireframeCubesphere (const Color4 &color, const Vector3 &position, float radius, float thickness=1.f, unsigned int subdivisions=10) |
Draws the outline of a Cubesphere in 3D space. More... | |
void | WireframeCubesphere (const Color4 &color, const Sphere &sphere, float thickness=1.f, unsigned int subdivisions=10) |
Draws the outline of a Cubesphere in 3D space. More... | |
void | FillSphere (const Color4 &color, const Vector3 &position, float radius, uint sectors=10, uint stacks=10) |
Draws a solid Sphere in 3D space. More... | |
void | FillSphere (const Color4 &color, const Sphere &sphere, uint sectors=10, uint stacks=10) |
Draws a solid Sphere in 3D space. More... | |
void | FillIcosphere (const Color4 &color, const Vector3 &position, float radius, unsigned int subdivisions=10) |
Draws a solid Icosphere in 3D space. More... | |
void | FillIcosphere (const Color4 &color, const Sphere &sphere, unsigned int subdivisions=10) |
Draws a solid Icosphere in 3D space. More... | |
void | FillCubesphere (const Color4 &color, const Vector3 &position, float radius, unsigned int subdivisions=10) |
Draws a solid Cubesphere in 3D space. More... | |
void | FillCubesphere (const Color4 &color, const Sphere &sphere, unsigned int subdivisions=10) |
Draws a solid Cubesphere in 3D space. More... | |
void | WireframeAABB (const Color4 &color, const Vector3 &pos, const Vector3 &radii, float thickness=1.f) |
Draws an outline of an axis-aligned bounding box in 3D space. More... | |
void | WireframeAABB (const Color4 &color, const AABB &aabb, float thickness=1.f) |
Draws an outline of an axis-aligned bounding box in 3D space. More... | |
void | FillAABB (const Color4 &color, const Vector3 &pos, const Vector3 &radii) |
Draws a solid axis-aligned bounding box in 3D space. More... | |
void | FillAABB (const Color4 &color, const AABB &aabb) |
Draws a solid axis-aligned bounding box in 3D space. More... | |
void | WireframeOBB (const Color4 &color, const Vector3 &position, const Vector3 &radii, const EulerAngle &orientation, float thickness=1.f) |
Draws an outline of an oriented bounding box in 3D space. More... | |
void | WireframeOBB (const Color4 &color, const OBB &obb, float thickness=1.f) |
Draws an outline of an oriented bounding box in 3D space. More... | |
void | FillOBB (const Color4 &color, const Vector3 &position, const Vector3 &radii, const EulerAngle &orientation) |
Draws an outline of an oriented bounding box in 3D space. More... | |
void | FillOBB (const Color4 &color, const OBB &obb) |
Draws an outline of an oriented bounding box in 3D space. More... | |
void | WireframeCylinder () |
void | FillCylinder () |
void | WireframePrism () |
void | FillPrism () |
void | WireframePipe () |
void | FillPipe () |
void | WireframeCone () |
void | FillCone () |
void | WireframeTorus () |
void | FillTorus () |
void | FillCapsule (const Color3 &color, const Capsule &capsule) |
void | WireframeCapsule (const Color3 &color, const Capsule &cap, float thickness=1.f) |
void | FillTriangleMesh (const Color3 &color, const TriangleMesh &mesh) |
void | WireframeTriangleMesh (const Color3 &color, const TriangleMesh &mesh, float thickness=1.f) |
void | DrawString (const Color4 &color, const std::string &text, const Vector3 &pos, float scale, u32 size, const Font &font, const EulerAngle &angle={0, 0, 0}, bool draw_back_face=false) |
Draws a string of text in 3D space, with an arbitrary rotation. More... | |
void | DrawBillboardString () |
Draws a string of text in 3D space that is always facing the exact direction of the camera projection. More... | |
void | DrawBillboardSprite () |
Draws a texture sprite in 3D space that is always facing the exact direction of the camera projection. More... | |
void | DrawSprite () |
void | DrawMatrixGizmo (const Matrix3x3 &, const Vector3 &) |
void | DrawMatrixGizmo (const Matrix4x4 &) |
void | DrawAxisAngleGizmo (const AxisAngle &, const Vector3 &) |
void | DrawQuaternionGizmo (const Quaternion &, const Vector3 &) |
Drawing functions for primitive 3D Shapes.
void JGL::J3D::Begin | ( | ) |
Open a 3-D rendering context with the underlying graphics system (In this case& by default OpenGL).
void JGL::J3D::ChangeFarPlane | ( | float | far_plane | ) |
Helper function to change the far-plane, which is the cutoff distance for rendering.
void JGL::J3D::ChangeFOV | ( | float | fov | ) |
Helper function to conveniently change the Field-Of-View.
void JGL::J3D::DrawAxisAngleGizmo | ( | const AxisAngle & | , |
const Vector3 & | |||
) |
void JGL::J3D::DrawBillboardSprite | ( | ) |
Draws a texture sprite in 3D space that is always facing the exact direction of the camera projection.
void JGL::J3D::DrawBillboardString | ( | ) |
Draws a string of text in 3D space that is always facing the exact direction of the camera projection.
void JGL::J3D::DrawCubicBezierCurve | ( | const Color4 & | color, |
const Vector3 & | controlA, | ||
const Vector3 & | pointA, | ||
const Vector3 & | pointB, | ||
const Vector3 & | controlB, | ||
int | subdivisions = 10 , |
||
float | thickness = 1 |
||
) |
Draws a smooth, curved line segment between two control points, with the curve controlled by the two inner points.
color | A 3-or-4 channel color value. |
controlA | The first control point, which can be considered the start of the line. |
pointA | The first inner point, which controls the contour of the curve. |
pointB | The second inner point, which controls the contour of the curve. |
controlB | The second control point, which can be considered the end of the line. |
subdivisions | The accuracy of the approximation of the curve, measured in iteration steps taken. |
thickness | The line-width to draw the curve with. |
void JGL::J3D::DrawLine | ( | const Color4 & | color, |
const Vector3 & | A, | ||
const Vector3 & | B, | ||
float | thickness = 1.f |
||
) |
Draws a line in 3D space.
color | A 3-or-4 channel color value. |
A | The start-point of the line segment. |
B | The end-point of the line segment. |
thickness | The line-width to draw the line segment with. |
void JGL::J3D::DrawMatrixGizmo | ( | const Matrix3x3 & | , |
const Vector3 & | |||
) |
void JGL::J3D::DrawMatrixGizmo | ( | const Matrix4x4 & | ) |
void JGL::J3D::DrawQuaternionGizmo | ( | const Quaternion & | , |
const Vector3 & | |||
) |
void JGL::J3D::DrawSprite | ( | ) |
void JGL::J3D::DrawString | ( | const Color4 & | color, |
const std::string & | text, | ||
const Vector3 & | pos, | ||
float | scale, | ||
u32 | size, | ||
const Font & | font, | ||
const EulerAngle & | angle = {0, 0, 0} , |
||
bool | draw_back_face = false |
||
) |
Draws a string of text in 3D space, with an arbitrary rotation.
color | A 3-or-4 channel color value. |
text | The content to display on the screen. |
pos | The position in 3D space to display the text. |
scale | The scaling factor to render the text with, 1 being default. TODO: Vector2 scaling? |
size | The pixel size to rasterize the font with. |
font | The font object to use when drawing. |
angle | The orientation in 3D space. |
draw_back_face |
void JGL::J3D::End | ( | ) |
Closes a 3-D rendering context with the underlying graphics system (In this case& by default OpenGL).
void JGL::J3D::FillAABB | ( | const Color4 & | color, |
const AABB & | aabb | ||
) |
Draws a solid axis-aligned bounding box in 3D space.
color | A 3-or-4 channel color value. |
aabb | The AABB object to visualize. |
void JGL::J3D::FillAABB | ( | const Color4 & | color, |
const Vector3 & | pos, | ||
const Vector3 & | radii | ||
) |
Draws a solid axis-aligned bounding box in 3D space.
color | A 3-or-4 channel color value. |
pos | The point in 3D space that is the center of the AABB. |
radii | The radii along x,y,z axes to size the bounding box. |
void JGL::J3D::FillCapsule | ( | const Color3 & | color, |
const Capsule & | capsule | ||
) |
void JGL::J3D::FillCone | ( | ) |
void JGL::J3D::FillCubesphere | ( | const Color4 & | color, |
const Sphere & | sphere, | ||
unsigned int | subdivisions = 10 |
||
) |
Draws a solid Cubesphere in 3D space.
color | A 3-or-4 channel color value. |
sphere | The mathematically-defined sphere object to be rendered. |
subdivisions | The accuracy of the approximation of the Cubesphere, measured in iteration steps taken. |
void JGL::J3D::FillCubesphere | ( | const Color4 & | color, |
const Vector3 & | position, | ||
float | radius, | ||
unsigned int | subdivisions = 10 |
||
) |
Draws a solid Cubesphere in 3D space.
color | A 3-or-4 channel color value. |
position | The point in 3D space at which to draw the Sphere. |
radius | The size to draw the Sphere at. |
subdivisions | The accuracy of the approximation of the Cubesphere, measured in iteration steps taken. |
void JGL::J3D::FillCylinder | ( | ) |
void JGL::J3D::FillIcosahedron | ( | const Color4 & | color, |
const Vector3 & | position, | ||
float | radius | ||
) |
Draws a solid Icosahedron in 3D space.
color | A 3-or-4 channel color value. |
position | The point in 3D space at which to draw the Icosahedron. |
radius | The size to draw the Icosahedron at. |
void JGL::J3D::FillIcosphere | ( | const Color4 & | color, |
const Sphere & | sphere, | ||
unsigned int | subdivisions = 10 |
||
) |
Draws a solid Icosphere in 3D space.
color | A 3-or-4 channel color value. |
sphere | The mathematically-defined sphere object to be rendered. |
subdivisions | The accuracy of the approximation of the Cubesphere, measured in iteration steps taken. |
void JGL::J3D::FillIcosphere | ( | const Color4 & | color, |
const Vector3 & | position, | ||
float | radius, | ||
unsigned int | subdivisions = 10 |
||
) |
Draws a solid Icosphere in 3D space.
color | A 3-or-4 channel color value. |
position | The point in 3D space at which to draw the Sphere. |
radius | The size to draw the Sphere at. |
subdivisions | The accuracy of the approximation of the Cubesphere, measured in iteration steps taken. |
void JGL::J3D::FillOBB | ( | const Color4 & | color, |
const OBB & | obb | ||
) |
Draws an outline of an oriented bounding box in 3D space.
color | A 3-or-4 channel color value. |
obb | The oriented-bounding-box object to visualize. |
void JGL::J3D::FillOBB | ( | const Color4 & | color, |
const Vector3 & | position, | ||
const Vector3 & | radii, | ||
const EulerAngle & | orientation | ||
) |
Draws an outline of an oriented bounding box in 3D space.
color | A 3-or-4 channel color value. |
position | The center-position of the oriented bounding box. |
radii | The radii along x,y,z axes to size the bounding box. |
orientation | The rotation in 3D space of the OBB. |
void JGL::J3D::FillPipe | ( | ) |
void JGL::J3D::FillPrism | ( | ) |
void JGL::J3D::FillSphere | ( | const Color4 & | color, |
const Sphere & | sphere, | ||
uint | sectors = 10 , |
||
uint | stacks = 10 |
||
) |
Draws a solid Sphere in 3D space.
color | A 3-or-4 channel color value. |
sphere | The mathematically-defined sphere object to be rendered. |
sectors | The amount of latitudinal subdivisions to perform when computing the sphere. |
stacks | The amount of longitudinal subdivisions to perform when computing the sphere. |
void JGL::J3D::FillSphere | ( | const Color4 & | color, |
const Vector3 & | position, | ||
float | radius, | ||
uint | sectors = 10 , |
||
uint | stacks = 10 |
||
) |
Draws a solid Sphere in 3D space.
color | A 3-or-4 channel color value. |
position | The point in 3D space at which to draw the Sphere. |
radius | The size to draw the Sphere at. |
sectors | The amount of latitudinal subdivisions to perform when computing the sphere. |
stacks | The amount of longitudinal subdivisions to perform when computing the sphere. |
void JGL::J3D::FillTorus | ( | ) |
void JGL::J3D::FillTriangleMesh | ( | const Color3 & | color, |
const TriangleMesh & | mesh | ||
) |
void JGL::J3D::Init | ( | const Vector2 & | window_size, |
float | fov, | ||
float | far_plane | ||
) |
Initializes internals for 3D rendering. Probably will be rethought later.
void JGL::J3D::SetMatrix | ( | const std::vector< GLfloat > & | matrix, |
const Vector2 & | window_size | ||
) |
void JGL::J3D::WireframeAABB | ( | const Color4 & | color, |
const AABB & | aabb, | ||
float | thickness = 1.f |
||
) |
Draws an outline of an axis-aligned bounding box in 3D space.
color | A 3-or-4 channel color value. |
aabb | The AABB object to render. |
void JGL::J3D::WireframeAABB | ( | const Color4 & | color, |
const Vector3 & | pos, | ||
const Vector3 & | radii, | ||
float | thickness = 1.f |
||
) |
Draws an outline of an axis-aligned bounding box in 3D space.
color | A 3-or-4 channel color value. |
pos | The point in 3D space that is the center of the AABB. |
radii | The radii along x,y,z axes to size the bounding box. |
thickness | The line-width to draw the Icosphere outline with. |
void JGL::J3D::WireframeCapsule | ( | const Color3 & | color, |
const Capsule & | cap, | ||
float | thickness = 1.f |
||
) |
void JGL::J3D::WireframeCone | ( | ) |
void JGL::J3D::WireframeCubesphere | ( | const Color4 & | color, |
const Sphere & | sphere, | ||
float | thickness = 1.f , |
||
unsigned int | subdivisions = 10 |
||
) |
Draws the outline of a Cubesphere in 3D space.
color | A 3-or-4 channel color value. |
sphere | The mathematically-defined sphere object to be rendered. |
thickness | The line-width to draw the Cubesphere outline with. |
subdivisions | The accuracy of the approximation of the Cubesphere, measured in iteration steps taken. |
void JGL::J3D::WireframeCubesphere | ( | const Color4 & | color, |
const Vector3 & | position, | ||
float | radius, | ||
float | thickness = 1.f , |
||
unsigned int | subdivisions = 10 |
||
) |
Draws the outline of a Cubesphere in 3D space.
color | A 3-or-4 channel color value. |
position | The point in 3D space at which to draw the Sphere. |
radius | The size to draw the Sphere at. |
thickness | The line-width to draw the Cubesphere outline with. |
subdivisions | The accuracy of the approximation of the Cubesphere, measured in iteration steps taken. |
void JGL::J3D::WireframeCylinder | ( | ) |
void JGL::J3D::WireframeIcosahedron | ( | const Color4 & | color, |
const Vector3 & | position, | ||
float | radius, | ||
float | thickness = 1.f |
||
) |
Draws the outline of an Icosahedron in 3D space.
color | A 3-or-4 channel color value. |
position | The point in 3D space at which to draw the Icosahedron. |
radius | The size to draw the Icosahedron at. |
thickness | The line-width to draw the Icosahedron outline with. |
void JGL::J3D::WireframeIcosphere | ( | const Color4 & | color, |
const Sphere & | sphere, | ||
float | thickness = 1.f , |
||
unsigned int | subdivisions = 10 |
||
) |
Draws the outline of an Icosphere in 3D space.
color | A 3-or-4 channel color value. |
sphere | The mathematically-defined sphere object to be rendered. |
thickness | The line-width to draw the Icosphere outline with. |
subdivisions | The accuracy of the approximation of the Icosphere, measured in iteration steps taken. |
void JGL::J3D::WireframeIcosphere | ( | const Color4 & | color, |
const Vector3 & | position, | ||
float | radius, | ||
float | thickness = 1.f , |
||
unsigned int | subdivisions = 10 |
||
) |
Draws the outline of an Icosphere in 3D space.
color | A 3-or-4 channel color value. |
position | The point in 3D space at which to draw the Sphere. |
radius | The size to draw the Sphere at. |
thickness | The line-width to draw the Icosahedron outline with. |
subdivisions | The accuracy of the approximation of the Icosphere, measured in iteration steps taken. |
void JGL::J3D::WireframeOBB | ( | const Color4 & | color, |
const OBB & | obb, | ||
float | thickness = 1.f |
||
) |
Draws an outline of an oriented bounding box in 3D space.
color | A 3-or-4 channel color value. |
obb | The OBB object to visualize. |
thickness | The line-width to draw the OBB outline with. |
void JGL::J3D::WireframeOBB | ( | const Color4 & | color, |
const Vector3 & | position, | ||
const Vector3 & | radii, | ||
const EulerAngle & | orientation, | ||
float | thickness = 1.f |
||
) |
Draws an outline of an oriented bounding box in 3D space.
color | A 3-or-4 channel color value. |
position | The point in 3D space that is the center of the AABB. |
radii | The radii along x,y,z axes to size the bounding box. |
orientation | The rotation in 3D space of the OBB. |
thickness | The line-width to draw the OBB outline with. |
void JGL::J3D::WireframePipe | ( | ) |
void JGL::J3D::WireframePrism | ( | ) |
void JGL::J3D::WireframeSphere | ( | const Color4 & | color, |
const Sphere & | sphere, | ||
float | thickness = 1.f , |
||
uint | sectors = 10 , |
||
uint | stacks = 10 |
||
) |
Draws the outline of a Sphere in 3D space.
color | A 3-or-4 channel color value. |
sphere | The mathematically-defined sphere object to be rendered. |
thickness | The line-width to draw the Icosahedron outline with. |
sectors | The amount of latitudinal subdivisions to perform when computing the sphere. |
stacks | The amount of longitudinal subdivisions to perform when computing the sphere. |
void JGL::J3D::WireframeSphere | ( | const Color4 & | color, |
const Vector3 & | position, | ||
float | radius, | ||
float | thickness = 1.f , |
||
uint | sectors = 10 , |
||
uint | stacks = 10 |
||
) |
Draws the outline of a Sphere in 3D space.
color | A 3-or-4 channel color value. |
position | The point in 3D space at which to draw the Sphere. |
radius | The size to draw the Sphere at. |
thickness | The line-width to draw the Icosahedron outline with. |
sectors | The amount of latitudinal subdivisions to perform when computing the sphere. |
stacks | The amount of longitudinal subdivisions to perform when computing the sphere. |
void JGL::J3D::WireframeTorus | ( | ) |
void JGL::J3D::WireframeTriangleMesh | ( | const Color3 & | color, |
const TriangleMesh & | mesh, | ||
float | thickness = 1.f |
||
) |