Commit 9f302f8d authored by Christopher Tenter's avatar Christopher Tenter

add ability to set reflection texture for bspline surface

parent 3820baa9
......@@ -16,6 +16,10 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/ObjectTypes/HexahedralMesh)
list( APPEND CURRENT_PLUGIN_DEPS OpenVolumeMesh )
endif()
if (EXISTS ${CMAKE_SOURCE_DIR}/ObjectTypes/BSplineSurface)
add_definitions (-DENABLE_BSPLINESURFACE_SUPPORT)
endif()
list(REMOVE_DUPLICATES CURRENT_PLUGIN_DEPS )
# use Qwt6 for QT5
......
......@@ -127,6 +127,11 @@ void TextureControlPlugin::slotTextureAdded( QString _textureName , QString _fil
glName = PluginFunctions::polyhedralMeshObject(obj)->textureNode()->add_texture(imageStore().getImage(newId,0));
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
if (obj->dataType(DATA_BSPLINE_SURFACE))
glName = PluginFunctions::bsplineSurfaceObject(obj)->textureNode()->add_texture(imageStore().getImage(newId, 0));
#endif
// ================================================================================
// Store texture information in objects metadata
// ================================================================================
......@@ -244,6 +249,9 @@ void TextureControlPlugin::addedEmptyObject( int _id ) {
#endif
#ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
&& !obj->dataType(DATA_POLYHEDRAL_MESH)
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
&& !obj->dataType(DATA_BSPLINE_SURFACE)
#endif
)
{
......@@ -288,6 +296,11 @@ void TextureControlPlugin::addedEmptyObject( int _id ) {
if ( obj->dataType( DATA_POLYHEDRAL_MESH ) )
glName = PluginFunctions::polyhedralMeshObject(obj)->textureNode()->add_texture(imageStore().getImage(newImageId,0));
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
if (obj->dataType(DATA_BSPLINE_SURFACE))
glName = PluginFunctions::bsplineSurfaceObject(obj)->textureNode()->add_texture(imageStore().getImage(newImageId, 0));
#endif
// ================================================================================
// Store texture information in objects metadata
......@@ -458,6 +471,12 @@ void TextureControlPlugin::slotTextureChangeImage( QString _textureName , QImage
}
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
else if (obj->dataType(DATA_BSPLINE_SURFACE)) {
PluginFunctions::bsplineSurfaceObject(obj)->textureNode()->set_texture(_image, texData->texture(_textureName).glName());
}
#endif
emit updateView();
}
......@@ -508,6 +527,11 @@ void TextureControlPlugin::slotTextureChangeImage( QString _textureName , QImage
else if ( o_it->dataType( DATA_POLYHEDRAL_MESH ) ) {
PluginFunctions::polyhedralMeshObject(o_it)->textureNode()->set_texture( _image , texData->texture(_textureName).glName());
}
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
else if (o_it->dataType(DATA_BSPLINE_SURFACE)) {
PluginFunctions::bsplineSurfaceObject(o_it)->textureNode()->set_texture(_image, texData->texture(_textureName).glName());
}
#endif
}
}
......@@ -765,6 +789,9 @@ void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _ident
#endif
#ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
&& !obj->dataType( DATA_POLYHEDRAL_MESH )
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
&& !obj->dataType(DATA_BSPLINE_SURFACE)
#endif
)
return;
......@@ -834,6 +861,15 @@ void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _ident
PluginFunctions::polyhedralMeshObject(obj)->textureNode()->set_repeat(texData->texture(_textureName).parameters.repeat);
}
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
else if (obj->dataType(DATA_BSPLINE_SURFACE)) {
// texcoords are parametric so nothing to update in the bspline surface mesh
// Texture has been bound to that object by slotAddTexture.. directly or by fileOpened from global texture
// Just activate it
PluginFunctions::bsplineSurfaceObject(obj)->textureNode()->activateTexture(texData->texture(_textureName).glName());
PluginFunctions::bsplineSurfaceObject(obj)->textureNode()->set_repeat(texData->texture(_textureName).parameters.repeat);
}
#endif
// ================================================================================
// Mark texture as not dirty
......@@ -1030,6 +1066,9 @@ void TextureControlPlugin::slotObjectUpdated(int _identifier, const UpdateType&
#endif
#ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
&& !obj->dataType( DATA_POLYHEDRAL_MESH )
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
&& !obj->dataType(DATA_BSPLINE_SURFACE)
#endif
)
return;
......@@ -1366,6 +1405,10 @@ void TextureControlPlugin::pluginsInitialized() {
emit addContextMenuItem(contextMenu_->menuAction() ,DATA_POLYHEDRAL_MESH , CONTEXTOBJECTMENU );
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
emit addContextMenuItem(contextMenu_->menuAction(), DATA_BSPLINE_SURFACE, CONTEXTOBJECTMENU);
#endif
slotTextureAdded("Reflection Lines","reflection_map.png",2);
slotSetTextureMode("Reflection Lines","type=environmentmap");
}
......@@ -1409,6 +1452,12 @@ void TextureControlPlugin::applyDialogSettings(TextureData* _texData, QString _t
}
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
else if (obj->dataType(DATA_BSPLINE_SURFACE)) {
PluginFunctions::bsplineSurfaceObject(obj)->textureNode()->set_texture(imageStore().getImage(texture.textureImageId(), 0), texture.glName());
}
#endif
// Always mark texture as dirty
_texData->texture( _textureName ).setDirty();
......@@ -1678,6 +1727,12 @@ void TextureControlPlugin::doSwitchTexture( QString _textureName , int _id ) {
// Activate the requested texture in texture node
PluginFunctions::polyhedralMeshObject(obj)->textureNode()->activateTexture( texData->texture( _textureName ).glName() );
}
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
else if (obj->dataType(DATA_BSPLINE_SURFACE)){
// Activate the requested texture in texture node
PluginFunctions::bsplineSurfaceObject(obj)->textureNode()->activateTexture(texData->texture(_textureName).glName());
}
#endif
else {
emit log(LOGERR, "doSwitchTexture: Texture Error ( mesh required) for Texture: " + _textureName );
......@@ -1752,6 +1807,9 @@ void TextureControlPlugin::slotUpdateContextMenu( int _objectId ) {
#endif
#ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
&& !obj->dataType( DATA_POLYHEDRAL_MESH )
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
&& !obj->dataType(DATA_BSPLINE_SURFACE)
#endif
)
{
......
......@@ -75,6 +75,10 @@
#include <ObjectTypes/HexahedralMesh/HexahedralMesh.hh>
#endif
#ifdef ENABLE_BSPLINESURFACE_SUPPORT
#include <ObjectTypes/BSplineSurface/BSplineSurface.hh>
#endif
#include <OpenFlipper/common/Types.hh>
#include "textureProperties.hh"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment