Changed osgFX::MultiTextureControl so that it uses an osg::FloatArray internally to enable sharing with osg::Uniform.

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14675 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2015-01-23 13:51:09 +00:00
parent 22cf4c18c3
commit 4bcf4cf7bb
3 changed files with 65 additions and 25 deletions

View File

@@ -32,15 +32,15 @@ namespace osgFX
META_Node(osgFX, MultiTextureControl);
typedef std::vector<float> TextureWeightList;
typedef osg::FloatArray TextureWeights;
void setTextureWeights(const TextureWeightList& twl) { _textureWeightList = twl; }
TextureWeightList& getTextureWeights() { return _textureWeightList; }
const TextureWeightList& getTextureWeights() const { return _textureWeightList; }
void setTextureWeights(TextureWeights* twl) { _textureWeights = twl; }
TextureWeights* getTextureWeights() { return _textureWeights.get(); }
const TextureWeights* getTextureWeights() const { return _textureWeights.get(); }
void setTextureWeight(unsigned int unit, float weight);
float getTextureWeight(unsigned int unit) const { return (unit<_textureWeightList.size()) ? _textureWeightList[unit] : 0.0f; }
unsigned int getNumTextureWeights() const { return _textureWeightList.size(); }
float getTextureWeight(unsigned int unit) const { return (unit<_textureWeights->size()) ? (*_textureWeights)[unit] : 0.0f; }
unsigned int getNumTextureWeights() const { return _textureWeights->size(); }
void setUseTexEnvCombine(bool flag) { _useTexEnvCombine = flag; }
bool getUseTexEnvCombine() const { return _useTexEnvCombine; }
@@ -49,12 +49,13 @@ namespace osgFX
bool getUseTextureWeightsUniform() const { return _useTextureWeightsUniform; }
protected:
virtual ~MultiTextureControl() {}
MultiTextureControl& operator = (const MultiTextureControl&) { return *this; }
void updateStateSet();
TextureWeightList _textureWeightList;
osg::ref_ptr<TextureWeights> _textureWeights;
bool _useTexEnvCombine;
bool _useTextureWeightsUniform;