Skip to content
Snippets Groups Projects
Commit 81e74ac1 authored by Jan Möbius's avatar Jan Möbius
Browse files

New texture handling with support for multiple textures per object

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4650 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 02ebfb87
Branches
No related tags found
No related merge requests found
......@@ -102,13 +102,6 @@ void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _ident
if ( activeTexture_ != _textureName)
return;
const bool repeat = textures_[textureid].repeat;
if( object->dataType( DATA_TRIANGLE_MESH ) ) {
TriMesh* mesh = PluginFunctions::triMesh(object);
doUpdateTexture(textureid, *mesh);
PluginFunctions::triMeshObject(object)->textureNode()->set_repeat(repeat);
QString filename = OpenFlipper::Options::textureDir().absolutePath() +
OpenFlipper::Options::dirSeparator() +
textures_[textureid].filename;
......@@ -121,28 +114,26 @@ void TextureControlPlugin::slotTextureUpdated( QString _textureName , int _ident
return ;
}
PluginFunctions::triMeshObject(object)->addTexture(_textureName,textureImage);
if( object->dataType( DATA_TRIANGLE_MESH ) ) {
TriMesh* mesh = PluginFunctions::triMesh(object);
doUpdateTexture(textureid, *mesh);
PluginFunctions::triMeshObject(object)->textureNode()->set_repeat(textures_[textureid].repeat);
PluginFunctions::triMeshObject(object)->setTexture(_textureName,textureImage);
//TODO
//textureExists
//enableTexture
}
if ( object->dataType( DATA_POLY_MESH ) ) {
PolyMesh* mesh = PluginFunctions::polyMesh(object);
doUpdateTexture(textureid, *mesh);
PluginFunctions::polyMeshObject(object)->textureNode()->set_repeat(textures_[textureid].repeat);
PluginFunctions::polyMeshObject(object)->setTexture(_textureName,textureImage);
PluginFunctions::polyMeshObject(object)->textureNode()->set_repeat(repeat);
QString filename = OpenFlipper::Options::textureDir().absolutePath() +
OpenFlipper::Options::dirSeparator() +
textures_[textureid].filename;
// load to image
QImage textureImage;
if ( !textureImage.load( filename ) )
{
std::cerr << "Cannot load texture " << filename.toStdString() << "\n";
return ;
}
PluginFunctions::polyMeshObject(object)->addTexture(_textureName,textureImage);
//TODO
//textureExists
//enableTexture
}
emit updateView();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment