Morph-SynRJ

view efx_screen2.h @ 0:22de913c2d84

morph-synrj intro
author "Cedric Pinson <cedric.pinson@alcove.fr> <mornifle@plopbyte.net>"
date Tue Nov 27 15:23:52 2007 +0100 (2007-11-27)
parents
children
line source
1 #ifndef EFX_SCREEN2_H
2 #define EFX_SCREEN2_H
5 #include "cmn_texture.h"
6 #include "efx_harmonics.h"
7 #include "mth_vector2.h"
8 #include "efx_touf.h"
9 #include "mth_hermite.h"
11 // Sync ...
12 #include "fxSync.h"
15 #if 0
16 class efxFollowPath_t
17 {
19 mth::Vector3_t* vertexes;
20 int nbMaxElements;
21 int indexVertexes;
22 int nbVertexes;
23 public:
25 efxFollowPath_t(){vertexes=0;indexVertexes=0;nbVertexes=0;}
27 void Init(int _nbkeys) {
28 if (vertexes)
29 delete [] vertexes;
30 vertexes=new mth::Vector3_t[_nbkeys];
31 nbMaxElements=_nbkeys;
32 }
35 mth::Vector3_t* Vertexes() { return vertexes;}
37 void PushVertex(mth::Vector3_t& _v) {
38 vertexes[indexVertexes]=_v;
39 indexVertexes=(indexVertexes+1)%nbMaxElements;
40 nbVertexes=mth::Min(nbVertexes+1,nbMaxElements);;
42 }
44 int NbCurrentVertexes() { return nbVertexes;}
45 int Index() { return indexVertexes;}
47 mth::Vector3_t& GetReverseVertex(int _index) {
48 return vertexes[(nbMaxElements+indexVertexes-_index-1)%nbMaxElements];
49 }
51 };
53 #endif
56 class efxScreen2_t
57 {
59 double internalTime;
62 // spercial harmonics data
63 GLuint textureForSpherical;
64 efxSpherical_t* spherical;
65 float radius; // infos used to know where to put the touffus family
66 // internal update for spherical harmonics
67 void UpdateSpherical();
69 // morph spherical
70 float morphFrac;
71 int currentShapeToMorph;
75 // toufs data
76 efxTouf_t* touffus;
77 int nbToufs;
78 mth::Hermite_t** toufPaths;
79 mth::HermiteKey_t* keyData;
80 int nbKeys;
82 GLuint textureTouf;
83 mth::Vector3_t toufForce;
85 float stepDanceYTargetPosition;
86 int stepDanceDirection;
87 bool toufStartMoving;
89 void InitToufs(int _nbToufs);
90 void UpdateToufs();
91 void SynchroniseToufs();
92 void HandleToufs();
93 //void HandleWindSound();
94 //void HandleSnareSound();
95 void HandleCameraMoving(double _time);
96 void HandleToufsMoving(double _time);
97 void HandleCameraTarget();
101 // path
102 // efxFollowPath_t path;
103 // void UpdatePath();
104 void GetRandomPos(float _rangeRandomRadius,float _distmin,const mth::Vector3_t& _fromPosition,mth::Vector3_t& _result);
106 void DrawSpherical();
107 void DrawToufs();
108 void DrawPath();
111 // camera
112 mth::Vector3_t camera;
113 mth::Vector3_t lookat;
114 mth::Hermite_t* cameraPath;
115 mth::HermiteKey_t* cameraKeyData;
119 cmnDesign_t design;
120 cmnDesignElementTexturedQuad_t* designElements;
121 void InitDesign();
123 cmnDesignScroller_t scroller;
127 void DrawParticle(float _r,
128 float _g,
129 float _b,
130 float _alpha,
131 int _i,
132 const mth::Vector3_t& _v0,
133 const mth::Vector3_t& _v1);
138 bool endPart;
139 float restingTime;
142 public:
144 efxScreen2_t();
146 void Init();
147 void Update();
148 void Draw();
149 void SetEnd(float _restingTime) { endPart=true; restingTime=_restingTime;}
150 bool SetEnd() { return endPart;}
152 // void HandleSnareSound();
153 void HandleWindSound();
154 };
157 #endif