-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
camera and frustum (pending changes)
- Loading branch information
1 parent
c78c029
commit 7f80dac
Showing
25 changed files
with
1,436 additions
and
516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include "vec3.h" | ||
|
||
template <typename T> struct TPoint; | ||
template <typename T> struct TVect; | ||
template <typename T> struct TLine; | ||
template <typename T> struct TPlane; | ||
|
||
|
||
template <typename T> | ||
struct TPoint { | ||
T x; | ||
T y; | ||
T z; | ||
T w; /* = 1 */ | ||
|
||
TPoint(T x, T y, T z, T w); | ||
TPoint(T x, T y, T z); | ||
explicit TPoint(TVec3<T> v); | ||
|
||
TPoint operator+= (const TVect<T>& v); | ||
|
||
static constexpr TPoint Origin; | ||
}; | ||
|
||
|
||
/** | ||
* Plucker coordinates for lines in 3D. | ||
* Cfr https://en.wikipedia.org/wiki/Pl%C3%BCcker_coordinates | ||
*/ | ||
template <typename T> | ||
struct TLine { | ||
union { | ||
struct { | ||
T wx; | ||
T wy; | ||
T wz; | ||
}; | ||
TVec3<T> m; | ||
}; | ||
union { | ||
struct { | ||
T yz; | ||
T zx; | ||
T xy; | ||
}; | ||
TVec3<T> d; | ||
}; | ||
|
||
TLine(const TPoint<T>& p, const TPoint<T>& q); | ||
TLine(const TPoint<T>& p, const TVect<T>& v); | ||
}; | ||
|
||
template <typename T> | ||
struct TPlane { | ||
T x; | ||
T y; | ||
T z; | ||
T w; | ||
TPlane(T x, T y, T z, T w); | ||
}; | ||
|
||
/* Typedefs */ | ||
|
||
typedef TPoint<float> Point; | ||
typedef TLine<float> Line; | ||
typedef TPlane<float> Plane; | ||
|
||
/* Implementations */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.