-
Notifications
You must be signed in to change notification settings - Fork 7
/
Skyrocket.h
143 lines (120 loc) · 3.86 KB
/
Skyrocket.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef __SKYROCKET__
#define __SKYROCKET__
#include "flare.h"
#include "rsMath.h"
#include "rsText.h"
#include "smoke.h"
#include "SoundEngine.h"
#include <OpenGL/gl.h>
#ifndef PARTICLE_H
#include "particle.h"
#endif
#define PI 3.14159265359f
#define PIx2 6.28318530718f
#define D2R 0.0174532925f
#define R2D 57.2957795131f
#define MAXFLARES 110 // Required 100 and 10 extra for good measure
#define MINDEPTH -1000000.0f // particle depth for inactive particles
class World;
//class particle;
typedef struct SkyrocketSaverSettings
{
int readyToDraw/* = 0*/;
// Window variables
int xsize, ysize, centerx, centery;
float aspectRatio;
// Camera variables
/*static */rsVec lookFrom[3]; // 3 = position, target position, last position
/*static */rsVec lookAt[3] // 3 = position, target position, last position
/*= {rsVec(0.0f, 1000.0f, 0.0f),
rsVec(0.0f, 1000.0f, 0.0f),
rsVec(0.0f, 1000.0f, 0.0f)}*/;
rsVec cameraPos; // used for positioning sounds (same as lookFrom[0])
rsVec cameraVel; // used for doppler shift
// Mouse variables
float mouseIdleTime;
int mouseButtons, mousex, mousey;
float mouseSpeed;
// the sound engine
//SoundEngine* soundengine/* = NULL*/;
// flare display lists
unsigned int flarelist[4];
// matrix junk for drawing flares in screen space
double modelMat[16], projMat[16];
GLint viewport[4];
// transformation needed for rendering particles
float billboardMat[16];
// lifespans for smoke particles
float smokeTime[SMOKETIMES]; // lifespans of consecutive smoke particles
int whichSmoke[WHICHSMOKES]; // table to indicate which particles produce smoke
// smoke display lists
unsigned int smokelist[5];
// the world
World* theWorld;
// text output
rsText* textwriter;
int numRockets /*= 0*/;
std::vector<flareData> lensFlares;
unsigned int numFlares /*= 0*/;
// Parameters edited in the dialog box
int dMaxrockets;
int dSmoke;
int dExplosionsmoke;
int dWind;
int dAmbient;
int dStardensity;
int dFlare;
int dMoonglow;
int dSound;
int kCamera; // 0 = paused, 1 = autonomous, 2 = mouse control
int dMoon;
int dClouds;
int dEarth;
int dIllumination;
int dFrameRateLimit;
int kStatistics;
bool kSlowMotion;
// Commands given from keyboard
int kFireworks /*= 1*/;
int kNewCamera /*= 0*/;
int userDefinedExplosion/* = -1*/;
// Additional globals
float frameTime;
int first;
std::vector<particle> particles;
unsigned int last_particle/* = 0*/;
#define ZOOMROCKETINACTIVE 1000000000
unsigned int zoomRocket/* = ZOOMROCKETINACTIVE*/;
} SkyrocketSaverSettings;
__private_extern__ void draw(SkyrocketSaverSettings * inSettings);
__private_extern__ void initSaver(int width,int height,SkyrocketSaverSettings * inSettings);
__private_extern__ void setDefaults(SkyrocketSaverSettings * inSettings);
__private_extern__ void cleanup(SkyrocketSaverSettings * inSettings);
// NZ: Some Windows-isms here:
enum
{
WM_KEYDOWN,
WM_MOUSEMOVE,
WM_LBUTTONDOWN,
WM_LBUTTONUP,
WM_MBUTTONDOWN,
WM_MBUTTONUP,
WM_RBUTTONDOWN,
WM_RBUTTONUP
};
typedef u_int32_t DWORD;
typedef u_int8_t BYTE;
typedef u_int16_t WORD;
typedef u_int32_t LONG;
#define MK_LBUTTON (1 << 1) /* same as NSLeftMouseDownMask */
#define MK_MBUTTON (1 << 25) /* same as NSOtherMouseDownMask */
#define MK_RBUTTON (1 << 3) /* same as NSRightMouseDownMask */
/*#define MAKEWORD(low, high) ((short)(((char)(low)) | (((short)((char)(high))) << 8)))
#define HIWORD(x) ((short)((long)(x) >> 16))
#define LOWORD(x) ((short)(x))*/
#define MAKEWORD(a, b) ((WORD)(((BYTE)(a)) | ((WORD)((BYTE)(b))) << 8))
#define MAKELONG(a, b) ((LONG)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
#define LOWORD(l) ((WORD)(l))
#define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
long ScreenSaverProc(unsigned int msg, unsigned int wpm, unsigned long lpm, SkyrocketSaverSettings *inSettings);
#endif