Add of source
Add of the source Former-commit-id: f3d01ef18ccc1ae906693f388e696c0763576a3b
This commit is contained in:
parent
7ba72ef1c6
commit
45fc9158e4
|
|
@ -114,6 +114,8 @@ bool NzRay<T>::Intersect(const NzBox<T>& box, NzVector3<T> * hitPoint, NzVector3
|
||||||
template<typename T>
|
template<typename T>
|
||||||
bool NzRay<T>::Intersect(const NzOrientedBox<T>& orientedBox, const NzMatrix4<T>& matrix, NzVector3<T> * hitPoint, NzVector3<T> * hitSecondPoint) const
|
bool NzRay<T>::Intersect(const NzOrientedBox<T>& orientedBox, const NzMatrix4<T>& matrix, NzVector3<T> * hitPoint, NzVector3<T> * hitSecondPoint) const
|
||||||
{
|
{
|
||||||
|
// Traduction from http://www.opengl-tutorial.org/miscellaneous/clicking-on-objects/picking-with-custom-ray-obb-function/ written by Arnaud Masserann
|
||||||
|
|
||||||
// Intersection method from Real-Time Rendering and Essential Mathematics for Games
|
// Intersection method from Real-Time Rendering and Essential Mathematics for Games
|
||||||
|
|
||||||
T tMin = F(0.0);
|
T tMin = F(0.0);
|
||||||
|
|
@ -185,7 +187,6 @@ bool NzRay<T>::Intersect(const NzOrientedBox<T>& orientedBox, const NzMatrix4<T>
|
||||||
if (-e + orientedBox.localBox.y > F(0.0) || -e + (orientedBox.localBox.y + orientedBox.localBox.height) < F(0.0))
|
if (-e + orientedBox.localBox.y > F(0.0) || -e + (orientedBox.localBox.y + orientedBox.localBox.height) < F(0.0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
// Test intersection with the 2 planes perpendicular to the OBB's Z axis
|
// Test intersection with the 2 planes perpendicular to the OBB's Z axis
|
||||||
// Exactly the same thing than above.
|
// Exactly the same thing than above.
|
||||||
NzVector3<T> zaxis(matrix(2, 0), matrix(2, 1), matrix(2, 2));
|
NzVector3<T> zaxis(matrix(2, 0), matrix(2, 1), matrix(2, 2));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue