Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TextureInterface Class Reference

Provide texture support for a plugin. More...

#include <OpenFlipper/BasePlugin/TextureInterface.hh>

Inheritance diagram for TextureInterface:
FileOBJPlugin FileVTKPlugin GaussCurvaturePlugin LaplaceLengthPlugin MeanCurvaturePlugin MeshComparePlugin TextureControlPlugin

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...
 

Detailed Description

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.

Member Function Documentation

virtual void TextureInterface::addMultiTexture ( QString  _textureGroup,
QString  _name,
QString  _filename,
int  _id,
int &  _textureId 
)
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.

Parameters
_textureGroupMultitexturing group using this texture
_nameName of the property which contains the tex coords (double or vec2d)
_filenameFilename of the texture (either local in OpenFlippers texture dir or global ( "./Textures/<name>")
_idId of the object which should use that texture
_textureIdThe 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.

virtual void TextureInterface::addTexture ( QString  _name,
QString  _filename,
uint  _dimension,
int  _id 
)
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.

Parameters
_nameName of the property which contains the tex coords (double or vec2d)
_filenameFilename of the texture (either local in OpenFlippers texture dir or global ( "./Textures/<name>")
_dimension1D texture ( currenty only supports 1 )
_idid of an object

Definition at line 86 of file TextureInterface.hh.

virtual void TextureInterface::addTexture ( QString  _name,
QString  _filename,
uint  _dimension 
)
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.

Parameters
_nameName of the property which contains the tex coords (double or vec2d)
_filenameFilename of the texture (either local in OpenFlippers texture dir or global ( "./Textures/<name>")
_dimension1D texture ( currenty only supports 1 )

Definition at line 97 of file TextureInterface.hh.

virtual void TextureInterface::getCurrentTexture ( int  _id,
QString &  _textureName 
)
inlinevirtual

get the name of the texture which is currently enabled

Parameters
_idId of the object where the current texture should be fetched from
_textureNamethis returns the name of the texture

Definition at line 265 of file TextureInterface.hh.

virtual void TextureInterface::getSubTextures ( int  _id,
QString  _multiTextureName,
QStringList &  _subTextures 
)
inlinevirtual

get the names of all sub-textures under the given multiTexture

Parameters
_idId of the object where the current texture should be fetched from
_multiTextureNamename of a multi texture
_subTexturesthis returns the names of all sub textures that are combined under the given multi texture

Definition at line 273 of file TextureInterface.hh.

virtual void TextureInterface::setTextureMode ( QString  _textureName,
QString  _mode 
)
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.

Parameters
_textureNameName of your Texture
_modecolon separated String describing your settings (e.g. clamp,abs )

Definition at line 176 of file TextureInterface.hh.

virtual void TextureInterface::setTextureMode ( QString  _textureName,
QString  _mode,
int  _id 
)
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.

Parameters
_textureNameName of your Texture
_modecolon separated String describing your settings (e.g. clamp,abs )
_idid of an object

Definition at line 187 of file TextureInterface.hh.

virtual void TextureInterface::slotGetCurrentTexture ( int  _id,
QString &  _textureName 
)
inlineprivatevirtual

fetches the name of the texture which is currently enabled

Parameters
_idId of the object where the current texture should be fetched from
_textureNamethis returns the name of the texture

Definition at line 464 of file TextureInterface.hh.

virtual void TextureInterface::slotGetSubTextures ( int  _id,
QString  _multiTextureName,
QStringList &  _subTextures 
)
inlineprivatevirtual

fetches the names of all sub-textures under the given multiTexture

Parameters
_idId of the object where the current texture should be fetched from
_multiTextureNamename of a multi texture
_subTexturesthis returns the names of all sub textures that are combined under the given multi texture

Definition at line 472 of file TextureInterface.hh.

virtual void TextureInterface::slotMultiTextureAdded ( QString  _textureGroup,
QString  _name,
QString  _filename,
int  _id,
int &  _textureId 
)
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.

Parameters
_textureGroupName of the texture group that is associated with the texture.
_nameName of the Added texture (has to be equal to the property name)
_filenameFilename of the Texture Image to be used
_idId of the object which should use the texture
_textureIdThe new id of the texture( This id is object related!!)

Definition at line 365 of file TextureInterface.hh.

virtual void TextureInterface::slotNumberOfTextures ( int  _id,
int &  _numTextures 
)
inlineprivatevirtual

get the number of textures per object

Parameters
_idId of the object
_numTexturesreturns the number of textures

Definition at line 457 of file TextureInterface.hh.

virtual void TextureInterface::slotSetTextureMode ( QString  _textureName,
QString  _mode,
int  _id 
)
inlineprivatevirtual

Texturemode for texture should be changed.

A plugin has updated the Texture settings for a texture

Parameters
_textureNameThe name of the updated texture
_modeNew mode flags for the given texture
_idid of an object

Definition at line 375 of file TextureInterface.hh.

virtual void TextureInterface::slotSetTextureMode ( QString  _textureName,
QString  _mode 
)
inlineprivatevirtual

Texturemode for texture should be changed.

A plugin has updated the Texture settings for a texture

Parameters
_textureNameThe name of the updated texture
_modeNew mode flags for the given texture

Definition at line 398 of file TextureInterface.hh.

virtual void TextureInterface::slotSwitchTexture ( QString  _textureName,
int  _id 
)
inlineprivatevirtual

This slot is called when a plugin requests to switch an objects texture This signal can be called from any thread.
.

Parameters
_textureNameName of the Texture
_idid of an object

Definition at line 304 of file TextureInterface.hh.

virtual void TextureInterface::slotSwitchTexture ( QString  _textureName)
inlineprivatevirtual

This slot is called when a plugin requests to switch to a different texture mode This signal can be called from any thread.
.

Parameters
_textureNameName of the Texture

Definition at line 311 of file TextureInterface.hh.

virtual void TextureInterface::slotTextureAdded ( QString  _textureName,
QString  _filename,
uint  _dimension,
int  _id 
)
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.

Parameters
_textureNameName of the Added texture (has to be equal to the property name)
_filenameFilename of the Texture Image to be used
_dimensionDimension of the Texture (currently only 1D and 2D Textures are supported
_idid of an object

Definition at line 338 of file TextureInterface.hh.

virtual void TextureInterface::slotTextureAdded ( QString  _textureName,
QString  _filename,
uint  _dimension 
)
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.

Parameters
_textureNameName of the Added texture (has to be equal to the property name)
_filenameFilename of the Texture Image to be used
_dimensionDimension of the Texture (currently only 1D and 2D Textures are supported

Definition at line 349 of file TextureInterface.hh.

virtual void TextureInterface::slotTextureChangeImage ( QString  _textureName,
QImage &  _image,
int  _id 
)
inlineprivatevirtual

Changes the texture image of a given texture.

Parameters
_textureNameThe name of the texture which should be changed
_imageThe new image for the texture
_idId of the object where the texture should be changed

Definition at line 383 of file TextureInterface.hh.

virtual void TextureInterface::slotTextureChangeImage ( QString  _textureName,
QImage &  _image 
)
inlineprivatevirtual

Changes the texture image of a given global texture.

Parameters
_textureNameThe name of the texture which should be changed
_imageThe new image for the texture

Definition at line 390 of file TextureInterface.hh.

virtual void TextureInterface::slotTextureFilename ( int  _id,
QString  _textureName,
QString &  _textureFilename 
)
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.

Parameters
_idId of the object where the texture should be fetched from
_textureNametexture name of the wanted texture
_textureFilenamethis returns the filename of the texture

Definition at line 450 of file TextureInterface.hh.

virtual void TextureInterface::slotTextureGetImage ( QString  _textureName,
QImage &  _image,
int  _id 
)
inlineprivatevirtual

fetches the texture image of a given texture

Parameters
_textureNameThe name of the texture which should be addressed
_imagereference to the image for the texture
_idId of the object where the texture should be fetched from

Definition at line 406 of file TextureInterface.hh.

virtual void TextureInterface::slotTextureGetImage ( QString  _textureName,
QImage &  _image 
)
inlineprivatevirtual

fetches the texture image of a given global texture

Parameters
_textureNameThe name of the texture which should be addressed
_imagereference to the image for the texture

Definition at line 413 of file TextureInterface.hh.

virtual void TextureInterface::slotTextureIndex ( QString  _textureName,
int  _id,
int &  _index 
)
inlineprivatevirtual

Get the texture index of a given texture.

Parameters
_textureNameThe name of the texture which should be addressed
_idId of the object where the texture is defined on
_indexthe index of the texture (used for multiTexturing)

Definition at line 421 of file TextureInterface.hh.

virtual void TextureInterface::slotTextureIndexPropertyName ( int  _id,
QString &  _propertyName 
)
inlineprivatevirtual

Get the name of the texture index property.

Get the name of the property that holds the texture index (face property).

Parameters
_idThe id of the mesh object
_propertyNameThe name of the property that holds the texture indices

Definition at line 430 of file TextureInterface.hh.

virtual void TextureInterface::slotTextureName ( int  _id,
int  _textureIndex,
QString &  _textureName 
)
inlineprivatevirtual

get the name of the texture with given texture index

Parameters
_idId of the object where the texture should be fetched from
_textureIndextexture index of the wanted texture
_textureNamethis returns the name of the texture

Definition at line 438 of file TextureInterface.hh.

virtual void TextureInterface::slotTextureUpdated ( QString  _textureName,
int  _identifier 
)
inlineprivatevirtual

A texture has been updated.

A plugin has updated a Texture

Parameters
_textureNameThe 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.

virtual void TextureInterface::slotUpdateTexture ( QString  _textureName,
int  _identifier 
)
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.

Parameters
_textureNameName of the Texture to be updated
_identifierThe id of the object to update

Definition at line 284 of file TextureInterface.hh.

virtual void TextureInterface::textureChangeImage ( QString  _textureName,
QImage &  _image,
int  _id 
)
inlinevirtual

Change the texture image of a given texture.

Parameters
_textureNameThe name of the texture which should be changed
_imageThe new image for the texture
_idId of the object where the texture should be changed

Definition at line 195 of file TextureInterface.hh.

virtual void TextureInterface::textureChangeImage ( QString  _textureName,
QImage &  _image 
)
inlinevirtual

Change the texture image of a given global texture.

Parameters
_textureNameThe name of the texture which should be changed
_imageThe new image for the texture

Definition at line 202 of file TextureInterface.hh.

virtual void TextureInterface::textureFilename ( int  _id,
QString  _textureName,
QString &  _textureFilename 
)
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.

Parameters
_idId of the object where the texture should be fetched from
_textureNameThe name of the texture whose filename will be fetched
_textureFilenamethis returns the name of the texture

Definition at line 258 of file TextureInterface.hh.

virtual void TextureInterface::textureGetImage ( QString  _textureName,
QImage &  _image,
int  _id 
)
inlinevirtual

get the texture image of a given texture

Parameters
_textureNameThe name of the texture which should be addressed
_imagereference to the image for the texture
_idId of the object where the texture should be fetched from

Definition at line 210 of file TextureInterface.hh.

virtual void TextureInterface::textureGetImage ( QString  _textureName,
QImage &  _image 
)
inlinevirtual

Get the texture image of a given global texture.

Parameters
_textureNameThe name of the texture which should be addressed
_imagereference to the image for the texture

Definition at line 217 of file TextureInterface.hh.

virtual void TextureInterface::textureIndex ( QString  _textureName,
int  _id,
int &  _index 
)
inlinevirtual

Get the texture index of a given texture.

Parameters
_textureNameThe name of the texture which should be addressed
_idId of the object where the texture is defined on
_indexthe index of the texture (used for multiTexturing)

Definition at line 225 of file TextureInterface.hh.

virtual void TextureInterface::textureIndexPropertyName ( int  _id,
QString &  _propertyName 
)
inlinevirtual

Get the name of the texture index property.

Get the name of the property that holds the texture index (face property).

Parameters
_idThe id of the mesh object
_propertyNameThe name of the property that holds the texture indices

Definition at line 234 of file TextureInterface.hh.

virtual void TextureInterface::textureName ( int  _id,
int  _textureIndex,
QString &  _textureName 
)
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.

Parameters
_idId of the object where the texture should be fetched from
_textureIndextexture index of the wanted texture
_textureNamethis returns the name of the texture

Definition at line 247 of file TextureInterface.hh.

virtual void TextureInterface::updatedTextures ( QString  ,
int   
)
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.


The documentation for this class was generated from the following file: