X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMaterial%2FMaterial_Model.cxx;fp=src%2FMaterial%2FMaterial_Model.cxx;h=8f66ac34a3c31f3fc0eb4681113b5f788d8ebbda;hb=d07a864e835879ccbbc2a5d21a0ba0ab131c3f36;hp=0b6792f342319162231a5f8fae8f2b1e5b8f4c06;hpb=e87935b0f9b3fddcc97715af8642e56d0e57e45c;p=modules%2Fgeom.git diff --git a/src/Material/Material_Model.cxx b/src/Material/Material_Model.cxx index 0b6792f34..8f66ac34a 100644 --- a/src/Material/Material_Model.cxx +++ b/src/Material/Material_Model.cxx @@ -27,6 +27,8 @@ #include +#include + /*! \brief Constructor @@ -557,17 +559,34 @@ Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect( bool theIsFront ) QColor c; // ambient reflection +#if OCC_VERSION_LARGE >= 0x07040000 + if ( color( Ambient ).isValid() ) { + c = color( Ambient ); + aspect.SetAmbientColor( Quantity_Color( Graphic3d_Vec3( c.redF(), c.greenF(), c.blueF() ) * reflection( Ambient, theIsFront ) ) ); + } + if ( !hasReflection( Ambient ) ) + aspect.SetAmbientColor( Quantity_NOC_BLACK ); +#else if ( color( Ambient ).isValid() ) { c = color( Ambient ); - aspect.SetAmbientColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) ); + aspect.SetAmbientColor( ( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) ); } aspect.SetAmbient( reflection( Ambient, theIsFront )); if ( hasReflection( Ambient ) ) aspect.SetReflectionModeOn( Graphic3d_TOR_AMBIENT ); else aspect.SetReflectionModeOff( Graphic3d_TOR_AMBIENT ); +#endif // diffuse reflection +#if OCC_VERSION_LARGE >= 0x07040000 + if ( color( Diffuse ).isValid() ) { + c = color( Diffuse ); + aspect.SetDiffuseColor( Quantity_Color( Graphic3d_Vec3( c.redF(), c.greenF(), c.blueF() ) * reflection( Diffuse, theIsFront ) ) ); + } + if ( !hasReflection( Diffuse ) ) + aspect.SetDiffuseColor( Quantity_NOC_BLACK ); +#else if ( color( Diffuse ).isValid() ) { c = color( Diffuse ); aspect.SetDiffuseColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) ); @@ -577,8 +596,17 @@ Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect( bool theIsFront ) aspect.SetReflectionModeOn( Graphic3d_TOR_DIFFUSE ); else aspect.SetReflectionModeOff( Graphic3d_TOR_DIFFUSE ); +#endif // specular reflection +#if OCC_VERSION_LARGE >= 0x07040000 + if ( color( Specular ).isValid() ) { + c = color( Specular ); + aspect.SetSpecularColor( Quantity_Color( Graphic3d_Vec3( c.redF(), c.greenF(), c.blueF() ) * reflection( Specular, theIsFront ) ) ); + } + if ( !hasReflection( Specular ) ) + aspect.SetSpecularColor( Quantity_NOC_BLACK ); +#else if ( color( Specular ).isValid() ) { c = color( Specular ); aspect.SetSpecularColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) ); @@ -588,8 +616,17 @@ Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect( bool theIsFront ) aspect.SetReflectionModeOn( Graphic3d_TOR_SPECULAR ); else aspect.SetReflectionModeOff( Graphic3d_TOR_SPECULAR ); +#endif // emissive reflection +#if OCC_VERSION_LARGE >= 0x07040000 + if ( color( Emissive ).isValid() ) { + c = color( Emissive ); + aspect.SetEmissiveColor( Quantity_Color( Graphic3d_Vec3( c.redF(), c.greenF(), c.blueF() ) * reflection( Emissive, theIsFront ) ) ); + } + if ( !hasReflection( Emissive ) ) + aspect.SetEmissiveColor( Quantity_NOC_BLACK ); +#else if ( color( Emissive ).isValid() ) { c = color( Emissive ); aspect.SetEmissiveColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) ); @@ -599,6 +636,7 @@ Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect( bool theIsFront ) aspect.SetReflectionModeOn( Graphic3d_TOR_EMISSION ); else aspect.SetReflectionModeOff( Graphic3d_TOR_EMISSION ); +#endif // shininess aspect.SetShininess( shininess( theIsFront ) );