]> Dogcows Code - chaz/yoink/blob - src/Moof/Entity.hh
tcp socket disconnecting by remote
[chaz/yoink] / src / Moof / Entity.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_ENTITY_HH_
13 #define _MOOF_ENTITY_HH_
14
15 #include <boost/shared_ptr.hpp>
16
17 #include <Moof/Aabb.hh>
18 #include <Moof/Cullable.hh>
19 #include <Moof/Drawable.hh>
20 #include <Moof/Sphere.hh>
21
22
23 namespace Mf {
24
25
26 class Frustum;
27
28
29 /**
30 * Interface for game objects that can be drawn to the screen and have a
31 * specified volume (take up space).
32 */
33
34 class Entity;
35 typedef boost::shared_ptr<Entity> EntityP;
36
37
38 class Entity : public Cullable, public Drawable
39 {
40 protected:
41
42 Aabb<3> mAabb;
43 Sphere<3> mSphere;
44
45 public:
46
47 virtual ~Entity() {}
48
49 virtual void drawIfVisible(Scalar alpha, const Frustum& frustum) const
50 {
51 if (isVisible(frustum)) draw(alpha);
52 }
53
54 virtual bool isVisible(const Frustum& frustum) const
55 {
56 return mSphere.isVisible(frustum) && mAabb.isVisible(frustum);
57 }
58
59 const Aabb<3>& getAabb() const
60 {
61 return mAabb;
62 }
63
64 const Sphere<3>& getSphere() const
65 {
66 return mSphere;
67 }
68 };
69
70
71 } // namespace Mf
72
73 #endif // _MOOF_ENTITY_HH_
74
This page took 0.033886 seconds and 4 git commands to generate.