Frz::Object3d Class Reference
A 3D object.
More...
#include <frz_obj3d.hpp>
List of all members.
Classes |
| struct | Poly |
| | A 3D polygon. More...
|
| struct | Vertex |
| | A 3D vertex. More...
|
Public Member Functions |
|
| Object3d () |
| | Default constructor.
|
|
| Object3d (const Object3d &obj, float zoom=1.0f) |
| | Copy constructor with zoom.
|
| | Object3d (const std::string &filename, float zoom=100.0f, uint32_t color=0xffffff) |
| | Constructor which reads an object file in Object File Format.
|
|
virtual | ~Object3d () |
| | Destructor.
|
|
int | vertexCount () const |
| | Returns the number of vertices.
|
|
int | polyCount () const |
| | Returns the number of polygons.
|
|
const Vertex & | vert (int i) const |
| | Returns a reference to vertex number i.
|
|
const Poly & | poly (int i) const |
| | Returns a reference to polygon number i.
|
| int | addVertex (const Vertex &v) |
| | Adds a vertex.
|
| int | addVertex (float x, float y, float z) |
| | Adds a vertex.
|
| int | addPoly (int a, int b, int c, int d=-1, uint32_t color=0xffffff) |
| | Inserts a polygon.
|
| void | translate (float x, float y, float z) |
| | Translates the whole object.
|
| void | merge (const Object3d &obj) |
| | Merges another object.
|
| void | importBin (const std::string &filename, float zoom=1.0f) |
| | Imports an object from internal binary file format.
|
| void | importOff (const std::string &filename, float zoom=1.0f, uint32_t color=0xffffff) |
| | Imports an object from Object File Format (OFF).
|
| void | exportBin (const std::string &filename) |
| | Exports an object to internal binary file format.
|
| void | exportOff (const std::string &filename) |
| | Exports an object to Object File Format (OFF).
|
Protected Attributes |
|
std::vector< Vertex > | vertices |
| | The internal vertex list.
|
|
std::vector< Poly > | polys |
| | The internal polygon list.
|
Detailed Description
A 3D object.
This class modelizes a 3D object. An object is made of:
- a set of vertices;
- a set of polygons defined by:
- a list of 3 or 4 vertices encoding either a triangle or a quad;
- a color value.
Constructor & Destructor Documentation
| Frz::Object3d::Object3d |
( |
const std::string & |
filename, |
|
|
float |
zoom = 100.0f, |
|
|
uint32_t |
color = 0xffffff | |
|
) |
| | |
Constructor which reads an object file in Object File Format.
- Parameters:
-
| filename | the file name |
| zoom | zoom factor to apply to the object's vertices |
| color | a color value for the object (ARGB binary format) |
Member Function Documentation
| int Frz::Object3d::addPoly |
( |
int |
a, |
|
|
int |
b, |
|
|
int |
c, |
|
|
int |
d = -1, |
|
|
uint32_t |
color = 0xffffff | |
|
) |
| | |
Inserts a polygon.
- 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 |
- Returns:
- the inserted polygon number
| int Frz::Object3d::addVertex |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z | |
|
) |
| | |
Adds a vertex.
- Parameters:
-
| x | x-coordinate of the new vertex to be inserted |
| y | y-coordinate of the new vertex to be inserted |
| z | z-coordinate of the new vertex to be inserted |
- Returns:
- the inserted vertex number
| int Frz::Object3d::addVertex |
( |
const Vertex & |
v |
) |
|
Adds a vertex.
- Parameters:
-
| v | a reference of the vertex whose copy is to be inserted |
- Returns:
- the inserted vertex number
| void Frz::Object3d::exportBin |
( |
const std::string & |
filename |
) |
|
Exports an object to internal binary file format.
The internal binary file format is designed for speed and efficiency, and contains exactly the contents of an Object3d object.
- Parameters:
-
| void Frz::Object3d::exportOff |
( |
const std::string & |
filename |
) |
|
Exports an object to Object File Format (OFF).
OFF is a commonly used file format.
- Parameters:
-
| void Frz::Object3d::importBin |
( |
const std::string & |
filename, |
|
|
float |
zoom = 1.0f | |
|
) |
| | |
Imports an object from internal binary file format.
The internal binary file format is designed for speed and efficiency, and contains exactly the contents of an Object3d object.
- Parameters:
-
| filename | the file name |
| zoom | the zoom value |
| void Frz::Object3d::importOff |
( |
const std::string & |
filename, |
|
|
float |
zoom = 1.0f, |
|
|
uint32_t |
color = 0xffffff | |
|
) |
| | |
Imports an object from Object File Format (OFF).
OFF is a commonly used file format.
- Parameters:
-
| filename | the file name |
| zoom | the zoom value |
| color | Object color in ARGB binary format |
| void Frz::Object3d::merge |
( |
const Object3d & |
obj |
) |
|
Merges another object.
All of the objects's vertices and polygons are added into this object.
- Parameters:
-
| obj | a reference to the object to be merged |
| void Frz::Object3d::translate |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z | |
|
) |
| | |
Translates the whole object.
- Parameters:
-
| x | x-coordinate of the translation vector |
| y | y-coordinate of the translation vector |
| z | z-coordinate of the translation vector |
The documentation for this class was generated from the following file: