- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgParticle/ExplosionDebrisEffect.cpp
r8500 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 30 30 { 31 31 setDefaults(); 32 32 33 33 _position.set(0.0f,0.0f,0.0f); 34 34 _scale = 1.0f; 35 35 _intensity = 1.0f; 36 36 37 37 _emitterDuration = 0.1; 38 38 _defaultParticleTemplate.setLifeTime(1.0+0.6*_scale); 39 39 40 40 if (_automaticSetup) buildEffect(); 41 41 } … … 44 44 { 45 45 setDefaults(); 46 46 47 47 _position = position; 48 48 _scale = scale; 49 49 _intensity = intensity; 50 50 51 51 _emitterDuration = 0.1; 52 52 _defaultParticleTemplate.setLifeTime(1.0+0.6*_scale); 53 53 54 54 if (_automaticSetup) buildEffect(); 55 55 } … … 64 64 { 65 65 ParticleEffect::setDefaults(); 66 67 _textureFileName = "Images/particle.rgb"; 66 67 _textureFileName = "Images/particle.rgb"; 68 68 _emitterDuration = 0.1; 69 69 70 70 // set up unit particle. 71 _defaultParticleTemplate.setLifeTime(1.0+0.6*_scale); 71 _defaultParticleTemplate.setLifeTime(1.0+0.6*_scale); 72 72 _defaultParticleTemplate.setSizeRange(osgParticle::rangef(0.75f, 3.0f)); 73 73 _defaultParticleTemplate.setAlphaRange(osgParticle::rangef(0.0f, 1.0f)); 74 74 _defaultParticleTemplate.setColorRange(osgParticle::rangev4( 75 osg::Vec4(0.5f, 0.5f, 0.0f, 1.0f), 75 osg::Vec4(0.5f, 0.5f, 0.0f, 1.0f), 76 76 osg::Vec4(0.2f, 0.2f, 0.2f, 0.5f))); 77 77 … … 93 93 osgParticle::Particle& ptemplate = _particleSystem->getDefaultParticleTemplate(); 94 94 95 float radius = 0.05f*_scale; 95 float radius = 0.05f*_scale; 96 96 float density = 1000.0f; // 1000.0kg/m^3 97 97 98 98 ptemplate.setLifeTime(_defaultParticleTemplate.getLifeTime()); 99 99 100 // the following ranges set the envelope of the respective 100 // the following ranges set the envelope of the respective 101 101 // graphical properties in time. 102 102 ptemplate.setSizeRange(osgParticle::rangef(radius*_defaultParticleTemplate.getSizeRange().minimum, … … 155 155 // set up program. 156 156 if (!_program) 157 { 157 { 158 158 _program = new osgParticle::FluidProgram; 159 159 } 160 160 161 161 if (_program.valid()) 162 162 { … … 164 164 _program->setWind(_wind); 165 165 } 166 166 167 167 } 168 168
