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