Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7696 in orxonox.OLD


Ignore:
Timestamp:
May 18, 2006, 4:25:18 PM (18 years ago)
Author:
amaechler
Message:

branches/atmospheric_engine: bug fixes and cleanup

Location:
branches/atmospheric_engine/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc

    r7691 r7696  
    6262{
    6363        //default values
    64         this->fogMode = GL_LINEAR;
    65         this->fogDensity = 0.1;
     64        this->fogMode = GL_EXP2;
     65        this->fogDensity = 0.001;
    6666        this->fogStart = 0;
    6767        this->fogEnd = 5000;
  • branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc

    r7691 r7696  
    2424#include "spark_particles.h"
    2525#include "plane_emitter.h"
     26#include "shell_command.h"
    2627
    2728#include "parser/tinyxml/tinyxml.h"
    2829
    29 //SHELL_COMMAND(activate, RainEffect, activateRain);
    30 //SHELL_COMMAND(deactivate, RainEffect, deactivateRain);
     30SHELL_COMMAND(activate, RainEffect, activateRain);
     31SHELL_COMMAND(deactivate, RainEffect, deactivateRain);
    3132
    3233using namespace std;
     
    4344                this->loadParams(root);
    4445
    45         //load sound
     46        //load rain sound
    4647        if (this->rainBuffer != NULL)
    4748                ResourceManager::getInstance()->unload(this->rainBuffer);
    4849        this->rainBuffer = (SoundBuffer*)ResourceManager::getInstance()->load("sound/rain.wav", WAV);
     50
     51        //load wind sound
     52        if (this->rainWindForce > 0) {
     53                if (this->windBuffer != NULL)
     54                        ResourceManager::getInstance()->unload(this->windBuffer);
     55                this->windBuffer = (SoundBuffer*)ResourceManager::getInstance()->load("sound/wind.wav", WAV);
     56        }
    4957
    5058        this->activate();
     
    5462{
    5563        this->deactivate();
     64
     65        if (this->rainBuffer != NULL)
     66                ResourceManager::getInstance()->unload(this->rainBuffer);
     67
     68        if (this->windBuffer != NULL)
     69                ResourceManager::getInstance()->unload(this->windBuffer);
    5670}
    5771
     
    114128
    115129        this->emitter->setSpread(this->rainWindForce / 50, 0.2);
    116 
     130       
    117131        this->soundSource.loop(this->rainBuffer);
    118         PRINTF(0)( "Playing RainSound\n" );
     132        if (this->rainWindForce > 0)
     133                this->soundSource.loop(this->windBuffer);
    119134}
    120135
     
    123138{
    124139        PRINTF(0)("Deactivating RainEffect\n");
     140        this->emitter->setSystem(NULL);
    125141
    126         this->emitter->setSystem(NULL);
     142        this->soundSource.stop();
    127143}
     144
     145void RainEffect::activateRain()
     146{
     147        this->activate();
     148}
     149
     150void RainEffect::deactivateRain()
     151{
     152        this->deactivate();
     153}
     154
    128155
    129156void RainEffect::tick (float dt)
  • branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.h

    r7685 r7696  
    3434                virtual bool deactivate();
    3535
     36                void activateRain();
     37                void deactivateRain();
     38
    3639                virtual void tick(float dt);
    3740
     
    6063                SoundSource                                                                                             soundSource;
    6164                SoundBuffer*                                                                                    rainBuffer;
     65                SoundBuffer*                                                                                    windBuffer;
    6266};
    6367
  • branches/atmospheric_engine/src/lib/graphics/effects/snow_effect.cc

    r7683 r7696  
    1717#include "util/loading/load_param.h"
    1818#include "util/loading/factory.h"
     19#include "util/loading/resource_manager.h"
    1920
    2021#include "glincl.h"
     
    4445        if (root != NULL)
    4546                this->loadParams(root);
     47
     48        //load wind sound
     49        if (this->snowWindForce > 1) {
     50                if (this->windBuffer != NULL)
     51                        ResourceManager::getInstance()->unload(this->windBuffer);
     52                this->windBuffer = (SoundBuffer*)ResourceManager::getInstance()->load("sound/wind.wav", WAV);
     53        }
    4654
    4755        this->activate();
     
    7785
    7886        // Default values
    79         particles = 12000;
    80         texture = "maps/snow_flake_01_32x32.png";
    81         life = 8;
    82         randomLife = 2;
    83         snowRadius = 3.5;
    84         randomRadius = 1;
    85         snowMass = 1.0;
    86         randomMass = 0.3;
    87         rate = 900;
    88         velocity = -100;
    89         randomVelocity = 5;
    90         angle = 0.5;
    91         randomAngle = 0.2;
    92         alpha = 0.5;
    93         snowSize = Vector2D(2500, 2500);
    94   snowCoord = Vector(100,450,400);
    95 
    96         activated = false;
     87        this->particles = 12000;
     88        this->texture = "maps/snow_flake_01_32x32.png";
     89        this->life = 8;
     90        this->randomLife = 2;
     91        this->snowRadius = 3.5;
     92        this->randomRadius = 1;
     93        this->snowMass = 1.0;
     94        this->randomMass = 0.3;
     95        this->rate = 900;
     96        this->velocity = -100;
     97        this->randomVelocity = 5;
     98        this->angle = 0.5;
     99        this->randomAngle = 0.2;
     100        this->alpha = 0.5;
     101        this->snowSize = Vector2D(2500, 2500);
     102  this->snowCoord = Vector(100,450,400);
     103        this->snowWindForce = 1;
     104
     105        this->activated = false;
    97106}
    98107
     
    119128        this->emitter->setEmissionRate(rate);
    120129        this->emitter->setEmissionVelocity(velocity, randomVelocity);
    121         this->emitter->setSpread(angle, randomAngle);
     130        this->emitter->setSpread(angle * this->snowWindForce , randomAngle * this->snowWindForce);
    122131        this->emitter->setSize(snowSize);
    123  
     132
    124133  //SnowEffect::snowParticles->precache(8);
     134
     135        if (this->snowWindForce > 1)
     136                this->soundSource.loop(this->windBuffer);
    125137}
    126138
     
    132144
    133145        this->emitter->setSystem(NULL);
     146
     147        if (this->windBuffer != NULL)
     148                ResourceManager::getInstance()->unload(this->windBuffer);
     149
    134150}
    135151
  • branches/atmospheric_engine/src/lib/graphics/effects/snow_effect.h

    r7683 r7696  
    1616class PlaneEmitter;
    1717class PNode;
     18
     19#include "sound_buffer.h"
     20#include "sound_source.h"
    1821
    1922class SnowEffect : public WeatherEffect
     
    3639                void deactivateSnow();
    3740
     41                inline void numParticles(int n) { this->particles = n; }
     42                inline void materialTexture(const std::string& texture) { this->texture = texture; }
     43                inline void lifeSpan(float lifeSpan, float randomLifeSpan) { this->life = lifeSpan; this->randomLife = randomLifeSpan; }
     44                inline void radius(float radius, float randomRadius) { this->snowRadius = radius; this->randomRadius = randomRadius; }
     45                inline void mass(float mass, float randomMass) { this->snowMass = mass; this->randomMass = randomMass; }
     46                inline void emissionRate(float emissionRate){ this->rate = emissionRate; }
     47                inline void emissionVelocity(float velocity, float randomVelocity){ this->velocity = velocity; this->randomVelocity = randomVelocity; }
     48                inline void size(float sizeX, float sizeY) { this->snowSize = Vector2D(sizeX, sizeY); }
     49                inline void coord(float x, float y, float z) { this->snowCoord = Vector(x, y, z); }
     50    inline void wind(int force) { this->snowWindForce = force; }
     51
     52
    3853        private:
    39                 void numParticles(int n) { this->particles = n; }
    40                 void materialTexture(const std::string& texture) { this->texture = texture; }
    41                 void lifeSpan(float lifeSpan, float randomLifeSpan) { this->life = lifeSpan; this->randomLife = randomLifeSpan; }
    42                 void radius(float radius, float randomRadius) { this->snowRadius = radius; this->randomRadius = randomRadius; }
    43                 void mass(float mass, float randomMass) { this->snowMass = mass; this->randomMass = randomMass; }
    44                 void emissionRate(float emissionRate){ this->rate = emissionRate; }
    45                 void emissionVelocity(float velocity, float randomVelocity){ this->velocity = velocity; this->randomVelocity = randomVelocity; }
    46                 void size(float sizeX, float sizeY) { this->snowSize = Vector2D(sizeX, sizeY); }
    47                 void coord(float x, float y, float z) { this->snowCoord = Vector(x, y, z); }
    48     void wind(int force) { this->angle = angle*force; this->randomAngle = randomAngle*force; }
     54                int                                                                                                                             particles;
     55                std::string                                                                                             texture;
     56                float                                                                                                                   life, randomLife;
     57                float                                                                                                                           snowRadius, randomRadius;
     58                float                                                                                                                           snowMass, randomMass;
     59                float                                                                                                                   rate;
     60                float                                                                                                                   velocity, randomVelocity;
     61                float                                                                                                                   angle, randomAngle;
     62                float                                                                                                                   alpha;
     63                Vector                                                                                                                  snowCoord;
     64                Vector2D                                                                                                                snowSize;
     65                int                                                                                                                                     snowWindForce;
    4966
    50                 int particles;
    51                 std::string texture;
    52                 float life, randomLife;
    53                 float snowRadius, randomRadius;
    54                 float snowMass, randomMass;
    55                 float rate;
    56                 float velocity, randomVelocity;
    57                 float angle, randomAngle;
    58                 float alpha;
    59                 Vector snowCoord;
    60                 Vector2D snowSize;
     67                bool                                                                                                                            activated;
    6168
    62                 bool activated;
     69                PlaneEmitter*                                                                                           emitter;
    6370
    64                 static SpriteParticles* snowParticles;
     71                static SpriteParticles*                                                 snowParticles;
    6572
    66                 PlaneEmitter*          emitter;
     73                SoundSource                                                                                                     soundSource;
     74                SoundBuffer*                                                                                            windBuffer;
    6775};
    6876
  • branches/atmospheric_engine/src/world_entities/space_ships/helicopter.cc

    r7647 r7696  
    5151{
    5252  this->setPlayer(NULL);
     53
     54  if (this->chopperBuffer != NULL)
     55    ResourceManager::getInstance()->unload(this->chopperBuffer);
    5356}
    5457
     
    215218
    216219  this->soundSource.loop(this->chopperBuffer);
    217   PRINTF(0)( "Playing ChopperSound\n" );
     220  // PRINTF(0)( "Playing ChopperSound\n" );
    218221}
    219222
     
    222225  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
    223226  this->detachCamera();
    224 
     227  this->soundSource.stop();
    225228}
    226229
Note: See TracChangeset for help on using the changeset viewer.