Frz::Object3d::Poly Struct Reference

A 3D polygon. More...

#include <frz_obj3d.hpp>

List of all members.

Public Member Functions

 Poly (int _a=-1, int _b=-1, int _c=-1, int _d=-1, int _color=0xffffff)
 Constructor.
bool operator== (const Poly &p)
 Compares two polygons.
void write (std::ostream &out)
 Writes a polygon into an output stream.
void read (std::istream &in)
 Reads a polygon from an input stream.

Public Attributes

union {
   struct {
      int   a
 First vertex index.
      int   b
 Second vertex index.
      int   c
 Third vertex index.
      int   d
 Fourth vertex index.
   } 
   int   v [4]
 An array containing the vertex indices.
}; 
uint32_t color
 The color for the polygon.
bool triangle
 An indicator containing true if the polygon is a triangle, and false if it is a quad.

Friends

std::ostream & operator<< (std::ostream &out, const Poly &q)
 Displays a polygon in human-readable fashion.

Detailed Description

A 3D polygon.

A Poly object either stores a triangle or a quad. The polygon is defined by a list of indices in an object's vertex list.


Constructor & Destructor Documentation

Frz::Object3d::Poly::Poly ( int  _a = -1,
int  _b = -1,
int  _c = -1,
int  _d = -1,
int  _color = 0xffffff 
)

Constructor.

Parameters:
_a First vertex index
_b Second vertex index
_c Third vertex index
_d Fourth vertex index (set to -1 if the poly is a triangle)
_color Polygon color in ARGB binary format

Member Function Documentation

bool Frz::Object3d::Poly::operator== ( const Poly p  )  [inline]

Compares two polygons.

All possible rotations are tested for equality comparison.

Returns:
true if the polygons are equal, false otherwise
void Frz::Object3d::Poly::read ( std::istream &  in  )  [inline]

Reads a polygon from an input stream.

Parameters:
in a reference to the input stream
void Frz::Object3d::Poly::write ( std::ostream &  out  )  [inline]

Writes a polygon into an output stream.

Parameters:
out a reference to the output stream

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const Poly q 
) [friend]

Displays a polygon in human-readable fashion.

Parameters:
out a reference to the output stream
q a reference to the polygon to be displayed
Returns:
a reference to the output stream

The documentation for this struct was generated from the following file:
 All Classes Functions Variables Friends
Generated on Thu Jun 10 17:37:47 2010 for freezer-0.1.0 by  doxygen 1.6.3