32#import "MyOpenGLView.h"
36#define FREEZE_PARTICLES 0
51- (id) initWithPosition:(HPVector)pos
54 minSpeed:(
float)minSpeed
55 maxSpeed:(
float)maxSpeed
57 baseColor:(GLfloat[4])baseColor
61 if ((
self = [super
init]))
64 [
self setPosition:pos];
70 for (
unsigned i = 0; i <
count; i++)
76 color = vector_normal(color);
85 [
self setStatus:STATUS_EFFECT];
95 return [NSString stringWithFormat:@"ttl: %.3fs", _duration - _timePassed];
105- (BOOL) checkCloseCollisionWith:(
Entity *)other
107 if (other == [
self owner])
return NO;
114 [
super update:delta_t];
123 for (i = 0; i <
count; i++)
125 particlePosition[i] = vector_add(particlePosition[i], vector_multiply_scalar(particleVelocity[i], delta_t));
133#define DrawQuadForView(x, y, z, sz) \
135 glTexCoord2f(0.0, 1.0); glVertex3f(x-sz, y-sz, z); \
136 glTexCoord2f(1.0, 1.0); glVertex3f(x+sz, y-sz, z); \
137 glTexCoord2f(1.0, 0.0); glVertex3f(x+sz, y+sz, z); \
138 glTexCoord2f(0.0, 0.0); glVertex3f(x-sz, y+sz, z); \
142- (void) drawImmediate:(
bool)immediate translucent:(
bool)translucent
144 if (!translucent || [
UNIVERSE breakPatternHide])
return;
149 OOGL(glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT));
151 OOGL(glEnable(GL_TEXTURE_2D));
152 OOGL(glEnable(GL_BLEND));
153 OOGL(glBlendFunc(GL_SRC_ALPHA, GL_ONE));
154 [[
self texture] apply];
156 HPVector viewPosition = [PLAYER viewpointPosition];
157 HPVector selfPosition = [
self position];
171 for (i = 0; i <
count; i++)
173 glColor4fv(particleColor[i]);
174 DrawQuadForView(particlePosition[i].
x, particlePosition[i].
y, particlePosition[i].z, particleSize[i]);
183 float thresholdSq = distanceThreshold * distanceThreshold;
186 if (distanceSq > thresholdSq)
194 for (i = 0; i <
count; i++)
200 glColor4fv(particleColor[i]);
214 float individuality = 3.0f * (1.0f - distanceSq / thresholdSq);
215 individuality = OOClamp_0_1_f(individuality);
217 for (i = 0; i <
count; i++)
223 glColor4fv(particleColor[i]);
@ kFragmentBurstMaxParticles
@ kBigFragmentBurstMaxParticles
#define DrawQuadForView(x, y, z, sz)
OOTexture * defaultParticleTexture()
NSString * descriptionComponents()
Vector _particleVelocity[kFragmentBurstMaxParticles]
GLfloat _particleSize[kFragmentBurstMaxParticles]
GLfloat _particleColor[kFragmentBurstMaxParticles][4]
Vector _particlePosition[kFragmentBurstMaxParticles]