Developer Documentation
|
Provide texture support for a plugin. More...
#include <OpenFlipper/BasePlugin/TextureInterface.hh>
Signals | |
virtual void | addTexture (QString _name, QString _filename, uint _dimension, int _id) |
Emit this Signal if a texture has been added (Property Name,filename,Dimension) More... | |
Public Member Functions | |
virtual void | addTexture (QString _name, QString _filename, uint _dimension) |
Emit this Signal if a texture has been added (Property Name,filename,Dimension) More... | |
virtual void | addMultiTexture (QString _textureGroup, QString _name, QString _filename, int _id, int &_textureId) |
Emit this Signal if you want to add a texture for a multitexturing mode. More... | |
virtual void | updateTexture (QString _textureName, int _identifier) |
Tell Plugins to update the given texture for the given identifier This signal can be called from any thread. . | |
virtual void | updateAllTextures () |
Tell Plugins to update all textures. | |
virtual void | updatedTextures (QString, int) |
emit this signal if you updated a texture More... | |
virtual void | switchTexture (QString _textureName, int _id) |
emit this signal if you want to switch the texture of a specific object This signal can be called from any thread. | |
virtual void | switchTexture (QString _textureName) |
emit this signal if you want to switch the global texture This signal can be called from any thread. | |
virtual void | setTextureMode (QString _textureName, QString _mode) |
emit this signal if you want to set a special mode for this texture (Clamping,...) More... | |
virtual void | setTextureMode (QString _textureName, QString _mode, int _id) |
emit this signal if you want to set a special mode for this texture (Clamping,...) More... | |
virtual void | textureChangeImage (QString _textureName, QImage &_image, int _id) |
Change the texture image of a given texture. More... | |
virtual void | textureChangeImage (QString _textureName, QImage &_image) |
Change the texture image of a given global texture. More... | |
virtual void | textureGetImage (QString _textureName, QImage &_image, int _id) |
get the texture image of a given texture More... | |
virtual void | textureGetImage (QString _textureName, QImage &_image) |
Get the texture image of a given global texture. More... | |
virtual void | textureIndex (QString _textureName, int _id, int &_index) |
Get the texture index of a given texture. More... | |
virtual void | textureIndexPropertyName (int _id, QString &_propertyName) |
Get the name of the texture index property. More... | |
virtual void | textureName (int _id, int _textureIndex, QString &_textureName) |
get the name of the texture with given texture index More... | |
virtual void | textureFilename (int _id, QString _textureName, QString &_textureFilename) |
get the filename of the texture with given texture index More... | |
virtual void | getCurrentTexture (int _id, QString &_textureName) |
get the name of the texture which is currently enabled More... | |
virtual void | getSubTextures (int _id, QString _multiTextureName, QStringList &_subTextures) |
get the names of all sub-textures under the given multiTexture More... | |
virtual | ~TextureInterface () |
Destructor. | |
Private Slots | |
virtual void | slotUpdateTexture (QString _textureName, int _identifier) |
update the texture with the given Name ( if this plugin provides this texture ) for all meshes More... | |
Private Member Functions | |
virtual void | slotUpdateAllTextures () |
update all textures provided by this plugin | |
virtual void | slotTextureUpdated (QString _textureName, int _identifier) |
A texture has been updated. More... | |
virtual void | slotSwitchTexture (QString _textureName, int _id) |
This slot is called when a plugin requests to switch an objects texture This signal can be called from any thread. . More... | |
virtual void | slotSwitchTexture (QString _textureName) |
This slot is called when a plugin requests to switch to a different texture mode This signal can be called from any thread. . More... | |
Functions handled by textureControlPlugin | |
Normally you dont have to do anything when these functions are called. Texturecontrol handles visualization and updates of textures. | |
virtual void | slotTextureAdded (QString _textureName, QString _filename, uint _dimension, int _id) |
A texture has been added by a plugin. More... | |
virtual void | slotTextureAdded (QString _textureName, QString _filename, uint _dimension) |
A texture has been added by a plugin. More... | |
virtual void | slotMultiTextureAdded (QString _textureGroup, QString _name, QString _filename, int _id, int &_textureId) |
A multiTexture has been added by a plugin. More... | |
virtual void | slotSetTextureMode (QString _textureName, QString _mode, int _id) |
Texturemode for texture should be changed. More... | |
virtual void | slotTextureChangeImage (QString _textureName, QImage &_image, int _id) |
Changes the texture image of a given texture. More... | |
virtual void | slotTextureChangeImage (QString _textureName, QImage &_image) |
Changes the texture image of a given global texture. More... | |
virtual void | slotSetTextureMode (QString _textureName, QString _mode) |
Texturemode for texture should be changed. More... | |
virtual void | slotTextureGetImage (QString _textureName, QImage &_image, int _id) |
fetches the texture image of a given texture More... | |
virtual void | slotTextureGetImage (QString _textureName, QImage &_image) |
fetches the texture image of a given global texture More... | |
virtual void | slotTextureIndex (QString _textureName, int _id, int &_index) |
Get the texture index of a given texture. More... | |
virtual void | slotTextureIndexPropertyName (int _id, QString &_propertyName) |
Get the name of the texture index property. More... | |
virtual void | slotTextureName (int _id, int _textureIndex, QString &_textureName) |
get the name of the texture with given texture index More... | |
virtual void | slotTextureFilename (int _id, QString _textureName, QString &_textureFilename) |
get the filename of the texture with given texture name More... | |
virtual void | slotNumberOfTextures (int _id, int &_numTextures) |
get the number of textures per object More... | |
virtual void | slotGetCurrentTexture (int _id, QString &_textureName) |
fetches the name of the texture which is currently enabled More... | |
virtual void | slotGetSubTextures (int _id, QString _multiTextureName, QStringList &_subTextures) |
fetches the names of all sub-textures under the given multiTexture More... | |
Provide texture support for a plugin.
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 coordinates of the mesh. As other plugins may provide textures to, the visualization of the textures is handled by the main application (or a texture control plugin).
Definition at line 73 of file TextureInterface.hh.
|
inlinevirtual |
Emit this Signal if you want to add a texture for a multitexturing mode.
Emit this signal if a texture should be added to a multitexturing mode.
The first parameter defines a texturegroup which collects all textures that should be painted in the multitexturing mode. This group does not have to exist on the first call but will be created automatically.
The second parameter defines the single textures name used in the gui.
This signal can be called from any thread.
_textureGroup | Multitexturing group using this texture |
_name | Name of the property which contains the tex coords (double or vec2d) |
_filename | Filename of the texture (either local in OpenFlippers texture dir or global ( "./Textures/<name>") |
_id | Id of the object which should use that texture |
_textureId | The new internal id of the texture( This id is object related!!). Use this id in your mesh as the texture index (Use mesh->set_texture_index on the face using this texture). |
Definition at line 116 of file TextureInterface.hh.
|
inlinevirtualsignal |
Emit this Signal if a texture has been added (Property Name,filename,Dimension)
Emit this signal if a texture for a specific object has been added This signal can be called from any thread.
_name | Name of the property which contains the tex coords (double or vec2d) |
_filename | Filename of the texture (either local in OpenFlippers texture dir or global ( "./Textures/<name>") |
_dimension | 1D texture ( currenty only supports 1 ) |
_id | id of an object |
Definition at line 86 of file TextureInterface.hh.
|
inlinevirtual |
Emit this Signal if a texture has been added (Property Name,filename,Dimension)
Emit this signal if a global texture has been added This signal can be called from any thread.
_name | Name of the property which contains the tex coords (double or vec2d) |
_filename | Filename of the texture (either local in OpenFlippers texture dir or global ( "./Textures/<name>") |
_dimension | 1D texture ( currenty only supports 1 ) |
Definition at line 97 of file TextureInterface.hh.
|
inlinevirtual |
get the name of the texture which is currently enabled
_id | Id of the object where the current texture should be fetched from |
_textureName | this returns the name of the texture |
Definition at line 265 of file TextureInterface.hh.
|
inlinevirtual |
get the names of all sub-textures under the given multiTexture
_id | Id of the object where the current texture should be fetched from |
_multiTextureName | name of a multi texture |
_subTextures | this returns the names of all sub textures that are combined under the given multi texture |
Definition at line 273 of file TextureInterface.hh.
|
inlinevirtual |
emit this signal if you want to set a special mode for this texture (Clamping,...)
emit this signal if you want to set a special mode for this texture
The values are modified in the following way:
First the absolute value of the property is taken if requested:
abs=true/false
Then this value is clamped against the given values:
clamp=true/false
clamp_min=value
clamp_max=value
If the texture should be repeated, the values are translated such that the minimum is at min_val(0.0 by default) and than scaled such that the maximum is at max_val. This data is than passed to the rendering:
repeat=true/false
min_val=value
max_val=value
If the texture should not be repeated you could choose to center the data around 0.5. The negative values are than mapped to 0..0.5 and the positive values to 0.5..1:
center=true/false
Otherwise, the values are mapped directly to 0..1. You can also disable that final scaling with:
scale=true/false
Examples:
Pass texture without modification: abs=false,clamp=false,repeat=false,center=false,scale=false
This signal can be called from any thread.
_textureName | Name of your Texture |
_mode | colon separated String describing your settings (e.g. clamp,abs ) |
Definition at line 176 of file TextureInterface.hh.
|
inlinevirtual |
emit this signal if you want to set a special mode for this texture (Clamping,...)
for info about the _mode parameter see setTextureMode(QString,QString) This signal can be called from any thread.
_textureName | Name of your Texture |
_mode | colon separated String describing your settings (e.g. clamp,abs ) |
_id | id of an object |
Definition at line 187 of file TextureInterface.hh.
|
inlineprivatevirtual |
fetches the name of the texture which is currently enabled
_id | Id of the object where the current texture should be fetched from |
_textureName | this returns the name of the texture |
Definition at line 464 of file TextureInterface.hh.
|
inlineprivatevirtual |
fetches the names of all sub-textures under the given multiTexture
_id | Id of the object where the current texture should be fetched from |
_multiTextureName | name of a multi texture |
_subTextures | this returns the names of all sub textures that are combined under the given multi texture |
Definition at line 472 of file TextureInterface.hh.
|
inlineprivatevirtual |
A multiTexture has been added by a plugin.
This slot is called when a multi Texture has been added by a plugin.
A multi texture has a global name which is defined as the texture group and consists of mutliple sub textures which have their own names but are all used when the group is active.
This slot will be executed on the main thread.
_textureGroup | Name of the texture group that is associated with the texture. |
_name | Name of the Added texture (has to be equal to the property name) |
_filename | Filename of the Texture Image to be used |
_id | Id of the object which should use the texture |
_textureId | The new id of the texture( This id is object related!!) |
Definition at line 365 of file TextureInterface.hh.
|
inlineprivatevirtual |
get the number of textures per object
_id | Id of the object |
_numTextures | returns the number of textures |
Definition at line 457 of file TextureInterface.hh.
|
inlineprivatevirtual |
Texturemode for texture should be changed.
A plugin has updated the Texture settings for a texture
_textureName | The name of the updated texture |
_mode | New mode flags for the given texture |
_id | id of an object |
Definition at line 375 of file TextureInterface.hh.
|
inlineprivatevirtual |
Texturemode for texture should be changed.
A plugin has updated the Texture settings for a texture
_textureName | The name of the updated texture |
_mode | New mode flags for the given texture |
Definition at line 398 of file TextureInterface.hh.
|
inlineprivatevirtual |
This slot is called when a plugin requests to switch an objects texture This signal can be called from any thread.
.
_textureName | Name of the Texture |
_id | id of an object |
Definition at line 304 of file TextureInterface.hh.
|
inlineprivatevirtual |
This slot is called when a plugin requests to switch to a different texture mode This signal can be called from any thread.
.
_textureName | Name of the Texture |
Definition at line 311 of file TextureInterface.hh.
|
inlineprivatevirtualslot |
A texture has been added by a plugin.
This slot is called when a texture for a specific object has been added by a plugin.
This slot will be executed on the main thread.
_textureName | Name of the Added texture (has to be equal to the property name) |
_filename | Filename of the Texture Image to be used |
_dimension | Dimension of the Texture (currently only 1D and 2D Textures are supported |
_id | id of an object |
Definition at line 338 of file TextureInterface.hh.
|
inlineprivatevirtual |
A texture has been added by a plugin.
This slot is called when a global texture has been added by a plugin.
This slot will be executed on the main thread.
_textureName | Name of the Added texture (has to be equal to the property name) |
_filename | Filename of the Texture Image to be used |
_dimension | Dimension of the Texture (currently only 1D and 2D Textures are supported |
Definition at line 349 of file TextureInterface.hh.
|
inlineprivatevirtual |
Changes the texture image of a given texture.
_textureName | The name of the texture which should be changed |
_image | The new image for the texture |
_id | Id of the object where the texture should be changed |
Definition at line 383 of file TextureInterface.hh.
|
inlineprivatevirtual |
Changes the texture image of a given global texture.
_textureName | The name of the texture which should be changed |
_image | The new image for the texture |
Definition at line 390 of file TextureInterface.hh.
|
inlineprivatevirtual |
get the filename of the texture with given texture name
Get the filename to texture with name _textureName. Retrieve texture names via signal textureName(int,int,QString&) using the object's id and the texture index.
_id | Id of the object where the texture should be fetched from |
_textureName | texture name of the wanted texture |
_textureFilename | this returns the filename of the texture |
Definition at line 450 of file TextureInterface.hh.
|
inlineprivatevirtual |
fetches the texture image of a given texture
_textureName | The name of the texture which should be addressed |
_image | reference to the image for the texture |
_id | Id of the object where the texture should be fetched from |
Definition at line 406 of file TextureInterface.hh.
|
inlineprivatevirtual |
fetches the texture image of a given global texture
_textureName | The name of the texture which should be addressed |
_image | reference to the image for the texture |
Definition at line 413 of file TextureInterface.hh.
|
inlineprivatevirtual |
Get the texture index of a given texture.
_textureName | The name of the texture which should be addressed |
_id | Id of the object where the texture is defined on |
_index | the index of the texture (used for multiTexturing) |
Definition at line 421 of file TextureInterface.hh.
|
inlineprivatevirtual |
Get the name of the texture index property.
Get the name of the property that holds the texture index (face property).
_id | The id of the mesh object |
_propertyName | The name of the property that holds the texture indices |
Definition at line 430 of file TextureInterface.hh.
|
inlineprivatevirtual |
get the name of the texture with given texture index
_id | Id of the object where the texture should be fetched from |
_textureIndex | texture index of the wanted texture |
_textureName | this returns the name of the texture |
Definition at line 438 of file TextureInterface.hh.
|
inlineprivatevirtual |
A texture has been updated.
A plugin has updated a Texture
_textureName | The name of the updated texture |
_identifier | -1 if all objects updated, otherwise the identifier of the object |
Definition at line 296 of file TextureInterface.hh.
|
inlineprivatevirtualslot |
update the texture with the given Name ( if this plugin provides this texture ) for all meshes
This function is called if the texture of the object is about to be shown and the object has changed since the last rendering of the texture.
_textureName | Name of the Texture to be updated |
_identifier | The id of the object to update |
Definition at line 284 of file TextureInterface.hh.
|
inlinevirtual |
Change the texture image of a given texture.
_textureName | The name of the texture which should be changed |
_image | The new image for the texture |
_id | Id of the object where the texture should be changed |
Definition at line 195 of file TextureInterface.hh.
|
inlinevirtual |
Change the texture image of a given global texture.
_textureName | The name of the texture which should be changed |
_image | The new image for the texture |
Definition at line 202 of file TextureInterface.hh.
|
inlinevirtual |
get the filename of the texture with given texture index
Get the filename of a given texture with name _textureName. Retrieve the texture's name via signal textureName(int,int,QString&) first.
_id | Id of the object where the texture should be fetched from |
_textureName | The name of the texture whose filename will be fetched |
_textureFilename | this returns the name of the texture |
Definition at line 258 of file TextureInterface.hh.
|
inlinevirtual |
get the texture image of a given texture
_textureName | The name of the texture which should be addressed |
_image | reference to the image for the texture |
_id | Id of the object where the texture should be fetched from |
Definition at line 210 of file TextureInterface.hh.
|
inlinevirtual |
Get the texture image of a given global texture.
_textureName | The name of the texture which should be addressed |
_image | reference to the image for the texture |
Definition at line 217 of file TextureInterface.hh.
|
inlinevirtual |
Get the texture index of a given texture.
_textureName | The name of the texture which should be addressed |
_id | Id of the object where the texture is defined on |
_index | the index of the texture (used for multiTexturing) |
Definition at line 225 of file TextureInterface.hh.
|
inlinevirtual |
Get the name of the texture index property.
Get the name of the property that holds the texture index (face property).
_id | The id of the mesh object |
_propertyName | The name of the property that holds the texture indices |
Definition at line 234 of file TextureInterface.hh.
|
inlinevirtual |
get the name of the texture with given texture index
When using multiTexturing you can retrieve the texture index of a face with 'mesh.texture_index(Handle)' This function maps the texture index to the name of the actual texture that is used to texture the face. Note that some plugins may change the mesh's internal property name for the texture index such that mesh.texture_index(Handle) won't return a valid texture index.
_id | Id of the object where the texture should be fetched from |
_textureIndex | texture index of the wanted texture |
_textureName | this returns the name of the texture |
Definition at line 247 of file TextureInterface.hh.
|
inlinevirtual |
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
Definition at line 131 of file TextureInterface.hh.