Changeset 9514 for OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp
- Timestamp:
- 01/20/09 16:06:44 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp
r9513 r9514 743 743 744 744 745 class FollowMouseCallback : public osgGA::GUIEventHandler, public osg::StateSet::Callback 745 namespace osgVolume 746 { 747 748 class PropertyAdjustmentCallback : public osgGA::GUIEventHandler, public osg::StateSet::Callback 746 749 { 747 750 public: 748 751 749 FollowMouseCallback() 750 { 752 PropertyAdjustmentCallback() 753 { 754 _transparencyKey = 't'; 755 _alphaFuncKey = 'a'; 756 _sampleDensityKey = 'd'; 757 751 758 _updateTransparency = false; 752 759 _updateAlphaCutOff = false; … … 754 761 } 755 762 756 FollowMouseCallback(const FollowMouseCallback&,const osg::CopyOp&) {} 757 758 META_Object(osg,FollowMouseCallback); 763 PropertyAdjustmentCallback(const PropertyAdjustmentCallback&,const osg::CopyOp&) {} 764 765 META_Object(osgVolume,PropertyAdjustmentCallback); 766 767 void setKeyEventActivatesTransparenyAdjustment(int key) { _transparencyKey = key; } 768 int getKeyEventActivatesTransparenyAdjustment() const { return _transparencyKey; } 769 770 void setKeyEventActivatesSampleDensityAdjustment(int key) { _sampleDensityKey = key; } 771 int getKeyEventActivatesSampleAdjustment() const { return _sampleDensityKey; } 772 773 void setKeyEventActivatesAlphaFuncAdjustment(int key) { _alphaFuncKey = key; } 774 int getKeyEventActivatesAlphaFuncAdjustment() const { return _alphaFuncKey; } 759 775 760 776 virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&, osg::Object* object, osg::NodeVisitor*) … … 775 791 float v = (ea.getY()-ea.getYmin())/(ea.getYmax()-ea.getYmin()); 776 792 float v2 = v*v; 793 float v4 = v2*v2; 777 794 778 795 if (_updateAlphaCutOff && cpv._isoProperty.valid()) … … 784 801 if (_updateAlphaCutOff && cpv._afProperty.valid()) 785 802 { 786 osg::notify(osg::NOTICE)<<"Setting afProperty to "<<v <<std::endl;787 cpv._afProperty->setValue(v );803 osg::notify(osg::NOTICE)<<"Setting afProperty to "<<v2<<std::endl; 804 cpv._afProperty->setValue(v2); 788 805 } 789 806 … … 796 813 if (_updateSampleDensity && cpv._sampleDensityProperty.valid()) 797 814 { 798 osg::notify(osg::NOTICE)<<"Setting sample density to "<<v 2<<std::endl;799 cpv._sampleDensityProperty->setValue(v 2);815 osg::notify(osg::NOTICE)<<"Setting sample density to "<<v4<<std::endl; 816 cpv._sampleDensityProperty->setValue(v4); 800 817 } 801 818 } … … 820 837 } 821 838 822 bool _updateTransparency; 823 bool _updateAlphaCutOff; 824 bool _updateSampleDensity; 839 int _transparencyKey; 840 int _alphaFuncKey; 841 int _sampleDensityKey; 842 843 bool _updateTransparency; 844 bool _updateAlphaCutOff; 845 bool _updateSampleDensity; 825 846 }; 826 847 827 848 } 828 849 class TestSupportOperation: public osg::GraphicsOperation 829 850 { … … 1353 1374 tile->setLayer(layer.get()); 1354 1375 1355 tile->setEventCallback(new FollowMouseCallback());1376 tile->setEventCallback(new osgVolume::PropertyAdjustmentCallback()); 1356 1377 1357 1378 if (useShader)
