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

Teddy::Models::Vertex Class Reference

Defines one point of polygon or line or other element. More...

#include <Vertex.h>

Inheritance diagram for Teddy::Models::Vertex:

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

Collaboration graph
[legend]
List of all members.

Public Methods

 Vertex ()
 Default constructor. More...

 Vertex (Vertex *v)
 Vertex (Vertex &v)
 Vertex (const Vertex &v)
 Vertex (const Vector &v)
 Vertex - Vector Copy-constructor. More...

 Vertex (const float x, const float y, const float z)
 Vertex Component constructor. More...

virtual ~Vertex ()
virtual double getMaxVector () const
virtual void debug ()
 Debugging information. More...

virtual void draw (Projection *p)
virtual void applyColor (Projection *p)
virtual void applyNormal (Projection *p)
virtual void applyTexture (Projection *p)
virtual void applyVertex (Projection *p)
void neg ()
 Flip the vertex. Notice that normal is not changed by this routine. More...

void transform (const Matrix &m, const Matrix &normal_matrix)
 Transform the vertex. More...

void setParent (const Vertex &vert)
void setVertex (const Vector &vert)
 Set vertex coordinate to this vertex. More...

void setVertex (const float x, const float y, const float z)
void setColor (const Color &color)
 Set color to this vertex. More...

void setNormal (const Vector &normal)
 Set normal to this vertex. More...

void setNormal (const float x, const float y, const float z)
void setTexture (const Vector &texture)
 Set vertex texture coordinate. More...

void setTexture (const float s, const float t, const float u=0.0f)
void addNormal (const Vector &add)
 Add normal to this vertex. More...

void normNormal ()
 Normalize normal. More...

void removeNormal ()
Vertex * getRoot ()
 Return the effective ancestor of this vertex. Recursively seeks for parent. More...

Vertex * getParent ()
 Return the effective parent of this vertex. More...

Vector & getVertex ()
 Return the effective vertex position of this vertex. More...

Color & getColor ()
 Return the effective vertex color. More...

Vector & getNormal ()
 Return the effective vertex normal coordinate. More...

Vector & getTexture ()
 Return vertex texture coordinate. More...

list< Face * > & getFaces ()
 Return the share list of this vertex. More...

void addFace (Face *face)
 Sharing lists are only stored in the root. More...

Vertex & operator+= (Vertex &v)
Vertex & operator-= (Vertex &v)
Vertex & operator *= (float k)
Vertex & operator/= (float k)
Vertex & operator+= (const Vertex &v)
Vertex & operator-= (const Vertex &v)
Vertex operator+ (Vertex &v)
Vertex operator- (Vertex &v)
Vertex operator * (float k)
Vertex operator/ (float k)
Vertex operator+ (const Vertex &v)
Vertex operator- (const Vertex &v)
void flipX ()
void flipY ()
void flipZ ()
void normalize ()
float magnitude ()

Public Attributes

list< Face * > faces
 Cross-reference. More...


Protected Attributes

Vertex * parent
 Original shared vertex. More...

Vector vert
 The actual vertex coordinates. More...

Vector normal
 Normal coordinates. More...

Color color
 Color. More...

Vector texturecoord
 Texture coordinates. More...


Detailed Description

Defines one point of polygon or line or other element.

Vertex is the most basic primitive for building object models. This class attempts to provide flexible vertex by coupling possible vertex features into a single class. Additionally vertices can be arranged into hieararchy so that one vertex can inherit some (or all) features from its parent. By using feature inheritance it is possible eg. share the vertex coordinate but specify different normal, or different texture coordinate.

Definition at line 64 of file Vertex.h.


Constructor & Destructor Documentation

Teddy::Models::Vertex::Vertex  
 

Default constructor.

Definition at line 37 of file Vertex.cpp.

Referenced by getRoot, operator *, operator *=, operator+, operator+=, operator-, operator-=, operator/, and operator/=.

Teddy::Models::Vertex::Vertex Vertex *    v
 

