29 #include "../client.h" 34 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
35 {0x00, 0x00, 0x20, 0x40, 0x40, 0x20, 0x00, 0x00,},
36 {0x00, 0x20, 0xa0, 0xc0, 0xc0, 0xa0, 0x20, 0x00,},
37 {0x00, 0x40, 0xc0, 0xff, 0xff, 0xc0, 0x40, 0x00,},
38 {0x00, 0x40, 0xc0, 0xff, 0xff, 0xc0, 0x40, 0x00,},
39 {0x00, 0x20, 0xa0, 0xc0, 0xc0, 0xa0, 0x20, 0x00,},
40 {0x00, 0x00, 0x20, 0x40, 0x40, 0x20, 0x00, 0x00,},
41 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}
51 static GLuint wpTextureHandle = 0;
54 return wpTextureHandle;
65 return wpTextureHandle;
181 int restOfLife = prt.
ttl -= milliseconds;
182 if (restOfLife < 0) {
190 prt.
vz = 0; prt.
vx = 0; prt.
vy = 0;
195 const int timeAfterUpdate = prt.
timeout -= milliseconds;
196 const float moveDuration = milliseconds * 0.001f;
198 prt.
x += prt.
vx * moveDuration; prt.
y += prt.
vy * moveDuration; prt.
z += prt.
vz * moveDuration;
200 if (timeAfterUpdate > 0) {
215 weatherZone.
maxs[2] += 512;
219 if (dead > 200) dead = 200;
221 int debugCreated = 0;
242 prt.
ttl = 1000 * lifeTime;
250 if (debugCreated)
Com_Printf(
"created %i weather particles\n", debugCreated);
270 #if 0 // disabled because of bizarre colors 293 const float splashFactor = prt.
ttl / 500.0f;
294 thisParticleSize *= (
splashSize - 1.0f) * splashFactor + 1.0
f;
295 dx = dy = thisParticleSize;
297 dx =
i & 1 ? thisParticleSize* 2 : thisParticleSize; dy =
i & 1 ? thisParticleSize : thisParticleSize * 2 ;
300 x = prt.
x; y = prt.
y; z = prt.
z;
303 GLfloat *pos = &prtPos[3 * 4 * prtCount];
304 GLfloat *texcoord = &prtTexcoord[2 * 4 * prtCount];
305 GLushort *idx = &prtIndex[3 * 2 * prtCount];
308 pos[0] = x - dx; pos[1] = y - dy; pos[2] = z + dz * 2;
309 pos[3] = x + dx; pos[4] = y - dy; pos[5] = z + dz *2;
310 pos[6] = x + dx; pos[7] = y + dy; pos[8] = z;
311 pos[9] = x - dx; pos[10] = y + dy; pos[11] = z;
313 texcoord[0] = 0; texcoord[1] = 0;
314 texcoord[2] = 1.0f; texcoord[3] = 0;
315 texcoord[4] = 1.0f; texcoord[5] = 1.0f;
316 texcoord[6] = 0; texcoord[7] = 1.0f;
318 idx[0] = 4 * prtCount; idx[1] = 4 * prtCount + 1; idx[2] = 4 * prtCount + 2;
319 idx[3] = 4 * prtCount + 2; idx[4] = 4 * prtCount + 3; idx[5] = 4 * prtCount;
331 R_BindArray(GL_TEXTURE_COORD_ARRAY, GL_FLOAT, prtTexcoord);
333 glDrawElements(GL_TRIANGLES, prtCount * 3 * 2, GL_UNSIGNED_SHORT, prtIndex);
vec_t VectorLength(const vec3_t v)
Calculate the length of a vector.
void R_EnableTexture(gltexunit_t *texunit, bool enable)
#define VectorSet(v, x, y, z)
void glBindTexture(GLenum target, GLuint id)
static GLuint wpTexture(void)
Gives handle to (and uploads if needed) weather particle texture; also binds it to the active texture...
void changeTo(weatherTypes weather)
changes to weather of given type; parameters are randomized
Weather(void)
make a default (clean) weather
local graphics definitions
static const size_t MAX_PARTICLES
void Com_Printf(const char *const fmt,...)
int Cvar_GetInteger(const char *varName)
Returns the int value of a cvar.
void R_Color(const vec4_t rgba)
Change the color to given value.
trace_t CL_Trace(const Line &traceLine, const AABB &box, const le_t *passle, le_t *passle2, int contentmask, int worldLevel)
Moves the given mins/maxs volume through the world from start to end.
void R_ResetArrayState(void)
static const uint8_t wpImage[8][8]
void clearParticles(void)
Just a shared methods for ctors to initialize the weather.
void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *texels)
particle particles[MAX_PARTICLES]
void expandXY(const float byVal)
expand the box in four directions, but clip them to the maximum boundaries
void glTexParameterf(GLenum target, GLenum pname, GLfloat param)
float frand(void)
Return random values between 0 and 1.
void R_EnableBlend(bool enable)
float crand(void)
Return random values between -1 and 1.
void glGenTextures(GLsizei n, GLuint *textures)
void update(int milliseconds)
Updates weather for the time passed; handles particle creation/removal automatically.
void setDefaults(void)
Sets clean weather, but generate some parameters usable for easily changing it into the worse varieti...
Weather effects rendering subsystem header file.
void render(void)
Draws weather effects.
void R_BindArray(GLenum target, GLenum type, const void *array)