Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef VolumePlot_INCLUDE_ONCE
00033 #define VolumePlot_INCLUDE_ONCE
00034
00035 #include <vlVolume/link_config.hpp>
00036 #include <vlGraphics/Actor.hpp>
00037 #include <vlGraphics/Geometry.hpp>
00038 #include <vlGraphics/Text.hpp>
00039 #include <vlGraphics/Effect.hpp>
00040 #include <vlCore/Transform.hpp>
00041 #include <vlGraphics/ActorTreeAbstract.hpp>
00042 #include <vlGraphics/SceneManagerActorTree.hpp>
00043 #include <vlVolume/MarchingCubes.hpp>
00044
00045 namespace vl
00046 {
00047 class SceneManager;
00048
00050 class VLVOLUME_EXPORT VolumePlot: public Object
00051 {
00052 VL_INSTRUMENT_CLASS(vl::VolumePlot, Object)
00053
00054 public:
00056 class Function
00057 {
00058 public:
00059 virtual float operator()(float x, float y, float z) const = 0;
00060 };
00061
00062 public:
00064 VolumePlot();
00065
00067 void compute(const Function& func, float threshold);
00068
00070 const Actor* isosurfaceActor() const { return mIsosurfaceActor.get(); }
00072 Actor* isosurfaceActor() { return mIsosurfaceActor.get(); }
00073
00075 const Geometry* isosurfaceGeometry() const { return mIsosurfaceGeometry.get(); }
00077 Geometry* isosurfaceGeometry() { return mIsosurfaceGeometry.get(); }
00078
00080 const Effect* isosurfaceEffect() const { return mIsosurfaceEffect.get(); }
00082 Effect* isosurfaceEffect() { return mIsosurfaceEffect.get(); }
00083
00085 const Effect* boxEffect() const { return mBoxEffect.get(); }
00087 Effect* boxEffect() { return mBoxEffect.get(); }
00088
00090 const fvec3& minCorner() const { return mMinCorner; }
00092 void setMinCorner(const fvec3& min_corner) { mMinCorner = min_corner; }
00093
00095 const fvec3& maxCorner() const { return mMaxCorner; }
00097 void setMaxCorner(const fvec3& max_corner) { mMaxCorner = max_corner; }
00098
00100 const Transform* plotTransform() const { return mPlotTransform.get(); }
00102 Transform* plotTransform() { return mPlotTransform.get(); }
00104 void setPlotTransform(Transform* tr) { mPlotTransform = tr; }
00105
00107 const ivec3& samplingResolution() const { return mSamplingResolution; }
00109 void setSamplingResolution(const ivec3& size) { mSamplingResolution = size; }
00110
00112 const String& labelFormat() const { return mLabelFormat; }
00114 void setLabelFormat(const String& format) { mLabelFormat = format; }
00115
00117 const Font* labelFont() const { return mLabelFont.get(); }
00119 Font* labelFont() { return mLabelFont.get(); }
00121 void setLabelFont(Font* font) { mLabelFont = font; }
00122
00124 const Text* textTemplate() const { return mTextTemplate.get(); }
00126 Text* textTemplate() { return mTextTemplate.get(); }
00127
00128 ActorTree* actorTreeMulti() { return mActorTreeMulti.get(); }
00129 const ActorTree* actorTreeMulti() const { return mActorTreeMulti.get(); }
00130
00131 protected:
00132 void setupLabels(const String& format, const fvec3& min_corner, const fvec3& max_corner, Font* font, Transform* root_tr);
00133 void evaluateFunction(float* scalar, const fvec3& min_corner, const fvec3& max_corner, const Function& func);
00134
00135 protected:
00136 std::vector< ref<Actor> > mActors;
00137 ref<Transform> mPlotTransform;
00138 ivec3 mSamplingResolution;
00139 String mLabelFormat;
00140 ref< Font > mLabelFont;
00141 fvec3 mMinCorner;
00142 fvec3 mMaxCorner;
00143 ref<Geometry> mIsosurfaceGeometry;
00144 ref<Actor> mIsosurfaceActor;
00145 ref<Effect> mIsosurfaceEffect;
00146 ref<Effect> mBoxEffect;
00147 ref<Text> mTextTemplate;
00148 ref<ActorTree> mActorTreeMulti;
00149 };
00150 }
00151
00152 #endif