00001 /*========================================================================= 00002 UberSim Source Code Release 00003 ------------------------------------------------------------------------- 00004 Copyright (C) 2002 Manuela Veloso, Brett Browning, Mike Bowling, 00005 James Bruce; {mmv, brettb, mhb, jbruce}@cs.cmu.edu 00006 Erick Tryzelaar {erickt}@andrew.cmu.edu 00007 School of Computer Science, Carnegie Mellon University 00008 ------------------------------------------------------------------------- 00009 This software is distributed under the GNU General Public License, 00010 version 2. If you do not have a copy of this licence, visit 00011 www.gnu.org, or write: Free Software Foundation, 59 Temple Place, 00012 Suite 330 Boston, MA 02111-1307 USA. This program is distributed 00013 in the hope that it will be useful, but WITHOUT ANY WARRANTY, 00014 including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 -------------------------------------------------------------------------*/ 00016 00017 #ifndef __SPATIAL_H__ 00018 #define __SPATIAL_H__ 00019 00020 #include "Vector3.h" 00021 #include "Matrix33.h" 00022 00023 #include "BoundingSphere.h" 00029 class MotionController; 00030 class Node; 00031 class RenderController; 00032 00033 class Spatial 00034 { 00035 public: 00036 Spatial (char* name); 00037 virtual ~Spatial (); 00038 00039 public: 00040 char* getName (); 00041 Node* getParent (); 00042 00043 MotionController* getMotionController (); 00044 //RenderController* getRenderController (); 00045 00046 BoundingSphere& getWorldBound (); 00047 00048 Real& getLocalScale (); 00049 Matrix33& getLocalRotation (); 00050 Vector3& getLocalPosition (); 00051 Vector3 getLocalLinearVelocity (); 00052 Vector3 getLocalAngularVelocity (); 00053 00054 Real& getWorldScale (); 00055 Matrix33& getWorldRotation (); 00056 Vector3& getWorldPosition (); 00057 Vector3 getWorldLinearVelocity (); 00058 Vector3 getWorldAngularVelocity (); 00059 00060 void setParent (Node* parent); 00061 00062 void setMotionController (MotionController* motionController); 00063 00064 virtual void setLocalScale (const Real localScale); 00065 virtual void setLocalRotation (const Matrix33& localRotation); 00066 virtual void setLocalPosition (const Vector3& localPosition); 00067 virtual void setLocalLinearVelocity (const Vector3& localLinearVelocity); 00068 virtual void setLocalAngularVelocity (const Vector3& localAngularVelocity); 00069 00070 virtual void setWorldScale (const Real worldScale); 00071 virtual void setWorldRotation (const Matrix33& worldRotation); 00072 virtual void setWorldPosition (const Vector3& worldPosition); 00073 virtual void setWorldLinearVelocity (const Vector3& worldLinearVelocity); 00074 virtual void setWorldAngularVelocity (const Vector3& worldAngularVelocity); 00075 00076 public: 00077 virtual void updateGeometricState (Real deltaTime); 00078 virtual void updateWorldData (Real deltaTime); 00079 virtual void updateWorldBound () = 0; 00080 00081 virtual void draw () = 0; 00082 00083 virtual void print() = 0; 00084 00085 virtual void onCollidingWith (Spatial* object); 00086 00087 virtual void collidingWith (Spatial* object) = 0; 00088 00089 protected: 00090 char* name; 00091 Node* parent; 00092 00093 MotionController* motionController; 00094 00095 BoundingSphere worldBound; 00096 00097 bool isCalculatingTransform; 00098 00099 Real localScale; 00100 Matrix33 localRotation; 00101 Vector3 localPosition; 00102 Vector3 localLinearVelocity; 00103 Vector3 localAngularVelocity; 00104 00105 Real worldScale; 00106 Matrix33 worldRotation; 00107 Vector3 worldPosition; 00108 Vector3 worldLinearVelocity; 00109 Vector3 worldAngularVelocity; 00110 }; 00111 00112 #endif