]> Dogcows Code - chaz/yoink/blob - src/Moof/Shape.hh
more explicit constructors
[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 Triangle3)
23 // Ray
24 // Shape<>
25 // +- Line<>
26 // - Line2 Line<2>
27 // - Line3 Line<3>
28 // +- Sphere<>
29 // | Sphere2, Circle Sphere<2>
30 // | Sphere3 Sphere<3>
31 // +- Aabb<>
32 // | Aabb2, Rectangle Aabb<2>
33 // | Aabb3 Aabb<3>
34 // +- Polygon<>
35 // | Triangle2 Polygon<2,3>
36 // | Triangle3 Polygon<3,3>
37
38
39 namespace Mf {
40
41
42 template <int D>
43 class Shape
44 {
45 public:
46
47 virtual ~Shape() {}
48
49 /**
50 * Checks if this shape is intersected by a given ray. If so, returns
51 * the distance from the start of the ray to the shape and information
52 * about the contact via the 2nd parameter. A negative value is
53 * returned if there is no contact.
54 */
55 virtual bool intersectRay(const Ray<D>& ray,
56 typename Ray<D>::Contact& hit) const
57 {
58 return false;
59 }
60 };
61
62
63 typedef Shape<2> Shape2;
64 typedef Shape<3> Shape3;
65
66
67 } // namespace Mf
68
69 #endif // _MOOF_SHAPE_HH_
70
This page took 0.034916 seconds and 4 git commands to generate.