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 public:
00054 class Function
00055 {
00056 public:
00057 virtual float operator()(float x, float y, float z) const = 0;
00058 };
00059
00060 public:
00061 virtual const char* className() { return "vl::VolumePlot"; }
00062
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 Transform* plotTransform() const { return mPlotTransform.get(); }
00102 void setPlotTransform(Transform* tr) { mPlotTransform = tr; }
00103
00105 const ivec3& samplingResolution() const { return mSamplingResolution; }
00107 void setSamplingResolution(const ivec3& size) { mSamplingResolution = size; }
00108
00110 const String& labelFormat() const { return mLabelFormat; }
00112 void setLabelFormat(const String& format) { mLabelFormat = format; }
00113
00115 Font* labelFont() const { return mLabelFont.get(); }
00117 void setLabelFont(Font* font) { mLabelFont = font; }
00118
00120 const Text* textTemplate() const { return mTextTemplate.get(); }
00122 Text* textTemplate() { return mTextTemplate.get(); }
00123
00124 ActorTree* actorTreeMulti() { return mActorTreeMulti.get(); }
00125 const ActorTree* actorTreeMulti() const { return mActorTreeMulti.get(); }
00126
00127 protected:
00128 void setupLabels(const String& format, const fvec3& min_corner, const fvec3& max_corner, Font* font, Transform* root_tr);
00129 void evaluateFunction(float* scalar, const fvec3& min_corner, const fvec3& max_corner, const Function& func);
00130
00131 protected:
00132 std::vector< ref<Actor> > mActors;
00133 ref<Transform> mPlotTransform;
00134 ivec3 mSamplingResolution;
00135 String mLabelFormat;
00136 ref< Font > mLabelFont;
00137 fvec3 mMinCorner;
00138 fvec3 mMaxCorner;
00139 ref<Geometry> mIsosurfaceGeometry;
00140 ref<Actor> mIsosurfaceActor;
00141 ref<Effect> mIsosurfaceEffect;
00142 ref<Effect> mBoxEffect;
00143 ref<Text> mTextTemplate;
00144 ref<ActorTree> mActorTreeMulti;
00145 };
00146 }
00147
00148 #endif