pgl
PrimitiveOpenGL3Dprimitivelibrary
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
pgl::Primitive Class Reference

Basic 3D primitive. More...

#include <primitive.h>

Inheritance diagram for pgl::Primitive:
Inheritance graph
[legend]
Collaboration diagram for pgl::Primitive:
Collaboration graph
[legend]

Public Member Functions

 Primitive ()
 Default constructor. More...
 
virtual void draw ()
 Draw primitive and its children.
 
- Public Member Functions inherited from pgl::Object
 Object ()
 Default constructor. More...
 
- Public Member Functions inherited from pgl::Node
template<class T >
T * attach (T *child)
 Add child to list of sub-objects. More...
 

Public Attributes

Vector3 color
 Primitive color.
 
- Public Attributes inherited from pgl::Object
Transform transform
 Position and orientation.
 
- Public Attributes inherited from pgl::Node
std::vector< Node * > children
 Sub-objects.
 

Protected Member Functions

double align (const Vector3 &start, const Vector3 &end)
 Align primitive along axis. More...
 
virtual void normal (const Vector3 &v)
 Sets norm for subsequent vertices.
 
virtual void vertex (const Vector3 &v)
 Enters vertex into display list.
 
virtual void quad (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &v4)
 Draws a four-sided polygon using two triangles. More...
 
virtual void triangle (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3)
 Draws triangle.
 

Protected Attributes

GLuint list_
 OpenGL display list identifier.
 

Detailed Description

Basic 3D primitive.

An object that actually draws something. Derived objects generally create a display list upon construction that is drawn by this superclass.

Note
Objects will generally by aligned along the Z axis and centered on the origin.

Constructor & Destructor Documentation

◆ Primitive()

pgl::Primitive::Primitive ( )
inline

Default constructor.

The default color is white.

Member Function Documentation

◆ align()

double pgl::Primitive::align ( const Vector3 start,
const Vector3 end 
)
inlineprotected

Align primitive along axis.

Align a centered z-axis aligned primitive along end-start, starting at start.

Returns
length of vector.

◆ quad()

virtual void pgl::Primitive::quad ( const Vector3 v1,
const Vector3 v2,
const Vector3 v3,
const Vector3 v4 
)
inlineprotectedvirtual

Draws a four-sided polygon using two triangles.

Assuming the polygon is in counter-clockwise order, the triangles are as well.


The documentation for this class was generated from the following file: