~ubuntu-branches/debian/sid/openscenegraph/sid

« back to all changes in this revision

Viewing changes to OpenSceneGraph/src/osgParticle/ParticleEffect.cpp

  • Committer: Package Import Robot
  • Author(s): Manuel A. Fernandez Montecelo, Alberto Luaces, Manuel A. Fernandez Montecelo
  • Date: 2013-07-30 13:07:57 UTC
  • mfrom: (1.4.3)
  • Revision ID: package-import@ubuntu.com-20130730130757-b3weq3502sennb16
Tags: 3.2.0~rc1-1
[Alberto Luaces]
* New upstream release.
* Updated standards version (3.9.4).
* Updated SVN URL.
* Removed the static version of the libraries since they impose a huge
  load on the build servers, add additional complexity on the build
  scripts, and make a great impact on the size of the packages, given
  the very small cases where they are useful.
* Acknowledge NMU.

[ Manuel A. Fernandez Montecelo ]
* Switch to @debian.org address

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
*/
13
13
 
35
35
void ParticleEffect::setUseLocalParticleSystem(bool local)
36
36
{
37
37
    if (_useLocalParticleSystem==local) return;
38
 
    
 
38
 
39
39
    _useLocalParticleSystem = local;
40
40
 
41
41
    if (_automaticSetup) buildEffect();
85
85
void ParticleEffect::setStartTime(double startTime)
86
86
{
87
87
    if (_startTime==startTime) return;
88
 
    
 
88
 
89
89
    _startTime =startTime;
90
90
 
91
91
    if (_automaticSetup) setUpEmitterAndProgram();
105
105
    if (_defaultParticleTemplate.getLifeTime()==duration) return;
106
106
 
107
107
    _defaultParticleTemplate.setLifeTime(duration);
108
 
    
 
108
 
109
109
    if (_automaticSetup) setUpEmitterAndProgram();
110
110
}
111
111
 
121
121
void ParticleEffect::setParticleSystem(ParticleSystem* ps)
122
122
{
123
123
    if (_particleSystem==ps) return;
124
 
    
 
124
 
125
125
    _particleSystem = ps;
126
126
 
127
127
    if (_automaticSetup) buildEffect();
145
145
    osg::ref_ptr<Program> program = getProgram();
146
146
    osg::ref_ptr<ParticleSystem> particleSystem = getParticleSystem();
147
147
 
148
 
    if (!emitter || !particleSystem || !program) return; 
 
148
    if (!emitter || !particleSystem || !program) return;
149
149
 
150
150
 
151
151
    // clear the children.
152
152
    removeChildren(0,getNumChildren());
153
 
    
 
153
 
154
154
    // add the emitter
155
155
    addChild(emitter.get());
156
 
    
 
156
 
157
157
    // add the program to update the particles
158
158
    addChild(program.get());
159
159
 
165
165
    if (_useLocalParticleSystem)
166
166
    {
167
167
        particleSystem->setParticleScaleReferenceFrame(ParticleSystem::LOCAL_COORDINATES);
168
 
    
 
168
 
169
169
        // add the geode to the scene graph
170
170
        osg::Geode* geode = new osg::Geode;
171
171
        geode->addDrawable(particleSystem.get());