1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
14#ifndef OSGUTIL_POSITIONALSTATECONTAINER
15#define OSGUTIL_POSITIONALSTATECONTAINER 1
21#include <osgUtil/RenderLeaf>
22#include <osgUtil/StateGraph>
27 * PositionalStateContainer base class. Used in RenderStage class.
29class OSGUTIL_EXPORT PositionalStateContainer : public osg::Object
34 PositionalStateContainer();
35 virtual osg::Object* cloneType() const { return new PositionalStateContainer(); }
36 virtual osg::Object* clone(const osg::CopyOp&) const { return new PositionalStateContainer(); } // note only implements a clone of type.
37 virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const PositionalStateContainer*>(obj)!=0L; }
38 virtual const char* libraryName() const { return "osgUtil"; }
39 virtual const char* className() const { return "PositionalStateContainer"; }
43 typedef std::pair< osg::ref_ptr<const osg::StateAttribute> , osg::ref_ptr<osg::RefMatrix> > AttrMatrixPair;
44 typedef std::vector< AttrMatrixPair > AttrMatrixList;
45 typedef std::map< unsigned int, AttrMatrixList > TexUnitAttrMatrixListMap;
47 AttrMatrixList& getAttrMatrixList() { return _attrList; }
49 virtual void addPositionedAttribute(osg::RefMatrix* matrix,const osg::StateAttribute* attr)
51 _attrList.push_back(AttrMatrixPair(attr,matrix));
54 TexUnitAttrMatrixListMap& getTexUnitAttrMatrixListMap() { return _texAttrListMap; }
56 virtual void addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix* matrix,const osg::StateAttribute* attr)
58 _texAttrListMap[textureUnit].push_back(AttrMatrixPair(attr,matrix));
61 virtual void draw(osg::State& state,RenderLeaf*& previous, const osg::Matrix* postMultMatrix = 0);
65 AttrMatrixList _attrList;
66 TexUnitAttrMatrixListMap _texAttrListMap;
70 virtual ~PositionalStateContainer();