00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #include <stdlib.h>
00040 #include <stdio.h>
00041
00042 #include "OSGConfig.h"
00043
00044 #include "OSGComponentTransform.h"
00045 #include "OSGDrawAction.h"
00046 #include "OSGRenderAction.h"
00047 #include "OSGIntersectAction.h"
00048
00049 #include <OSGIntersectActor.h>
00050
00051 OSG_USING_NAMESPACE
00052
00057
00058
00059
00060 void ComponentTransform::changed(BitVector whichField, UInt32 origin)
00061 {
00062 ComponentTransformPtr ptr(*this);
00063
00064 if((whichField & CenterFieldMask ) ||
00065 (whichField & RotationFieldMask ) ||
00066 (whichField & ScaleFieldMask ) ||
00067 (whichField & ScaleOrientationFieldMask) ||
00068 (whichField & TranslationFieldMask ) )
00069 {
00070 beginEditCP(ptr, MatrixFieldMask);
00071 {
00072 getMatrix().setTransform(getTranslation (),
00073 getRotation (),
00074 getScale (),
00075 getScaleOrientation(),
00076 getCenter ());
00077 }
00078 endEditCP (ptr, MatrixFieldMask);
00079 }
00080
00081 Inherited::changed(whichField, origin);
00082 }
00083
00084 void ComponentTransform::dump( UInt32 uiIndent,
00085 const BitVector bvFlags) const
00086 {
00087 Inherited::dump(uiIndent, bvFlags);
00088 }
00089
00090
00091
00092
00093 ComponentTransform::ComponentTransform(void) :
00094 Inherited()
00095 {
00096 _sfScale.getValue().setValues(1.f, 1.f, 1.f);
00097 }
00098
00099 ComponentTransform::ComponentTransform(const ComponentTransform &source) :
00100 Inherited(source)
00101 {
00102 }
00103
00104
00105
00106
00107 ComponentTransform::~ComponentTransform(void)
00108 {
00109 }
00110
00111
00112
00113
00114 void ComponentTransform::initMethod (void)
00115 {
00116 DrawAction::registerEnterDefault(
00117 getClassType(),
00118 osgTypedMethodFunctor2BaseCPtrRef<
00119 Action::ResultE,
00120 ComponentTransformPtr ,
00121 CNodePtr ,
00122 Action *>(&ComponentTransform::drawEnter));
00123
00124 DrawAction::registerLeaveDefault(
00125 getClassType(),
00126 osgTypedMethodFunctor2BaseCPtrRef<
00127 Action::ResultE,
00128 ComponentTransformPtr ,
00129 CNodePtr ,
00130 Action *>(&ComponentTransform::drawLeave));
00131
00132
00133 RenderAction::registerEnterDefault(
00134 getClassType(),
00135 osgTypedMethodFunctor2BaseCPtrRef<
00136 Action::ResultE,
00137 ComponentTransformPtr ,
00138 CNodePtr ,
00139 Action *>(&ComponentTransform::renderEnter));
00140
00141 RenderAction::registerLeaveDefault(
00142 getClassType(),
00143 osgTypedMethodFunctor2BaseCPtrRef<
00144 Action::ResultE,
00145 ComponentTransformPtr ,
00146 CNodePtr ,
00147 Action *>(&ComponentTransform::renderLeave));
00148
00149 IntersectAction::registerEnterDefault(
00150 getClassType(),
00151 osgTypedMethodFunctor2BaseCPtrRef<
00152 Action::ResultE,
00153 ComponentTransformPtr ,
00154 CNodePtr ,
00155 Action *>(&ComponentTransform::intersectEnter));
00156
00157 IntersectAction::registerLeaveDefault(
00158 getClassType(),
00159 osgTypedMethodFunctor2BaseCPtrRef<
00160 Action::ResultE,
00161 ComponentTransformPtr ,
00162 CNodePtr ,
00163 Action *>(&ComponentTransform::intersectLeave));
00164
00165 IntersectActor::regClassEnter(
00166 osgTypedMethodFunctor2BaseCPtr<
00167 NewActionTypes::ResultE,
00168 ComponentTransformPtr ,
00169 NodeCorePtr ,
00170 ActorBase::FunctorArgumentType &>(&ComponentTransform::intersectActorEnter),
00171 getClassType());
00172
00173 IntersectActor::regClassLeave(
00174 osgTypedMethodFunctor2BaseCPtr<
00175 NewActionTypes::ResultE,
00176 ComponentTransformPtr ,
00177 NodeCorePtr ,
00178 ActorBase::FunctorArgumentType &>(&ComponentTransform::intersectActorLeave),
00179 getClassType());
00180 }
00181
00182
00183
00184
00185
00186 #ifdef __sgi
00187 #pragma set woff 1174
00188 #endif
00189
00190 #ifdef OSG_LINUX_ICC
00191 #pragma warning( disable : 177 )
00192 #endif
00193
00194 namespace
00195 {
00196 static Char8 cvsid_cpp[] = "@(#)$Id: $";
00197 static Char8 cvsid_hpp[] = OSGCOMPONENTTRANSFORM_HEADER_CVSID;
00198 static Char8 cvsid_inl[] = OSGCOMPONENTTRANSFORM_INLINE_CVSID;
00199 }
00200
00201