Vertex - Vertex Inheritance constructor Notice that Face cross-reference -list is not copied Notice how Parent is set

Definition at line 54 of file Vertex.cpp.

Teddy::Models::Vertex::Vertex Vertex &    v
 

Vertex - Vertex copy constructor Notice that Face cross-reference -list is not copied Notice how Parent is set Notice that accessor methods are not used for some members

Definition at line 72 of file Vertex.cpp.

Teddy::Models::Vertex::Vertex const Vertex &    v
 

Teddy::Models::Vertex::Vertex const Vector &    v
 

Vertex - Vector Copy-constructor.

Definition at line 85 of file Vertex.cpp.

References Vector.

Teddy::Models::Vertex::Vertex const float    x,
const float    y,
const float    z
 

Vertex Component constructor.

Definition at line 98 of file Vertex.cpp.

Teddy::Models::Vertex::~Vertex   [virtual]
 

Definition at line 110 of file Vertex.cpp.


Member Function Documentation

void Teddy::Models::Vertex::addFace Face   face
 

Sharing lists are only stored in the root.

Definition at line 203 of file Vertex.cpp.

References getRoot.

void Teddy::Models::Vertex::addNormal const Vector &    add
 

Add normal to this vertex.

Definition at line 165 of file Vertex.cpp.

References Teddy::Models::Element::add, normal, and Vector.

void Teddy::Models::Vertex::applyColor Projection *    p [virtual]
 

Definition at line 299 of file Vertex.cpp.

References color, Teddy::MixIn::Options::isEnabled, parent, Teddy::Models::Element::VX_HAS_COLOR, Teddy::Models::Element::VX_HAS_PARENT, Teddy::Models::Element::VX_USE_PARENT_COLOR, and Teddy::Models::Element::VX_USE_THIS_COLOR.

Referenced by draw.

void Teddy::Models::Vertex::applyNormal Projection *    p [virtual]
 

Definition at line 311 of file Vertex.cpp.

References debug, Teddy::SysSupport::dmsg, Teddy::MixIn::Options::isEnabled, Teddy::SysSupport::M_VERT, normal, parent, Teddy::Models::Element::VX_HAS_NORMAL, Teddy::Models::Element::VX_HAS_PARENT, Teddy::Models::Element::VX_USE_PARENT_NORMAL, and Teddy::Models::Element::VX_USE_THIS_NORMAL.

Referenced by draw.

void Teddy::Models::Vertex::applyTexture Projection *    p [virtual]
 

Definition at line 324 of file Vertex.cpp.

References Teddy::MixIn::Options::isEnabled, parent, texturecoord, Teddy::Models::Element::VX_HAS_PARENT, Teddy::Models::Element::VX_HAS_TEXTURE, Teddy::Models::Element::VX_USE_PARENT_TEXTURE, and Teddy::Models::Element::VX_USE_THIS_TEXTURE.

Referenced by draw.

void Teddy::Models::Vertex::applyVertex Projection *    p [virtual]
 

Definition at line 336 of file Vertex.cpp.

References Teddy::MixIn::Options::isEnabled, parent, vert, Teddy::Models::Element::VX_HAS_PARENT, Teddy::Models::Element::VX_HAS_VERTEX, Teddy::Models::Element::VX_USE_PARENT_VERTEX, and Teddy::Models::Element::VX_USE_THIS_VERTEX.

Referenced by draw.

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

Debugging information.

Reimplemented from Teddy::Models::Element.

Definition at line 349 of file Vertex.cpp.

References Teddy::SysSupport::dmsg, Teddy::MixIn::Options::isEnabled, Teddy::SysSupport::M_VERT, Teddy::Models::Element::VX_HAS_COLOR, Teddy::Models::Element::VX_HAS_NORMAL, Teddy::Models::Element::VX_HAS_PARENT, Teddy::Models::Element::VX_HAS_TEXTURE, Teddy::Models::Element::VX_HAS_VERTEX, Teddy::Models::Element::VX_USE_PARENT_COLOR, Teddy::Models::Element::VX_USE_PARENT_NORMAL, Teddy::Models::Element::VX_USE_PARENT_TEXTURE, Teddy::Models::Element::VX_USE_PARENT_VERTEX, Teddy::Models::Element::VX_USE_THIS_COLOR, Teddy::Models::Element::VX_USE_THIS_NORMAL, Teddy::Models::Element::VX_USE_THIS_TEXTURE, and Teddy::Models::Element::VX_USE_THIS_VERTEX.

Referenced by applyNormal.

void Teddy::Models::Vertex::draw Projection *    p [virtual]
 

Draw.

Since any feature may or may not be inherited from parent, all settings are handled in sub-methods.

Does NOT include begin(), so Vertex can be used with any OpenGL primitives, but needs begin() outside.

Implements Teddy::Models::Element.

Definition at line 291 of file Vertex.cpp.

References applyColor, applyNormal, applyTexture, and applyVertex.

void Teddy::Models::Vertex::flipX   [inline]
 

Definition at line 128 of file Vertex.h.

References getVertex.

void Teddy::Models::Vertex::flipY   [inline]
 

Definition at line 129 of file Vertex.h.

References getVertex.

void Teddy::Models::Vertex::flipZ   [inline]
 

Definition at line 130 of file Vertex.h.

References getVertex.

Color & Teddy::Models::Vertex::getColor  
 

Return the effective vertex color.

Definition at line 244 of file Vertex.cpp.

References color, Teddy::SysSupport::emsg, Teddy::MixIn::Options::isEnabled, Teddy::SysSupport::M_VERT, parent, Teddy::Models::Element::VX_HAS_COLOR, Teddy::Models::Element::VX_HAS_PARENT, Teddy::Models::Element::VX_USE_PARENT_COLOR, and Teddy::Models::Element::VX_USE_THIS_COLOR.

list< Face * > & Teddy::Models::Vertex::getFaces  
 

Return the share list of this vertex.

Definition at line 209 of file Vertex.cpp.

References getRoot.

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

Reimplemented from Teddy::Models::Element.

Definition at line 368 of file Vertex.cpp.

References vert.

Vector & Teddy::Models::Vertex::getNormal  
 

Return the effective vertex normal coordinate.

Definition at line 257 of file Vertex.cpp.

References Teddy::SysSupport::emsg, Teddy::MixIn::Options::isEnabled, Teddy::SysSupport::M_VERT, normal, parent, Vector, Teddy::Models::Element::VX_HAS_NORMAL, Teddy::Models::Element::VX_HAS_PARENT, Teddy::Models::Element::VX_USE_PARENT_NORMAL, and Teddy::Models::Element::VX_USE_THIS_NORMAL.

Vertex * Teddy::Models::Vertex::getParent  
 

Return the effective parent of this vertex.

Definition at line 226 of file Vertex.cpp.

References parent.

Referenced by getRoot.

Vertex * Teddy::Models::Vertex::getRoot  
 

Return the effective ancestor of this vertex. Recursively seeks for parent.

Definition at line 215 of file Vertex.cpp.

References getParent, and Vertex.

Referenced by addFace, and getFaces.

Vector & Teddy::Models::Vertex::getTexture  
 

Return vertex texture coordinate.

Definition at line 270 of file Vertex.cpp.

References Teddy::SysSupport::emsg, Teddy::MixIn::Options::isEnabled, Teddy::SysSupport::M_VERT, parent, texturecoord, Vector, Teddy::Models::Element::VX_HAS_PARENT, Teddy::Models::Element::VX_HAS_TEXTURE, Teddy::Models::Element::VX_USE_PARENT_TEXTURE, and Teddy::Models::Element::VX_USE_THIS_TEXTURE.

Vector & Teddy::Models::Vertex::getVertex  
 

Return the effective vertex position of this vertex.

Definition at line 232 of file Vertex.cpp.

References Teddy::SysSupport::dmsg, Teddy::MixIn::Options::isEnabled, Teddy::SysSupport::M_VERT, parent, Vector, vert, Teddy::Models::Element::VX_HAS_PARENT, Teddy::Models::Element::VX_HAS_VERTEX, Teddy::Models::Element::VX_USE_PARENT_VERTEX, and Teddy::Models::Element::VX_USE_THIS_VERTEX.

Referenced by flipX, flipY, flipZ, magnitude, and normalize.

float Teddy::Models::Vertex::magnitude   [inline]
 

Definition at line 134 of file Vertex.h.

References getVertex.

void Teddy::Models::Vertex::neg  
 

Flip the vertex. Notice that normal is not changed by this routine.

Definition at line 115 of file Vertex.cpp.

References vert.

void Teddy::Models::Vertex::normalize   [inline]
 

Definition at line 133 of file Vertex.h.

References getVertex.

void Teddy::Models::Vertex::normNormal  
 

Normalize normal.

Definition at line 171 of file Vertex.cpp.

References Teddy::MixIn::Options::disable, Teddy::SysSupport::emsg, Teddy::MixIn::Options::enable, Teddy::MixIn::Options::isDisabled, Teddy::SysSupport::M_VERT, normal, Teddy::Models::Element::VX_HAS_NORMAL, Teddy::Models::Element::VX_USE_PARENT_NORMAL, and Teddy::Models::Element::VX_USE_THIS_NORMAL.

Vertex Teddy::Models::Vertex::operator * float    k [inline]
 

Definition at line 119 of file Vertex.h.

References vert, and Vertex.

Vertex& Teddy::Models::Vertex::operator *= float    k [inline]
 

Definition at line 109 of file Vertex.h.

References vert, and Vertex.

Vertex Teddy::Models::Vertex::operator+ const Vertex &    v [inline]
 

Definition at line 122 of file Vertex.h.

References vert, and Vertex.

Vertex Teddy::Models::Vertex::operator+ Vertex &    v [inline]
 

Definition at line 117 of file Vertex.h.

References vert, and Vertex.

Vertex& Teddy::Models::Vertex::operator+= const Vertex &    v [inline]
 

Definition at line 112 of file Vertex.h.

References vert, and Vertex.

Vertex& Teddy::Models::Vertex::operator+= Vertex &    v [inline]
 

Definition at line 107 of file Vertex.h.

References vert, and Vertex.

Vertex Teddy::Models::Vertex::operator- const Vertex &    v [inline]
 

Definition at line 123 of file Vertex.h.

References vert, and Vertex.

Vertex Teddy::Models::Vertex::operator- Vertex &    v [inline]
 

Definition at line 118 of file Vertex.h.

References vert, and Vertex.

Vertex& Teddy::Models::Vertex::operator-= const Vertex &    v [inline]
 

Definition at line 113 of file Vertex.h.

References vert, and Vertex.

Vertex& Teddy::Models::Vertex::operator-= Vertex &    v [inline]
 

Definition at line 108 of file Vertex.h.

References vert, and Vertex.

Vertex Teddy::Models::Vertex::operator/ float    k [inline]
 

Definition at line 120 of file Vertex.h.

References vert, and Vertex.

Vertex& Teddy::Models::Vertex::operator/= float    k [inline]
 

Definition at line 110 of file Vertex.h.

References vert, and Vertex.

void Teddy::Models::Vertex::removeNormal  
 

void Teddy::Models::Vertex::setColor const Color &    color
 

Set color to this vertex.

Definition at line 131 of file Vertex.cpp.

References color, Teddy::MixIn::Options::disable, Teddy::MixIn::Options::enable, Teddy::Models::Element::VX_HAS_COLOR, Teddy::Models::Element::VX_USE_PARENT_COLOR, and Teddy::Models::Element::VX_USE_THIS_COLOR.

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

Reimplemented from Teddy::Models::Element.

Definition at line 144 of file Vertex.cpp.

References Teddy::MixIn::Options::disable, Teddy::MixIn::Options::enable, normal, Vector, Teddy::Models::Element::VX_HAS_NORMAL, Teddy::Models::Element::VX_USE_PARENT_NORMAL, and Teddy::Models::Element::VX_USE_THIS_NORMAL.

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

