Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Teddy::Models::Geometry Class Reference

Geometry maintains modelling data for part of Model. No materials. More...

#include <Geometry.h>

Inheritance diagram for Teddy::Models::Geometry:

Inheritance graph
[legend]
List of all members.

Public Methods

 Geometry ()
 Constructor. More...

virtual ~Geometry ()
 Destructor. More...

void insert (Element *e)
 Insert Element to Model Insert Element to Model. More...

virtual void beginElements (Projection *p)
 Code to be executed before visiting elements in the Model for drawing. More...

virtual void drawElements (Projection *p)
 Code to visit elements in the Geometry for drawing. More...

virtual void endElements (Projection *p)
 Code to be executed after visiting elements in the Geometry for drawing. More...

virtual void transformVertices (const Matrix &m, const Matrix &normal_matrix, const bool reverse)
void clearTraversal ()
double getMaxVector ()
void smooth (float max_smoothing_angle)
 Average shared normals for vertices. More...

void makePlanarTextureCoordinates (Vector center, Vector size, int axis)
 Calculate planar texture coordinates for Geometry. More...

void makeCylindricalTextureCoordinates (Vector center, Vector size, int axis)
 Calculate cylindrical texture coordinates for Geometry. More...

void makeSphericalTextureCoordinates (Vector center, Vector size, int axis)
 Calculate spherical texture coordinates for Geometry. More...

void makeCubicTextureCoordinates (Vector center, Vector size)
 Calculate cubic texture coordinates for Geometry. More...

void setTextureCoordinate (Element *e, list< Vertex * >::iterator v_it, float u, float v)
 Set texture coordinate for Geometry vertex Set texture coordinate for Geometry vertex. More...

void draw (Projection *p)
void beginUpdate (Projection *p)
void endUpdate (Projection *p)

Public Attributes

list< Element * > elements

Static Public Attributes

int draw_count = 0

Protected Attributes

unsigned int gl_list_id
bool dirty

Detailed Description

Geometry maintains modelling data for part of Model. No materials.

Definition at line 62 of file Geometry.h.


Constructor & Destructor Documentation

Teddy::Models::Geometry::Geometry  
 

Constructor.

Definition at line 41 of file Geometry.cpp.

References dirty, and gl_list_id.

Teddy::Models::Geometry::~Geometry   [virtual]
 

Destructor.

Bug:
remove display list

Definition at line 112 of file Geometry.cpp.

References gl_list_id.


Member Function Documentation

void Teddy::Models::Geometry::beginElements Projection *    p [virtual]
 

Code to be executed before visiting elements in the Model for drawing.

Parameters:
p  Projection Area to which this mesh is being drawn

Reimplemented in Teddy::Models::LineGeometry.

Definition at line 132 of file Geometry.cpp.

Referenced by drawElements.

void Teddy::Models::Geometry::beginUpdate Projection *    p
 

Definition at line 48 of file Geometry.cpp.

References gl_list_id.

Referenced by draw.

void Teddy::Models::Geometry::clearTraversal  
 

Definition at line 74 of file Geometry.cpp.

References elements.

void Teddy::Models::Geometry::draw Projection *    p
 

Definition at line 61 of file Geometry.cpp.

References beginUpdate, dirty, drawElements, endUpdate, and gl_list_id.

void Teddy::Models::Geometry::drawElements Projection *    p [virtual]
 

Code to visit elements in the Geometry for drawing.

Parameters:
p  Projection Area to which this Geometry is being drawn

Definition at line 140 of file Geometry.cpp.

References beginElements, elements, and endElements.

Referenced by draw.

void Teddy::Models::Geometry::endElements Projection *    p [virtual]
 

Code to be executed after visiting elements in the Geometry for drawing.

Parameters:
p  Projection Area to which this mesh is being drawn

Reimplemented in Teddy::Models::LineGeometry.

Definition at line 157 of file Geometry.cpp.

Referenced by drawElements.

void Teddy::Models::Geometry::endUpdate Projection *    p
 

Definition at line 54 of file Geometry.cpp.

References dirty.

Referenced by draw.

double Teddy::Models::Geometry::getMaxVector  
 

Definition at line 94 of file Geometry.cpp.

References elements.

void Teddy::Models::Geometry::insert Element   e
 

