TObject Class Reference

contains object information(unique name, type), 3D data(vertices, faces, normal and texture coordinates), position, rotation and scale, link to material and some specific settings (like shadow casting) More...

#include <object.h>

List of all members.

Public Member Functions

 TObject ()
 Set default values, primitive type and resets position.
 ~TObject ()
 Destructor.
void Create (const char *name, int primitive, GLfloat size, GLfloat height, GLint sliceX, GLint sliceY)
 Creates object using direct parameters. Objects are generated directly and then stored in VBO for faster further drawing.
VBO Create (const char *name, const char *file, bool load=true)
 Creates object from external 3DS file.
VBO Create (Lib3dsMesh *mesh)
 Creates object directly from 3DS mesh.
void CreateInstance (const TObject &ref)
 create object as instance from existing object
void SetVBOdata (VBO data)
void SetGInstances (int count)
 Set number of current object GI instances.
GLint GetVertexBuffer ()
 Return vertex buffer ID.
void Draw (TMatrix &viewMatrix, bool render_mat=true)
 Draws object by calling it's display list. Before this object is transformed and rotated to it's current position. Then attached material is rendered(TMaterial::RenderMaterial()) There are specific types of settings, when object is not rendered (e.g. when rendering into shadow map is active and object don't cast shadows).
void DrawScreenQuad ()
 Draws screen aligned quad.
void DrawObject (bool flag)
 turn on/off object drawing
void SetMaterial (TMaterial *m)
 Set material to object (material referenced as TMaterial class).
float GetReflect ()
 Has object reflections?
bool HasMaterial ()
 Return if object has assigned material.
string GetMatName ()
 Return material name.
void Move (GLfloat wx, GLfloat wy, GLfloat wz)
 Move object from current position by position vector(relative).
void MoveAbs (GLfloat wx, GLfloat wy, GLfloat wz)
 Move object to new position(relative).
void MoveAbs (TVector w)
 Move object to new absolute position.
void Rotate (GLfloat angle, GLint axis)
 Rotate object by adding angle to current rotation(relative).
void RotateAbs (GLfloat angle, GLint axis)
 Rotate object by new angle(absolute).
void Resize (GLfloat sx, GLfloat sy, GLfloat sz)
 Resize object.
void CastShadow (bool flag=true)
 Enable/disable shadow casting by object.
string GetName ()
 Return object name.
TVector GetPosition ()
 Return object position (as TVector).
bool IsTransparent ()
 has object bound a transparent material?
bool HasFramebuffer ()
 has object bound framebuffer for reflection?

Public Attributes

GLuint cf_buffer
 framebuffer for dynamic reflection
GLuint cr_buffer
 renderbuffer for dynamic reflection
GLuint render_cubemap
 cubemap to render into
GLuint render_cubemap_depth
 depth texture for cubemap
GLuint refl_size
 reflection render size

Detailed Description

contains object information(unique name, type), 3D data(vertices, faces, normal and texture coordinates), position, rotation and scale, link to material and some specific settings (like shadow casting)


Constructor & Destructor Documentation

TObject::~TObject (  ) 

Destructor.

Todo:
free dynamic data

delete VBO buffers (only if object is not used in future)


Member Function Documentation

VBO TObject::Create ( Lib3dsMesh *  mesh  ) 

Creates object directly from 3DS mesh.

Parameters:
mesh 3DS mesh
Returns:
pointer to vertex buffer with data
VBO TObject::Create ( const char *  _name,
const char *  _file,
bool  load = true 
)

Creates object from external 3DS file.

Parameters:
_name object name
_file file with object data in 3DS format
load has object data been loaded before?
Returns:
success/fail of loading
void TObject::Create ( const char *  _name,
int  primitive,
GLfloat  size,
GLfloat  height,
GLint  sliceX,
GLint  sliceY 
)

Creates object using direct parameters. Objects are generated directly and then stored in VBO for faster further drawing.

Parameters:
_name object name(must be unique)
primitive object type (can be CUBE,PLANE,CONE,CYLINDER,DISK,SPHERE,TORUS,TEAPOT,SPLINE,FONT)
size basic object size (depends on primitive type)
height object height (depends on primitive type)
sliceX polygon count horizontal (depends on primitive type)
sliceY polygon count vertical (depends on primitive type)

Every primitive type use parameters differently:

cube: 1 param: size

plane: 2 params, size, sizeY

strip plane: 4 params, size, sizeY, sliceX, sliceY

cone: 4 params: baseRadius, height, sliceX, sliceY

cylinder: 4 params: baseRadius, height, sliceX, sliceY

disk: 4 params: innerRadius, outerRadius, sliceX, sliceY

sphere: 3 params: radius, sliceX, sliceY

torus: 4 params: innerRadius, outerRadius, nsides, rings

(torus creation - thanks to http://www.sulaco.co.za/)

void TObject::Draw ( TMatrix viewMatrix,
bool  render_mat = true 
)

Draws object by calling it's display list. Before this object is transformed and rotated to it's current position. Then attached material is rendered(TMaterial::RenderMaterial()) There are specific types of settings, when object is not rendered (e.g. when rendering into shadow map is active and object don't cast shadows).

Parameters:
viewMatrix actual view matrix
render_mat whether object material should be drawn
void TObject::Move ( GLfloat  wx,
GLfloat  wy,
GLfloat  wz 
)

Move object from current position by position vector(relative).

Parameters:
wx X-coordinate of vector
wy Y-coordinate of vector
wz Z-coordinate of vector
void TObject::MoveAbs ( TVector  w  )  [inline]

Move object to new absolute position.

Parameters:
w new position coordinates
void TObject::MoveAbs ( GLfloat  wx,
GLfloat  wy,
GLfloat  wz 
)

Move object to new position(relative).

Parameters:
wx X-coordinate of vector
wy Y-coordinate of vector
wz Z-coordinate of vector
void TObject::Resize ( GLfloat  sx,
GLfloat  sy,
GLfloat  sz 
)

Resize object.

Parameters:
sx scale in X-axis (<1.0 - smaller, >1.0 - bigger)
sy scale in Y-axis (<1.0 - smaller, >1.0 - bigger)
sz scale in Z-axis (<1.0 - smaller, >1.0 - bigger)
void TObject::Rotate ( GLfloat  angle,
GLint  axis 
)

Rotate object by adding angle to current rotation(relative).

Parameters:
angle rotation increment in degrees
axis rotational axis (can be A_X, A_Y, A_Z)
void TObject::RotateAbs ( GLfloat  angle,
GLint  axis 
)

Rotate object by new angle(absolute).

Parameters:
angle new rotation angle in degrees
axis rotational axis (can be A_X, A_Y, A_Z)
void TObject::SetVBOdata ( VBO  data  )  [inline]

set new VBO data

Parameters:
data already loaded VBO data

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

Generated by  doxygen 1.6.2