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

Teddy::Models::Element Class Reference

A simple renderable part of Geometry. More...

#include <Element.h>

Inheritance diagram for Teddy::Models::Element:

Inheritance graph
[legend]
Collaboration diagram for Teddy::Models::Element:

Collaboration graph
[legend]
List of all members.

Public Methods

 Element (unsigned long options=0)
virtual ~Element ()
 Element destructor. More...

virtual void draw (Projection *p)=0
virtual void debug ()
 Debugging information. More...

virtual void add (const float x, const float y, const float z)
 Insert a vertex to the face, component version. More...

virtual void add (Vertex *v)
 Insert a vertex to the face, pointer version. More...

virtual void append (const float x, const float y, const float z)
 Insert a vertex to the face - pointer version, reverse order. More...

virtual void append (Vertex *v)
 Insert a vertex to the face - pointer version, reverse order. More...

virtual void reverse ()
virtual bool contains (const Vertex *v) const
 Return true if element contains spesified vertex. More...

virtual void makeNormal ()
virtual void makeConvexNormal ()
virtual void smooth (float max_smoothing_angle)
 Default Element smooth - does not do anything. More...

void setNormal (const Vector &normal)
 Set element normal. More...

void setNormal (const float x, const float y, const float z)
const Vector & getNormal () const
 Set element normal. More...

virtual double getMaxVector () const
void clearTraversal ()
 Default Element add to collision model - does not do anything. More...

virtual void transformVertices (const Matrix &m, const Matrix &normal_matrix, const bool reverse)
 Transform all element vertices. More...


Public Attributes

list< Vertex * > vertices

Static Public Attributes

const unsigned long EL_HAS_ELEMENT_NORMAL = (1L<< 0L)
const unsigned long EL_USE_ELEMENT_NORMAL = (1L<< 1L)
const unsigned long EL_USE_VERTEX_NORMALS = (1L<< 2L)
const unsigned long VX_HAS_PARENT = (1L<< 3L)
const unsigned long VX_HAS_VERTEX = (1L<< 4L)
const unsigned long VX_HAS_NORMAL = (1L<< 5L)
const unsigned long VX_HAS_COLOR = (1L<< 6L)
const unsigned long VX_HAS_TEXTURE = (1L<< 7L)
const unsigned long VX_USE_THIS_VERTEX = (1L<< 8L)
const unsigned long VX_USE_THIS_NORMAL = (1L<< 9L)
const unsigned long VX_USE_THIS_COLOR = (1L<<10L)
const unsigned long VX_USE_THIS_TEXTURE = (1L<<11L)
const unsigned long VX_USE_PARENT_VERTEX = (1L<<12L)
const unsigned long VX_USE_PARENT_NORMAL = (1L<<13L)
const unsigned long VX_USE_PARENT_COLOR = (1L<<14L)
const unsigned long VX_USE_PARENT_TEXTURE = (1L<<15L)
const unsigned long VX_TRAVERSAL_VISITED = (1L<<16L)
const unsigned long VX_USE_PARENT_ALL

Protected Attributes

Vector normal

Detailed Description

A simple renderable part of Geometry.

Definition at line 61 of file Element.h.


Constructor & Destructor Documentation

Teddy::Models::Element::Element unsigned long    options = 0
 

Definition at line 70 of file Element.cpp.

Teddy::Models::Element::~Element   [virtual]
 

Element destructor.

Definition at line 79 of file Element.cpp.


Member Function Documentation

void Teddy::Models::Element::add Vertex   v [virtual]
 

Insert a vertex to the face, pointer version.

Reimplemented in Teddy::Models::Face.

Definition at line 89 of file Element.cpp.

References vertices.

void Teddy::Models::Element::add const float    x,
const float    y,
const float    z
[virtual]
 

Insert a vertex to the face, component version.

Reimplemented in Teddy::Models::Face.

Definition at line 96 of file Element.cpp.

References vertices.

Referenced by Teddy::Models::Vertex::addNormal.

void Teddy::Models::Element::append Vertex   v [virtual]
 

Insert a vertex to the face - pointer version, reverse order.

Reimplemented in Teddy::Models::Face.

Definition at line 104 of file Element.cpp.

