1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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.
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.
14#ifndef OSGFX_MULTITEXTURECONTROL
15#define OSGFX_MULTITEXTURECONTROL
19#include <osgFX/Export>
24 This node provides control over the which texture units are active and the
25 blending weighting between them.
27 class OSGFX_EXPORT MultiTextureControl: public osg::Group {
30 MultiTextureControl();
31 MultiTextureControl(const MultiTextureControl& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
33 META_Node(osgFX, MultiTextureControl);
35 typedef osg::FloatArray TextureWeights;
37 void setTextureWeights(TextureWeights* twl) { _textureWeights = twl; }
38 TextureWeights* getTextureWeights() { return _textureWeights.get(); }
39 const TextureWeights* getTextureWeights() const { return _textureWeights.get(); }
41 void setTextureWeight(unsigned int unit, float weight);
42 float getTextureWeight(unsigned int unit) const { return (unit<_textureWeights->size()) ? (*_textureWeights)[unit] : 0.0f; }
43 unsigned int getNumTextureWeights() const { return _textureWeights->size(); }
45 void setUseTexEnvCombine(bool flag) { _useTexEnvCombine = flag; }
46 bool getUseTexEnvCombine() const { return _useTexEnvCombine; }
48 void setUseTextureWeightsUniform(bool flag) { _useTextureWeightsUniform = flag; }
49 bool getUseTextureWeightsUniform() const { return _useTextureWeightsUniform; }
53 virtual ~MultiTextureControl() {}
54 MultiTextureControl& operator = (const MultiTextureControl&) { return *this; }
56 void updateStateSet();
58 osg::ref_ptr<TextureWeights> _textureWeights;
60 bool _useTexEnvCombine;
61 bool _useTextureWeightsUniform;