Tactics: Western Philosophers Vs. Musicians  0.12
A turn-based tactical game combining rules and gameplay elements inspired by Final Fantasy Tactics and the Mayfair Exponential Game System. Unlike most games of this type, motion is in full, grid-less 3D.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CPhysicalObject.h
Go to the documentation of this file.
1 // Copyright (C) 2004-2011 Dylan Blair
3 //
4 // email: dblair@alumni.cs.utexas.edu
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 
21 #ifndef CPHYSICAL_OBJECT_H
22 #define CPHYSICAL_OBJECT_H
23 
24 #include "IObject.h"
25 #include "ICollisionListener.h"
26 #include "../CD_LIB/CDVolume.h"
27 
28 #include <vector>
29 
30 namespace OpenSkyNet {
31  namespace Core {
34  CD::Volume* _colVol;
35  Math::Point<> _vel;
36  public:
37  PhysicalObject(CD::Volume* colVol_) : _colVol(colVol_) {
38  _colVol->setUserPointer(static_cast<void*>(this));
39  }
40 
42 
43  virtual ~PhysicalObject();
44 
45  inline const CD::Volume* getCollisionVolume() const { return _colVol; }
46  inline CD::Volume* getCollisionVolume() { return _colVol; }
47 
50  virtual Math::Point<> getPos() const { return _colVol->getCenter(); }
51  virtual void getPos(Math::Point<>& pos_) const { pos_ = _colVol->getCenter(); }
52  virtual void setPos(const Math::Point<> &pos_) {
53  _colVol->setCenter(pos_);
54  setHasPosChanged(true);
55  }
56 
57  virtual Math::Matrix3x3 getRot() const;
58  virtual void getRot(Math::Matrix3x3& rot_) const;
59  virtual void setRot(const Math::Matrix3x3 &rot_);
60 
61  virtual Math::Point<> getVel() const { return _vel; }
62  virtual void getVel(Math::Point<>& vel_) const { vel_ = _vel; }
63  virtual void setVel(const Math::Point<> &vel_) {
64  _vel = vel_;
65  setHasVelChanged(true);
66  }
67 
68  virtual const PhysicalObject* getPhysicalObject() const { return this; }
69  virtual PhysicalObject* getPhysicalObject() { return this; }
71 
74  virtual void setNonCollidingData(Object* obj_) {
75  assert(obj_ == this);
76  if (obj_ == this)
77  _colVol->setNonColTransform(getPos(), getRot());
78  }
79  virtual bool handleCollisions(Object* collidee_, std::vector<CD::HitInfo>& colliders_, float& dt_);
81  };
82  }
83 }
84 
85 #endif //CPHYSICAL_OBJECT_H
CD::Volume * getCollisionVolume()
Definition: CPhysicalObject.h:46
#define COL_GROUP_HIT_ALL_HIT_BY_ALL
Definition: CDVolume.h:138
virtual void getPos(Math::Point<> &pos_) const
Definition: CPhysicalObject.h:51
Definition: CPhysicalObject.h:33
Definition: CDVolume.h:54
const Matrix3x3 g_identityMatrix3x3
Definition: MMatrix3x3.cpp:5
virtual Math::Point getPos() const
Definition: CPhysicalObject.h:50
Definition: CDVolume.h:225
PhysicalObject(CD::Volume *colVol_)
Definition: CPhysicalObject.h:37
virtual void setPos(const Math::Point<> &pos_)
Definition: CPhysicalObject.h:52
const Point g_origin
Definition: MPoint.cpp:5
virtual void setNonCollidingData(Object *obj_)
Definition: CPhysicalObject.h:74
unsigned int uint
Definition: UTypes.h:39
#define CORE_DLL
Definition: CCoreDLL.h:57
const CD::Volume * getCollisionVolume() const
Definition: CPhysicalObject.h:45
Definition: MPoint.h:33
virtual Math::Point getVel() const
Definition: CPhysicalObject.h:61
virtual void getVel(Math::Point<> &vel_) const
Definition: CPhysicalObject.h:62
Definition: IObject.h:36
Definition: IObject.h:75
virtual const PhysicalObject * getPhysicalObject() const
Definition: CPhysicalObject.h:68
Definition: ICollisionListener.h:34
virtual PhysicalObject * getPhysicalObject()
Definition: CPhysicalObject.h:69
Definition: MMatrix3x3.h:32
float float rot_[3]
Definition: ViewerApp.h:31
float pos_[3]
Definition: ViewerApp.h:31
virtual void setVel(const Math::Point<> &vel_)
Definition: CPhysicalObject.h:63