anatomist  5.1.2
3D neuroimaging data viewer
volrender.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 
35 #ifndef ANATOMIST_OBJECT_VOLRENDER_H
36 #define ANATOMIST_OBJECT_VOLRENDER_H
37 
40 
41 
42 namespace anatomist
43 {
44  template<typename T> class AVolume;
45 
46 
47  class VolRender : public ObjectVector, public GLComponent
48  {
49  public:
50  struct Private;
51 
52  VolRender( AObject * vol );
53  virtual ~VolRender();
54 
55  virtual bool render( PrimList &, const ViewState & );
56  virtual bool Is2DObject() { return true; }
57  virtual bool Is3DObject() { return false; }
58  virtual Tree* optionTree() const;
59  virtual bool CanRemove( AObject * ) { return false; }
60 
61  void createDefaultPalette( const std::string & name = "" );
62  virtual AObjectPalette* palette();
63  virtual const AObjectPalette* palette() const;
64  virtual void setPalette( const AObjectPalette &pal );
65  virtual Material & GetMaterial();
66  virtual const Material & material() const;
67  virtual const Material* glMaterial() const;
68  virtual void SetMaterial( const Material &mat );
69  virtual bool isTransparent() const;
70  virtual bool renderingIsObserverDependent() const;
71 
72  virtual void glSetChanged( glPart, bool = true ) const;
73  virtual void glSetTexImageChanged( bool = true, unsigned tex = 0 ) const;
74  virtual void glSetTexEnvChanged( bool = true, unsigned tex = 0 ) const;
75 
76  virtual const GLComponent* glAPI() const;
77  virtual GLComponent* glAPI();
78  virtual const AObjectPalette* glPalette( unsigned tex = 0 ) const;
79 
80  virtual unsigned glDimTex( const ViewState &, unsigned tex = 0 ) const;
81  virtual bool glMakeTexImage( const ViewState &state,
82  const GLTexture &gltex, unsigned tex ) const;
83  virtual bool glMakeBodyGLL( const ViewState &state,
84  const GLList &gllist ) const;
85  virtual const GLComponent::TexExtrema &
86  glTexExtrema( unsigned tex = 0 ) const;
87  virtual GLComponent::TexExtrema & glTexExtrema( unsigned tex = 0 );
88  virtual void update(const Observable* observable, void* arg);
89 
90  bool checkObject() const;
91  std::string shaderType() const;
92  bool setShaderType( const std::string & );
93  unsigned maxSlices() const;
94  void setMaxSlices( unsigned n );
95  int slabSize() const;
96  void setSlabSize( int n );
97  virtual std::vector<float> voxelSize() const;
98 
99  static int classType();
100  static void volrenderProperties( const std::set<anatomist::AObject *> & );
101 
102  protected:
103  virtual std::string viewStateID( glPart part, const ViewState & ) const;
104 
105  private:
106  Private *d;
107  };
108 
109 }
110 
111 
112 #endif
113 
114 
115 
Base Anatomist object (abstract)
Definition: Object.h:96
std::string name() const
Name shown in control window.
Definition: Object.h:165
Base class for all OpenGL objects in Anatomist (with OpenGL display lists)
Definition: glcomponent.h:67
glPart
GL object parts, each driving a GL list.
Definition: glcomponent.h:114
This class has to be rewritten, it's really really a shame.......
Definition: Material.h:48
it's a list, in fact...
Definition: objectVector.h:212
This class can be subclassed to represent an object that the programmer wants to have observed.
Definition: Observable.h:68
virtual Tree * optionTree() const
Menu tree for new options, see object/optionMatcher.h.
virtual bool glMakeTexImage(const ViewState &state, const GLTexture &gltex, unsigned tex) const
If you make non-standard textures (ie not from a palette), overload this function to fill gltex.
virtual bool Is2DObject()
Can be display in 2D windows.
Definition: volrender.h:56
virtual GLComponent::TexExtrema & glTexExtrema(unsigned tex=0)
virtual void setPalette(const AObjectPalette &pal)
virtual void glSetChanged(glPart, bool=true) const
virtual const GLComponent * glAPI() const
static int classType()
bool checkObject() const
virtual unsigned glDimTex(const ViewState &, unsigned tex=0) const
texture dimension (1, 2 [or 3])
virtual std::string viewStateID(glPart part, const ViewState &) const
Makes a unique ID from a viewstate.
virtual void update(const Observable *observable, void *arg)
This class is an Observer of each of the AObject it groups.
virtual bool Is3DObject()
Can be display in 3D windows.
Definition: volrender.h:57
virtual void SetMaterial(const Material &mat)
virtual bool renderingIsObserverDependent() const
true only if the rendering (openGL) of the object changes with the observer position/orientation of t...
virtual const AObjectPalette * palette() const
virtual const Material & material() const
virtual bool render(PrimList &, const ViewState &)
rendering (generally 2D or 3D using OpenGL).
int slabSize() const
virtual bool glMakeBodyGLL(const ViewState &state, const GLList &gllist) const
If you want to make a non-standard GL display list for the body geometry, overload this function to f...
virtual GLComponent * glAPI()
unsigned maxSlices() const
virtual bool CanRemove(AObject *)
Definition: volrender.h:59
virtual Material & GetMaterial()
virtual const GLComponent::TexExtrema & glTexExtrema(unsigned tex=0) const
bool setShaderType(const std::string &)
virtual void glSetTexEnvChanged(bool=true, unsigned tex=0) const
virtual AObjectPalette * palette()
Normally, getOrCreatePalette() should be used instead of this function in most cases.
VolRender(AObject *vol)
virtual std::vector< float > voxelSize() const
Returns at least 4 sizes. For 3D objects, returns (1, 1, 1, 1)
virtual void glSetTexImageChanged(bool=true, unsigned tex=0) const
std::string shaderType() const
void createDefaultPalette(const std::string &name="")
function called by getOrCreatePalette() - overloadable, need not be called directly
static void volrenderProperties(const std::set< anatomist::AObject * > &)
void setMaxSlices(unsigned n)
void setSlabSize(int n)
virtual const AObjectPalette * glPalette(unsigned tex=0) const
virtual bool isTransparent() const
virtual const Material * glMaterial() const
std::list< carto::rc_ptr< GLItem > > PrimList
Definition: Object.h:72
ViewState holds information about how a view wants to see an object.
Definition: viewstate.h:67