19 #include "visbasemod.h" 23 namespace osg {
class Vec3f;
class Array;
class Referenced; }
26 #define mGetOsgArrPtr(tp,ptr) ((tp) ptr->getDataPointer() ) 27 #define mGetOsgVec2Arr(ptr) ((osg::Vec2Array*) ptr ) 28 #define mGetOsgVec3Arr(ptr) ((osg::Vec3Array*) ptr ) 29 #define mGetOsgVec4Arr(ptr) ((osg::Vec4Array*) ptr ) 31 #if defined(visBase_EXPORTS) || defined(VISBASE_EXPORTS) || \ 32 defined(uiOSG_EXPORTS) || defined(UIOSG_EXPORTS) 45 void unRefOsgPtr(osg::Referenced*);
46 void refOsgPtr(
const osg::Referenced*);
47 void unRefAndZeroOsgPtr(osg::Referenced*);
55 inline void set(
Coord3& _to,
const osg::Vec3f& v )
56 { _to.x = v[0]; _to.y=v[1]; _to.z=v[2]; }
59 inline void set( osg::Vec3f& _to,
const Coord3& v )
60 { _to.set( (
float) v.x, (
float) v.y, (
float) v.z ); }
63 inline void set(
Coord& _to,
const osg::Vec2f& v )
64 { _to.x = v[0]; _to.y=v[1]; }
67 inline void set( osg::Vec2f& _to,
const Coord& v )
68 { _to.set( (
float) v.x, (
float) v.y ); }
71 inline void set(
Coord3& _to,
const osg::Vec3d& v )
72 { _to.x = v[0]; _to.y=v[1]; _to.z=v[2]; }
75 inline void set( osg::Vec3d& _to,
const Coord3& v )
76 { _to.set( v.x, v.y, v.z ); }
78 #define mIsOsgVec3Def( pos ) \ 79 ( pos[0]<mUdf(float) && pos[1]<mUdf(float) && pos[2]<mUdf(float) ) 81 #define mODColVal(val) ( val<=0.0 ? 0 : val>=1.0 ? 255 : mNINT32(255*val) ) 82 #define mOsgColValF(val) ( val<=0 ? 0.0f : val>=255 ? 1.0f : float(val)/255 ) 83 #define mOsgColValD(val) ( val<=0 ? 0.0 : val>=255 ? 1.0 : double(val)/255 ) 86 inline void set(
Color& _to,
const osg::Vec4f& col )
87 { _to.set( mODColVal(col[0]), mODColVal(col[1]),
88 mODColVal(col[2]), 255-mODColVal(col[3]) ); }
91 inline void set( osg::Vec4f& _to,
const Color& col )
92 { _to.set( mOsgColValF(col.r()), mOsgColValF(col.g()),
93 mOsgColValF(col.b()), 1.0f-mOsgColValF(col.t()) ); }
96 inline void set(
Color& _to,
const osg::Vec4d& col )
97 { _to.set( mODColVal(col[0]), mODColVal(col[1]),
98 mODColVal(col[2]), 255-mODColVal(col[3]) ); }
101 inline void set( osg::Vec4d& _to,
const Color& col )
102 { _to.set( mOsgColValD(col.r()), mOsgColValD(col.g()),
103 mOsgColValD(col.b()), 1.0-mOsgColValD(col.t()) ); }
110 class Undef<osg::Vec3f>
113 static void setUdf( osg::Vec3f& i ) {}
117 class Undef<osg::Vec3d>
120 static void setUdf( osg::Vec3d& i ) {}
124 class Undef<osg::Vec2f>
127 static void setUdf( osg::Vec2f& i ) {}
131 class Undef<osg::Vec2d>
134 static void setUdf( osg::Vec2d& i ) {}
139 class Undef<osg::Vec4f>
142 static void setUdf( osg::Vec4f& i ) {}
146 class Undef<osg::Vec4d>
149 static void setUdf( osg::Vec4d& i ) {}
165 OneFrameCullDisabler(osg::Node*);
166 virtual void operator()(osg::Node*,osg::NodeVisitor*);
169 #define mAttachOneFrameCullDisabler( osgnode ) \ 170 osg::ref_ptr<OneFrameCullDisabler> oneframeculldisablerof##osgnode = \ 171 new OneFrameCullDisabler( osgnode ); #define mExpClass(module)
Definition: commondefs.h:160
Templatized undefined and initialisation (i.e. null) values.
Definition: color.h:106
FixedString Undef()
Definition: keystrs.h:142
A cartesian coordinate in 2D space.
Definition: coord.h:25
A cartesian coordinate in 3D space.
Definition: coord.h:72
Definition: visannot.h:43
Open Scene Graph.
Definition: visannot.h:29
T & setUdf(T &u)
Definition: undefval.h:262
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
Template based type conversion.
Definition: convert.h:24