- Main Page
- Classes
- Files
- Directories

- Class List
- Class Hierarchy
- Class Members

# cVertex Struct Reference

cVertex defines a point in 3 dimensional space and the associated rendering properties (position, color, texture coordinate, and surface normal) More...

`#include <CVertex.h>`

List of all members.

## Public Member Functions
| cVertex (const double a_x=0.0, const double a_y=0.0, const double a_z=0.0)
| ~cVertex ()
void | setPos (const double &a_x, const double &a_y, const double &a_z)
void | setPos (const cVector3d &a_pos)
void | translate (const cVector3d &a_translation)
cVector3d | getPos () const
cVector3d | getGlobalPos () const
void | setNormal (const cVector3d &a_normal)
void | setNormal (const double &a_x, const double &a_y, const double &a_z)
cVector3d | getNormal () const
void | setTexCoord (const cVector3d &a_texCoord)
| Set texture coordinate.
void | setTexCoord (const double &a_tx, const double &a_ty)
cVector3d | getTexCoord () const
void | setColor (const cColorb &a_color)
void | setColor (const float &a_red, const float &a_green, const float &a_blue, const float a_alpha=1.0)
void | computeGlobalPosition (const cVector3d &a_globalPos, const cMatrix3d &a_globalRot)
## Public Attributes
cVector3d | m_localPos
| Local position of this vertex.
cVector3d | m_globalPos
| Global position of this vertex in world coordinates.
cVector3d | m_normal
| Surface normal.
cVector3d | m_texCoord
| Texture coordinate (uvw).
cColorb | m_color
| Color.
int | m_index
| My index in the vertex list of the mesh that owns me.
bool | m_allocated
| Is this vertex allocated?
int | m_nTriangles
| How many triangles use this vertex?
int | m_tag
| User data.

## Detailed Description

cVertex defines a point in 3 dimensional space and the associated rendering properties (position, color, texture coordinate, and surface normal)

## Constructor & Destructor Documentation

cVertex::cVertex | ( | const double | a_x = `0.0`,
|  | const double | a_y = `0.0`,
|  | const double | a_z = `0.0` |
| ) |  |  | `[inline]`

Constructor of cVertex.

Parameters:

  | a_x | X component.
  | a_y | Y component.
  | a_z | Z component.

cVertex::~cVertex | ( |  | ) | `[inline]`

Destructor of cVertex.

## Member Function Documentation

void cVertex::setPos | ( | const double & | a_x,
|  | const double & | a_y,
|  | const double & | a_z |
| ) |  |  | `[inline]`

Set the position coordinates of vertex.

Parameters:

  | a_x | X component.
  | a_y | Y component.
  | a_z | Z component.

void cVertex::setPos | ( | const cVector3d & | a_pos | ) | `[inline]`

Set local position of vertex

Parameters:

  | a_pos | Local position of vertex

void cVertex::translate | ( | const cVector3d & | a_translation | ) | `[inline]`

Translate vertex by defining a translation passed as parameter.

Parameters:

  | a_translation | Translation vector.

cVector3d cVertex::getPos | ( |  | ) | const`[inline]`

Read local position of vertex

Returns:
  Return position of vertex.

cVector3d cVertex::getGlobalPos | ( |  | ) | const`[inline]`

Read global position. This value is only correct if the computeGlobalPositions() method is called from the parent world.

Returns:
  Return global position of vertex in world coordinates.

void cVertex::setNormal | ( | const cVector3d & | a_normal | ) | `[inline]`

Set normal vector of vertex.

Parameters:

  | a_normal | Normal vector.

void cVertex::setNormal | ( | const double & | a_x,
|  | const double & | a_y,
|  | const double & | a_z |
| ) |  |  | `[inline]`

Set normal vector of vertex by passing its X,Y and Z components as parameters

Parameters:

  | a_x | X component.
  | a_y | Y component.
  | a_z | Z component.

cVector3d cVertex::getNormal | ( |  | ) | const`[inline]`

Set normal vector of vertex

Returns:
  Return normal vector.

void cVertex::setTexCoord | ( | const cVector3d & | a_texCoord | ) | `[inline]`

Set texture coordinate.

Set texture coordinate of vertex.

Parameters:

  | a_texCoord | Texture coordinate.

void cVertex::setTexCoord | ( | const double & | a_tx,
|  | const double & | a_ty |
| ) |  |  | `[inline]`

Set texture coordinate by passing its coordinates as parameters.

Parameters:

  | a_tx | X component.
  | a_ty | Y component.

cVector3d cVertex::getTexCoord | ( |  | ) | const`[inline]`

Read texture coordinate of vertex.

Returns:
  Return texture coordinate.

void cVertex::setColor | ( | const cColorb & | a_color | ) | `[inline]`

Set color of vertex.

Parameters:

  | a_color | Color.

void cVertex::setColor | ( | const float & | a_red,
|  | const float & | a_green,
|  | const float & | a_blue,
|  | const float | a_alpha = `1.0` |
| ) |  |  | `[inline]`

Set color of vertex.

Parameters:

  | a_red | Red component.
  | a_green | Green component.
  | a_blue | Blue component.
  | a_alpha | Alpha component.

void cVertex::computeGlobalPosition | ( | const cVector3d & | a_globalPos,
|  | const cMatrix3d & | a_globalRot |
| ) |  |  | `[inline]`

Compute the global position of vertex given the global position and global rotation matrix of the parent object.

Parameters:

  | a_globalPos | Global position vector of parent.
  | a_globalRot | Global rotation matrix of parent.

The documentation for this struct was generated from the following file:

- chai3d/src/graphics/CVertex.h