Set normal to this vertex.

Reimplemented from Teddy::Models::Element.

Definition at line 139 of file Vertex.cpp.

References Teddy::MixIn::Options::disable, Teddy::MixIn::Options::enable, normal, Vector, Teddy::Models::Element::VX_HAS_NORMAL, Teddy::Models::Element::VX_USE_PARENT_NORMAL, and Teddy::Models::Element::VX_USE_THIS_NORMAL.

void Teddy::Models::Vertex::setParent const Vertex &    vert
 

void Teddy::Models::Vertex::setTexture const float    s,
const float    t,
const float    u = 0.0f
 

Definition at line 195 of file Vertex.cpp.

References Teddy::MixIn::Options::disable, Teddy::MixIn::Options::enable, texturecoord, Vector, Teddy::Models::Element::VX_HAS_TEXTURE, Teddy::Models::Element::VX_USE_PARENT_TEXTURE, and Teddy::Models::Element::VX_USE_THIS_TEXTURE.

void Teddy::Models::Vertex::setTexture const Vector &    texture
 

Set vertex texture coordinate.

Definition at line 190 of file Vertex.cpp.

References Teddy::MixIn::Options::disable, Teddy::MixIn::Options::enable, texturecoord, Vector, Teddy::Models::Element::VX_HAS_TEXTURE, Teddy::Models::Element::VX_USE_PARENT_TEXTURE, and Teddy::Models::Element::VX_USE_THIS_TEXTURE.

void Teddy::Models::Vertex::setVertex const float    x,
const float    y,
const float    z
 

Definition at line 157 of file Vertex.cpp.

References Teddy::MixIn::Options::disable, Teddy::MixIn::Options::enable, Vector, vert, Teddy::Models::Element::VX_HAS_VERTEX, Teddy::Models::Element::VX_USE_PARENT_VERTEX, and Teddy::Models::Element::VX_USE_THIS_VERTEX.

void Teddy::Models::Vertex::setVertex const Vector &    vert
 

Set vertex coordinate to this vertex.

Definition at line 152 of file Vertex.cpp.

References Teddy::MixIn::Options::disable, Teddy::MixIn::Options::enable, Vector, vert, Teddy::Models::Element::VX_HAS_VERTEX, Teddy::Models::Element::VX_USE_PARENT_VERTEX, and Teddy::Models::Element::VX_USE_THIS_VERTEX.

void Teddy::Models::Vertex::transform const Matrix &    m,
const Matrix &    normal_matrix
 

Transform the vertex.

Definition at line 123 of file Vertex.cpp.

References normal, and vert.


Member Data Documentation

Color Teddy::Models::Vertex::color [protected]
 

Color.

Definition at line 143 of file Vertex.h.

Referenced by applyColor, getColor, and setColor.

list<Face*> Teddy::Models::Vertex::faces
 

Cross-reference.

Definition at line 137 of file Vertex.h.

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

Normal coordinates.

Reimplemented from Teddy::Models::Element.

Definition at line 142 of file Vertex.h.

Referenced by addNormal, applyNormal, getNormal, normNormal, setNormal, and transform.

Vertex* Teddy::Models::Vertex::parent [protected]
 

Original shared vertex.

Definition at line 140 of file Vertex.h.

Referenced by applyColor, applyNormal, applyTexture, applyVertex, getColor, getNormal, getParent, getTexture, and getVertex.

Vector Teddy::Models::Vertex::texturecoord [protected]
 

Texture coordinates.

Definition at line 144 of file Vertex.h.

Referenced by applyTexture, getTexture, and setTexture.

Vector Teddy::Models::Vertex::vert [protected]
 

The actual vertex coordinates.

Definition at line 141 of file Vertex.h.

Referenced by applyVertex, getMaxVector, getVertex, neg, operator *, operator *=, operator+, operator+=, operator-, operator-=, operator/, operator/=, setVertex, and transform.


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