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
// ================================================================================
// Enable the right draw mode and update
// ================================================================================
switchDrawMode(false);
switchDrawMode( texData->texture( _textureName ).type() );
}
template< typename MeshT >
......@@ -1014,28 +1014,43 @@ void TextureControlPlugin::doSwitchTexture( QString _textureName , int _id ) {
// ================================================================================
// 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;
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_SHADED );
} else {
break;
case VERTEXBASED:
textureMode |= ( PluginFunctions::drawMode(j) == ACG::SceneGraph::DrawModes::SOLID_TEXTURED );
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 ( _multiTexture )
PluginFunctions::setDrawMode( ACG::SceneGraph::DrawModes::SOLID_2DTEXTURED_FACE_SHADED );
else
PluginFunctions::setDrawMode( ACG::SceneGraph::DrawModes::SOLID_TEXTURED_SHADED );
switch (_type) {
case MULTITEXTURE:
case HALFEDGEBASED:
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();
......
......@@ -133,7 +133,7 @@ class TextureControlPlugin : public QObject, BaseInterface, TextureInterface, Me
void getImage( QString _fileName, QImage& _image );
/// Checks for a correct drawmode and changes if necessary
void switchDrawMode( bool _multiTexture );
void switchDrawMode( TextureType _type );
TextureData globalTextures_;
......
......@@ -116,8 +116,8 @@ class Texture {
void setDirty() { dirty_ = true; };
void type( uint _type ) { type_ = _type; };
uint type( ) { return type_; };
void type( TextureType _type ) { type_ = _type; };
TextureType type( ) { return type_; };
QString indexMappingProperty() { return indexMappingProperty_; };
......@@ -159,7 +159,7 @@ class Texture {
bool dirty_;
/// Texture Type
uint type_;
TextureType type_;
/** If this is a multiTexture, indexMappingProperty_ will point to the property storing the mapping
* Defaults to the f:textureindex
......
......@@ -5,7 +5,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>978</width>
<width>1016</width>
<height>633</height>
</rect>
</property>
......@@ -43,6 +43,12 @@
</item>
<item>
<widget class="QTreeWidget" name="textureList" >
<property name="minimumSize" >
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="rootIsDecorated" >
<bool>true</bool>
</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