OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AntiSquish.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 //osgDragger - Copyright (C) 2007 Fugro-Jason B.V.
14 
15 #ifndef _OSG_ANTISQUISH_
16 #define _OSG_ANTISQUISH_ 1
17 
18 #include <osgManipulator/Export>
19 
20 #include <osg/Transform>
21 #include <OpenThreads/Mutex>
22 
23 namespace osgManipulator {
24 
29 {
30  public :
31  AntiSquish();
32  AntiSquish(const osg::Vec3d& pivot);
33  AntiSquish(const osg::Vec3d& pivot, const osg::Vec3d& position);
35 
36  virtual osg::Object* cloneType() const { return new AntiSquish(); }
37 
38  virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new AntiSquish (*this,copyop); }
39 
40  virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const AntiSquish *>(obj)!=NULL; }
41 
42  virtual const char* libraryName() const { return "osgManipulator"; }
43 
44  virtual const char* className() const { return "AntiSquish"; }
45 
46 
47  void setPivot(const osg::Vec3d& pvt)
48  {
49  _pivot = pvt;
50  _usePivot = true;
51  _cacheDirty = true;
52  }
53 
54  const osg::Vec3d& getPivot() const { return _pivot; }
55 
56  void setPosition(const osg::Vec3d& pos)
57  {
58  _position = pos;
59  _usePosition = true;
60  _cacheDirty = true;
61  }
62 
63  const osg::Vec3d& getPosition() const { return _position; }
64 
65  bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor*) const;
66  bool computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisitor*) const;
67 
68  protected:
69 
70  virtual ~AntiSquish();
71 
72  bool computeUnSquishedMatrix(osg::Matrix&) const;
73 
75  bool _usePivot;
76 
79 
81  mutable bool _cacheDirty;
84 };
85 
86 }
87 #endif
void setPosition(const osg::Vec3d &pos)
Definition: AntiSquish.h:56
#define NULL
Definition: Export.h:59
This class provides an object-oriented thread mutex interface.
Definition: Mutex.h:31
#define OSGMANIPULATOR_EXPORT
Definition: Export.h:27
OpenThreads::Mutex _cacheLock
Definition: AntiSquish.h:80
virtual const char * libraryName() const
Definition: AntiSquish.h:42
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Definition: AntiSquish.h:38
virtual const char * className() const
Definition: AntiSquish.h:44
virtual osg::Object * cloneType() const
Definition: AntiSquish.h:36
osg::Matrix _cacheLocalToWorld
Definition: AntiSquish.h:82
void setPivot(const osg::Vec3d &pvt)
Definition: AntiSquish.h:47
const osg::Vec3d & getPivot() const
Definition: AntiSquish.h:54
virtual bool isSameKindAs(const osg::Object *obj) const
Definition: AntiSquish.h:40
const osg::Vec3d & getPosition() const
Definition: AntiSquish.h:63