TextureInterface.hh 6.54 KB
Newer Older
Jan Möbius's avatar
 
Jan Möbius committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//=============================================================================
//
//                               OpenFlipper
//        Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
//                           www.openflipper.org
//
//-----------------------------------------------------------------------------
//
//                                License
//
//  OpenFlipper is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
Jan Möbius's avatar
   
Jan Möbius committed
15
//
Jan Möbius's avatar
 
Jan Möbius committed
16
17
18
19
//  OpenFlipper is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
Jan Möbius's avatar
   
Jan Möbius committed
20
//
Jan Möbius's avatar
 
Jan Möbius committed
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//  You should have received a copy of the GNU Lesser General Public License
//  along with OpenFlipper.  If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
//   $Revision$
//   $Author$
//   $Date$
//
//=============================================================================




//
// C++ Interface: TexturePlugin
//
Jan Möbius's avatar
   
Jan Möbius committed
38
// Description:
Jan Möbius's avatar
 
Jan Möbius committed
39
40
41
42
43
//
//
// Author: Jan Moebius <jan_moebius@web.de>, (C) 2007
//

Jan Möbius's avatar
   
Jan Möbius committed
44
45
#ifndef TEXTUREINTERFACE_HH
#define TEXTUREINTERFACE_HH
Jan Möbius's avatar
 
Jan Möbius committed
46
47
48
49

 #include <QtGui>
 #include <QMenuBar>
 #include <OpenFlipper/common/Types.hh>
Jan Möbius's avatar
   
Jan Möbius committed
50

Jan Möbius's avatar
 
Jan Möbius committed
51
52
53
 /**
  * This Interface should be used by plugins which will provide a texture. The texture coordinates have
  * to be written into a mesh property. You do not need to write texture information into the texture
Jan Möbius's avatar
   
Jan Möbius committed
54
  * coordinates of the mesh. As other plugins may provide textures to, the visualization of the
Jan Möbius's avatar
 
Jan Möbius committed
55
56
57
58
  * textures is handled by the main application (or a texture control plugin).
 */
class TextureInterface {
   signals :
Jan Möbius's avatar
   
Jan Möbius committed
59

Jan Möbius's avatar
 
Jan Möbius committed
60
      /** \brief Emit this Signal if a texture has been added (Property Name,filename,Dimension)
Jan Möbius's avatar
   
Jan Möbius committed
61
       *
Jan Möbius's avatar
 
Jan Möbius committed
62
63
64
65
       *  @param  _name Name of the property which contains the tex coords (double or vec2d)
       *  @param _filename Filename of the texture ( "./Textures/<name>")
       *  @param _dimension 1D texture ( currenty only supports 1 )
       */
Dirk Wilden's avatar
Dirk Wilden committed
66
      virtual void addTexture( QString /*_name*/ , QString /*_filename*/ , uint /*_dimension*/ ) {};
Jan Möbius's avatar
   
Jan Möbius committed
67

Jan Möbius's avatar
 
Jan Möbius committed
68
69
      /** \brief Tell Plugins to update the given texture for the given identifier
       */
Dirk Wilden's avatar
Dirk Wilden committed
70
      virtual void updateTexture( QString /*_textureName*/  , int /*_identifier*/) {};
Jan Möbius's avatar
   
Jan Möbius committed
71

Jan Möbius's avatar
 
Jan Möbius committed
72
73
74
      /** \brief Tell Plugins to update all textures
       */
      virtual void updateAllTextures( ) {};
Jan Möbius's avatar
   
Jan Möbius committed
75
76
77
78

