Added support for setting texture units in the new TexGenNode.
This commit is contained in:
@@ -170,6 +170,9 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
/** Add an attribute which is positioned related to the modelview matrix.*/
|
||||
inline void addPositionedAttribute(osg::RefMatrix* matrix,const osg::StateAttribute* attr);
|
||||
|
||||
/** Add an attribute which is positioned related to the modelview matrix.*/
|
||||
inline void addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix* matrix,const osg::StateAttribute* attr);
|
||||
|
||||
/** reimplement CullStack's popProjectionMatrix() adding clamping of the projection matrix to the computed near and far.*/
|
||||
virtual void popProjectionMatrix();
|
||||
|
||||
@@ -351,6 +354,12 @@ inline void CullVisitor::addPositionedAttribute(osg::RefMatrix* matrix,const osg
|
||||
_currentRenderBin->_stage->addPositionedAttribute(matrix,attr);
|
||||
}
|
||||
|
||||
/** Add an attribute which is positioned related to the modelview matrix.*/
|
||||
inline void CullVisitor::addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix* matrix,const osg::StateAttribute* attr)
|
||||
{
|
||||
_currentRenderBin->_stage->addPositionedTextureAttribute(textureUnit,matrix,attr);
|
||||
}
|
||||
|
||||
inline RenderLeaf* CullVisitor::createOrReuseRenderLeaf(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* matrix, float depth)
|
||||
{
|
||||
// skip of any already reused renderleaf.
|
||||
|
||||
@@ -117,6 +117,11 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
getRenderStageLighting()->addPositionedAttribute(matrix,attr);
|
||||
}
|
||||
|
||||
virtual void addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix* matrix,const osg::StateAttribute* attr)
|
||||
{
|
||||
getRenderStageLighting()->addPositionedTextureAttribute(textureUnit, matrix,attr);
|
||||
}
|
||||
|
||||
virtual void drawPreRenderStages(osg::State& state,RenderLeaf*& previous);
|
||||
|
||||
virtual void draw(osg::State& state,RenderLeaf*& previous);
|
||||
|
||||
@@ -41,18 +41,25 @@ class OSGUTIL_EXPORT RenderStageLighting : public osg::Object
|
||||
virtual void reset();
|
||||
|
||||
typedef std::pair< const osg::StateAttribute*, osg::ref_ptr<osg::RefMatrix> > AttrMatrixPair;
|
||||
typedef std::vector< AttrMatrixPair > AttrMatrixList;
|
||||
typedef std::vector< AttrMatrixPair > AttrMatrixList;
|
||||
typedef std::map< unsigned int, AttrMatrixList > TexUnitAttrMatrixListMap;
|
||||
|
||||
virtual void addPositionedAttribute(osg::RefMatrix* matrix,const osg::StateAttribute* attr)
|
||||
{
|
||||
_attrList.push_back(AttrMatrixPair(attr,matrix));
|
||||
}
|
||||
|
||||
virtual void addPositionedTextureAttribute(unsigned int textureUnit, osg::RefMatrix* matrix,const osg::StateAttribute* attr)
|
||||
{
|
||||
_texAttrListMap[textureUnit].push_back(AttrMatrixPair(attr,matrix));
|
||||
}
|
||||
|
||||
virtual void draw(osg::State& state,RenderLeaf*& previous);
|
||||
|
||||
public:
|
||||
|
||||
AttrMatrixList _attrList;
|
||||
AttrMatrixList _attrList;
|
||||
TexUnitAttrMatrixListMap _texAttrListMap;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user