bubble.h

Go to the documentation of this file.
00001 
00016 #ifndef _BUBBLE_H_
00017 #define _BUBBLE_H_
00018 
00019 #include <Inventor/SbColor.h>
00020 #include <Inventor/SbLinear.h>
00021 #include <Inventor/nodes/SoTranslation.h>
00022 #include <Inventor/nodes/SoMaterial.h>
00023 
00024 #include "graphical_node.h"
00025 #include "time_updateable.h"
00026 #include "play_field.h"
00027 #include "bubble_field.h"
00028 #include "templates/callable_back.h"
00029 
00030 class Explosion;
00031 
00037 class Bubble: public TimeUpdateable, public GraphicalNode,
00038         public Templates::CallableBack<Explosion>
00039 {
00040         private:
00041 
00043                 static const float TRANSPARENCY_TRANSPARENT;
00044 
00046                 static const float TRANSPARENCY_SOLID;
00047 
00049                 static int freeTypeId;
00050 
00052                 static float speed;
00053 
00055                 int _typeId;
00056 
00058                 SbVec3f _motionVector;
00059 
00061                 SoTranslation* _position;
00062 
00064                 SbColor _color;
00065 
00067                 Explosion* _explosion;
00068 
00071                 Templates::CallableBack<Bubble>* _explodeDone;
00072 
00074                 SoMaterial* _material;
00075 
00076         private:
00077 
00085                 Bubble(int id, const SbColor& color, Explosion* explosion);
00086 
00093                 void createOIGraph();
00094 
00095         public:
00096 
00105                 Bubble(const SbColor& color, Explosion* explosion);
00106 
00110                 ~Bubble();
00111 
00112                 // Override
00113                 virtual void timeUpdate(float dt);
00114 
00115                 // Override
00116                 virtual void callableBackNotify(Explosion* subject);
00117 
00123                 Bubble* clone() const;
00124 
00132                 void setMotionVector(const SbVec3f& newMotionVector);
00133 
00140                 const SbVec3f& getMotionVector() const
00141                 {
00142                         return _motionVector;
00143                 }
00144 
00150                 void setPosition(const SbVec3f& newPosition)
00151                 {
00152                         _position->translation = newPosition;
00153                 }
00154 
00160                 const SbVec3f& getPosition() const
00161                 {
00162                         return _position->translation.getValue();
00163                 }
00164 
00170                 static float getSpeed() { return speed; }
00171 
00177                 static float getRadius()
00178                 {
00179                         return PlayField::getSizeHalfSize() / BubbleField::getNumberOfBubblesInRow();
00180                 }
00181 
00185                 int getType() { return _typeId; }
00186 
00192                 bool collidesWithBubble(const SbVec3f& other) const;
00193 
00197                 virtual void enableTransparency();
00198 
00202                 virtual void disableTransparency();
00203 
00210                 void explode(Templates::CallableBack<Bubble>* explodeDone);
00211 };
00212 
00213 #endif

Generated on Sat Dec 20 19:21:24 2008 for PGR2008 by  doxygen 1.5.6