00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef GRAPHICALWOBJECT_H
00025 #define GRAPHICALWOBJECT_H
00026
00027 #include "worldsimconfig.h"
00028 #include "world.h"
00029 #include "renderworld.h"
00030
00031
00032 namespace farsa {
00033
00044 class FARSA_WSIM_API GraphicalWObject : public WObject
00045 {
00046 Q_OBJECT
00047
00048 public:
00056 GraphicalWObject(World* world, QString name = "unamed", const wMatrix& tm = wMatrix::identity());
00057
00061 virtual ~GraphicalWObject();
00062
00074 void attachToObject(WObject* object, bool makeOwner = false);
00075
00081 WObject* attachedObject() const
00082 {
00083 return m_attachedObject;
00084 }
00085
00095 void updateAndRender(RenderWObject* renderer, QGLContext* gw);
00096
00107 void updateAndRenderAABB(RenderWObject* renderer, RenderWorld* gw);
00108
00121 void updateAndCalculateAABB(wVector& minPoint, wVector& maxPoint, const wMatrix tm);
00122
00134 void updateAndCalculateOBB(wVector& dimension, wVector& minPoint, wVector& maxPoint);
00135
00136 protected:
00145 virtual void render(RenderWObject* renderer, QGLContext* gw) = 0;
00146
00155 virtual void renderAABB(RenderWObject* renderer, RenderWorld* gw);
00156
00168 virtual void calculateAABB(wVector& minPoint, wVector& maxPoint, const wMatrix tm);
00169
00179 virtual void calculateOBB(wVector& dimension, wVector& minPoint, wVector& maxPoint);
00180
00185 void updateMatrixFromAttachedObject();
00186
00192 WObject *m_attachedObject;
00193 };
00194
00195 }
00196
00197 #endif