reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

of3dGraphics Class Reference

#include <of3dGraphics.h>

Public Member Functions

 of3dGraphics (ofBaseRenderer *renderer)
 Construct a of3dGraphics object.
 
void setPlaneResolution (int columns, int rows)
 Set the plane resolution using column and rows.
 
glm::vec2 getPlaneResolution () const
 Get the current plane resolution as a 2D vector.
 
void drawPlane (float x, float y, float width, float height) const
 Draw a plane using x, y, width, and height.
 
void drawPlane (float x, float y, float z, float width, float height) const
 Draw a plane using x, y, z, width, and height.
 
void drawPlane (const glm::vec3 &position, float width, float height) const
 Draw a plane a position vector, width, and height.
 
void drawPlane (float width, float height) const
 Draw a plane at the coordinate system's origin.
 
void setSphereResolution (int res)
 Set the resolution to use when drawing spheres.
 
int getSphereResolution () const
 Get the current sphere resolution.
 
void drawSphere (float x, float y, float radius) const
 Draw a sphere.
 
void drawSphere (float x, float y, float z, float radius) const
 Draw a sphere.
 
void drawSphere (const glm::vec3 &position, float radius) const
 Draw a sphere.
 
void drawSphere (float radius) const
 Draw a sphere at the coordinate system's origin.
 
void setIcoSphereResolution (int res)
 Set the resolution to use when drawing icospheres.
 
int getIcoSphereResolution () const
 Get the current icosphere resolution.
 
void drawIcoSphere (float x, float y, float z, float radius) const
 Draw an icosphere.
 
void drawIcoSphere (float x, float y, float radius) const
 Draw an icosphere.
 
void drawIcoSphere (const glm::vec3 &position, float radius) const
 Draw an icosphere.
 
void drawIcoSphere (float radius) const
 Draw an icosphere at the coordinate system's origin.
 
void setCylinderResolution (int radiusSegments, int heightSegments, int capSegments=2)
 Set the resolution to use when drawing cylinders.
 
glm::vec3 getCylinderResolution () const
 Get the current cylinder resolution as a 3D vector.
 
void drawCylinder (float x, float y, float radius, float height) const
 Draw a cylinder using x, y, radius, and height.
 
void drawCylinder (float x, float y, float z, float radius, float height) const
 Draw a cylinder using x, y, z, radius, and height.
 
void drawCylinder (const glm::vec3 &position, float radius, float height) const
 Draw a cylinder using position, radius, and height.
 
void drawCylinder (float radius, float height) const
 Draw a cylinder at the origin using radius and height.
 
void setConeResolution (int radiusSegments, int heightSegments, int capSegments=2)
 Set the resolution to use when drawing cones.
 
glm::vec3 getConeResolution () const
 Get the cone resolution.
 
void drawCone (float x, float y, float z, float radius, float height) const
 Draw a cone.
 
void drawCone (float x, float y, float radius, float height) const
 Draw a cone.
 
void drawCone (const glm::vec3 &position, float radius, float height) const
 Draw a cone using x, y, z, radius, and height.
 
void drawCone (float radius, float height) const
 Draw a cone at the origin using radius and height.
 
void setBoxResolution (int res)
 Set the resolution to use when drawing boxes.
 
void setBoxResolution (int resWidth, int resHeight, int resDepth)
 Set the resolution to use when drawing boxes.
 
glm::vec3 getBoxResolution () const
 Get the current box resolution as a 3D vector.
 
void drawBox (float x, float y, float z, float width, float height, float depth) const
 Draw a cube.
 
void drawBox (float x, float y, float z, float size) const
 Draw a cube.
 
void drawBox (const glm::vec3 &position, float width, float height, float depth) const
 Draw a cube.
 
void drawBox (const glm::vec3 &position, float size) const
 Draw a cube.
 
void drawBox (float size) const
 Draw a cube.
 
void drawBox (float width, float height, float depth) const
 Draw a cube.
 
void drawAxis (float size) const
 Draw the coordinate system's axes.
 
void drawGrid (float stepSize, size_t numberOfSteps, bool labels, bool x, bool y, bool z) const
 Draw the coordinate system's axes as a grid.
 
void drawGridPlane (float stepSize, size_t numberOfSteps, bool labels) const
 Draw a coordinate system plane using the y and z axes.
 
void drawArrow (const glm::vec3 &start, const glm::vec3 &end, float headSize) const
 Draw an arrow between two 3D points.
 
void drawRotationAxes (float radius, float stripWidth, int circleRes) const
 Draw the coordinate system's rotation axes.
 

Constructor & Destructor Documentation

◆ of3dGraphics()

