root/OpenSceneGraph/trunk/include/osgUtil/PositionalStateContainer @ 13041

Revision 13041, 2.8 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
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.
7 *
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.
12*/
13
14#ifndef OSGUTIL_POSTIONALSTATECONTIANER
15#define OSGUTIL_POSTIONALSTATECONTIANER 1
16
17#include <osg/Object>
18#include <osg/Light>
19#include <osg/State>
20
21#include <osgUtil/RenderLeaf>
22#include <osgUtil/StateGraph>
23
24namespace osgUtil {
25
26/**
27 * PositionalStateContainer base class. Used in RenderStage class.
28 */
29class OSGUTIL_EXPORT PositionalStateContainer : public osg::Object
30{
31    public:
32
33
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"; }
40
41        virtual void reset();
42
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;
46
47        AttrMatrixList& getAttrMatrixList() { return _attrList; }
48
49        virtual void addPositionedAttribute(osg::RefMatrix* matrix,const osg::StateAttribute* attr)
50        {
51            _attrList.push_back(AttrMatrixPair(attr,matrix));
52        }
53
54        TexUnitAttrMatrixListMap& getTexUnitAttrMatrixListMap() { return _texAttrListMap; }
55
56        virtual void addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix* matrix,const osg::StateAttribute* attr)
57        {
58            _texAttrListMap[textureUnit].push_back(AttrMatrixPair(attr,matrix));
59        }
60
61        virtual void draw(osg::State& state,RenderLeaf*& previous, const osg::Matrix* postMultMatrix = 0);
62
63    public:
64
65        AttrMatrixList              _attrList;
66        TexUnitAttrMatrixListMap    _texAttrListMap;
67
68    protected:
69
70        virtual ~PositionalStateContainer();
71
72};
73
74}
75
76#endif
77
Note: See TracBrowser for help on using the browser.