OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TangentSpaceGenerator.h
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 OSGUTIL_TANGENTSPACEGENERATOR_
15 #define OSGUTIL_TANGENTSPACEGENERATOR_
16 
17 #include <osgUtil/Export>
18 
19 #include <osg/ref_ptr>
20 #include <osg/Referenced>
21 #include <osg/Array>
22 #include <osg/Geometry>
23 
24 namespace osgUtil
25 {
26 
39 public:
42 
43  void generate(osg::Geometry *geo, int normal_map_tex_unit = 0);
44 
45  inline osg::Vec4Array *getTangentArray() { return T_.get(); }
46  inline const osg::Vec4Array *getTangentArray() const { return T_.get(); }
47  inline void setTangentArray(osg::Vec4Array *array) { T_ = array; }
48 
49  inline osg::Vec4Array *getNormalArray() { return N_.get(); }
50  inline const osg::Vec4Array *getNormalArray() const { return N_.get(); }
51  inline void setNormalArray(osg::Vec4Array *array) { N_ = array; }
52 
53  inline osg::Vec4Array *getBinormalArray() { return B_.get(); }
54  inline const osg::Vec4Array *getBinormalArray() const { return B_.get(); }
55  inline void setBinormalArray(osg::Vec4Array *array) { B_ = array; }
56 
57  inline osg::IndexArray *getIndices() { return indices_.get(); }
58 
59 protected:
60 
63 
64  void compute(osg::PrimitiveSet *pset,
65  const osg::Array *vx,
66  const osg::Array *nx,
67  const osg::Array *tx,
68  int iA, int iB, int iC);
69 
74 };
75 
76 }
77 
78 #endif
const osg::Vec4Array * getBinormalArray() const
void setTangentArray(osg::Vec4Array *array)
osg::ref_ptr< osg::UIntArray > indices_
const osg::Vec4Array * getNormalArray() const
osg::ref_ptr< osg::Vec4Array > N_
osg::ref_ptr< osg::Vec4Array > B_
void setNormalArray(osg::Vec4Array *array)
#define OSGUTIL_EXPORT
Definition: Export.h:40
void setBinormalArray(osg::Vec4Array *array)
const osg::Vec4Array * getTangentArray() const
TangentSpaceGenerator & operator=(const TangentSpaceGenerator &)
Shader generator framework.
Definition: RenderInfo.h:20
osg::ref_ptr< osg::Vec4Array > T_