]> Dogcows Code - chaz/yoink/blob - src/moof/shape.hh
pch support
[chaz/yoink] / src / moof / shape.hh
1
2 /*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
3 **] All rights reserved.
4 *
5 * Distributable under the terms and conditions of the 2-clause BSD license;
6 * see the file COPYING for a complete text of the license.
7 *
8 *****************************************************************************/
9
10 #ifndef _MOOF_SHAPE_HH_
11 #define _MOOF_SHAPE_HH_
12
13 #include <moof/drawable.hh>
14 #include <moof/math.hh>
15 #include <moof/opengl.hh>
16 #include <moof/ray.hh>
17
18
19 /**
20 * \file shape.hh
21 * Declares an interface for shapes.
22 */
23
24 // frustum
25 // plane (can construct from triangle2)
26 // ray
27 // shape<>
28 // +- line<>
29 // - line2 line<2>
30 // - line3 line<3>
31 // +- sphere<>
32 // | sphere2, circle sphere<2>
33 // | sphere3 sphere<3>
34 // +- aabb<>
35 // | aabb2, rectangle aabb<2>
36 // | aabb3 aabb<3>
37 // +- polygon<>
38 // | triangle2 polygon<2,3>
39 // | triangle3 polygon<3,3>
40
41
42 namespace moof {
43
44
45 template <int D>
46 class shape
47 {
48 public:
49
50 virtual ~shape() {}
51
52 /**
53 * Checks if this shape is intersected by a given ray. If so, returns
54 * the distance from the start of the ray to the shape and information
55 * about the contact via the 2nd parameter. A negative value is
56 * returned if there is no contact.
57 */
58 virtual bool intersect_ray(const ray<D>& ray,
59 typename moof::ray<D>::contact& hit) const
60 {
61 return false;
62 }
63 };
64
65 typedef shape<2> shape2;
66 typedef shape<3> shape3;
67
68
69 } // namespace moof
70
71 #endif // _MOOF_SHAPE_HH_
72
This page took 0.03157 seconds and 4 git commands to generate.