Show
Ignore:
Timestamp:
04/17/06 21:10:06 (8 years ago)
Author:
robert
Message:

Standardised the bin number of the particle effects

Files:
1 modified

Legend:

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

    r5093 r5095  
    2525#include <osg/PointSprite> 
    2626#include <osg/io_utils> 
     27 
     28#define USE_LOCAL_SHADERS 1 
    2729 
    2830float random(float min,float max) { return min + (max-min)*(float)rand()/(float)RAND_MAX; } 
     
    437439void setUpGeometries(unsigned int numParticles) 
    438440{ 
     441    unsigned int renderBin = 11; 
     442 
    439443    { 
    440444        quad_geometry = new osg::Geometry; 
     
    444448        osg::Program* program = new osg::Program; 
    445449        quad_stateset->setAttribute(program); 
    446         quad_stateset->setRenderBinDetails(13,"DepthSortedBin"); 
    447  
    448 #if 1 
     450        quad_stateset->setRenderBinDetails(renderBin,"DepthSortedBin"); 
     451 
     452#ifdef USE_LOCAL_SHADERS 
    449453        char vertexShaderSource[] =  
    450454            "uniform vec3 dv_i;\n" 
     
    523527        osg::Program* program = new osg::Program; 
    524528        line_stateset->setAttribute(program); 
    525         line_stateset->setRenderBinDetails(12,"DepthSortedBin"); 
    526  
    527 #if 1 
     529        line_stateset->setRenderBinDetails(renderBin,"DepthSortedBin"); 
     530 
     531#ifdef USE_LOCAL_SHADERS 
    528532        char vertexShaderSource[] =  
    529533            "uniform vec3 dv_i;\n" 
     
    601605        point_stateset->setAttribute(program); 
    602606 
    603 #if 1 
     607#ifdef USE_LOCAL_SHADERS 
    604608        char vertexShaderSource[] =  
    605609            "uniform vec3 dv_i;\n" 
     
    629633            "    gl_Position = gl_ModelViewProjectionMatrix * vec4(v_current,1.0);\n" 
    630634            "\n" 
    631             "    //float pointSize = min(abs(1280*particleSize / gl_Position.w), 20.0);\n" 
    632             "    float pointSize = abs(1280*particleSize / gl_Position.w);\n" 
     635            "    float pointSize = abs(1280.0*particleSize / gl_Position.w);\n" 
    633636            "    //gl_PointSize = max(ceil(pointSize),2);\n" 
    634637            "    gl_PointSize = ceil(pointSize);\n" 
     
    660663 
    661664        point_stateset->setMode(GL_VERTEX_PROGRAM_POINT_SIZE, osg::StateAttribute::ON); 
    662         point_stateset->setRenderBinDetails(11,"DepthSortedBin"); 
     665        point_stateset->setRenderBinDetails(renderBin,"DepthSortedBin"); 
    663666    } 
    664667