Added TextureWeights uniform support and controls to osgFX::MultiTextureControl to support usage with shaders.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14668 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
@@ -3,39 +3,15 @@
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkTextureWeights( const osgFX::MultiTextureControl& ctrl )
|
||||
{
|
||||
return ctrl.getNumTextureWeights()>0;
|
||||
}
|
||||
|
||||
static bool readTextureWeights( osgDB::InputStream& is, osgFX::MultiTextureControl& ctrl )
|
||||
{
|
||||
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
float weight = 0.0f; is >> weight;
|
||||
ctrl.setTextureWeight( i, weight );
|
||||
}
|
||||
is >> is.END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeTextureWeights( osgDB::OutputStream& os, const osgFX::MultiTextureControl& ctrl )
|
||||
{
|
||||
unsigned int size = ctrl.getNumTextureWeights();
|
||||
os.writeSize(size); os << os.BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
os << ctrl.getTextureWeight(i);
|
||||
}
|
||||
os << os.END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgFX_MultiTextureControl,
|
||||
new osgFX::MultiTextureControl,
|
||||
osgFX::MultiTextureControl,
|
||||
"osg::Object osg::Node osg::Group osgFX::MultiTextureControl" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( TextureWeights ); // _textureWeightList
|
||||
ADD_VECTOR_SERIALIZER( TextureWeights, osgFX::MultiTextureControl::TextureWeightList, osgDB::BaseSerializer::RW_FLOAT, 1.0f );
|
||||
{
|
||||
UPDATE_TO_VERSION_SCOPED( 116 )
|
||||
ADD_BOOL_SERIALIZER( UseTexEnvCombine, true );
|
||||
ADD_BOOL_SERIALIZER( UseTextureWeightsUniform, true );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user