From 8327e5c3c27781a982e5258fd5a94dfef5d2dcf1 Mon Sep 17 00:00:00 2001 From: adv Date: Thu, 14 Nov 2013 08:51:54 +0000 Subject: [PATCH] Transparency for immersible zones correction(Bug #71). --- src/HYDROGUI/HYDROGUI_Shape.cxx | 25 +++++++++++++++++++------ src/HYDROGUI/HYDROGUI_Shape.h | 4 ++-- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index 9a6c0ca7..41cf8299 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -26,6 +26,7 @@ #include "HYDROGUI_Tool.h" #include +#include #include #include @@ -359,7 +360,17 @@ void HYDROGUI_Shape::buildShape() if ( myTopoShape.IsNull() ) return; - myShape = new AIS_TexturedShape( myTopoShape ); + QString aTextureFileName = getTextureFileName(); + bool anIsTexture = !aTextureFileName.isEmpty(); + + if ( anIsTexture ) + { + myShape = new AIS_TexturedShape( myTopoShape ); + } + else + { + myShape = new AIS_Shape( myTopoShape ); + } if ( !myObject.IsNull() ) myShape->SetOwner( myObject ); @@ -367,12 +378,14 @@ void HYDROGUI_Shape::buildShape() myShape->SetTransparency( 0 ); myShape->SetDisplayMode( (AIS_DisplayMode)myDisplayMode ); - QString aTextureFileName = getTextureFileName(); - if( !aTextureFileName.isEmpty() ) + if( anIsTexture ) { - myShape->SetTextureFileName( HYDROGUI_Tool::ToAsciiString( aTextureFileName ) ); - myShape->SetTextureMapOn(); - myShape->DisableTextureModulate(); + Handle(AIS_TexturedShape) aTexturedShape = + Handle(AIS_TexturedShape)::DownCast( myShape ); + + aTexturedShape->SetTextureFileName( HYDROGUI_Tool::ToAsciiString( aTextureFileName ) ); + aTexturedShape->SetTextureMapOn(); + aTexturedShape->DisableTextureModulate(); } // Init default params for shape diff --git a/src/HYDROGUI/HYDROGUI_Shape.h b/src/HYDROGUI/HYDROGUI_Shape.h index 007c3e52..84880112 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.h +++ b/src/HYDROGUI/HYDROGUI_Shape.h @@ -24,7 +24,7 @@ #define HYDROGUI_SHAPE_H #include -#include +#include #include @@ -107,7 +107,7 @@ private: private: Handle(AIS_InteractiveContext) myContext; Handle(HYDROData_Entity) myObject; - Handle(AIS_TexturedShape) myShape; + Handle(AIS_Shape) myShape; bool myIsToUpdate; bool myIsVisible; -- 2.39.2