|
|
|
@@ -13,33 +13,28 @@
|
|
|
|
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
|
|
|
// commercial license or contractual agreement.
|
|
|
|
|
|
|
|
|
|
#include <Graphic3d_Structure.hxx>
|
|
|
|
|
|
|
|
|
|
#include <Aspect_PolygonOffsetMode.hxx>
|
|
|
|
|
#include <Bnd_Box.hxx>
|
|
|
|
|
#include <gp_Pnt.hxx>
|
|
|
|
|
#include <Graphic3d_AspectFillArea3d.hxx>
|
|
|
|
|
#include <Graphic3d_AspectLine3d.hxx>
|
|
|
|
|
#include <Graphic3d_AspectMarker3d.hxx>
|
|
|
|
|
#include <Graphic3d_AspectText3d.hxx>
|
|
|
|
|
#include <Graphic3d_DataStructureManager.hxx>
|
|
|
|
|
#include <Graphic3d_GraphicDriver.hxx>
|
|
|
|
|
#include <Graphic3d_Group.hxx>
|
|
|
|
|
#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
|
|
|
|
|
#include <Graphic3d_MapOfStructure.hxx>
|
|
|
|
|
#include <Graphic3d_MaterialAspect.hxx>
|
|
|
|
|
#include <Graphic3d_PriorityDefinitionError.hxx>
|
|
|
|
|
#include <Graphic3d_Structure.hxx>
|
|
|
|
|
#include "Graphic3d_Structure.pxx"
|
|
|
|
|
#include <Graphic3d_StructureDefinitionError.hxx>
|
|
|
|
|
#include <Graphic3d_StructureManager.hxx>
|
|
|
|
|
#include <Graphic3d_TextureMap.hxx>
|
|
|
|
|
#include <Graphic3d_TransformError.hxx>
|
|
|
|
|
#include <Graphic3d_Vector.hxx>
|
|
|
|
|
#include <Quantity_Color.hxx>
|
|
|
|
|
#include <Standard_Type.hxx>
|
|
|
|
|
#include <TColStd_Array2OfReal.hxx>
|
|
|
|
|
|
|
|
|
|
#include "Graphic3d_Structure.pxx"
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Structure,MMgt_TShared)
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
@@ -56,17 +51,6 @@ Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManage
|
|
|
|
|
myVisual (Graphic3d_TOS_ALL)
|
|
|
|
|
{
|
|
|
|
|
myCStructure = theManager->GraphicDriver()->CreateStructure (theManager);
|
|
|
|
|
|
|
|
|
|
// default aspects
|
|
|
|
|
Handle(Graphic3d_AspectLine3d) aAspectLine3d = new Graphic3d_AspectLine3d();
|
|
|
|
|
Handle(Graphic3d_AspectText3d) aAspectText3d = new Graphic3d_AspectText3d();
|
|
|
|
|
Handle(Graphic3d_AspectMarker3d) aAspectMarker3d = new Graphic3d_AspectMarker3d();
|
|
|
|
|
Handle(Graphic3d_AspectFillArea3d) aAspectFillArea3d = new Graphic3d_AspectFillArea3d();
|
|
|
|
|
theManager->PrimitivesAspect (aAspectLine3d, aAspectText3d, aAspectMarker3d, aAspectFillArea3d);
|
|
|
|
|
aAspectFillArea3d->SetPolygonOffsets (Aspect_POM_Fill, 1.0, 0.0);
|
|
|
|
|
|
|
|
|
|
// update the associated CStructure
|
|
|
|
|
UpdateStructure (aAspectLine3d, aAspectText3d, aAspectMarker3d, aAspectFillArea3d);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
@@ -84,17 +68,6 @@ Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManage
|
|
|
|
|
myVisual (thePrs->myVisual)
|
|
|
|
|
{
|
|
|
|
|
myCStructure = thePrs->myCStructure->ShadowLink (theManager);
|
|
|
|
|
|
|
|
|
|
// default aspects
|
|
|
|
|
Handle(Graphic3d_AspectLine3d) aAspectLine3d = new Graphic3d_AspectLine3d();
|
|
|
|
|
Handle(Graphic3d_AspectText3d) aAspectText3d = new Graphic3d_AspectText3d();
|
|
|
|
|
Handle(Graphic3d_AspectMarker3d) aAspectMarker3d = new Graphic3d_AspectMarker3d();
|
|
|
|
|
Handle(Graphic3d_AspectFillArea3d) aAspectFillArea3d = new Graphic3d_AspectFillArea3d();
|
|
|
|
|
theManager->PrimitivesAspect (aAspectLine3d, aAspectText3d, aAspectMarker3d, aAspectFillArea3d);
|
|
|
|
|
aAspectFillArea3d->SetPolygonOffsets (Aspect_POM_Fill, 1.0, 0.0);
|
|
|
|
|
|
|
|
|
|
// update the associated CStructure
|
|
|
|
|
UpdateStructure (aAspectLine3d, aAspectText3d, aAspectMarker3d, aAspectFillArea3d);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
@@ -501,21 +474,6 @@ Standard_Boolean Graphic3d_Structure::IsEmpty() const
|
|
|
|
|
return Standard_True;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : PrimitivesAspect
|
|
|
|
|
//purpose :
|
|
|
|
|
//=============================================================================
|
|
|
|
|
void Graphic3d_Structure::PrimitivesAspect (Handle(Graphic3d_AspectLine3d)& theAspLine,
|
|
|
|
|
Handle(Graphic3d_AspectText3d)& theAspText,
|
|
|
|
|
Handle(Graphic3d_AspectMarker3d)& theAspMarker,
|
|
|
|
|
Handle(Graphic3d_AspectFillArea3d)& theAspFill) const
|
|
|
|
|
{
|
|
|
|
|
theAspLine = Line3dAspect();
|
|
|
|
|
theAspText = Text3dAspect();
|
|
|
|
|
theAspMarker = Marker3dAspect();
|
|
|
|
|
theAspFill = FillArea3dAspect();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : GroupsWithFacet
|
|
|
|
|
//purpose :
|
|
|
|
@@ -664,229 +622,6 @@ void Graphic3d_Structure::GraphicDisconnect (const Handle(Graphic3d_Structure)&
|
|
|
|
|
myCStructure->Disconnect (*theDaughter->myCStructure);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : Line3dAspect
|
|
|
|
|
//purpose :
|
|
|
|
|
//=============================================================================
|
|
|
|
|
Handle(Graphic3d_AspectLine3d) Graphic3d_Structure::Line3dAspect() const
|
|
|
|
|
{
|
|
|
|
|
const Standard_Real anRGB[3] =
|
|
|
|
|
{
|
|
|
|
|
Standard_Real (myCStructure->ContextLine.Color.r),
|
|
|
|
|
Standard_Real (myCStructure->ContextLine.Color.g),
|
|
|
|
|
Standard_Real (myCStructure->ContextLine.Color.b)
|
|
|
|
|
};
|
|
|
|
|
Quantity_Color aColor;
|
|
|
|
|
aColor.SetValues (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
|
|
|
|
|
Aspect_TypeOfLine aLType = Aspect_TypeOfLine (myCStructure->ContextLine.LineType);
|
|
|
|
|
Standard_Real aWidth = Standard_Real (myCStructure->ContextLine.Width);
|
|
|
|
|
|
|
|
|
|
Handle(Graphic3d_AspectLine3d) anAspLine = new Graphic3d_AspectLine3d (aColor, aLType, aWidth);
|
|
|
|
|
anAspLine->SetShaderProgram (myCStructure->ContextLine.ShaderProgram);
|
|
|
|
|
return anAspLine;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : Text3dAspect
|
|
|
|
|
//purpose :
|
|
|
|
|
//=============================================================================
|
|
|
|
|
Handle(Graphic3d_AspectText3d) Graphic3d_Structure::Text3dAspect() const
|
|
|
|
|
{
|
|
|
|
|
const Standard_Real anRGB[3] =
|
|
|
|
|
{
|
|
|
|
|
Standard_Real (myCStructure->ContextText.Color.r),
|
|
|
|
|
Standard_Real (myCStructure->ContextText.Color.g),
|
|
|
|
|
Standard_Real (myCStructure->ContextText.Color.b)
|
|
|
|
|
};
|
|
|
|
|
Quantity_Color aColor;
|
|
|
|
|
aColor.SetValues (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
|
|
|
|
|
Standard_CString aFont = Standard_CString (myCStructure->ContextText.Font);
|
|
|
|
|
Standard_Real anExpansion = Standard_Real (myCStructure->ContextText.Expan);
|
|
|
|
|
Standard_Real aSpace = Standard_Real (myCStructure->ContextText.Space);
|
|
|
|
|
Aspect_TypeOfStyleText aStyle = Aspect_TypeOfStyleText (myCStructure->ContextText.Style);
|
|
|
|
|
Aspect_TypeOfDisplayText aDispType = Aspect_TypeOfDisplayText (myCStructure->ContextText.DisplayType);
|
|
|
|
|
|
|
|
|
|
Handle(Graphic3d_AspectText3d) anAspText = new Graphic3d_AspectText3d (aColor, aFont, anExpansion, aSpace, aStyle, aDispType);
|
|
|
|
|
anAspText->SetShaderProgram (myCStructure->ContextText.ShaderProgram);
|
|
|
|
|
return anAspText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : Marker3dAspect
|
|
|
|
|
//purpose :
|
|
|
|
|
//=============================================================================
|
|
|
|
|
Handle(Graphic3d_AspectMarker3d) Graphic3d_Structure::Marker3dAspect() const
|
|
|
|
|
{
|
|
|
|
|
const Standard_Real anRGB[3] =
|
|
|
|
|
{
|
|
|
|
|
Standard_Real (myCStructure->ContextMarker.Color.r),
|
|
|
|
|
Standard_Real (myCStructure->ContextMarker.Color.g),
|
|
|
|
|
Standard_Real (myCStructure->ContextMarker.Color.b)
|
|
|
|
|
};
|
|
|
|
|
Quantity_Color aColor;
|
|
|
|
|
aColor.SetValues (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
|
|
|
|
|
Aspect_TypeOfMarker aMType = myCStructure->ContextMarker.MarkerType;
|
|
|
|
|
Standard_Real aScale = Standard_Real (myCStructure->ContextMarker.Scale);
|
|
|
|
|
|
|
|
|
|
Handle(Graphic3d_AspectMarker3d) anAspMarker = new Graphic3d_AspectMarker3d (aMType, aColor, aScale);
|
|
|
|
|
anAspMarker->SetShaderProgram (myCStructure->ContextMarker.ShaderProgram);
|
|
|
|
|
return anAspMarker;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : FillArea3dAspect
|
|
|
|
|
//purpose :
|
|
|
|
|
//=============================================================================
|
|
|
|
|
Handle(Graphic3d_AspectFillArea3d) Graphic3d_Structure::FillArea3dAspect() const
|
|
|
|
|
{
|
|
|
|
|
// Back Material
|
|
|
|
|
Graphic3d_MaterialAspect aBack;
|
|
|
|
|
aBack.SetShininess (Standard_Real (myCStructure->ContextFillArea.Back.Shininess));
|
|
|
|
|
aBack.SetAmbient (Standard_Real (myCStructure->ContextFillArea.Back.Ambient));
|
|
|
|
|
aBack.SetDiffuse (Standard_Real (myCStructure->ContextFillArea.Back.Diffuse));
|
|
|
|
|
aBack.SetSpecular (Standard_Real (myCStructure->ContextFillArea.Back.Specular));
|
|
|
|
|
aBack.SetTransparency (Standard_Real (myCStructure->ContextFillArea.Back.Transparency));
|
|
|
|
|
aBack.SetEmissive (Standard_Real (myCStructure->ContextFillArea.Back.Emission));
|
|
|
|
|
if (myCStructure->ContextFillArea.Back.IsAmbient == 1)
|
|
|
|
|
aBack.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
|
|
|
|
|
else
|
|
|
|
|
aBack.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
|
|
|
|
|
if (myCStructure->ContextFillArea.Back.IsDiffuse == 1)
|
|
|
|
|
aBack.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
|
|
|
|
|
else
|
|
|
|
|
aBack.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
|
|
|
|
|
if (myCStructure->ContextFillArea.Back.IsSpecular == 1)
|
|
|
|
|
aBack.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
|
|
|
|
|
else
|
|
|
|
|
aBack.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
|
|
|
|
|
if (myCStructure->ContextFillArea.Back.IsEmission == 1)
|
|
|
|
|
aBack.SetReflectionModeOn (Graphic3d_TOR_EMISSION);
|
|
|
|
|
else
|
|
|
|
|
aBack.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
|
|
|
|
|
|
|
|
|
|
Quantity_Color aColor (Standard_Real (myCStructure->ContextFillArea.Back.ColorSpec.r),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Back.ColorSpec.g),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Back.ColorSpec.b), Quantity_TOC_RGB);
|
|
|
|
|
aBack.SetSpecularColor (aColor);
|
|
|
|
|
|
|
|
|
|
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Back.ColorAmb.r),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Back.ColorAmb.g),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Back.ColorAmb.b), Quantity_TOC_RGB);
|
|
|
|
|
aBack.SetAmbientColor (aColor);
|
|
|
|
|
|
|
|
|
|
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Back.ColorDif.r),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Back.ColorDif.g),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Back.ColorDif.b), Quantity_TOC_RGB);
|
|
|
|
|
aBack.SetDiffuseColor (aColor);
|
|
|
|
|
|
|
|
|
|
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Back.ColorEms.r),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Back.ColorEms.g),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Back.ColorEms.b), Quantity_TOC_RGB);
|
|
|
|
|
aBack.SetEmissiveColor (aColor);
|
|
|
|
|
|
|
|
|
|
aBack.SetEnvReflexion (myCStructure->ContextFillArea.Back.EnvReflexion);
|
|
|
|
|
aBack.SetMaterialType (myCStructure->ContextFillArea.Back.IsPhysic ? Graphic3d_MATERIAL_PHYSIC : Graphic3d_MATERIAL_ASPECT);
|
|
|
|
|
|
|
|
|
|
aBack.SetRefractionIndex (Standard_Real (myCStructure->ContextFillArea.Back.RefractionIndex));
|
|
|
|
|
aBack.SetBSDF (myCStructure->ContextFillArea.Back.BSDF);
|
|
|
|
|
|
|
|
|
|
// Front Material
|
|
|
|
|
Graphic3d_MaterialAspect aFront;
|
|
|
|
|
aFront.SetShininess (Standard_Real (myCStructure->ContextFillArea.Front.Shininess));
|
|
|
|
|
aFront.SetAmbient (Standard_Real (myCStructure->ContextFillArea.Front.Ambient));
|
|
|
|
|
aFront.SetDiffuse (Standard_Real (myCStructure->ContextFillArea.Front.Diffuse));
|
|
|
|
|
aFront.SetSpecular (Standard_Real (myCStructure->ContextFillArea.Front.Specular));
|
|
|
|
|
aFront.SetTransparency (Standard_Real (myCStructure->ContextFillArea.Front.Transparency));
|
|
|
|
|
aFront.SetEmissive (Standard_Real (myCStructure->ContextFillArea.Front.Emission));
|
|
|
|
|
if (myCStructure->ContextFillArea.Front.IsAmbient == 1)
|
|
|
|
|
aFront.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
|
|
|
|
|
else
|
|
|
|
|
aFront.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
|
|
|
|
|
if (myCStructure->ContextFillArea.Front.IsDiffuse == 1)
|
|
|
|
|
aFront.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
|
|
|
|
|
else
|
|
|
|
|
aFront.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
|
|
|
|
|
if (myCStructure->ContextFillArea.Front.IsSpecular == 1)
|
|
|
|
|
aFront.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
|
|
|
|
|
else
|
|
|
|
|
aFront.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
|
|
|
|
|
if (myCStructure->ContextFillArea.Front.Emission == 1)
|
|
|
|
|
aFront.SetReflectionModeOn (Graphic3d_TOR_EMISSION);
|
|
|
|
|
else
|
|
|
|
|
aFront.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
|
|
|
|
|
|
|
|
|
|
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Front.ColorSpec.r),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Front.ColorSpec.g),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Front.ColorSpec.b), Quantity_TOC_RGB);
|
|
|
|
|
aFront.SetSpecularColor (aColor);
|
|
|
|
|
|
|
|
|
|
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Front.ColorAmb.r),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Front.ColorAmb.g),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Front.ColorAmb.b), Quantity_TOC_RGB);
|
|
|
|
|
aFront.SetAmbientColor (aColor);
|
|
|
|
|
|
|
|
|
|
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Front.ColorDif.r),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Front.ColorDif.g),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Front.ColorDif.b), Quantity_TOC_RGB);
|
|
|
|
|
aFront.SetDiffuseColor (aColor);
|
|
|
|
|
|
|
|
|
|
aColor.SetValues (Standard_Real (myCStructure->ContextFillArea.Front.ColorEms.r),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Front.ColorEms.g),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Front.ColorEms.b), Quantity_TOC_RGB);
|
|
|
|
|
aFront.SetEmissiveColor (aColor);
|
|
|
|
|
|
|
|
|
|
aFront.SetEnvReflexion (myCStructure->ContextFillArea.Front.EnvReflexion);
|
|
|
|
|
aFront.SetMaterialType (myCStructure->ContextFillArea.Front.IsPhysic ? Graphic3d_MATERIAL_PHYSIC : Graphic3d_MATERIAL_ASPECT);
|
|
|
|
|
|
|
|
|
|
aFront.SetRefractionIndex (Standard_Real (myCStructure->ContextFillArea.Front.RefractionIndex));
|
|
|
|
|
aFront.SetBSDF (myCStructure->ContextFillArea.Front.BSDF);
|
|
|
|
|
|
|
|
|
|
Quantity_Color anIntColor (Standard_Real (myCStructure->ContextFillArea.IntColor.r),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.IntColor.g),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.IntColor.b), Quantity_TOC_RGB);
|
|
|
|
|
Quantity_Color anEdgeColor (Standard_Real (myCStructure->ContextFillArea.EdgeColor.r),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.EdgeColor.g),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.EdgeColor.b), Quantity_TOC_RGB);
|
|
|
|
|
Handle(Graphic3d_AspectFillArea3d) anAspFill = new Graphic3d_AspectFillArea3d (Aspect_InteriorStyle (myCStructure->ContextFillArea.Style),
|
|
|
|
|
anIntColor, anEdgeColor,
|
|
|
|
|
Aspect_TypeOfLine (myCStructure->ContextFillArea.LineType),
|
|
|
|
|
Standard_Real (myCStructure->ContextFillArea.Width),
|
|
|
|
|
aFront, aBack);
|
|
|
|
|
|
|
|
|
|
// Edges
|
|
|
|
|
if (myCStructure->ContextFillArea.Edge == 1)
|
|
|
|
|
anAspFill->SetEdgeOn();
|
|
|
|
|
else
|
|
|
|
|
anAspFill->SetEdgeOff();
|
|
|
|
|
// Hatch
|
|
|
|
|
anAspFill->SetHatchStyle (Aspect_HatchStyle (myCStructure->ContextFillArea.Hatch));
|
|
|
|
|
// Materials
|
|
|
|
|
// Front and Back face
|
|
|
|
|
if (myCStructure->ContextFillArea.Distinguish == 1)
|
|
|
|
|
anAspFill->SetDistinguishOn();
|
|
|
|
|
else
|
|
|
|
|
anAspFill->SetDistinguishOff();
|
|
|
|
|
if (myCStructure->ContextFillArea.BackFace == 1)
|
|
|
|
|
anAspFill->SuppressBackFace();
|
|
|
|
|
else
|
|
|
|
|
anAspFill->AllowBackFace();
|
|
|
|
|
// Texture
|
|
|
|
|
anAspFill->SetTextureMap (myCStructure->ContextFillArea.Texture.TextureMap);
|
|
|
|
|
if (myCStructure->ContextFillArea.Texture.doTextureMap == 1)
|
|
|
|
|
{
|
|
|
|
|
anAspFill->SetTextureMapOn();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
anAspFill->SetTextureMapOff();
|
|
|
|
|
}
|
|
|
|
|
anAspFill->SetShaderProgram (myCStructure->ContextFillArea.ShaderProgram);
|
|
|
|
|
anAspFill->SetPolygonOffsets (myCStructure->ContextFillArea.PolygonOffsetMode,
|
|
|
|
|
myCStructure->ContextFillArea.PolygonOffsetFactor,
|
|
|
|
|
myCStructure->ContextFillArea.PolygonOffsetUnits);
|
|
|
|
|
return anAspFill;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : Groups
|
|
|
|
|
//purpose :
|
|
|
|
@@ -905,273 +640,6 @@ Standard_Integer Graphic3d_Structure::NumberOfGroups() const
|
|
|
|
|
return myCStructure->Groups().Length();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : SetPrimitivesAspect
|
|
|
|
|
//purpose :
|
|
|
|
|
//=============================================================================
|
|
|
|
|
void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& theAspLine)
|
|
|
|
|
{
|
|
|
|
|
if (IsDeleted()) return;
|
|
|
|
|
|
|
|
|
|
Standard_Real aWidth;
|
|
|
|
|
Quantity_Color aColor;
|
|
|
|
|
Aspect_TypeOfLine aLType;
|
|
|
|
|
theAspLine->Values (aColor, aLType, aWidth);
|
|
|
|
|
|
|
|
|
|
myCStructure->ContextLine.Color.r = float (aColor.Red());
|
|
|
|
|
myCStructure->ContextLine.Color.g = float (aColor.Green());
|
|
|
|
|
myCStructure->ContextLine.Color.b = float (aColor.Blue());
|
|
|
|
|
myCStructure->ContextLine.LineType = int (aLType);
|
|
|
|
|
myCStructure->ContextLine.Width = float (aWidth);
|
|
|
|
|
myCStructure->ContextLine.ShaderProgram = theAspLine->ShaderProgram();
|
|
|
|
|
myCStructure->ContextLine.IsDef = 1;
|
|
|
|
|
|
|
|
|
|
myCStructure->UpdateAspects();
|
|
|
|
|
|
|
|
|
|
// Attributes are "IsSet" during the first update of context (line, marker...)
|
|
|
|
|
myCStructure->ContextLine.IsSet = 1;
|
|
|
|
|
myCStructure->ContextFillArea.IsSet = 1;
|
|
|
|
|
myCStructure->ContextMarker.IsSet = 1;
|
|
|
|
|
myCStructure->ContextText.IsSet = 1;
|
|
|
|
|
|
|
|
|
|
Update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : SetPrimitivesAspect
|
|
|
|
|
//purpose :
|
|
|
|
|
//=============================================================================
|
|
|
|
|
void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspFill)
|
|
|
|
|
{
|
|
|
|
|
if (IsDeleted()) return;
|
|
|
|
|
|
|
|
|
|
Standard_Real anRGB[3];
|
|
|
|
|
Standard_Real aWidth;
|
|
|
|
|
Quantity_Color anIntColor;
|
|
|
|
|
Quantity_Color aBackIntColor;
|
|
|
|
|
Quantity_Color anEdgeColor;
|
|
|
|
|
Aspect_TypeOfLine aLType;
|
|
|
|
|
Aspect_InteriorStyle aStyle;
|
|
|
|
|
theAspFill->Values (aStyle, anIntColor, aBackIntColor, anEdgeColor, aLType, aWidth);
|
|
|
|
|
|
|
|
|
|
anIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
|
|
|
|
|
myCStructure->ContextFillArea.Style = aStyle;
|
|
|
|
|
myCStructure->ContextFillArea.IntColor.r = float (anRGB[0]);
|
|
|
|
|
myCStructure->ContextFillArea.IntColor.g = float (anRGB[1]);
|
|
|
|
|
myCStructure->ContextFillArea.IntColor.b = float (anRGB[2]);
|
|
|
|
|
|
|
|
|
|
if (theAspFill->Distinguish())
|
|
|
|
|
{
|
|
|
|
|
aBackIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
|
|
|
|
|
}
|
|
|
|
|
myCStructure->ContextFillArea.BackIntColor.r = float(anRGB[0]);
|
|
|
|
|
myCStructure->ContextFillArea.BackIntColor.g = float(anRGB[1]);
|
|
|
|
|
myCStructure->ContextFillArea.BackIntColor.b = float(anRGB[2]);
|
|
|
|
|
|
|
|
|
|
// Edges
|
|
|
|
|
myCStructure->ContextFillArea.Edge = theAspFill->Edge () ? 1 : 0;
|
|
|
|
|
myCStructure->ContextFillArea.EdgeColor.r = float (anEdgeColor.Red());
|
|
|
|
|
myCStructure->ContextFillArea.EdgeColor.g = float (anEdgeColor.Green());
|
|
|
|
|
myCStructure->ContextFillArea.EdgeColor.b = float (anEdgeColor.Blue());
|
|
|
|
|
myCStructure->ContextFillArea.LineType = aLType;
|
|
|
|
|
myCStructure->ContextFillArea.Width = float (aWidth);
|
|
|
|
|
myCStructure->ContextFillArea.Hatch = theAspFill->HatchStyle();
|
|
|
|
|
|
|
|
|
|
// Front and Back face
|
|
|
|
|
myCStructure->ContextFillArea.Distinguish = theAspFill->Distinguish() ? 1 : 0;
|
|
|
|
|
myCStructure->ContextFillArea.BackFace = theAspFill->BackFace() ? 1 : 0;
|
|
|
|
|
|
|
|
|
|
// Back Material
|
|
|
|
|
const Graphic3d_MaterialAspect& aBack = theAspFill->BackMaterial();
|
|
|
|
|
// Light specificity
|
|
|
|
|
myCStructure->ContextFillArea.Back.Shininess = float (aBack.Shininess());
|
|
|
|
|
myCStructure->ContextFillArea.Back.Ambient = float (aBack.Ambient());
|
|
|
|
|
myCStructure->ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
|
|
|
|
|
myCStructure->ContextFillArea.Back.Specular = float (aBack.Specular());
|
|
|
|
|
myCStructure->ContextFillArea.Back.Transparency = float (aBack.Transparency());
|
|
|
|
|
myCStructure->ContextFillArea.Back.RefractionIndex = float (aBack.RefractionIndex());
|
|
|
|
|
myCStructure->ContextFillArea.Back.BSDF = aBack.BSDF();
|
|
|
|
|
myCStructure->ContextFillArea.Back.Emission = float (aBack.Emissive());
|
|
|
|
|
|
|
|
|
|
// Reflection mode
|
|
|
|
|
myCStructure->ContextFillArea.Back.IsAmbient = (aBack.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0);
|
|
|
|
|
myCStructure->ContextFillArea.Back.IsDiffuse = (aBack.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0);
|
|
|
|
|
myCStructure->ContextFillArea.Back.IsSpecular = (aBack.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0);
|
|
|
|
|
myCStructure->ContextFillArea.Back.IsEmission = (aBack.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0);
|
|
|
|
|
|
|
|
|
|
// Material type
|
|
|
|
|
//JR/Hp
|
|
|
|
|
myCStructure->ContextFillArea.Back.IsPhysic = (aBack.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0 );
|
|
|
|
|
|
|
|
|
|
// Specular Color
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorSpec.r = float (aBack.SpecularColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorSpec.g = float (aBack.SpecularColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorSpec.b = float (aBack.SpecularColor().Blue());
|
|
|
|
|
|
|
|
|
|
// Ambient color
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorAmb.r = float (aBack.AmbientColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorAmb.g = float (aBack.AmbientColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorAmb.b = float (aBack.AmbientColor().Blue());
|
|
|
|
|
|
|
|
|
|
// Diffuse color
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorDif.r = float (aBack.DiffuseColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorDif.g = float (aBack.DiffuseColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorDif.b = float (aBack.DiffuseColor().Blue());
|
|
|
|
|
|
|
|
|
|
// Emissive color
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorEms.r = float (aBack.EmissiveColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorEms.g = float (aBack.EmissiveColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorEms.b = float (aBack.EmissiveColor().Blue());
|
|
|
|
|
|
|
|
|
|
myCStructure->ContextFillArea.Back.EnvReflexion =
|
|
|
|
|
float ((theAspFill->BackMaterial ()).EnvReflexion());
|
|
|
|
|
|
|
|
|
|
// Front Material
|
|
|
|
|
const Graphic3d_MaterialAspect& aFront = theAspFill->FrontMaterial();
|
|
|
|
|
// Light specificity
|
|
|
|
|
myCStructure->ContextFillArea.Front.Shininess = float (aFront.Shininess());
|
|
|
|
|
myCStructure->ContextFillArea.Front.Ambient = float (aFront.Ambient());
|
|
|
|
|
myCStructure->ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
|
|
|
|
|
myCStructure->ContextFillArea.Front.Specular = float (aFront.Specular());
|
|
|
|
|
myCStructure->ContextFillArea.Front.Transparency = float (aFront.Transparency());
|
|
|
|
|
myCStructure->ContextFillArea.Front.RefractionIndex = float (aFront.RefractionIndex());
|
|
|
|
|
myCStructure->ContextFillArea.Front.BSDF = aFront.BSDF();
|
|
|
|
|
myCStructure->ContextFillArea.Front.Emission = float (aFront.Emissive());
|
|
|
|
|
|
|
|
|
|
// Reflection mode
|
|
|
|
|
myCStructure->ContextFillArea.Front.IsAmbient = (aFront.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0);
|
|
|
|
|
myCStructure->ContextFillArea.Front.IsDiffuse = (aFront.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0);
|
|
|
|
|
myCStructure->ContextFillArea.Front.IsSpecular = (aFront.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0);
|
|
|
|
|
myCStructure->ContextFillArea.Front.IsEmission = (aFront.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0);
|
|
|
|
|
|
|
|
|
|
// Materail type
|
|
|
|
|
//JR/Hp
|
|
|
|
|
myCStructure->ContextFillArea.Front.IsPhysic = (aFront.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0);
|
|
|
|
|
|
|
|
|
|
// Specular Color
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorSpec.r = float (aFront.SpecularColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorSpec.g = float (aFront.SpecularColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorSpec.b = float (aFront.SpecularColor().Blue());
|
|
|
|
|
|
|
|
|
|
// Ambient color
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorAmb.r = float (aFront.AmbientColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorAmb.g = float (aFront.AmbientColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorAmb.b = float (aFront.AmbientColor().Blue());
|
|
|
|
|
|
|
|
|
|
// Diffuse color
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorDif.r = float (aFront.DiffuseColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorDif.g = float (aFront.DiffuseColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorDif.b = float (aFront.DiffuseColor().Blue());
|
|
|
|
|
|
|
|
|
|
// Emissive color
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorEms.r = float (aFront.EmissiveColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorEms.g = float (aFront.EmissiveColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorEms.b = float (aFront.EmissiveColor().Blue());
|
|
|
|
|
|
|
|
|
|
myCStructure->ContextFillArea.Front.EnvReflexion = float (aFront.EnvReflexion());
|
|
|
|
|
|
|
|
|
|
myCStructure->ContextFillArea.IsDef = 1; // Definition material ok
|
|
|
|
|
|
|
|
|
|
myCStructure->ContextFillArea.Texture.TextureMap = theAspFill->TextureMap();
|
|
|
|
|
myCStructure->ContextFillArea.Texture.doTextureMap = theAspFill->TextureMapState() ? 1 : 0;
|
|
|
|
|
myCStructure->ContextFillArea.ShaderProgram = theAspFill->ShaderProgram();
|
|
|
|
|
|
|
|
|
|
Standard_Integer aPolyMode;
|
|
|
|
|
Standard_ShortReal aPolyFactor, aPolyUnits;
|
|
|
|
|
theAspFill->PolygonOffsets (aPolyMode, aPolyFactor, aPolyUnits);
|
|
|
|
|
myCStructure->ContextFillArea.PolygonOffsetMode = aPolyMode;
|
|
|
|
|
myCStructure->ContextFillArea.PolygonOffsetFactor = aPolyFactor;
|
|
|
|
|
myCStructure->ContextFillArea.PolygonOffsetUnits = aPolyUnits;
|
|
|
|
|
|
|
|
|
|
myCStructure->UpdateAspects();
|
|
|
|
|
|
|
|
|
|
// Attributes are "IsSet" during the first update of context (line, marker...)
|
|
|
|
|
myCStructure->ContextLine.IsSet = 1;
|
|
|
|
|
myCStructure->ContextFillArea.IsSet = 1;
|
|
|
|
|
myCStructure->ContextMarker.IsSet = 1;
|
|
|
|
|
myCStructure->ContextText.IsSet = 1;
|
|
|
|
|
|
|
|
|
|
Update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : SetPrimitivesAspect
|
|
|
|
|
//purpose :
|
|
|
|
|
//=============================================================================
|
|
|
|
|
void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& theAspText)
|
|
|
|
|
{
|
|
|
|
|
if (IsDeleted()) return;
|
|
|
|
|
|
|
|
|
|
Standard_CString aFont;
|
|
|
|
|
Standard_Real aSpace, anExpansion, aTextAngle;
|
|
|
|
|
Quantity_Color aColor, aColorSub;
|
|
|
|
|
Aspect_TypeOfStyleText aStyle;
|
|
|
|
|
Aspect_TypeOfDisplayText aDispType;
|
|
|
|
|
Standard_Boolean isTextZoomable;
|
|
|
|
|
Font_FontAspect aTextFontAspect;
|
|
|
|
|
theAspText->Values (aColor, aFont, anExpansion, aSpace, aStyle, aDispType, aColorSub, isTextZoomable, aTextAngle, aTextFontAspect);
|
|
|
|
|
|
|
|
|
|
myCStructure->ContextText.Color.r = float (aColor.Red());
|
|
|
|
|
myCStructure->ContextText.Color.g = float (aColor.Green());
|
|
|
|
|
myCStructure->ContextText.Color.b = float (aColor.Blue());
|
|
|
|
|
myCStructure->ContextText.Font = aFont;
|
|
|
|
|
myCStructure->ContextText.Expan = float (anExpansion);
|
|
|
|
|
myCStructure->ContextText.Space = float (aSpace);
|
|
|
|
|
myCStructure->ContextText.Style = aStyle;
|
|
|
|
|
myCStructure->ContextText.DisplayType = aDispType;
|
|
|
|
|
myCStructure->ContextText.ColorSubTitle.r = float (aColorSub.Red());
|
|
|
|
|
myCStructure->ContextText.ColorSubTitle.g = float (aColorSub.Green());
|
|
|
|
|
myCStructure->ContextText.ColorSubTitle.b = float (aColorSub.Blue());
|
|
|
|
|
myCStructure->ContextText.TextZoomable = isTextZoomable;
|
|
|
|
|
myCStructure->ContextText.TextAngle = float (aTextAngle);
|
|
|
|
|
myCStructure->ContextText.TextFontAspect = aTextFontAspect;
|
|
|
|
|
myCStructure->ContextText.ShaderProgram = theAspText->ShaderProgram();
|
|
|
|
|
|
|
|
|
|
myCStructure->ContextText.IsDef = 1;
|
|
|
|
|
|
|
|
|
|
myCStructure->UpdateAspects();
|
|
|
|
|
|
|
|
|
|
// Attributes are "IsSet" during the first update of a context (line, marker...)
|
|
|
|
|
myCStructure->ContextLine.IsSet = 1;
|
|
|
|
|
myCStructure->ContextFillArea.IsSet = 1;
|
|
|
|
|
myCStructure->ContextMarker.IsSet = 1;
|
|
|
|
|
myCStructure->ContextText.IsSet = 1;
|
|
|
|
|
|
|
|
|
|
Update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : SetPrimitivesAspect
|
|
|
|
|
//purpose :
|
|
|
|
|
//=============================================================================
|
|
|
|
|
void Graphic3d_Structure::SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& theAspMarker)
|
|
|
|
|
{
|
|
|
|
|
if (IsDeleted()) return;
|
|
|
|
|
|
|
|
|
|
Standard_Real aScale;
|
|
|
|
|
Quantity_Color aColor;
|
|
|
|
|
Aspect_TypeOfMarker aMType;
|
|
|
|
|
theAspMarker->Values (aColor, aMType, aScale);
|
|
|
|
|
|
|
|
|
|
myCStructure->ContextMarker.Color.r = float (aColor.Red());
|
|
|
|
|
myCStructure->ContextMarker.Color.g = float (aColor.Green());
|
|
|
|
|
myCStructure->ContextMarker.Color.b = float (aColor.Blue());
|
|
|
|
|
myCStructure->ContextMarker.MarkerType = aMType;
|
|
|
|
|
myCStructure->ContextMarker.Scale = float (aScale);
|
|
|
|
|
myCStructure->ContextMarker.ShaderProgram = theAspMarker->ShaderProgram();
|
|
|
|
|
myCStructure->ContextMarker.IsDef = 1;
|
|
|
|
|
|
|
|
|
|
myCStructure->UpdateAspects();
|
|
|
|
|
|
|
|
|
|
// Attributes are "IsSet" during the first update of a context (line, marker...)
|
|
|
|
|
myCStructure->ContextLine.IsSet = 1;
|
|
|
|
|
myCStructure->ContextFillArea.IsSet = 1;
|
|
|
|
|
myCStructure->ContextMarker.IsSet = 1;
|
|
|
|
|
myCStructure->ContextText.IsSet = 1;
|
|
|
|
|
|
|
|
|
|
Update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : SetVisual
|
|
|
|
|
//purpose :
|
|
|
|
@@ -1997,182 +1465,6 @@ void Graphic3d_Structure::Update (const bool theUpdateLayer) const
|
|
|
|
|
theUpdateLayer ? myCStructure->ZLayer() : Graphic3d_ZLayerId_UNKNOWN);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : UpdateStructure
|
|
|
|
|
//purpose :
|
|
|
|
|
//=============================================================================
|
|
|
|
|
void Graphic3d_Structure::UpdateStructure (const Handle(Graphic3d_AspectLine3d)& theAspLine,
|
|
|
|
|
const Handle(Graphic3d_AspectText3d)& theAspText,
|
|
|
|
|
const Handle(Graphic3d_AspectMarker3d)& theAspMarker,
|
|
|
|
|
const Handle(Graphic3d_AspectFillArea3d)& theAspFill)
|
|
|
|
|
{
|
|
|
|
|
Standard_CString aFont;
|
|
|
|
|
Standard_Real aSpace, anExpansion, aWidth, aScale;
|
|
|
|
|
Quantity_Color aColor, anIntColor, aBackIntColor, anEdgeColor, aColorSub;
|
|
|
|
|
Aspect_TypeOfLine aLType;
|
|
|
|
|
Aspect_TypeOfMarker aMType;
|
|
|
|
|
Aspect_InteriorStyle aStyle;
|
|
|
|
|
Aspect_TypeOfStyleText aStyleT;
|
|
|
|
|
Aspect_TypeOfDisplayText aDisplayType;
|
|
|
|
|
Standard_Boolean aTextZoomable;
|
|
|
|
|
Standard_Real aTextAngle;
|
|
|
|
|
Font_FontAspect aTextFontAspect;
|
|
|
|
|
|
|
|
|
|
theAspLine->Values (aColor, aLType, aWidth);
|
|
|
|
|
myCStructure->ContextLine.Color.r = float (aColor.Red());
|
|
|
|
|
myCStructure->ContextLine.Color.g = float (aColor.Green());
|
|
|
|
|
myCStructure->ContextLine.Color.b = float (aColor.Blue());
|
|
|
|
|
myCStructure->ContextLine.LineType = aLType;
|
|
|
|
|
myCStructure->ContextLine.Width = float (aWidth);
|
|
|
|
|
myCStructure->ContextLine.ShaderProgram = theAspLine->ShaderProgram();
|
|
|
|
|
|
|
|
|
|
theAspMarker->Values (aColor, aMType, aScale);
|
|
|
|
|
myCStructure->ContextMarker.Color.r = float (aColor.Red());
|
|
|
|
|
myCStructure->ContextMarker.Color.g = float (aColor.Green());
|
|
|
|
|
myCStructure->ContextMarker.Color.b = float (aColor.Blue());
|
|
|
|
|
myCStructure->ContextMarker.MarkerType = aMType;
|
|
|
|
|
myCStructure->ContextMarker.Scale = float (aScale);
|
|
|
|
|
myCStructure->ContextMarker.ShaderProgram = theAspMarker->ShaderProgram();
|
|
|
|
|
|
|
|
|
|
theAspText->Values (aColor, aFont, anExpansion, aSpace, aStyleT, aDisplayType, aColorSub, aTextZoomable, aTextAngle, aTextFontAspect);
|
|
|
|
|
myCStructure->ContextText.Color.r = float (aColor.Red());
|
|
|
|
|
myCStructure->ContextText.Color.g = float (aColor.Green());
|
|
|
|
|
myCStructure->ContextText.Color.b = float (aColor.Blue());
|
|
|
|
|
myCStructure->ContextText.Font = aFont;
|
|
|
|
|
myCStructure->ContextText.Expan = float (anExpansion);
|
|
|
|
|
myCStructure->ContextText.Style = aStyleT;
|
|
|
|
|
myCStructure->ContextText.DisplayType = aDisplayType;
|
|
|
|
|
myCStructure->ContextText.Space = float (aSpace);
|
|
|
|
|
myCStructure->ContextText.ColorSubTitle.r = float (aColorSub.Red());
|
|
|
|
|
myCStructure->ContextText.ColorSubTitle.g = float (aColorSub.Green());
|
|
|
|
|
myCStructure->ContextText.ColorSubTitle.b = float (aColorSub.Blue());
|
|
|
|
|
myCStructure->ContextText.TextZoomable = aTextZoomable;
|
|
|
|
|
myCStructure->ContextText.TextAngle = float (aTextAngle);
|
|
|
|
|
myCStructure->ContextText.TextFontAspect = aTextFontAspect;
|
|
|
|
|
myCStructure->ContextText.ShaderProgram = theAspText->ShaderProgram();
|
|
|
|
|
|
|
|
|
|
Standard_Real anRGB[3];
|
|
|
|
|
theAspFill->Values (aStyle, anIntColor, aBackIntColor, anEdgeColor, aLType, aWidth);
|
|
|
|
|
anIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
|
|
|
|
|
myCStructure->ContextFillArea.Style = aStyle;
|
|
|
|
|
myCStructure->ContextFillArea.IntColor.r = float (anRGB[0]);
|
|
|
|
|
myCStructure->ContextFillArea.IntColor.g = float (anRGB[1]);
|
|
|
|
|
myCStructure->ContextFillArea.IntColor.b = float (anRGB[2]);
|
|
|
|
|
|
|
|
|
|
if (theAspFill->Distinguish())
|
|
|
|
|
{
|
|
|
|
|
aBackIntColor.Values (anRGB[0], anRGB[1], anRGB[2], Quantity_TOC_RGB);
|
|
|
|
|
}
|
|
|
|
|
myCStructure->ContextFillArea.BackIntColor.r = float (anRGB[0]);
|
|
|
|
|
myCStructure->ContextFillArea.BackIntColor.g = float (anRGB[1]);
|
|
|
|
|
myCStructure->ContextFillArea.BackIntColor.b = float (anRGB[2]);
|
|
|
|
|
|
|
|
|
|
// Edges
|
|
|
|
|
myCStructure->ContextFillArea.Edge = theAspFill->Edge () ? 1:0;
|
|
|
|
|
myCStructure->ContextFillArea.EdgeColor.r = float (anEdgeColor.Red());
|
|
|
|
|
myCStructure->ContextFillArea.EdgeColor.g = float (anEdgeColor.Green());
|
|
|
|
|
myCStructure->ContextFillArea.EdgeColor.b = float (anEdgeColor.Blue());
|
|
|
|
|
myCStructure->ContextFillArea.LineType = aLType;
|
|
|
|
|
myCStructure->ContextFillArea.Width = float (aWidth);
|
|
|
|
|
myCStructure->ContextFillArea.Hatch = theAspFill->HatchStyle();
|
|
|
|
|
|
|
|
|
|
// Front and Back face
|
|
|
|
|
myCStructure->ContextFillArea.Distinguish = theAspFill->Distinguish() ? 1 : 0;
|
|
|
|
|
myCStructure->ContextFillArea.BackFace = theAspFill->BackFace() ? 1 : 0;
|
|
|
|
|
// Back Material
|
|
|
|
|
const Graphic3d_MaterialAspect& aBack = theAspFill->BackMaterial();
|
|
|
|
|
// Light specificity
|
|
|
|
|
myCStructure->ContextFillArea.Back.Shininess = float (aBack.Shininess());
|
|
|
|
|
myCStructure->ContextFillArea.Back.Ambient = float (aBack.Ambient());
|
|
|
|
|
myCStructure->ContextFillArea.Back.Diffuse = float (aBack.Diffuse());
|
|
|
|
|
myCStructure->ContextFillArea.Back.Specular = float (aBack.Specular());
|
|
|
|
|
myCStructure->ContextFillArea.Back.Transparency = float (aBack.Transparency());
|
|
|
|
|
myCStructure->ContextFillArea.Back.Emission = float (aBack.Emissive());
|
|
|
|
|
|
|
|
|
|
// Reflection mode
|
|
|
|
|
myCStructure->ContextFillArea.Back.IsAmbient = (aBack.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0);
|
|
|
|
|
myCStructure->ContextFillArea.Back.IsDiffuse = (aBack.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0);
|
|
|
|
|
myCStructure->ContextFillArea.Back.IsSpecular = (aBack.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0);
|
|
|
|
|
myCStructure->ContextFillArea.Back.IsEmission = (aBack.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0);
|
|
|
|
|
|
|
|
|
|
// Material type
|
|
|
|
|
myCStructure->ContextFillArea.Back.IsPhysic = (aBack.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0);
|
|
|
|
|
|
|
|
|
|
// Specular color
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorSpec.r = float (aBack.SpecularColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorSpec.g = float (aBack.SpecularColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorSpec.b = float (aBack.SpecularColor().Blue());
|
|
|
|
|
|
|
|
|
|
// Ambient color
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorAmb.r = float (aBack.AmbientColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorAmb.g = float (aBack.AmbientColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorAmb.b = float (aBack.AmbientColor().Blue());
|
|
|
|
|
|
|
|
|
|
// Diffuse color
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorDif.r = float (aBack.DiffuseColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorDif.g = float (aBack.DiffuseColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorDif.b = float (aBack.DiffuseColor().Blue());
|
|
|
|
|
|
|
|
|
|
// Emissive color
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorEms.r = float (aBack.EmissiveColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorEms.g = float (aBack.EmissiveColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Back.ColorEms.b = float (aBack.EmissiveColor().Blue());
|
|
|
|
|
|
|
|
|
|
myCStructure->ContextFillArea.Back.EnvReflexion = float (aBack.EnvReflexion());
|
|
|
|
|
|
|
|
|
|
// Front Material
|
|
|
|
|
const Graphic3d_MaterialAspect& aFront = theAspFill->FrontMaterial();
|
|
|
|
|
// Light specificity
|
|
|
|
|
myCStructure->ContextFillArea.Front.Shininess = float (aFront.Shininess());
|
|
|
|
|
myCStructure->ContextFillArea.Front.Ambient = float (aFront.Ambient());
|
|
|
|
|
myCStructure->ContextFillArea.Front.Diffuse = float (aFront.Diffuse());
|
|
|
|
|
myCStructure->ContextFillArea.Front.Specular = float (aFront.Specular());
|
|
|
|
|
myCStructure->ContextFillArea.Front.Transparency = float (aFront.Transparency());
|
|
|
|
|
myCStructure->ContextFillArea.Front.Emission = float (aFront.Emissive());
|
|
|
|
|
|
|
|
|
|
// Reflection mode
|
|
|
|
|
myCStructure->ContextFillArea.Front.IsAmbient = (aFront.ReflectionMode (Graphic3d_TOR_AMBIENT) ? 1 : 0);
|
|
|
|
|
myCStructure->ContextFillArea.Front.IsDiffuse = (aFront.ReflectionMode (Graphic3d_TOR_DIFFUSE) ? 1 : 0);
|
|
|
|
|
myCStructure->ContextFillArea.Front.IsSpecular = (aFront.ReflectionMode (Graphic3d_TOR_SPECULAR) ? 1 : 0);
|
|
|
|
|
myCStructure->ContextFillArea.Front.IsEmission = (aFront.ReflectionMode (Graphic3d_TOR_EMISSION) ? 1 : 0);
|
|
|
|
|
|
|
|
|
|
// Material type
|
|
|
|
|
myCStructure->ContextFillArea.Front.IsPhysic = (aFront.MaterialType (Graphic3d_MATERIAL_PHYSIC) ? 1 : 0);
|
|
|
|
|
|
|
|
|
|
// Specular color
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorSpec.r = float (aFront.SpecularColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorSpec.g = float (aFront.SpecularColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorSpec.b = float (aFront.SpecularColor().Blue());
|
|
|
|
|
|
|
|
|
|
// Ambient color
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorAmb.r = float (aFront.AmbientColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorAmb.g = float (aFront.AmbientColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorAmb.b = float (aFront.AmbientColor().Blue());
|
|
|
|
|
|
|
|
|
|
// Diffuse color
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorDif.r = float (aFront.DiffuseColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorDif.g = float (aFront.DiffuseColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorDif.b = float (aFront.DiffuseColor().Blue());
|
|
|
|
|
|
|
|
|
|
// Emissive color
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorEms.r = float (aFront.EmissiveColor().Red());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorEms.g = float (aFront.EmissiveColor().Green());
|
|
|
|
|
myCStructure->ContextFillArea.Front.ColorEms.b = float (aFront.EmissiveColor().Blue());
|
|
|
|
|
|
|
|
|
|
myCStructure->ContextFillArea.Front.EnvReflexion = float (aFront.EnvReflexion());
|
|
|
|
|
|
|
|
|
|
myCStructure->ContextFillArea.Texture.TextureMap = theAspFill->TextureMap();
|
|
|
|
|
myCStructure->ContextFillArea.Texture.doTextureMap = theAspFill->TextureMapState() ? 1 : 0;
|
|
|
|
|
myCStructure->ContextFillArea.ShaderProgram = theAspFill->ShaderProgram();
|
|
|
|
|
|
|
|
|
|
Standard_Integer aPolyMode;
|
|
|
|
|
Standard_ShortReal aPolyFactor, aPolyUnits;
|
|
|
|
|
theAspFill->PolygonOffsets (aPolyMode, aPolyFactor, aPolyUnits);
|
|
|
|
|
myCStructure->ContextFillArea.PolygonOffsetMode = aPolyMode;
|
|
|
|
|
myCStructure->ContextFillArea.PolygonOffsetFactor = aPolyFactor;
|
|
|
|
|
myCStructure->ContextFillArea.PolygonOffsetUnits = aPolyUnits;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
//function : GraphicHighlight
|
|
|
|
|
//purpose :
|
|
|
|
|