anatomist  5.0.5
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 
98  static int classType();
99  static void volrenderProperties( const std::set<anatomist::AObject *> & );
100 
101  protected:
102  virtual std::string viewStateID( glPart part, const ViewState & ) const;
103 
104  private:
105  Private *d;
106  };
107 
108 }
109 
110 
111 #endif
112 
113 
114 
void createDefaultPalette(const std::string &name="")
function called by getOrCreatePalette() - overloadable, need not be called directly ...
ViewState holds information about how a view wants to see an object.
Definition: viewstate.h:66
virtual bool Is2DObject()
Can be display in 2D windows.
Definition: volrender.h:56
virtual void SetMaterial(const Material &mat)
Base Anatomist object (abstract)
Definition: Object.h:95
std::list< carto::rc_ptr< GLItem > > PrimList
Definition: Object.h:72
virtual unsigned glDimTex(const ViewState &, unsigned tex=0) const
texture dimension (1, 2 [or 3])
virtual const GLComponent * glAPI() const
virtual std::string viewStateID(glPart part, const ViewState &) const
Makes a unique ID from a viewstate.
This class can be subclassed to represent an object that the programmer wants to have observed...
Definition: Observable.h:67
virtual bool renderingIsObserverDependent() const
true only if the rendering (openGL) of the object changes with the observer position/orientation of t...
std::string name() const
Name shown in control window.
Definition: Object.h:165
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...
bool checkObject() const
static int classType()
virtual const AObjectPalette * glPalette(unsigned tex=0) const
virtual bool isTransparent() const
void setMaxSlices(unsigned n)
virtual const Material & material() const
virtual const Material * glMaterial() const
This class has to be rewritten, it&#39;s really really a shame.......
Definition: Material.h:47
std::string shaderType() const
virtual Tree * optionTree() const
Menu tree for new options, see object/optionMatcher.h.
unsigned maxSlices() const
it&#39;s a list, in fact...
Definition: objectVector.h:211
bool setShaderType(const std::string &)
VolRender(AObject *vol)
int slabSize() const
virtual void glSetChanged(glPart, bool=true) const
virtual bool CanRemove(AObject *)
Definition: volrender.h:59
virtual void setPalette(const AObjectPalette &pal)
Base class for all OpenGL objects in Anatomist (with OpenGL display lists)
Definition: glcomponent.h:66
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...
void setSlabSize(int n)
virtual void update(const Observable *observable, void *arg)
This class is an Observer of each of the AObject it groups.
glPart
GL object parts, each driving a GL list.
Definition: glcomponent.h:113
virtual void glSetTexEnvChanged(bool=true, unsigned tex=0) const
virtual bool render(PrimList &, const ViewState &)
rendering (generally 2D or 3D using OpenGL).
virtual Material & GetMaterial()
virtual AObjectPalette * palette()
Normally, getOrCreatePalette() should be used instead of this function in most cases.
virtual const GLComponent::TexExtrema & glTexExtrema(unsigned tex=0) const
static void volrenderProperties(const std::set< anatomist::AObject *> &)
virtual void glSetTexImageChanged(bool=true, unsigned tex=0) const
virtual bool Is3DObject()
Can be display in 3D windows.
Definition: volrender.h:57