openscenegraph
TangentSpaceGenerator
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
24namespace osgUtil
25{
26
39public:
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
59protected:
60
63
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
Definition TangentSpaceGenerator:38
osg::ref_ptr< osg::Vec4Array > T_
Definition TangentSpaceGenerator:70
osg::Vec4Array * getTangentArray()
Definition TangentSpaceGenerator:45
void generate(osg::Geometry *geo, int normal_map_tex_unit=0)
osg::ref_ptr< osg::UIntArray > indices_
Definition TangentSpaceGenerator:73
const osg::Vec4Array * getBinormalArray() const
Definition TangentSpaceGenerator:54
osg::Vec4Array * getBinormalArray()
Definition TangentSpaceGenerator:53
virtual ~TangentSpaceGenerator()
Definition TangentSpaceGenerator:61
osg::IndexArray * getIndices()
Definition TangentSpaceGenerator:57
void setNormalArray(osg::Vec4Array *array)
Definition TangentSpaceGenerator:51
osg::Vec4Array * getNormalArray()
Definition TangentSpaceGenerator:49
osg::ref_ptr< osg::Vec4Array > N_
Definition TangentSpaceGenerator:72
void compute(osg::PrimitiveSet *pset, const osg::Array *vx, const osg::Array *nx, const osg::Array *tx, int iA, int iB, int iC)
TangentSpaceGenerator(const TangentSpaceGenerator &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
void setTangentArray(osg::Vec4Array *array)
Definition TangentSpaceGenerator:47
void setBinormalArray(osg::Vec4Array *array)
Definition TangentSpaceGenerator:55
const osg::Vec4Array * getTangentArray() const
Definition TangentSpaceGenerator:46
osg::ref_ptr< osg::Vec4Array > B_
Definition TangentSpaceGenerator:71
const osg::Vec4Array * getNormalArray() const
Definition TangentSpaceGenerator:50
TangentSpaceGenerator & operator=(const TangentSpaceGenerator &)
Definition TangentSpaceGenerator:62
Definition Array:61
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Definition Geometry:31
Definition Array:320
Definition PrimitiveSet:125
Definition Referenced:44
A concrete array holding elements of type T.
Definition Array:243
Definition ref_ptr:32
Shader generator framework.
Definition NodeVisitor:25
#define OSGUTIL_EXPORT
Definition osgUtil/Export:40