Show
Ignore:
Timestamp:
04/14/06 16:24:12 (9 years ago)
Author:
robert
Message:

Refined the default settings for rain and snow to achieve better framerates.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgprecipitation/osgprecipitation.cpp

    r5090 r5091  
    4343        fogExponent(1.0), 
    4444        fogEnd(1000.0), 
    45         fogColour(0.5, 0.5, 0.5, 1.0) 
     45        fogColour(0.5, 0.5, 0.5, 1.0), 
     46        clearColour(0.5, 0.5, 0.5, 1.0) 
    4647    {} 
    4748 
     
    5051        particleVelocity = osg::Vec3(0.0,0.0,-2.0) + osg::Vec3(0.0,0.0,-10.0)*intensity; 
    5152        particleSize = 0.01 + 0.02*intensity; 
    52         numberOfParticles = intensity * 100000000; 
    5353        particleColour = osg::Vec4(0.6, 0.6, 0.6, 1.0) -  osg::Vec4(0.1, 0.1, 0.1, 1.0)* intensity; 
     54        numberOfParticles = intensity * 85000000; 
     55        numberOfCellsX = 50 + (int)(150.0f*intensity); 
     56        numberOfCellsY = 50 + (int)(150.0f*intensity); 
     57        farTransition = 140.0f - 100.0f*intensity; 
    5458        fogExponent = 1.0f; 
    5559        fogDensity = 0.01f*intensity; 
    5660        fogEnd = 250/(0.01 + intensity); 
    57         farTransition = 150.0f - 100.0f*intensity; 
     61        fogColour.set(0.5, 0.5, 0.5, 1.0); 
     62        clearColour.set(0.5, 0.5, 0.5, 1.0); 
    5863    } 
    5964 
     
    6267        particleVelocity = osg::Vec3(0.0,0.0,-1.0) + osg::Vec3(0.0,0.0,-0.5)*intensity; 
    6368        particleSize = 0.02 + 0.03*intensity; 
    64         numberOfParticles = intensity * 100000000; 
    6569        particleColour = osg::Vec4(0.85f, 0.85f, 0.85f, 1.0f) -  osg::Vec4(0.1f, 0.1f, 0.1f, 1.0f)* intensity; 
     70        numberOfParticles = intensity * 80000000; 
     71        numberOfCellsX = 50 + (int)(150.0f*intensity); 
     72        numberOfCellsY = 50 + (int)(150.0f*intensity); 
     73        farTransition = 140.0f - 100.0f*intensity; 
    6674        fogExponent = 1.0f; 
    6775        fogDensity = 0.02f*intensity; 
    6876        fogEnd = 150.0f/(0.01f + intensity); 
    69         farTransition = 150.0f - 100.0f*intensity; 
     77        fogColour.set(0.6, 0.6, 0.6, 1.0); 
     78        clearColour.set(0.6, 0.6, 0.6, 1.0); 
    7079    } 
    7180 
     
    8493    float               fogEnd; 
    8594    osg::Vec4           fogColour; 
     95    osg::Vec4           clearColour; 
    8696}; 
    8797 
     
    753763    while (arguments.read("--fogColour", parameters.fogColour.r(), parameters.fogColour.g(), parameters.fogColour.b(), parameters.fogColour.a())) {} 
    754764  
     765 
     766    viewer.setClearColor(parameters.clearColour); 
     767 
    755768    // if user request help write it out to cout. 
    756769    if (arguments.read("-h") || arguments.read("--help"))