2012-03-22 01:36:20 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
2004-06-15 03:11:04 +08:00
|
|
|
*
|
2012-03-22 01:36:20 +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
|
2004-06-15 03:11:04 +08:00
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
2012-03-22 01:36:20 +08:00
|
|
|
*
|
2004-06-15 03:11:04 +08:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2012-03-22 01:36:20 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2004-06-15 03:11:04 +08:00
|
|
|
* 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);
|
2012-03-22 01:36:20 +08:00
|
|
|
|
|
|
|
|
2005-07-15 16:32:36 +08:00
|
|
|
enum ReferenceFrame
|
|
|
|
{
|
|
|
|
RELATIVE_RF,
|
|
|
|
ABSOLUTE_RF
|
|
|
|
};
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2005-07-15 16:32:36 +08:00
|
|
|
/** Set the TexGenNode's ReferenceFrame, either to be relative to its
|
|
|
|
* parent reference frame. */
|
|
|
|
void setReferenceFrame(ReferenceFrame rf);
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2010-09-24 22:53:10 +08:00
|
|
|
/** Get the TexGenNode's ReferenceFrame.*/
|
2005-07-15 16:32:36 +08:00
|
|
|
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);
|
2012-03-22 01:36:20 +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(); }
|
|
|
|
|
2007-01-11 18:35:03 +08:00
|
|
|
/** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
|
|
|
|
virtual void setThreadSafeRefUnref(bool threadSafe);
|
2004-06-15 03:11:04 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual ~TexGenNode();
|
|
|
|
|
2004-06-17 22:02:15 +08:00
|
|
|
unsigned int _textureUnit;
|
2004-06-15 03:11:04 +08:00
|
|
|
osg::ref_ptr<TexGen> _texgen;
|
2005-07-15 16:32:36 +08:00
|
|
|
|
|
|
|
ReferenceFrame _referenceFrame;
|
2004-06-15 03:11:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|