of3dGraphics::of3dGraphics ( ofBaseRenderer renderer)

Construct a of3dGraphics object.

Parameters
rendererA pointer to the base renderer.

Member Function Documentation

◆ drawArrow()

void of3dGraphics::drawArrow ( const glm::vec3 &  start,
const glm::vec3 &  end,
float  headSize 
) const

Draw an arrow between two 3D points.

Parameters
startThe 3D vector to use as the first point.
endThe 3D vector to use as the second point.
headSizeThe size of the arrowhead.

◆ drawAxis()

void of3dGraphics::drawAxis ( float  size) const

Draw the coordinate system's axes.

This draws a red, green, and blue lines for the x, y, and z axes respectively. This can be helpful when trying to orient other objects in respect to the coordinate system.

Parameters
sizeThe length to draw each axis line.

◆ drawBox() [1/6]

void of3dGraphics::drawBox ( const glm::vec3 &  position,
float  size 
) const

Draw a cube.

A cube is drawn starting from a 3D reference position, with the specified size.

The cube is drawn with the current color, e.g. set with ofSetColor(). The cube is drawn filled by default; change this with ofFill();

Parameters
positiona glm::vec3 which contains the (x,y,z) coordinates for the cube's reference corner.
sizeThe size of the cube.

◆ drawBox() [2/6]

void of3dGraphics::drawBox ( const glm::vec3 &  position,
float  width,
float  height,
float  depth 
) const

Draw a cube.

A box is a rectangular solid: an extruded rectangle. It is drawn starting from a 3D reference coordinate. It has a width (in x), a height (in y), and a depth (in z). The box is drawn with the current color, e.g. set with ofSetColor(). The box is drawn filled by default; change this with ofFill();

Parameters
positiona glm::vec3 which contains the (x,y,z) coordinates for the box's reference corner.
widthThe width of the box.
heightThe height of the box.
depthThe depth of the box.

◆ drawBox() [3/6]

void of3dGraphics::drawBox ( float  size) const

Draw a cube.

The cube is drawn with the current color, e.g. set with ofSetColor(). The cube is drawn filled by default; change this with ofFill();

Parameters
sizeThe size of the cube.

◆ drawBox() [4/6]

void of3dGraphics::drawBox ( float  width,
float  height,
float  depth 
) const

Draw a cube.

A box is a rectangular solid: an extruded rectangle. It is drawn starting from the origin of the current reference frame. It has a width (in x), a height (in y), and a depth (in z). The box is drawn with the current color, e.g. set with ofSetColor(). The box is drawn filled by default; change this with ofFill();

Parameters
widthThe width of the box.
heightThe height of the box.
depthThe depth of the box.

◆ drawBox() [5/6]

void of3dGraphics::drawBox ( float  x,
float  y,
float  z,
float  size 
) const

Draw a cube.

A cube is a rectangular solid bounded by six square faces of equal size. It is also known as a regular hexahedron, a square parallelepiped, an equilateral cuboid and a right rhombohedron. It is a regular square prism in three orientations.

It is drawn starting from a 3D reference coordinate, with the specified size.

The cube is drawn with the current color, e.g. set with ofSetColor(). The cube is drawn filled by default; change this with ofFill();

Parameters
xThe x-coordinate of the cube's origin.
yThe y-coordinate of the cube's origin.
zThe z-coordinate of the cube's origin.
sizeThe size of the cube.

◆ drawBox() [6/6]

void of3dGraphics::drawBox ( float  x,
float  y,
float  z,
float  width,
float  height,
float  depth 
) const

Draw a cube.

A box is a rectangular solid: an extruded rectangle. It is drawn starting from a 3D reference coordinate. It has a width (in x), a height (in y), and a depth (in z). The box is drawn with the current color, e.g. set with ofSetColor(). The box is drawn filled by default; change this with ofFill();

Parameters
xThe x-coordinate of the box's origin.
yThe y-coordinate of the box's origin.
zThe z-coordinate of the box's origin.
widthThe width of the box.
heightThe height of the box.
depthThe depth of the box.

◆ drawCone() [1/4]

void of3dGraphics::drawCone ( const glm::vec3 &  position,
float  radius,
float  height 
) const

Draw a cone using x, y, z, radius, and height.

Cones are drawn with x, y, and z coordinates representing the centroid of the cone.

Parameters
positionThe 3D point representing this cone's position.
radiusThe radius to use when drawing this cone's circular footprint.
heightThe height to use when drawing this cone.

◆ drawCone() [2/4]

void of3dGraphics::drawCone ( float  radius,
float  height 
) const

Draw a cone at the origin using radius and height.

