687
//!This class allows for the visualisation of 3D scalar fields
688
class DrawField3D : public DrawableObj
691
mutable std::vector<std::pair<Point3D,RGBThis> > ptsCache;
692
mutable bool ptsCacheOK;
695
static const Camera *curCam;
696
//!Alpha transparancy of objects in field
699
//!Size of points in the field -
700
//only meaningful if the render mode is set to alpha blended points
703
//!True if the scalar field's bounding box is to be drawn
706
//!Colours for the bounding boxes
709
//!True if volume grid is enabled
712
//!Colour map lower and upper bounds
713
float colourMapBound[2];
715
//!Which colourmap to use
716
unsigned int colourMapID;
718
//!Sets the render mode for the 3D volume
720
* 0: Alpha blended points
722
unsigned int volumeRenderMode;
723
//!The scalar field - used to store data values
724
const Voxels<float> *field;
726
//!Default Constructor
729
virtual ~DrawField3D();
732
DrawableObj *clone() const;
734
//!Get the bounding box for this object
735
void getBoundingBox(BoundCube &b) const;
737
//!Set the render mode (see volumeRenderMode variable for details)
738
void setRenderMode(unsigned int);
740
//!Set the field pointer
741
void setField(const Voxels<float> *field);
743
//!Set the alpha value for elemnts
744
void setAlpha(float alpha);
746
//!Set the colour bar minima and maxima from current field values
747
void setColourMinMax();
749
//!Set the colourMap ID
750
void setColourMapID(unsigned int i){ colourMapID=i;};
755
//!Set the size of points
756
void setPointSize(float size);
758
//!Set the colours that ar ebeing used in the tempMap
759
void setMapColours(unsigned int map);
761
//!Set the coour of the bounding box
762
void setBoxColours(float r, float g, float b, float a);
763
//!Set the current camera
764
static void setCurCamera(const Camera *c){curCam=c;};
768
class DrawIsoSurface: public DrawableObj
771
mutable bool cacheOK;
773
//!should we draw the thing
778
unsigned int drawMode;
780
//!Isosurface scalar threshold
783
Voxels<float> *voxels;
785
mutable vector<TriangleWithVertexNorm> mesh;
787
//!Warning. Although I declare this as const, I do some naughty mutating to the cache.
788
void updateMesh() const;
790
//!Point colour (r,g,b,a) range: [0.0f,1.0f]
798
DrawableObj* clone() const;
800
//!Transfer ownership of data pointer to class
801
void swapVoxels(Voxels<float> *v);
803
//!Set the drawing method
808
//!Set the isosurface value
809
void setScalarThresh(float thresh) { threshold=thresh;cacheOK=false;mesh.clear();};
811
//!Get the bouding box (of the entire scalar field)
812
void getBoundingBox(BoundCube &b) const ;
814
//!Sets the color of the point to be drawn
815
void setColour(float rP, float gP, float bP, float alpha) { r=rP;g=gP;b=bP;a=alpha;} ;
679
818
#ifdef HPMC_GPU_ISOSURFACE
680
819
//!A class to use GPU shaders to draw isosurfaces
752
899
~DrawIsoSurfaceWithShader();
754
901
//initialise dataset and shaders
755
bool init(unsigned int dataX,
756
unsigned int dataY, unsigned int dataZ, const char *dataset);
902
bool init(const Voxels<float> &v);
758
904
void draw() const;
760
void setScalarThresh(float thresh) { threshold=thresh;};
906
//Can the shader run?
907
bool canRun() const{return shadersOK;};
909
void setScalarThresh(float thresh) ;
911
void getBoundingBox(BoundCube &b) const;