386b87d4a0
Moved CullVisitor/RenderStage/RenderStageLighting across to managing lights entirely within RenderStageLighting, and changed the management of modelview matrices so that RenderLeaf now stores the absolute modelview matrix, rather than a model matrix as done previously. The later allows RenderLeaf's to do a glLoadMatrix rather than a glPushMatrix/glMultMatrix/glPopMatrix.
57 lines
1.6 KiB
Plaintext
57 lines
1.6 KiB
Plaintext
//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Robert Osfield
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
//as published by the Free Software Foundation.
|
|
|
|
#ifndef OSGUTIL_RENDERSTAGELIGHTING
|
|
#define OSGUTIL_RENDERSTAGELIGHTING 1
|
|
|
|
#include <osg/Object>
|
|
#include <osg/Light>
|
|
#include <osg/State>
|
|
|
|
#include <osgUtil/RenderLeaf>
|
|
#include <osgUtil/RenderGraph>
|
|
|
|
namespace osgUtil {
|
|
|
|
/**
|
|
* RenderBin base class.
|
|
*/
|
|
class OSGUTIL_EXPORT RenderStageLighting : public osg::Object
|
|
{
|
|
public:
|
|
|
|
|
|
RenderStageLighting();
|
|
virtual osg::Object* cloneType() const { return new RenderStageLighting(); }
|
|
virtual osg::Object* clone(const osg::CopyOp&) const { return new RenderStageLighting(); } // note only implements a clone of type.
|
|
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RenderStageLighting*>(obj)!=0L; }
|
|
virtual const char* className() const { return "RenderStageLighting"; }
|
|
|
|
virtual void reset();
|
|
|
|
typedef std::pair< osg::Light*, osg::ref_ptr<osg::Matrix> > LightMatrixPair;
|
|
typedef std::vector< LightMatrixPair > LightList;
|
|
|
|
virtual void addLight(osg::Light* light,osg::Matrix* matrix)
|
|
{
|
|
_lightList.push_back(LightMatrixPair(light,matrix));
|
|
}
|
|
|
|
virtual void draw(osg::State& state,RenderLeaf*& previous);
|
|
|
|
public:
|
|
|
|
LightList _lightList;
|
|
|
|
protected:
|
|
|
|
virtual ~RenderStageLighting();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|
|
|