Commit ba0683fa authored by Jan Möbius's avatar Jan Möbius

Better handling of switchDrawMode ( And improvements for textureType)

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5767 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f884f9a9
...@@ -378,7 +378,7 @@ void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _ident ...@@ -378,7 +378,7 @@ void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _ident
// ================================================================================ // ================================================================================
// Enable the right draw mode and update // Enable the right draw mode and update
// ================================================================================ // ================================================================================
switchDrawMode(false); switchDrawMode( texData->texture( _textureName ).type() );
} }
template< typename MeshT > template< typename MeshT >
...@@ -1014,28 +1014,43 @@ void TextureControlPlugin::doSwitchTexture( QString _textureName , int _id ) { ...@@ -1014,28 +1014,43 @@ void TextureControlPlugin::doSwitchTexture( QString _textureName , int _id ) {
// ================================================================================ // ================================================================================
// Switch to a texture drawMode // Switch to a texture drawMode
// ================================================================================ // ================================================================================
switchDrawMode(multiTextureMode); switchDrawMode(texData->texture( _textureName ).type());
} }
void TextureControlPlugin::switchDrawMode( bool _multiTexture ) { void TextureControlPlugin::switchDrawMode( TextureType _type ) {
bool textureMode = false; bool textureMode = false;
for ( int j = 0 ; j < PluginFunctions::viewers() ; ++j ) { for ( int j = 0 ; j < PluginFunctions::viewers() ; ++j ) {
if ( _multiTexture ) { switch (_type) {
case MULTITEXTURE:
case HALFEDGEBASED:
textureMode |= ( PluginFunctions::drawMode(j) == ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE ); textureMode |= ( PluginFunctions::drawMode(j) == ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE );
textureMode |= ( PluginFunctions::drawMode(j) == ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE_SHADED ); textureMode |= ( PluginFunctions::drawMode(j) == ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE_SHADED );
} else { break;
case VERTEXBASED:
textureMode |= ( PluginFunctions::drawMode(j) == ACG::SceneGraph::DrawModes::SOLID_TEXTURED ); textureMode |= ( PluginFunctions::drawMode(j) == ACG::SceneGraph::DrawModes::SOLID_TEXTURED );
textureMode |= ( PluginFunctions::drawMode(j) == ACG::SceneGraph::DrawModes::SOLID_TEXTURED_SHADED ); textureMode |= ( PluginFunctions::drawMode(j) == ACG::SceneGraph::DrawModes::SOLID_TEXTURED_SHADED );
} break;
case UNSET:
emit log(LOGERR,"Switching drawmode for unknonw Texture Type!");
break;
}
} }
if ( !textureMode ) { if ( !textureMode ) {
if ( _multiTexture ) switch (_type) {
PluginFunctions::setDrawMode( ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE_SHADED ); case MULTITEXTURE:
else case HALFEDGEBASED:
PluginFunctions::setDrawMode( ACG::SceneGraph::DrawModes::SOLID_TEXTURED_SHADED ); PluginFunctions::setDrawMode( ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE_SHADED );
break;
case VERTEXBASED:
PluginFunctions::setDrawMode( ACG::SceneGraph::DrawModes::SOLID_TEXTURED_SHADED );
break;
case UNSET:
emit log(LOGERR,"Switching drawmode for unknonw Texture Type!");
break;
}
} }
emit updateView(); emit updateView();
......
...@@ -133,7 +133,7 @@ class TextureControlPlugin : public QObject, BaseInterface, TextureInterface, Me ...@@ -133,7 +133,7 @@ class TextureControlPlugin : public QObject, BaseInterface, TextureInterface, Me
void getImage( QString _fileName, QImage& _image ); void getImage( QString _fileName, QImage& _image );
/// Checks for a correct drawmode and changes if necessary /// Checks for a correct drawmode and changes if necessary
void switchDrawMode( bool _multiTexture ); void switchDrawMode( TextureType _type );
TextureData globalTextures_; TextureData globalTextures_;
......
...@@ -116,8 +116,8 @@ class Texture { ...@@ -116,8 +116,8 @@ class Texture {
void setDirty() { dirty_ = true; }; void setDirty() { dirty_ = true; };
void type( uint _type ) { type_ = _type; }; void type( TextureType _type ) { type_ = _type; };
uint type( ) { return type_; }; TextureType type( ) { return type_; };
QString indexMappingProperty() { return indexMappingProperty_; }; QString indexMappingProperty() { return indexMappingProperty_; };
...@@ -159,7 +159,7 @@ class Texture { ...@@ -159,7 +159,7 @@ class Texture {
bool dirty_; bool dirty_;
/// Texture Type /// Texture Type
uint type_; TextureType type_;
/** If this is a multiTexture, indexMappingProperty_ will point to the property storing the mapping /** If this is a multiTexture, indexMappingProperty_ will point to the property storing the mapping
* Defaults to the f:textureindex * Defaults to the f:textureindex
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>978</width> <width>1016</width>
<height>633</height> <height>633</height>
</rect> </rect>
</property> </property>
...@@ -43,6 +43,12 @@ ...@@ -43,6 +43,12 @@
</item> </item>
<item> <item>
<widget class="QTreeWidget" name="textureList" > <widget class="QTreeWidget" name="textureList" >
<property name="minimumSize" >
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="rootIsDecorated" > <property name="rootIsDecorated" >
<bool>true</bool> <bool>true</bool>
</property> </property>
......
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