2 * Copyright (C) 2017 Julien Valentin <mp3butcher@hotmail.com>
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.
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.
15#ifndef OSGANIMATION_MORPH_TRANSFORM_HARDWARE
16#define OSGANIMATION_MORPH_TRANSFORM_HARDWARE 1
18#include <osgAnimation/Export>
19#include <osgAnimation/RigTransform>
20#include <osgAnimation/VertexInfluence>
21#include <osgAnimation/Bone>
25///texture unit reserved for morphtarget TBO
26#define MORPHTRANSHW_DEFAULTMORPHTEXTUREUNIT 7
32 /// This class manage format for hardware morphing
33 class OSGANIMATION_EXPORT MorphTransformHardware : public MorphTransform
37 MorphTransformHardware();
39 MorphTransformHardware(const MorphTransformHardware& rth, const osg::CopyOp& copyop);
41 META_Object(osgAnimation,MorphTransformHardware);
43 virtual void operator()(MorphGeometry&);
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(); }
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; }
55 bool init(MorphGeometry&);
57 osg::ref_ptr<osg::Uniform> _uniformTargetsWeight;
58 osg::ref_ptr<osg::Shader> _shader;
61 unsigned int _reservedTextureUnit;