openscenegraph
TexGenNode
Go to the documentation of this file.
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 OSG_TexGenNode
15#define OSG_TexGenNode 1
16
17#include <osg/Group>
18#include <osg/TexGen>
19
20namespace osg {
21
22/** Node for defining the position of TexGen in the scene. */
23class OSG_EXPORT TexGenNode : public Group
24{
25
26 public:
27
28 TexGenNode();
29 TexGenNode(TexGen* texgen);
30
31 TexGenNode(const TexGenNode& tgb, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
32
33 META_Node(osg, TexGenNode);
34
35
36 enum ReferenceFrame
37 {
38 RELATIVE_RF,
39 ABSOLUTE_RF
40 };
41
42 /** Set the TexGenNode's ReferenceFrame, either to be relative to its
43 * parent reference frame. */
44 void setReferenceFrame(ReferenceFrame rf);
45
46 /** Get the TexGenNode's ReferenceFrame.*/
47 ReferenceFrame getReferenceFrame() const { return _referenceFrame; }
48
49 /** Set the texture unit that this TexGenNode is associated with.*/
50 void setTextureUnit(unsigned int textureUnit) { _textureUnit = textureUnit; }
51
52 unsigned int getTextureUnit() const { return _textureUnit; }
53
54 /** Set the TexGen. */
55 void setTexGen(TexGen* texgen);
56
57 /** Get the TexGen. */
58 inline TexGen* getTexGen() { return _texgen.get(); }
59
60 /** Get the const TexGen. */
61 inline const TexGen* getTexGen() const { return _texgen.get(); }
62
63 /** Set whether to use a mutex to ensure ref() and unref() are thread safe.*/
64 virtual void setThreadSafeRefUnref(bool threadSafe);
65
66 protected:
67
68 virtual ~TexGenNode();
69
70 unsigned int _textureUnit;
71 osg::ref_ptr<TexGen> _texgen;
72
73 ReferenceFrame _referenceFrame;
74};
75
76}
77
78#endif