| 1 | /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield |
|---|
| 2 | * |
|---|
| 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. |
|---|
| 7 | * |
|---|
| 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. |
|---|
| 12 | */ |
|---|
| 13 | |
|---|
| 14 | #ifndef OSGFX_MULTITEXTURECONTROL |
|---|
| 15 | #define OSGFX_MULTITEXTURECONTROL |
|---|
| 16 | |
|---|
| 17 | #include <osg/Group> |
|---|
| 18 | |
|---|
| 19 | #include <osgFX/Export> |
|---|
| 20 | |
|---|
| 21 | namespace osgFX |
|---|
| 22 | { |
|---|
| 23 | /** |
|---|
| 24 | This node provides control over the which texture units are active and the |
|---|
| 25 | blending weighting between them. |
|---|
| 26 | */ |
|---|
| 27 | class OSGFX_EXPORT MultiTextureControl: public osg::Group { |
|---|
| 28 | public: |
|---|
| 29 | |
|---|
| 30 | MultiTextureControl(); |
|---|
| 31 | MultiTextureControl(const MultiTextureControl& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); |
|---|
| 32 | |
|---|
| 33 | META_Node(osgFX, MultiTextureControl); |
|---|
| 34 | |
|---|
| 35 | void setTextureWeight(unsigned int unit, float weight); |
|---|
| 36 | |
|---|
| 37 | float getTextureWeight(unsigned int unit) const { return (unit<_textureWeightList.size()) ? _textureWeightList[unit] : 0.0f; } |
|---|
| 38 | |
|---|
| 39 | unsigned int getNumTextureWeights() const { return _textureWeightList.size(); } |
|---|
| 40 | |
|---|
| 41 | protected: |
|---|
| 42 | virtual ~MultiTextureControl() {} |
|---|
| 43 | MultiTextureControl& operator = (const MultiTextureControl&) { return *this; } |
|---|
| 44 | |
|---|
| 45 | void updateStateSet(); |
|---|
| 46 | |
|---|
| 47 | typedef std::vector<float> TextureWeightList; |
|---|
| 48 | TextureWeightList _textureWeightList; |
|---|
| 49 | }; |
|---|
| 50 | |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | #endif |
|---|