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

Added environment Texture Type

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5992 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c2553259
...@@ -674,6 +674,9 @@ bool TextureControlPlugin::parseMode( QString _mode, Texture& _texture ) { ...@@ -674,6 +674,9 @@ bool TextureControlPlugin::parseMode( QString _mode, Texture& _texture ) {
} else if ( (value == "vertexbased") && (_texture.type() != HALFEDGEBASED) ) { } else if ( (value == "vertexbased") && (_texture.type() != HALFEDGEBASED) ) {
_texture.type( VERTEXBASED ); _texture.type( VERTEXBASED );
changed = true; changed = true;
} else if ( (value == "environmentmap") && (_texture.type() != ENVIRONMENT) ) {
_texture.type( ENVIRONMENT );
changed = true;
} else { } else {
emit log(LOGERR,"Unknown texture type : " + value + " for texture: " + _texture.name() ); emit log(LOGERR,"Unknown texture type : " + value + " for texture: " + _texture.name() );
} }
...@@ -865,6 +868,7 @@ void TextureControlPlugin::pluginsInitialized() { ...@@ -865,6 +868,7 @@ void TextureControlPlugin::pluginsInitialized() {
slotTextureAdded("Reflection Lines","reflection_map.png",2); slotTextureAdded("Reflection Lines","reflection_map.png",2);
slotSetTextureMode("Reflection Lines","type=environmentmap");
} }
void TextureControlPlugin::slotSetTextureProperties() { void TextureControlPlugin::slotSetTextureProperties() {
...@@ -1031,7 +1035,8 @@ void TextureControlPlugin::doSwitchTexture( QString _textureName , int _id ) { ...@@ -1031,7 +1035,8 @@ void TextureControlPlugin::doSwitchTexture( QString _textureName , int _id ) {
// ================================================================================ // ================================================================================
if( obj->dataType( DATA_TRIANGLE_MESH ) ){ if( obj->dataType( DATA_TRIANGLE_MESH ) ){
if (!multiTextureMode) { if (!multiTextureMode) {
doUpdateTexture(texData->texture(_textureName), *PluginFunctions::triMeshObject(obj)->mesh()); if ( texData->texture(_textureName).type() != ENVIRONMENT)
doUpdateTexture(texData->texture(_textureName), *PluginFunctions::triMeshObject(obj)->mesh());
PluginFunctions::triMeshObject(obj)->textureNode()->activateTexture( texData->texture( _textureName ).glName() ); PluginFunctions::triMeshObject(obj)->textureNode()->activateTexture( texData->texture( _textureName ).glName() );
PluginFunctions::triMeshObject(obj)->meshNode()->set_index_property_name("No Texture Index"); PluginFunctions::triMeshObject(obj)->meshNode()->set_index_property_name("No Texture Index");
PluginFunctions::triMeshObject(obj)->meshNode()->set_texture_map( 0 ); PluginFunctions::triMeshObject(obj)->meshNode()->set_texture_map( 0 );
...@@ -1047,7 +1052,8 @@ void TextureControlPlugin::doSwitchTexture( QString _textureName , int _id ) { ...@@ -1047,7 +1052,8 @@ void TextureControlPlugin::doSwitchTexture( QString _textureName , int _id ) {
if ( obj->dataType( DATA_POLY_MESH ) ){ if ( obj->dataType( DATA_POLY_MESH ) ){
if (!multiTextureMode) { if (!multiTextureMode) {
doUpdateTexture(texData->texture(_textureName), *PluginFunctions::polyMeshObject(obj)->mesh()); if ( texData->texture(_textureName).type() != ENVIRONMENT)
doUpdateTexture(texData->texture(_textureName), *PluginFunctions::polyMeshObject(obj)->mesh());
PluginFunctions::polyMeshObject(obj)->textureNode()->activateTexture( texData->texture( _textureName ).glName() ); PluginFunctions::polyMeshObject(obj)->textureNode()->activateTexture( texData->texture( _textureName ).glName() );
PluginFunctions::polyMeshObject(obj)->meshNode()->set_index_property_name("No Texture Index"); PluginFunctions::polyMeshObject(obj)->meshNode()->set_index_property_name("No Texture Index");
PluginFunctions::polyMeshObject(obj)->meshNode()->set_texture_map( 0 ); PluginFunctions::polyMeshObject(obj)->meshNode()->set_texture_map( 0 );
...@@ -1081,6 +1087,9 @@ void TextureControlPlugin::switchDrawMode( TextureType _type ) { ...@@ -1081,6 +1087,9 @@ void TextureControlPlugin::switchDrawMode( TextureType _type ) {
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; break;
case ENVIRONMENT:
textureMode |= ( PluginFunctions::drawMode(j) == ACG::SceneGraph::DrawModes::SOLID_ENV_MAPPED );
break;
case UNSET: case UNSET:
emit log(LOGERR,"Switching drawmode for unknonw Texture Type!"); emit log(LOGERR,"Switching drawmode for unknonw Texture Type!");
break; break;
...@@ -1096,6 +1105,9 @@ void TextureControlPlugin::switchDrawMode( TextureType _type ) { ...@@ -1096,6 +1105,9 @@ void TextureControlPlugin::switchDrawMode( TextureType _type ) {
case VERTEXBASED: case VERTEXBASED:
PluginFunctions::setDrawMode( ACG::SceneGraph::DrawModes::SOLID_TEXTURED_SHADED , PluginFunctions::ALL_VIEWERS); PluginFunctions::setDrawMode( ACG::SceneGraph::DrawModes::SOLID_TEXTURED_SHADED , PluginFunctions::ALL_VIEWERS);
break; break;
case ENVIRONMENT:
PluginFunctions::setDrawMode( ACG::SceneGraph::DrawModes::SOLID_ENV_MAPPED , PluginFunctions::ALL_VIEWERS);
break;
case UNSET: case UNSET:
emit log(LOGERR,"Switching drawmode for unknonw Texture Type!"); emit log(LOGERR,"Switching drawmode for unknonw Texture Type!");
break; break;
......
...@@ -44,9 +44,14 @@ ...@@ -44,9 +44,14 @@
#include <iostream> #include <iostream>
enum TextureType { UNSET = 1 << 0, enum TextureType { UNSET = 1 << 0,
/// Texture Coordinates are stored on a per Vertex basis
VERTEXBASED = 1 << 1, VERTEXBASED = 1 << 1,
/// Texture Coordinates are stored on a per Halfedge basis ( per vertex per face )
HALFEDGEBASED = 1 << 2, HALFEDGEBASED = 1 << 2,
MULTITEXTURE = 1 << 3 }; /// Texture coordinates are autogenerated by OpenGL for Environment map
ENVIRONMENT = 1 << 3,
/// MultiTexture Mode
MULTITEXTURE = 1 << 4 };
class TexParameters class TexParameters
{ {
......
...@@ -222,8 +222,6 @@ void texturePropertiesWidget::textureChanged(QTreeWidgetItem* _item, int _column ...@@ -222,8 +222,6 @@ void texturePropertiesWidget::textureChanged(QTreeWidgetItem* _item, int _column
indexLabel->setEnabled(true); indexLabel->setEnabled(true);
indexBox->setEnabled(true); indexBox->setEnabled(true);
indexBox->clear(); indexBox->clear();
std::cerr << "Property status: " << std::endl;
indexBox->addItem("TODO"); indexBox->addItem("TODO");
break; break;
case HALFEDGEBASED: case HALFEDGEBASED:
...@@ -238,6 +236,12 @@ void texturePropertiesWidget::textureChanged(QTreeWidgetItem* _item, int _column ...@@ -238,6 +236,12 @@ void texturePropertiesWidget::textureChanged(QTreeWidgetItem* _item, int _column
indexBox->setEnabled(false); indexBox->setEnabled(false);
indexBox->clear(); indexBox->clear();
break; break;
case ENVIRONMENT:
typeLabel->setText("Type: Environment Map");
indexLabel->setEnabled(false);
indexBox->setEnabled(false);
indexBox->clear();
break;
case UNSET: case UNSET:
typeLabel->setText("Type: Unset"); typeLabel->setText("Type: Unset");
indexLabel->setEnabled(false); indexLabel->setEnabled(false);
......
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