#include <QMutexLocker>
+#include <Basics_OCCTVersion.hxx>
+
/*!
\brief Constructor
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 ) );
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 ) );
myTopLevel = Standard_False;
Graphic3d_MaterialAspect aMatAspect;
if ( !HasMaterial() ) {
+#if OCC_VERSION_LARGE >= 0x07040000
+ aMatAspect.SetAmbientColor( Quantity_Color (Graphic3d_Vec3( 0.5f ) ) );
+ aMatAspect.SetDiffuseColor( Quantity_Color (Graphic3d_Vec3( 0.5f ) ) );
+ aMatAspect.SetEmissiveColor( Quantity_Color (Graphic3d_Vec3( 0.5f ) ) );
+ aMatAspect.SetSpecularColor( Quantity_Color (Graphic3d_Vec3( 0.5f ) ) );
+#else
aMatAspect.SetAmbient( 0.5 );
aMatAspect.SetDiffuse( 0.5 );
aMatAspect.SetEmissive( 0.5 );
- aMatAspect.SetShininess(0.5 );
aMatAspect.SetSpecular( 0.5 );
-
+#endif
+ aMatAspect.SetShininess(0.5 );
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(aMatAspect);
}
myTextDPI( 0 )
{
// graphical resources for drawing text and underline
+#if OCC_VERSION_LARGE >= 0x07040000
+ myTextParams = new Graphic3d_Text( theTextHeight );
+ myTextParams->SetText( myText.ToCString() );
+ myTextParams->SetHorizontalAlignment ( Graphic3d_HTA_CENTER );
+ myTextParams->SetVerticalAlignment ( Graphic3d_VTA_CENTER );
+ myTextDraw = new OpenGl_Text( myTextParams );
+#else
myTextParams.Height = theTextHeight;
myTextParams.HAlign = Graphic3d_HTA_CENTER;
myTextParams.VAlign = Graphic3d_VTA_CENTER;
myTextDraw = new OpenGl_Text( myText.ToCString(), OpenGl_Vec3(), myTextParams );
+#endif
myTextLineDraw = new OpenGl_PrimitiveArray( theDriver );
// graphical resources for drawing extension line and marker
#endif
// getting string size will also initialize font library
+#if OCC_VERSION_LARGE >= 0x07040000
+ myTextDraw->StringSize( aContext,
+ myText, *anAspect, myTextParams->Height(), aDPI,
+ myTextSize.x, myTextSize.a, myTextSize.d );
+#else
myTextDraw->StringSize( aContext,
myText, *anAspect, myTextParams, aDPI,
myTextSize.x, myTextSize.a, myTextSize.d );
+#endif
myTextDPI = aDPI;
myTextSize.y = myTextSize.a - myTextSize.d;
+
+# if OCC_VERSION_LARGE >= 0x07040000
+ switch ( myTextParams->HorizontalAlignment() )
+#else
switch (myTextParams.HAlign)
+#endif
{
case Graphic3d_HTA_LEFT: myTextUnderline.x() = 0.f; break;
case Graphic3d_HTA_CENTER: myTextUnderline.x() = -myTextSize.x / 2.f; break;
default:
break;
}
+
+# if OCC_VERSION_LARGE >= 0x07040000
+ switch ( myTextParams->VerticalAlignment() )
+#else
switch (myTextParams.VAlign)
+#endif
{
case Graphic3d_VTA_TOPFIRSTLINE:
case Graphic3d_VTA_TOP: myTextUnderline.y() = -myTextSize.y; break;
// ------------------------------------------------------------
OpenGl_Vec4 aCenter (0.f, 0.f, 0.f, 1.f);
+# if OCC_VERSION_LARGE >= 0x07040000
+ switch ( myTextParams->HorizontalAlignment() )
+#else
switch (myTextParams.HAlign)
+#endif
{
case Graphic3d_HTA_LEFT: aCenter.x() = myTextSize.x / 2.f; break;
case Graphic3d_HTA_CENTER: aCenter.x() = 0.f; break;
case Graphic3d_HTA_RIGHT: aCenter.x() = -myTextSize.x / 2.f; break;
default: break;
}
+# if OCC_VERSION_LARGE >= 0x07040000
+ switch ( myTextParams->VerticalAlignment() )
+#else
switch (myTextParams.VAlign)
+#endif
{
case Graphic3d_VTA_TOPFIRSTLINE:
case Graphic3d_VTA_TOP: aCenter.y() = -myTextSize.y / 2.f; break;
#include <NCollection_Handle.hxx>
#include <NCollection_String.hxx>
#include <OpenGl_Element.hxx>
-#include <OpenGl_TextParam.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <TCollection_ExtendedString.hxx>
#include <Basics_OCCTVersion.hxx>
+#if OCC_VERSION_LARGE >= 0x07040000
+#include <Graphic3d_Text.hxx>
+#else
+#include <OpenGl_TextParam.hxx>
+#endif
class OpenGl_GraphicDriver;
class OpenGl_PrimitiveArray;
GEOM_Annotation* myAISObject; //!< Instance of presentation class.
NCollection_String myText; //!< Text string of annotation label.
+#if OCC_VERSION_LARGE >= 0x07040000
+ Handle(Graphic3d_Text) myTextParams; //!< Text draw parameters.
+#else
OpenGl_TextParam myTextParams; //!< Text draw parameters.
+#endif
OpenGl_Text* myTextDraw; //!< Text draw element.
OpenGl_PrimitiveArray* myTextLineDraw; //!< Text underline draw element.
OpenGl_PrimitiveArray* myExtLineDraw; //!< Extension line draw element.