Added s/getMaxNumOfTextureUnits control to osgGA::StateSetManipulator, and set the default to 4.
This commit is contained in:
@@ -53,6 +53,9 @@ public:
|
||||
|
||||
/** Get the keyboard and mouse usage of this manipulator.*/
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
void setMaximumNumOfTextureUnits(unsigned int i) { _maxNumOfTextureUnits = i; }
|
||||
unsigned int getMaximumNumOfTextureUnits() const { return _maxNumOfTextureUnits; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -62,6 +65,7 @@ protected:
|
||||
bool _backface;
|
||||
bool _lighting;
|
||||
bool _texture;
|
||||
unsigned int _maxNumOfTextureUnits;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,11 @@
|
||||
using namespace osg;
|
||||
using namespace osgGA;
|
||||
|
||||
StateSetManipulator::StateSetManipulator(): _drawState(NULL)
|
||||
StateSetManipulator::StateSetManipulator():
|
||||
_backface(false),
|
||||
_lighting(false),
|
||||
_texture(false),
|
||||
_maxNumOfTextureUnits(4)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -83,10 +87,9 @@ bool StateSetManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& aa)
|
||||
// ( _drawState->getAttribute( osg::StateAttribute::TEXTURE ) );
|
||||
// cout << tex->numTextureUnits() << endl;
|
||||
|
||||
unsigned int nunit = 8; // should actually use the _real_ num units here, but how?
|
||||
unsigned int mode = osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF;
|
||||
if ( _texture ) mode = osg::StateAttribute::INHERIT|osg::StateAttribute::ON;
|
||||
for( unsigned int ii=0; ii<nunit; ii++ )
|
||||
for( unsigned int ii=0; ii<_maxNumOfTextureUnits; ii++ )
|
||||
{
|
||||
_drawState->setTextureMode( ii, GL_TEXTURE_1D, mode );
|
||||
_drawState->setTextureMode( ii, GL_TEXTURE_2D, mode );
|
||||
|
||||
@@ -34,6 +34,9 @@ BEGIN_OBJECT_REFLECTOR(osgGA::StateSetManipulator)
|
||||
I_Method2(bool, handle, IN, const osgGA::GUIEventAdapter &, ea, IN, osgGA::GUIActionAdapter &, us);
|
||||
I_Method1(void, accept, IN, osgGA::GUIEventHandlerVisitor &, x);
|
||||
I_Method1(void, getUsage, IN, osg::ApplicationUsage &, usage);
|
||||
I_Method1(void, setMaximumNumOfTextureUnits, IN, unsigned int, i);
|
||||
I_Method0(unsigned int, getMaximumNumOfTextureUnits);
|
||||
I_Property(unsigned int, MaximumNumOfTextureUnits);
|
||||
I_Property(osg::StateSet *, StateSet);
|
||||
END_REFLECTOR
|
||||
|
||||
|
||||
Reference in New Issue
Block a user