A 3D vertex. More...
#include <frz_vertex.hpp>

Public Member Functions | |
| vertex (float _x=0.f, float _y=0.f, float _z=0.f, float _t=1.0f) | |
| Default constructor. | |
| vertex (const vertex &v) | |
| Copy constructor. | |
| vertex (uint32_t _a, uint32_t _b, uint32_t _c, uint32_t _s) | |
| Integer constructor. | |
| vertex (vector float v) | |
| Altivec vector conversion constructor. | |
| void | set (vector float v) |
| Sets a vertex value from an Altivec vector. | |
| vertex | operator- (const vertex &a) const |
| vertex subtraction operator. | |
| vertex | operator+ (const vertex &a) const |
| vertex addition operator. | |
| vertex | operator* (const vertex &b) const |
| vertex cross product operator. | |
| vertex | operator* (float f) const |
| Scale all coefficients with a scalar value. | |
| void | normalize (void) |
| Normalizes the vertex. | |
| float | norm2 (void) |
| Computes the square norm of the vertex. | |
| float | norm (void) |
| Computes the norm of the vertex. | |
| void | update_norm (const vertex &a, const vertex &b, const vertex &c) |
Updates the normal vector in vertex b of triangle (a,b, c). | |
| vector float | v () const |
| Converts the vertex to an Altivec vector. | |
Public Attributes | |
| union { | |
| float x | |
| First vertex coordinate in floating point format. | |
| uint32_t a | |
| First vertex coordinate in 32-bit integer format. | |
| }; | |
| union { | |
| float y | |
| Second vertex coordinate in floating point format. | |
| uint32_t b | |
| Second vertex coordinate in 32-bit integer format. | |
| }; | |
| union { | |
| float z | |
| Third vertex coordinate in floating point format. | |
| uint32_t c | |
| Third vertex coordinate in 32-bit integer format. | |
| }; | |
| union { | |
| float t | |
| Fourth vertex coordinate in floating point format. | |
| uint32_t s | |
| Fourth vertex coordinate in 32-bit integer format. | |
| }; | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const vertex &v) |
| Outputs the vertex in human-readable fashion. | |
A 3D vertex.
This class generally is used for storing a set of 3D coordinates, but also may embed extra data. Its main purpose is to be packed into Scene::Triangle objects, for communication with the SPE's. In this case, a vertex will be loaded into a 16-byte vector on SPU side.
The fourth vertex element is generally ignored by the arithmetics and normalization methods. It is used for storage and 16-byte alignment only.
| Frz::vertex::vertex | ( | float | _x = 0.f, |
|
| float | _y = 0.f, |
|||
| float | _z = 0.f, |
|||
| float | _t = 1.0f | |||
| ) | [inline] |
Default constructor.
| _x | the first vertex coordinate | |
| _y | the second vertex coordinate | |
| _z | the third vertex coordinate | |
| _t | the fourth vertex coordinate |
| Frz::vertex::vertex | ( | const vertex & | v | ) | [inline] |
Copy constructor.
| v | the vertex to be copied |
| Frz::vertex::vertex | ( | uint32_t | _a, | |
| uint32_t | _b, | |||
| uint32_t | _c, | |||
| uint32_t | _s | |||
| ) | [inline] |
Integer constructor.
| _a | the first vertex coordinate | |
| _b | the second vertex coordinate | |
| _c | the third vertex coordinate | |
| _s | the fourth vertex coordinate |
| Frz::vertex::vertex | ( | vector float | v | ) | [inline] |
Altivec vector conversion constructor.
| v | the Altivec vector variable to be converted |
| float Frz::vertex::norm | ( | void | ) |
Computes the norm of the vertex.
| float Frz::vertex::norm2 | ( | void | ) |
Computes the square norm of the vertex.
| void Frz::vertex::normalize | ( | void | ) |
Normalizes the vertex.
All terms of the vertex are divided by the vertex's norm.
| vertex Frz::vertex::operator* | ( | float | f | ) | const [inline] |
Scale all coefficients with a scalar value.
| f | the scalar value to be multiplied with all the vertex coordinates |
vertex cross product operator.
| b | the vertex to be the right hand operand to the cross product |
vertex addition operator.
| a | the vertex to be added to this |
vertex subtraction operator.
| a | the vertex to be subtracted to this |
| void Frz::vertex::set | ( | vector float | v | ) | [inline] |
Sets a vertex value from an Altivec vector.
| v | the Altivec vector |
Updates the normal vector in vertex b of triangle (a,b, c).
This corresponds to adding the normalized ab * bc cross product, multiplied by the angle in b
| vector float Frz::vertex::v | ( | ) | const [inline] |
Converts the vertex to an Altivec vector.
| std::ostream& operator<< | ( | std::ostream & | os, | |
| const vertex & | v | |||
| ) | [friend] |
Outputs the vertex in human-readable fashion.
| os | the output stream | |
| v | the vertex to be displayed |
1.6.3