      /** \brief emit this signal if you updated a texture
       *
       *  Give the name of the texture and the id of the object or -1 if all objects were update
Jan Möbius's avatar
 
Jan Möbius committed
79
80
      */
      virtual void updatedTextures( QString , int ) {};
Jan Möbius's avatar
   
Jan Möbius committed
81

Jan Möbius's avatar
 
Jan Möbius committed
82
      /** \brief emit this signal if you want to switch the viewer to a specific texture mode
Jan Möbius's avatar
   
Jan Möbius committed
83
84
       *
       *  Give the name of the texture and the id of the object or -1 if all objects were update
Jan Möbius's avatar
 
Jan Möbius committed
85
86
      */
      virtual void switchTexture( QString ) {};
Jan Möbius's avatar
   
Jan Möbius committed
87

Jan Möbius's avatar
 
Jan Möbius committed
88
      /** \brief emit this signal if you want to set a special mode for this texture (Clamping,...)
Jan Möbius's avatar
   
Jan Möbius committed
89
       *
Jan Möbius's avatar
 
Jan Möbius committed
90
       *  emit this signal if you want to set a special mode for this texture
Jan Möbius's avatar
   
Jan Möbius committed
91
       *
Jan Möbius's avatar
 
Jan Möbius committed
92
93
94
95
96
97
98
99
100
101
102
       *  Supported Mode Flags :\n
       *  Clamping : clamp=true/false \n
       *  Min Value for clamping  : clamp_min=value \n
       *  Max Value for clamping : clamp_max=value \n
       *  Use only absolute values : abs=true/false \n
       *  repeat texture : repeat=true/false \n
       *  Maximum value for repeat : max_val=value \n
       *  center texture : center=true/false \n
       *  \n
       * The system works like this :\n
       * First the abolute value of the property is taken if requested. Then this value is clamped against the given values. if the texture
Jan Möbius's avatar
   
Jan Möbius committed
103
       * should be repeated, the values are translated such that the minimum is at zero and than scaled such that the maximum is at
Jan Möbius's avatar
 
Jan Möbius committed
104
105
106
107
108
       * max_val. If its not repeated, the decision is to center the values around 0.5 or not. If not centered, the values are mapped directly
       * to 0..1 .If centered, the negative values are mapped to 0..0.5 and the positive values to 0.5..1.
       *  @param _textureName Name of your Texture
       *  @param _mode colon seperated String describing your settings (e.g. clamp,abs )
      */
Dirk Wilden's avatar
Dirk Wilden committed
109
      virtual void setTextureMode(QString /*_textureName*/ ,QString /*_mode*/) {};
Jan Möbius's avatar
   
Jan Möbius committed
110

Jan Möbius's avatar
 
Jan Möbius committed
111
112
113
114
115
   private slots :
      /** \brief update the texture with the given Name ( if this plugin provides this texture ) for all meshes
       * @param _textureName Name of the Texture to be updated
       * @param _identifier The id of the object to update
      */
Dirk Wilden's avatar
Dirk Wilden committed
116
      virtual void slotUpdateTexture( QString /*_textureName*/ , int /*_identifier*/) {};
Jan Möbius's avatar
   
Jan Möbius committed
117

Jan Möbius's avatar
 
Jan Möbius committed
118
119
120
      /** \brief update all textures provided by this plugin
       */
      virtual void slotUpdateAllTextures( ) {};
Jan Möbius's avatar
   
Jan Möbius committed
121
122
123
124

      /** \brief A texture has been added by a plugin.
       *
       * This slot is called when a texture has been added by a plugin.
Jan Möbius's avatar
 
Jan Möbius committed
125
126
127
128
       * @param _textureName Name of the Added texture (has to be equal to the property name)
       * @param _filename Filename of the Texture Image to be used
       * @param dimension Dimension of the Texture (currently only 1D and 2D Textures are supported
       */
Dirk Wilden's avatar
Dirk Wilden committed
129
      virtual void slotTextureAdded( QString /*_textureName*/ , QString /*_filename*/ , uint /*dimension*/ ) {};
Jan Möbius's avatar
   
Jan Möbius committed
130

Jan Möbius's avatar
 
Jan Möbius committed
131
      /** \brief A texture has been updated
Jan Möbius's avatar
   
Jan Möbius committed
132
       *
Jan Möbius's avatar
 
Jan Möbius committed
133
134
135
136
       *  A plugin has updated a Texture
       *  @param _textureName The name of the updated texture
       *  @param _identifier -1 if all objects updated, otherwise the identifier of the object
       */
Dirk Wilden's avatar
Dirk Wilden committed
137
      virtual void slotTextureUpdated( QString /*_textureName*/ , int /*_identifier*/ ) {};
Jan Möbius's avatar
   
Jan Möbius committed
138

Jan Möbius's avatar
 
Jan Möbius committed
139
      /** \brief Texturemode for texture should be changed
Jan Möbius's avatar
   
Jan Möbius committed
140
       *
Jan Möbius's avatar
 
Jan Möbius committed
141
142
143
144
       *  A plugin has updated the Texture settings for a texture
       *  @param _textureName The name of the updated texture
       *  @param _mode New mode flags for the given texture
       */
Dirk Wilden's avatar
Dirk Wilden committed
145
      virtual void slotSetTextureMode(QString /*_textureName*/ ,QString /*_mode*/) {};
Jan Möbius's avatar
   
Jan Möbius committed
146

Jan Möbius's avatar
 
Jan Möbius committed
147
      /** \brief This slot is called when a plugin requests to switch to a different texture mode
Jan Möbius's avatar
   
Jan Möbius committed
148
       *
Jan Möbius's avatar
 
Jan Möbius committed
149
150
       * @param _textureName Name of the Texture
      */
Dirk Wilden's avatar
Dirk Wilden committed
151
      virtual void slotSwitchTexture( QString /*_textureName*/ ) {};
Jan Möbius's avatar
   
Jan Möbius committed
152
153
154

   public :

Jan Möbius's avatar
 
Jan Möbius committed
155
156
      /// Destructor
      virtual ~TextureInterface() {};
Jan Möbius's avatar
   
Jan Möbius committed
157

Jan Möbius's avatar
 
Jan Möbius committed
158
159
160
};

Q_DECLARE_INTERFACE(TextureInterface,"OpenFlipper.TextureInterface/1.0")
Jan Möbius's avatar
   
Jan Möbius committed
161

Jan Möbius's avatar
 
Jan Möbius committed
162
#endif // TEXTUREINTERFACE_HH