| 1 | #include <osgVolume/Property> |
|---|
| 2 | |
|---|
| 3 | #include <iostream> |
|---|
| 4 | #include <string> |
|---|
| 5 | |
|---|
| 6 | #include <osg/Vec3> |
|---|
| 7 | #include <osg/Vec4> |
|---|
| 8 | #include <osg/io_utils> |
|---|
| 9 | |
|---|
| 10 | #include <osgDB/ReadFile> |
|---|
| 11 | #include <osgDB/Registry> |
|---|
| 12 | #include <osgDB/Input> |
|---|
| 13 | #include <osgDB/Output> |
|---|
| 14 | #include <osgDB/ParameterOutput> |
|---|
| 15 | |
|---|
| 16 | bool ScalarProperty_readLocalData(osg::Object &obj, osgDB::Input &fr); |
|---|
| 17 | bool ScalarProperty_writeLocalData(const osg::Object &obj, osgDB::Output &fw); |
|---|
| 18 | |
|---|
| 19 | REGISTER_DOTOSGWRAPPER(ScalarProperty_Proxy) |
|---|
| 20 | ( |
|---|
| 21 | 0, |
|---|
| 22 | "ScalarProperty", |
|---|
| 23 | "Object ScalarProperty", |
|---|
| 24 | ScalarProperty_readLocalData, |
|---|
| 25 | ScalarProperty_writeLocalData |
|---|
| 26 | ); |
|---|
| 27 | |
|---|
| 28 | REGISTER_DOTOSGWRAPPER(IsoSurfaceProperty_Proxy) |
|---|
| 29 | ( |
|---|
| 30 | new osgVolume::IsoSurfaceProperty, |
|---|
| 31 | "IsoSurfaceProperty", |
|---|
| 32 | "Object ScalarProperty", |
|---|
| 33 | ScalarProperty_readLocalData, |
|---|
| 34 | ScalarProperty_writeLocalData |
|---|
| 35 | ); |
|---|
| 36 | |
|---|
| 37 | REGISTER_DOTOSGWRAPPER(AlphaFuncProperty_Proxy) |
|---|
| 38 | ( |
|---|
| 39 | new osgVolume::AlphaFuncProperty, |
|---|
| 40 | "AlphaFuncProperty", |
|---|
| 41 | "Object AlphaFuncProperty", |
|---|
| 42 | ScalarProperty_readLocalData, |
|---|
| 43 | ScalarProperty_writeLocalData |
|---|
| 44 | ); |
|---|
| 45 | |
|---|
| 46 | REGISTER_DOTOSGWRAPPER(SampleDensityProperty_Proxy) |
|---|
| 47 | ( |
|---|
| 48 | new osgVolume::SampleDensityProperty, |
|---|
| 49 | "SampleDensityProperty", |
|---|
| 50 | "Object SampleDensityProperty", |
|---|
| 51 | ScalarProperty_readLocalData, |
|---|
| 52 | ScalarProperty_writeLocalData |
|---|
| 53 | ); |
|---|
| 54 | |
|---|
| 55 | REGISTER_DOTOSGWRAPPER(TransparencyProperty_Proxy) |
|---|
| 56 | ( |
|---|
| 57 | new osgVolume::TransparencyProperty, |
|---|
| 58 | "TransparencyProperty", |
|---|
| 59 | "Object TransparencyProperty", |
|---|
| 60 | ScalarProperty_readLocalData, |
|---|
| 61 | ScalarProperty_writeLocalData |
|---|
| 62 | ); |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | bool ScalarProperty_readLocalData(osg::Object& obj, osgDB::Input &fr) |
|---|
| 67 | { |
|---|
| 68 | osgVolume::ScalarProperty& sp = static_cast<osgVolume::ScalarProperty&>(obj); |
|---|
| 69 | |
|---|
| 70 | bool itrAdvanced = false; |
|---|
| 71 | |
|---|
| 72 | float value=0; |
|---|
| 73 | if (fr.read("value",value)) |
|---|
| 74 | { |
|---|
| 75 | itrAdvanced = true; |
|---|
| 76 | sp.setValue(value); |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | return itrAdvanced; |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | bool ScalarProperty_writeLocalData(const osg::Object& obj, osgDB::Output& fw) |
|---|
| 83 | { |
|---|
| 84 | const osgVolume::ScalarProperty& sp = static_cast<const osgVolume::ScalarProperty&>(obj); |
|---|
| 85 | |
|---|
| 86 | fw.indent()<<"value "<<sp.getValue()<<std::endl; |
|---|
| 87 | |
|---|
| 88 | return true; |
|---|
| 89 | } |
|---|