]> Dogcows Code - chaz/yoink/blob - src/Moof/Shape.hh
c97296004b7a80aa73d5ff3594ed4ae658b38c40
[chaz/yoink] / src / Moof / Shape.hh
1
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
4 *
5 * vi:ts=4 sw=4 tw=75
6 *
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.
9 *
10 **************************************************************************/
11
12 #ifndef _MOOF_SHAPE_HH_
13 #define _MOOF_SHAPE_HH_
14
15 #include <Moof/Drawable.hh>
16 #include <Moof/Math.hh>
17 #include <Moof/OpenGL.hh>
18 #include <Moof/Ray.hh>
19
20
21 // Frustum
22 // Plane (can construct from Triangle<3>)
23 // Ray
24 // Shape<>
25 // +- Line<>
26 // +- Ball<>
27 // | Circle <- Ball<2>
28 // | Sphere <- Ball<3>
29 // +- Box<>
30 // | Rectangle <- Box<2>
31 // | Aabb <- Box<3>
32 // +- Polygon<>
33 // | Triangle <- Polygon<3>
34 // +- Cylinder
35 // +- Cone
36
37
38 namespace Mf {
39
40
41 template <int D>
42 class Shape
43 {
44 public:
45
46 virtual ~Shape() {}
47
48 /**
49 * Checks if this shape is intersected by a given ray. If so, returns
50 * the distance from the start of the ray to the shape and information
51 * about the intersection via the 2nd parameter. A negative value is
52 * returned if there is no intersection.
53 */
54 virtual bool intersectRay(const Ray<D>& ray,
55 typename Ray<D>::Intersection& hit)
56 {
57 return SCALAR(-1.0);
58 }
59 };
60
61
62 } // namespace Mf
63
64 #endif // _MOOF_SHAPE_HH_
65
This page took 0.029409 seconds and 3 git commands to generate.