Show
Ignore:
Timestamp:
06/08/06 16:32:02 (9 years ago)
Author:
robert
Message:

From Paul Martz, added support to textured light points into osgSim and OpenFlight? loader, as part of the OpenFlight? v16.0 spec.

Files:
1 modified

Legend:

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

    r4718 r5168  
    88#include <osg/ShapeDrawable> 
    99#include <osg/Notify> 
     10#include <osg/PointSprite> 
     11#include <osg/Texture2D> 
     12#include <osg/BlendFunc> 
    1013 
    1114#include <osgDB/Registry> 
     
    4851 
    4952#undef INTERPOLATE 
     53 
     54bool usePointSprites; 
    5055 
    5156osg::Node* createLightPointsDatabase() 
     
    97102 
    98103        osgSim::LightPointNode* lpn = new osgSim::LightPointNode; 
     104 
     105        // 
     106        osg::StateSet* set = lpn->getOrCreateStateSet(); 
     107 
     108        if (usePointSprites) 
     109        { 
     110            lpn->setPointSprite(); 
     111 
     112            // Set point sprite texture in LightPointNode StateSet. 
     113            osg::Texture2D *tex = new osg::Texture2D(); 
     114            tex->setImage(osgDB::readImageFile("Images/particle.rgb")); 
     115            set->setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON); 
     116        } 
     117 
     118        //set->setMode(GL_BLEND, osg::StateAttribute::ON); 
     119        //osg::BlendFunc *fn = new osg::BlendFunc(); 
     120        //fn->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::DST_ALPHA); 
     121        //set->setAttributeAndModes(fn, osg::StateAttribute::ON); 
     122        // 
     123 
    99124        addToLightPointNode(*lpn,start,end,noStepsX); 
    100125         
     
    173198    arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); 
    174199    arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
     200    arguments.getApplicationUsage()->addCommandLineOption("--sprites","Point sprites."); 
    175201 
    176202    // construct the viewer. 
     
    189215        return 1; 
    190216    } 
     217 
     218    usePointSprites = false; 
     219    while (arguments.read("--sprites")) { usePointSprites = true; }; 
    191220 
    192221    // any option left unread are converted into errors to write out later.