2005-04-15 05:41:28 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2005 Robert Osfield
|
2004-06-15 03:11:04 +08:00
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSG_TexGenNode
|
|
|
|
#define OSG_TexGenNode 1
|
|
|
|
|
|
|
|
#include <osg/Group>
|
|
|
|
#include <osg/TexGen>
|
|
|
|
|
|
|
|
namespace osg {
|
|
|
|
|
2004-09-14 00:10:59 +08:00
|
|
|
/** Node for defining the position of TexGen in the scene. */
|
2005-04-12 01:14:17 +08:00
|
|
|
class OSG_EXPORT TexGenNode : public Group
|
2004-06-15 03:11:04 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
TexGenNode();
|
|
|
|
TexGenNode(TexGen* texgen);
|
|
|
|
|
|
|
|
TexGenNode(const TexGenNode& tgb, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
|
|
|
|
|
|
|
META_Node(osg, TexGenNode);
|
|
|
|
|
2004-06-17 22:02:15 +08:00
|
|
|
|
2005-07-15 16:32:36 +08:00
|
|
|
enum ReferenceFrame
|
|
|
|
{
|
|
|
|
RELATIVE_RF,
|
|
|
|
ABSOLUTE_RF
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Set the TexGenNode's ReferenceFrame, either to be relative to its
|
|
|
|
* parent reference frame. */
|
|
|
|
void setReferenceFrame(ReferenceFrame rf);
|
|
|
|
|
|
|
|
/** Ge thte TexGenNode's ReferenceFrame.*/
|
|
|
|
ReferenceFrame getReferenceFrame() const { return _referenceFrame; }
|
|
|
|
|
|
|
|
/** Set the texture unit that this TexGenNode is associated with.*/
|
2004-06-17 22:02:15 +08:00
|
|
|
void setTextureUnit(unsigned int textureUnit) { _textureUnit = textureUnit; }
|
|
|
|
|
|
|
|
unsigned int getTextureUnit() const { return _textureUnit; }
|
|
|
|
|
2004-09-14 00:10:59 +08:00
|
|
|
/** Set the TexGen. */
|
2004-06-15 03:11:04 +08:00
|
|
|
void setTexGen(TexGen* texgen);
|
2004-06-17 22:02:15 +08:00
|
|
|
|
2004-09-14 00:10:59 +08:00
|
|
|
/** Get the TexGen. */
|
2004-06-15 03:11:04 +08:00
|
|
|
inline TexGen* getTexGen() { return _texgen.get(); }
|
|
|
|
|
2004-09-14 00:10:59 +08:00
|
|
|
/** Get the const TexGen. */
|
2004-06-15 03:11:04 +08:00
|
|
|
inline const TexGen* getTexGen() const { return _texgen.get(); }
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual ~TexGenNode();
|
|
|
|
|
2004-06-17 22:02:15 +08:00
|
|
|
unsigned int _textureUnit;
|
2004-06-15 03:11:04 +08:00
|
|
|
StateAttribute::GLModeValue _value;
|
|
|
|
osg::ref_ptr<TexGen> _texgen;
|
2005-07-15 16:32:36 +08:00
|
|
|
|
|
|
|
ReferenceFrame _referenceFrame;
|
2004-06-15 03:11:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|