Changeset 1198 for trunk/Source/Contrib/Manipulators/OSGManipulator.cpp
- Timestamp:
- 05/05/08 07:12:19 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Source/Contrib/Manipulators/OSGManipulator.cpp
r1195 r1198 95 95 Manipulator::Manipulator(void) : 96 96 Inherited(), 97 _activeParent( N ullFC),97 _activeParent( NULL ), 98 98 _externalUpdateHandler( NULL ) 99 99 { … … 139 139 else if ( (whichField & ParentsFieldMask) == ParentsFieldMask ) 140 140 { 141 Node Ptrparent;141 Node *parent; 142 142 143 143 if ( !getParents().empty() ) 144 144 { 145 145 //std::cout << "parent size= " << parents.getSize() << std::endl; 146 parent = dynamic_cast<Node Ptr>(getParents()[0]); // Dangerous! multiple parents?146 parent = dynamic_cast<Node *>(getParents()[0]); // Dangerous! multiple parents? 147 147 } 148 148 else 149 149 { 150 parent = N ullFC;150 parent = NULL; 151 151 } 152 152 … … 156 156 if ( parent != _activeParent ) 157 157 { 158 if ( N ullFC!= parent )158 if ( NULL != parent ) 159 159 { 160 160 // remove old childs from a loaded osb file. … … 166 166 } 167 167 168 if ( _activeParent != N ullFC)168 if ( _activeParent != NULL ) 169 169 { 170 170 subHandleGeo(_activeParent); … … 176 176 } 177 177 178 void Manipulator::addHandleGeo(Node Ptrn)178 void Manipulator::addHandleGeo(Node *n) 179 179 { 180 180 n->addChild(getTransXNode()); … … 184 184 } 185 185 186 void Manipulator::subHandleGeo(Node Ptrn)186 void Manipulator::subHandleGeo(Node *n) 187 187 { 188 188 n->subChild(getTransXNode()); … … 194 194 void Manipulator::reverseTransform() 195 195 { 196 if ( getTarget() != N ullFC)197 { 198 Transform Ptr t = dynamic_cast<TransformPtr>(getTarget()->getCore());199 Matrix m,n,o;196 if ( getTarget() != NULL ) 197 { 198 Transform *t = dynamic_cast<Transform *>(getTarget()->getCore()); 199 Matrix m,n,o; 200 200 201 201 Vec3f translation; … … 251 251 setMaterialZ(pMat); 252 252 253 SimpleMaterial PtrsimpleMat;254 Geometry Ptrgeo;253 SimpleMaterial *simpleMat; 254 Geometry *geo; 255 255 256 256 setExternalUpdateHandler(NULL); … … 282 282 _transHandleXC->setRotation (Quaternion(Vec3f(0, 0, 1), osgDegree2Rad(-90))); 283 283 284 simpleMat = dynamic_cast<SimpleMaterial Ptr>(getMaterialX());284 simpleMat = dynamic_cast<SimpleMaterial *>(getMaterialX()); 285 285 286 286 simpleMat->setDiffuse(Color3f(1, 0, 0)); 287 287 simpleMat->setLit (true ); 288 288 289 geo = dynamic_cast<Geometry Ptr>(getHandleXNode()->getCore());289 geo = dynamic_cast<Geometry *>(getHandleXNode()->getCore()); 290 290 geo->setMaterial(simpleMat); 291 291 … … 307 307 // _transHandleYC->setRotation ( Quaternion(Vec3f(0, 0, 1), osgDegree2Rad(-90))); 308 308 309 simpleMat = dynamic_cast<SimpleMaterial Ptr>(getMaterialY());309 simpleMat = dynamic_cast<SimpleMaterial *>(getMaterialY()); 310 310 simpleMat->setDiffuse(Color3f(0, 1, 0)); 311 311 simpleMat->setLit (true ); 312 312 313 geo = dynamic_cast<Geometry Ptr>(getHandleYNode()->getCore());313 geo = dynamic_cast<Geometry *>(getHandleYNode()->getCore()); 314 314 geo->setMaterial(simpleMat); 315 315 … … 331 331 _transHandleZC->setRotation (Quaternion(Vec3f(1, 0, 0), osgDegree2Rad(90))); 332 332 333 simpleMat = dynamic_cast<SimpleMaterial Ptr>(getMaterialZ());333 simpleMat = dynamic_cast<SimpleMaterial *>(getMaterialZ()); 334 334 simpleMat->setDiffuse(Color3f(0, 0, 1)); 335 335 simpleMat->setLit (true ); 336 336 337 geo = dynamic_cast<Geometry Ptr>(getHandleZNode()->getCore());337 geo = dynamic_cast<Geometry *>(getHandleZNode()->getCore()); 338 338 geo->setMaterial(simpleMat); 339 339 … … 349 349 Inherited::resolveLinks(); 350 350 351 _activeParent = N ullFC;352 353 _transHandleXC = N ullFC;354 _transHandleYC = N ullFC;355 _transHandleZC = N ullFC;356 } 357 358 Pnt2f Manipulator::calcScreenProjection(const Pnt3f &p,359 const ViewportPtr &port)360 { 361 Camera Ptrcam;362 Matrix proj, projtrans, view;363 Pnt3f pnt;364 365 if( port != N ullFC)351 _activeParent = NULL; 352 353 _transHandleXC = NULL; 354 _transHandleYC = NULL; 355 _transHandleZC = NULL; 356 } 357 358 Pnt2f Manipulator::calcScreenProjection(const Pnt3f & p, 359 Viewport * const port) 360 { 361 Camera *cam; 362 Matrix proj, projtrans, view; 363 Pnt3f pnt; 364 365 if( port != NULL ) 366 366 { 367 367 cam = port->getCamera(); … … 387 387 { 388 388 SWARNING << "calcScreenProjection(const Pnt3f&, " 389 " const ViewportPtr&port="389 "Viewport * const port=" 390 390 << port << ")\n"; 391 391 return Pnt2f(0.0f, 0.0f); … … 405 405 406 406 // get the beacon's core (must be ComponentTransform) and it's center 407 if( getTarget() != N ullFC)407 if( getTarget() != NULL ) 408 408 { 409 409 // get transformation of beacon 410 Transform Ptr t = dynamic_cast<TransformPtr>(getTarget()->getCore());411 412 if( t != N ullFC)410 Transform *t = dynamic_cast<Transform *>(getTarget()->getCore()); 411 412 if( t != NULL ) 413 413 { 414 414 UInt16 coord(0); // active coordinate: X=0, Y=1, Z=2