This cone will be drawn with its position at the coordinate system's origin (0, 0, 0).

Parameters
radiusThe radius to use when drawing this cone's circular footprint.
heightThe height to use when drawing this cone.

◆ drawCone() [3/4]

void of3dGraphics::drawCone ( float  x,
float  y,
float  radius,
float  height 
) const

Draw a cone.

Cones are drawn with x, y, and z coordinates representing the centroid of the cylinder. This function draws a cone with a z position property of 0.

Parameters
xThe x coordinate to use when drawing this cone.
yThe y coordinate to use when drawing this cone.
radiusThe radius to use when drawing this cone's circular footprint.
heightThe height to use when drawing this cone.

◆ drawCone() [4/4]

void of3dGraphics::drawCone ( float  x,
float  y,
float  z,
float  radius,
float  height 
) const

Draw a cone.

Cones are drawn with x, y, and z coordinates representing the centroid of the cone.

Parameters
xThe x coordinate to use when drawing this cone.
yThe y coordinate to use when drawing this cone.
zThe z coordinate to use when drawing this cone.
radiusThe radius to use when drawing this cone's circular footprint.
heightThe height to use when drawing this cone.

◆ drawCylinder() [1/4]

void of3dGraphics::drawCylinder ( const glm::vec3 &  position,
float  radius,
float  height 
) const

Draw a cylinder using position, radius, and height.

Cyliners are drawn with x, y, and z coordinates representing the centroid of the cylinder.

Parameters
positionThe 3D point to use as a position coordinate when drawing this cylinder.
radiusThe radius to use when drawing this cylinder's circular footprint.
heightThe height to use when drawing this cylinder.

◆ drawCylinder() [2/4]

void of3dGraphics::drawCylinder ( float  radius,
float  height 
) const

Draw a cylinder at the origin using radius and height.

A cylinder drawn in this way will be positioned at the coordinate system origin (0, 0, 0).

Parameters
radiusThe radius to use when drawing this cylinder's circular footprint.
heightThe height to use when drawing this cylinder.

◆ drawCylinder() [3/4]

void of3dGraphics::drawCylinder ( float  x,
float  y,
float  radius,
float  height 
) const

Draw a cylinder using x, y, radius, and height.

Cylinders are drawn with x, y, and z coordinates representing the centroid of the cylinder. This function doesn't specify a cylinder's z value so it defaults to 0.

Parameters
xThe x coordinate to use when drawing this cylinder.
yThe y coordinate to use when drawing this cylinder.
radiusThe radius to use when drawing this cylinder's circular footprint.
heightThe height to use when drawing this cylinder.

◆ drawCylinder() [4/4]

void of3dGraphics::drawCylinder ( float  x,
float  y,
float  z,
float  radius,
float  height 
) const

Draw a cylinder using x, y, z, radius, and height.

Cylinders are drawn with x, y, and z coordinates representing the centroid of the cylinder.

Parameters
xThe x coordinate to use when drawing this cylinder.
yThe y coordinate to use when drawing this cylinder.
zThe z coordinate to use when drawing this cylinder.
radiusThe radius to use when drawing this cylinder's circular footprint.
heightThe height to use when drawing this cylinder.

◆ drawGrid()

void of3dGraphics::drawGrid ( float  stepSize,
size_t  numberOfSteps,
bool  labels,
bool  x,
bool  y,
bool  z 
) const

Draw the coordinate system's axes as a grid.

Parameters
stepSizeThe size of each row/column in each axis grid.
numberOfStepsThe number of rows/columns in each axis grid.
labelsTrue to draw the name and values of the axis as a bitmap string.
xTrue to draw the x axis.
yTrue to draw the y axis.
zTrue to draw the z axis.

◆ drawGridPlane()

void of3dGraphics::drawGridPlane ( float  stepSize,
size_t  numberOfSteps,
bool  labels 
) const

Draw a coordinate system plane using the y and z axes.

Parameters
stepSizeThe size of each row/column on the axis grid.
numberOfStepsThe number of rows/columns on the axis grid.
labelsTrue to draw the names and values of the axes.

◆ drawIcoSphere() [1/4]

void of3dGraphics::drawIcoSphere ( const glm::vec3 &  position,
float  radius 
) const

Draw an icosphere.

Icospheres are drawn with their position coordinates representing the center of the sphere.

Parameters
positionA 3D point specifying the sphere's centroid.
radiusThe radius of the sphere.

◆ drawIcoSphere() [2/4]

void of3dGraphics::drawIcoSphere ( float  radius) const

Draw an icosphere at the coordinate system's origin.

