00001
00002
00003
00004
00005
00006
00007
00008 #ifndef SurroundEffect_Header
00009
00010 #define SurroundEffect_Header
00011
00012 #include <DrawObj.H>
00013 #include <IS3D.H>
00014 #include "Word.H"
00015 #include "Effect.H"
00016
00017 using namespace std;
00018
00019 namespace cavewriting {
00020
00024 class SurroundEffect : public Effect {
00025
00026 public:
00027
00028 SurroundEffect(Array<Word*>& words,
00029 double startTime, double duration = 100.0,
00030 bool startPaused = true,
00031 const Vector3& initialPosition = Vector3(0,0,0),
00032 float speed = 0.1f,
00033 const Vector3& range = Vector3(2, 2, 2),
00034 bool collapse = false,
00035 double collapseDuration = 10.0,
00036 const Vector3& collapseTarget = Vector3(0, 0, 0));
00037
00038 SurroundEffect(Word* words,
00039 double startTime, double duration = 100.0,
00040 bool startPaused = true,
00041 const Vector3& initialPosition = Vector3(0,0,0),
00042 float speed = 0.1f,
00043 const Vector3& range = Vector3(2, 2, 2),
00044 bool collapse = false,
00045 double collapseDuration = 10.0,
00046 const Vector3& collapseTarget = Vector3(0, 0, 0));
00047
00048
00049 static SurroundEffect* fromXML(xercesc::DOMElement * node, bool startPaused = true);
00050 virtual ~SurroundEffect();
00051
00052 virtual void animate();
00053
00054 static void stopAll();
00055 static SurroundEffect * createDefaultSurroundEffect(Word * word);
00056 protected:
00057 float _speed;
00058 Vector3 _positionOffset;
00059 Vector3 _range;
00060 bool _firstTime;
00062 bool _collapse;
00064 float _collapseDuration;
00066 float _collapseStartTime;
00068 Vector3 _collapseTarget;
00069
00072 void setupOffsets(const Vector3& firstCalculatedPos, const Vector3& curPosition);
00073
00075 void doGrabHack(double frac);
00076
00077 static bool _stopAll;
00078
00079 int _framesSinceCreation;
00080 private:
00081 };
00082
00083 }
00084
00085 #endif