/** * @brief Add atmospheric effects * @details Add atmospheric effects (e.g. rain, snow etc.) to view] */ void CG_AddAtmosphericEffects() { int curr, max, currnum; cg_atmosphericParticle_t *particle; vec3_t currvec; float currweight; if (cg_atmFx.numDrops <= 0 || cg_atmFx.numEffectShaders == 0 || cg_atmosphericEffects.value <= 0) { return; } max = cg_atmosphericEffects.value < 1 ? cg_atmosphericEffects.value * cg_atmFx.numDrops : cg_atmFx.numDrops; if (CG_EffectGustCurrent(currvec, &currweight, &currnum)) { // recalculate gust parameters CG_EffectGust(); } // allow parametric management of drop count for swelling/waning precip cg_atmFx.oldDropsActive = cg_atmFx.dropsActive; cg_atmFx.dropsActive = 0; cg_atmFx.dropsCreated = 0; VectorSet(cg_atmFx.viewDir, cg.refdef_current->viewaxis[0][0], cg.refdef_current->viewaxis[0][1], 0.f); for (curr = 0; curr < max; curr++) { particle = &cg_atmFx.particles[curr]; if (!cg_atmFx.ParticleCheckVisible(particle)) { // effect has terminated or fallen from screen view if (!cg_atmFx.ParticleGenerate(particle, currvec, currweight)) { continue; } else { cg_atmFx.dropsCreated++; } } cg_atmFx.ParticleRender(particle); cg_atmFx.dropsActive++; } cg_atmFx.lastRainTime = cg.time; }
void CG_AddAtmosphericEffects() { // Add atmospheric effects (e.g. rain, snow etc.) to view int curr, max, currnum; cg_atmosphericParticle_t *particle; vec3_t currvec; float currweight; if (cg_atmFx.numDrops <= 0 || cg_atmFx.numEffectShaders == 0) return; max = cg_lowEffects.integer ? (cg_atmFx.numDrops >> 1) : cg_atmFx.numDrops; if (CG_EffectGustCurrent(currvec, &currweight, &currnum)) CG_EffectGust(); // Recalculate gust parameters for (curr = 0; curr < max; curr++) { particle = &cg_atmFx.particles[curr]; if (!cg_atmFx.ParticleCheckVisible(particle)) { // Effect has terminated / fallen from screen view if (!particle->nextDropTime) { // Stop rain being synchronized particle->nextDropTime = rand() % ATMOSPHERIC_DROPDELAY; } else if (currnum < curr || particle->nextDropTime > cg.time) continue; if (!cg_atmFx.ParticleGenerate(particle, currvec, currweight)) { // Ensure it doesn't attempt to generate every frame, to prevent // 'clumping' when there's only a small sky area available. particle->nextDropTime = cg.time + ATMOSPHERIC_DROPDELAY; continue; } } cg_atmFx.ParticleRender(particle); } cg_atmFx.lastRainTime = cg.time; }
void CG_AddAtmosphericEffects() { // Add atmospheric effects (e.g. rain, snow etc.) to view int curr, max, currnum; cg_atmosphericParticle_t *particle; vec3_t currvec; float currweight; if( cg_atmFx.numDrops <= 0 || cg_atmFx.numEffectShaders == 0 || cg_atmosphericEffects.value <= 0 ) return; #ifndef ATM_NEW CG_ClearPolyPool(); #endif // ATM_NEW max = cg_atmosphericEffects.value < 1 ? cg_atmosphericEffects.value * cg_atmFx.numDrops : cg_atmFx.numDrops; if( CG_EffectGustCurrent( currvec, &currweight, &currnum ) ) CG_EffectGust(); // Recalculate gust parameters // ydnar: allow parametric management of drop count for swelling/waning precip cg_atmFx.oldDropsActive = cg_atmFx.dropsActive; cg_atmFx.dropsActive = 0; cg_atmFx.dropsRendered = cg_atmFx.dropsCreated = cg_atmFx.dropsSkipped = 0; // getgroundtime = getskytime = rendertime = checkvisibletime = generatetime = 0; // n_getgroundtime = n_getskytime = n_rendertime = n_checkvisibletime = n_generatetime = 0; VectorSet( cg_atmFx.viewDir, cg.refdef_current->viewaxis[0][0], cg.refdef_current->viewaxis[0][1], 0.f ); for( curr = 0; curr < max; curr++ ) { particle = &cg_atmFx.particles[curr]; //% if( !CG_SnowParticleCheckVisible( particle ) ) if( !cg_atmFx.ParticleCheckVisible( particle ) ) { // Effect has terminated / fallen from screen view /* if( !particle->nextDropTime ) { // Stop rain being synchronized particle->nextDropTime = cg.time + rand() % ATMOSPHERIC_DROPDELAY; } if( currnum < curr || particle->nextDropTime > cg.time ) { cg_atmFx.dropsRendered++; continue; } */ //% if( !CG_SnowParticleGenerate( particle, currvec, currweight ) ) if( !cg_atmFx.ParticleGenerate( particle, currvec, currweight ) ) { // Ensure it doesn't attempt to generate every frame, to prevent // 'clumping' when there's only a small sky area available. particle->nextDropTime = cg.time + ATMOSPHERIC_DROPDELAY; continue; } else { cg_atmFx.dropsCreated++; } } //% CG_RainParticleRender( particle ); cg_atmFx.ParticleRender( particle ); cg_atmFx.dropsActive++; } // CG_RenderPolyPool(); cg_atmFx.lastRainTime = cg.time; // CG_Printf( "Active: %d Generated: %d Rendered: %d Skipped: %d\n", cg_atmFx.dropsActive, cg_atmFx.dropsCreated, cg_atmFx.dropsRendered, cg_atmFx.dropsSkipped ); // CG_Printf( "gg: %i gs: %i rt: %i cv: %i ge: %i\n", getgroundtime, getskytime, rendertime, checkvisibletime, generatetime ); // CG_Printf( "\\-> %i \\-> %i \\-> %i \\-> %i \\-> %i\n", n_getgroundtime, n_getskytime, n_rendertime, n_checkvisibletime, n_generatetime ); }