]>
Dogcows Code - chaz/yoink/blob - src/Moof/Ray.hh
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
10 **************************************************************************/
15 #include <Moof/Drawable.hh>
16 #include <Moof/Math.hh>
17 #include <Moof/OpenGL.hh>
18 #include <Moof/Texture.hh>
25 * A line that goes to infinity.
29 struct Ray
: public Drawable
31 typedef cml::vector
< Scalar
, cml::fixed
<D
> > Vector
;
33 // solution = point + t*direction
39 Scalar distance
; // distance from the origin to the nearest point
40 Vector normal
; // surface normal at contact point
42 bool operator < (const Contact
& rhs
)
44 return distance
< rhs
.distance
;
48 void solve(Vector
& p
, Scalar t
) const
50 p
= point
+ t
*direction
;
53 void draw(Scalar alpha
= 0.0) const
55 Vector end
= point
+ 1000.0 * direction
;
56 // FIXME this is kinda cheesy
58 Mf::Texture::resetBind();
67 direction
.normalize();
78 #endif // _MOOF_RAY_HH_
This page took 0.037517 seconds and 4 git commands to generate.