Insert Element to Model Insert Element to Model.

Parameters:
e  Element which is added to this Model

Definition at line 123 of file Geometry.cpp.

References elements.

void Teddy::Models::Geometry::makeCubicTextureCoordinates Vector    center,
Vector    size
 

Calculate cubic texture coordinates for Geometry.

Calculate cubic texture coordinates for Geometry

Parameters:
center  Texture center
size  Texture size
Texture coordinate calculation for Geometry is done Element by Element.

For each Element, we calculate a new texture coordinate for each Vertex of the Element.

If the Vertex in the Element does not yet have a texture coordinate set, we will set the new texture coordinate to the existing Vertex.

If the Vertex in the Element does have the same texture coordinate as we just calculated, we do nothing to it.

If the Vertex in the Element has a different texture coordinate, then we replace the old Vertex pointer in Face's Vertex list with a new Vertex that inherits the old Vertex but has the new texture coordinate. The old Vertex is not changed, and other Face's Vertex lists still point to it.

This routine is not recursive; sub-Geometryes are not processed.

Definition at line 549 of file GeometryTextureCoordinates.cpp.

References Teddy::SysSupport::dmsg, elements, Teddy::SysSupport::M_TMAP, setTextureCoordinate, TC_EPSILON, TEXTURE_AXIS_X, TEXTURE_AXIS_Y, TEXTURE_AXIS_Z, and Vector.

void Teddy::Models::Geometry::makeCylindricalTextureCoordinates Vector    center,
Vector    size,
int    axis
 

Calculate cylindrical texture coordinates for Geometry.

Calculate cylindrical texture coordinates for Geometry

Parameters:
center  Texture center
size  Texture size
axis  Texture axis
The texture axis can be one of the following:

  • TEXTURE_AXIS_X
  • TEXTURE_AXIS_Y
  • TEXTURE_AXIS_Z
Texture coordinate calculation for Geometry is done Element by Element.

For each Element, we calculate a new texture coordinate for each Vertex of the Element.

If the Vertex in the Element does not yet have a texture coordinate set, we will set the new texture coordinate to the existing Vertex.

If the Vertex in the Element does have the same texture coordinate as we just calculated, we do nothing to it.

If the Vertex in the Element has a different texture coordinate, then we replace the old Vertex pointer in Face's Vertex list with a new Vertex that inherits the old Vertex but has the new texture coordinate. The old Vertex is not changed, and other Face's Vertex lists still point to it.

This routine is not recursive; sub-Geometryes are not processed.

Definition at line 332 of file GeometryTextureCoordinates.cpp.

References Teddy::SysSupport::dmsg, elements, Teddy::Models::fract, M_2_PI, Teddy::SysSupport::M_TMAP, setTextureCoordinate, TEXTURE_AXIS_X, TEXTURE_AXIS_Y, TEXTURE_AXIS_Z, Vector, and Teddy::Models::xyz_to_h.

void Teddy::Models::Geometry::makePlanarTextureCoordinates Vector    center,
Vector    size,
int    axis
 

Calculate planar texture coordinates for Geometry.

Calculate planar texture coordinates for Geometry

Parameters:
center  Texture center
size  Texture size
axis  Texture axis
The texture axis can be one of the following:

  • TEXTURE_AXIS_X
  • TEXTURE_AXIS_Y
  • TEXTURE_AXIS_Z
Texture coordinate calculation for Geometry is done Element by Element.

For each Element, we calculate a new texture coordinate for each Vertex of the Element.

If the Vertex in the Element does not yet have a texture coordinate set, we will set the new texture coordinate to the existing Vertex.

If the Vertex in the Element does have the same texture coordinate as we just calculated, we do nothing to it.

If the Vertex in the Element has a different texture coordinate, then we replace the old Vertex pointer in Face's Vertex list with a new Vertex that inherits the old Vertex but has the new texture coordinate. The old Vertex is not changed, and other Face's Vertex lists still point to it.

This routine is not recursive; sub-Geometryes are not processed.

Here are some simplified code fragments showing how LightWave computes UV coordinates from X, Y, and Z. If the resulting UV coordinates are not in the range from 0 to 1, the appropriate integer should be added to them to bring them into that range (the fract function should have accomplished this by subtracting the floor of each number from itself). Then they can be multiplied by the width and height (in pixels) of an image map to determine which pixel to look up. The texture size, center, and tiling parameters are taken right off the texture control panel.

Definition at line 205 of file GeometryTextureCoordinates.cpp.

References Teddy::SysSupport::dmsg, elements, Teddy::SysSupport::M_TMAP, setTextureCoordinate, TC_EPSILON, TEXTURE_AXIS_X, TEXTURE_AXIS_Y, TEXTURE_AXIS_Z, and Vector.

void Teddy::Models::Geometry::makeSphericalTextureCoordinates Vector    center,
Vector    size,
int    axis
 

Calculate spherical texture coordinates for Geometry.

Calculate spherical texture coordinates for Geometry

Parameters:
center  Texture center
size  Texture size
axis  Texture axis
The texture axis can be one of the following:

  • TEXTURE_AXIS_X
  • TEXTURE_AXIS_Y
  • TEXTURE_AXIS_Z
Texture coordinate calculation for Geometry is done Element by Element.

For each Element, we calculate a new texture coordinate for each Vertex of the Element.

If the Vertex in the Element does not yet have a texture coordinate set, we will set the new texture coordinate to the existing Vertex.

If the Vertex in the Element does have the same texture coordinate as we just calculated, we do nothing to it.

If the Vertex in the Element has a different texture coordinate, then we replace the old Vertex pointer in Face's Vertex list with a new Vertex that inherits the old Vertex but has the new texture coordinate. The old Vertex is not changed, and other Face's Vertex lists still point to it.

This routine is not recursive; sub-Geometryes are not processed.

Definition at line 444 of file GeometryTextureCoordinates.cpp.

References Teddy::SysSupport::dmsg, elements, Teddy::Models::fract, M_2_PI, M_PI, Teddy::SysSupport::M_TMAP, setTextureCoordinate, TEXTURE_AXIS_X, TEXTURE_AXIS_Y, TEXTURE_AXIS_Z, Vector, and Teddy::Models::xyz_to_hp.

void Teddy::Models::Geometry::setTextureCoordinate Element   e,
list< Vertex * >::iterator    v_it,
float    s,
float    t
 

Set texture coordinate for Geometry vertex Set texture coordinate for Geometry vertex.

Parameters:
e  Element of Geometry which vertex is being processed
v_it  Element vertex list iterator
s  Texture s coordinate
t  Texture t coordinate

Definition at line 105 of file GeometryTextureCoordinates.cpp.

References Teddy::SysSupport::dmsg, Teddy::SysSupport::M_TMAP, TC_EPSILON, and Vector.

Referenced by makeCubicTextureCoordinates, makeCylindricalTextureCoordinates, makePlanarTextureCoordinates, and makeSphericalTextureCoordinates.

void Teddy::Models::Geometry::smooth float    max_smoothing_angle
 

Average shared normals for vertices.

Warning:
This method is not recursive
Parameters:
max_smoothing  angle The maximum angle between faces which vertices will participate the smoothing
Bug:
Check type (either degrees or radians) for max_smoothing_angle

Definition at line 167 of file Geometry.cpp.

References Teddy::SysSupport::dmsg, elements, and Teddy::SysSupport::M_TMAP.

void Teddy::Models::Geometry::transformVertices const Matrix &    m,
const Matrix &    normal_matrix,
const bool    reverse
[virtual]
 

Definition at line 83 of file Geometry.cpp.

References dirty, and elements.


Member Data Documentation

bool Teddy::Models::Geometry::dirty [protected]
 

Definition at line 98 of file Geometry.h.

Referenced by draw, endUpdate, Geometry, and transformVertices.

int Teddy::Models::Geometry::draw_count = 0 [static]
 

Definition at line 37 of file Geometry.cpp.

list<Element*> Teddy::Models::Geometry::elements
 

Definition at line 88 of file Geometry.h.

Referenced by clearTraversal, drawElements, getMaxVector, insert, makeCubicTextureCoordinates, makeCylindricalTextureCoordinates, makePlanarTextureCoordinates, makeSphericalTextureCoordinates, smooth, and transformVertices.

unsigned int Teddy::Models::Geometry::gl_list_id [protected]
 

Definition at line 97 of file Geometry.h.

Referenced by beginUpdate, draw, Geometry, and ~Geometry.


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