1
0
Fork 0
2018-soft-3d-renderer/include/point.h

41 lines
538 B
C

#ifndef POINT_H
// STRUCTURE
struct Point
{
inline Point(void) : x(0), y(0), z(0), w(1) {}
inline Point(float x, float y, float z) : x(x), y(y), z(z), w(1) {}
union
{
float e[4];
struct
{
float x, y, z, w;
};
};
};
// OPERATORS
// v / f
inline Point operator/(Point v, float f)
{
Point result;
float inverse = 1.0f / f;
result.x = v.x * inverse;
result.y = v.y * inverse;
result.z = v.z * inverse;
return result;
}
#define POINT_H
#endif