Icospheres are drawn with their position coordinates representing the center of the sphere. This function draws a sphere at the coordinate system origin (0, 0, 0).

Parameters
radiusThe radius of the sphere.

◆ drawIcoSphere() [3/4]

void of3dGraphics::drawIcoSphere ( float  x,
float  y,
float  radius 
) const

Draw an icosphere.

Icospheres are drawn with their x, y, and z coordinates representing the center of the sphere. This function draws the sphere with a default origin z value of 0.

Parameters
xThe x coordinate of the sphere's centroid.
yThe y coordinate of the sphere's centroid.
radiusThe radius of the sphere.

◆ drawIcoSphere() [4/4]

void of3dGraphics::drawIcoSphere ( float  x,
float  y,
float  z,
float  radius 
) const

Draw an icosphere.

Icospheres are drawn with their x, y, and z coordinates representing the center of the sphere.

Parameters
xThe x coordinate of the sphere's centroid.
yThe y coordinate of the sphere's centroid.
zThe z coordinate of the sphere's centroid.
radiusThe radius of the sphere.

◆ drawPlane() [1/4]

void of3dGraphics::drawPlane ( const glm::vec3 &  position,
float  width,
float  height 
) const

Draw a plane a position vector, width, and height.

Planes are drawn with their position coordinates specifying the center of the plane.

Parameters
positionA 3D point specifying the plane's centroid.
widthThe width to use when drawing the plane.
heightThe height to use when drawing the plane.

◆ drawPlane() [2/4]

void of3dGraphics::drawPlane ( float  width,
float  height 
) const

Draw a plane at the coordinate system's origin.

This function draws a plane with a centroid at the coordinate system origin (0, 0, 0).

Parameters
widthThe width of the plane.
heightThe height of the plane.

◆ drawPlane() [3/4]

void of3dGraphics::drawPlane ( float  x,
float  y,
float  width,
float  height 
) const

Draw a plane using x, y, width, and height.

Planes are drawn with their x, y, and z coordinates specifying the center of the plane. This function draws a plane with a z coordinate of 0.

Parameters
xThe x coordinate to use when drawing the plane.
yThe y coordinate to use when drawing the plane.
widthThe width to use when drawing the plane.
heightThe height to use when drawing the plane.

◆ drawPlane() [4/4]

void of3dGraphics::drawPlane ( float  x,
float  y,
float  z,
float  width,
float  height 
) const

Draw a plane using x, y, z, width, and height.

Planes are drawn with their x, y, and z coordinates specifying the center of the plane.

Parameters
xThe x coordinate to use when drawing the plane.
yThe y coordinate to use when drawing the plane.
zThe z coordinate to use when drawing the plane.
widthThe width to use when drawing the plane.
heightThe height to use when drawing the plane.

◆ drawRotationAxes()

void of3dGraphics::drawRotationAxes ( float  radius,
float  stripWidth,
int  circleRes 
) const

Draw the coordinate system's rotation axes.

This draws red, green, and blue lines for the x, y, and z rotation axes respectively. This can be helpful when trying to orient other object's rotation in respect to the coordinate system.

Parameters
radiusThe radius to draw the rotation axes with.
stripWidthThe width of each axis line.
circleResThe circle resolution to use when drawing the axes.

◆ drawSphere() [1/4]

void of3dGraphics::drawSphere ( const glm::vec3 &  position,
float  radius 
) const

Draw a sphere.

Spheres are drawn with their position representing the center of the sphere.

Parameters
positionA 3D point specifying the sphere's centroid.
radiusThe radius of the sphere.

◆ drawSphere() [2/4]

void of3dGraphics::drawSphere ( float  radius) const

Draw a sphere at the coordinate system's origin.

Spheres are drawn with their position representing the center of the 0, 0, 0.

Parameters
radiusThe radius of the sphere.

◆ drawSphere() [3/4]

void of3dGraphics::drawSphere ( float  x,
float  y,
float  radius 
) const

Draw a sphere.

Spheres are drawn with x, y, and z coordinates representing the center of the sphere. This function draws the sphere with a default origin z value of 0.

Parameters
xThe x coordinate of the sphere's centroid.
yThe y coordinate of the sphere's centroid.
radiusThe radius of the sphere.

◆ drawSphere() [4/4]

void of3dGraphics::drawSphere ( float  x,
float  y,
float  z,
float  radius 
) const

Draw a sphere.

Spheres are drawn with their x, y, and z coordinates representing the center of the sphere.

Parameters
xThe x coordinate of the sphere's centroid.

◆ getBoxResolution()

glm::vec3 of3dGraphics::getBoxResolution ( ) const

Get the current box resolution as a 3D vector.

The returned vector's x, y, and z properties represent the current resolution width, resolution height, and resolution depth respectively.

returns a 3D vector representing the resolution in each dimension.

◆ getConeResolution()

glm::vec3 of3dGraphics::getConeResolution ( ) const

Get the cone resolution.

Allows you to fetch the resolution with which cones are polygonized. Returns a glm::vec3 containing the following data: Encoded as "x": radiusSegments, the number of facets (subdivisions) around the cone's circular footprint. Encoded as "y": heightSegments, the number of subdivisions from the cone's top to bottom. Encoded as "z": capSegments, the number of annular (ring-shaped) subdivisions of the cone's endcap.

Returns
A 3D vector containing radiusSegments, heightSegments, capSegments for cone polygonization as x, y, and z properties respectively.

◆ getCylinderResolution()

glm::vec3 of3dGraphics::getCylinderResolution ( ) const

Get the current cylinder resolution as a 3D vector.

The resulting vector's x, y, and z properties correspond to the radius segments, height segments, and cap segments of the current cylinder resolution respectively.

Returns
A 3D vector representing the current cylinder resolution.

◆ getIcoSphereResolution()

int of3dGraphics::getIcoSphereResolution ( ) const

Get the current icosphere resolution.

Returns
The current icosphere resolution.
See also
setIcoSphereResolution()

◆ getPlaneResolution()

glm::vec2 of3dGraphics::getPlaneResolution ( ) const

Get the current plane resolution as a 2D vector.

The resulting vector's x and y values corresponds to the current column and row resolutions respectively.

Returns
A 2D vector representing the current plane resolution in columns and rows.

◆ getSphereResolution()

int of3dGraphics::getSphereResolution ( ) const

Get the current sphere resolution.

Returns
The current sphere resolution.
See also
setSphereResolution()

◆ setBoxResolution() [1/2]

void of3dGraphics::setBoxResolution ( int  res)

Set the resolution to use when drawing boxes.

Boxes

Parameters
resThe number of subdivisions to use for box width, height, and depth.

◆ setBoxResolution() [2/2]

void of3dGraphics::setBoxResolution ( int  resWidth,
int  resHeight,
int  resDepth 
)

Set the resolution to use when drawing boxes.

Parameters
resWidthThe number of subdivisions to use when drawing box widths.
resHeightThe number of subdivisions to use when drawing box heights.
resDepthThe number of subdivisions to use when drawing box

◆ setConeResolution()

void of3dGraphics::setConeResolution ( int  radiusSegments,
int  heightSegments,
int  capSegments = 2 
)

Set the resolution to use when drawing cones.

Cones

Parameters
radiusSegmentsThe number of facets (subdivisions) around the cone's circular footprint.
heightSegmentsThe number of subdivisions from the cone's top to bottom.
capSegmentsThe number of annular (ring-shaped) subdivisions of the cone's endcap.

◆ setCylinderResolution()

void of3dGraphics::setCylinderResolution ( int  radiusSegments,
int  heightSegments,
int  capSegments = 2 
)

Set the resolution to use when drawing cylinders.

Cylinders

Parameters
radiusSegmentsThe number of facets (subdivisions) around the cylinder's circular footprint. A larger number yields a higher resolution.
heightSegmentsThe number of horizontal subdivisions from the cylinder's top to bottom.
capSegmentsThe number of annular (ring-shaped) subdivisions of the cylinder's endcap. Defaults to 2.

◆ setIcoSphereResolution()

void of3dGraphics::setIcoSphereResolution ( int  res)

Set the resolution to use when drawing icospheres.

A higher resolution will produce a smoother looking sphere at the cost of using more vertices to do so.

Parameters
resThe resolution to use when drawing icospheres.
See also
getIcoSphereResolution()
drawIcoSphere()

◆ setPlaneResolution()

void of3dGraphics::setPlaneResolution ( int  columns,
int  rows 
)

Set the plane resolution using column and rows.

Planes

Parameters
columnsThe number of columns to use when drawing planes.
rowsThe number of rows to use when drawing planes.

◆ setSphereResolution()

void of3dGraphics::setSphereResolution ( int  res)

Set the resolution to use when drawing spheres.

Spheres

The sphere resolution describes how many facets (cross-sections) will be used when drawing spheres. A higher resolution will produce a smoother looking sphere at the cost of using more vertices to do so.

Parameters
resThe resolution to use when drawing spheres.
See also
getSphereResolution()
drawSphere()

The documentation for this class was generated from the following files:
  • /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/graphics/of3dGraphics.h
  • /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/graphics/of3dGraphics.cpp