~ubuntu-branches/ubuntu/gutsy/rss-glx/gutsy

« back to all changes in this revision

Viewing changes to reallyslick/cpp_src/solarwinds.cpp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2005-11-30 18:21:27 UTC
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20051130182127-5iww7elbiyzej1lk
Tags: upstream-0.8.0
ImportĀ upstreamĀ versionĀ 0.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
int dEmitterspeed;
59
59
int dWindspeed;
60
60
int dBlur;
61
 
int dPriority;
62
61
 
63
62
class wind {
64
63
      public:
85
84
        for (i = 0; i < dEmitters; i++) {
86
85
                emitters[i] = new float[3];
87
86
 
88
 
                emitters[i][0] = myRandf (60.0f) - 30.0f;
89
 
                emitters[i][1] = myRandf (60.0f) - 30.0f;
90
 
                emitters[i][2] = myRandf (30.0f) - 15.0f;
 
87
                emitters[i][0] = rsRandf (60.0f) - 30.0f;
 
88
                emitters[i][1] = rsRandf (60.0f) - 30.0f;
 
89
                emitters[i][2] = rsRandf (30.0f) - 15.0f;
91
90
        }
92
91
 
93
92
        particles = new float *[dParticles];
116
115
        }
117
116
 
118
117
        for (i = 0; i < NUMCONSTS; i++) {
119
 
                ct[i] = myRandf (PIx2);
120
 
                cv[i] = myRandf (0.00005f * float (dWindspeed) * float (dWindspeed))
 
118
                ct[i] = rsRandf (PIx2);
 
119
                cv[i] = rsRandf (0.00005f * float (dWindspeed) * float (dWindspeed))
121
120
                + 0.00001f * float (dWindspeed) * float (dWindspeed);
122
121
        }
123
122
}
165
164
        for (i = 0; i < dEmitters; i++) {
166
165
                emitters[i][2] += evel; // emitter moves toward viewer
167
166
                if (emitters[i][2] > 15.0f) {   // reset emitter
168
 
                        emitters[i][0] = myRandf (60.0f) - 30.0f;
169
 
                        emitters[i][1] = myRandf (60.0f) - 30.0f;
 
167
                        emitters[i][0] = rsRandf (60.0f) - 30.0f;
 
168
                        emitters[i][1] = rsRandf (60.0f) - 30.0f;
170
169
                        emitters[i][2] = -15.0f;
171
170
                }
172
171
                particles[whichparticle][0] = emitters[i][0];
263
262
        }
264
263
}
265
264
 
266
 
void hack_draw (xstuff_t * XStuff)
 
265
void hack_draw (xstuff_t * XStuff, double currentTime, float frameTime)
267
266
{
268
267
        int i;
269
268
 
270
 
        glLoadIdentity ();
271
 
 
272
269
        if (!dBlur) {
273
270
                glClear (GL_COLOR_BUFFER_BIT);
274
271
        } else {
275
 
                glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
276
 
                glColor4f (0.0f, 0.0f, 0.0f, 0.5f - (float (dBlur) * 0.0049f));
277
 
                glBegin (GL_QUADS);
278
 
                glVertex3f (-40.0f, -17.0f, 0.0f);
279
 
                glVertex3f (40.0f, -17.0f, 0.0f);
280
 
                glVertex3f (40.0f, 17.0f, 0.0f);
281
 
                glVertex3f (-40.0f, 17.0f, 0.0f);
282
 
                glEnd ();
283
 
                if (!dGeometry)
284
 
                        glBlendFunc (GL_ONE, GL_ONE);
285
 
                else
286
 
                        glBlendFunc (GL_SRC_ALPHA, GL_ONE);     // Necessary for point and 
287
 
                // 
288
 
                // line smoothing (I don't 
289
 
                // know why)
290
 
                // Maybe it's just my video card...
 
272
                glMatrixMode(GL_PROJECTION);
 
273
                glPushMatrix();
 
274
                        glLoadIdentity();
 
275
                        glOrtho(0.0, 1.0, 0.0, 1.0, 1.0, -1.0);
 
276
                        glMatrixMode(GL_MODELVIEW);
 
277
                        glLoadIdentity();
 
278
                                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
279
                                glColor4f(0.0f, 0.0f, 0.0f, 0.5f - (float(dBlur) * 0.0049f));
 
280
                                glBegin(GL_TRIANGLE_STRIP);
 
281
                                        glVertex3f(0.0f, 0.0f, 0.0f);
 
282
                                        glVertex3f(1.0f, 0.0f, 0.0f);
 
283
                                        glVertex3f(0.0f, 1.0f, 0.0f);
 
284
                                        glVertex3f(1.0f, 1.0f, 0.0f);
 
285
                                glEnd();
 
286
                                if(dGeometry == 0)
 
287
                                        glBlendFunc(GL_ONE, GL_ONE);
 
288
                                else
 
289
                                        glBlendFunc(GL_SRC_ALPHA, GL_ONE);  // Necessary for point and line smoothing (I don't know why)
 
290
                                                // Maybe it's just my video card...
 
291
                glMatrixMode(GL_PROJECTION);
 
292
                glPopMatrix();
291
293
        }
292
294
 
 
295
        glMatrixMode(GL_MODELVIEW);
 
296
        glLoadIdentity();
 
297
        glTranslatef(0.0, 0.0, -15.0);
 
298
 
293
299
        // You should need to draw twice if using blur, once to each buffer.
294
300
        // But wglSwapLayerBuffers appears to copy the back to the
295
301
        // front instead of just switching the pointers to them.  It turns
585
591
        }
586
592
 
587
593
        if (!change_flag) {
588
 
                setDefaults (myRandi (6) + 1);
 
594
                setDefaults (rsRandi (6) + 1);
589
595
        }
590
596
}