-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <QMutexLocker>
+#include <Basics_OCCTVersion.hxx>
+
/*!
\brief Constructor
{
double value = 0.0;
if ( type >= 0 && type < 4 )
+ {
if ( theIsFront )
value = myReflection[ type ].front_coef;
else
value = myReflection[ type ].back_coef;
+ }
return value;
}
void Material_Model::setReflection( ReflectionType type, double value, bool theIsFront )
{
if ( type >= 0 && type < 4 )
+ {
if ( theIsFront )
myReflection[ type ].front_coef = value;
else
myReflection[ type ].back_coef = value;
+ }
}
/*!
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.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 ) );
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 ) );
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 ) );
aspect.SetReflectionModeOn( Graphic3d_TOR_EMISSION );
else
aspect.SetReflectionModeOff( Graphic3d_TOR_EMISSION );
+#endif
// shininess
aspect.SetShininess( shininess( theIsFront ) );