anatomist 6.0.4
3D neuroimaging data viewer
glmobject.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#ifndef ANA_MOBJECT_GLMOBJECT_H
35#define ANA_MOBJECT_GLMOBJECT_H
36
39
40namespace anatomist
41{
42 class Shader;
43
49 class GLMObject : public MObject, public GLComponent
50 {
51 public:
53 virtual ~GLMObject();
54
55 virtual const GLComponent* glAPI() const { return this; }
56 virtual GLComponent* glAPI() { return this; }
57
58 virtual const Material *glMaterial() const;
59 virtual Material & GetMaterial();
60 virtual const Material & material() const;
61 virtual const AObjectPalette* glPalette( unsigned tex = 0 ) const;
62 virtual void update( const Observable*, void* );
63 virtual bool render( PrimList &, const ViewState & vs );
64
65 virtual void glSetChanged( glPart, bool x = true ) const;
66 virtual void glClearHasChangedFlags() const;
67 virtual unsigned glNumVertex( const ViewState & ) const;
68 virtual const GLfloat* glVertexArray( const ViewState & ) const;
70 virtual const GLfloat* glNormalArray( const ViewState & ) const;
71 virtual unsigned glPolygonSize( const ViewState & ) const;
72 virtual unsigned glNumPolygon( const ViewState & ) const;
74 virtual const GLuint* glPolygonArray( const ViewState & ) const;
75
76 virtual void glSetTexImageChanged( bool x = true, unsigned tex = 0 ) const;
77 virtual void glSetTexEnvChanged( bool x = true, unsigned tex = 0 ) const;
78 virtual TexInfo & glTexInfo( unsigned tex = 0 ) const;
79 virtual const TexExtrema & glTexExtrema( unsigned tex = 0 ) const;
80 virtual TexExtrema & glTexExtrema( unsigned tex = 0 );
81 virtual unsigned glNumTextures() const;
82 virtual unsigned glNumTextures( const ViewState & ) const;
83 virtual glTextureMode glTexMode( unsigned tex = 0 ) const;
84 virtual void glSetTexMode( glTextureMode mode, unsigned tex = 0 );
85 virtual float glTexRate( unsigned tex = 0 ) const;
86 virtual void glSetTexRate( float rate, unsigned tex = 0 );
87 virtual glTextureFiltering glTexFiltering( unsigned tex = 0 ) const;
88 virtual void glSetTexFiltering( glTextureFiltering x, unsigned tex = 0 );
89 virtual glTextureWrapMode glTexWrapMode( unsigned coord = 0,
90 unsigned tex = 0 ) const;
91 virtual void glSetTexWrapMode( glTextureWrapMode x, unsigned coord = 0,
92 unsigned tex = 0 );
93 virtual void glSetTexRGBInterpolation( bool x, unsigned tex = 0 );
94 virtual bool glTexRGBInterpolation( unsigned tex = 0 ) const;
95 virtual glAutoTexturingMode glAutoTexMode( unsigned tex = 0 ) const;
97 unsigned tex = 0 );
98 virtual const float *glAutoTexParams( unsigned coord = 0,
99 unsigned tex = 0 ) const;
100 virtual void glSetAutoTexParams( const float* params, unsigned coord = 0,
101 unsigned tex = 0 );
102 virtual bool glTexImageChanged( unsigned tex = 0 ) const;
103 virtual bool glTexEnvChanged( unsigned tex = 0 ) const;
104 virtual unsigned glDimTex( const ViewState &, unsigned tex = 0 ) const;
105 virtual unsigned glTexCoordSize( const ViewState &,
106 unsigned tex = 0 ) const;
107 virtual const GLfloat* glTexCoordArray( const ViewState &,
108 unsigned tex = 0 ) const;
109
110 virtual bool glMakeTexImage( const ViewState & state,
111 const GLTexture & gltex, unsigned tex ) const;
112 virtual bool glMakeTexEnvGLL( const ViewState & state,
113 const GLList & gllist, unsigned tex ) const;
114 virtual void glSetMaterialGLL( const std::string & state, RefGLItem x );
115 virtual void glSetTexNameGLL( const std::string & state, RefGLItem x,
116 unsigned tex = 0 );
117 virtual GLPrimitives glMaterialGLL( const ViewState & state ) const;
119 unsigned tex = 0 ) const;
121 unsigned tex = 0 ) const;
122 virtual void glGarbageCollector( int nkept = -1 );
123/* virtual void glBeforeBodyGLL( const ViewState & state,
124 GLPrimitives & pl ) const;
125 virtual void glAfterBodyGLL( const ViewState & state,
126 GLPrimitives & pl ) const;*/
128 virtual const AObjectPalette* palette() const;
129
130 // new functions
131 virtual GLComponent* glGeometry( const ViewState & );
132 virtual GLComponent* glTexture( const ViewState & , unsigned n = 0 );
133 virtual const GLComponent* glGeometry( const ViewState & ) const;
134 virtual const GLComponent* glTexture( const ViewState & ,
135 unsigned n = 0 ) const;
136 virtual std::string viewStateID( glPart part, const ViewState & ) const;
137 virtual void setShaderParameters(const Shader &shader, const ViewState & state) const;
138
139 protected:
142 virtual bool glToRef( const Referential* objref, GLPrimitives & pl ) const;
143
144 private:
145 struct Private;
146 Private *d;
147 };
148
149}
150
151
152#endif
153
154
glPart
GL object parts, each driving a GL list.
virtual glAutoTexturingMode glAutoTexMode(unsigned tex=0) const
virtual glTextureFiltering glTexFiltering(unsigned tex=0) const
virtual void glSetTexEnvChanged(bool x=true, unsigned tex=0) const
virtual const GLComponent * glAPI() const
OpenGL objects const API.
Definition glmobject.h:55
virtual const float * glAutoTexParams(unsigned coord=0, unsigned tex=0) const
virtual void glSetTexFiltering(glTextureFiltering x, unsigned tex=0)
virtual const GLuint * glPolygonArray(const ViewState &) const
number of vertices per polygon (default = 3: triangles)
virtual GLComponent * glAPI()
OpenGL objects API.
Definition glmobject.h:56
virtual void glSetTexNameGLL(const std::string &state, RefGLItem x, unsigned tex=0)
virtual TexInfo & glTexInfo(unsigned tex=0) const
virtual unsigned glNumPolygon(const ViewState &) const
virtual const GLfloat * glVertexArray(const ViewState &) const
virtual void setShaderParameters(const Shader &shader, const ViewState &state) const
virtual void update(const Observable *, void *)
This class is an Observer of each of the AObject it groups.
virtual void glSetTexRate(float rate, unsigned tex=0)
virtual GLPrimitives glTexEnvGLL(const ViewState &, unsigned tex=0) const
virtual unsigned glNumTextures(const ViewState &) const
virtual unsigned glNumVertex(const ViewState &) const
virtual const TexExtrema & glTexExtrema(unsigned tex=0) const
virtual bool glTexImageChanged(unsigned tex=0) const
virtual bool glToRef(const Referential *objref, GLPrimitives &pl) const
get to geometry object referential before drawing.
virtual float glTexRate(unsigned tex=0) const
virtual void glSetAutoTexParams(const float *params, unsigned coord=0, unsigned tex=0)
virtual glTextureWrapMode glTexWrapMode(unsigned coord=0, unsigned tex=0) const
virtual void glSetAutoTexMode(glAutoTexturingMode mode, unsigned tex=0)
virtual const GLComponent * glTexture(const ViewState &, unsigned n=0) const
virtual const AObjectPalette * palette() const
virtual bool render(PrimList &, const ViewState &vs)
rendering (generally 2D or 3D using OpenGL).
virtual void glSetTexImageChanged(bool x=true, unsigned tex=0) const
virtual void glSetTexWrapMode(glTextureWrapMode x, unsigned coord=0, unsigned tex=0)
virtual GLPrimitives glTexNameGLL(const ViewState &, unsigned tex=0) const
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 glTexRGBInterpolation(unsigned tex=0) const
virtual const Material & material() const
virtual void glClearHasChangedFlags() const
virtual TexExtrema & glTexExtrema(unsigned tex=0)
virtual glTextureMode glTexMode(unsigned tex=0) const
virtual unsigned glNumTextures() const
virtual GLComponent * glTexture(const ViewState &, unsigned n=0)
virtual Material & GetMaterial()
virtual void glSetTexRGBInterpolation(bool x, unsigned tex=0)
virtual const GLfloat * glNormalArray(const ViewState &) const
normals array (optional), default=0 (no normals, flat shaded faces)
virtual void glSetTexMode(glTextureMode mode, unsigned tex=0)
virtual AObjectPalette * palette()
Normally, getOrCreatePalette() should be used instead of this function in most cases.
virtual void glSetMaterialGLL(const std::string &state, RefGLItem x)
virtual void glSetChanged(glPart, bool x=true) const
virtual bool glMakeTexEnvGLL(const ViewState &state, const GLList &gllist, unsigned tex) const
virtual std::string viewStateID(glPart part, const ViewState &) const
Makes a unique ID from a viewstate.
virtual const GLComponent * glGeometry(const ViewState &) const
virtual const Material * glMaterial() const
virtual void glGarbageCollector(int nkept=-1)
Frees unused display lists.
virtual unsigned glTexCoordSize(const ViewState &, unsigned tex=0) const
texture array size (must be >= numVertex to work), defalut=0
virtual GLPrimitives glMaterialGLL(const ViewState &state) const
virtual const AObjectPalette * glPalette(unsigned tex=0) const
virtual bool glTexEnvChanged(unsigned tex=0) const
virtual const GLfloat * glTexCoordArray(const ViewState &, unsigned tex=0) const
virtual unsigned glPolygonSize(const ViewState &) const
number of vertices per polygon (default = 3: triangles)
virtual GLComponent * glGeometry(const ViewState &)
virtual unsigned glDimTex(const ViewState &, unsigned tex=0) const
texture dimension (1, 2 [or 3])
This class has to be rewritten, it's really really a shame.......
Definition Material.h:48
This class can be subclassed to represent an object that the programmer wants to have observed.
Definition Observable.h:68
Referential: marker for transformations, with an associated color.
Definition Referential.h:56
std::list< carto::rc_ptr< GLItem > > PrimList
Definition Object.h:74
carto::rc_ptr< GLItem > RefGLItem
Definition primitive.h:129
std::list< RefGLItem > GLPrimitives
Definition primitive.h:156
ViewState holds information about how a view wants to see an object.
Definition viewstate.h:67