Shape Class Reference
[Basic]
Base class for a 3D object in the scene.
More...
#include <Shape.hpp>
List of all members.
Public Member Functions |
| Shape (const Tag &tag, ShapeTraits traits) |
virtual void | associate () |
virtual void | draw () const |
void | draw (int first, int number) const |
virtual void | finalize () |
virtual list< VertexAttribute > | getAttributes () const |
virtual GLuint | getCount () const |
virtual GLuint | getLimit () const |
virtual string | getName () const |
virtual Program * | getProgram () const |
virtual void | setAttributes (list< VertexAttribute > &attributes) |
virtual void | setProgram (Program *program) |
virtual string | toString () const |
Protected Member Functions |
void | checkForDefaultUniforms () |
virtual GLuint | getOffset (const string &name) const |
void | setBufferData (const string &name, GLfloat data[][3]) |
virtual void | setCount (GLuint count) |
virtual void | setLimit (GLuint limit) |
virtual void | updateBuffer ()=0 |
Static Protected Member Functions |
static bool | isBufferStored (const string &className) |
Private Attributes |
bool | defaults |
list< VertexAttribute > | attributes |
GLenum | mode |
GLenum | usage |
GLuint | block |
GLuint | buffer |
GLuint | count |
GLuint | limit |
map< string, GLuint > | offsets |
Program * | program |
string | name |
Static Private Attributes |
static map< string, GLuint > | buffers |
Detailed Description
Base class for a 3D object in the scene.
Uses a vertex buffer for drawing. If usage is GL_STATIC_DRAW
, a buffer will only be generated once for each concrete shape. Subsequent instances of that shape will be given the same buffer. That way duplicate buffers are avoided.
count | Number of elements in the shape. |
buffer | Handle that OpenGL identifies the vertex buffer with. |
program | Pointer to the Program the shape will be rendered with. |
Constructor & Destructor Documentation
Shape |
( |
const Tag & |
tag, |
|
|
ShapeTraits |
traits | |
|
) |
| | |
Creates a shape from an XML tag.
- Parameters:
-
| tag | XML tag with attributes for SimpleDrawable. |
| traits | Structure of shape parameters. |
Member Function Documentation
void associate |
( |
|
) |
[virtual] |
void draw |
( |
int |
first, |
|
|
int |
number | |
|
) |
| | const |
Renders part of the shape.
void draw |
( |
|
) |
const [virtual] |
void finalize |
( |
|
) |
[virtual] |
Loads the vertex data into the vertex buffer so it's ready to render.
Reimplemented from Node.
Reimplemented in Boolean.
list< VertexAttribute > getAttributes |
( |
|
) |
const [inline, virtual] |
- Returns:
- Attributes in use for this shape.
GLuint getCount |
( |
|
) |
const [inline, virtual] |
- Returns:
- Number of vertices in the shape.
GLuint getLimit |
( |
|
) |
const [inline, virtual] |
- Returns:
- Number of vertices that will be drawn.
string getName |
( |
|
) |
const [inline, virtual] |
- Returns:
- User-assigned name of the shape.
GLuint getOffset |
( |
const string & |
name |
) |
const [protected, virtual] |
- Returns:
- Number of bytes into the vertex buffer for a vertex attribute.
Program * getProgram |
( |
|
) |
const [inline, virtual] |
- Returns:
- Program the shape sends vertex attributes to.
bool isBufferStored |
( |
const string & |
className |
) |
[static, protected] |
Checks if a buffer already exists for a concrete shape.
void setAttributes |
( |
list< VertexAttribute > & |
a |
) |
[inline, virtual] |
Set attributes in use for this shape.
void setBufferData |
( |
const string & |
name, |
|
|
GLfloat |
data[][3] | |
|
) |
| | [protected] |
Sets data in the buffer according to its vertex attribute name.
- Parameters:
-
| name | Name of the vertex attribute |
| data | Array of values of length count |
void setCount |
( |
GLuint |
c |
) |
[inline, protected, virtual] |
Sets the number of vertices in the shape.
void setLimit |
( |
GLuint |
l |
) |
[inline, protected, virtual] |
Sets the number of vertices that will be drawn.
void setProgram |
( |
Program * |
p |
) |
[inline, virtual] |
Sets the program to send vertex attributes to.
string toString |
( |
|
) |
const [virtual] |
The documentation for this class was generated from the following files: