void Joint::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { if(whichField & JointTransformationFieldMask) { invalidateVolume(); } Inherited::changed(whichField, origin, details); }
OSG_USING_NAMESPACE /*! \class osg::ComponentTransform */ /*-------------------------------------------------------------------------*/ /* Changed */ void ComponentTransform::changed(BitVector whichField, UInt32 origin) { ComponentTransformPtr ptr(*this); if((whichField & CenterFieldMask ) || (whichField & RotationFieldMask ) || (whichField & ScaleFieldMask ) || (whichField & ScaleOrientationFieldMask) || (whichField & TranslationFieldMask ) ) { // be careful not to mark the matrix as changed here to avoid // bouncing changes back and forth _sfMatrix.getValue().setTransform(getTranslation (), getRotation (), getScale (), getScaleOrientation(), getCenter () ); invalidateVolume(); } else if(whichField & Inherited::MatrixFieldMask) { Vec3f translation; Quaternion rotation; Vec3f scale; Quaternion scaleOrientation; Vec3f center; _sfMatrix.getValue().getTransform(translation, rotation, scale, scaleOrientation, center ); // be careful not to mark the components as changed here to avoid // bouncing changes back and forth _sfTranslation .setValue(translation ); _sfRotation .setValue(rotation ); _sfScale .setValue(scale ); _sfScaleOrientation.setValue(scaleOrientation); _sfCenter .setValue(center ); } Inherited::changed(whichField, origin); }
void ReplicateTransform::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { if(whichField & TargetFieldMask) { invalidateVolume(); } Inherited::changed(whichField, origin, details); }
void StackedTransform::updateTransform(void) { _mTransformation.setIdentity(); for(UInt32 i =0; i < getMFTransformElements()->size(); ++i) { getTransformElements(i)->accumulateMatrix(_mTransformation); } invalidateVolume(); }
void Node::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details ) { Inherited::changed(whichField, origin, details); if(whichField & (CoreFieldMask | ChildrenFieldMask)) { invalidateVolume(); } if(whichField & TravMaskFieldMask) { if(getParent() != NULL) { getParent()->invalidateVolume(); } else { invalidateVolume(); } } }
void ReplicateTransform::calcMatrix(const Matrixr &mToWorld) { Matrixr prevValue(_invWorld); _invWorld.invertFrom(mToWorld); if(getTarget() != NULL) { _invWorld.mult(getTarget()->getToWorld()); } if(_invWorld != prevValue) { invalidateVolume(); } }
void SkeletonOgreJoint::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { if(((TranslateFieldMask | RotateFieldMask | ScaleFieldMask | OffsetTranslateFieldMask | OffsetScaleFieldMask | OffsetRotateFieldMask | InvBindTranslateFieldMask | InvBindScaleFieldMask | InvBindRotateFieldMask ) & whichField) != 0x0000) { invalidateVolume(); if(_sfSkeleton.getValue() != NULL) _sfSkeleton.getValue()->editSFJointsChanged(); } Inherited::changed(whichField, origin, details); }
void SkinnedGeometry::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { if((RenderModeFieldMask & whichField) != 0) { if(_sfSkinningAlgorithm.getValue() == NULL || _sfSkinningAlgorithm.getValue()->getRenderMode() != RenderModeE(_sfRenderMode.getValue()) ) { switch(_sfRenderMode.getValue()) { case RMUnskinned: { UnskinnedSkinningAlgorithmUnrecPtr algo = UnskinnedSkinningAlgorithm::create(); setSkinningAlgorithm(algo); if(_sfSkeleton.getValue() != NULL) algo->setSkeleton(_sfSkeleton.getValue()); } break; case RMSkeleton: { SkeletonSkinningAlgorithmUnrecPtr algo = SkeletonSkinningAlgorithm::create(); setSkinningAlgorithm(algo); if(_sfSkeleton.getValue() != NULL) { algo->setSkeleton(_sfSkeleton.getValue()); _sfSkeleton.getValue()->setUseInvBindMatrix(false); } } break; case RMSkinnedCPU: { CPUSkinningAlgorithmUnrecPtr algo = CPUSkinningAlgorithm::create(); setSkinningAlgorithm(algo); if(_sfSkeleton.getValue() != NULL) { algo->setSkeleton(_sfSkeleton.getValue()); _sfSkeleton.getValue()->setUseInvBindMatrix(true); } } break; case RMSkinnedGPU: { GPUSkinningAlgorithmUnrecPtr algo = GPUSkinningAlgorithm::create(); setSkinningAlgorithm(algo); if(_sfSkeleton.getValue() != NULL) { algo->setSkeleton(_sfSkeleton.getValue()); _sfSkeleton.getValue()->setUseInvBindMatrix(true); } } break; } invalidateVolume(); } } if((SkeletonFieldMask & whichField) != 0) { if(_sfSkinningAlgorithm.getValue() != NULL) { _sfSkinningAlgorithm.getValue()->setSkeleton( _sfSkeleton.getValue()); } } Inherited::changed(whichField, origin, details); }
void DynamicTerrain::changed( BitVector whichField, UInt32 origin ) { Inherited::changed( whichField, origin ); // todo: prevent multiple initializations: (how?) if( ( whichField & DynamicTerrain::HeightDataFieldMask ) ) { // heightdata image changed: use the image as data source and reinitialize the data structures: imageHeightSource_.setImage( getHeightData() ); std::cerr << "HeightDataField changed" << std::endl; needInitialize_ = true; } if( ( whichField & DynamicTerrain::TextureDataFieldMask ) ) { imageTextureSource_.setImage( getTextureData() ); needInitialize_ = true; } if( ( whichField & DynamicTerrain::LevelSizeFieldMask ) ) { // the level size has changed: we need to reinitialize: needInitialize_ = true; } if( whichField & DynamicTerrain::UseGpuRendererFieldMask ) { // todo: change the used renderer } if( ( whichField & DynamicTerrain::HeightDataOffsetFieldMask ) || ( whichField & DynamicTerrain::HeightDataScaleFieldMask ) ) { invalidateVolume(); } if( whichField & DynamicTerrain::CpuVertexProgramFieldId ) { geoClipmaps_.setCpuVertexProgramText( getCpuVertexProgram() ); } if( whichField & DynamicTerrain::CpuFragmentProgramFieldId ) { geoClipmaps_.setCpuFragmentProgramText( getCpuFragmentProgram() ); } if( whichField & DynamicTerrain::TextureDataFieldId ) { // create a texture chunk: ImagePtr textureImage = getTextureData(); if( textureImage != NullFC ) { globalTexture_ = TextureChunk::create(); beginEditCP( globalTexture_ ); globalTexture_->setImage( textureImage ); globalTexture_->setWrapS( GL_CLAMP ); globalTexture_->setWrapT( GL_CLAMP ); globalTexture_->setWrapR( GL_CLAMP ); globalTexture_->setMinFilter( GL_LINEAR ); globalTexture_->setMagFilter( GL_LINEAR ); globalTexture_->setEnvMode( GL_MODULATE ); endEditCP( globalTexture_ ); } else { globalTexture_ = NullFC; } } }