Changeset 13428

Show
Ignore:
Timestamp:
04/24/14 12:49:57 (3 hours ago)
Author:
robert
Message:

From Mattias Helsing, "Seems I was only half right given what you asked for. CMP0017 only
says that modules that are found and ran from cmake modules dir should
prefer cmake-provided modules. find_package() and include() still look
in CMAKE_MODULE_PATH first.

After some investigating I've come up with a proposal examplified in
the attached FindGDAL.cmake script. It simply calls the cmake provided
FindGDAL.cmake if it exists and returns if it succeeds in finding GDAL
using that, otherwise continue with our local cmake code.
Pro: Wont clutter our root CMakeLists.txt
Con: If we begin to write more advanced Findxxx modules (using
COMPONENTS, REQUIRED etc.) we may have to revise this scheme.
"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgParticle/ParticleSystem.cpp

    r13041 r13428  
    140140        { 
    141141            osg::Matrixd modelview = *(cv->getModelViewMatrix()); 
    142             float scale = (_sortMode==SORT_FRONT_TO_BACK ? -1.0f : 1.0f); 
     142            double scale = (_sortMode==SORT_FRONT_TO_BACK ? -1.0 : 1.0); 
     143            double deadDistance = DBL_MAX; 
    143144            for (unsigned int i=0; i<_particles.size(); ++i) 
    144145            { 
     
    147148                    particle.setDepth(distance(particle.getPosition(), modelview) * scale); 
    148149                else 
    149                     particle.setDepth(0.0f); 
     150                    particle.setDepth(deadDistance); 
    150151            } 
    151152            std::sort<Particle_vector::iterator>(_particles.begin(), _particles.end()); 
     153 
     154            // Repopulate the death stack as it will have been invalidated by the sort. 
     155            unsigned int numDead = _deadparts.size(); 
     156            if (numDead>0) 
     157            {             
     158                 // clear the death stack 
     159                _deadparts = Death_stack(); 
     160                 
     161                // copy the tail of the _particles vector as this will contain all the dead Particle thanks to the depth sort against DBL_MAX 
     162                Particle* first_dead_ptr  = &_particles[_particles.size()-numDead]; 
     163                Particle* last_dead_ptr  = &_particles[_particles.size()-1]; 
     164                for(Particle* dead_ptr  = first_dead_ptr; dead_ptr<=last_dead_ptr; ++dead_ptr) 
     165                { 
     166                    _deadparts.push(dead_ptr); 
     167                } 
     168            } 
    152169        } 
    153170    }