openscenegraph
MorphTransformHardware
Go to the documentation of this file.
1/* -*-c++-*-
2 * Copyright (C) 2017 Julien Valentin <mp3butcher@hotmail.com>
3 *
4 * This library is open source and may be redistributed and/or modified under
5 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
6 * (at your option) any later version. The full license is in LICENSE file
7 * included with this distribution, and on the openscenegraph.org website.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * OpenSceneGraph Public License for more details.
13 */
14
15#ifndef OSGANIMATION_MORPH_TRANSFORM_HARDWARE
16#define OSGANIMATION_MORPH_TRANSFORM_HARDWARE 1
17
18#include <osgAnimation/Export>
19#include <osgAnimation/RigTransform>
20#include <osgAnimation/VertexInfluence>
21#include <osgAnimation/Bone>
22#include <osg/Matrix>
23#include <osg/Array>
24
25///texture unit reserved for morphtarget TBO
26#define MORPHTRANSHW_DEFAULTMORPHTEXTUREUNIT 7
27
28namespace osgAnimation
29{
30 class MorphGeometry;
31
32 /// This class manage format for hardware morphing
33 class OSGANIMATION_EXPORT MorphTransformHardware : public MorphTransform
34 {
35 public:
36
37 MorphTransformHardware();
38
39 MorphTransformHardware(const MorphTransformHardware& rth, const osg::CopyOp& copyop);
40
41 META_Object(osgAnimation,MorphTransformHardware);
42
43 virtual void operator()(MorphGeometry&);
44
45 inline void setShader( osg::Shader*s ) { _shader=s; }
46 inline const osg::Shader * getShader() const { return _shader.get(); }
47 inline osg::Shader * getShader() { return _shader.get(); }
48
49 ///texture unit reserved for morphtarget TBO default is 7
50 void setReservedTextureUnit(unsigned int t) { _reservedTextureUnit=t; }
51 unsigned int getReservedTextureUnit() const { return _reservedTextureUnit; }
52
53 protected:
54
55 bool init(MorphGeometry&);
56
57 osg::ref_ptr<osg::Uniform> _uniformTargetsWeight;
58 osg::ref_ptr<osg::Shader> _shader;
59
60 bool _needInit;
61 unsigned int _reservedTextureUnit;
62 };
63}
64
65#endif