00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00025
00026 #ifndef Filter_H
00027 #define Filter_H
00028
00029 #include <H3D/X3DChildNode.h>
00030 #include <H3D/FieldTemplates.h>
00031 #include <H3D/SFBool.h>
00032 #include "H3DNetworkingUtils/FilteredSFVec3f.h"
00033
00034
00035
00036
00037
00038 template struct __declspec(dllimport) H3D::AutoUpdate <H3D::SFBool>;
00039
00040 namespace H3DNetworkingUtils {
00041
00046
00047 class H3D_NETWORKING_UTILS_DLL_SPEC Filter : public H3D::X3DChildNode {
00048 public:
00049
00050 class EnableSwitch;
00051
00053 Filter(H3D::Inst<H3D::SFVec3f > _rawValue = 0,
00054 H3D::Inst<FilteredSFVec3f > _filteredValue = 0,
00055 H3D::Inst<H3D::SFInt32 > _samp_size = 0,
00056 H3D::Inst<EnableSwitch > _enabled = 0);
00057
00058 static H3D::H3DNodeDatabase database;
00059
00060 class EnableSwitch : public H3D::AutoUpdate< H3D::SFBool > {
00061 public:
00062 virtual void update() {
00063 H3D::SFBool * on = static_cast<H3D::SFBool *>(event.ptr);
00064 if (on->getValue() == value) {
00065 return;
00066 }
00067 value = on->getValue();
00068 if (value) {
00069 filtP->rawValue->route(filtP->filteredValue);
00070 filtP->sampleSize->route(filtP->filteredValue);
00071 }
00072 else {
00073 filtP->rawValue->unroute(filtP->filteredValue);
00074 filtP->sampleSize->unroute(filtP->filteredValue);
00075 }
00076 }
00077 Filter * filtP;
00078 };
00079
00084 auto_ptr<H3D::SFVec3f > rawValue;
00085
00090 auto_ptr<FilteredSFVec3f > filteredValue;
00091
00096 auto_ptr<H3D::SFInt32 > sampleSize;
00097
00102 auto_ptr<EnableSwitch > enabled;
00103 };
00104
00105 }
00106
00107 #endif
00108