source: OGRE/trunk/ogrenew/Tools/LightwaveConverter/include/lwEnvelope.h @ 657

Revision 657, 1.8 KB checked in by mattausch, 18 years ago (diff)

added ogre dependencies and patched ogre sources

Line 
1
2#ifndef _LWENVELOPE_H_
3#define _LWENVELOPE_H_
4
5#include "lwo.h"
6
7#include <iostream>
8
9class lwKey
10{
11public:
12        lwKey(float ntime, float nvalue) : time(ntime), value(nvalue) {}
13        float          time;
14        float          value;
15        unsigned int   shape;               /* ID_TCB, ID_BEZ2, etc. */
16        float          tension;
17        float          continuity;
18        float          bias;
19        float          param[ 4 ];
20};
21
22typedef vector<lwKey*> vkeys;
23
24inline bool operator < (const lwKey &k1, const lwKey &k2)
25{
26        return k1.time < k2.time;
27}
28
29#define BEH_RESET      0
30#define BEH_CONSTANT   1
31#define BEH_REPEAT     2
32#define BEH_OSCILLATE  3
33#define BEH_OFFSET     4
34#define BEH_LINEAR     5
35
36class lwEnvelope
37{
38        float range( float v, float lo, float hi, int *i );
39        void hermite( float t, float *h1, float *h2, float *h3, float *h4 );
40        float bezier( float x0, float x1, float x2, float x3, float t );
41        float bez2_time( float x0, float x1, float x2, float x3, float time, float *t0, float *t1 );
42        float bez2( lwKey *key0, lwKey *key1, float time );
43        float outgoing( unsigned int key0, unsigned int key1 );
44        float incoming( unsigned int key0, unsigned int key1 );
45       
46public:
47        lwEnvelope()
48        {
49                name = 0;
50        }
51
52        ~lwEnvelope()
53        {
54                if (name) free(name);
55                unsigned int i;
56                for (i=0; i<keys.size(); delete keys[i++]);
57                for (i=0; i<cfilters.size(); delete cfilters[i++]);
58        }
59       
60        float evaluate( float time );
61        lwKey *addKey( float time, float value );
62
63        int       index;
64        int       type;
65        char     *name;
66        vkeys     keys;                /* linked list of keys */
67        int       behavior[ 2 ];       /* pre and post (extrapolation) */
68        vplugins  cfilters;            /* linked list of channel filters */
69        int       ncfilters;
70};
71
72typedef vector<lwEnvelope*> venvelopes;
73
74#endif // _LWENVELOPE_H_
75
Note: See TracBrowser for help on using the repository browser.