mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-12 08:13:07 +05:00
0021719: EDF 1654 : Materials
This commit is contained in:
parent
6532e3f033
commit
a0d61b1163
@ -58,6 +58,7 @@
|
|||||||
<parameter name="marker_scale" value="1" />
|
<parameter name="marker_scale" value="1" />
|
||||||
<parameter name="geom_preview" value="false" />
|
<parameter name="geom_preview" value="false" />
|
||||||
<parameter name="material" value="Plastic" />
|
<parameter name="material" value="Plastic" />
|
||||||
|
<parameter name="predef_materials" value="true" />
|
||||||
<parameter name="edge_width" value="1" />
|
<parameter name="edge_width" value="1" />
|
||||||
<parameter name="isolines_width" value="1" />
|
<parameter name="isolines_width" value="1" />
|
||||||
<parameter name="preview_edge_width" value="1" />
|
<parameter name="preview_edge_width" value="1" />
|
||||||
|
@ -48,6 +48,15 @@ GEOMGUI::~GEOMGUI()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// class : GEOMGUI::OnGUIEvent
|
||||||
|
// purpose : Main/popup menu events processing
|
||||||
|
//=================================================================================
|
||||||
|
bool GEOMGUI::OnGUIEvent( int /*theCommandID*/, SUIT_Desktop* /*parent*/, const QVariant& /*theParam*/ )
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : GEOMGUI::OnGUIEvent
|
// class : GEOMGUI::OnGUIEvent
|
||||||
// purpose : Main/popup menu events processing
|
// purpose : Main/popup menu events processing
|
||||||
|
@ -51,6 +51,7 @@ public :
|
|||||||
|
|
||||||
// Each of this methods can be redifined by descendants
|
// Each of this methods can be redifined by descendants
|
||||||
virtual bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent );
|
virtual bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent );
|
||||||
|
virtual bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent, const QVariant& theParam );
|
||||||
|
|
||||||
virtual bool OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* );
|
virtual bool OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* );
|
||||||
virtual bool OnMouseMove( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* );
|
virtual bool OnMouseMove( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* );
|
||||||
|
@ -984,7 +984,15 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
|
|||||||
aStudy->setObjectProperty( aMgrId, anIO->getEntry(), MATERIAL_PROP, material.toProperties() );
|
aStudy->setObjectProperty( aMgrId, anIO->getEntry(), MATERIAL_PROP, material.toProperties() );
|
||||||
|
|
||||||
// Set material for the selected shape
|
// Set material for the selected shape
|
||||||
AISShape->SetMaterial( material.getMaterialOCCAspect() );
|
// Set front material for the selected shape
|
||||||
|
AISShape->SetCurrentFacingModel(Aspect_TOFM_FRONT_SIDE);
|
||||||
|
AISShape->SetMaterial( material.getMaterialOCCAspect( true ) );
|
||||||
|
// Set back material for the selected shape
|
||||||
|
AISShape->SetCurrentFacingModel(Aspect_TOFM_BACK_SIDE);
|
||||||
|
AISShape->SetMaterial( material.getMaterialOCCAspect( false ) );
|
||||||
|
// Return to the default facing mode
|
||||||
|
AISShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
|
||||||
|
|
||||||
if(HasWidth())
|
if(HasWidth())
|
||||||
aStudy->setObjectProperty( aMgrId, anIO->getEntry(), EDGE_WIDTH_PROP, GetWidth() );
|
aStudy->setObjectProperty( aMgrId, anIO->getEntry(), EDGE_WIDTH_PROP, GetWidth() );
|
||||||
if(HasIsosWidth())
|
if(HasIsosWidth())
|
||||||
@ -1191,7 +1199,8 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
|||||||
aStudy->setObjectProperty( aMgrId, anEntry, MATERIAL_PROP, material.toProperties() );
|
aStudy->setObjectProperty( aMgrId, anEntry, MATERIAL_PROP, material.toProperties() );
|
||||||
// Set the same front and back materials for the selected shape
|
// Set the same front and back materials for the selected shape
|
||||||
std::vector<vtkProperty*> aProps;
|
std::vector<vtkProperty*> aProps;
|
||||||
aProps.push_back( material.getMaterialVTKProperty() );
|
aProps.push_back( material.getMaterialVTKProperty( true ) );
|
||||||
|
aProps.push_back( material.getMaterialVTKProperty( false) );
|
||||||
aGeomGActor->SetMaterial(aProps);
|
aGeomGActor->SetMaterial(aProps);
|
||||||
|
|
||||||
vtkFloatingPointType aColor[3] = {1.,0.,0.};
|
vtkFloatingPointType aColor[3] = {1.,0.,0.};
|
||||||
@ -1240,7 +1249,8 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
|||||||
aStudy->setObjectProperty( aMgrId, anEntry, MATERIAL_PROP, material.toProperties() );
|
aStudy->setObjectProperty( aMgrId, anEntry, MATERIAL_PROP, material.toProperties() );
|
||||||
// Set material for the selected shape
|
// Set material for the selected shape
|
||||||
std::vector<vtkProperty*> aProps;
|
std::vector<vtkProperty*> aProps;
|
||||||
aProps.push_back( material.getMaterialVTKProperty() );
|
aProps.push_back( material.getMaterialVTKProperty( true ) );
|
||||||
|
aProps.push_back( material.getMaterialVTKProperty( false ) );
|
||||||
aGeomGActor->SetMaterial(aProps);
|
aGeomGActor->SetMaterial(aProps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2966,6 +2966,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>MEN_TOOLS</source>
|
<source>MEN_TOOLS</source>
|
||||||
<translation>Tools</translation>
|
<translation>Tools</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>MEN_MATERIALS_LIBRARY</source>
|
||||||
|
<translation>Materials library</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MEN_TORUS</source>
|
<source>MEN_TORUS</source>
|
||||||
<translation>Torus</translation>
|
<translation>Torus</translation>
|
||||||
@ -3026,6 +3030,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>MEN_POP_MATERIAL_PROPERTIES</source>
|
<source>MEN_POP_MATERIAL_PROPERTIES</source>
|
||||||
<translation>Material Properties</translation>
|
<translation>Material Properties</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>MEN_POP_PREDEF_MATER_CUSTOM</source>
|
||||||
|
<translation>Custom...</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>NAME_LBL</source>
|
<source>NAME_LBL</source>
|
||||||
<translation>Name: </translation>
|
<translation>Name: </translation>
|
||||||
@ -3170,6 +3178,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>PREF_MATERIAL</source>
|
<source>PREF_MATERIAL</source>
|
||||||
<translation>Default material</translation>
|
<translation>Default material</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>PREF_PREDEF_MATERIALS</source>
|
||||||
|
<translation>Show predefined materials in popup menu</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>PREF_EDGE_WIDTH</source>
|
<source>PREF_EDGE_WIDTH</source>
|
||||||
<translation>Edges width</translation>
|
<translation>Edges width</translation>
|
||||||
@ -3202,6 +3214,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>PROCESS_SHAPE_NEW_OBJ_NAME</source>
|
<source>PROCESS_SHAPE_NEW_OBJ_NAME</source>
|
||||||
<translation>ProcessShape</translation>
|
<translation>ProcessShape</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>MATERIAL_LIBRARY_TLT</source>
|
||||||
|
<translation>Materials Library</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>REMOVE_HOLES_NEW_OBJ_NAME</source>
|
<source>REMOVE_HOLES_NEW_OBJ_NAME</source>
|
||||||
<translation>SupressHoles</translation>
|
<translation>SupressHoles</translation>
|
||||||
@ -3614,6 +3630,14 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>STB_POP_WIREFRAME</source>
|
<source>STB_POP_WIREFRAME</source>
|
||||||
<translation>Wireframe</translation>
|
<translation>Wireframe</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>STB_MATERIALS_LIBRARY</source>
|
||||||
|
<translation>Displays content of Materials library</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>STB_POP_PREDEF_MATER_CUSTOM</source>
|
||||||
|
<translation>Custom...</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>STB_PROPAGATE</source>
|
<source>STB_PROPAGATE</source>
|
||||||
<translation>Propagate</translation>
|
<translation>Propagate</translation>
|
||||||
@ -5566,6 +5590,14 @@ Would you like to continue?</translation>
|
|||||||
<source>MATERIAL_PROPERTIES_TLT</source>
|
<source>MATERIAL_PROPERTIES_TLT</source>
|
||||||
<translation>Color and Material Properties</translation>
|
<translation>Color and Material Properties</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FRONT_FACE</source>
|
||||||
|
<translation>Front face</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>BACK_FACE</source>
|
||||||
|
<translation>Back face</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>REFLECTION_0</source>
|
<source>REFLECTION_0</source>
|
||||||
<translation>Ambient</translation>
|
<translation>Ambient</translation>
|
||||||
@ -5582,10 +5614,6 @@ Would you like to continue?</translation>
|
|||||||
<source>REFLECTION_3</source>
|
<source>REFLECTION_3</source>
|
||||||
<translation>Emissive</translation>
|
<translation>Emissive</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>ENABLED</source>
|
|
||||||
<translation>Enabled</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>SHININESS</source>
|
<source>SHININESS</source>
|
||||||
<translation>Shininess:</translation>
|
<translation>Shininess:</translation>
|
||||||
|
@ -5557,10 +5557,6 @@ Voulez-vous continuer?</translation>
|
|||||||
<source>REFLECTION_3</source>
|
<source>REFLECTION_3</source>
|
||||||
<translation>Emissive</translation>
|
<translation>Emissive</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>ENABLED</source>
|
|
||||||
<translation>Activée</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>SHININESS</source>
|
<source>SHININESS</source>
|
||||||
<translation>Brillance:</translation>
|
<translation>Brillance:</translation>
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "GEOM_Actor.h"
|
#include "GEOM_Actor.h"
|
||||||
|
|
||||||
#include <Material_ResourceMgr.h>
|
#include <Material_ResourceMgr.h>
|
||||||
|
#include <Material_Model.h>
|
||||||
|
|
||||||
#include <SUIT_Desktop.h>
|
#include <SUIT_Desktop.h>
|
||||||
#include <SUIT_MessageBox.h>
|
#include <SUIT_MessageBox.h>
|
||||||
@ -84,6 +85,7 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QSignalMapper>
|
||||||
|
|
||||||
#include <AIS_Drawer.hxx>
|
#include <AIS_Drawer.hxx>
|
||||||
#include <AIS_ListOfInteractive.hxx>
|
#include <AIS_ListOfInteractive.hxx>
|
||||||
@ -358,7 +360,7 @@ void GeometryGUI::OnGUIEvent()
|
|||||||
// function : GeometryGUI::OnGUIEvent()
|
// function : GeometryGUI::OnGUIEvent()
|
||||||
// purpose : manage all events on GUI [static]
|
// purpose : manage all events on GUI [static]
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void GeometryGUI::OnGUIEvent( int id )
|
void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
|
||||||
{
|
{
|
||||||
SUIT_Application* anApp = application();
|
SUIT_Application* anApp = application();
|
||||||
if (!anApp) return;
|
if (!anApp) return;
|
||||||
@ -407,6 +409,7 @@ void GeometryGUI::OnGUIEvent( int id )
|
|||||||
case GEOMOp::OpSelectAll: // POPUP MENU - SELECT ONLY - SELECT ALL
|
case GEOMOp::OpSelectAll: // POPUP MENU - SELECT ONLY - SELECT ALL
|
||||||
case GEOMOp::OpDelete: // MENU EDIT - DELETE
|
case GEOMOp::OpDelete: // MENU EDIT - DELETE
|
||||||
case GEOMOp::OpCheckGeom: // MENU TOOLS - CHECK GEOMETRY
|
case GEOMOp::OpCheckGeom: // MENU TOOLS - CHECK GEOMETRY
|
||||||
|
case GEOMOp::OpMaterialsLibrary: // MENU TOOLS - MATERIALS LIBRARY
|
||||||
case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT
|
case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT
|
||||||
case GEOMOp::OpColor: // POPUP MENU - COLOR
|
case GEOMOp::OpColor: // POPUP MENU - COLOR
|
||||||
case GEOMOp::OpSetTexture: // POPUP MENU - SETTEXTURE
|
case GEOMOp::OpSetTexture: // POPUP MENU - SETTEXTURE
|
||||||
@ -424,6 +427,8 @@ void GeometryGUI::OnGUIEvent( int id )
|
|||||||
case GEOMOp::OpPublishObject: // ROOT GEOM OBJECT - POPUP MENU - PUBLISH
|
case GEOMOp::OpPublishObject: // ROOT GEOM OBJECT - POPUP MENU - PUBLISH
|
||||||
case GEOMOp::OpPointMarker: // POPUP MENU - POINT MARKER
|
case GEOMOp::OpPointMarker: // POPUP MENU - POINT MARKER
|
||||||
case GEOMOp::OpMaterialProperties: // POPUP MENU - MATERIAL PROPERTIES
|
case GEOMOp::OpMaterialProperties: // POPUP MENU - MATERIAL PROPERTIES
|
||||||
|
case GEOMOp::OpPredefMaterial: // POPUP MENU - <SOME MATERIAL>
|
||||||
|
case GEOMOp::OpPredefMaterCustom: // POPUP MENU - MATERIAL PROPERTIES - CUSTOM...
|
||||||
case GEOMOp::OpEdgeWidth: // POPUP MENU - LINE WIDTH - EDGE WIDTH
|
case GEOMOp::OpEdgeWidth: // POPUP MENU - LINE WIDTH - EDGE WIDTH
|
||||||
case GEOMOp::OpIsosWidth: // POPUP MENU - LINE WIDTH - ISOS WIDTH
|
case GEOMOp::OpIsosWidth: // POPUP MENU - LINE WIDTH - ISOS WIDTH
|
||||||
case GEOMOp::OpBringToFront: // POPUP MENU - BRING TO FRONT
|
case GEOMOp::OpBringToFront: // POPUP MENU - BRING TO FRONT
|
||||||
@ -594,8 +599,10 @@ void GeometryGUI::OnGUIEvent( int id )
|
|||||||
|
|
||||||
// call method of corresponding GUI library
|
// call method of corresponding GUI library
|
||||||
if ( library ) {
|
if ( library ) {
|
||||||
library->OnGUIEvent( id, desk );
|
if( !theParam.isValid() )
|
||||||
|
library->OnGUIEvent( id, desk );
|
||||||
|
else
|
||||||
|
library->OnGUIEvent( id, desk, theParam);
|
||||||
// Update a list of materials for "Preferences" dialog
|
// Update a list of materials for "Preferences" dialog
|
||||||
if ( id == GEOMOp::OpMaterialProperties ) {
|
if ( id == GEOMOp::OpMaterialProperties ) {
|
||||||
LightApp_Preferences* pref = preferences();
|
LightApp_Preferences* pref = preferences();
|
||||||
@ -845,6 +852,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
createGeomAction( GEOMOp::OpCheckGeom, "CHECK_GEOMETRY" );
|
createGeomAction( GEOMOp::OpCheckGeom, "CHECK_GEOMETRY" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
createGeomAction( GEOMOp::OpMaterialsLibrary, "MATERIALS_LIBRARY" );
|
||||||
createGeomAction( GEOMOp::OpDMWireframe, "WIREFRAME" );
|
createGeomAction( GEOMOp::OpDMWireframe, "WIREFRAME" );
|
||||||
createGeomAction( GEOMOp::OpDMShading, "SHADING" );
|
createGeomAction( GEOMOp::OpDMShading, "SHADING" );
|
||||||
createGeomAction( GEOMOp::OpDMShadingWithEdges, "SHADING_WITH_EDGES" );
|
createGeomAction( GEOMOp::OpDMShadingWithEdges, "SHADING_WITH_EDGES" );
|
||||||
@ -886,7 +894,8 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
createGeomAction( GEOMOp::OpUnpublishObject, "POP_UNPUBLISH_OBJ" );
|
createGeomAction( GEOMOp::OpUnpublishObject, "POP_UNPUBLISH_OBJ" );
|
||||||
createGeomAction( GEOMOp::OpPublishObject, "POP_PUBLISH_OBJ" );
|
createGeomAction( GEOMOp::OpPublishObject, "POP_PUBLISH_OBJ" );
|
||||||
createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" );
|
createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" );
|
||||||
createGeomAction( GEOMOp::OpMaterialProperties, "POP_MATERIAL_PROPERTIES" );
|
createGeomAction( GEOMOp::OpMaterialProperties, "POP_MATERIAL_PROPERTIES" );
|
||||||
|
createGeomAction( GEOMOp::OpPredefMaterCustom, "POP_PREDEF_MATER_CUSTOM" );
|
||||||
|
|
||||||
createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
|
createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
|
||||||
|
|
||||||
@ -1085,6 +1094,11 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
createMenu( GEOMOp::OpCheckGeom, toolsId, -1 );
|
createMenu( GEOMOp::OpCheckGeom, toolsId, -1 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1 );
|
||||||
|
createMenu( separator(), toolsId, -1 );
|
||||||
|
createMenu( GEOMOp::OpMaterialsLibrary, toolsId, -1 );
|
||||||
|
createMenu( separator(), toolsId, -1 );
|
||||||
|
|
||||||
int viewId = createMenu( tr( "MEN_VIEW" ), -1, -1 );
|
int viewId = createMenu( tr( "MEN_VIEW" ), -1, -1 );
|
||||||
createMenu( separator(), viewId, -1 );
|
createMenu( separator(), viewId, -1 );
|
||||||
|
|
||||||
@ -1288,6 +1302,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
|
mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
|
||||||
mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK + " and isVectorsMode", QtxPopupMgr::ToggleRule );
|
mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK + " and isVectorsMode", QtxPopupMgr::ToggleRule );
|
||||||
mgr->insert( separator(), -1, -1 ); // -----------
|
mgr->insert( separator(), -1, -1 ); // -----------
|
||||||
|
|
||||||
mgr->insert( action( GEOMOp::OpColor ), -1, -1 ); // color
|
mgr->insert( action( GEOMOp::OpColor ), -1, -1 ); // color
|
||||||
mgr->setRule( action( GEOMOp::OpColor ), clientOCCorVTKorOB_AndSomeVisible + " and ($component={'GEOM'})" + "and isPhysicalMaterial=false", QtxPopupMgr::VisibleRule );
|
mgr->setRule( action( GEOMOp::OpColor ), clientOCCorVTKorOB_AndSomeVisible + " and ($component={'GEOM'})" + "and isPhysicalMaterial=false", QtxPopupMgr::VisibleRule );
|
||||||
mgr->insert( action( GEOMOp::OpTransparency ), -1, -1 ); // transparency
|
mgr->insert( action( GEOMOp::OpTransparency ), -1, -1 ); // transparency
|
||||||
@ -1299,9 +1314,13 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
mgr->insert( action( GEOMOp::OpPointMarker ), -1, -1 ); // point marker
|
mgr->insert( action( GEOMOp::OpPointMarker ), -1, -1 ); // point marker
|
||||||
//mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg(GEOM_POINT ), QtxPopupMgr::VisibleRule );
|
//mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg(GEOM_POINT ), QtxPopupMgr::VisibleRule );
|
||||||
mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and ( $typeid in {%1} or compoundOfVertices=true ) " ).arg(GEOM::VERTEX).arg(GEOM::COMPOUND), QtxPopupMgr::VisibleRule );
|
mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and ( $typeid in {%1} or compoundOfVertices=true ) " ).arg(GEOM::VERTEX).arg(GEOM::COMPOUND), QtxPopupMgr::VisibleRule );
|
||||||
mgr->insert( action( GEOMOp::OpMaterialProperties ), -1, -1 ); // material properties
|
|
||||||
mgr->setRule( action( GEOMOp::OpMaterialProperties ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'}) and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
|
// material properties
|
||||||
mgr->insert( action( GEOMOp::OpSetTexture ), -1, -1 ); // texture
|
int MaterId = mgr->insert( action( GEOMOp::OpMaterialProperties ), -1, -1 );
|
||||||
|
mgr->setRule( action( GEOMOp::OpMaterialProperties ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
|
||||||
|
|
||||||
|
// texture
|
||||||
|
mgr->insert( action( GEOMOp::OpSetTexture ), -1, -1 );
|
||||||
mgr->setRule( action( GEOMOp::OpSetTexture ), clientOCCorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
|
mgr->setRule( action( GEOMOp::OpSetTexture ), clientOCCorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
|
||||||
|
|
||||||
int lineW = mgr->insert( tr( "MEN_LINE_WIDTH" ), -1, -1 ); // line width menu
|
int lineW = mgr->insert( tr( "MEN_LINE_WIDTH" ), -1, -1 ); // line width menu
|
||||||
@ -1688,6 +1707,55 @@ void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString&
|
|||||||
SalomeApp_Module::contextMenuPopup( client, menu, title );
|
SalomeApp_Module::contextMenuPopup( client, menu, title );
|
||||||
SALOME_ListIO lst;
|
SALOME_ListIO lst;
|
||||||
getApp()->selectionMgr()->selectedObjects( lst );
|
getApp()->selectionMgr()->selectedObjects( lst );
|
||||||
|
|
||||||
|
//Add submenu for predefined materials
|
||||||
|
bool isPredefMat = SUIT_Session::session()->resourceMgr()->booleanValue( "Geometry", "predef_materials" );
|
||||||
|
if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() > 0 ) {
|
||||||
|
QtxPopupMgr* mgr = popupMgr();
|
||||||
|
//get parrent for submenu
|
||||||
|
QAction* act = mgr->action( mgr->actionId( action( GEOMOp::OpMaterialProperties ) ) );
|
||||||
|
//Clear old menu
|
||||||
|
QMenu* oldMenu = act->menu() ;
|
||||||
|
if( oldMenu ) {
|
||||||
|
delete oldMenu;
|
||||||
|
}
|
||||||
|
if( isPredefMat ){
|
||||||
|
QMenu* matMenu = new QMenu();
|
||||||
|
QSignalMapper* signalMapper = new QSignalMapper( matMenu );
|
||||||
|
|
||||||
|
//Get current material model for the object
|
||||||
|
QVariant v;
|
||||||
|
LightApp_Application* anApp = dynamic_cast<LightApp_Application*>( getApp() );
|
||||||
|
if ( anApp && anApp->activeViewManager() ) {
|
||||||
|
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( anApp->activeStudy() );
|
||||||
|
if( aStudy ) {
|
||||||
|
v = aStudy->getObjectProperty( anApp->activeViewManager()->getGlobalId(), lst.Last()->getEntry(), MATERIAL_PROP, QVariant() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QString curModel = "";
|
||||||
|
if ( v.canConvert<QString>() ) curModel = v.toString();
|
||||||
|
// get list of all predefined materials
|
||||||
|
Material_ResourceMgr aMatResMgr;
|
||||||
|
QStringList matNameList = aMatResMgr.materials();
|
||||||
|
foreach ( QString name, matNameList )
|
||||||
|
{
|
||||||
|
QAction* menAct = matMenu->addAction( name );
|
||||||
|
connect(menAct, SIGNAL( toggled( bool ) ), signalMapper, SLOT( map() ) );
|
||||||
|
signalMapper->setMapping( menAct, name );
|
||||||
|
menAct->setCheckable( true );
|
||||||
|
// Set checked if this material is current
|
||||||
|
Material_Model aModel;
|
||||||
|
aModel.fromResources( name );
|
||||||
|
menAct->setChecked( aModel.toProperties() == curModel );
|
||||||
|
}
|
||||||
|
matMenu->insertAction( matMenu->addSeparator(), action( GEOMOp::OpPredefMaterCustom ) );
|
||||||
|
matMenu->insertSeparator( action( GEOMOp::OpPredefMaterCustom ) );
|
||||||
|
connect( signalMapper, SIGNAL( mapped( const QString & ) ),
|
||||||
|
this, SLOT( OnSetMaterial( const QString & ) ) );
|
||||||
|
act->setMenu( matMenu );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Set name
|
||||||
if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) {
|
if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) {
|
||||||
Handle(SALOME_InteractiveObject) io = lst.First();
|
Handle(SALOME_InteractiveObject) io = lst.First();
|
||||||
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
|
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
|
||||||
@ -1701,6 +1769,12 @@ void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeometryGUI::OnSetMaterial(const QString& theName)
|
||||||
|
{
|
||||||
|
OnGUIEvent( GEOMOp::OpPredefMaterial, QVariant( theName ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GeometryGUI::createPreferences()
|
void GeometryGUI::createPreferences()
|
||||||
{
|
{
|
||||||
int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
|
int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
|
||||||
@ -1745,6 +1819,9 @@ void GeometryGUI::createPreferences()
|
|||||||
int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup,
|
int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup,
|
||||||
LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
|
LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
|
||||||
|
|
||||||
|
int predef_materials = addPreference( tr( "PREF_PREDEF_MATERIALS" ), genGroup,
|
||||||
|
LightApp_Preferences::Bool, "Geometry", "predef_materials" );
|
||||||
|
|
||||||
int material = addPreference( tr( "PREF_MATERIAL" ), genGroup,
|
int material = addPreference( tr( "PREF_MATERIAL" ), genGroup,
|
||||||
LightApp_Preferences::Selector,
|
LightApp_Preferences::Selector,
|
||||||
"Geometry", "material" );
|
"Geometry", "material" );
|
||||||
@ -1863,6 +1940,8 @@ void GeometryGUI::createPreferences()
|
|||||||
setPreferenceProperty( defl, "step", 1.0e-04 );
|
setPreferenceProperty( defl, "step", 1.0e-04 );
|
||||||
setPreferenceProperty( defl, "precision", 6 );
|
setPreferenceProperty( defl, "precision", 6 );
|
||||||
|
|
||||||
|
// Set property for 'Show predefined materials'
|
||||||
|
setPreferenceProperty( predef_materials, "eval", true);
|
||||||
// Set property for default material
|
// Set property for default material
|
||||||
Material_ResourceMgr aMatResMgr;
|
Material_ResourceMgr aMatResMgr;
|
||||||
setPreferenceProperty( material, "strings", aMatResMgr.materials() );
|
setPreferenceProperty( material, "strings", aMatResMgr.materials() );
|
||||||
|
@ -111,7 +111,7 @@ public:
|
|||||||
void EmitSignalDefaultStepValueChanged( double newVal );
|
void EmitSignalDefaultStepValueChanged( double newVal );
|
||||||
|
|
||||||
// Process action
|
// Process action
|
||||||
void OnGUIEvent( int id );
|
void OnGUIEvent( int id, const QVariant& theParam = QVariant( QVariant::Invalid ) );
|
||||||
|
|
||||||
// The Working Plane management
|
// The Working Plane management
|
||||||
void SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp; }
|
void SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp; }
|
||||||
@ -151,6 +151,7 @@ private slots:
|
|||||||
void OnGUIEvent();
|
void OnGUIEvent();
|
||||||
void onWindowActivated( SUIT_ViewWindow* );
|
void onWindowActivated( SUIT_ViewWindow* );
|
||||||
void onViewAboutToShow();
|
void onViewAboutToShow();
|
||||||
|
void OnSetMaterial( const QString& );
|
||||||
|
|
||||||
signals :
|
signals :
|
||||||
void SignalDeactivateActiveDialog();
|
void SignalDeactivateActiveDialog();
|
||||||
|
@ -29,6 +29,7 @@ namespace GEOMOp {
|
|||||||
OpExport = 1001, // MENU FILE - EXPORT
|
OpExport = 1001, // MENU FILE - EXPORT
|
||||||
OpDelete = 1020, // MENU EDIT - DELETE
|
OpDelete = 1020, // MENU EDIT - DELETE
|
||||||
OpCheckGeom = 1030, // MENU TOOLS - CHECK GEOMETRY
|
OpCheckGeom = 1030, // MENU TOOLS - CHECK GEOMETRY
|
||||||
|
OpMaterialsLibrary = 1040, // MENU TOOLS - MATERIALS LIBRARY
|
||||||
OpSelectVertex = 1100, // POPUP MENU - SELECT ONLY - VERTEX
|
OpSelectVertex = 1100, // POPUP MENU - SELECT ONLY - VERTEX
|
||||||
OpSelectEdge = 1101, // POPUP MENU - SELECT ONLY - EDGE
|
OpSelectEdge = 1101, // POPUP MENU - SELECT ONLY - EDGE
|
||||||
OpSelectWire = 1102, // POPUP MENU - SELECT ONLY - WIRE
|
OpSelectWire = 1102, // POPUP MENU - SELECT ONLY - WIRE
|
||||||
@ -50,6 +51,8 @@ namespace GEOMOp {
|
|||||||
OpPointMarker = 1210, // POPUP MENU - POINT MARKER
|
OpPointMarker = 1210, // POPUP MENU - POINT MARKER
|
||||||
OpSetTexture = 1211, // POPUP MENU - SETTEXTURE
|
OpSetTexture = 1211, // POPUP MENU - SETTEXTURE
|
||||||
OpMaterialProperties = 1212, // POPUP MENU - MATERIAL PROPERTIES
|
OpMaterialProperties = 1212, // POPUP MENU - MATERIAL PROPERTIES
|
||||||
|
OpPredefMaterial = 1213, // POPUP MENU - MATERIAL PROPERTIES - <SOME MATERIAL>
|
||||||
|
OpPredefMaterCustom = 1214, // POPUP MENU - MATERIAL PROPERTIES - CUSTOM...
|
||||||
OpDiscloseChildren = 1250, // POPUP MENU - DISCLOSE CHILD ITEMS
|
OpDiscloseChildren = 1250, // POPUP MENU - DISCLOSE CHILD ITEMS
|
||||||
OpConcealChildren = 1251, // POPUP MENU - CONCEAL CHILD ITEMS
|
OpConcealChildren = 1251, // POPUP MENU - CONCEAL CHILD ITEMS
|
||||||
OpUnpublishObject = 1253, // POPUP MENU - UNPUBLISH
|
OpUnpublishObject = 1253, // POPUP MENU - UNPUBLISH
|
||||||
|
@ -325,7 +325,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
|
|||||||
case GEOMOp::OpColor: // POPUP - COLOR
|
case GEOMOp::OpColor: // POPUP - COLOR
|
||||||
OnColor();
|
OnColor();
|
||||||
break;
|
break;
|
||||||
case GEOMOp::OpSetTexture: // POPUP - TEXTURE
|
case GEOMOp::OpSetTexture: // POPUP - TEXTURE
|
||||||
OnTexture();
|
OnTexture();
|
||||||
break;
|
break;
|
||||||
case GEOMOp::OpTransparency: // POPUP - TRANSPARENCY
|
case GEOMOp::OpTransparency: // POPUP - TRANSPARENCY
|
||||||
@ -349,6 +349,12 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
|
|||||||
case GEOMOp::OpMaterialProperties: // POPUP - MATERIAL PROPERTIES
|
case GEOMOp::OpMaterialProperties: // POPUP - MATERIAL PROPERTIES
|
||||||
OnMaterialProperties();
|
OnMaterialProperties();
|
||||||
break;
|
break;
|
||||||
|
case GEOMOp::OpPredefMaterCustom: // POPUP - MATERIAL PROPERTIES - CUSTOM...
|
||||||
|
OnMaterialProperties();
|
||||||
|
break;
|
||||||
|
case GEOMOp::OpMaterialsLibrary: // POPUP MENU - MATERIAL PROPERTIES
|
||||||
|
OnMaterialsLibrary();
|
||||||
|
break;
|
||||||
case GEOMOp::OpAutoColor: // POPUP - AUTO COLOR
|
case GEOMOp::OpAutoColor: // POPUP - AUTO COLOR
|
||||||
OnAutoColor();
|
OnAutoColor();
|
||||||
break;
|
break;
|
||||||
@ -387,6 +393,25 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : OnGUIEvent()
|
||||||
|
// purpose :
|
||||||
|
//=======================================================================
|
||||||
|
bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent, const QVariant& theParam )
|
||||||
|
{
|
||||||
|
getGeometryGUI()->EmitSignalDeactivateDialog();
|
||||||
|
|
||||||
|
switch ( theCommandID ) {
|
||||||
|
case GEOMOp::OpPredefMaterial: // POPUP MENU - MATERIAL PROPERTIES - <SOME MATERIAL>
|
||||||
|
OnSetMaterial( theParam );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//===============================================================================
|
//===============================================================================
|
||||||
// function : OnEditDelete()
|
// function : OnEditDelete()
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -54,6 +54,8 @@ public:
|
|||||||
~GEOMToolsGUI();
|
~GEOMToolsGUI();
|
||||||
|
|
||||||
bool OnGUIEvent( int, SUIT_Desktop* );
|
bool OnGUIEvent( int, SUIT_Desktop* );
|
||||||
|
bool OnGUIEvent( int theCommandID, SUIT_Desktop*, const QVariant& );
|
||||||
|
|
||||||
virtual void deactivate();
|
virtual void deactivate();
|
||||||
|
|
||||||
enum ActionType { SHOWDLG, INCR, DECR };
|
enum ActionType { SHOWDLG, INCR, DECR };
|
||||||
@ -82,6 +84,8 @@ private:
|
|||||||
void OnPublishObject() ;
|
void OnPublishObject() ;
|
||||||
void OnPointMarker();
|
void OnPointMarker();
|
||||||
void OnMaterialProperties();
|
void OnMaterialProperties();
|
||||||
|
void OnMaterialsLibrary();
|
||||||
|
void OnSetMaterial(const QVariant& );
|
||||||
void OnEdgeWidth();
|
void OnEdgeWidth();
|
||||||
void OnIsosWidth();
|
void OnIsosWidth();
|
||||||
void OnBringToFront();
|
void OnBringToFront();
|
||||||
|
@ -34,7 +34,9 @@
|
|||||||
#include "GEOMToolsGUI_PublishDlg.h"
|
#include "GEOMToolsGUI_PublishDlg.h"
|
||||||
#include "GEOMToolsGUI_MaterialPropertiesDlg.h"
|
#include "GEOMToolsGUI_MaterialPropertiesDlg.h"
|
||||||
#include "GEOMToolsGUI_LineWidthDlg.h"
|
#include "GEOMToolsGUI_LineWidthDlg.h"
|
||||||
#include "Material_Model.h"
|
#include <Material_Model.h>
|
||||||
|
|
||||||
|
#include <GEOM_VTKPropertyMaterial.hxx>
|
||||||
|
|
||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
#include <GeometryGUI_Operations.h>
|
#include <GeometryGUI_Operations.h>
|
||||||
@ -109,6 +111,7 @@
|
|||||||
// VTK includes
|
// VTK includes
|
||||||
#include <vtkRenderer.h>
|
#include <vtkRenderer.h>
|
||||||
|
|
||||||
|
class QtxDialog;
|
||||||
// If the next macro is defined, autocolor feature works for all sub-shapes;
|
// If the next macro is defined, autocolor feature works for all sub-shapes;
|
||||||
// if it is undefined, autocolor feature works for groups only
|
// if it is undefined, autocolor feature works for groups only
|
||||||
#define GENERAL_AUTOCOLOR
|
#define GENERAL_AUTOCOLOR
|
||||||
@ -1006,7 +1009,14 @@ void GEOMToolsGUI::OnPointMarker()
|
|||||||
|
|
||||||
void GEOMToolsGUI::OnMaterialProperties()
|
void GEOMToolsGUI::OnMaterialProperties()
|
||||||
{
|
{
|
||||||
GEOMToolsGUI_MaterialPropertiesDlg dlg( SUIT_Session::session()->activeApplication()->desktop() );
|
GEOMToolsGUI_MaterialPropertiesDlg* dlg = new GEOMToolsGUI_MaterialPropertiesDlg( SUIT_Session::session()->activeApplication()->desktop(), true, false, QtxDialog::OK | QtxDialog::Close | QtxDialog::Apply | QtxDialog::Help );
|
||||||
|
dlg->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GEOMToolsGUI::OnMaterialsLibrary()
|
||||||
|
{
|
||||||
|
GEOMToolsGUI_MaterialPropertiesDlg dlg( SUIT_Session::session()->activeApplication()->desktop(), false, true, QtxDialog::Standard );
|
||||||
|
dlg.setWindowTitle( tr( "MATERIAL_LIBRARY_TLT" ) );
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1444,3 +1454,90 @@ void GEOMToolsGUI::OnClsBringToFront() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GEOMToolsGUI::OnSetMaterial( const QVariant& theParam )
|
||||||
|
{
|
||||||
|
QString theName;
|
||||||
|
if ( theParam.canConvert<QString>() ) theName = theParam.toString();
|
||||||
|
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||||
|
if ( !app )
|
||||||
|
return;
|
||||||
|
SalomeApp_Module* mod = dynamic_cast<SalomeApp_Module*>(app->activeModule());
|
||||||
|
if(!mod)
|
||||||
|
return;
|
||||||
|
GEOM_Displayer* disp = dynamic_cast<GEOM_Displayer*>(mod->displayer());
|
||||||
|
if(!disp)
|
||||||
|
return;
|
||||||
|
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
|
||||||
|
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
||||||
|
if ( !aSelMgr || !study )
|
||||||
|
return;
|
||||||
|
SALOME_ListIO selected;
|
||||||
|
aSelMgr->selectedObjects( selected );
|
||||||
|
if ( selected.IsEmpty() )
|
||||||
|
return;
|
||||||
|
SUIT_ViewWindow* window = app->desktop()->activeWindow();
|
||||||
|
int mgrId = window->getViewManager()->getGlobalId();
|
||||||
|
|
||||||
|
// convert needed material properties to the string representation
|
||||||
|
Material_Model aModel;
|
||||||
|
aModel.fromResources( theName );
|
||||||
|
QString prop = aModel.toProperties();
|
||||||
|
|
||||||
|
if ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ) {
|
||||||
|
// for VTK viewer
|
||||||
|
SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
|
||||||
|
if ( !vtkVW )
|
||||||
|
return;
|
||||||
|
|
||||||
|
SVTK_View* aView = vtkVW->getView();
|
||||||
|
|
||||||
|
// get VTK material properties from the current model
|
||||||
|
GEOM_VTKPropertyMaterial* vtkPropF = aModel.getMaterialVTKProperty();
|
||||||
|
GEOM_VTKPropertyMaterial* vtkPropB = aModel.getMaterialVTKProperty( false );
|
||||||
|
|
||||||
|
SUIT_OverrideCursor wc();
|
||||||
|
|
||||||
|
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
||||||
|
// set material property to the presentation
|
||||||
|
aView->SetMaterial( It.Value(), vtkPropF, vtkPropB );
|
||||||
|
// store chosen material in the property map
|
||||||
|
study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
|
||||||
|
// set correct color for the non-physical material
|
||||||
|
}
|
||||||
|
aView->Repaint();
|
||||||
|
GeometryGUI::Modified();
|
||||||
|
}
|
||||||
|
else if ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
|
||||||
|
// for OCC viewer
|
||||||
|
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
|
||||||
|
if ( !vm )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Handle(AIS_InteractiveContext) ic = vm->getAISContext();
|
||||||
|
|
||||||
|
// get OCC material aspect from the current model
|
||||||
|
Graphic3d_MaterialAspect front_occAspect = aModel.getMaterialOCCAspect( true );
|
||||||
|
Graphic3d_MaterialAspect back_occAspect = aModel.getMaterialOCCAspect( false );
|
||||||
|
|
||||||
|
SUIT_OverrideCursor wc();
|
||||||
|
|
||||||
|
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
||||||
|
Handle(GEOM_AISShape) aisShape = GEOMBase::ConvertIOinGEOMAISShape( It.Value(), true );
|
||||||
|
if ( !aisShape.IsNull() ) {
|
||||||
|
// Set front material for the selected shape
|
||||||
|
aisShape->SetCurrentFacingModel(Aspect_TOFM_FRONT_SIDE);
|
||||||
|
aisShape->SetMaterial(front_occAspect);
|
||||||
|
// Set back material for the selected shape
|
||||||
|
aisShape->SetCurrentFacingModel(Aspect_TOFM_BACK_SIDE);
|
||||||
|
aisShape->SetMaterial(back_occAspect);
|
||||||
|
// Return to the default facing mode
|
||||||
|
aisShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
|
||||||
|
// store chosen material in the property map
|
||||||
|
study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
|
||||||
|
//if ( aisShape->DisplayMode() != AIS_Shaded)
|
||||||
|
ic->Redisplay( aisShape, Standard_False );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ic->UpdateCurrentViewer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "GEOM_Constants.h"
|
#include "GEOM_Constants.h"
|
||||||
#include "GEOM_VTKPropertyMaterial.hxx"
|
#include "GEOM_VTKPropertyMaterial.hxx"
|
||||||
#include "GEOMBase.h"
|
#include "GEOMBase.h"
|
||||||
|
#include "GEOM_Displayer.h"
|
||||||
|
|
||||||
#include <QtxColorButton.h>
|
#include <QtxColorButton.h>
|
||||||
#include <QtxDoubleSpinBox.h>
|
#include <QtxDoubleSpinBox.h>
|
||||||
@ -50,6 +51,7 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QLineEdit>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
@ -89,10 +91,14 @@ void GEOMToolsGUI_MaterialList::contextMenuEvent( QContextMenuEvent* e )
|
|||||||
/*!
|
/*!
|
||||||
\brief Constructor
|
\brief Constructor
|
||||||
\param parent parent widget
|
\param parent parent widget
|
||||||
|
\param showSelWidget if \c true then objects can be selected by user
|
||||||
|
\param modal if \c true dialog box is modal
|
||||||
|
\param f specified control buttons for dialog box (QtxDialog::ButtonFlags)
|
||||||
*/
|
*/
|
||||||
GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget* parent )
|
GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget* parent,bool showSelWidget, bool modal,const int f )
|
||||||
: QtxDialog( parent, true, true, OK | Close | Apply | Help )
|
: QtxDialog( parent, modal, true, f )
|
||||||
{
|
{
|
||||||
|
myShowSelWidget = showSelWidget;
|
||||||
// Set title
|
// Set title
|
||||||
setWindowTitle( tr( "MATERIAL_PROPERTIES_TLT" ) );
|
setWindowTitle( tr( "MATERIAL_PROPERTIES_TLT" ) );
|
||||||
|
|
||||||
@ -105,6 +111,11 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
|||||||
QFrame* fr = new QFrame( mainFrame() );
|
QFrame* fr = new QFrame( mainFrame() );
|
||||||
fr->setFrameStyle( QFrame::Box | QFrame::Sunken );
|
fr->setFrameStyle( QFrame::Box | QFrame::Sunken );
|
||||||
main->addWidget( fr );
|
main->addWidget( fr );
|
||||||
|
// selection widget
|
||||||
|
myLineEditCurArg = new QLineEdit(fr);
|
||||||
|
myLineEditCurArg->setReadOnly(true);
|
||||||
|
myPushBtn = new QPushButton(fr);
|
||||||
|
QLabel* PushBtnLab = new QLabel( tr( "GEOM_OBJECTS" ), fr );
|
||||||
|
|
||||||
// materials list widget
|
// materials list widget
|
||||||
myMaterials = new GEOMToolsGUI_MaterialList( fr );
|
myMaterials = new GEOMToolsGUI_MaterialList( fr );
|
||||||
@ -130,41 +141,64 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
|||||||
// "physical" material type widgets
|
// "physical" material type widgets
|
||||||
myPhysical = new QCheckBox( tr( "PHYSICAL" ), propWidget );
|
myPhysical = new QCheckBox( tr( "PHYSICAL" ), propWidget );
|
||||||
|
|
||||||
|
// Labels for front and back reflection components
|
||||||
|
QLabel* aFrontLabel = new QLabel( tr( "FRONT_FACE" ), propWidget );
|
||||||
|
QLabel* aBackLabel = new QLabel( tr( "BACK_FACE" ), propWidget );
|
||||||
|
|
||||||
// reflection components widgets
|
// reflection components widgets
|
||||||
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ )
|
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ )
|
||||||
{
|
{
|
||||||
Reflection refl;
|
Reflection refl;
|
||||||
|
|
||||||
|
refl.enabled = new QCheckBox( propWidget );
|
||||||
|
|
||||||
refl.label = new QLabel( tr( QString( "REFLECTION_%1" ).arg( i ).toLatin1().data() ), propWidget );
|
refl.label = new QLabel( tr( QString( "REFLECTION_%1" ).arg( i ).toLatin1().data() ), propWidget );
|
||||||
|
|
||||||
refl.color = new QtxColorButton( propWidget );
|
refl.color = new QtxColorButton( propWidget );
|
||||||
//refl.color->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
//refl.color->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
||||||
|
|
||||||
refl.coef = new QtxDoubleSpinBox( propWidget );
|
refl.front_coef = new QtxDoubleSpinBox( propWidget );
|
||||||
refl.coef->setPrecision( 4 );
|
refl.front_coef->setPrecision( 4 );
|
||||||
refl.coef->setDecimals( 4 );
|
refl.front_coef->setDecimals( 4 );
|
||||||
refl.coef->setRange( 0., 1. );
|
refl.front_coef->setRange( 0., 1. );
|
||||||
refl.coef->setSingleStep( 0.05 );
|
refl.front_coef->setSingleStep( 0.05 );
|
||||||
refl.coef->setMinimumWidth( 80 );
|
refl.front_coef->setMinimumWidth( 80 );
|
||||||
|
|
||||||
refl.enabled = new QCheckBox( tr( "ENABLED" ), propWidget );
|
refl.back_coef = new QtxDoubleSpinBox( propWidget );
|
||||||
|
refl.back_coef->setPrecision( 4 );
|
||||||
|
refl.back_coef->setDecimals( 4 );
|
||||||
|
refl.back_coef->setRange( 0., 1. );
|
||||||
|
refl.back_coef->setSingleStep( 0.05 );
|
||||||
|
refl.back_coef->setMinimumWidth( 80 );
|
||||||
|
|
||||||
myReflection << refl;
|
myReflection << refl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// shininess widgets
|
// shininess widgets
|
||||||
QLabel* shininessLab = new QLabel( tr( "SHININESS" ), propWidget );
|
QLabel* shininessLab = new QLabel( tr( "SHININESS" ), propWidget );
|
||||||
myShininess = new QtxDoubleSpinBox( propWidget );
|
myFrontShininess = new QtxDoubleSpinBox( propWidget );
|
||||||
myShininess->setPrecision( 4 );
|
myFrontShininess->setPrecision( 4 );
|
||||||
myShininess->setDecimals( 4 );
|
myFrontShininess->setDecimals( 4 );
|
||||||
myShininess->setRange( 0., 1. );
|
myFrontShininess->setRange( 0., 1. );
|
||||||
myShininess->setSingleStep( 0.05 );
|
myFrontShininess->setSingleStep( 0.05 );
|
||||||
|
|
||||||
|
myBackShininess = new QtxDoubleSpinBox( propWidget );
|
||||||
|
myBackShininess->setPrecision( 4 );
|
||||||
|
myBackShininess->setDecimals( 4 );
|
||||||
|
myBackShininess->setRange( 0., 1. );
|
||||||
|
myBackShininess->setSingleStep( 0.05 );
|
||||||
|
|
||||||
// separator widgets
|
// separator widgets
|
||||||
QFrame* line1 = new QFrame( propWidget );
|
QFrame* line1 = new QFrame( propWidget );
|
||||||
line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
|
line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
|
||||||
QFrame* line2 = new QFrame( propWidget );
|
QFrame* line2 = new QFrame( propWidget );
|
||||||
line2->setFrameStyle( QFrame::HLine | QFrame::Sunken );
|
line2->setFrameStyle( QFrame::HLine | QFrame::Sunken );
|
||||||
|
QFrame* line3 = new QFrame( propWidget );
|
||||||
|
line3->setFrameStyle( QFrame::VLine | QFrame::Sunken );
|
||||||
|
QFrame* line4 = new QFrame( propWidget );
|
||||||
|
line4->setFrameStyle( QFrame::VLine | QFrame::Sunken );
|
||||||
|
QFrame* line5 = new QFrame( propWidget );
|
||||||
|
line5->setFrameStyle( QFrame::HLine | QFrame::Sunken );
|
||||||
|
|
||||||
// add / remove material buttons
|
// add / remove material buttons
|
||||||
myAddButton = new QPushButton( tr( "ADD_MATERIAL" ), propWidget );
|
myAddButton = new QPushButton( tr( "ADD_MATERIAL" ), propWidget );
|
||||||
@ -178,21 +212,42 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
|||||||
btnLayout->addWidget( myDelButton );
|
btnLayout->addWidget( myDelButton );
|
||||||
|
|
||||||
// layout all properties widgets together
|
// layout all properties widgets together
|
||||||
propLayout->addWidget( myColorLab, 0, 0 );
|
propLayout->addWidget( PushBtnLab,0,0);
|
||||||
propLayout->addWidget( myColor, 0, 1 );
|
propLayout->addWidget( myPushBtn,0,1);
|
||||||
propLayout->addWidget( line1, 1, 0, 1, 4 );
|
propLayout->addWidget( myLineEditCurArg, 0, 2, 1, 5 );
|
||||||
propLayout->addWidget( myPhysical, 2, 0, 1, 2 );
|
propLayout->addWidget( line1, 1, 0, 1, 7 );
|
||||||
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ ) {
|
propLayout->addWidget( myColorLab, 2, 1 );
|
||||||
propLayout->addWidget( myReflection[i].label, i+3, 0 );
|
propLayout->addWidget( myColor, 2, 2 );
|
||||||
propLayout->addWidget( myReflection[i].color, i+3, 1 );
|
propLayout->addWidget( myPhysical, 2, 0 );
|
||||||
propLayout->addWidget( myReflection[i].coef, i+3, 2 );
|
propLayout->addWidget( line2, 3, 0, 1, 7 );
|
||||||
propLayout->addWidget( myReflection[i].enabled, i+3, 3 );
|
propLayout->addWidget( aFrontLabel, 4, 4);
|
||||||
|
propLayout->addWidget( aBackLabel, 4, 6);
|
||||||
|
|
||||||
|
propLayout->addWidget( line3, 4, 3, 6, 1 );
|
||||||
|
propLayout->addWidget( line4, 4, 5, 6, 1 );
|
||||||
|
|
||||||
|
if( !myShowSelWidget ) {
|
||||||
|
myColorLab->hide();
|
||||||
|
myColor->hide();
|
||||||
|
line1->hide();
|
||||||
|
myLineEditCurArg->hide();
|
||||||
|
myPushBtn->hide();
|
||||||
|
PushBtnLab->hide();
|
||||||
}
|
}
|
||||||
propLayout->addWidget( shininessLab, 7, 0 );
|
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ ) {
|
||||||
propLayout->addWidget( myShininess, 7, 2 );
|
propLayout->addWidget( myReflection[i].enabled, i+5, 0 );
|
||||||
propLayout->addWidget( line2, 8, 0, 1, 4 );
|
propLayout->addWidget( myReflection[i].label, i+5, 1 );
|
||||||
propLayout->setRowStretch( 9, 5 );
|
propLayout->addWidget( myReflection[i].color, i+5, 2 );
|
||||||
propLayout->addLayout( btnLayout, 10, 0, 1, 4 );
|
propLayout->addWidget( myReflection[i].front_coef, i+5, 4 );
|
||||||
|
propLayout->addWidget( myReflection[i].back_coef, i+5, 6 );
|
||||||
|
}
|
||||||
|
|
||||||
|
propLayout->addWidget( shininessLab, 9, 0 );
|
||||||
|
propLayout->addWidget( myFrontShininess, 9, 4 );
|
||||||
|
propLayout->addWidget( myBackShininess, 9, 6 );
|
||||||
|
propLayout->addWidget( line5, 10, 0, 1, 7 );
|
||||||
|
propLayout->setRowStretch( 11, 5 );
|
||||||
|
propLayout->addLayout( btnLayout, 12, 0, 1, 7 );
|
||||||
|
|
||||||
// initialize dialog box
|
// initialize dialog box
|
||||||
setButtonPosition( Right, Close );
|
setButtonPosition( Right, Close );
|
||||||
@ -227,6 +282,9 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
|||||||
// install event filter to the materials list to process key press events
|
// install event filter to the materials list to process key press events
|
||||||
myMaterials->installEventFilter( this );
|
myMaterials->installEventFilter( this );
|
||||||
|
|
||||||
|
//Set image
|
||||||
|
myPushBtn->setIcon(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||||
|
|
||||||
// connect signals
|
// connect signals
|
||||||
// note: all widgets, that change material properties, are connected to the common signal
|
// note: all widgets, that change material properties, are connected to the common signal
|
||||||
// changed(), instead of connecting directly to the slot - this allows easy temporary blocking
|
// changed(), instead of connecting directly to the slot - this allows easy temporary blocking
|
||||||
@ -234,10 +292,12 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
|||||||
connect( myPhysical, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
|
connect( myPhysical, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
|
||||||
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ ) {
|
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ ) {
|
||||||
connect( myReflection[i].color, SIGNAL( changed( QColor ) ), this, SIGNAL( changed() ) );
|
connect( myReflection[i].color, SIGNAL( changed( QColor ) ), this, SIGNAL( changed() ) );
|
||||||
connect( myReflection[i].coef, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
|
connect( myReflection[i].front_coef, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
|
||||||
|
connect( myReflection[i].back_coef, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
|
||||||
connect( myReflection[i].enabled, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
|
connect( myReflection[i].enabled, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
|
||||||
}
|
}
|
||||||
connect( myShininess, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
|
connect( myFrontShininess, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
|
||||||
|
connect( myBackShininess, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
|
||||||
connect( myMaterials, SIGNAL( itemSelectionChanged() ),
|
connect( myMaterials, SIGNAL( itemSelectionChanged() ),
|
||||||
this, SLOT( onMaterialChanged() ) );
|
this, SLOT( onMaterialChanged() ) );
|
||||||
connect( myMaterials, SIGNAL( itemChanged( QListWidgetItem* ) ),
|
connect( myMaterials, SIGNAL( itemChanged( QListWidgetItem* ) ),
|
||||||
@ -249,6 +309,9 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
|||||||
connect( this, SIGNAL( dlgApply() ), this, SLOT( onApply() ) );
|
connect( this, SIGNAL( dlgApply() ), this, SLOT( onApply() ) );
|
||||||
connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
|
connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
|
||||||
connect( this, SIGNAL( changed() ), this, SLOT( onChanged() ) );
|
connect( this, SIGNAL( changed() ), this, SLOT( onChanged() ) );
|
||||||
|
connect(myPushBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
|
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
||||||
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
// initialize current material model according to the selection
|
// initialize current material model according to the selection
|
||||||
myColor->setColor( SUIT_Session::session()->resourceMgr()->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ) );
|
myColor->setColor( SUIT_Session::session()->resourceMgr()->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ) );
|
||||||
@ -276,6 +339,9 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
myLineEditCurArg->setText("");
|
||||||
|
myPushBtn->click();
|
||||||
|
SelectionIntoArgument();
|
||||||
|
|
||||||
// finally activate current material properties
|
// finally activate current material properties
|
||||||
myMaterials->setCurrentRow( 0 );
|
myMaterials->setCurrentRow( 0 );
|
||||||
@ -324,12 +390,14 @@ void GEOMToolsGUI_MaterialPropertiesDlg::fromModel( const Material_Model& model
|
|||||||
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ )
|
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ )
|
||||||
{
|
{
|
||||||
myReflection[i].color->setColor( model.color( (Material_Model::ReflectionType)i ) );
|
myReflection[i].color->setColor( model.color( (Material_Model::ReflectionType)i ) );
|
||||||
myReflection[i].coef->setValue( model.reflection( (Material_Model::ReflectionType)i ) );
|
myReflection[i].front_coef->setValue( model.reflection( (Material_Model::ReflectionType)i, true ) );
|
||||||
|
myReflection[i].back_coef->setValue( model.reflection( (Material_Model::ReflectionType)i, false ) );
|
||||||
myReflection[i].enabled->setChecked( model.hasReflection( (Material_Model::ReflectionType)i ) );
|
myReflection[i].enabled->setChecked( model.hasReflection( (Material_Model::ReflectionType)i ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// shininess
|
// shininess
|
||||||
myShininess->setValue( model.shininess() );
|
myFrontShininess->setValue( model.shininess( true ) );
|
||||||
|
myBackShininess->setValue( model.shininess( false ) );
|
||||||
|
|
||||||
// type (physical or no)
|
// type (physical or no)
|
||||||
myPhysical->setChecked( model.isPhysical() );
|
myPhysical->setChecked( model.isPhysical() );
|
||||||
@ -345,13 +413,15 @@ void GEOMToolsGUI_MaterialPropertiesDlg::toModel( Material_Model& model ) const
|
|||||||
model.setPhysical( myPhysical->isChecked() );
|
model.setPhysical( myPhysical->isChecked() );
|
||||||
|
|
||||||
// shininess
|
// shininess
|
||||||
model.setShininess( myShininess->value() );
|
model.setShininess( myFrontShininess->value(), true );
|
||||||
|
model.setShininess( myBackShininess->value(), false );
|
||||||
|
|
||||||
// reflection components
|
// reflection components
|
||||||
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ )
|
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ )
|
||||||
{
|
{
|
||||||
model.setColor ( (Material_Model::ReflectionType)i, myReflection[i].color->color() );
|
model.setColor ( (Material_Model::ReflectionType)i, myReflection[i].color->color() );
|
||||||
model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].coef->value() );
|
model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].front_coef->value(), true );
|
||||||
|
model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].back_coef->value(), false );
|
||||||
model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].enabled->isChecked() );
|
model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].enabled->isChecked() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -391,7 +461,7 @@ void GEOMToolsGUI_MaterialPropertiesDlg::onApply()
|
|||||||
{
|
{
|
||||||
// save user materials
|
// save user materials
|
||||||
myResourceMgr.save();
|
myResourceMgr.save();
|
||||||
|
if( !myShowSelWidget ) return;
|
||||||
// store selected material properties in the current model
|
// store selected material properties in the current model
|
||||||
toModel( myCurrentModel );
|
toModel( myCurrentModel );
|
||||||
|
|
||||||
@ -421,19 +491,20 @@ void GEOMToolsGUI_MaterialPropertiesDlg::onApply()
|
|||||||
SVTK_View* aView = vtkVW->getView();
|
SVTK_View* aView = vtkVW->getView();
|
||||||
|
|
||||||
// get VTK material properties from the current model
|
// get VTK material properties from the current model
|
||||||
GEOM_VTKPropertyMaterial* vtkProp = myCurrentModel.getMaterialVTKProperty();
|
GEOM_VTKPropertyMaterial* vtkPropF = myCurrentModel.getMaterialVTKProperty();
|
||||||
|
GEOM_VTKPropertyMaterial* vtkPropB = myCurrentModel.getMaterialVTKProperty( false );
|
||||||
|
|
||||||
SUIT_OverrideCursor wc();
|
SUIT_OverrideCursor wc();
|
||||||
|
|
||||||
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
||||||
// set material property to the presentation
|
// set material property to the presentation
|
||||||
aView->SetMaterial( It.Value(), vtkProp );
|
aView->SetMaterial( It.Value(), vtkPropF, vtkPropB );
|
||||||
// store chosen material in the property map
|
// store chosen material in the property map
|
||||||
study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
|
study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
|
||||||
// set correct color for the non-physical material
|
// set correct color for the non-physical material
|
||||||
if ( !myCurrentModel.isPhysical() ) {
|
if ( !myCurrentModel.isPhysical() ) {
|
||||||
aView->SetColor( It.Value(), myColor->color() );
|
aView->SetColor( It.Value(), myColor->color() );
|
||||||
study->setObjectProperty( mgrId, It.Value()->getEntry(), COLOR_PROP, myColor->color() );
|
study->setObjectProperty( mgrId, It.Value()->getEntry(), COLOR_PROP, myColor->color() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aView->Repaint();
|
aView->Repaint();
|
||||||
@ -448,25 +519,32 @@ void GEOMToolsGUI_MaterialPropertiesDlg::onApply()
|
|||||||
Handle(AIS_InteractiveContext) ic = vm->getAISContext();
|
Handle(AIS_InteractiveContext) ic = vm->getAISContext();
|
||||||
|
|
||||||
// get OCC material aspect from the current model
|
// get OCC material aspect from the current model
|
||||||
Graphic3d_MaterialAspect occAspect = myCurrentModel.getMaterialOCCAspect();
|
Graphic3d_MaterialAspect front_occAspect = myCurrentModel.getMaterialOCCAspect( true );
|
||||||
|
Graphic3d_MaterialAspect back_occAspect = myCurrentModel.getMaterialOCCAspect( false );
|
||||||
|
|
||||||
SUIT_OverrideCursor wc();
|
SUIT_OverrideCursor wc();
|
||||||
|
|
||||||
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
||||||
Handle(GEOM_AISShape) aisShape = GEOMBase::ConvertIOinGEOMAISShape( It.Value(), true );
|
Handle(GEOM_AISShape) aisShape = GEOMBase::ConvertIOinGEOMAISShape( It.Value(), true );
|
||||||
if ( !aisShape.IsNull() ) {
|
if ( !aisShape.IsNull() ) {
|
||||||
// set material property to the presentation
|
// Set front material for the selected shape
|
||||||
aisShape->SetMaterial( occAspect );
|
aisShape->SetCurrentFacingModel(Aspect_TOFM_FRONT_SIDE);
|
||||||
// store chosen material in the property map
|
aisShape->SetMaterial(front_occAspect);
|
||||||
study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
|
// Set back material for the selected shape
|
||||||
// set correct color for the non-physical material
|
aisShape->SetCurrentFacingModel(Aspect_TOFM_BACK_SIDE);
|
||||||
if ( !myCurrentModel.isPhysical() ) {
|
aisShape->SetMaterial(back_occAspect);
|
||||||
aisShape->SetShadingColor( SalomeApp_Tools::color( myColor->color() ) );
|
// Return to the default facing mode
|
||||||
study->setObjectProperty( mgrId, It.Value()->getEntry(), COLOR_PROP, myColor->color() );
|
aisShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
|
||||||
ic->RecomputePrsOnly( aisShape, Standard_False );
|
// store chosen material in the property map
|
||||||
}
|
study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
|
||||||
//if ( aisShape->DisplayMode() != AIS_Shaded/*aisShape->DisplayMode() == GEOM_AISShape::ShadingWithEdges*/)
|
// set correct color for the non-physical material
|
||||||
ic->Redisplay( aisShape, Standard_False );
|
if ( !myCurrentModel.isPhysical() ) {
|
||||||
|
aisShape->SetShadingColor( SalomeApp_Tools::color( myColor->color() ) );
|
||||||
|
study->setObjectProperty( mgrId, It.Value()->getEntry(), COLOR_PROP, myColor->color() );
|
||||||
|
ic->RecomputePrsOnly( aisShape, Standard_False );
|
||||||
|
}
|
||||||
|
//if ( aisShape->DisplayMode() != AIS_Shaded/*aisShape->DisplayMode() == GEOM_AISShape::ShadingWithEdges*/)
|
||||||
|
ic->Redisplay( aisShape, Standard_False );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ic->UpdateCurrentViewer();
|
ic->UpdateCurrentViewer();
|
||||||
@ -670,3 +748,37 @@ void GEOMToolsGUI_MaterialPropertiesDlg::updateState()
|
|||||||
myColor->setEnabled( !myPhysical->isChecked() );
|
myColor->setEnabled( !myPhysical->isChecked() );
|
||||||
myReflection[0].color->setEnabled( myPhysical->isChecked() );
|
myReflection[0].color->setEnabled( myPhysical->isChecked() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GEOMToolsGUI_MaterialPropertiesDlg::SetEditCurrentArgument()
|
||||||
|
{
|
||||||
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
|
if (send == myPushBtn) {
|
||||||
|
// enable line edit
|
||||||
|
myLineEditCurArg->setEnabled(true);
|
||||||
|
myLineEditCurArg->setFocus();
|
||||||
|
SelectionIntoArgument();
|
||||||
|
// after setFocus(), because it will be setDown(false) when loses focus
|
||||||
|
send->setDown(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Called when selection as changed or other case
|
||||||
|
*/
|
||||||
|
void GEOMToolsGUI_MaterialPropertiesDlg::SelectionIntoArgument()
|
||||||
|
{
|
||||||
|
myLineEditCurArg->setText( "" );
|
||||||
|
QString aString = "";
|
||||||
|
|
||||||
|
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||||
|
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
||||||
|
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
|
||||||
|
if ( study ) {
|
||||||
|
SALOME_ListIO aSelList;
|
||||||
|
aSelMgr->selectedObjects(aSelList);
|
||||||
|
int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
|
||||||
|
}
|
||||||
|
myLineEditCurArg->setText( aString );
|
||||||
|
}
|
||||||
|
@ -45,7 +45,7 @@ class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_MaterialPropertiesDlg : public QtxDialog
|
|||||||
enum { TypeRole = Qt::UserRole + 123, NameRole };
|
enum { TypeRole = Qt::UserRole + 123, NameRole };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GEOMToolsGUI_MaterialPropertiesDlg( QWidget* = 0 );
|
GEOMToolsGUI_MaterialPropertiesDlg( QWidget* = 0 , bool = true, bool = false,const int = Standard );
|
||||||
~GEOMToolsGUI_MaterialPropertiesDlg();
|
~GEOMToolsGUI_MaterialPropertiesDlg();
|
||||||
|
|
||||||
void accept();
|
void accept();
|
||||||
@ -72,26 +72,33 @@ private slots:
|
|||||||
void onAddMaterial();
|
void onAddMaterial();
|
||||||
void onApply();
|
void onApply();
|
||||||
void onHelp();
|
void onHelp();
|
||||||
|
void SetEditCurrentArgument();
|
||||||
|
void SelectionIntoArgument();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
QCheckBox* enabled;
|
||||||
QLabel* label;
|
QLabel* label;
|
||||||
QtxColorButton* color;
|
QtxColorButton* color;
|
||||||
QtxDoubleSpinBox* coef;
|
QtxDoubleSpinBox* front_coef;
|
||||||
QCheckBox* enabled;
|
QtxDoubleSpinBox* back_coef;
|
||||||
} Reflection;
|
} Reflection;
|
||||||
|
|
||||||
GEOMToolsGUI_MaterialList* myMaterials;
|
GEOMToolsGUI_MaterialList* myMaterials;
|
||||||
QCheckBox* myPhysical;
|
QCheckBox* myPhysical;
|
||||||
QList<Reflection> myReflection;
|
QList<Reflection> myReflection;
|
||||||
QtxDoubleSpinBox* myShininess;
|
QtxDoubleSpinBox* myFrontShininess;
|
||||||
|
QtxDoubleSpinBox* myBackShininess;
|
||||||
QLabel* myColorLab;
|
QLabel* myColorLab;
|
||||||
QtxColorButton* myColor;
|
QtxColorButton* myColor;
|
||||||
QPushButton* myAddButton;
|
QPushButton* myAddButton;
|
||||||
QPushButton* myDelButton;
|
QPushButton* myDelButton;
|
||||||
Material_ResourceMgr myResourceMgr;
|
Material_ResourceMgr myResourceMgr;
|
||||||
Material_Model myCurrentModel;
|
Material_Model myCurrentModel;
|
||||||
|
bool myShowSelWidget;
|
||||||
|
QLineEdit* myLineEditCurArg;
|
||||||
|
QPushButton* myPushBtn;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GEOMToolsGUI_MaterialList : public QListWidget
|
class GEOMToolsGUI_MaterialList : public QListWidget
|
||||||
|
@ -78,21 +78,36 @@ void Material_Model::fromProperties( const QString& props )
|
|||||||
else if ( key == "emissivecolor" && Qtx::stringToColor( data, colorValue ) ) {
|
else if ( key == "emissivecolor" && Qtx::stringToColor( data, colorValue ) ) {
|
||||||
setColor( Emissive, colorValue );
|
setColor( Emissive, colorValue );
|
||||||
}
|
}
|
||||||
else if ( key == "ambientcoefficient" && dblOk ) {
|
else if ( key == "frontambientcoefficient" && dblOk ) {
|
||||||
setReflection( Ambient, dblValue );
|
setReflection( Ambient, dblValue );
|
||||||
}
|
}
|
||||||
else if ( key == "diffusecoefficient" && dblOk ) {
|
else if ( key == "backambientcoefficient" && dblOk ) {
|
||||||
|
setReflection( Ambient, dblValue, false );
|
||||||
|
}
|
||||||
|
else if ( key == "frontdiffusecoefficient" && dblOk ) {
|
||||||
setReflection( Diffuse, dblValue );
|
setReflection( Diffuse, dblValue );
|
||||||
}
|
}
|
||||||
else if ( key == "specularcoefficient" && dblOk ) {
|
else if ( key == "backdiffusecoefficient" && dblOk ) {
|
||||||
|
setReflection( Diffuse, dblValue, false );
|
||||||
|
}
|
||||||
|
else if ( key == "frontspecularcoefficient" && dblOk ) {
|
||||||
setReflection( Specular, dblValue );
|
setReflection( Specular, dblValue );
|
||||||
}
|
}
|
||||||
else if ( key == "emissivecoefficient" && dblOk ) {
|
else if ( key == "backspecularcoefficient" && dblOk ) {
|
||||||
|
setReflection( Specular, dblValue, false );
|
||||||
|
}
|
||||||
|
else if ( key == "frontemissivecoefficient" && dblOk ) {
|
||||||
setReflection( Emissive, dblValue );
|
setReflection( Emissive, dblValue );
|
||||||
}
|
}
|
||||||
else if ( key == "shininess" && dblOk ) {
|
else if ( key == "backemissivecoefficient" && dblOk ) {
|
||||||
|
setReflection( Emissive, dblValue, false );
|
||||||
|
}
|
||||||
|
else if ( key == "frontshininess" && dblOk ) {
|
||||||
setShininess( dblValue );
|
setShininess( dblValue );
|
||||||
}
|
}
|
||||||
|
else if ( key == "backshininess" && dblOk ) {
|
||||||
|
setShininess( dblValue, false );
|
||||||
|
}
|
||||||
else if ( key == "transparency" && dblOk ) {
|
else if ( key == "transparency" && dblOk ) {
|
||||||
setTransparency( dblValue );
|
setTransparency( dblValue );
|
||||||
}
|
}
|
||||||
@ -128,7 +143,7 @@ QString Material_Model::toProperties()
|
|||||||
props << fmt.arg( "Physical" ).arg( isPhysical() );
|
props << fmt.arg( "Physical" ).arg( isPhysical() );
|
||||||
|
|
||||||
// shininess
|
// shininess
|
||||||
props << fmt.arg( "Shininess" ).arg( shininess() );
|
props << fmt.arg( "FrontShininess" ).arg( QString::number ( shininess( true ), 'g', 4 ) ) << fmt.arg( "BackShininess" ).arg( QString::number ( shininess( false ), 'g', 4 ) );
|
||||||
|
|
||||||
//transparency
|
//transparency
|
||||||
props << fmt.arg( "Transparency" ).arg( transparency() );
|
props << fmt.arg( "Transparency" ).arg( transparency() );
|
||||||
@ -137,25 +152,25 @@ QString Material_Model::toProperties()
|
|||||||
props << fmt.arg( "Ambient" ).arg( hasReflection( Ambient ) );
|
props << fmt.arg( "Ambient" ).arg( hasReflection( Ambient ) );
|
||||||
if ( color( Ambient ).isValid() )
|
if ( color( Ambient ).isValid() )
|
||||||
props << fmt.arg( "AmbientColor" ).arg( Qtx::colorToString( color( Ambient ) ) );
|
props << fmt.arg( "AmbientColor" ).arg( Qtx::colorToString( color( Ambient ) ) );
|
||||||
props << fmt.arg( "AmbientCoefficient" ).arg( reflection( Ambient ) );
|
props << fmt.arg( "FrontAmbientCoefficient" ).arg( QString::number ( reflection( Ambient, true ), 'g', 4 ) ) << fmt.arg( "BackAmbientCoefficient" ).arg( QString::number ( reflection( Ambient, false ), 'g', 4 ) );
|
||||||
|
|
||||||
// diffuse reflection
|
// diffuse reflection
|
||||||
props << fmt.arg( "Diffuse" ).arg( hasReflection( Diffuse ) );
|
props << fmt.arg( "Diffuse" ).arg( hasReflection( Diffuse ) );
|
||||||
if ( color( Diffuse ).isValid() )
|
if ( color( Diffuse ).isValid() )
|
||||||
props << fmt.arg( "DiffuseColor" ).arg( Qtx::colorToString( color( Diffuse ) ) );
|
props << fmt.arg( "DiffuseColor" ).arg( Qtx::colorToString( color( Diffuse ) ) );
|
||||||
props << fmt.arg( "DiffuseCoefficient" ).arg( reflection( Diffuse ) );
|
props << fmt.arg( "FrontDiffuseCoefficient" ).arg( QString::number ( reflection( Diffuse, true ), 'g', 4 ) ) << fmt.arg( "BackDiffuseCoefficient" ).arg( QString::number ( reflection( Diffuse, false ), 'g', 4 ) );
|
||||||
|
|
||||||
// specular reflection
|
// specular reflection
|
||||||
props << fmt.arg( "Specular" ).arg( hasReflection( Specular ) );
|
props << fmt.arg( "Specular" ).arg( hasReflection( Specular ) );
|
||||||
if ( color( Specular ).isValid() )
|
if ( color( Specular ).isValid() )
|
||||||
props << fmt.arg( "SpecularColor" ).arg( Qtx::colorToString( color( Specular ) ) );
|
props << fmt.arg( "SpecularColor" ).arg( Qtx::colorToString( color( Specular ) ) );
|
||||||
props << fmt.arg( "SpecularCoefficient" ).arg( reflection( Specular ) );
|
props << fmt.arg( "FrontSpecularCoefficient" ).arg( QString::number ( reflection( Specular, true ), 'g', 4 ) ) << fmt.arg( "BackSpecularCoefficient" ).arg( QString::number ( reflection( Specular, false ), 'g', 4 ) );
|
||||||
|
|
||||||
// emissive reflection
|
// emissive reflection
|
||||||
props << fmt.arg( "Emissive" ).arg( hasReflection( Emissive ) );
|
props << fmt.arg( "Emissive" ).arg( hasReflection( Emissive ) );
|
||||||
if ( color( Emissive ).isValid() )
|
if ( color( Emissive ).isValid() )
|
||||||
props << fmt.arg( "EmissiveColor" ).arg( Qtx::colorToString( color( Emissive ) ) );
|
props << fmt.arg( "EmissiveColor" ).arg( Qtx::colorToString( color( Emissive ) ) );
|
||||||
props << fmt.arg( "EmissiveCoefficient" ).arg( reflection( Emissive ) );
|
props << fmt.arg( "FrontEmissiveCoefficient" ).arg( QString::number ( reflection( Emissive, true ), 'g', 4 ) ) << fmt.arg( "BackEmissiveCoefficient" ).arg( QString::number ( reflection( Emissive, false ), 'g', 4 ) );
|
||||||
|
|
||||||
return props.join( ":" );
|
return props.join( ":" );
|
||||||
}
|
}
|
||||||
@ -194,8 +209,11 @@ void Material_Model::fromResources( const QString& material, QtxResourceMgr* res
|
|||||||
}
|
}
|
||||||
|
|
||||||
// shininess
|
// shininess
|
||||||
if ( resMgr->hasValue( material, "shininess" ) ) {
|
if ( resMgr->hasValue( material, "front_shininess" ) ) {
|
||||||
setShininess( resMgr->doubleValue( material, "shininess" ) );
|
setShininess( resMgr->doubleValue( material, "front_shininess" ) );
|
||||||
|
}
|
||||||
|
if ( resMgr->hasValue( material, "back_shininess" ) ) {
|
||||||
|
setShininess( resMgr->doubleValue( material, "back_shininess" ), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
// transparency
|
// transparency
|
||||||
@ -207,8 +225,11 @@ void Material_Model::fromResources( const QString& material, QtxResourceMgr* res
|
|||||||
if ( resMgr->hasValue( material, "ambient-color" ) ) {
|
if ( resMgr->hasValue( material, "ambient-color" ) ) {
|
||||||
setColor( Ambient, resMgr->colorValue( material, "ambient-color" ) );
|
setColor( Ambient, resMgr->colorValue( material, "ambient-color" ) );
|
||||||
}
|
}
|
||||||
if ( resMgr->hasValue( material, "ambient-coefficient" ) ) {
|
if ( resMgr->hasValue( material, "front_ambient-coefficient" ) ) {
|
||||||
setReflection( Ambient, resMgr->doubleValue( material, "ambient-coefficient" ) );
|
setReflection( Ambient, resMgr->doubleValue( material, "front_ambient-coefficient" ) );
|
||||||
|
}
|
||||||
|
if ( resMgr->hasValue( material, "back_ambient-coefficient" ) ) {
|
||||||
|
setReflection( Ambient, resMgr->doubleValue( material, "back_ambient-coefficient" ), false );
|
||||||
}
|
}
|
||||||
if ( resMgr->hasValue( material, "ambient" ) ) {
|
if ( resMgr->hasValue( material, "ambient" ) ) {
|
||||||
setReflection( Ambient, resMgr->booleanValue( material, "ambient" ) );
|
setReflection( Ambient, resMgr->booleanValue( material, "ambient" ) );
|
||||||
@ -218,8 +239,11 @@ void Material_Model::fromResources( const QString& material, QtxResourceMgr* res
|
|||||||
if ( resMgr->hasValue( material, "diffuse-color" ) ) {
|
if ( resMgr->hasValue( material, "diffuse-color" ) ) {
|
||||||
setColor( Diffuse, resMgr->colorValue( material, "diffuse-color" ) );
|
setColor( Diffuse, resMgr->colorValue( material, "diffuse-color" ) );
|
||||||
}
|
}
|
||||||
if ( resMgr->hasValue( material, "diffuse-coefficient" ) ) {
|
if ( resMgr->hasValue( material, "front_diffuse-coefficient" ) ) {
|
||||||
setReflection( Diffuse, resMgr->doubleValue( material, "diffuse-coefficient" ) );
|
setReflection( Diffuse, resMgr->doubleValue( material, "front_diffuse-coefficient" ) );
|
||||||
|
}
|
||||||
|
if ( resMgr->hasValue( material, "back_diffuse-coefficient" ) ) {
|
||||||
|
setReflection( Diffuse, resMgr->doubleValue( material, "back_diffuse-coefficient" ), false );
|
||||||
}
|
}
|
||||||
if ( resMgr->hasValue( material, "diffuse" ) ) {
|
if ( resMgr->hasValue( material, "diffuse" ) ) {
|
||||||
setReflection( Diffuse, resMgr->booleanValue( material, "diffuse" ) );
|
setReflection( Diffuse, resMgr->booleanValue( material, "diffuse" ) );
|
||||||
@ -229,8 +253,11 @@ void Material_Model::fromResources( const QString& material, QtxResourceMgr* res
|
|||||||
if ( resMgr->hasValue( material, "specular-color" ) ) {
|
if ( resMgr->hasValue( material, "specular-color" ) ) {
|
||||||
setColor( Specular, resMgr->colorValue( material, "specular-color" ) );
|
setColor( Specular, resMgr->colorValue( material, "specular-color" ) );
|
||||||
}
|
}
|
||||||
if ( resMgr->hasValue( material, "specular-coefficient" ) ) {
|
if ( resMgr->hasValue( material, "front_specular-coefficient" ) ) {
|
||||||
setReflection( Specular, resMgr->doubleValue( material, "specular-coefficient" ) );
|
setReflection( Specular, resMgr->doubleValue( material, "front_specular-coefficient" ) );
|
||||||
|
}
|
||||||
|
if ( resMgr->hasValue( material, "back_specular-coefficient" ) ) {
|
||||||
|
setReflection( Specular, resMgr->doubleValue( material, "back_specular-coefficient" ), false );
|
||||||
}
|
}
|
||||||
if ( resMgr->hasValue( material, "specular" ) ) {
|
if ( resMgr->hasValue( material, "specular" ) ) {
|
||||||
setReflection( Specular, resMgr->booleanValue( material, "specular" ) );
|
setReflection( Specular, resMgr->booleanValue( material, "specular" ) );
|
||||||
@ -240,8 +267,11 @@ void Material_Model::fromResources( const QString& material, QtxResourceMgr* res
|
|||||||
if ( resMgr->hasValue( material, "emissive-color" ) ) {
|
if ( resMgr->hasValue( material, "emissive-color" ) ) {
|
||||||
setColor( Emissive, resMgr->colorValue( material, "emissive-color" ) );
|
setColor( Emissive, resMgr->colorValue( material, "emissive-color" ) );
|
||||||
}
|
}
|
||||||
if ( resMgr->hasValue( material, "emissive-coefficient" ) ) {
|
if ( resMgr->hasValue( material, "front_emissive-coefficient" ) ) {
|
||||||
setReflection( Emissive, resMgr->doubleValue( material, "emissive-coefficient" ) );
|
setReflection( Emissive, resMgr->doubleValue( material, "front_emissive-coefficient" ) );
|
||||||
|
}
|
||||||
|
if ( resMgr->hasValue( material, "back_emissive-coefficient" ) ) {
|
||||||
|
setReflection( Emissive, resMgr->doubleValue( material, "back_emissive-coefficient" ), false );
|
||||||
}
|
}
|
||||||
if ( resMgr->hasValue( material, "emissive" ) ) {
|
if ( resMgr->hasValue( material, "emissive" ) ) {
|
||||||
setReflection( Emissive, resMgr->booleanValue( material, "emissive" ) );
|
setReflection( Emissive, resMgr->booleanValue( material, "emissive" ) );
|
||||||
@ -267,7 +297,8 @@ void Material_Model::toResources( const QString& material, QtxResourceMgr* resMg
|
|||||||
resMgr->setValue( material, "physical", isPhysical() );
|
resMgr->setValue( material, "physical", isPhysical() );
|
||||||
|
|
||||||
// shininess
|
// shininess
|
||||||
resMgr->setValue( material, "shininess", shininess() );
|
resMgr->setValue( material, "front_shininess", shininess( true) );
|
||||||
|
resMgr->setValue( material, "back_shininess", shininess( false ) );
|
||||||
|
|
||||||
// transparency
|
// transparency
|
||||||
resMgr->setValue( material, "transparency", transparency() );
|
resMgr->setValue( material, "transparency", transparency() );
|
||||||
@ -275,46 +306,33 @@ void Material_Model::toResources( const QString& material, QtxResourceMgr* resMg
|
|||||||
// ambient reflection
|
// ambient reflection
|
||||||
if ( color( Ambient ).isValid() )
|
if ( color( Ambient ).isValid() )
|
||||||
resMgr->setValue( material, "ambient-color", color( Ambient ) );
|
resMgr->setValue( material, "ambient-color", color( Ambient ) );
|
||||||
resMgr->setValue( material, "ambient-coefficient", reflection( Ambient ) );
|
resMgr->setValue( material, "front_ambient-coefficient", reflection( Ambient ) );
|
||||||
|
resMgr->setValue( material, "back_ambient-coefficient", reflection( Ambient, false ) );
|
||||||
resMgr->setValue( material, "ambient", hasReflection( Ambient ) );
|
resMgr->setValue( material, "ambient", hasReflection( Ambient ) );
|
||||||
|
|
||||||
// diffuse reflection
|
// diffuse reflection
|
||||||
if ( color( Diffuse ).isValid() )
|
if ( color( Diffuse ).isValid() )
|
||||||
resMgr->setValue( material, "diffuse-color", color( Diffuse ) );
|
resMgr->setValue( material, "diffuse-color", color( Diffuse ) );
|
||||||
resMgr->setValue( material, "diffuse-coefficient", reflection( Diffuse ) );
|
resMgr->setValue( material, "front_diffuse-coefficient", reflection( Diffuse ) );
|
||||||
|
resMgr->setValue( material, "back_diffuse-coefficient", reflection( Diffuse, false ) );
|
||||||
resMgr->setValue( material, "diffuse", hasReflection( Diffuse ) );
|
resMgr->setValue( material, "diffuse", hasReflection( Diffuse ) );
|
||||||
|
|
||||||
// Specular reflection
|
// Specular reflection
|
||||||
if ( color( Specular ).isValid() )
|
if ( color( Specular ).isValid() )
|
||||||
resMgr->setValue( material, "specular-color", color( Specular ) );
|
resMgr->setValue( material, "specular-color", color( Specular ) );
|
||||||
resMgr->setValue( material, "specular-coefficient", reflection( Specular ) );
|
resMgr->setValue( material, "front_specular-coefficient", reflection( Specular ) );
|
||||||
|
resMgr->setValue( material, "back_specular-coefficient", reflection( Specular, false ) );
|
||||||
resMgr->setValue( material, "specular", hasReflection( Specular ) );
|
resMgr->setValue( material, "specular", hasReflection( Specular ) );
|
||||||
|
|
||||||
// Emissive reflection
|
// Emissive reflection
|
||||||
if ( color( Emissive ).isValid() )
|
if ( color( Emissive ).isValid() )
|
||||||
resMgr->setValue( material, "emissive-color", color( Emissive ) );
|
resMgr->setValue( material, "emissive-color", color( Emissive ) );
|
||||||
resMgr->setValue( material, "emissive-coefficient", reflection( Emissive ) );
|
resMgr->setValue( material, "front_emissive-coefficient", reflection( Emissive ) );
|
||||||
|
resMgr->setValue( material, "back_emissive-coefficient", reflection( Emissive, false ) );
|
||||||
resMgr->setValue( material, "emissive", hasReflection( Emissive ) );
|
resMgr->setValue( material, "emissive", hasReflection( Emissive ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Initialize material model from the preferences
|
|
||||||
|
|
||||||
The material name is retrieved from the "material" parameter of the "Geometry" section
|
|
||||||
of the specified resources manager.
|
|
||||||
|
|
||||||
\param resMgr resources manager
|
|
||||||
\sa fromResources(), toResources()
|
|
||||||
*/
|
|
||||||
// void Material_Model::fromPreferences( QtxResourceMgr* resMgr )
|
|
||||||
// {
|
|
||||||
// if ( resMgr ) {
|
|
||||||
// // default material is Plastic
|
|
||||||
// fromResources( resMgr->stringValue( "Geometry", "material", "Plastic" ) );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Get material type
|
\brief Get material type
|
||||||
\return \c true if material is physical or \c false otherwise
|
\return \c true if material is physical or \c false otherwise
|
||||||
@ -390,14 +408,18 @@ void Material_Model::setColor( ReflectionType type, const QColor& value )
|
|||||||
/*!
|
/*!
|
||||||
\brief Get coefficient value for the given reflection type
|
\brief Get coefficient value for the given reflection type
|
||||||
\param type reflection type
|
\param type reflection type
|
||||||
|
\param theIsFront boolean flag for choosing side
|
||||||
\return coefficient value for the specified reflection type
|
\return coefficient value for the specified reflection type
|
||||||
\sa setReflection(ReflectionType, double)
|
\sa setReflection(ReflectionType, double, bool = true)
|
||||||
*/
|
*/
|
||||||
double Material_Model::reflection( ReflectionType type ) const
|
double Material_Model::reflection( ReflectionType type, bool theIsFront ) const
|
||||||
{
|
{
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
if ( type >= 0 && type < 4 )
|
if ( type >= 0 && type < 4 )
|
||||||
value = myReflection[ type ].coef;
|
if ( theIsFront )
|
||||||
|
value = myReflection[ type ].front_coef;
|
||||||
|
else
|
||||||
|
value = myReflection[ type ].back_coef;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,32 +427,44 @@ double Material_Model::reflection( ReflectionType type ) const
|
|||||||
\brief Set coefficient value for the given reflection type
|
\brief Set coefficient value for the given reflection type
|
||||||
\param type reflection type
|
\param type reflection type
|
||||||
\param value coefficient to be used by the given reflection type
|
\param value coefficient to be used by the given reflection type
|
||||||
\sa reflection()
|
\param theIsFront boolean flag for choosing side
|
||||||
|
\sa reflection( bool = true)
|
||||||
*/
|
*/
|
||||||
void Material_Model::setReflection( ReflectionType type, double value )
|
void Material_Model::setReflection( ReflectionType type, double value, bool theIsFront )
|
||||||
{
|
{
|
||||||
if ( type >= 0 && type < 4 )
|
if ( type >= 0 && type < 4 )
|
||||||
myReflection[ type ].coef = value;
|
if ( theIsFront )
|
||||||
|
myReflection[ type ].front_coef = value;
|
||||||
|
else
|
||||||
|
myReflection[ type ].back_coef = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Get shininess value
|
\brief Get shininess value
|
||||||
|
\param theIsFront boolean flag for choosing side
|
||||||
\return shininess value of the material
|
\return shininess value of the material
|
||||||
\sa setShininess()
|
\sa setShininess( double, bool = true )
|
||||||
*/
|
*/
|
||||||
double Material_Model::shininess() const
|
double Material_Model::shininess( bool theIsFront ) const
|
||||||
{
|
{
|
||||||
return myShininess;
|
if ( theIsFront )
|
||||||
|
return myFrontShininess;
|
||||||
|
else
|
||||||
|
return myBackShininess;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set shininess value
|
\brief Set shininess value
|
||||||
\param value new shininess value
|
\param value new shininess value
|
||||||
\sa shininess()
|
\param theIsFront boolean flag for choosing side
|
||||||
|
\sa shininess( bool = true )
|
||||||
*/
|
*/
|
||||||
void Material_Model::setShininess( double value )
|
void Material_Model::setShininess( double value, bool theIsFront )
|
||||||
{
|
{
|
||||||
myShininess = value;
|
if ( theIsFront )
|
||||||
|
myFrontShininess = value;
|
||||||
|
else
|
||||||
|
myBackShininess = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -464,39 +498,45 @@ void Material_Model::init()
|
|||||||
setPhysical( false );
|
setPhysical( false );
|
||||||
// shininess
|
// shininess
|
||||||
setShininess( 0.039 );
|
setShininess( 0.039 );
|
||||||
|
setShininess( 0.039, false );
|
||||||
// transparency
|
// transparency
|
||||||
setTransparency( 0.0 );
|
setTransparency( 0.0 );
|
||||||
|
|
||||||
// ambient reflection (enabled by default)
|
// ambient reflection (enabled by default)
|
||||||
Qtx::stringToColor( "#333333", c );
|
Qtx::stringToColor( "#333333", c );
|
||||||
setColor( Ambient, c );
|
setColor( Ambient, c );
|
||||||
setReflection( Ambient, 0.3 );
|
setReflection( Ambient, 0.3, true );
|
||||||
|
setReflection( Ambient, 0.3, false );
|
||||||
setReflection( Ambient, true );
|
setReflection( Ambient, true );
|
||||||
|
|
||||||
// diffuse reflection (enabled by default)
|
// diffuse reflection (enabled by default)
|
||||||
Qtx::stringToColor( "#000000", c );
|
Qtx::stringToColor( "#000000", c );
|
||||||
setColor( Diffuse, c );
|
setColor( Diffuse, c );
|
||||||
setReflection( Diffuse, 0.65 );
|
setReflection( Diffuse, 0.65 );
|
||||||
|
setReflection( Diffuse, 0.65, false );
|
||||||
setReflection( Diffuse, true );
|
setReflection( Diffuse, true );
|
||||||
|
|
||||||
// specular reflection (enabled by default)
|
// specular reflection (enabled by default)
|
||||||
Qtx::stringToColor( "#ffffff", c );
|
Qtx::stringToColor( "#ffffff", c );
|
||||||
setColor( Specular, c );
|
setColor( Specular, c );
|
||||||
setReflection( Specular, 0.0 );
|
setReflection( Specular, 0.0 );
|
||||||
|
setReflection( Specular, 0.0, false );
|
||||||
setReflection( Specular, true );
|
setReflection( Specular, true );
|
||||||
|
|
||||||
// emissive reflection (disabled by default)
|
// emissive reflection (disabled by default)
|
||||||
Qtx::stringToColor( "#000000", c );
|
Qtx::stringToColor( "#000000", c );
|
||||||
setColor( Emissive, c );
|
setColor( Emissive, c );
|
||||||
setReflection( Emissive, 0.0 );
|
setReflection( Emissive, 0.0 );
|
||||||
|
setReflection( Emissive, 0.0, false );
|
||||||
setReflection( Emissive, false );
|
setReflection( Emissive, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Construct OCCT material aspect from material model
|
\brief Construct OCCT material aspect from material model
|
||||||
|
\param theIsFront boolean flag for choosing side
|
||||||
\return material aspect object with corresponding properties
|
\return material aspect object with corresponding properties
|
||||||
*/
|
*/
|
||||||
Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect()
|
Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect( bool theIsFront )
|
||||||
{
|
{
|
||||||
// Get material aspect from the current model
|
// Get material aspect from the current model
|
||||||
Graphic3d_MaterialAspect aspect;
|
Graphic3d_MaterialAspect aspect;
|
||||||
@ -508,7 +548,7 @@ Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect()
|
|||||||
c = color( Ambient );
|
c = color( Ambient );
|
||||||
aspect.SetAmbientColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
|
aspect.SetAmbientColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
|
||||||
}
|
}
|
||||||
aspect.SetAmbient( reflection( Ambient ));
|
aspect.SetAmbient( reflection( Ambient, theIsFront ));
|
||||||
if ( hasReflection( Ambient ) )
|
if ( hasReflection( Ambient ) )
|
||||||
aspect.SetReflectionModeOn( Graphic3d_TOR_AMBIENT );
|
aspect.SetReflectionModeOn( Graphic3d_TOR_AMBIENT );
|
||||||
else
|
else
|
||||||
@ -519,7 +559,7 @@ Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect()
|
|||||||
c = color( Diffuse );
|
c = color( Diffuse );
|
||||||
aspect.SetDiffuseColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
|
aspect.SetDiffuseColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
|
||||||
}
|
}
|
||||||
aspect.SetDiffuse( reflection( Diffuse ));
|
aspect.SetDiffuse( reflection( Diffuse, theIsFront ));
|
||||||
if ( hasReflection( Diffuse ) )
|
if ( hasReflection( Diffuse ) )
|
||||||
aspect.SetReflectionModeOn( Graphic3d_TOR_DIFFUSE );
|
aspect.SetReflectionModeOn( Graphic3d_TOR_DIFFUSE );
|
||||||
else
|
else
|
||||||
@ -530,7 +570,7 @@ Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect()
|
|||||||
c = color( Specular );
|
c = color( Specular );
|
||||||
aspect.SetSpecularColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
|
aspect.SetSpecularColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
|
||||||
}
|
}
|
||||||
aspect.SetSpecular( reflection( Specular ));
|
aspect.SetSpecular( reflection( Specular, theIsFront ));
|
||||||
if ( hasReflection( Specular ) )
|
if ( hasReflection( Specular ) )
|
||||||
aspect.SetReflectionModeOn( Graphic3d_TOR_SPECULAR );
|
aspect.SetReflectionModeOn( Graphic3d_TOR_SPECULAR );
|
||||||
else
|
else
|
||||||
@ -541,14 +581,14 @@ Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect()
|
|||||||
c = color( Emissive );
|
c = color( Emissive );
|
||||||
aspect.SetEmissiveColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
|
aspect.SetEmissiveColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
|
||||||
}
|
}
|
||||||
aspect.SetEmissive( reflection( Emissive ));
|
aspect.SetEmissive( reflection( Emissive, theIsFront ));
|
||||||
if ( hasReflection( Emissive ) )
|
if ( hasReflection( Emissive ) )
|
||||||
aspect.SetReflectionModeOn( Graphic3d_TOR_EMISSION );
|
aspect.SetReflectionModeOn( Graphic3d_TOR_EMISSION );
|
||||||
else
|
else
|
||||||
aspect.SetReflectionModeOff( Graphic3d_TOR_EMISSION );
|
aspect.SetReflectionModeOff( Graphic3d_TOR_EMISSION );
|
||||||
|
|
||||||
// shininess
|
// shininess
|
||||||
aspect.SetShininess( shininess() );
|
aspect.SetShininess( shininess( theIsFront ) );
|
||||||
|
|
||||||
// transparency
|
// transparency
|
||||||
aspect.SetTransparency( transparency() );
|
aspect.SetTransparency( transparency() );
|
||||||
@ -561,9 +601,10 @@ Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect()
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Construct VTK property from material model
|
\brief Construct VTK property from material model
|
||||||
|
\param theIsFront boolean flag for choosing side
|
||||||
\return VTK property with correspondent material properties
|
\return VTK property with correspondent material properties
|
||||||
*/
|
*/
|
||||||
GEOM_VTKPropertyMaterial* Material_Model::getMaterialVTKProperty()
|
GEOM_VTKPropertyMaterial* Material_Model::getMaterialVTKProperty( bool theIsFront )
|
||||||
{
|
{
|
||||||
// NOTE: In VTK it's impossible to switch on/off specific reflection type
|
// NOTE: In VTK it's impossible to switch on/off specific reflection type
|
||||||
// NOTE: In VTK emissive reflection type is not supported
|
// NOTE: In VTK emissive reflection type is not supported
|
||||||
@ -579,25 +620,25 @@ GEOM_VTKPropertyMaterial* Material_Model::getMaterialVTKProperty()
|
|||||||
if ( color( Ambient ).isValid() && hasReflection( Ambient ) ) {
|
if ( color( Ambient ).isValid() && hasReflection( Ambient ) ) {
|
||||||
c = color( Ambient );
|
c = color( Ambient );
|
||||||
prop->SetAmbientColor( c.redF(), c.greenF(), c.blueF() );
|
prop->SetAmbientColor( c.redF(), c.greenF(), c.blueF() );
|
||||||
prop->SetAmbient( reflection( Ambient ) );
|
prop->SetAmbient( reflection( Ambient, theIsFront ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// diffuse reflection
|
// diffuse reflection
|
||||||
if ( color( Diffuse ).isValid() && hasReflection( Diffuse ) ) {
|
if ( color( Diffuse ).isValid() && hasReflection( Diffuse ) ) {
|
||||||
c = color( Diffuse );
|
c = color( Diffuse );
|
||||||
prop->SetDiffuseColor( c.redF(), c.greenF(), c.blueF() );
|
prop->SetDiffuseColor( c.redF(), c.greenF(), c.blueF() );
|
||||||
prop->SetDiffuse( reflection( Diffuse ) );
|
prop->SetDiffuse( reflection( Diffuse, theIsFront ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// specular reflection
|
// specular reflection
|
||||||
if ( color( Specular ).isValid() && hasReflection( Specular ) ) {
|
if ( color( Specular ).isValid() && hasReflection( Specular ) ) {
|
||||||
c = color( Specular );
|
c = color( Specular );
|
||||||
prop->SetSpecularColor( c.redF(), c.greenF(), c.blueF() );
|
prop->SetSpecularColor( c.redF(), c.greenF(), c.blueF() );
|
||||||
prop->SetSpecular( reflection( Specular ) );
|
prop->SetSpecular( reflection( Specular, theIsFront ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// shininess
|
// shininess
|
||||||
prop->SetSpecularPower( shininess()*100.0 );
|
prop->SetSpecularPower( shininess( theIsFront )*100.0 );
|
||||||
|
|
||||||
// transparency
|
// transparency
|
||||||
prop->SetOpacity( 1 - transparency() );
|
prop->SetOpacity( 1 - transparency() );
|
||||||
|
@ -63,17 +63,17 @@ public:
|
|||||||
QColor color( ReflectionType ) const;
|
QColor color( ReflectionType ) const;
|
||||||
void setColor( ReflectionType, const QColor& );
|
void setColor( ReflectionType, const QColor& );
|
||||||
|
|
||||||
double reflection( ReflectionType ) const;
|
double reflection( ReflectionType, bool = true ) const;
|
||||||
void setReflection( ReflectionType, double );
|
void setReflection( ReflectionType, double, bool = true );
|
||||||
|
|
||||||
double shininess() const;
|
double shininess( bool = true) const;
|
||||||
void setShininess( double );
|
void setShininess( double, bool = true );
|
||||||
|
|
||||||
double transparency() const;
|
double transparency() const;
|
||||||
void setTransparency( double );
|
void setTransparency( double );
|
||||||
|
|
||||||
Graphic3d_MaterialAspect getMaterialOCCAspect();
|
Graphic3d_MaterialAspect getMaterialOCCAspect( bool = true );
|
||||||
GEOM_VTKPropertyMaterial* getMaterialVTKProperty();
|
GEOM_VTKPropertyMaterial* getMaterialVTKProperty( bool = true );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
@ -81,14 +81,16 @@ private:
|
|||||||
private:
|
private:
|
||||||
typedef struct {
|
typedef struct {
|
||||||
QColor color;
|
QColor color;
|
||||||
double coef;
|
double front_coef;
|
||||||
|
double back_coef;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
} ReflectionData;
|
} ReflectionData;
|
||||||
|
|
||||||
typedef QVector<ReflectionData> ReflectionList;
|
typedef QVector<ReflectionData> ReflectionList;
|
||||||
|
|
||||||
bool myIsPhysical;
|
bool myIsPhysical;
|
||||||
double myShininess;
|
double myFrontShininess;
|
||||||
|
double myBackShininess;
|
||||||
double myTransparency;
|
double myTransparency;
|
||||||
ReflectionList myReflection;
|
ReflectionList myReflection;
|
||||||
};
|
};
|
||||||
|
@ -23,196 +23,279 @@
|
|||||||
-->
|
-->
|
||||||
<document>
|
<document>
|
||||||
<section name="[common]" >
|
<section name="[common]" >
|
||||||
<parameter name="physical" value="false" />
|
<parameter name="physical" value="false" />
|
||||||
<parameter name="shininess" value="0.039" />
|
<parameter name="front_shininess" value="0.039" />
|
||||||
<parameter name="ambient" value="true" />
|
<parameter name="back_shininess" value="0.039" />
|
||||||
<parameter name="ambient-coefficient" value="0.3" />
|
<parameter name="ambient" value="true" />
|
||||||
<parameter name="ambient-color" value="#333333" />
|
<parameter name="front_ambient-coefficient" value="0.3" />
|
||||||
<parameter name="diffuse" value="true" />
|
<parameter name="back_ambient-coefficient" value="0.3" />
|
||||||
<parameter name="diffuse-coefficient" value="0.65" />
|
<parameter name="ambient-color" value="#333333" />
|
||||||
<parameter name="diffuse-color" value="#000000" />
|
<parameter name="diffuse" value="true" />
|
||||||
<parameter name="specular" value="true" />
|
<parameter name="front_diffuse-coefficient" value="0.65" />
|
||||||
<parameter name="specular-coefficient" value="0.0" />
|
<parameter name="back_diffuse-coefficient" value="0.65" />
|
||||||
<parameter name="specular-color" value="#ffffff" />
|
<parameter name="diffuse-color" value="#000000" />
|
||||||
<parameter name="emissive" value="false" />
|
<parameter name="specular" value="true" />
|
||||||
<parameter name="emissive-coefficient" value="0.0" />
|
<parameter name="front_specular-coefficient" value="0.0" />
|
||||||
<parameter name="emissive-color" value="#000000" />
|
<parameter name="back_specular-coefficient" value="0.0" />
|
||||||
<parameter name="transparency" value="0.0" />
|
<parameter name="specular-color" value="#ffffff" />
|
||||||
|
<parameter name="emissive" value="false" />
|
||||||
|
<parameter name="front_emissive-coefficient" value="0.0" />
|
||||||
|
<parameter name="back_emissive-coefficient" value="0.0" />
|
||||||
|
<parameter name="emissive-color" value="#000000" />
|
||||||
|
<parameter name="transparency" value="0.0" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Plastic" >
|
<section name="Plastic" >
|
||||||
<parameter name="shininess" value="0.0078125" />
|
<parameter name="front_shininess" value="0.0078125" />
|
||||||
<parameter name="ambient-coefficient" value="0.5" />
|
<parameter name="back_shininess" value="0.0078125" />
|
||||||
<parameter name="diffuse-coefficient" value="0.24" />
|
<parameter name="front_ambient-coefficient" value="0.5" />
|
||||||
<parameter name="specular-coefficient" value="0.06" />
|
<parameter name="back_ambient-coefficient" value="0.35" />
|
||||||
|
<parameter name="front_diffuse-coefficient" value="0.24" />
|
||||||
|
<parameter name="back_diffuse-coefficient" value="0.24" />
|
||||||
|
<parameter name="front_specular-coefficient" value="0.06" />
|
||||||
|
<parameter name="back_specular-coefficient" value="0.06" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Shiny plastic" >
|
<section name="Shiny plastic" >
|
||||||
<parameter name="shininess" value="1.0" />
|
<parameter name="front_shininess" value="1.0" />
|
||||||
<parameter name="ambient-coefficient" value="0.44" />
|
<parameter name="back_shininess" value="1.0" />
|
||||||
<parameter name="diffuse-coefficient" value="0.5" />
|
<parameter name="front_ambient-coefficient" value="0.44" />
|
||||||
<parameter name="specular-coefficient" value="1.0" />
|
<parameter name="back_ambient-coefficient" value="0.36" />
|
||||||
|
<parameter name="front_diffuse-coefficient" value="0.5" />
|
||||||
|
<parameter name="back_diffuse-coefficient" value="0.4" />
|
||||||
|
<parameter name="front_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="back_specular-coefficient" value="1.0" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Satin" >
|
<section name="Satin" >
|
||||||
<parameter name="shininess" value="0.09375" />
|
<parameter name="front_shininess" value="0.09375" />
|
||||||
<parameter name="ambient-coefficient" value="0.33" />
|
<parameter name="back_shininess" value="0.09375" />
|
||||||
<parameter name="diffuse-coefficient" value="0.4" />
|
<parameter name="front_ambient-coefficient" value="0.33" />
|
||||||
<parameter name="specular-coefficient" value="0.44" />
|
<parameter name="back_ambient-coefficient" value="0.28" />
|
||||||
|
<parameter name="front_diffuse-coefficient" value="0.4" />
|
||||||
|
<parameter name="back_diffuse-coefficient" value="0.35" />
|
||||||
|
<parameter name="front_specular-coefficient" value="0.44" />
|
||||||
|
<parameter name="back_specular-coefficient" value="0.44" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Neon" >
|
<section name="Neon" >
|
||||||
<parameter name="shininess" value="0.05" />
|
<parameter name="front_shininess" value="0.05" />
|
||||||
<parameter name="ambient-coefficient" value="1.0" />
|
<parameter name="back_shininess" value="0.05" />
|
||||||
<parameter name="diffuse-coefficient" value="1.0" />
|
<parameter name="front_ambient-coefficient" value="1.0" />
|
||||||
<parameter name="specular-coefficient" value="0.62" />
|
<parameter name="back_ambient-coefficient" value="0.6" />
|
||||||
<parameter name="emissive-coefficient" value="1.0" />
|
<parameter name="front_diffuse-coefficient" value="1.0" />
|
||||||
<parameter name="ambient" value="false" />
|
<parameter name="back_diffuse-coefficient" value="0.6" />
|
||||||
<parameter name="emissive" value="true" />
|
<parameter name="front_specular-coefficient" value="0.62" />
|
||||||
|
<parameter name="back_specular-coefficient" value="0.27" />
|
||||||
|
<parameter name="front_emissive-coefficient" value="1.0" />
|
||||||
|
<parameter name="back_emissive-coefficient" value="0.5" />
|
||||||
|
<parameter name="ambient" value="false" />
|
||||||
|
<parameter name="emissive" value="true" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Metalized" >
|
<section name="Metalized" >
|
||||||
<parameter name="shininess" value="0.13" />
|
<parameter name="front_shininess" value="0.08" />
|
||||||
<parameter name="ambient" value="false" />
|
<parameter name="back_shininess" value="0.13" />
|
||||||
<parameter name="ambient-coefficient" value="0.9" />
|
<parameter name="ambient" value="false" />
|
||||||
<parameter name="diffuse-coefficient" value="0.47" />
|
<parameter name="front_ambient-coefficient" value="0.9" />
|
||||||
<parameter name="specular-coefficient" value="0.45" />
|
<parameter name="back_ambient-coefficient" value="0.7" />
|
||||||
|
<parameter name="front_diffuse-coefficient" value="0.57" />
|
||||||
|
<parameter name="back_diffuse-coefficient" value="0.42" />
|
||||||
|
<parameter name="front_specular-coefficient" value="0.45" />
|
||||||
|
<parameter name="back_specular-coefficient" value="0.45" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Brass">
|
<section name="Brass">
|
||||||
<parameter name="physical" value="true" />
|
<parameter name="physical" value="true" />
|
||||||
<parameter name="shininess" value="0.21794844" />
|
<parameter name="front_shininess" value="0.21794844" />
|
||||||
<parameter name="ambient-coefficient" value="1.0" />
|
<parameter name="back_shininess" value="0.21794844" />
|
||||||
<parameter name="ambient-color" value="#543907" />
|
<parameter name="front_ambient-coefficient" value="1.0" />
|
||||||
<parameter name="diffuse-coefficient" value="1.0" />
|
<parameter name="back_ambient-coefficient" value="0.6" />
|
||||||
<parameter name="diffuse-color" value="#c7911d" />
|
<parameter name="ambient-color" value="#543907" />
|
||||||
<parameter name="specular-coefficient" value="1.0" />
|
<parameter name="front_diffuse-coefficient" value="1.0" />
|
||||||
<parameter name="specular-color" value="#fdf0ce" />
|
<parameter name="back_diffuse-coefficient" value="0.9" />
|
||||||
|
<parameter name="diffuse-color" value="#c7911d" />
|
||||||
|
<parameter name="front_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="back_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="specular-color" value="#fdf0ce" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Bronze">
|
<section name="Bronze">
|
||||||
<parameter name="physical" value="true" />
|
<parameter name="physical" value="true" />
|
||||||
<parameter name="shininess" value="0.2" />
|
<parameter name="front_shininess" value="0.2" />
|
||||||
<parameter name="ambient-coefficient" value="1.0" />
|
<parameter name="back_shininess" value="0.2" />
|
||||||
<parameter name="ambient-color" value="#36200d" />
|
<parameter name="front_ambient-coefficient" value="1.0" />
|
||||||
<parameter name="diffuse-coefficient" value="1.0" />
|
<parameter name="back_ambient-coefficient" value="0.6" />
|
||||||
<parameter name="diffuse-color" value="#b66d2e" />
|
<parameter name="ambient-color" value="#36200d" />
|
||||||
<parameter name="specular-coefficient" value="1.0" />
|
<parameter name="front_diffuse-coefficient" value="1.0" />
|
||||||
<parameter name="specular-color" value="#64452a" />
|
<parameter name="back_diffuse-coefficient" value="0.9" />
|
||||||
|
<parameter name="diffuse-color" value="#b66d2e" />
|
||||||
|
<parameter name="front_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="back_specular-coefficient" value="0.95" />
|
||||||
|
<parameter name="specular-color" value="#64452a" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Copper" >
|
<section name="Copper" >
|
||||||
<parameter name="physical" value="true" />
|
<parameter name="physical" value="true" />
|
||||||
<parameter name="shininess" value="0.93" />
|
<parameter name="front_shininess" value="0.93" />
|
||||||
<parameter name="ambient-coefficient" value="1.0" />
|
<parameter name="back_shininess" value="0.93" />
|
||||||
<parameter name="ambient-color" value="#54423a" />
|
<parameter name="front_ambient-coefficient" value="1.0" />
|
||||||
<parameter name="diffuse-coefficient" value="1.0" />
|
<parameter name="back_ambient-coefficient" value="0.6" />
|
||||||
<parameter name="diffuse-color" value="#801c00" />
|
<parameter name="ambient-color" value="#54423a" />
|
||||||
<parameter name="specular-coefficient" value="1.0" />
|
<parameter name="front_diffuse-coefficient" value="1.0" />
|
||||||
<parameter name="specular-color" value="#f3ba00" />
|
<parameter name="back_diffuse-coefficient" value="1.0" />
|
||||||
|
<parameter name="diffuse-color" value="#801c00" />
|
||||||
|
<parameter name="front_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="back_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="specular-color" value="#f3ba00" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Gold" >
|
<section name="Gold" >
|
||||||
<parameter name="physical" value="true" />
|
<parameter name="physical" value="true" />
|
||||||
<parameter name="shininess" value="0.0625" />
|
<parameter name="front_shininess" value="0.0625" />
|
||||||
<parameter name="ambient-coefficient" value="0.3" />
|
<parameter name="back_shininess" value="0.0625" />
|
||||||
<parameter name="ambient-color" value="#ffc451" />
|
<parameter name="front_ambient-coefficient" value="0.3" />
|
||||||
<parameter name="diffuse-coefficient" value="0.4" />
|
<parameter name="back_ambient-coefficient" value="0.25" />
|
||||||
<parameter name="diffuse-color" value="#ffb000" />
|
<parameter name="ambient-color" value="#ffc451" />
|
||||||
<parameter name="specular-coefficient" value="0.9" />
|
<parameter name="front_diffuse-coefficient" value="0.4" />
|
||||||
<parameter name="specular-color" value="#fffac7" />
|
<parameter name="back_diffuse-coefficient" value="0.3" />
|
||||||
|
<parameter name="diffuse-color" value="#ffb000" />
|
||||||
|
<parameter name="front_specular-coefficient" value="0.9" />
|
||||||
|
<parameter name="back_specular-coefficient" value="0.9" />
|
||||||
|
<parameter name="specular-color" value="#fffac7" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Pewter" >
|
<section name="Pewter" >
|
||||||
<parameter name="physical" value="true" />
|
<parameter name="physical" value="true" />
|
||||||
<parameter name="shininess" value="0.076923047" />
|
<parameter name="front_shininess" value="0.076923047" />
|
||||||
<parameter name="ambient-coefficient" value="1.0" />
|
<parameter name="back_shininess" value="0.076923047" />
|
||||||
<parameter name="ambient-color" value="#1b0f1d" />
|
<parameter name="front_ambient-coefficient" value="1.0" />
|
||||||
<parameter name="diffuse-coefficient" value="1.0" />
|
<parameter name="back_ambient-coefficient" value="0.6" />
|
||||||
<parameter name="diffuse-color" value="#6d788a" />
|
<parameter name="ambient-color" value="#1b0f1d" />
|
||||||
<parameter name="specular-coefficient" value="1.0" />
|
<parameter name="front_diffuse-coefficient" value="1.0" />
|
||||||
<parameter name="specular-color" value="#555585" />
|
<parameter name="back_diffuse-coefficient" value="0.9" />
|
||||||
|
<parameter name="diffuse-color" value="#6d788a" />
|
||||||
|
<parameter name="front_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="back_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="specular-color" value="#555585" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Plaster" >
|
<section name="Plaster" >
|
||||||
<parameter name="shininess" value="0.0078125" />
|
<parameter name="front_shininess" value="0.0078125" />
|
||||||
<parameter name="ambient-coefficient" value="0.26" />
|
<parameter name="back_shininess" value="0.0078125" />
|
||||||
<parameter name="ambient-color" value="#313131" />
|
<parameter name="front_ambient-coefficient" value="0.26" />
|
||||||
<parameter name="diffuse-coefficient" value="0.23" />
|
<parameter name="back_ambient-coefficient" value="0.18" />
|
||||||
<parameter name="diffuse-color" value="#818181" />
|
<parameter name="ambient-color" value="#313131" />
|
||||||
<parameter name="specular-coefficient" value="0.06" />
|
<parameter name="front_diffuse-coefficient" value="0.23" />
|
||||||
<parameter name="specular-color" value="#828282" />
|
<parameter name="back_diffuse-coefficient" value="0.18" />
|
||||||
|
<parameter name="diffuse-color" value="#818181" />
|
||||||
|
<parameter name="front_specular-coefficient" value="0.06" />
|
||||||
|
<parameter name="back_specular-coefficient" value="0.06" />
|
||||||
|
<parameter name="specular-color" value="#828282" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Silver" >
|
<section name="Silver" >
|
||||||
<parameter name="physical" value="true" />
|
<parameter name="physical" value="true" />
|
||||||
<parameter name="shininess" value="0.2" />
|
<parameter name="front_shininess" value="0.2" />
|
||||||
<parameter name="ambient-coefficient" value="1.0" />
|
<parameter name="back_shininess" value="0.2" />
|
||||||
<parameter name="ambient-color" value="#313131" />
|
<parameter name="front_ambient-coefficient" value="1.0" />
|
||||||
<parameter name="diffuse-coefficient" value="1.0" />
|
<parameter name="back_ambient-coefficient" value="0.6" />
|
||||||
<parameter name="diffuse-color" value="#818181" />
|
<parameter name="ambient-color" value="#313131" />
|
||||||
<parameter name="specular-coefficient" value="1.0" />
|
<parameter name="front_diffuse-coefficient" value="1.0" />
|
||||||
<parameter name="specular-color" value="#828282" />
|
<parameter name="back_diffuse-coefficient" value="0.95" />
|
||||||
|
<parameter name="diffuse-color" value="#818181" />
|
||||||
|
<parameter name="front_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="back_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="specular-color" value="#828282" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Steel" >
|
<section name="Steel" >
|
||||||
<parameter name="physical" value="true" />
|
<parameter name="physical" value="true" />
|
||||||
<parameter name="shininess" value="0.06" />
|
<parameter name="front_shininess" value="0.06" />
|
||||||
<parameter name="ambient-coefficient" value="0.01" />
|
<parameter name="back_shininess" value="0.06" />
|
||||||
<parameter name="diffuse-coefficient" value="0.03" />
|
<parameter name="front_ambient-coefficient" value="0.01" />
|
||||||
<parameter name="specular-coefficient" value="0.98" />
|
<parameter name="back_ambient-coefficient" value="0.01" />
|
||||||
<parameter name="specular-color" value="#ffffff" />
|
<parameter name="front_diffuse-coefficient" value="0.03" />
|
||||||
|
<parameter name="back_diffuse-coefficient" value="0.01" />
|
||||||
|
<parameter name="front_specular-coefficient" value="0.98" />
|
||||||
|
<parameter name="back_specular-coefficient" value="0.63" />
|
||||||
|
<parameter name="specular-color" value="#ffffff" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Stone" >
|
<section name="Stone" >
|
||||||
<parameter name="physical" value="true" />
|
<parameter name="physical" value="true" />
|
||||||
<parameter name="shininess" value="0.17" />
|
<parameter name="front_shininess" value="0.17" />
|
||||||
<parameter name="ambient-coefficient" value="0.19" />
|
<parameter name="back_shininess" value="0.17" />
|
||||||
<parameter name="ambient-color" value="#ffcc9e" />
|
<parameter name="front_ambient-coefficient" value="0.19" />
|
||||||
<parameter name="diffuse-coefficient" value="0.75" />
|
<parameter name="back_ambient-coefficient" value="0.19" />
|
||||||
<parameter name="diffuse-color" value="#ffcc9e" />
|
<parameter name="ambient-color" value="#ffcc9e" />
|
||||||
<parameter name="specular-coefficient" value="0.08" />
|
<parameter name="front_diffuse-coefficient" value="0.75" />
|
||||||
<parameter name="specular-color" value="#faff99" />
|
<parameter name="back_diffuse-coefficient" value="0.5" />
|
||||||
|
<parameter name="diffuse-color" value="#ffcc9e" />
|
||||||
|
<parameter name="front_specular-coefficient" value="0.08" />
|
||||||
|
<parameter name="back_specular-coefficient" value="0.08" />
|
||||||
|
<parameter name="specular-color" value="#faff99" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Chrome" >
|
<section name="Chrome" >
|
||||||
<parameter name="physical" value="true" />
|
<parameter name="physical" value="true" />
|
||||||
<parameter name="shininess" value="0.1" />
|
<parameter name="front_shininess" value="0.1" />
|
||||||
<parameter name="ambient-coefficient" value="1.0" />
|
<parameter name="back_shininess" value="0.1" />
|
||||||
<parameter name="ambient-color" value="#595959" />
|
<parameter name="front_ambient-coefficient" value="1.0" />
|
||||||
<parameter name="diffuse-coefficient" value="1.0" />
|
<parameter name="back_ambient-coefficient" value="0.6" />
|
||||||
<parameter name="diffuse-color" value="#666666" />
|
<parameter name="ambient-color" value="#595959" />
|
||||||
<parameter name="specular-coefficient" value="1.0" />
|
<parameter name="front_diffuse-coefficient" value="1.0" />
|
||||||
<parameter name="specular-color" value="#f9f9f9" />
|
<parameter name="back_diffuse-coefficient" value="0.95" />
|
||||||
|
<parameter name="diffuse-color" value="#666666" />
|
||||||
|
<parameter name="front_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="back_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="specular-color" value="#f9f9f9" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Neon (physical)" >
|
<section name="Neon (physical)" >
|
||||||
<parameter name="physical" value="true" />
|
<parameter name="physical" value="true" />
|
||||||
<parameter name="shininess" value="0.05" />
|
<parameter name="front_shininess" value="0.05" />
|
||||||
<parameter name="ambient" value="false" />
|
<parameter name="back_shininess" value="0.05" />
|
||||||
<parameter name="ambient-coefficient" value="1.0" />
|
<parameter name="ambient" value="false" />
|
||||||
<parameter name="ambient-color" value="#ffffff" />
|
<parameter name="front_ambient-coefficient" value="1.0" />
|
||||||
<parameter name="diffuse" value="false" />
|
<parameter name="back_ambient-coefficient" value="1.0" />
|
||||||
<parameter name="diffuse-coefficient" value="1.0" />
|
<parameter name="ambient-color" value="#ffffff" />
|
||||||
<parameter name="diffuse-color" value="#ffffff" />
|
<parameter name="diffuse" value="false" />
|
||||||
<parameter name="specular-coefficient" value="0.62" />
|
<parameter name="front_diffuse-coefficient" value="1.0" />
|
||||||
<parameter name="specular-color" value="#ffffff" />
|
<parameter name="back_diffuse-coefficient" value="1.0" />
|
||||||
<parameter name="emissive" value="true" />
|
<parameter name="diffuse-color" value="#ffffff" />
|
||||||
<parameter name="emissive-coefficient" value="0.9" />
|
<parameter name="front_specular-coefficient" value="0.62" />
|
||||||
<parameter name="emissive-color" value="#00ff75" />
|
<parameter name="back_specular-coefficient" value="0.62" />
|
||||||
|
<parameter name="specular-color" value="#ffffff" />
|
||||||
|
<parameter name="emissive" value="true" />
|
||||||
|
<parameter name="front_emissive-coefficient" value="0.9" />
|
||||||
|
<parameter name="back_emissive-coefficient" value="0.72" />
|
||||||
|
<parameter name="emissive-color" value="#00ff75" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Aluminium" >
|
<section name="Aluminium" >
|
||||||
<parameter name="physical" value="true" />
|
<parameter name="physical" value="true" />
|
||||||
<parameter name="shininess" value="0.09" />
|
<parameter name="front_shininess" value="0.09" />
|
||||||
<parameter name="ambient-coefficient" value="1.0" />
|
<parameter name="back_shininess" value="0.09" />
|
||||||
<parameter name="ambient-color" value="#4c4c4c" />
|
<parameter name="front_ambient-coefficient" value="1.0" />
|
||||||
<parameter name="diffuse-coefficient" value="1.0" />
|
<parameter name="back_ambient-coefficient" value="0.6" />
|
||||||
<parameter name="diffuse-color" value="#4c4c4c" />
|
<parameter name="ambient-color" value="#4c4c4c" />
|
||||||
<parameter name="specular-coefficient" value="1.0" />
|
<parameter name="front_diffuse-coefficient" value="1.0" />
|
||||||
<parameter name="specular-color" value="#b3b3cc" />
|
<parameter name="back_diffuse-coefficient" value="1.0" />
|
||||||
|
<parameter name="diffuse-color" value="#4c4c4c" />
|
||||||
|
<parameter name="front_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="back_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="specular-color" value="#b3b3cc" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Obsidian" >
|
<section name="Obsidian" >
|
||||||
<parameter name="physical" value="true" />
|
<parameter name="physical" value="true" />
|
||||||
<parameter name="shininess" value="0.3" />
|
<parameter name="front_shininess" value="0.3" />
|
||||||
<parameter name="ambient-coefficient" value="1.0" />
|
<parameter name="back_shininess" value="0.3" />
|
||||||
<parameter name="ambient-color" value="#0d0c10" />
|
<parameter name="front_ambient-coefficient" value="1.0" />
|
||||||
<parameter name="diffuse-coefficient" value="1.0" />
|
<parameter name="back_ambient-coefficient" value="1.0" />
|
||||||
<parameter name="diffuse-color" value="#2e2b39" />
|
<parameter name="ambient-color" value="#0d0c10" />
|
||||||
<parameter name="specular-coefficient" value="1.0" />
|
<parameter name="front_diffuse-coefficient" value="1.0" />
|
||||||
<parameter name="specular-color" value="#555458" />
|
<parameter name="back_diffuse-coefficient" value="0.7" />
|
||||||
|
<parameter name="diffuse-color" value="#2e2b39" />
|
||||||
|
<parameter name="front_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="back_specular-coefficient" value="0.9" />
|
||||||
|
<parameter name="specular-color" value="#555458" />
|
||||||
</section>
|
</section>
|
||||||
<section name="Jade" >
|
<section name="Jade" >
|
||||||
<parameter name="physical" value="true" />
|
<parameter name="physical" value="true" />
|
||||||
<parameter name="shininess" value="0.1" />
|
<parameter name="front_shininess" value="0.1" />
|
||||||
<parameter name="ambient-coefficient" value="1.0" />
|
<parameter name="back_shininess" value="0.1" />
|
||||||
<parameter name="ambient-color" value="#223828" />
|
<parameter name="front_ambient-coefficient" value="1.0" />
|
||||||
<parameter name="diffuse-coefficient" value="1.0" />
|
<parameter name="back_ambient-coefficient" value="0.6" />
|
||||||
<parameter name="diffuse-color" value="#8ae3a1" />
|
<parameter name="ambient-color" value="#223828" />
|
||||||
<parameter name="specular-coefficient" value="1.0" />
|
<parameter name="front_diffuse-coefficient" value="1.0" />
|
||||||
<parameter name="specular-color" value="#505050" />
|
<parameter name="back_diffuse-coefficient" value="0.85" />
|
||||||
|
<parameter name="diffuse-color" value="#8ae3a1" />
|
||||||
|
<parameter name="front_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="back_specular-coefficient" value="1.0" />
|
||||||
|
<parameter name="specular-color" value="#505050" />
|
||||||
</section>
|
</section>
|
||||||
</document>
|
</document>
|
||||||
|
@ -166,7 +166,8 @@ GEOM_AISShape::GEOM_AISShape(const TopoDS_Shape& shape,
|
|||||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
|
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
|
||||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(aMatAspect);
|
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(aMatAspect);
|
||||||
}
|
}
|
||||||
myCurrentMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
myCurrentFrontMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
||||||
|
myCurrentBackMaterial = myDrawer->ShadingAspect()->Aspect()->BackMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_AISShape::setIO(const Handle(SALOME_InteractiveObject)& io){
|
void GEOM_AISShape::setIO(const Handle(SALOME_InteractiveObject)& io){
|
||||||
@ -327,10 +328,12 @@ void GEOM_AISShape::SetTransparency(const Standard_Real aValue)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
||||||
|
Graphic3d_MaterialAspect BMat = myDrawer->ShadingAspect()->Aspect()->BackMaterial();
|
||||||
FMat.SetTransparency(aValue);
|
FMat.SetTransparency(aValue);
|
||||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(FMat);
|
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(FMat);
|
||||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(FMat);
|
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(BMat);
|
||||||
myCurrentMaterial = FMat;
|
myCurrentFrontMaterial = FMat;
|
||||||
|
myCurrentBackMaterial = BMat;
|
||||||
myTransparency = aValue;
|
myTransparency = aValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,9 +391,10 @@ void GEOM_AISShape::shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPre
|
|||||||
|
|
||||||
Graphic3d_MaterialAspect aMatAspect(Graphic3d_NOM_PLASTIC);
|
Graphic3d_MaterialAspect aMatAspect(Graphic3d_NOM_PLASTIC);
|
||||||
aMatAspect.SetTransparency(myTransparency);
|
aMatAspect.SetTransparency(myTransparency);
|
||||||
myCurrentMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
myCurrentFrontMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
||||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial( isTopLevel() ? aMatAspect : myCurrentMaterial );
|
myCurrentBackMaterial = myDrawer->ShadingAspect()->Aspect()->BackMaterial();
|
||||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial( isTopLevel() ? aMatAspect : myCurrentMaterial );
|
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial( isTopLevel() ? aMatAspect : myCurrentFrontMaterial );
|
||||||
|
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial( isTopLevel() ? aMatAspect : myCurrentBackMaterial );
|
||||||
|
|
||||||
//Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
|
//Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
|
||||||
// P->SetPrimitivesAspect(a4bis);
|
// P->SetPrimitivesAspect(a4bis);
|
||||||
|
@ -172,7 +172,8 @@ private:
|
|||||||
TCollection_AsciiString myName;
|
TCollection_AsciiString myName;
|
||||||
bool myDisplayVectors;
|
bool myDisplayVectors;
|
||||||
Standard_Boolean myTopLevel;
|
Standard_Boolean myTopLevel;
|
||||||
Graphic3d_MaterialAspect myCurrentMaterial;
|
Graphic3d_MaterialAspect myCurrentFrontMaterial;
|
||||||
|
Graphic3d_MaterialAspect myCurrentBackMaterial;
|
||||||
Standard_Integer myPrevDisplayMode;
|
Standard_Integer myPrevDisplayMode;
|
||||||
|
|
||||||
static TopLevelDispMode myTopLevelDm;
|
static TopLevelDispMode myTopLevelDm;
|
||||||
|
@ -112,7 +112,8 @@ GEOM_Actor::GEOM_Actor():
|
|||||||
|
|
||||||
myHighlightProp(vtkProperty::New()),
|
myHighlightProp(vtkProperty::New()),
|
||||||
myPreHighlightProp(vtkProperty::New()),
|
myPreHighlightProp(vtkProperty::New()),
|
||||||
myShadingFaceProp(vtkProperty::New())
|
myShadingFaceProp(vtkProperty::New()),
|
||||||
|
myShadingBackFaceProp(vtkProperty::New())
|
||||||
{
|
{
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
MESSAGE (this<< " GEOM_Actor::GEOM_Actor");
|
MESSAGE (this<< " GEOM_Actor::GEOM_Actor");
|
||||||
@ -201,6 +202,7 @@ GEOM_Actor::~GEOM_Actor()
|
|||||||
myHighlightProp->Delete();
|
myHighlightProp->Delete();
|
||||||
myPreHighlightProp->Delete();
|
myPreHighlightProp->Delete();
|
||||||
myShadingFaceProp->Delete();
|
myShadingFaceProp->Delete();
|
||||||
|
myShadingBackFaceProp->Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOM_Actor*
|
GEOM_Actor*
|
||||||
@ -546,6 +548,7 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
|
|||||||
myPreHighlightProp->SetRepresentationToSurface();
|
myPreHighlightProp->SetRepresentationToSurface();
|
||||||
myHighlightProp->SetRepresentationToSurface();
|
myHighlightProp->SetRepresentationToSurface();
|
||||||
myShadingFaceProp->SetRepresentationToSurface();
|
myShadingFaceProp->SetRepresentationToSurface();
|
||||||
|
myShadingBackFaceProp->SetRepresentationToSurface();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,14 +556,17 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
|
|||||||
if(myIsPreselected){
|
if(myIsPreselected){
|
||||||
this->myHighlightActor->SetProperty(myPreHighlightProp.GetPointer());
|
this->myHighlightActor->SetProperty(myPreHighlightProp.GetPointer());
|
||||||
myShadingFaceActor->SetProperty(myPreHighlightProp.GetPointer());
|
myShadingFaceActor->SetProperty(myPreHighlightProp.GetPointer());
|
||||||
|
myShadingFaceActor->SetBackfaceProperty(myPreHighlightProp.GetPointer());
|
||||||
} else {
|
} else {
|
||||||
this->myHighlightActor->SetProperty(myShadingFaceProp.GetPointer());
|
this->myHighlightActor->SetProperty(myShadingFaceProp.GetPointer());
|
||||||
myShadingFaceActor->SetProperty(myShadingFaceProp.GetPointer());
|
myShadingFaceActor->SetProperty(myShadingFaceProp.GetPointer());
|
||||||
|
myShadingFaceActor->SetBackfaceProperty(myShadingBackFaceProp.GetPointer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this->myHighlightActor->SetProperty(myHighlightProp.GetPointer());
|
this->myHighlightActor->SetProperty(myHighlightProp.GetPointer());
|
||||||
myShadingFaceActor->SetProperty(myHighlightProp.GetPointer());
|
myShadingFaceActor->SetProperty(myHighlightProp.GetPointer());
|
||||||
|
myShadingFaceActor->SetBackfaceProperty(myHighlightProp.GetPointer());
|
||||||
}
|
}
|
||||||
|
|
||||||
this->Property->Render(this, ren);
|
this->Property->Render(this, ren);
|
||||||
@ -671,6 +677,7 @@ void GEOM_Actor::SetOpacity(vtkFloatingPointType opa)
|
|||||||
{
|
{
|
||||||
// enk:tested OK
|
// enk:tested OK
|
||||||
myShadingFaceProp->SetOpacity(opa);
|
myShadingFaceProp->SetOpacity(opa);
|
||||||
|
myShadingBackFaceProp->SetOpacity(opa);
|
||||||
myHighlightProp->SetOpacity(opa);
|
myHighlightProp->SetOpacity(opa);
|
||||||
myPreHighlightProp->SetOpacity(opa);
|
myPreHighlightProp->SetOpacity(opa);
|
||||||
myVertexActor->GetProperty()->SetOpacity(opa);
|
myVertexActor->GetProperty()->SetOpacity(opa);
|
||||||
@ -686,6 +693,7 @@ void GEOM_Actor::SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloat
|
|||||||
{
|
{
|
||||||
// enk:tested OK
|
// enk:tested OK
|
||||||
myShadingFaceProp->SetColor(r,g,b); // shading color (Shading)
|
myShadingFaceProp->SetColor(r,g,b); // shading color (Shading)
|
||||||
|
myShadingBackFaceProp->SetColor(r,g,b); // back face shading color (Shading)
|
||||||
myVertexActor->GetProperty()->SetColor(r,g,b); // vertex actor (Shading/Wireframe)
|
myVertexActor->GetProperty()->SetColor(r,g,b); // vertex actor (Shading/Wireframe)
|
||||||
if ( myDisplayMode != (int)eShadingWithEdges ) {
|
if ( myDisplayMode != (int)eShadingWithEdges ) {
|
||||||
myIsolatedEdgeActor->GetProperty()->SetColor(r,g,b); // standalone edge color (Wireframe)
|
myIsolatedEdgeActor->GetProperty()->SetColor(r,g,b); // standalone edge color (Wireframe)
|
||||||
@ -709,22 +717,40 @@ void GEOM_Actor::GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFlo
|
|||||||
void GEOM_Actor::SetMaterial(std::vector<vtkProperty*> theProps)
|
void GEOM_Actor::SetMaterial(std::vector<vtkProperty*> theProps)
|
||||||
{
|
{
|
||||||
// we set material properties as back and front material
|
// we set material properties as back and front material
|
||||||
|
int aSize = theProps.size();
|
||||||
|
|
||||||
|
if ( aSize < 1 || aSize > 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// theProps[0] -- front material properties
|
||||||
|
// theProps[1] -- back material properties (if exist)
|
||||||
|
|
||||||
double aCoefnt;
|
double aCoefnt;
|
||||||
|
|
||||||
// Set reflection coefficients
|
// Set reflection coefficients
|
||||||
aCoefnt = theProps[0]->GetAmbient();
|
aCoefnt = theProps[0]->GetAmbient();
|
||||||
myShadingFaceProp->SetAmbient(aCoefnt);
|
myShadingFaceProp->SetAmbient(aCoefnt);
|
||||||
myVertexActor->GetProperty()->SetAmbient(aCoefnt);
|
myVertexActor->GetProperty()->SetAmbient(aCoefnt);
|
||||||
|
if ( aSize == 2 )
|
||||||
|
aCoefnt = theProps[1]->GetAmbient();
|
||||||
|
myShadingBackFaceProp->SetAmbient(aCoefnt);
|
||||||
|
|
||||||
// Set diffuse coefficients
|
// Set diffuse coefficients
|
||||||
aCoefnt = theProps[0]->GetDiffuse();
|
aCoefnt = theProps[0]->GetDiffuse();
|
||||||
myShadingFaceProp->SetDiffuse(aCoefnt);
|
myShadingFaceProp->SetDiffuse(aCoefnt);
|
||||||
myVertexActor->GetProperty()->SetDiffuse(aCoefnt);
|
myVertexActor->GetProperty()->SetDiffuse(aCoefnt);
|
||||||
|
if ( aSize == 2 )
|
||||||
|
aCoefnt = theProps[1]->GetDiffuse();
|
||||||
|
myShadingBackFaceProp->SetDiffuse(aCoefnt);
|
||||||
|
|
||||||
// Set specular coefficients
|
// Set specular coefficients
|
||||||
aCoefnt = theProps[0]->GetSpecular();
|
aCoefnt = theProps[0]->GetSpecular();
|
||||||
myShadingFaceProp->SetSpecular(aCoefnt);
|
myShadingFaceProp->SetSpecular(aCoefnt);
|
||||||
myVertexActor->GetProperty()->SetSpecular(aCoefnt);
|
myVertexActor->GetProperty()->SetSpecular(aCoefnt);
|
||||||
|
if ( aSize == 2 )
|
||||||
|
aCoefnt = theProps[1]->GetSpecular();
|
||||||
|
myShadingBackFaceProp->SetSpecular(aCoefnt);
|
||||||
|
|
||||||
|
|
||||||
double* aColor;
|
double* aColor;
|
||||||
|
|
||||||
@ -732,28 +758,48 @@ void GEOM_Actor::SetMaterial(std::vector<vtkProperty*> theProps)
|
|||||||
aColor = theProps[0]->GetAmbientColor();
|
aColor = theProps[0]->GetAmbientColor();
|
||||||
myShadingFaceProp->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
|
myShadingFaceProp->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
|
||||||
myVertexActor->GetProperty()->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
|
myVertexActor->GetProperty()->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
|
||||||
|
if ( aSize == 2 )
|
||||||
|
aColor = theProps[1]->GetAmbientColor();
|
||||||
|
myShadingBackFaceProp->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
|
||||||
|
|
||||||
// Set diffuse colors
|
// Set diffuse colors
|
||||||
aColor = theProps[0]->GetDiffuseColor();
|
aColor = theProps[0]->GetDiffuseColor();
|
||||||
myShadingFaceProp->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
|
myShadingFaceProp->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
|
||||||
myVertexActor->GetProperty()->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
|
myVertexActor->GetProperty()->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
|
||||||
|
if ( aSize == 2 )
|
||||||
|
aColor = theProps[1]->GetDiffuseColor();
|
||||||
|
myShadingBackFaceProp->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
|
||||||
|
|
||||||
// Set specular colors
|
// Set specular colors
|
||||||
aColor = theProps[0]->GetSpecularColor();
|
aColor = theProps[0]->GetSpecularColor();
|
||||||
myShadingFaceProp->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
|
myShadingFaceProp->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
|
||||||
myVertexActor->GetProperty()->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
|
myVertexActor->GetProperty()->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
|
||||||
|
if ( aSize == 2 )
|
||||||
|
aColor = theProps[1]->GetSpecularColor();
|
||||||
|
myShadingBackFaceProp->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
|
||||||
|
|
||||||
// Set shininess
|
// Set shininess
|
||||||
aCoefnt = theProps[0]->GetSpecularPower();
|
aCoefnt = theProps[0]->GetSpecularPower();
|
||||||
myShadingFaceProp->SetSpecularPower(aCoefnt);
|
myShadingFaceProp->SetSpecularPower(aCoefnt);
|
||||||
myVertexActor->GetProperty()->SetSpecularPower(aCoefnt);
|
myVertexActor->GetProperty()->SetSpecularPower(aCoefnt);
|
||||||
|
if ( aSize == 2 )
|
||||||
|
aCoefnt = theProps[1]->GetSpecularPower();
|
||||||
|
myShadingBackFaceProp->SetSpecularPower(aCoefnt);
|
||||||
|
|
||||||
|
// Set back face material property
|
||||||
|
myShadingFaceActor->SetBackfaceProperty(myShadingBackFaceProp.GetPointer());
|
||||||
}
|
}
|
||||||
|
|
||||||
vtkProperty* GEOM_Actor::GetMaterial()
|
vtkProperty* GEOM_Actor::GetFrontMaterial()
|
||||||
{
|
{
|
||||||
return myShadingFaceProp;
|
return myShadingFaceProp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vtkProperty* GEOM_Actor::GetBackMaterial()
|
||||||
|
{
|
||||||
|
return myShadingBackFaceProp;
|
||||||
|
}
|
||||||
|
|
||||||
bool GEOM_Actor::IsInfinitive()
|
bool GEOM_Actor::IsInfinitive()
|
||||||
{
|
{
|
||||||
return ((bool)myShape.Infinite() || isOnlyVertex);
|
return ((bool)myShape.Infinite() || isOnlyVertex);
|
||||||
|
@ -126,8 +126,8 @@ public:
|
|||||||
|
|
||||||
// Material
|
// Material
|
||||||
void SetMaterial(std::vector<vtkProperty*> theProps);
|
void SetMaterial(std::vector<vtkProperty*> theProps);
|
||||||
vtkProperty* GetMaterial();
|
vtkProperty* GetFrontMaterial();
|
||||||
|
vtkProperty* GetBackMaterial();
|
||||||
virtual bool IsInfinitive();
|
virtual bool IsInfinitive();
|
||||||
|
|
||||||
// overloaded functions
|
// overloaded functions
|
||||||
@ -242,6 +242,7 @@ private:
|
|||||||
vtkSmartPointer<vtkProperty> myHighlightProp;
|
vtkSmartPointer<vtkProperty> myHighlightProp;
|
||||||
vtkSmartPointer<vtkProperty> myPreHighlightProp;
|
vtkSmartPointer<vtkProperty> myPreHighlightProp;
|
||||||
vtkSmartPointer<vtkProperty> myShadingFaceProp;
|
vtkSmartPointer<vtkProperty> myShadingFaceProp;
|
||||||
|
vtkSmartPointer<vtkProperty> myShadingBackFaceProp;
|
||||||
|
|
||||||
PAppendFilter myAppendFilter;
|
PAppendFilter myAppendFilter;
|
||||||
PPolyGeomPainterDataMapper myPolyDataMapper;
|
PPolyGeomPainterDataMapper myPolyDataMapper;
|
||||||
|
@ -73,6 +73,20 @@ GetProperty()
|
|||||||
return myActor->GetProperty();
|
return myActor->GetProperty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
GEOM_DeviceActor::
|
||||||
|
SetBackfaceProperty(vtkProperty* theProperty)
|
||||||
|
{
|
||||||
|
myActor->SetBackfaceProperty(theProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
vtkProperty*
|
||||||
|
GEOM_DeviceActor::
|
||||||
|
GetBackfaceProperty()
|
||||||
|
{
|
||||||
|
return myActor->GetBackfaceProperty();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GEOM_DeviceActor::
|
GEOM_DeviceActor::
|
||||||
SetVisibility(int theVisibility)
|
SetVisibility(int theVisibility)
|
||||||
|
@ -53,6 +53,9 @@ public:
|
|||||||
void SetProperty(vtkProperty* theProperty);
|
void SetProperty(vtkProperty* theProperty);
|
||||||
vtkProperty* GetProperty();
|
vtkProperty* GetProperty();
|
||||||
|
|
||||||
|
void SetBackfaceProperty(vtkProperty* theProperty);
|
||||||
|
vtkProperty* GetBackfaceProperty();
|
||||||
|
|
||||||
void SetVisibility(int theVisibility);
|
void SetVisibility(int theVisibility);
|
||||||
int GetVisibility();
|
int GetVisibility();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user