References vertices.

void Teddy::Models::Element::append const float    x,
const float    y,
const float    z
[virtual]
 

Insert a vertex to the face - pointer version, reverse order.

Reimplemented in Teddy::Models::Face.

Definition at line 111 of file Element.cpp.

References vertices.

void Teddy::Models::Element::clearTraversal  
 

Default Element add to collision model - does not do anything.

Definition at line 245 of file Element.cpp.

References vertices, and VX_TRAVERSAL_VISITED.

bool Teddy::Models::Element::contains const Vertex   v const [virtual]
 

Return true if element contains spesified vertex.

Definition at line 136 of file Element.cpp.

References vertices.

void Teddy::Models::Element::debug   [virtual]
 

Debugging information.

Reimplemented in Teddy::Models::Vertex.

Definition at line 84 of file Element.cpp.

virtual void Teddy::Models::Element::draw Projection *    p [pure virtual]
 

Implemented in Teddy::Models::Face.

double Teddy::Models::Element::getMaxVector   const [virtual]
 

Reimplemented in Teddy::Models::Vertex.

Definition at line 255 of file Element.cpp.

References vertices.

const Vector & Teddy::Models::Element::getNormal   const
 

Set element normal.

Definition at line 130 of file Element.cpp.

References normal, and Vector.

Referenced by Teddy::Models::Face::smooth.

void Teddy::Models::Element::makeConvexNormal   [virtual]
 

Definition at line 218 of file Element.cpp.

References makeNormal, normal, reverse, Vector, and vertices.

void Teddy::Models::Element::makeNormal   [virtual]
 

Calculate a normal for Element. This requires at least three vertices, and the vertices must not be on a single line.

Reimplemented in Teddy::Models::QuadStrip.

Definition at line 160 of file Element.cpp.

References Teddy::SysSupport::dmsg, EL_HAS_ELEMENT_NORMAL, EL_USE_ELEMENT_NORMAL, Teddy::MixIn::Options::enable, Teddy::SysSupport::M_WARN, normal, Vector, and vertices.

Referenced by makeConvexNormal, and Teddy::Models::Face::smooth.

void Teddy::Models::Element::reverse   [virtual]
 

Reverse order of vertices in Face. Remember to update normal as well if needed - that is not done by this.

Reimplemented in Teddy::Models::QuadStrip.

Definition at line 150 of file Element.cpp.

References vertices.

Referenced by makeConvexNormal, and transformVertices.

void Teddy::Models::Element::setNormal const float    x,
const float    y,
const float    z
 

Reimplemented in Teddy::Models::Vertex.

Definition at line 123 of file Element.cpp.

References EL_HAS_ELEMENT_NORMAL, Teddy::MixIn::Options::enable, normal, and Vector.

void Teddy::Models::Element::setNormal const Vector &    normal
 

Set element normal.

Reimplemented in Teddy::Models::Vertex.

Definition at line 119 of file Element.cpp.

References EL_HAS_ELEMENT_NORMAL, Teddy::MixIn::Options::enable, normal, and Vector.

void Teddy::Models::Element::smooth float    max_smoothing_angle [virtual]
 

Default Element smooth - does not do anything.

Reimplemented in Teddy::Models::Face.

Definition at line 233 of file Element.cpp.

void Teddy::Models::Element::transformVertices const Matrix &    m,
const Matrix &    normal_matrix,
const bool    rev
[virtual]
 

Transform all element vertices.

Definition at line 273 of file Element.cpp.

References EL_HAS_ELEMENT_NORMAL, Teddy::MixIn::Options::isEnabled, normal, reverse, vertices, and VX_TRAVERSAL_VISITED.


Member Data Documentation

const unsigned long Teddy::Models::Element::EL_HAS_ELEMENT_NORMAL = (1L<< 0L) [static]
 

Definition at line 40 of file Element.cpp.

Referenced by Teddy::Models::TriangleStrip::draw, Teddy::Models::TriangleFan::draw, Teddy::Models::QuadStrip::draw, Teddy::Models::Face::draw, Teddy::Models::TriangleStrip::makeNormal, Teddy::Models::TriangleFan::makeNormal, Teddy::Models::QuadStrip::makeNormal, makeNormal, setNormal, Teddy::Models::Face::smooth, and transformVertices.

const unsigned long Teddy::Models::Element::EL_USE_ELEMENT_NORMAL = (1L<< 1L) [static]
 

Definition at line 41 of file Element.cpp.

Referenced by Teddy::Models::TriangleStrip::draw, Teddy::Models::TriangleFan::draw, Teddy::Models::QuadStrip::draw, Teddy::Models::Face::draw, Teddy::Models::TriangleStrip::makeNormal, Teddy::Models::TriangleFan::makeNormal, Teddy::Models::QuadStrip::makeNormal, makeNormal, and Teddy::Models::Face::smooth.

const unsigned long Teddy::Models::Element::EL_USE_VERTEX_NORMALS = (1L<< 2L) [static]
 

Definition at line 42 of file Element.cpp.

Referenced by Teddy::Models::Face::smooth.

Vector Teddy::Models::Element::normal [protected]
 

Reimplemented in Teddy::Models::Vertex.

Definition at line 133 of file Element.h.

Referenced by Teddy::Models::TriangleStrip::draw, Teddy::Models::TriangleFan::draw, Teddy::Models::QuadStrip::draw, Teddy::Models::Face::draw, getNormal, makeConvexNormal, Teddy::Models::TriangleStrip::makeNormal, Teddy::Models::TriangleFan::makeNormal, Teddy::Models::QuadStrip::makeNormal, makeNormal, setNormal, Teddy::Models::Face::smooth, and transformVertices.

list<Vertex*> Teddy::Models::Element::vertices
 

Definition at line 132 of file Element.h.

Referenced by Teddy::Models::Face::add, add, Teddy::Models::Face::append, append, clearTraversal, contains, Teddy::Models::TriangleStrip::countCSGFaceElements, Teddy::Models::Triangles::countCSGFaceElements, Teddy::Models::TriangleFan::countCSGFaceElements, Teddy::Models::QuadStrip::countCSGFaceElements, Teddy::Models::Quads::countCSGFaceElements, Teddy::Models::TriangleStrip::draw, Teddy::Models::Triangles::draw, Teddy::Models::TriangleFan::draw, Teddy::Models::QuadStrip::draw, Teddy::Models::Quads::draw, Teddy::Models::Face::draw, getMaxVector, makeConvexNormal, Teddy::Models::TriangleStrip::makeNormal, Teddy::Models::TriangleFan::makeNormal, Teddy::Models::QuadStrip::makeNormal, makeNormal, Teddy::Models::QuadStrip::reverse, reverse, Teddy::Models::Face::smooth, and transformVertices.

const unsigned long Teddy::Models::Element::VX_HAS_COLOR = (1L<< 6L) [static]
 

Definition at line 47 of file Element.cpp.

Referenced by Teddy::Models::Vertex::applyColor, Teddy::Models::Vertex::debug, Teddy::Models::Vertex::getColor, and Teddy::Models::Vertex::setColor.

const unsigned long Teddy::Models::Element::VX_HAS_NORMAL = (1L<< 5L) [static]
 

Definition at line 46 of file Element.cpp.

Referenced by Teddy::Models::Vertex::applyNormal, Teddy::Models::Vertex::debug, Teddy::Models::Vertex::getNormal, Teddy::Models::Vertex::normNormal, Teddy::Models::Vertex::setNormal, and Teddy::Models::Face::smooth.

const unsigned long Teddy::Models::Element::VX_HAS_PARENT = (1L<< 3L) [static]
 

Definition at line 44 of file Element.cpp.

Referenced by Teddy::Models::Vertex::applyColor, Teddy::Models::Vertex::applyNormal, Teddy::Models::Vertex::applyTexture, Teddy::Models::Vertex::applyVertex, Teddy::Models::Vertex::debug, Teddy::Models::Vertex::getColor, Teddy::Models::Vertex::getNormal, Teddy::Models::Vertex::getTexture, and Teddy::Models::Vertex::getVertex.

const unsigned long Teddy::Models::Element::VX_HAS_TEXTURE = (1L<< 7L) [static]
 

Definition at line 48 of file Element.cpp.

Referenced by Teddy::Models::Vertex::applyTexture, Teddy::Models::Vertex::debug, Teddy::Models::Vertex::getTexture, and Teddy::Models::Vertex::setTexture.

const unsigned long Teddy::Models::Element::VX_HAS_VERTEX = (1L<< 4L) [static]
 

Definition at line 45 of file Element.cpp.

Referenced by Teddy::Models::Vertex::applyVertex, Teddy::Models::Vertex::debug, Teddy::Models::Vertex::getVertex, and Teddy::Models::Vertex::setVertex.

const unsigned long Teddy::Models::Element::VX_TRAVERSAL_VISITED = (1L<<16L) [static]
 

Definition at line 60 of file Element.cpp.

Referenced by clearTraversal, and transformVertices.

const unsigned long Teddy::Models::Element::VX_USE_PARENT_ALL [static]
 

Initial value:

 
    Element::VX_USE_PARENT_VERTEX  | 
    Element::VX_USE_PARENT_NORMAL  | 
    Element::VX_USE_PARENT_COLOR   |
    Element::VX_USE_PARENT_TEXTURE

Definition at line 62 of file Element.cpp.

const unsigned long Teddy::Models::Element::VX_USE_PARENT_COLOR = (1L<<14L) [static]
 

Definition at line 57 of file Element.cpp.

Referenced by Teddy::Models::Vertex::applyColor, Teddy::Models::Vertex::debug, Teddy::Models::Vertex::getColor, and Teddy::Models::Vertex::setColor.

const unsigned long Teddy::Models::Element::VX_USE_PARENT_NORMAL = (1L<<13L) [static]
 

Definition at line 56 of file Element.cpp.

Referenced by Teddy::Models::Vertex::applyNormal, Teddy::Models::Vertex::debug, Teddy::Models::Vertex::getNormal, Teddy::Models::Vertex::normNormal, and Teddy::Models::Vertex::setNormal.

const unsigned long Teddy::Models::Element::VX_USE_PARENT_TEXTURE = (1L<<15L) [static]
 

Definition at line 58 of file Element.cpp.

Referenced by Teddy::Models::Vertex::applyTexture, Teddy::Models::Vertex::debug, Teddy::Models::Vertex::getTexture, and Teddy::Models::Vertex::setTexture.

const unsigned long Teddy::Models::Element::VX_USE_PARENT_VERTEX = (1L<<12L) [static]
 

Definition at line 55 of file Element.cpp.

Referenced by Teddy::Models::Vertex::applyVertex, Teddy::Models::Vertex::debug, Teddy::Models::Vertex::getVertex, and Teddy::Models::Vertex::setVertex.

const unsigned long Teddy::Models::Element::VX_USE_THIS_COLOR = (1L<<10L) [static]
 

Definition at line 52 of file Element.cpp.

Referenced by Teddy::Models::Vertex::applyColor, Teddy::Models::Vertex::debug, Teddy::Models::Vertex::getColor, and Teddy::Models::Vertex::setColor.

const unsigned long Teddy::Models::Element::VX_USE_THIS_NORMAL = (1L<< 9L) [static]
 

Definition at line 51 of file Element.cpp.

Referenced by Teddy::Models::Vertex::applyNormal, Teddy::Models::Vertex::debug, Teddy::Models::Vertex::getNormal, Teddy::Models::Vertex::normNormal, and Teddy::Models::Vertex::setNormal.

const unsigned long Teddy::Models::Element::VX_USE_THIS_TEXTURE = (1L<<11L) [static]
 

Definition at line 53 of file Element.cpp.

Referenced by Teddy::Models::Vertex::applyTexture, Teddy::Models::Vertex::debug, Teddy::Models::Vertex::getTexture, and Teddy::Models::Vertex::setTexture.

const unsigned long Teddy::Models::Element::VX_USE_THIS_VERTEX = (1L<< 8L) [static]
 

Definition at line 50 of file Element.cpp.

Referenced by Teddy::Models::Vertex::applyVertex, Teddy::Models::Vertex::debug, Teddy::Models::Vertex::getVertex, and Teddy::Models::Vertex::setVertex.


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