1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
snn
8bf036a056 0030392: XCAFDoc_GraphNode doesn't copy backward links 2019-09-02 16:21:39 +03:00
104 changed files with 2224 additions and 1885 deletions

View File

@@ -58,7 +58,7 @@ set SYS_VS_LIST {}
set SYS_VC_LIST {}
set SYS_VCVARS_LIST {}
# detect installed Visual Studio 2017+ instances by running vswhere.exe
# detect installed Visual Studio 2017 instances by running vswhere.exe
if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] } {
lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141)"
lappend ::SYS_VC_LIST "vc141"
@@ -69,16 +69,6 @@ if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Micr
lappend ::SYS_VC_LIST "vc141-uwp"
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
}
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] } {
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142)"
lappend ::SYS_VC_LIST "vc142"
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
}
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] } {
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142) UWP"
lappend ::SYS_VC_LIST "vc142-uwp"
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
}
# detect installed Visual Studio instances from global environment
if { [info exists ::env(VS140COMNTOOLS)] } {

View File

@@ -256,7 +256,7 @@ proc genAllResources {} {
# Wrapper-function to generate VS project files
proc genproj {theFormat args} {
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "cbp" "xcd" "pro"}
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "cbp" "xcd" "pro"}
set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
set isHelpRequire false
@@ -312,7 +312,6 @@ proc genproj {theFormat args} {
vc12 - Visual Studio 2013
vc14 - Visual Studio 2015
vc141 - Visual Studio 2017
vc142 - Visual Studio 2019
cbp - CodeBlocks
xcd - XCode
pro - Qt Creator
@@ -511,8 +510,7 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl } {
"vc11" -
"vc12" -
"vc14" -
"vc141" -
"vc142" { OS:MKVC $anOutDir $aModules $anAllSolution $theFormat $isUWP}
"vc141" { OS:MKVC $anOutDir $aModules $anAllSolution $theFormat $isUWP}
"cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution $thePlatform $theCmpl }
"xcd" {
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
@@ -936,7 +934,7 @@ proc osutils:collectinc {theModules theIncPath} {
set anIncFiles [glob -tails -nocomplain -dir ${anIncPath} "*"]
foreach anIncFile ${anIncFiles} {
if { [lsearch -exact ${allHeaderFiles} ${anIncFile}] == -1 } {
puts "Warning: file ${anIncPath}/${anIncFile} is not present in the sources and will be removed from ${theIncPath}"
puts "Warning: file ${anIncPath}/${anIncFile} is not presented in the sources and will be removed from ${theIncPath}!"
file delete -force "${theIncPath}/${anIncFile}"
}
}
@@ -967,7 +965,7 @@ proc osutils:vcsolution:header { vcversion } {
append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 2013\n"
} elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" || "$vcversion" == "vc142" } {
} elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141"} {
append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 14\n"
@@ -1205,9 +1203,6 @@ proc osutils:vcproj:readtemplate {theVcVer isUWP isExec} {
if { $theVcVer == "vc141" } {
set aVCRTVer "vc14"
set aToolset "v141"
} elseif { $theVcVer == "vc142" } {
set aVCRTVer "vc14"
set aToolset "v142"
}
set what "$theVcVer"

View File

@@ -1716,40 +1716,6 @@ aGroup->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< next array
aGroup->AddPrimitiveArray (aLines);
~~~~
@subsection upgrade_740_materials Material definition
Decomposition of Ambient, Diffuse, Specular and Emissive properties has been eliminated within *Graphic3d_MaterialAspect* definition.
As result, the following methods of *Graphic3d_MaterialAspect* class have been removed: SetReflectionMode(), SetReflectionModeOn(), Ambient(), Diffuse(), Emissive(), Specular(), SetAmbient(), SetDiffuse(), SetSpecular(), SetEmissive().
Previously, computation of final value required the following code:
~~~~
Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor;
Graphic3d_Vec3 anAmbient (0.0f);
if (theMaterial.ReflectionMode (Graphic3d_TOR_AMBIENT))
{
anAmbient = theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT)
? (Graphic3d_Vec3 )theInteriorColor * theMaterial.Ambient()
: (Graphic3d_Vec3 )theMaterial.AmbientColor() * theMaterial.Ambient();
}
~~~~
New code looks like this:
~~~~
Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor;
Graphic3d_Vec3 anAmbient = theMaterial.AmbientColor();
if (theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT)) { anAmbient *= (Graphic3d_Vec3 )theInteriorColor; }
~~~~
Existing code should be updated to:
- Replace Graphic3d_MaterialAspect::SetReflectionModeOff() with setting black color; SetReflectionModeOn() calls can be simply removed.
R.g. theMaterial.SetAmbientColor(Quantity_NOC_BLACK).
- Replace Graphic3d_MaterialAspect::Ambient(), SetAmbient(), Diffuse(), SetDiffuse(), Specular(), SetSpecular(), Emissive(), SetEmissive() with methods working with pre-multiplied color.
E.g. theMaterial.SetAmbientColor(Graphic3d_Vec3 (1.0f, 0.0f, 0.0f) * 0.2f).
- Avoid using Graphic3d_MaterialAspect::Color() and SetColor() with non-physical materials (Graphic3d_MATERIAL_ASPECT).
These materials do not include color definition, because it is taken from Graphic3d_Aspects::InteriorColor() - this has not been changed.
However, previously it was possible storing the color with SetColor() call and then fetching it with Color() by application code (the rendering ignored this value);
now SetColor() explicitly ignores call for Graphic3d_MATERIAL_ASPECT materials and Color() returns DiffuseColor() multiplication coefficients.
@subsection upgrade_740_text Changes in Graphic3d_Text and OpenGl_Text API
Parameters of *Text* in *Graphic3d_Group* are moved into a new *Graphic3d_Text* class. *AddText* of *Graphic3d_Group* should be used instead of the previous *Text*.

View File

@@ -79,10 +79,10 @@ case 6: //color
Handle(Graphic3d_Group) mygroup = Prs3d_Root::CurrentGroup(aPresentation);
myAspect = (new Prs3d_ShadingAspect())->Aspect();
Graphic3d_MaterialAspect material = myAspect->FrontMaterial();
material.SetAmbientColor (Quantity_NOC_BLACK);
material.SetDiffuseColor (Quantity_NOC_BLACK);
material.SetSpecularColor(Quantity_NOC_BLACK);
material.SetEmissiveColor(Quantity_NOC_BLACK);
material.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
material.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
material.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
material.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
myAspect->SetFrontMaterial(material);
mygroup->SetPrimitivesAspect(myAspect);

View File

@@ -403,17 +403,16 @@ void AIS_Dimension::DrawArrow (const Handle(Prs3d_Presentation)& thePresentation
anArrow->AddVertex (aRightPoint);
// Set aspect for arrow triangles
Graphic3d_PolygonOffset aPolOffset;
aPolOffset.Mode = Aspect_POM_Off;
aPolOffset.Factor = 0.0f;
aPolOffset.Units = 0.0f;
Handle(Graphic3d_AspectFillArea3d) aShadingStyle = new Graphic3d_AspectFillArea3d();
aShadingStyle->SetInteriorStyle (Aspect_IS_SOLID);
aShadingStyle->SetColor (myDrawer->DimensionAspect()->ArrowAspect()->Aspect()->Color());
aShadingStyle->SetShadingModel (Graphic3d_TOSM_UNLIT);
aShadingStyle->SetPolygonOffset (aPolOffset);
Graphic3d_MaterialAspect aShadeMat (Graphic3d_NOM_DEFAULT);
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
aGroup->SetPrimitivesAspect (aShadingStyle);
Handle(Prs3d_ShadingAspect) aShadingStyle = new Prs3d_ShadingAspect();
aShadingStyle->SetColor (myDrawer->DimensionAspect()->ArrowAspect()->Aspect()->Color());
aShadingStyle->SetMaterial (aShadeMat);
aGroup->SetPrimitivesAspect (aShadingStyle->Aspect());
aGroup->AddPrimitiveArray (anArrow);
}
@@ -531,9 +530,9 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
}
Graphic3d_MaterialAspect aShadeMat (Graphic3d_NOM_DEFAULT);
aShadeMat.SetAmbientColor (Quantity_NOC_BLACK);
aShadeMat.SetDiffuseColor (Quantity_NOC_BLACK);
aShadeMat.SetSpecularColor(Quantity_NOC_BLACK);
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
myDrawer->ShadingAspect()->Aspect()->SetInteriorColor (aColor);
myDrawer->ShadingAspect()->Aspect()->SetBackInteriorColor (aColor);
myDrawer->ShadingAspect()->SetMaterial (aShadeMat);

View File

@@ -1968,7 +1968,7 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
}
const Standard_Integer aDispMode = theIObj->HasHilightMode() ? theIObj->HilightMode() : 0;
unselectOwners (theIObj);
unhighlightOwners (theIObj);
myMainPM->SetVisibility (theIObj, aStatus->DisplayMode(), Standard_False);
if (!myLastPicked.IsNull()
@@ -2000,10 +2000,10 @@ void AIS_InteractiveContext::EraseGlobal (const Handle(AIS_InteractiveObject)& t
}
//=======================================================================
//function : unselectOwners
//function : unhighlightOwners
//purpose :
//=======================================================================
void AIS_InteractiveContext::unselectOwners (const Handle(AIS_InteractiveObject)& theObject)
void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject)
{
SelectMgr_SequenceOfOwner aSeq;
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
@@ -2037,7 +2037,7 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
return;
}
unselectOwners (theIObj);
unhighlightOwners (theIObj);
myMainPM->Erase (theIObj, -1);
theIObj->ErasePresentations (true); // make sure highlighting presentations are properly erased

View File

@@ -1235,7 +1235,7 @@ protected: //! @name internal methods
Standard_EXPORT Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr);
//! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
Standard_EXPORT void unselectOwners (const Handle(AIS_InteractiveObject)& theObject);
Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
//! Helper function that highlights the owner given with <theStyle> without
//! performing AutoHighlight checks, e.g. is used for dynamic highlight.
@@ -1246,16 +1246,12 @@ protected: //! @name internal methods
//! for AutoHighlight, e.g. is used for selection.
Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner);
//! Helper function that highlights the owners with check
//! for AutoHighlight, e.g. is used for selection.
Standard_EXPORT void highlightOwners (const AIS_NListOfEntityOwner& theOwners);
//! Helper function that highlights global owner of the object given with <theStyle> with check
//! for AutoHighlight, e.g. is used for selection.
//! If global owner is null, it simply highlights the whole object
Standard_EXPORT void highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theDispMode);
const Standard_Integer theDispMode) const;
//! Helper function that unhighlights all owners that are stored in current AIS_Selection.
//! The function updates global status and selection state of owner and interactive object.
@@ -1263,14 +1259,9 @@ protected: //! @name internal methods
//! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
//! Helper function that unhighlights the owners with check
//! for AutoHighlight, e.g. is used for selection.
Standard_EXPORT void unhighlightOwners (const AIS_NListOfEntityOwner& theOwners,
const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
//! Helper function that unhighlights global selection owner of given interactive.
//! The function does not perform any updates of global or owner status
Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj);
Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const;
//! Helper function that turns on sub-intensity in global status and highlights
//! given objects with sub-intensity color

View File

@@ -85,7 +85,6 @@ void AIS_InteractiveContext::highlightWithColor (const Handle(SelectMgr_EntityOw
//=======================================================================
void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner)
{
AIS_NListOfEntityOwner anOwners;
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
if (anObj.IsNull())
{
@@ -99,15 +98,17 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
{
if (aSelIter.Value()->IsSameSelectable (anObj))
{
anOwners.Append (aSelIter.Value());
aSeq.Append (aSelIter.Value());
}
}
anObj->HilightSelected (myMainPM, aSeq);
}
else
{
anOwners.Append (theOwner);
const Handle(Prs3d_Drawer)& aStyle = getSelStyle (anObj, theOwner);
const Standard_Integer aHiMode = getHilightMode (anObj, aStyle, -1);
theOwner->HilightWithColor (myMainPM, aStyle, aHiMode);
}
highlightOwners (anOwners);
}
//=======================================================================
@@ -116,7 +117,7 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
//=======================================================================
void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theDispMode)
const Standard_Integer theDispMode) const
{
if (theObj.IsNull())
{
@@ -132,7 +133,6 @@ void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject
return;
}
AIS_NListOfEntityOwner anOwners;
if (!aGlobOwner->IsAutoHilight())
{
SelectMgr_SequenceOfOwner aSeq;
@@ -140,15 +140,15 @@ void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject
{
if (aSelIter.Value()->IsSameSelectable (theObj))
{
anOwners.Append (aSelIter.Value());
aSeq.Append (aSelIter.Value());
}
}
theObj->HilightSelected (myMainPM, aSeq);
}
else
{
anOwners.Append (aGlobOwner);
aGlobOwner->HilightWithColor (myMainPM, theStyle, aHiMode);
}
highlightOwners (anOwners);
}
//=======================================================================
@@ -156,19 +156,9 @@ void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject
//purpose :
//=======================================================================
void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity)
{
unhighlightOwners (mySelection->Objects(), theIsToHilightSubIntensity);
}
//=======================================================================
//function : unhighlightOwners
//purpose :
//=======================================================================
void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& theOwners,
const Standard_Boolean theIsToHilightSubIntensity)
{
NCollection_IndexedMap<Handle(AIS_InteractiveObject)> anObjToClear;
for (AIS_NListOfEntityOwner::Iterator aSelIter (theOwners); aSelIter.More(); aSelIter.Next())
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
@@ -196,7 +186,7 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
}
if (anOwner == anInteractive->GlobalSelOwner())
{
aStatus->SetHilightStatus (Standard_False);
myObjects.ChangeFind (anInteractive)->SetHilightStatus (Standard_False);
}
}
for (NCollection_IndexedMap<Handle(AIS_InteractiveObject)>::Iterator anIter (anObjToClear); anIter.More(); anIter.Next())
@@ -211,7 +201,7 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
//function : unhighlightGlobal
//purpose :
//=======================================================================
void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj)
void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const
{
if (theObj.IsNull())
{
@@ -225,9 +215,15 @@ void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObje
return;
}
AIS_NListOfEntityOwner anOwners;
anOwners.Append (aGlobOwner);
unhighlightOwners (anOwners);
if (aGlobOwner->IsAutoHilight())
{
aGlobOwner->Unhilight (myMainPM);
}
else
{
myMainPM->Unhighlight (theObj);
theObj->ClearSelected();
}
}
//=======================================================================
@@ -724,27 +720,11 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
{
// In case of selection without using local context
clearDynamicHighlight();
highlightOwners (mySelection->Objects());
if (theToUpdateViewer)
UpdateCurrentViewer();
}
//=======================================================================
//function : highlightOwners
//purpose :
//=======================================================================
void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theOwners)
{
AIS_MapOfObjSelectedOwners anObjOwnerMap;
for (AIS_NListOfEntityOwner::Iterator aSelIter (theOwners); aSelIter.More(); aSelIter.Next())
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
if (anObj.IsNull())
continue;
const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anObj, anOwner);
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind(anObj);
if (anOwner == anObj->GlobalSelOwner())
@@ -781,6 +761,9 @@ void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theO
}
anObjOwnerMap.Clear();
}
if (theToUpdateViewer)
UpdateCurrentViewer();
}
//=======================================================================
@@ -789,7 +772,17 @@ void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theO
//=======================================================================
void AIS_InteractiveContext::UnhilightSelected (const Standard_Boolean theToUpdateViewer)
{
unhighlightSelected();
for (AIS_NListOfEntityOwner::Iterator aSelIter (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
if (anOwner == anObj->GlobalSelOwner())
{
myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
}
anOwner->Unhilight (myMainPM);
}
if (theToUpdateViewer)
UpdateCurrentViewer();
@@ -944,6 +937,13 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
}
}
if (myAutoHilight && theOwner == anObject->GlobalSelOwner())
{
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObject);
aState->SetHilightStatus (Standard_True);
aState->SetHilightStyle (anObjSelStyle);
}
if (theToUpdateViewer)
UpdateCurrentViewer();
}
@@ -990,17 +990,28 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
if (myAutoHilight)
{
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner;
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
if (theOwner->IsSelected())
{
highlightSelected (theOwner);
if (isGlobal)
{
aStatus->SetHilightStatus (Standard_True);
aStatus->SetHilightStyle (getSelStyle (anObj, theOwner));
}
}
else
{
AIS_NListOfEntityOwner anOwners;
anOwners.Append (theOwner);
unhighlightOwners (anOwners);
if (theOwner->IsAutoHilight())
{
theOwner->Unhilight (myMainPM);
}
else
{
anObj->ClearSelected();
}
aStatus->SetHilightStatus (Standard_False);
aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
}
}

View File

@@ -132,7 +132,7 @@ void AIS_Manipulator::init()
myAxes[2] = Axis (gp::OZ(), Quantity_NOC_BLUE1);
Graphic3d_MaterialAspect aShadingMaterial;
aShadingMaterial.SetSpecularColor(Quantity_NOC_BLACK);
aShadingMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
aShadingMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
@@ -142,10 +142,10 @@ void AIS_Manipulator::init()
Graphic3d_MaterialAspect aHilightMaterial;
aHilightMaterial.SetColor (Quantity_NOC_AZURE);
aHilightMaterial.SetAmbientColor (Quantity_NOC_BLACK);
aHilightMaterial.SetDiffuseColor (Quantity_NOC_BLACK);
aHilightMaterial.SetSpecularColor(Quantity_NOC_BLACK);
aHilightMaterial.SetEmissiveColor(Quantity_NOC_BLACK);
aHilightMaterial.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
aHilightMaterial.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
aHilightMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
aHilightMaterial.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
aHilightMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
myHighlightAspect = new Prs3d_ShadingAspect();
@@ -153,10 +153,11 @@ void AIS_Manipulator::init()
myHighlightAspect->SetMaterial (aHilightMaterial);
Graphic3d_MaterialAspect aDraggerMaterial;
aDraggerMaterial.SetAmbientColor (Quantity_NOC_BLACK);
aDraggerMaterial.SetDiffuseColor (Quantity_NOC_BLACK);
aDraggerMaterial.SetSpecularColor(Quantity_NOC_BLACK);
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
aDraggerMaterial.SetMaterialType(Graphic3d_MATERIAL_ASPECT);
aDraggerMaterial.SetAmbient(1.0);
myDraggerHighlight = new Prs3d_ShadingAspect();
myDraggerHighlight->Aspect()->SetInteriorStyle(Aspect_IS_SOLID);

View File

@@ -637,7 +637,7 @@ void AIS_Shape::setMaterial (const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Boolean theToKeepColor,
const Standard_Boolean theToKeepTransp) const
{
const Quantity_Color aColor = theDrawer->ShadingAspect()->Color (myCurrentFacingModel);
const Quantity_Color aColor = theDrawer->ShadingAspect()->Material (myCurrentFacingModel).Color();
const Standard_Real aTransp = theDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
theDrawer->SetupOwnShadingAspect();
theDrawer->ShadingAspect()->SetMaterial (theMaterial, myCurrentFacingModel);

View File

@@ -137,7 +137,7 @@ void AIS_Triangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aP
Standard_Integer i;
Standard_Integer j;
const Standard_Real ambient = 0.2;
Standard_Real ambient = aspect->FrontMaterial().Ambient();
if (hasVNormals)
{
const TShort_Array1OfShortReal& normals = myTriangulation->Normals();

View File

@@ -223,10 +223,10 @@ void AIS_ViewCube::setDefaultAttributes()
void AIS_ViewCube::setDefaultHighlightAttributes()
{
Graphic3d_MaterialAspect aHighlightMaterial;
aHighlightMaterial.SetAmbientColor (Quantity_NOC_BLACK);
aHighlightMaterial.SetDiffuseColor (Quantity_NOC_BLACK);
aHighlightMaterial.SetSpecularColor(Quantity_NOC_BLACK);
aHighlightMaterial.SetEmissiveColor(Quantity_NOC_BLACK);
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
aHighlightMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
myDynHilightDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
myDynHilightDrawer->ShadingAspect()->SetMaterial (aHighlightMaterial);

View File

@@ -19,7 +19,7 @@
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <Geom_Curve.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <gp_Pnt2d.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepAdaptor_HSurface.hxx>
@@ -94,14 +94,8 @@ void BRepExtrema_ExtCF::Perform(const TopoDS_Edge& E, const TopoDS_Face& F2)
else
{
// Exploration of points and classification
const Standard_Real Tol = BRep_Tool::Tolerance (F2);
BRepTopAdaptor_FClass2d classifier (F2, Tol);
// If the underlying surface of the face is periodic
// Extrema should return the point within the period,
// so there is no point to adjust it in classifier.
Standard_Boolean isAdjustPeriodic = Standard_False;
BRepClass_FaceClassifier classifier;
const Standard_Real Tol = BRep_Tool::Tolerance(F2);
Extrema_POnCurv P1;
Extrema_POnSurf P2;
@@ -110,7 +104,8 @@ void BRepExtrema_ExtCF::Perform(const TopoDS_Edge& E, const TopoDS_Face& F2)
myExtCS.Points(i, P1, P2);
P2.Parameter(U1, U2);
const gp_Pnt2d Puv(U1, U2);
const TopAbs_State state = classifier.Perform (Puv, isAdjustPeriodic);
classifier.Perform(F2, Puv, Tol);
const TopAbs_State state = classifier.State();
if (state == TopAbs_ON || state == TopAbs_IN)
{
mySqDist.Append(myExtCS.SquareDistance(i));

View File

@@ -233,8 +233,7 @@ void BRepOffset_SimpleOffset::FillFaceData(const TopoDS_Face& theFace)
if (theFace.Orientation() == TopAbs_REVERSED)
aMult = -1.0;
BRepOffset_Status aStatus; // set by BRepOffset::Surface(), could be used to check result...
aNFD.myOffsetS = BRepOffset::Surface (aS, aMult * myOffsetValue, aStatus, Standard_True);
aNFD.myOffsetS = new Geom_OffsetSurface(aS, aMult * myOffsetValue, Standard_True);
aNFD.myL = TopLoc_Location(); // Null transformation.
// Save offset surface in map.

View File

@@ -973,24 +973,11 @@ Standard_Boolean Bnd_OBB::IsCompletelyInside(const Bnd_OBB& theOther) const
// =======================================================================
void Bnd_OBB::Add(const gp_Pnt& theP)
{
if (IsVoid())
{
myCenter = theP.XYZ();
myAxes[0] = gp::DX().XYZ();
myAxes[1] = gp::DY().XYZ();
myAxes[2] = gp::DZ().XYZ();
myHDims[0] = 0.0;
myHDims[1] = 0.0;
myHDims[2] = 0.0;
myIsAABox = Standard_True;
}
else
{
gp_Pnt aList[9];
GetVertex(aList);
aList[8] = theP;
ReBuild(TColgp_Array1OfPnt(aList[0], 0, 8));
}
gp_Pnt aList[9];
GetVertex(aList);
aList[8] = theP;
ReBuild(TColgp_Array1OfPnt(aList[0], 0, 8));
}
// =======================================================================
@@ -999,26 +986,9 @@ void Bnd_OBB::Add(const gp_Pnt& theP)
// =======================================================================
void Bnd_OBB::Add(const Bnd_OBB& theOther)
{
if (!theOther.IsVoid())
{
if (IsVoid())
{
myCenter = theOther.myCenter;
myAxes[0] = theOther.myAxes[0];
myAxes[1] = theOther.myAxes[1];
myAxes[2] = theOther.myAxes[2];
myHDims[0] = theOther.myHDims[0];
myHDims[1] = theOther.myHDims[1];
myHDims[2] = theOther.myHDims[2];
myIsAABox = theOther.myIsAABox;
}
else
{
gp_Pnt aList[16];
GetVertex(&aList[0]);
theOther.GetVertex(&aList[8]);
ReBuild(TColgp_Array1OfPnt(aList[0], 0, 15));
}
}
gp_Pnt aList[16];
GetVertex(&aList[0]);
theOther.GetVertex(&aList[8]);
ReBuild(TColgp_Array1OfPnt(aList[0], 0, 15));
}

View File

@@ -28,7 +28,9 @@
#include <Standard_Address.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <Standard_Integer.hxx>
class StdFail_InfiniteSolutions;
class StdFail_NotDone;
class Standard_OutOfRange;
class Adaptor3d_Curve;
class Extrema_CurveTool;
class Extrema_POnCurv;
@@ -36,6 +38,7 @@ class gp_Pnt;
class gp_Vec;
class Extrema_ECC
{
public:

View File

@@ -28,7 +28,9 @@
#include <Standard_Address.hxx>
#include <TColgp_HArray1OfPnt2d.hxx>
#include <Standard_Integer.hxx>
class StdFail_InfiniteSolutions;
class StdFail_NotDone;
class Standard_OutOfRange;
class Adaptor2d_Curve2d;
class Extrema_Curve2dTool;
class Extrema_POnCurv2d;
@@ -36,6 +38,7 @@ class gp_Pnt2d;
class gp_Vec2d;
class Extrema_ECC2d
{
public:

View File

@@ -16,6 +16,9 @@
#include <Extrema_ECC2d.hxx>
#include <StdFail_InfiniteSolutions.hxx>
#include <StdFail_NotDone.hxx>
#include <Standard_OutOfRange.hxx>
#include <Adaptor2d_Curve2d.hxx>
#include <Extrema_Curve2dTool.hxx>
#include <Extrema_ExtPC2d.hxx>

View File

@@ -16,6 +16,9 @@
#include <Extrema_ECC.hxx>
#include <StdFail_InfiniteSolutions.hxx>
#include <StdFail_NotDone.hxx>
#include <Standard_OutOfRange.hxx>
#include <Adaptor3d_Curve.hxx>
#include <Extrema_CurveTool.hxx>
#include <Extrema_ExtPC.hxx>

View File

@@ -43,6 +43,7 @@
#include <Standard_NotImplemented.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_OutOfRange.hxx>
#include <StdFail_InfiniteSolutions.hxx>
#include <StdFail_NotDone.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_ListIteratorOfListOfTransient.hxx>
@@ -326,6 +327,11 @@ void Extrema_ExtCC::Points(const Standard_Integer N,
Extrema_POnCurv& P1,
Extrema_POnCurv& P2) const
{
if (IsParallel())
{
throw StdFail_InfiniteSolutions();
}
if (N < 1 || N > NbExt())
{
throw Standard_OutOfRange();

View File

@@ -29,7 +29,9 @@
#include <Standard_Address.hxx>
#include <Standard_Real.hxx>
#include <gp_Pnt.hxx>
class StdFail_InfiniteSolutions;
class StdFail_NotDone;
class Standard_OutOfRange;
class Adaptor3d_Curve;
class Extrema_POnCurv;
class gp_Pnt;

View File

@@ -34,7 +34,10 @@
#include <GeomAbs_CurveType.hxx>
#include <gp_Pnt2d.hxx>
#include <Precision.hxx>
#include <Standard_Failure.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_OutOfRange.hxx>
#include <StdFail_InfiniteSolutions.hxx>
#include <StdFail_NotDone.hxx>
Extrema_ExtCC2d::Extrema_ExtCC2d()

View File

@@ -28,7 +28,9 @@
#include <Standard_Address.hxx>
#include <Standard_Real.hxx>
#include <gp_Pnt2d.hxx>
class StdFail_InfiniteSolutions;
class StdFail_NotDone;
class Standard_OutOfRange;
class Adaptor2d_Curve2d;
class Extrema_POnCurv2d;
class gp_Pnt2d;

View File

@@ -36,7 +36,10 @@
#include <gp_Sphere.hxx>
#include <gp_Torus.hxx>
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_TypeMismatch.hxx>
#include <StdFail_InfiniteSolutions.hxx>
#include <StdFail_NotDone.hxx>
#include <TColStd_Array1OfReal.hxx>
@@ -494,6 +497,11 @@ void Extrema_ExtCS::Points(const Standard_Integer N,
Extrema_POnCurv& P1,
Extrema_POnSurf& P2) const
{
if (IsParallel())
{
throw StdFail_InfiniteSolutions();
}
if (N < 1 || N > NbExt())
{
throw Standard_OutOfRange();

View File

@@ -36,7 +36,9 @@
#include <math_DirectPolynomialRoots.hxx>
#include <math_TrigonometricFunctionRoots.hxx>
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_OutOfRange.hxx>
#include <StdFail_InfiniteSolutions.hxx>
#include <StdFail_NotDone.hxx>
#include <stdio.h>
@@ -1098,6 +1100,11 @@ void Extrema_ExtElC::Points (const Standard_Integer N,
Extrema_POnCurv& P1,
Extrema_POnCurv& P2) const
{
if (IsParallel())
{
throw StdFail_InfiniteSolutions();
}
if (N < 1 || N > NbExt())
{
throw Standard_OutOfRange();

View File

@@ -25,7 +25,9 @@
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Extrema_POnCurv.hxx>
class StdFail_InfiniteSolutions;
class StdFail_NotDone;
class Standard_OutOfRange;
class gp_Lin;
class gp_Circ;
class gp_Elips;

View File

@@ -27,7 +27,9 @@
#include <math_DirectPolynomialRoots.hxx>
#include <math_TrigonometricFunctionRoots.hxx>
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_OutOfRange.hxx>
#include <StdFail_InfiniteSolutions.hxx>
#include <StdFail_NotDone.hxx>
//=======================================================================
@@ -457,6 +459,11 @@ void Extrema_ExtElC2d::Points (const Standard_Integer N,
Extrema_POnCurv2d& P1,
Extrema_POnCurv2d& P2) const
{
if (IsParallel())
{
throw StdFail_InfiniteSolutions();
}
if (N < 1 || N > NbExt()) { throw Standard_OutOfRange(); }
P1 = myPoint[N-1][0];
P2 = myPoint[N-1][1];

View File

@@ -25,7 +25,9 @@
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Extrema_POnCurv2d.hxx>
class StdFail_InfiniteSolutions;
class StdFail_NotDone;
class Standard_OutOfRange;
class gp_Lin2d;
class gp_Circ2d;
class gp_Elips2d;

View File

@@ -37,6 +37,7 @@
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_OutOfRange.hxx>
#include <StdFail_InfiniteSolutions.hxx>
#include <StdFail_NotDone.hxx>
#include <TColStd_ListOfInteger.hxx>
@@ -826,6 +827,11 @@ void Extrema_ExtElCS::Points(const Standard_Integer N,
Extrema_POnCurv& P1,
Extrema_POnSurf& P2) const
{
if (IsParallel())
{
throw StdFail_InfiniteSolutions();
}
if (N < 1 || N > NbExt())
{
throw Standard_OutOfRange();

View File

@@ -27,7 +27,9 @@
#include <Extrema_HArray1OfPOnCurv.hxx>
#include <Extrema_HArray1OfPOnSurf.hxx>
#include <Standard_Real.hxx>
class StdFail_InfiniteSolutions;
class StdFail_NotDone;
class Standard_OutOfRange;
class gp_Lin;
class gp_Pln;
class gp_Cylinder;

View File

@@ -24,6 +24,7 @@
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_OutOfRange.hxx>
#include <StdFail_InfiniteSolutions.hxx>
#include <StdFail_NotDone.hxx>
Extrema_ExtElSS::Extrema_ExtElSS()
@@ -164,6 +165,11 @@ void Extrema_ExtElSS::Points(const Standard_Integer N,
Extrema_POnSurf& P1,
Extrema_POnSurf& P2) const
{
if (IsParallel())
{
throw StdFail_InfiniteSolutions();
}
if (N < 1 || N > NbExt())
{
throw Standard_OutOfRange();

View File

@@ -26,7 +26,9 @@
#include <TColStd_HArray1OfReal.hxx>
#include <Extrema_HArray1OfPOnSurf.hxx>
#include <Standard_Real.hxx>
class StdFail_InfiniteSolutions;
class StdFail_NotDone;
class Standard_OutOfRange;
class gp_Pln;
class gp_Sphere;
class gp_Cylinder;

View File

@@ -24,7 +24,10 @@
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_TypeMismatch.hxx>
#include <StdFail_InfiniteSolutions.hxx>
#include <StdFail_NotDone.hxx>
Extrema_ExtSS::Extrema_ExtSS()
@@ -260,6 +263,11 @@ void Extrema_ExtSS::Points(const Standard_Integer N,
Extrema_POnSurf& P1,
Extrema_POnSurf& P2) const
{
if (IsParallel())
{
throw StdFail_InfiniteSolutions();
}
if (N < 1 || N > NbExt())
{
throw Standard_OutOfRange();

View File

@@ -658,6 +658,11 @@ void Extrema_GenExtCC::Points(const Standard_Integer N,
POnC& P1,
POnC& P2) const
{
if (IsParallel())
{
throw StdFail_InfiniteSolutions();
}
if (N < 1 || N > NbExt())
{
throw Standard_OutOfRange();

View File

@@ -27,13 +27,13 @@ namespace
static Handle(Graphic3d_AspectFillArea3d) defaultAspect()
{
Graphic3d_MaterialAspect aMaterial (Graphic3d_NOM_DEFAULT);
const Graphic3d_MaterialAspect aMaterial (Graphic3d_NOM_DEFAULT);
Handle(Graphic3d_AspectFillArea3d) anAspect = new Graphic3d_AspectFillArea3d();
anAspect->SetDistinguishOff();
anAspect->SetFrontMaterial (aMaterial);
anAspect->SetHatchStyle (Aspect_HS_HORIZONTAL);
anAspect->SetInteriorStyle (Aspect_IS_SOLID);
anAspect->SetInteriorColor (Quantity_NOC_GRAY20);
anAspect->SetInteriorColor (aMaterial.Color());
anAspect->SetSuppressBackFaces (false);
return anAspect;
}
@@ -177,17 +177,6 @@ Handle(Graphic3d_ClipPlane) Graphic3d_ClipPlane::Clone() const
return new Graphic3d_ClipPlane(*this);
}
// =======================================================================
// function : SetCappingColor
// purpose :
// =======================================================================
void Graphic3d_ClipPlane::SetCappingColor (const Quantity_Color& theColor)
{
myAspect->SetInteriorColor (theColor);
myAspect->ChangeFrontMaterial().SetColor (theColor);
++myAspectMod;
}
// =======================================================================
// function : SetCappingMaterial
// purpose :
@@ -195,10 +184,7 @@ void Graphic3d_ClipPlane::SetCappingColor (const Quantity_Color& theColor)
void Graphic3d_ClipPlane::SetCappingMaterial (const Graphic3d_MaterialAspect& theMat)
{
myAspect->SetFrontMaterial (theMat);
if (myAspect->FrontMaterial().MaterialType() != Graphic3d_MATERIAL_ASPECT)
{
myAspect->SetInteriorColor (theMat.Color());
}
myAspect->SetInteriorColor (theMat.Color());
++myAspectMod;
}

View File

@@ -166,12 +166,6 @@ public:
public: // @name user-defined graphical attributes
//! Return color for rendering capping surface.
Quantity_Color CappingColor() const { return myAspect->FrontMaterial().MaterialType() == Graphic3d_MATERIAL_ASPECT ? myAspect->FrontMaterial().Color() : myAspect->InteriorColor(); }
//! Set color for rendering capping surface.
Standard_EXPORT void SetCappingColor (const Quantity_Color& theColor);
//! Set material for rendering capping surface.
//! @param theMat [in] the material.
Standard_EXPORT void SetCappingMaterial (const Graphic3d_MaterialAspect& theMat);

View File

@@ -25,14 +25,14 @@ namespace
{
const char* StringName;
Graphic3d_BSDF BSDF;
Quantity_Color Colors[Graphic3d_TypeOfReflection_NB];
Quantity_Color Colors [Graphic3d_TypeOfReflection_NB];
Standard_ShortReal ColorCoef[Graphic3d_TypeOfReflection_NB];
Standard_ShortReal TransparencyCoef;
Standard_ShortReal RefractionIndex;
Standard_ShortReal Shininess;
Standard_ShortReal AmbientCoef; //!< coefficient for Graphic3d_MaterialAspect::SetColor()
Standard_ShortReal DiffuseCoef; //!< coefficient for Graphic3d_MaterialAspect::SetColor()
Graphic3d_TypeOfMaterial MaterialType;
Graphic3d_NameOfMaterial MaterialName;
Standard_Boolean ReflActivity[Graphic3d_TypeOfReflection_NB];
RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStringName);
@@ -80,59 +80,62 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
TransparencyCoef(0.0f),
RefractionIndex (1.0f),
Shininess (0.039f),
AmbientCoef (0.25f),
DiffuseCoef (1.0f),
MaterialType (Graphic3d_MATERIAL_ASPECT),
MaterialName (theName)
{
ReflActivity[Graphic3d_TOR_AMBIENT] = Standard_True;
ReflActivity[Graphic3d_TOR_DIFFUSE] = Standard_True;
ReflActivity[Graphic3d_TOR_SPECULAR] = Standard_True;
ReflActivity[Graphic3d_TOR_EMISSION] = Standard_False;
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.3f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.65f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.0f;
ColorCoef[Graphic3d_TOR_EMISSION] = 0.0f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.2f, 0.2f, 0.2f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.2f, 0.2f, 0.2f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (1.0f, 1.0f, 1.0f));
switch (theName)
{
case Graphic3d_NOM_PLASTIC:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Shininess = 0.0078125f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.50f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.24f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.06f;
Shininess = 0.0078125f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.50f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.24f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.06f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
BSDF.Kd = Graphic3d_Vec3 (0.2f);
BSDF.Kd = static_cast<Graphic3d_Vec3> (Colors[Graphic3d_TOR_DIFFUSE]);
BSDF.Ks = Graphic3d_Vec4 (0.00784314f, 0.00784314f, 0.00784314f, 0.25f);
BSDF.Normalize();
break;
case Graphic3d_NOM_SHINY_PLASTIC:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Shininess = 1.00f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.44f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.50f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
Shininess = 1.00f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.44f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.50f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (1.0f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
BSDF.Kd = Graphic3d_Vec3 (0.2f);
BSDF.Kd = static_cast<Graphic3d_Vec3> (Colors[Graphic3d_TOR_DIFFUSE]);
BSDF.Ks = Graphic3d_Vec4 (0.145f, 0.145f, 0.145f, 0.17f);
BSDF.Normalize();
break;
case Graphic3d_NOM_SATIN:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Shininess = 0.09375f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.33f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.40f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.44f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
Shininess = 0.09375f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.33f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.40f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.44f;
BSDF.Kd = Graphic3d_Vec3 (0.2f);
BSDF.Ks = Graphic3d_Vec4 (0.6f);
break;
case Graphic3d_NOM_NEON_GNC:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Shininess = 0.05f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.0f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (1.0f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.62f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (1.0f));
Shininess = 0.05f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.62f;
ColorCoef[Graphic3d_TOR_EMISSION] = 1.00f;
ReflActivity[Graphic3d_TOR_AMBIENT] = Standard_False;
ReflActivity[Graphic3d_TOR_EMISSION] = Standard_True;
BSDF.Kd = Graphic3d_Vec3 (0.0f);
BSDF.Ks = Graphic3d_Vec4 (0.5f, 0.5f, 0.5f, 0.f);
@@ -140,160 +143,199 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.FresnelBase = Graphic3d_Fresnel::CreateDielectric (1.5f);
break;
case Graphic3d_NOM_METALIZED:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Shininess = 0.13f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.0f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.47f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.45f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.2f)), 0.045f);
Shininess = 0.13f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.90f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.47f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.45f;
ReflActivity[Graphic3d_TOR_AMBIENT] = Standard_False;
{
const Graphic3d_Vec3 aColor = (Graphic3d_Vec3 )Colors[Graphic3d_TOR_DIFFUSE];
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
Graphic3d_Fresnel::CreateSchlick (aColor), 0.045f);
}
break;
// Ascending Compatibility physical materials. The same definition is taken as in the next constructor.
case Graphic3d_NOM_BRASS:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.65f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.58f, 0.42f, 0.20f)), 0.045f);
Shininess = 0.65f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.329f, 0.224f, 0.027f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.780f, 0.569f, 0.114f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.992f, 0.941f, 0.808f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_BRONZE:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.65f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.65f, 0.35f, 0.15f)), 0.045f);
Shininess = 0.65f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.213f, 0.128f, 0.054f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.714f, 0.428f, 0.181f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.590f, 0.408f, 0.250f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_COPPER:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.65f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.955008f, 0.637427f, 0.538163f)), 0.045f);
Shininess = 0.65f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.191f, 0.074f, 0.023f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.604f, 0.270f, 0.083f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.950f, 0.640f, 0.540f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_GOLD:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.80f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (1.000000f, 0.765557f, 0.336057f)), 0.045f);
Shininess = 0.80f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.300f, 0.230f, 0.095f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.752f, 0.580f, 0.100f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (1.000f, 0.710f, 0.290f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_PEWTER:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.50f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
Graphic3d_Fresnel::CreateConductor (1.8800f, 3.4900f), 0.045f);
Shininess = 0.50f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.106f, 0.059f, 0.114f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.427f, 0.471f, 0.541f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.333f, 0.333f, 0.522f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_PLASTER:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Shininess = 0.01f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.26f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.75f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.05f;
Shininess = 0.01f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.26f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.75f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.05f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.192f, 0.192f, 0.192f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.508f, 0.508f, 0.508f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.508f, 0.508f, 0.508f));
BSDF.Kd = Graphic3d_Vec3 (0.482353f, 0.482353f, 0.482353f);
break;
case Graphic3d_NOM_SILVER:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.75f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.971519f, 0.959915f, 0.915324f)), 0.045f);
Shininess = 0.75f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.275f, 0.275f, 0.250f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.630f, 0.630f, 0.630f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.950f, 0.930f, 0.880f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_STEEL:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.90f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
Graphic3d_Fresnel::CreateConductor (Graphic3d_Vec3 (2.90f, 2.80f, 2.53f), Graphic3d_Vec3 (3.08f, 2.90f, 2.74f)), 0.045f);
Shininess = 0.90f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.150f, 0.150f, 0.180f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.500f, 0.510f, 0.520f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.560f, 0.570f, 0.580f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_STONE:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
// special case for SetColor()
AmbientCoef = 0.19f * 0.25f;
DiffuseCoef = 0.75f;
Shininess = 0.17f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.19f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.75f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.08f;
Shininess = 0.17f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (1.00f, 0.8f, 0.62f) * 0.19f);
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (1.00f, 0.8f, 0.62f) * 0.75f);
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.98f, 1.0f, 0.60f) * 0.08f);
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (1.00f, 0.8f, 0.62f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (1.00f, 0.8f, 0.62f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.98f, 1.0f, 0.60f));
BSDF.Kd = Graphic3d_Vec3 (0.243137f, 0.243137f, 0.243137f);
BSDF.Ks = Graphic3d_Vec4 (0.00392157f, 0.00392157f, 0.00392157f, 0.5f);
break;
// Ascending Compatibility of physical materials. Takes the same definition as in the next constructor. New materials
case Graphic3d_NOM_CHROME:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.90f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.549585f, 0.556114f, 0.554256f)), 0.045f);
Shininess = 0.90f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.200f, 0.200f, 0.225f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.550f, 0.550f, 0.550f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.975f, 0.975f, 0.975f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_ALUMINIUM:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.75f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.913183f, 0.921494f, 0.924524f)), 0.045f);
Shininess = 0.75f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.300f, 0.300f, 0.300f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.600f, 0.600f, 0.600f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.910f, 0.920f, 0.920f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_NEON_PHC:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.05f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.0f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.0f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.62f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f, 0.90f, 0.414f));
Shininess = 0.05f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.62f;
ColorCoef[Graphic3d_TOR_EMISSION] = 0.90f;
ReflActivity[Graphic3d_TOR_AMBIENT] = Standard_False;
ReflActivity[Graphic3d_TOR_DIFFUSE] = Standard_False;
ReflActivity[Graphic3d_TOR_EMISSION] = Standard_True;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (1.0f, 1.0f, 1.0f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (1.0f, 1.0f, 1.0f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (1.0f, 1.0f, 1.0f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f, 1.0f, 0.46f));
BSDF.Kd = Graphic3d_Vec3 (0.0f);
BSDF.Ks = Graphic3d_Vec4 (0.5f, 0.5f, 0.5f, 0.f);
@@ -303,11 +345,14 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
case Graphic3d_NOM_OBSIDIAN:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.3f;
Shininess = 0.3f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.0f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.0f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.0f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.054f, 0.050f, 0.066f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.183f, 0.170f, 0.225f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.333f, 0.329f, 0.346f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
BSDF.Kd = Graphic3d_Vec3 (0.023f, 0.f, 0.023f);
BSDF.Ks = Graphic3d_Vec4 (0.0156863f, 0.0156863f, 0.0156863f, 0.1f);
@@ -315,11 +360,14 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
case Graphic3d_NOM_JADE:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.10f;
Shininess = 0.10f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.135f, 0.223f, 0.158f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.540f, 0.890f, 0.630f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.316f, 0.316f, 0.316f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
BSDF.FresnelBase = Graphic3d_Fresnel::CreateDielectric (1.5f);
BSDF.Kd = Graphic3d_Vec3 (0.208658f, 0.415686f, 0.218401f);
@@ -328,11 +376,14 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
case Graphic3d_NOM_CHARCOAL:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.01f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.050f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.150f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.0f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
Shininess = 0.01f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.050f, 0.050f, 0.050f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.150f, 0.150f, 0.150f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.000f, 0.000f, 0.000f));
BSDF.Kd = Graphic3d_Vec3 (0.02f, 0.02f, 0.02f);
BSDF.Ks = Graphic3d_Vec4 (0.1f, 0.1f, 0.1f, 0.3f);
@@ -340,6 +391,10 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
case Graphic3d_NOM_WATER:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.90f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
RefractionIndex = 1.33f;
BSDF = Graphic3d_BSDF::CreateGlass (Graphic3d_Vec3 (1.f),
Graphic3d_Vec3 (0.7f, 0.75f, 0.85f),
@@ -347,15 +402,17 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
RefractionIndex);
TransparencyCoef = 0.80f;
Shininess = 0.90f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.450f, 0.450f, 0.475f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.050f, 0.050f, 0.075f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.380f, 0.380f, 0.380f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_GLASS:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.50f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
RefractionIndex = 1.62f;
BSDF = Graphic3d_BSDF::CreateGlass (Graphic3d_Vec3 (1.f),
Graphic3d_Vec3 (0.75f, 0.95f, 0.9f),
@@ -363,15 +420,17 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
RefractionIndex);
TransparencyCoef = 0.80f;
Shininess = 0.50f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.550f, 0.575f, 0.575f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.050f, 0.075f, 0.075f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.920f, 0.920f, 0.920f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
case Graphic3d_NOM_DIAMOND:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.90f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
RefractionIndex = 2.42f;
BSDF = Graphic3d_BSDF::CreateGlass (Graphic3d_Vec3 (1.f),
Graphic3d_Vec3 (0.95f, 0.95f, 0.95f),
@@ -379,16 +438,18 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
RefractionIndex);
TransparencyCoef = 0.80f;
Shininess = 0.90f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.550f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.100f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.970f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.550f, 0.550f, 0.550f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.100f, 0.100f, 0.100f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.970f, 0.970f, 0.970f));
break;
case Graphic3d_NOM_TRANSPARENT:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.90f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
RefractionIndex = 1.0f;
BSDF.Kd = Graphic3d_Vec3 (0.1f);
@@ -396,26 +457,22 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.FresnelBase = Graphic3d_Fresnel::CreateConstant (0.0f);
TransparencyCoef = 0.80f;
Shininess = 0.90f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.550f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.100f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.970f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.550f, 0.550f, 0.550f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.100f, 0.100f, 0.100f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.970f, 0.970f, 0.970f));
break;
case Graphic3d_NOM_UserDefined:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.1f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.8f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.2f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
ColorCoef[Graphic3d_TOR_EMISSION] = 1.00f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.1f, 0.1f, 0.1f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.8f, 0.8f, 0.8f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.2f, 0.2f, 0.2f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f, 0.0f, 0.0f));
break;
case Graphic3d_NOM_DEFAULT:
MaterialType = Graphic3d_MATERIAL_ASPECT;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.30f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.65f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.0f));
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
break;
}
}
@@ -453,12 +510,20 @@ void Graphic3d_MaterialAspect::init (const Graphic3d_NameOfMaterial theName)
myColors[Graphic3d_TOR_DIFFUSE] = aMat.Colors[Graphic3d_TOR_DIFFUSE];
myColors[Graphic3d_TOR_SPECULAR] = aMat.Colors[Graphic3d_TOR_SPECULAR];
myColors[Graphic3d_TOR_EMISSION] = aMat.Colors[Graphic3d_TOR_EMISSION];
myColorCoef[Graphic3d_TOR_AMBIENT] = aMat.ColorCoef[Graphic3d_TOR_AMBIENT];
myColorCoef[Graphic3d_TOR_DIFFUSE] = aMat.ColorCoef[Graphic3d_TOR_DIFFUSE];
myColorCoef[Graphic3d_TOR_SPECULAR] = aMat.ColorCoef[Graphic3d_TOR_SPECULAR];
myColorCoef[Graphic3d_TOR_EMISSION] = aMat.ColorCoef[Graphic3d_TOR_EMISSION];
myTransparencyCoef = aMat.TransparencyCoef;
myRefractionIndex = aMat.RefractionIndex;
myShininess = aMat.Shininess;
myMaterialType = aMat.MaterialType;
myMaterialName = theName;
myRequestedMaterialName = theName;
myReflActivity[Graphic3d_TOR_AMBIENT] = aMat.ReflActivity[Graphic3d_TOR_AMBIENT];
myReflActivity[Graphic3d_TOR_DIFFUSE] = aMat.ReflActivity[Graphic3d_TOR_DIFFUSE];
myReflActivity[Graphic3d_TOR_SPECULAR] = aMat.ReflActivity[Graphic3d_TOR_SPECULAR];
myReflActivity[Graphic3d_TOR_EMISSION] = aMat.ReflActivity[Graphic3d_TOR_EMISSION];
}
// =======================================================================
@@ -488,28 +553,42 @@ void Graphic3d_MaterialAspect::SetMaterialType (const Graphic3d_TypeOfMaterial t
}
}
// =======================================================================
// function : SetAmbient
// purpose :
// =======================================================================
void Graphic3d_MaterialAspect::SetAmbient (const Standard_ShortReal theValue)
{
if (theValue < 0.0f
|| theValue > 1.0f)
{
throw Graphic3d_MaterialDefinitionError("Bad value for SetAmbient < 0. or > 1.0");
}
myColorCoef[Graphic3d_TOR_AMBIENT] = theValue;
if (myReflActivity[Graphic3d_TOR_AMBIENT]
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
{
setUserMaterial();
}
}
// =======================================================================
// function : SetColor
// purpose :
// =======================================================================
void Graphic3d_MaterialAspect::SetColor (const Quantity_Color& theColor)
{
if (myMaterialType == Graphic3d_MATERIAL_ASPECT)
{
return;
}
const RawMaterial& aSrcMat = THE_MATERIALS[myRequestedMaterialName];
const Quantity_Color anAmbient((Graphic3d_Vec3 )theColor * aSrcMat.AmbientCoef);
const Quantity_Color aDiffuse ((Graphic3d_Vec3 )theColor * aSrcMat.DiffuseCoef);
if (myMaterialName != Graphic3d_NOM_UserDefined
&& (!myColors[Graphic3d_TOR_AMBIENT].IsEqual (anAmbient)
|| !myColors[Graphic3d_TOR_DIFFUSE].IsEqual (aDiffuse)))
const Standard_ShortReal anAmbientCoeff = 0.25f;
myColors[Graphic3d_TOR_AMBIENT].SetValues (theColor.Red() * anAmbientCoeff,
theColor.Green() * anAmbientCoeff,
theColor.Blue() * anAmbientCoeff, Quantity_TOC_RGB);
myColors[Graphic3d_TOR_DIFFUSE] = theColor;
if (myReflActivity[Graphic3d_TOR_AMBIENT]
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
{
setUserMaterial();
}
myColors[Graphic3d_TOR_AMBIENT] = anAmbient;
myColors[Graphic3d_TOR_DIFFUSE] = aDiffuse;
}
// =======================================================================
@@ -518,13 +597,12 @@ void Graphic3d_MaterialAspect::SetColor (const Quantity_Color& theColor)
// =======================================================================
void Graphic3d_MaterialAspect::SetAmbientColor (const Quantity_Color& theColor)
{
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
&& myMaterialName != Graphic3d_NOM_UserDefined
&& !myColors[Graphic3d_TOR_AMBIENT].IsEqual (theColor))
myColors[Graphic3d_TOR_AMBIENT] = theColor;
if (myReflActivity[Graphic3d_TOR_AMBIENT]
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
{
setUserMaterial();
}
myColors[Graphic3d_TOR_AMBIENT] = theColor;
}
// =======================================================================
@@ -533,13 +611,12 @@ void Graphic3d_MaterialAspect::SetAmbientColor (const Quantity_Color& theColor)
// =======================================================================
void Graphic3d_MaterialAspect::SetDiffuseColor (const Quantity_Color& theColor)
{
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
&& myMaterialName != Graphic3d_NOM_UserDefined
&& !myColors[Graphic3d_TOR_DIFFUSE].IsEqual (theColor))
myColors[Graphic3d_TOR_DIFFUSE] = theColor;
if (myReflActivity[Graphic3d_TOR_DIFFUSE]
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
{
setUserMaterial();
}
myColors[Graphic3d_TOR_DIFFUSE] = theColor;
}
// =======================================================================
@@ -548,13 +625,12 @@ void Graphic3d_MaterialAspect::SetDiffuseColor (const Quantity_Color& theColor)
// =======================================================================
void Graphic3d_MaterialAspect::SetSpecularColor (const Quantity_Color& theColor)
{
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
&& myMaterialName != Graphic3d_NOM_UserDefined
&& !myColors[Graphic3d_TOR_SPECULAR].IsEqual (theColor))
myColors[Graphic3d_TOR_SPECULAR] = theColor;
if (myReflActivity[Graphic3d_TOR_SPECULAR]
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
{
setUserMaterial();
}
myColors[Graphic3d_TOR_SPECULAR] = theColor;
}
// =======================================================================
@@ -563,13 +639,86 @@ void Graphic3d_MaterialAspect::SetSpecularColor (const Quantity_Color& theColor)
// =======================================================================
void Graphic3d_MaterialAspect::SetEmissiveColor (const Quantity_Color& theColor)
{
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
&& myMaterialName != Graphic3d_NOM_UserDefined
&& !myColors[Graphic3d_TOR_EMISSION].IsEqual (theColor))
myColors[Graphic3d_TOR_EMISSION] = theColor;
if (myReflActivity[Graphic3d_TOR_EMISSION]
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
{
setUserMaterial();
}
}
// =======================================================================
// function : SetDiffuse
// purpose :
// =======================================================================
void Graphic3d_MaterialAspect::SetDiffuse (const Standard_ShortReal theValue)
{
if (theValue < 0.0f
|| theValue > 1.0f)
{
throw Graphic3d_MaterialDefinitionError("Bad value for SetDiffuse < 0. or > 1.0");
}
myColorCoef[Graphic3d_TOR_DIFFUSE] = theValue;
if (myReflActivity[Graphic3d_TOR_DIFFUSE]
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
{
setUserMaterial();
}
}
// =======================================================================
// function : SetEmissive
// purpose :
// =======================================================================
void Graphic3d_MaterialAspect::SetEmissive (const Standard_ShortReal theValue)
{
if (theValue < 0.0f
|| theValue > 1.0f)
{
throw Graphic3d_MaterialDefinitionError("Bad value for SetEmissive < 0. or > 1.0");
}
myColorCoef[Graphic3d_TOR_EMISSION] = theValue;
if (myReflActivity[Graphic3d_TOR_DIFFUSE]
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
{
setUserMaterial();
}
}
// =======================================================================
// function : SetReflectionMode
// purpose :
// =======================================================================
void Graphic3d_MaterialAspect::SetReflectionMode (const Graphic3d_TypeOfReflection theType,
const Standard_Boolean theValue)
{
myReflActivity[theType] = theValue;
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC)
{
setUserMaterial();
}
}
// =======================================================================
// function : SetSpecular
// purpose :
// =======================================================================
void Graphic3d_MaterialAspect::SetSpecular (const Standard_ShortReal theValue)
{
if (theValue < 0.0f
|| theValue > 1.0f)
{
throw Graphic3d_MaterialDefinitionError("Bad value for SetSpecular < 0. or > 1.0");
}
myColorCoef[Graphic3d_TOR_SPECULAR] = theValue;
if (myReflActivity[Graphic3d_TOR_SPECULAR]
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
{
setUserMaterial();
}
myColors[Graphic3d_TOR_EMISSION] = theColor;
}
// =======================================================================
@@ -613,11 +762,8 @@ void Graphic3d_MaterialAspect::SetShininess (const Standard_ShortReal theValue)
throw Graphic3d_MaterialDefinitionError("Bad value for Shininess < 0. or > 1.0");
}
if (myShininess != theValue)
{
myShininess = theValue;
setUserMaterial();
}
myShininess = theValue;
setUserMaterial();
}
// =======================================================================
@@ -638,55 +784,47 @@ Standard_CString Graphic3d_MaterialAspect::MaterialName (const Standard_Integer
// function : MaterialFromName
// purpose :
// =======================================================================
Standard_Boolean Graphic3d_MaterialAspect::MaterialFromName (const Standard_CString theName,
Graphic3d_NameOfMaterial& theMat)
Graphic3d_NameOfMaterial Graphic3d_MaterialAspect::MaterialFromName (const Standard_CString theName)
{
TCollection_AsciiString aName (theName);
aName.LowerCase();
aName.Capitalize();
const Standard_Integer aNbMaterials = Graphic3d_MaterialAspect::NumberOfMaterials();
for (Standard_Integer aMatIter = 0; aMatIter <= aNbMaterials; ++aMatIter)
for (Standard_Integer aMatIter = 0; aMatIter < aNbMaterials; ++aMatIter)
{
const RawMaterial& aMat = THE_MATERIALS[aMatIter];
if (aName == aMat.StringName)
{
theMat = Graphic3d_NameOfMaterial(aMatIter);
return Standard_True;
return Graphic3d_NameOfMaterial(aMatIter);
}
}
// parse aliases
if (aName == "Plastic") // Plastified
{
theMat = Graphic3d_NOM_PLASTIC;
return Standard_True;
return Graphic3d_NOM_PLASTIC;
}
else if (aName == "Shiny_plastic") // Shiny_plastified
{
theMat = Graphic3d_NOM_SHINY_PLASTIC;
return Standard_True;
return Graphic3d_NOM_SHINY_PLASTIC;
}
else if (aName == "Plaster") // Plastered
{
theMat = Graphic3d_NOM_PLASTER;
return Standard_True;
return Graphic3d_NOM_PLASTER;
}
else if (aName == "Satin") // Satined
{
theMat = Graphic3d_NOM_SATIN;
return Standard_True;
return Graphic3d_NOM_SATIN;
}
else if (aName == "Neon_gnc") // Ionized
{
theMat = Graphic3d_NOM_NEON_GNC;
return Standard_True;
return Graphic3d_NOM_NEON_GNC;
}
else if (aName == "Neon_phc") // Neon
{
theMat = Graphic3d_NOM_NEON_PHC;
return Standard_True;
return Graphic3d_NOM_NEON_PHC;
}
return Standard_False;
return Graphic3d_NOM_DEFAULT;
}
// =======================================================================

View File

@@ -42,20 +42,8 @@ public:
//! Returns the type of the predefined material of specified rank within range [1, NumberOfMaterials()].
Standard_EXPORT static Graphic3d_TypeOfMaterial MaterialType (const Standard_Integer theRank);
//! Finds the material for specified name.
//! @param theName [in] name to find
//! @param theMat [out] found material
//! @return FALSE if name was unrecognized
Standard_EXPORT static Standard_Boolean MaterialFromName (const Standard_CString theName,
Graphic3d_NameOfMaterial& theMat);
//! Returns the material for specified name or Graphic3d_NOM_DEFAULT if name is unknown.
static Graphic3d_NameOfMaterial MaterialFromName (const Standard_CString theName)
{
Graphic3d_NameOfMaterial aMat = Graphic3d_NOM_DEFAULT;
MaterialFromName (theName, aMat);
return aMat;
}
Standard_EXPORT static Graphic3d_NameOfMaterial MaterialFromName (const Standard_CString theName);
public:
@@ -99,11 +87,9 @@ public:
}
//! Returns the diffuse color of the surface.
//! WARNING! This method does NOT return color for Graphic3d_MATERIAL_ASPECT material (color is defined by Graphic3d_Aspects::InteriorColor()).
const Quantity_Color& Color() const { return myColors[Graphic3d_TOR_DIFFUSE]; }
//! Modifies the ambient and diffuse color of the surface.
//! WARNING! Has no effect for Graphic3d_MATERIAL_ASPECT material (color should be set to Graphic3d_Aspects::SetInteriorColor()).
Standard_EXPORT void SetColor (const Quantity_Color& theColor);
//! Returns the transparency coefficient of the surface (1.0 - Alpha); 0.0 means opaque.
@@ -146,6 +132,34 @@ public:
//! Modifies the emissive color of the surface.
Standard_EXPORT void SetEmissiveColor (const Quantity_Color& theColor);
//! Returns the reflection properties of the surface.
Standard_ShortReal Ambient() const { return myColorCoef[Graphic3d_TOR_AMBIENT]; }
//! Modifies the reflection properties of the surface.
//! Warning: Raises MaterialDefinitionError if given value is a negative value or greater than 1.0.
Standard_EXPORT void SetAmbient (const Standard_ShortReal theValue);
//! Returns the reflection properties of the surface.
Standard_ShortReal Diffuse() const { return myColorCoef[Graphic3d_TOR_DIFFUSE]; }
//! Modifies the reflection properties of the surface.
//! Warning: Raises MaterialDefinitionError if given value is a negative value or greater than 1.0.
Standard_EXPORT void SetDiffuse (const Standard_ShortReal theValue);
//! Returns the reflection properties of the surface.
Standard_ShortReal Specular() const { return myColorCoef[Graphic3d_TOR_SPECULAR]; }
//! Modifies the reflection properties of the surface.
//! Warning: Raises MaterialDefinitionError if given value is a negative value or greater than 1.0.
Standard_EXPORT void SetSpecular (const Standard_ShortReal theValue);
//! Returns the emissive coefficient of the surface.
Standard_ShortReal Emissive() const { return myColorCoef[Graphic3d_TOR_EMISSION]; }
//! Modifies the reflection properties of the surface.
//! Warning: Raises MaterialDefinitionError if given value is a negative value or greater than 1.0.
Standard_EXPORT void SetEmissive (const Standard_ShortReal theValue);
//! Returns the luminosity of the surface.
Standard_ShortReal Shininess() const { return myShininess; }
@@ -173,11 +187,26 @@ public:
//! Returns TRUE if the reflection mode is active, FALSE otherwise.
Standard_Boolean ReflectionMode (const Graphic3d_TypeOfReflection theType) const
{
return !myColors[theType].IsEqual (Quantity_NOC_BLACK);
return myReflActivity[theType];
}
//! Returns material type.
Graphic3d_TypeOfMaterial MaterialType() const { return myMaterialType; }
//! Activates or deactivates the reflective properties of the surface with specified reflection type.
//!
//! Disabling diffuse and specular reflectance is useful for efficient visualization
//! of large amounts of data as definition of normals for graphic primitives is not needed
//! when only "all-directional" reflectance is active.
//!
//! NOTE: Disabling all four reflection modes also turns off the following effects:
//! 1. Lighting. Colors of primitives are not affected by the material properties when lighting is off.
//! 2. Transparency.
Standard_EXPORT void SetReflectionMode (const Graphic3d_TypeOfReflection theType,
const Standard_Boolean theValue);
//! Activates the reflective properties of the surface with specified reflection type.
void SetReflectionModeOn (const Graphic3d_TypeOfReflection theType) { SetReflectionMode (theType, Standard_True); }
//! Deactivates the reflective properties of the surface with specified reflection type.
void SetReflectionModeOff (const Graphic3d_TypeOfReflection theType) { SetReflectionMode (theType, Standard_False); }
//! Returns TRUE if type of this material is equal to specified type.
Standard_Boolean MaterialType (const Graphic3d_TypeOfMaterial theType) const { return myMaterialType == theType; }
@@ -194,39 +223,27 @@ public:
//! Returns TRUE if this material is identical to specified one.
Standard_Boolean IsEqual (const Graphic3d_MaterialAspect& theOther) const
{
return myTransparencyCoef == theOther.myTransparencyCoef
return myColorCoef[Graphic3d_TOR_AMBIENT] == theOther.myColorCoef[Graphic3d_TOR_AMBIENT]
&& myColorCoef[Graphic3d_TOR_DIFFUSE] == theOther.myColorCoef[Graphic3d_TOR_DIFFUSE]
&& myColorCoef[Graphic3d_TOR_SPECULAR] == theOther.myColorCoef[Graphic3d_TOR_SPECULAR]
&& myColorCoef[Graphic3d_TOR_EMISSION] == theOther.myColorCoef[Graphic3d_TOR_EMISSION]
&& myTransparencyCoef == theOther.myTransparencyCoef
&& myRefractionIndex == theOther.myRefractionIndex
&& myBSDF == theOther.myBSDF
&& myShininess == theOther.myShininess
&& myColors[Graphic3d_TOR_AMBIENT] == theOther.myColors[Graphic3d_TOR_AMBIENT]
&& myColors[Graphic3d_TOR_DIFFUSE] == theOther.myColors[Graphic3d_TOR_DIFFUSE]
&& myColors[Graphic3d_TOR_SPECULAR] == theOther.myColors[Graphic3d_TOR_SPECULAR]
&& myColors[Graphic3d_TOR_EMISSION] == theOther.myColors[Graphic3d_TOR_EMISSION];
&& myColors[Graphic3d_TOR_AMBIENT] == theOther.myColors[Graphic3d_TOR_AMBIENT]
&& myColors[Graphic3d_TOR_DIFFUSE] == theOther.myColors[Graphic3d_TOR_DIFFUSE]
&& myColors[Graphic3d_TOR_SPECULAR] == theOther.myColors[Graphic3d_TOR_SPECULAR]
&& myColors[Graphic3d_TOR_EMISSION] == theOther.myColors[Graphic3d_TOR_EMISSION]
&& myReflActivity[Graphic3d_TOR_AMBIENT] == theOther.myReflActivity[Graphic3d_TOR_AMBIENT]
&& myReflActivity[Graphic3d_TOR_DIFFUSE] == theOther.myReflActivity[Graphic3d_TOR_DIFFUSE]
&& myReflActivity[Graphic3d_TOR_SPECULAR] == theOther.myReflActivity[Graphic3d_TOR_SPECULAR]
&& myReflActivity[Graphic3d_TOR_EMISSION] == theOther.myReflActivity[Graphic3d_TOR_EMISSION];
}
//! Returns TRUE if this material is identical to specified one.
Standard_Boolean operator== (const Graphic3d_MaterialAspect& theOther) const { return IsEqual (theOther); }
public:
//! Deactivates the reflective properties of the surface with specified reflection type.
Standard_DEPRECATED("Deprecated method, specific material component should be zerroed instead")
void SetReflectionModeOff (const Graphic3d_TypeOfReflection theType)
{
if (!ReflectionMode (theType))
{
return;
}
switch (theType)
{
case Graphic3d_TOR_AMBIENT: SetAmbientColor (Quantity_NOC_BLACK); break;
case Graphic3d_TOR_DIFFUSE: SetDiffuseColor (Quantity_NOC_BLACK); break;
case Graphic3d_TOR_SPECULAR: SetSpecularColor(Quantity_NOC_BLACK); break;
case Graphic3d_TOR_EMISSION: SetEmissiveColor(Quantity_NOC_BLACK); break;
}
}
private:
//! Initialize the standard material.
@@ -237,18 +254,16 @@ private:
{
// if a component of a "standard" material change, the
// result is no more standard (a blue gold is not a gold)
if (myMaterialName != Graphic3d_NOM_UserDefined)
{
myMaterialName = Graphic3d_NOM_UserDefined;
myStringName = "UserDefined";
}
myMaterialName = Graphic3d_NOM_UserDefined;
myStringName = "UserDefined";
}
private:
Graphic3d_BSDF myBSDF;
TCollection_AsciiString myStringName;
Quantity_Color myColors[Graphic3d_TypeOfReflection_NB];
Quantity_Color myColors [Graphic3d_TypeOfReflection_NB];
Standard_ShortReal myColorCoef[Graphic3d_TypeOfReflection_NB];
Standard_ShortReal myTransparencyCoef;
Standard_ShortReal myRefractionIndex;
Standard_ShortReal myShininess;
@@ -257,6 +272,8 @@ private:
Graphic3d_NameOfMaterial myMaterialName;
Graphic3d_NameOfMaterial myRequestedMaterialName;
Standard_Boolean myReflActivity[Graphic3d_TypeOfReflection_NB];
};
#endif // _Graphic3d_MaterialAspect_HeaderFile

View File

@@ -20,8 +20,8 @@
//! Types of materials specifies if a material can change color.
enum Graphic3d_TypeOfMaterial
{
Graphic3d_MATERIAL_ASPECT, //!< aspect material definition with configurable color (like plastic)
Graphic3d_MATERIAL_PHYSIC //!< physical material definition with fixed color (like gold)
Graphic3d_MATERIAL_ASPECT,
Graphic3d_MATERIAL_PHYSIC
};
#endif // _Graphic3d_TypeOfMaterial_HeaderFile

View File

@@ -6,5 +6,7 @@ HeaderSection_FileName.cxx
HeaderSection_FileName.hxx
HeaderSection_FileSchema.cxx
HeaderSection_FileSchema.hxx
HeaderSection_HeaderRecognizer.cxx
HeaderSection_HeaderRecognizer.hxx
HeaderSection_Protocol.cxx
HeaderSection_Protocol.hxx

View File

@@ -0,0 +1,51 @@
// Created on: 1994-06-27
// Created by: Frederic MAUPAS
// Copyright (c) 1994-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <HeaderSection_FileDescription.hxx>
#include <HeaderSection_FileName.hxx>
#include <HeaderSection_FileSchema.hxx>
#include <HeaderSection_HeaderRecognizer.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(HeaderSection_HeaderRecognizer,StepData_FileRecognizer)
static TCollection_AsciiString reco_FileName ("FILE_NAME");
static TCollection_AsciiString reco_FileSchema ("FILE_SCHEMA");
static TCollection_AsciiString reco_FileDescription ("FILE_DESCRIPTION");
HeaderSection_HeaderRecognizer::HeaderSection_HeaderRecognizer ()
{ }
void HeaderSection_HeaderRecognizer::Eval
(const TCollection_AsciiString& key)
{
if (key.IsEqual(reco_FileName)) {
SetOK(new HeaderSection_FileName);
return;
}
if (key.IsEqual(reco_FileSchema)) {
SetOK(new HeaderSection_FileSchema);
return;
}
if (key.IsEqual(reco_FileDescription)) {
SetOK(new HeaderSection_FileDescription);
return;
}
}

View File

@@ -0,0 +1,66 @@
// Created on: 1994-06-27
// Created by: Frederic MAUPAS
// Copyright (c) 1994-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _HeaderSection_HeaderRecognizer_HeaderFile
#define _HeaderSection_HeaderRecognizer_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <StepData_FileRecognizer.hxx>
class TCollection_AsciiString;
class HeaderSection_HeaderRecognizer;
DEFINE_STANDARD_HANDLE(HeaderSection_HeaderRecognizer, StepData_FileRecognizer)
//! Recognizes STEP Standard Header Entities
//! (FileName, FileDescription, FileSchema)
class HeaderSection_HeaderRecognizer : public StepData_FileRecognizer
{
public:
Standard_EXPORT HeaderSection_HeaderRecognizer();
DEFINE_STANDARD_RTTIEXT(HeaderSection_HeaderRecognizer,StepData_FileRecognizer)
protected:
//! Recognizes data types of Header STEP Standard
Standard_EXPORT void Eval (const TCollection_AsciiString& key) Standard_OVERRIDE;
private:
};
#endif // _HeaderSection_HeaderRecognizer_HeaderFile

View File

@@ -877,6 +877,62 @@ static IFSelect_ReturnStatus fun27
return IFSelect_RetVoid;
}
static IFSelect_ReturnStatus fun28
(const Handle(IFSelect_SessionPilot)& pilot)
{
Standard_Integer argc = pilot->NbWords();
const Standard_CString arg1 = pilot->Arg(1);
const Standard_CString arg2 = pilot->Arg(2);
const Standard_CString arg3 = pilot->Arg(3);
// **** DefParam ****
Handle(Message_Messenger) sout = Message::DefaultMessenger();
if (argc < 2) {
Handle(TColStd_HSequenceOfHAsciiString) li = Interface_Static::Items();
Standard_Integer i,nb = li->Length();
sout<<" List of parameters : "<<nb<<" items :"<<Message_EndLine;
for (i = 1; i <= nb; i ++) sout<<" "<<li->Value(i)->ToCString();
sout<<Message_EndLine<<" defparam name_param to known more about one"<<Message_EndLine;
sout<<" defparam nom_param e options to edit a definition"<<Message_EndLine;
} else if (argc == 2) {
sout<<" Definition of Parameter : "<<arg1<<Message_EndLine;
Handle(Interface_Static) unst = Interface_Static::Static (arg1);
if (unst.IsNull()) sout<<" undefined"<<Message_EndLine;
else unst->Print(sout);
return IFSelect_RetVoid;
} else if (arg2[0] == 'i') {
// initialisation : arg1=nompar a2='i' a3=family a4=type [a5=val]
if (argc < 5) { sout<<" name init family type [valinit]"<<Message_EndLine; return IFSelect_RetVoid; }
char typ = (pilot->Arg(4))[0];
Standard_Boolean ok= (argc==5 ? Interface_Static::Init(arg3,arg1,typ) :
Interface_Static::Init(arg3,arg1,typ,pilot->Arg(5)));
return (ok ? IFSelect_RetDone : IFSelect_RetFail);
} else if (arg2[0] == 'e') {
// edition : arg1=nompar arg2='e' arg3=option arg4...=parametres option
char comm[100];
if (argc < 4) {
sout<<" give name and options ! Options (according type), 1 a time\n"
<<" imin ival / imax ival / rmin rval / rmax rval /\n"
<<" enum stnum / enum stnum match / eval e1 e2 e3 ... (maxi 10)\n"
<<Message_EndLine;
return IFSelect_RetVoid;
}
if (argc > 4) sout<<"Only the command and ONE more arg are considered"<<Message_EndLine;
sprintf(comm,"%s %s",pilot->Arg(3),pilot->Arg(4));
sout<<"Editing parameter : "<<arg1<<" , by command : "<<comm<<Message_EndLine;
Handle(Interface_Static) unst = Interface_Static::Static (arg1);
if (unst.IsNull()) { sout<<arg1<<" undefined"<<Message_EndLine; return IFSelect_RetError; }
if (Interface_Static::Init(unst->Family(),arg1,'&',comm))
{ sout<<"Editing done"<<Message_EndLine; return IFSelect_RetDone; }
else { sout<<"Command not processed : "<<comm<<Message_EndLine; return IFSelect_RetFail; }
}
sout<<"Unknown Option : "<<arg2<<Message_EndLine;
return IFSelect_RetVoid;
}
static IFSelect_ReturnStatus fun29
(const Handle(IFSelect_SessionPilot)& pilot)
{
@@ -2438,6 +2494,7 @@ void IFSelect_Functions::Init()
IFSelect_Act::AddFunc("xsave","filename:string : sauve items-session",fun25);
IFSelect_Act::AddFunc("xrestore","filename:string : restaure items-session",fun26);
IFSelect_Act::AddFunc("param","nompar:string : displays parameter value; + nompar val : changes it",fun27);
IFSelect_Act::AddFunc("defparam","nompar:string : display def. param; also : nompar edit, nompar init",fun28);
IFSelect_Act::AddFunc("sentfiles","Lists files sent from last Load",fun29);
IFSelect_Act::AddFunc("fileprefix","prefix:string : definit File Prefix",fun30);

View File

@@ -212,7 +212,7 @@ IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile
{
if (thelibrary.IsNull()) return IFSelect_RetVoid;
if (theprotocol.IsNull()) return IFSelect_RetVoid;
Handle(Interface_InterfaceModel) model =myModel;
Handle(Interface_InterfaceModel) model;
IFSelect_ReturnStatus status = IFSelect_RetVoid;
try {
OCC_CATCH_SIGNALS
@@ -1701,12 +1701,11 @@ Standard_Integer IFSelect_WorkSession::RunTransformer
{
Standard_Integer effect = 0;
if (transf.IsNull() || !IsLoaded()) return effect;
Handle(Interface_InterfaceModel) newmod; // Null au depart
Interface_CheckIterator checks;
checks.SetName("X-STEP WorkSession : RunTransformer");
Standard_Boolean res = transf->Perform
(thegraph->Graph(),theprotocol,checks,myModel);
(thegraph->Graph(),theprotocol,checks,newmod);
if (!checks.IsEmpty(Standard_False)) {
Handle(Message_Messenger) sout = Message::DefaultMessenger();

View File

@@ -66,7 +66,7 @@ Interface_FileReaderTool::Interface_FileReaderTool ()
{
themessenger = Message::DefaultMessenger();
theerrhand = Standard_True;
thetrace = 0;
thetrace = 1;
thenbrep0 = thenbreps = 0;
}
@@ -334,11 +334,8 @@ void Interface_FileReaderTool::LoadModel
}
catch (Standard_Failure const&) {
// Sendinf of message : Internal error during the header reading
if (!TF.IsNull())
{
Message_Msg Msg11("XSTEP_11");
TF->Send(Msg11, Message_Info);
}
Message_Msg Msg11("XSTEP_11");
TF->Send (Msg11, Message_Info);
}
}
else
@@ -370,12 +367,9 @@ void Interface_FileReaderTool::LoadModel
// .. Fin Lecture ..
if (anent.IsNull()) {
// Sending of message : Number of ignored Null Entities
if (!TF.IsNull())
{
Message_Msg Msg21("XSTEP_21");
Msg21.Arg(amodel->NbEntities());
TF->Send(Msg21, Message_Info);
}
Message_Msg Msg21("XSTEP_21");
Msg21.Arg(amodel->NbEntities());
TF->Send (Msg21, Message_Info);
continue;
}
// LoadedEntity fait AddEntity MAIS PAS SetReport (en bloc a la fin)
@@ -398,18 +392,13 @@ void Interface_FileReaderTool::LoadModel
//:abv 03Apr00: anent is actually a previous one: if (anent.IsNull())
anent = thereader->BoundEntity(num);
if (anent.IsNull()) {
if (thetrace > 0)
{
// Sending of message : Number of ignored Null Entities
if (!TF.IsNull())
{
Message_Msg Msg21("XSTEP_21");
Msg21.Arg(amodel->NbEntities() + 1);
TF->Send(Msg21, Message_Info);
}
continue;
if (thetrace > 0)
{
// Sending of message : Number of ignored Null Entities
Message_Msg Msg21("XSTEP_21");
Msg21.Arg(amodel->NbEntities()+1);
TF->Send (Msg21, Message_Info);
continue;
}
}
/*Handle(Interface_Check)*/ ach = new Interface_Check(anent);
@@ -419,13 +408,10 @@ void Interface_FileReaderTool::LoadModel
ach->SendFail (Msg278);
if (ierr == 2) {
// Sending of message : reading of entity failed
if (!TF.IsNull())
{
Message_Msg Msg22("XSTEP_22");
Msg22.Arg(amodel->StringLabel(anent));
TF->Send(Msg22, Message_Info);
}
// Sending of message : reading of entity failed
Message_Msg Msg22("XSTEP_22");
Msg22.Arg(amodel->StringLabel(anent));
TF->Send (Msg22, Message_Info);
return;
}
@@ -434,13 +420,10 @@ void Interface_FileReaderTool::LoadModel
ierr = 1;
// ce qui serait bien ici serait de recuperer le texte de l erreur pour ach ...
if (thetrace > 0) {
// Sending of message : recovered entity
if (!TF.IsNull())
{
Message_Msg Msg23("XSTEP_23");
Msg23.Arg(num);
TF->Send(Msg23, Message_Info);
}
// Sending of message : recovered entity
Message_Msg Msg23("XSTEP_23");
Msg23.Arg(num);
TF->Send (Msg23, Message_Info);
}
// Finalement, on charge une Entite Inconnue
@@ -461,12 +444,9 @@ void Interface_FileReaderTool::LoadModel
else {
if (thetrace > 0) {
// Sending of message : reading of entity failed
if (!TF.IsNull())
{
Message_Msg Msg22("XSTEP_22");
Msg22.Arg(amodel->StringLabel(anent));
TF->Send(Msg22, Message_Info);
}
Message_Msg Msg22("XSTEP_22");
Msg22.Arg(amodel->StringLabel(anent));
TF->Send (Msg22, Message_Info);
}
// On garde <rep> telle quelle : pas d analyse fichier supplementaire,
// Mais la phase preliminaire eventuelle est conservee
@@ -480,12 +460,9 @@ void Interface_FileReaderTool::LoadModel
if (thetrace > 0)
{
// Sending of message : report
if (!TF.IsNull())
{
Message_Msg Msg24("XSTEP_24");
Msg24.Arg(thenbreps);
TF->Send(Msg24, Message_Info);
}
Message_Msg Msg24("XSTEP_24");
Msg24.Arg(thenbreps);
TF->Send (Msg24, Message_Info);
}
amodel->Reservate (-thenbreps-10);
thenbreps = thereports->Upper();
@@ -506,11 +483,8 @@ void Interface_FileReaderTool::LoadModel
}
catch (Standard_Failure const&) {
// Sendinf of message : Internal error during the header reading
if (!TF.IsNull())
{
Message_Msg Msg11("XSTEP_11");
TF->Send(Msg11, Message_Info);
}
Message_Msg Msg11("XSTEP_11");
TF->Send (Msg11, Message_Info);
}
}
else
@@ -539,13 +513,10 @@ Handle(Standard_Transient) Interface_FileReaderTool::LoadedEntity
// Trace Entite Inconnue
if (thetrace >= 2 && theproto->IsUnknownEntity(anent)) {
Handle(Message_Messenger) TF = Messenger();
if (!TF.IsNull())
{
Message_Msg Msg22("XSTEP_22");
// Sending of message : reading of entity failed
Msg22.Arg(themodel->StringLabel(anent)->String());
TF->Send(Msg22, Message_Info);
}
Message_Msg Msg22("XSTEP_22");
// Sending of message : reading of entity failed
Msg22.Arg(themodel->StringLabel(anent)->String());
TF->Send (Msg22, Message_Info);
}
// .. Chargement proprement dit : Specifique de la Norme ..
AnalyseRecord(num,anent,ach);
@@ -574,7 +545,7 @@ Handle(Standard_Transient) Interface_FileReaderTool::LoadedEntity
}
thereports->SetValue(irep,rep);
if ( thetrace >= 2 && !Messenger().IsNull())
if ( thetrace >= 2)
ach->Print (Messenger(),2);
}

View File

@@ -215,14 +215,13 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
PolygonVerticesFor3D, PolygonBoundsFor3D );
}
Graphic3d_MaterialAspect aMaterial[2] = { Graphic3d_NOM_PLASTIC, Graphic3d_NOM_PLASTIC };
Graphic3d_MaterialAspect aMaterial[2];
for (Standard_Integer i = 0; i < 2; i++)
{
// OCC20644 "plastic" is most suitable here, as it is "non-physic"
// so TelUpdateMaterial() from OpenGl_attri.c uses the interior
// color from AspectFillArea3d to calculate all material colors
aMaterial[i].SetSpecularColor (Quantity_NOC_BLACK);
aMaterial[i].SetEmissiveColor (Quantity_NOC_BLACK);
aMaterial[i] = Graphic3d_MaterialAspect ( Graphic3d_NOM_PLASTIC );
// OCC21720 For single-colored elements turning all material components off is a good idea,
// as anyhow the normals are not computed and the lighting will be off,
@@ -230,8 +229,10 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
// and there is no need to spend time on updating material properties
if ( !IsReflect )
{
aMaterial[i].SetAmbientColor (Quantity_NOC_BLACK);
aMaterial[i].SetDiffuseColor (Quantity_NOC_BLACK);
aMaterial[i].SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
aMaterial[i].SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
aMaterial[i].SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
aMaterial[i].SetReflectionModeOff(Graphic3d_TOR_EMISSION);
}
else
{
@@ -240,8 +241,10 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
// those in the color scale most exactly (the sum of all reflection
// coefficients is equal to 1). See also MeshVS_NodalColorPrsBuilder
// class for more explanations.
aMaterial[i].SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (0.5f)));
aMaterial[i].SetDiffuseColor (Quantity_Color (Graphic3d_Vec3 (0.5f)));
aMaterial[i].SetAmbient( .5 );
aMaterial[i].SetDiffuse( .5 );
aMaterial[i].SetSpecular( 0. );
aMaterial[i].SetEmissive( 0. );
}
}
@@ -478,14 +481,13 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
CustomBuild(Prs, aCustomElements, IDsToExclude, DisplayMode);
}
Graphic3d_MaterialAspect aMaterial2[2] = { Graphic3d_NOM_PLASTIC, Graphic3d_NOM_PLASTIC };
Graphic3d_MaterialAspect aMaterial2[2];
for (Standard_Integer i = 0; i < 2; i++)
{
// OCC20644 "plastic" is most suitable here, as it is "non-physic"
// so TelUpdateMaterial() from OpenGl_attri.c uses the interior
// color from AspectFillArea3d to calculate all material colors
aMaterial2[i].SetSpecularColor (Quantity_NOC_BLACK);
aMaterial2[i].SetEmissiveColor (Quantity_NOC_BLACK);
aMaterial2[i] = Graphic3d_MaterialAspect ( Graphic3d_NOM_PLASTIC );
if ( !IsReflect )
{
@@ -494,8 +496,14 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
// to have different materials for front and back sides!
// Instead, trying to make material color "nondirectional" with
// only ambient component on.
aMaterial2[i].SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (1.0f)));
aMaterial2[i].SetDiffuseColor (Quantity_NOC_BLACK);
aMaterial2[i].SetReflectionModeOn ( Graphic3d_TOR_AMBIENT );
aMaterial2[i].SetReflectionModeOff( Graphic3d_TOR_DIFFUSE );
aMaterial2[i].SetReflectionModeOff( Graphic3d_TOR_SPECULAR );
aMaterial2[i].SetReflectionModeOff( Graphic3d_TOR_EMISSION );
aMaterial2[i].SetAmbient ( 1. );
aMaterial2[i].SetDiffuse ( 0. );
aMaterial2[i].SetSpecular( 0. );
aMaterial2[i].SetEmissive( 0. );
}
else
{
@@ -504,8 +512,10 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
// those in the color scale most exactly (the sum of all reflection
// coefficients is equal to 1). See also MeshVS_NodalColorPrsBuilder
// class for more explanations.
aMaterial2[i].SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (0.5f)));
aMaterial2[i].SetDiffuseColor (Quantity_Color (Graphic3d_Vec3 (0.5f)));
aMaterial2[i].SetAmbient( .5 );
aMaterial2[i].SetDiffuse( .5 );
aMaterial2[i].SetSpecular( 0. );
aMaterial2[i].SetEmissive( 0. );
}
}

View File

@@ -219,10 +219,10 @@ void MeshVS_MeshPrsBuilder::BuildElements( const Handle(Prs3d_Presentation)& Prs
aDrawer->GetMaterial ( MeshVS_DA_FrontMaterial, AMat );
if ( !IsReflect )
{
AMat.SetAmbientColor (Quantity_NOC_BLACK);
AMat.SetDiffuseColor (Quantity_NOC_BLACK);
AMat.SetSpecularColor(Quantity_NOC_BLACK);
AMat.SetEmissiveColor(Quantity_NOC_BLACK);
AMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
AMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
AMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
AMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
}
Handle( Graphic3d_AspectFillArea3d ) aFill = MeshVS_Tool::CreateAspectFillArea3d( GetDrawer(), AMat );
Handle( Graphic3d_AspectLine3d ) aBeam = MeshVS_Tool::CreateAspectLine3d ( GetDrawer() );
@@ -533,10 +533,10 @@ void MeshVS_MeshPrsBuilder::BuildHilightPrs ( const Handle(Prs3d_Presentation)&
Graphic3d_MaterialAspect AMat;
aDrawer->GetMaterial ( MeshVS_DA_FrontMaterial, AMat );
AMat.SetAmbientColor (Quantity_NOC_BLACK);
AMat.SetDiffuseColor (Quantity_NOC_BLACK);
AMat.SetSpecularColor(Quantity_NOC_BLACK);
AMat.SetEmissiveColor(Quantity_NOC_BLACK);
AMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
AMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
AMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
AMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
Handle( Graphic3d_AspectFillArea3d ) aFill = MeshVS_Tool::CreateAspectFillArea3d( GetDrawer(), AMat );
Handle( Graphic3d_AspectLine3d ) aBeam = MeshVS_Tool::CreateAspectLine3d( GetDrawer() );

View File

@@ -189,16 +189,20 @@ void MeshVS_NodalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
}
// Draw faces with nodal color
// OCC20644 Use "plastic" material as it is "non-physic" and so it is easier to get the required colors
Graphic3d_MaterialAspect aMaterial[2] = { Graphic3d_NOM_PLASTIC, Graphic3d_NOM_PLASTIC };
for (Standard_Integer i = 0; i < 2; ++i)
// OCC20644 Use "plastic" material as it is "non-physic" and so it is easier
// to get the required colors (see TelUpdateMaterial() function in OpenGl_attri.c)
Graphic3d_MaterialAspect aMaterial[ 2 ];
aMaterial[ 0 ] = Graphic3d_MaterialAspect( Graphic3d_NOM_PLASTIC );
aMaterial[ 1 ] = Graphic3d_MaterialAspect( Graphic3d_NOM_PLASTIC );
Standard_Integer i;
for ( i = 0; i < 2; i++ )
{
aMaterial[i].SetSpecularColor (Quantity_NOC_BLACK);
aMaterial[i].SetEmissiveColor (Quantity_NOC_BLACK);
if ( !IsReflect )
{
aMaterial[i].SetAmbientColor (Quantity_NOC_BLACK);
aMaterial[i].SetDiffuseColor (Quantity_NOC_BLACK);
aMaterial[ i ].SetReflectionModeOff( Graphic3d_TOR_SPECULAR );
aMaterial[ i ].SetReflectionModeOff( Graphic3d_TOR_AMBIENT );
aMaterial[ i ].SetReflectionModeOff( Graphic3d_TOR_DIFFUSE );
aMaterial[ i ].SetReflectionModeOff( Graphic3d_TOR_EMISSION );
}
else{
// OCC20644 Using the material with reflection properties same as in
@@ -211,10 +215,14 @@ void MeshVS_NodalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
// is done by TelUpdateMaterial().
// 0.5 is used to have the colors in 3D maximally similar to those in the color scale.
// This is possible when the sum of all coefficient is equal to 1.
aMaterial[i].SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (0.5f)));
aMaterial[i].SetDiffuseColor (Quantity_Color (Graphic3d_Vec3 (0.5f)));
aMaterial[i].SetAmbient( .5 );
aMaterial[i].SetDiffuse( .5 );
aMaterial[i].SetSpecular( 0. );
aMaterial[i].SetEmissive( 0. );
}
}
}
// Create array of polygons for interior presentation of faces and volumes
Handle(Graphic3d_ArrayOfPolygons) aCPolyArr = new Graphic3d_ArrayOfPolygons
@@ -275,7 +283,7 @@ void MeshVS_NodalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
gp_Dir aDefNorm( 0., 0., 1. );
// Prepare for scaling the incoming colors
const Standard_Real anColorRatio = !IsReflect ? 0.44f : 0.5f;
Standard_Real anColorRatio = aMaterial[0].Ambient();
for (it.Reset(); it.More(); it.Next())
{

View File

@@ -13,8 +13,9 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <NCollection_BaseAllocator.hxx>
// Purpose: Implementation of the BaseAllocator class
#include <NCollection_BaseAllocator.hxx>
#include <NCollection_IncAllocator.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_Map.hxx>
@@ -59,50 +60,62 @@ const Handle(NCollection_BaseAllocator)&
return pAllocator;
}
namespace
// global variable to ensure that allocator will be created during loading the library
static Handle(NCollection_BaseAllocator) theAllocInit =
NCollection_BaseAllocator::CommonBaseAllocator();
//=======================================================================
/**
* Structure for collecting statistics about blocks of one size
*/
//=======================================================================
struct StorageInfo
{
// global variable to ensure that allocator will be created during loading the library
static Handle(NCollection_BaseAllocator) theAllocInit = NCollection_BaseAllocator::CommonBaseAllocator();
Standard_Size roundSize;
int nbAlloc;
int nbFree;
StorageInfo()
: roundSize(0), nbAlloc(0), nbFree(0) {}
StorageInfo(Standard_Size theSize)
: roundSize(theSize), nbAlloc(0), nbFree(0) {}
};
//! Structure for collecting statistics about blocks of one size
struct StorageInfo
{
Standard_Size roundSize;
int nbAlloc;
int nbFree;
StorageInfo() : roundSize(0), nbAlloc(0), nbFree(0) {}
StorageInfo(Standard_Size theSize) : roundSize(theSize), nbAlloc(0), nbFree(0) {}
};
//=======================================================================
/**
* Static data map (block_size -> StorageInfo)
*/
//=======================================================================
static NCollection_DataMap<Standard_Size, StorageInfo>& StorageMap()
{
static NCollection_IncAllocator TheAlloc;
static NCollection_DataMap<Standard_Size, StorageInfo>
TheMap (1, & TheAlloc);
return TheMap;
}
//! Static data map (block_size -> StorageInfo)
static NCollection_DataMap<Standard_Size, StorageInfo>& StorageMap()
{
static NCollection_IncAllocator TheAlloc;
static NCollection_DataMap<Standard_Size, StorageInfo> TheMap (1, & TheAlloc);
return TheMap;
}
//=======================================================================
/**
* Static data map (address -> AllocationID)
*/
//=======================================================================
static NCollection_DataMap<Standard_Address, Standard_Size>& StorageIDMap()
{
static NCollection_IncAllocator TheAlloc;
static NCollection_DataMap<Standard_Address, Standard_Size>
TheMap (1, & TheAlloc);
return TheMap;
}
//! Static data map (address -> AllocationID)
static NCollection_DataMap<Standard_Address, Standard_Size>& StorageIDMap()
{
static NCollection_IncAllocator TheAlloc;
static NCollection_DataMap<Standard_Address, Standard_Size> TheMap (1, & TheAlloc);
return TheMap;
}
//! Static map (AllocationID)
static NCollection_Map<Standard_Size>& StorageIDSet()
{
static NCollection_IncAllocator TheAlloc;
static NCollection_Map<Standard_Size> TheMap (1, & TheAlloc);
return TheMap;
}
// dummy function for break point
inline void place_for_break_point () {}
//! Static value of the current allocation ID. It provides unique numbering of allocation events.
static Standard_Size CurrentID = 0;
//=======================================================================
/**
* Static map (AllocationID)
*/
//=======================================================================
static NCollection_Map<Standard_Size>& StorageIDSet()
{
static NCollection_IncAllocator TheAlloc;
static NCollection_Map<Standard_Size> TheMap (1, & TheAlloc);
return TheMap;
}
//=======================================================================
@@ -134,6 +147,14 @@ Standard_EXPORT Standard_Size& StandardCallBack_CatchID()
return Value;
}
//=======================================================================
/**
* Static value of the current allocation ID. It provides unique
* numbering of allocation events.
*/
//=======================================================================
static Standard_Size CurrentID = 0;
//=======================================================================
/**
* Exported function to reset the callback system to the initial state
@@ -149,6 +170,11 @@ Standard_EXPORT void StandardCallBack_Reset()
StandardCallBack_CatchID() = 0;
}
namespace {
// dummy function for break point
inline void place_for_break_point () {}
}
//=======================================================================
//function : StandardCallBack
//purpose : Callback function to register alloc/free calls

View File

@@ -246,31 +246,29 @@ void OSD_MAllocHook::LogFileHandler::Close()
//function : LogFileHandler::MakeReport
//purpose :
//=======================================================================
namespace
struct StorageInfo
{
struct StorageInfo
Standard_Size size;
Standard_Integer nbAlloc;
Standard_Integer nbFree;
Standard_Integer nbLeftPeak;
std::set<unsigned long> alive;
StorageInfo(Standard_Size theSize = 0)
: size (theSize),
nbAlloc (0),
nbFree (0),
nbLeftPeak(0),
alive()
{
Standard_Size size;
Standard_Integer nbAlloc;
Standard_Integer nbFree;
Standard_Integer nbLeftPeak;
std::set<unsigned long> alive;
}
StorageInfo(Standard_Size theSize = 0)
: size (theSize),
nbAlloc (0),
nbFree (0),
nbLeftPeak(0),
alive()
{
}
bool operator < (const StorageInfo& theOther) const
{
return size < theOther.size;
}
};
}
bool operator < (const StorageInfo& theOther) const
{
return size < theOther.size;
}
};
Standard_Boolean OSD_MAllocHook::LogFileHandler::MakeReport
(const char* theLogFile,

View File

@@ -25,10 +25,14 @@ namespace
{
Graphic3d_MaterialAspect aMat;
aMat.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
aMat.SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (0.2f)));
aMat.SetDiffuseColor (Quantity_Color (Graphic3d_Vec3 (0.8f)));
aMat.SetEmissiveColor(Quantity_Color (Graphic3d_Vec3 (0.1f)));
aMat.SetSpecularColor(Quantity_NOC_BLACK);
aMat.SetAmbient (0.2f);
aMat.SetDiffuse (0.8f);
aMat.SetSpecular (0.1f);
aMat.SetEmissive (0.0f);
aMat.SetAmbientColor (Quantity_NOC_WHITE);
aMat.SetDiffuseColor (Quantity_NOC_WHITE);
aMat.SetEmissiveColor(Quantity_NOC_WHITE);
aMat.SetSpecularColor(Quantity_NOC_WHITE);
aMat.SetShininess (10.0f / 128.0f);
aMat.SetRefractionIndex (1.0f);
return aMat;

View File

@@ -43,14 +43,6 @@ struct OpenGl_Material
Diffuse.SetValues (theColor.rgb(), Diffuse.a());
}
//! Empty constructor.
OpenGl_Material()
: Ambient (1.0f),
Diffuse (1.0f),
Specular(1.0f),
Emission(1.0f),
Params (1.0f, 0.0f, 0.0f, 0.0f) {}
//! Initialize material
void Init (const Graphic3d_MaterialAspect& theProp,
const Quantity_Color& theInteriorColor);

View File

@@ -47,6 +47,66 @@ OpenGl_RaytraceMaterial::OpenGl_RaytraceMaterial()
Transparency (ZERO_VEC_4F)
{ }
// =======================================================================
// function : OpenGl_RaytraceMaterial
// purpose : Creates new material with specified properties
// =======================================================================
OpenGl_RaytraceMaterial::OpenGl_RaytraceMaterial (const BVH_Vec4f& theAmbient,
const BVH_Vec4f& theDiffuse,
const BVH_Vec4f& theSpecular)
: Ambient (theAmbient),
Diffuse (theDiffuse),
Specular (theSpecular),
Emission (ZERO_VEC_4F),
Reflection (ZERO_VEC_4F),
Refraction (ZERO_VEC_4F),
Transparency (ZERO_VEC_4F)
{
//
}
// =======================================================================
// function : OpenGl_RaytraceMaterial
// purpose : Creates new material with specified properties
// =======================================================================
OpenGl_RaytraceMaterial::OpenGl_RaytraceMaterial (const BVH_Vec4f& theAmbient,
const BVH_Vec4f& theDiffuse,
const BVH_Vec4f& theSpecular,
const BVH_Vec4f& theEmission,
const BVH_Vec4f& theTranspar)
: Ambient (theAmbient),
Diffuse (theDiffuse),
Specular (theSpecular),
Emission (theEmission),
Reflection (ZERO_VEC_4F),
Refraction (ZERO_VEC_4F),
Transparency (theTranspar)
{
//
}
// =======================================================================
// function : OpenGl_RaytraceMaterial
// purpose : Creates new material with specified properties
// =======================================================================
OpenGl_RaytraceMaterial::OpenGl_RaytraceMaterial (const BVH_Vec4f& theAmbient,
const BVH_Vec4f& theDiffuse,
const BVH_Vec4f& theSpecular,
const BVH_Vec4f& theEmission,
const BVH_Vec4f& theTranspar,
const BVH_Vec4f& theReflection,
const BVH_Vec4f& theRefraction)
: Ambient (theAmbient),
Diffuse (theDiffuse),
Specular (theSpecular),
Emission (theEmission),
Reflection (theReflection),
Refraction (theRefraction),
Transparency (theTranspar)
{
//
}
// =======================================================================
// function : OpenGl_RaytraceLight
// purpose : Creates new light source

View File

@@ -43,35 +43,89 @@ namespace OpenGl_Raytrace
}
//! Stores properties of surface material.
struct OpenGl_RaytraceMaterial
class OpenGl_RaytraceMaterial
{
BVH_Vec4f Ambient; //!< Ambient reflection coefficient
BVH_Vec4f Diffuse; //!< Diffuse reflection coefficient
BVH_Vec4f Specular; //!< Glossy reflection coefficient
BVH_Vec4f Emission; //!< Material emission
BVH_Vec4f Reflection; //!< Specular reflection coefficient
BVH_Vec4f Refraction; //!< Specular refraction coefficient
BVH_Vec4f Transparency; //!< Material transparency
BVH_Mat4f TextureTransform; //!< Texture transformation matrix
public:
//! Ambient reflection coefficient.
BVH_Vec4f Ambient;
//! Diffuse reflection coefficient.
BVH_Vec4f Diffuse;
//! Glossy reflection coefficient.
BVH_Vec4f Specular;
//! Material emission.
BVH_Vec4f Emission;
//! Specular reflection coefficient.
BVH_Vec4f Reflection;
//! Specular refraction coefficient.
BVH_Vec4f Refraction;
//! Material transparency.
BVH_Vec4f Transparency;
//! Texture transformation matrix.
BVH_Mat4f TextureTransform;
//! Physically-based material properties (used in path tracing engine).
struct Physical
{
BVH_Vec4f Kc; //!< Weight of coat specular/glossy BRDF
BVH_Vec4f Kd; //!< Weight of base diffuse BRDF
BVH_Vec4f Ks; //!< Weight of base specular/glossy BRDF
BVH_Vec4f Kt; //!< Weight of base specular/glossy BTDF
BVH_Vec4f Le; //!< Radiance emitted by the surface
BVH_Vec4f FresnelCoat; //!< Fresnel coefficients of coat layer
BVH_Vec4f FresnelBase; //!< Fresnel coefficients of base layer
BVH_Vec4f Absorption; //!< Absorption color/intensity
//! Weight of coat specular/glossy BRDF.
BVH_Vec4f Kc;
//! Weight of base diffuse BRDF.
BVH_Vec4f Kd;
//! Weight of base specular/glossy BRDF.
BVH_Vec4f Ks;
//! Weight of base specular/glossy BTDF.
BVH_Vec4f Kt;
//! Radiance emitted by the surface.
BVH_Vec4f Le;
//! Fresnel coefficients of coat layer.
BVH_Vec4f FresnelCoat;
//! Fresnel coefficients of base layer.
BVH_Vec4f FresnelBase;
//! Absorption color/intensity.
BVH_Vec4f Absorption;
} BSDF;
public:
//! Empty constructor.
//! Creates new default material.
OpenGl_RaytraceMaterial();
//! Creates new material with specified properties.
OpenGl_RaytraceMaterial (const BVH_Vec4f& theAmbient,
const BVH_Vec4f& theDiffuse,
const BVH_Vec4f& theSpecular);
//! Creates new material with specified properties.
OpenGl_RaytraceMaterial (const BVH_Vec4f& theAmbient,
const BVH_Vec4f& theDiffuse,
const BVH_Vec4f& theSpecular,
const BVH_Vec4f& theEmission,
const BVH_Vec4f& theTranspar);
//! Creates new material with specified properties.
OpenGl_RaytraceMaterial (const BVH_Vec4f& theAmbient,
const BVH_Vec4f& theDiffuse,
const BVH_Vec4f& theSpecular,
const BVH_Vec4f& theEmission,
const BVH_Vec4f& theTranspar,
const BVH_Vec4f& theReflection,
const BVH_Vec4f& theRefraction);
//! Returns packed (serialized) representation of material.
const Standard_ShortReal* Packed()
{
@@ -80,11 +134,15 @@ public:
};
//! Stores properties of OpenGL light source.
struct OpenGl_RaytraceLight
class OpenGl_RaytraceLight
{
public:
BVH_Vec4f Emission; //!< Diffuse intensity (in terms of OpenGL)
BVH_Vec4f Position; //!< Position of light source (in terms of OpenGL)
//! Diffuse intensity (in terms of OpenGL).
BVH_Vec4f Emission;
//! Position of light source (in terms of OpenGL).
BVH_Vec4f Position;
public:

View File

@@ -58,6 +58,7 @@ struct OpenGl_Matrix;
class Graphic3d_StructureManager;
class OpenGl_GraphicDriver;
class OpenGl_StateCounter;
class OpenGl_RaytraceMaterial;
class OpenGl_TriangleSet;
class OpenGl_Workspace;
class OpenGl_View;

View File

@@ -350,67 +350,90 @@ void buildTextureTransform (const Handle(Graphic3d_TextureParams)& theParams, BV
OpenGl_RaytraceMaterial OpenGl_View::convertMaterial (const OpenGl_Aspects* theAspect,
const Handle(OpenGl_Context)& theGlContext)
{
OpenGl_RaytraceMaterial aResMat;
OpenGl_RaytraceMaterial theMaterial;
const Graphic3d_MaterialAspect& aSrcMat = theAspect->Aspect()->FrontMaterial();
const OpenGl_Vec3& aMatCol = theAspect->Aspect()->InteriorColor();
const bool isPhysic = aSrcMat.MaterialType (Graphic3d_MATERIAL_PHYSIC);
const float aShine = 128.0f * float(aSrcMat.Shininess());
const OpenGl_Vec3& aSrcAmb = aSrcMat.AmbientColor();
const OpenGl_Vec3& aSrcDif = aSrcMat.DiffuseColor();
const OpenGl_Vec3& aSrcSpe = aSrcMat.SpecularColor();
const OpenGl_Vec3& aSrcEms = aSrcMat.EmissiveColor();
switch (aSrcMat.MaterialType())
// ambient component
if (aSrcMat.ReflectionMode (Graphic3d_TOR_AMBIENT))
{
case Graphic3d_MATERIAL_ASPECT:
{
aResMat.Ambient .SetValues (aSrcAmb * aMatCol, 1.0f);
aResMat.Diffuse .SetValues (aSrcDif * aMatCol, -1.0f); // -1 is no texture
aResMat.Emission.SetValues (aSrcEms * aMatCol, 1.0f);
break;
}
case Graphic3d_MATERIAL_PHYSIC:
{
aResMat.Ambient .SetValues (aSrcAmb, 1.0f);
aResMat.Diffuse .SetValues (aSrcDif, -1.0f); // -1 is no texture
aResMat.Emission.SetValues (aSrcEms, 1.0f);
break;
}
const OpenGl_Vec3& aSrcAmb = isPhysic ? aSrcMat.AmbientColor() : aMatCol;
theMaterial.Ambient = BVH_Vec4f (aSrcAmb * (float )aSrcMat.Ambient(), 1.0f);
}
else
{
theMaterial.Ambient = THE_BLACK_COLOR;
}
// diffusion component
if (aSrcMat.ReflectionMode (Graphic3d_TOR_DIFFUSE))
{
// interior color is always ignored for Specular
aResMat.Specular.SetValues (aSrcSpe, aShine);
const Standard_ShortReal aMaxRefl = Max (aResMat.Diffuse.x() + aResMat.Specular.x(),
Max (aResMat.Diffuse.y() + aResMat.Specular.y(),
aResMat.Diffuse.z() + aResMat.Specular.z()));
const OpenGl_Vec3& aSrcDif = isPhysic ? aSrcMat.DiffuseColor() : aMatCol;
theMaterial.Diffuse = BVH_Vec4f (aSrcDif * (float )aSrcMat.Diffuse(), -1.0f); // -1 is no texture
}
else
{
theMaterial.Diffuse = BVH_Vec4f (THE_BLACK_COLOR.rgb(), -1.0f);
}
// specular component
if (aSrcMat.ReflectionMode (Graphic3d_TOR_SPECULAR))
{
const OpenGl_Vec3& aSrcSpe = aSrcMat.SpecularColor();
const OpenGl_Vec3& aSrcSpe2 = isPhysic ? aSrcSpe : THE_WHITE_COLOR.rgb();
theMaterial.Specular = BVH_Vec4f (aSrcSpe2 * (float )aSrcMat.Specular(), aShine);
const Standard_ShortReal aMaxRefl = Max (theMaterial.Diffuse.x() + theMaterial.Specular.x(),
Max (theMaterial.Diffuse.y() + theMaterial.Specular.y(),
theMaterial.Diffuse.z() + theMaterial.Specular.z()));
const Standard_ShortReal aReflectionScale = 0.75f / aMaxRefl;
aResMat.Reflection.SetValues (aSrcSpe * aReflectionScale, 0.0f);
// ignore isPhysic here
theMaterial.Reflection = BVH_Vec4f (aSrcSpe * (float )aSrcMat.Specular() * aReflectionScale, 0.0f);
}
else
{
theMaterial.Specular = BVH_Vec4f (THE_BLACK_COLOR.rgb(), aShine);
}
// emission component
if (aSrcMat.ReflectionMode (Graphic3d_TOR_EMISSION))
{
const OpenGl_Vec3& aSrcEms = isPhysic ? aSrcMat.EmissiveColor() : aMatCol;
theMaterial.Emission = BVH_Vec4f (aSrcEms * (float )aSrcMat.Emissive(), 1.0f);
}
else
{
theMaterial.Emission = THE_BLACK_COLOR;
}
const float anIndex = (float )aSrcMat.RefractionIndex();
aResMat.Transparency = BVH_Vec4f (aSrcMat.Alpha(), aSrcMat.Transparency(),
anIndex == 0 ? 1.0f : anIndex,
anIndex == 0 ? 1.0f : 1.0f / anIndex);
theMaterial.Transparency = BVH_Vec4f (aSrcMat.Alpha(), aSrcMat.Transparency(),
anIndex == 0 ? 1.0f : anIndex,
anIndex == 0 ? 1.0f : 1.0f / anIndex);
// Serialize physically-based material properties
const Graphic3d_BSDF& aBSDF = aSrcMat.BSDF();
aResMat.BSDF.Kc = aBSDF.Kc;
aResMat.BSDF.Ks = aBSDF.Ks;
aResMat.BSDF.Kd = BVH_Vec4f (aBSDF.Kd, -1.f); // no texture
aResMat.BSDF.Kt = BVH_Vec4f (aBSDF.Kt, 0.f);
aResMat.BSDF.Le = BVH_Vec4f (aBSDF.Le, 0.f);
theMaterial.BSDF.Kc = aBSDF.Kc;
theMaterial.BSDF.Ks = aBSDF.Ks;
theMaterial.BSDF.Kd = BVH_Vec4f (aBSDF.Kd, -1.f); // no texture
theMaterial.BSDF.Kt = BVH_Vec4f (aBSDF.Kt, 0.f);
theMaterial.BSDF.Le = BVH_Vec4f (aBSDF.Le, 0.f);
aResMat.BSDF.Absorption = aBSDF.Absorption;
theMaterial.BSDF.Absorption = aBSDF.Absorption;
aResMat.BSDF.FresnelCoat = aBSDF.FresnelCoat.Serialize ();
aResMat.BSDF.FresnelBase = aBSDF.FresnelBase.Serialize ();
theMaterial.BSDF.FresnelCoat = aBSDF.FresnelCoat.Serialize ();
theMaterial.BSDF.FresnelBase = aBSDF.FresnelBase.Serialize ();
// Handle material textures
if (!theAspect->Aspect()->ToMapTexture())
{
return aResMat;
return theMaterial;
}
const Handle(OpenGl_TextureSet)& aTextureSet = theAspect->TextureSet (theGlContext);
@@ -418,26 +441,30 @@ OpenGl_RaytraceMaterial OpenGl_View::convertMaterial (const OpenGl_Aspects* theA
|| aTextureSet->IsEmpty()
|| aTextureSet->First().IsNull())
{
return aResMat;
return theMaterial;
}
if (theGlContext->HasRayTracingTextures())
{
const Handle(OpenGl_Texture)& aTexture = aTextureSet->First();
buildTextureTransform (aTexture->Sampler()->Parameters(), aResMat.TextureTransform);
buildTextureTransform (aTexture->Sampler()->Parameters(), theMaterial.TextureTransform);
// write texture ID to diffuse w-component
aResMat.Diffuse.w() = aResMat.BSDF.Kd.w() = static_cast<Standard_ShortReal> (myRaytraceGeometry.AddTexture (aTexture));
theMaterial.Diffuse.w() = theMaterial.BSDF.Kd.w() = static_cast<Standard_ShortReal> (myRaytraceGeometry.AddTexture (aTexture));
}
else if (!myIsRaytraceWarnTextures)
{
theGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
"Warning: texturing in Ray-Trace requires GL_ARB_bindless_texture extension which is missing. "
"Please try to update graphics card driver. At the moment textures will be ignored.");
const TCollection_ExtendedString aWarnMessage =
"Warning: texturing in Ray-Trace requires GL_ARB_bindless_texture extension which is missing. "
"Please try to update graphics card driver. At the moment textures will be ignored.";
theGlContext->PushMessage (GL_DEBUG_SOURCE_APPLICATION,
GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH, aWarnMessage);
myIsRaytraceWarnTextures = Standard_True;
}
return aResMat;
return theMaterial;
}
// =======================================================================

View File

@@ -817,7 +817,7 @@ bool OpenGl_View::redrawImmediate (const Graphic3d_Camera::Projection theProject
OpenGl_FrameBuffer* theOitAccumFbo,
const Standard_Boolean theIsPartialUpdate)
{
const Handle(OpenGl_Context)& aCtx = myWorkspace->GetGlContext();
Handle(OpenGl_Context) aCtx = myWorkspace->GetGlContext();
GLboolean toCopyBackToFront = GL_FALSE;
if (theDrawFbo == theReadFbo
&& theDrawFbo != NULL)
@@ -855,7 +855,6 @@ bool OpenGl_View::redrawImmediate (const Graphic3d_Camera::Projection theProject
}
else
{
toCopyBackToFront = GL_FALSE;
myBackBufferRestored = Standard_False;
}
}

View File

@@ -57,30 +57,52 @@ namespace
void OpenGl_Material::Init (const Graphic3d_MaterialAspect& theMat,
const Quantity_Color& theInteriorColor)
{
const bool isPhysic = theMat.MaterialType (Graphic3d_MATERIAL_PHYSIC);
ChangeShine() = 128.0f * theMat.Shininess();
ChangeTransparency() = theMat.Alpha();
const OpenGl_Vec3& aSrcAmb = theMat.AmbientColor();
const OpenGl_Vec3& aSrcDif = theMat.DiffuseColor();
const OpenGl_Vec3& aSrcSpe = theMat.SpecularColor();
const OpenGl_Vec3& aSrcEms = theMat.EmissiveColor();
Specular.SetValues (aSrcSpe, 1.0f); // interior color is ignored for Specular
switch (theMat.MaterialType())
// ambient component
if (theMat.ReflectionMode (Graphic3d_TOR_AMBIENT))
{
case Graphic3d_MATERIAL_ASPECT:
{
Ambient .SetValues (aSrcAmb * theInteriorColor, 1.0f);
Diffuse .SetValues (aSrcDif * theInteriorColor, 1.0f);
Emission.SetValues (aSrcEms * theInteriorColor, 1.0f);
break;
}
case Graphic3d_MATERIAL_PHYSIC:
{
Ambient .SetValues (aSrcAmb, 1.0f);
Diffuse .SetValues (aSrcDif, 1.0f);
Emission.SetValues (aSrcEms, 1.0f);
break;
}
const OpenGl_Vec3& aSrcAmb = isPhysic ? theMat.AmbientColor() : theInteriorColor;
Ambient = OpenGl_Vec4 (aSrcAmb * theMat.Ambient(), 1.0f);
}
else
{
Ambient = THE_BLACK_COLOR;
}
// diffusion component
if (theMat.ReflectionMode (Graphic3d_TOR_DIFFUSE))
{
const OpenGl_Vec3& aSrcDif = isPhysic ? theMat.DiffuseColor() : theInteriorColor;
Diffuse = OpenGl_Vec4 (aSrcDif * theMat.Diffuse(), 1.0f);
}
else
{
Diffuse = THE_BLACK_COLOR;
}
// specular component
if (theMat.ReflectionMode (Graphic3d_TOR_SPECULAR))
{
const OpenGl_Vec3& aSrcSpe = isPhysic ? (const OpenGl_Vec3& )theMat.SpecularColor() : THE_WHITE_COLOR.rgb();
Specular = OpenGl_Vec4 (aSrcSpe * theMat.Specular(), 1.0f);
}
else
{
Specular = THE_BLACK_COLOR;
}
// emission component
if (theMat.ReflectionMode (Graphic3d_TOR_EMISSION))
{
const OpenGl_Vec3& aSrcEms = isPhysic ? theMat.EmissiveColor() : theInteriorColor;
Emission = OpenGl_Vec4 (aSrcEms * theMat.Emissive(), 1.0f);
}
else
{
Emission = THE_BLACK_COLOR;
}
}
@@ -124,12 +146,6 @@ OpenGl_Workspace::OpenGl_Workspace (OpenGl_View* theView, const Handle(OpenGl_Wi
glHint (GL_LINE_SMOOTH_HINT, GL_FASTEST);
glHint (GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
if (myGlContext->Vendor() == "microsoft corporation"
&& !myGlContext->IsGlGreaterEqual (1, 2))
{
// this software implementation causes too slow rendering into GL_FRONT on modern Windows
theView->SetImmediateModeDrawToFront (false);
}
#endif
}

View File

@@ -76,13 +76,9 @@ const Quantity_Color& Prs3d_ShadingAspect::Color (const Aspect_TypeOfFacingModel
default:
case Aspect_TOFM_BOTH_SIDE:
case Aspect_TOFM_FRONT_SIDE:
return myAspect->FrontMaterial().MaterialType() == Graphic3d_MATERIAL_ASPECT
? myAspect->InteriorColor()
: myAspect->FrontMaterial().Color();
return myAspect->FrontMaterial().Color();
case Aspect_TOFM_BACK_SIDE:
return myAspect->BackMaterial().MaterialType() == Graphic3d_MATERIAL_ASPECT
? myAspect->BackInteriorColor()
: myAspect->BackMaterial().Color();
return myAspect->BackMaterial().Color();
}
}

View File

@@ -1113,7 +1113,7 @@ static Standard_Integer OCC1174_1 (Draw_Interpretor& di, Standard_Integer argc,
aFront.SetAmbientColor(aColF);
aFront.SetDiffuseColor(aColF);
aFront.SetSpecularColor(aColF);
aFront.SetEmissiveColor(Quantity_NOC_BLACK);
aFront.SetEmissiveColor(aColF);
aFront.SetTransparency(0.0);
aShadingAspect->SetMaterial(aFront,Aspect_TOFM_FRONT_SIDE);
@@ -1121,7 +1121,7 @@ static Standard_Integer OCC1174_1 (Draw_Interpretor& di, Standard_Integer argc,
aBack.SetAmbientColor(aColB);
aBack.SetDiffuseColor(aColB);
aBack.SetSpecularColor(aColB);
aBack.SetEmissiveColor(Quantity_NOC_BLACK);
aBack.SetEmissiveColor(aColB);
aBack.SetTransparency(0.0);
aShadingAspect->SetMaterial(aBack,Aspect_TOFM_BACK_SIDE);
@@ -1171,7 +1171,7 @@ static Standard_Integer OCC1174_2 (Draw_Interpretor& di, Standard_Integer argc,
front.SetAmbientColor(colf);
front.SetDiffuseColor(colf);
front.SetSpecularColor(colf);
front.SetEmissiveColor(Quantity_NOC_BLACK);
front.SetEmissiveColor(colf);
front.SetTransparency (0.4f);
sa->SetMaterial(front,Aspect_TOFM_FRONT_SIDE);
@@ -1179,7 +1179,7 @@ static Standard_Integer OCC1174_2 (Draw_Interpretor& di, Standard_Integer argc,
back.SetAmbientColor(colb);
back.SetDiffuseColor(colb);
back.SetSpecularColor(colb);
back.SetEmissiveColor(Quantity_NOC_BLACK);
back.SetEmissiveColor(colb);
back.SetTransparency (0.2f);
sa->SetMaterial(back,Aspect_TOFM_BACK_SIDE);

View File

@@ -3239,108 +3239,6 @@ static Standard_Integer OCC30869 (Draw_Interpretor& theDI, Standard_Integer theA
return 0;
}
#include <BRepExtrema_ExtCF.hxx>
//=======================================================================
//function : OCC30880
//purpose :
//=======================================================================
static Standard_Integer OCC30880 (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
{
if (theArgc != 3)
{
theDI.PrintHelp (theArgv[0]);
return 1;
}
TopoDS_Shape anEdge = DBRep::Get (theArgv[1]);
if (anEdge.IsNull() || anEdge.ShapeType() != TopAbs_EDGE)
{
theDI << theArgv[1] << " is not an edge.\n";
return 1;
}
TopoDS_Shape aFace = DBRep::Get (theArgv[2]);
if (aFace.IsNull() || aFace.ShapeType() != TopAbs_FACE)
{
theDI << theArgv[2] << " is not a face.\n";
return 1;
}
BRepExtrema_ExtCF anExtCF (TopoDS::Edge (anEdge),
TopoDS::Face (aFace));
if (!anExtCF.IsDone())
{
theDI << "Not done\n";
return 0;
}
if (!anExtCF.NbExt())
{
theDI << "No solutions\n";
return 0;
}
if (anExtCF.IsParallel())
{
theDI << "Infinite number of solutions, distance - " << Sqrt (anExtCF.SquareDistance (1)) << "\n";
return 0;
}
Standard_Real aDistMin = RealLast();
Standard_Integer aSolMin = -1;
// Look for the minimal solution
for (int i = 1; i <= anExtCF.NbExt(); ++i)
{
Standard_Real aDist = anExtCF.SquareDistance (i);
if (aDist < aDistMin)
{
aDistMin = aDist;
aSolMin = i;
}
}
if (aSolMin < 0)
{
theDI << "Failed\n";
return 0;
}
theDI << "Minimal distance - " << Sqrt (aDistMin) << "\n";
return 0;
}
#include <BRepPrimAPI_MakeBox.hxx>
static Standard_Integer OCC30704(Draw_Interpretor& di, Standard_Integer, const char**)
{
// Make a shape somewhere far from (0, 0, 0).
BRepPrimAPI_MakeBox mkBox(gp_Pnt(100, 100, 100), 100, 100, 100);
const TopoDS_Shape& box = mkBox.Shape();
// Add a bounding box of a shape to a void bounding box.
Bnd_OBB aVoidBox, aBox;
BRepBndLib::AddOBB(box, aBox, Standard_False, Standard_False, Standard_False);
aVoidBox.Add(aBox);
// Print the center point of the bounding box.
const gp_XYZ& center = aVoidBox.Center();
di << center.X() << " " << center.Y() << " " << center.Z();
return 0;
}
static Standard_Integer OCC30704_1(Draw_Interpretor& di, Standard_Integer, const char**)
{
// A point.
gp_Pnt aP(100, 200, 300);
// Add the point to a void bounding box.
Bnd_OBB aVoidBox;
aVoidBox.Add(aP);
// Print the center point of the bounding box.
const gp_XYZ& center = aVoidBox.Center();
di << center.X() << " " << center.Y() << " " << center.Z();
return 0;
}
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
@@ -3398,12 +3296,5 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
"Usage: OCC30869 wire",
__FILE__, OCC30869, group);
theCommands.Add ("OCC30880", "Looks for extrema between edge and face.\n"
"Usage: OCC30880 edge face",
__FILE__, OCC30880, group);
theCommands.Add("OCC30704", "OCC30704", __FILE__, OCC30704, group);
theCommands.Add("OCC30704_1", "OCC30704_1", __FILE__, OCC30704_1, group);
return;
}

View File

@@ -42,10 +42,10 @@ void QABugs_PresentableObject::Compute(const Handle(PrsMgr_PresentationManager3d
Handle(Graphic3d_Group) aGroup = aStructure->NewGroup();
Handle(Prs3d_ShadingAspect) anAspect = myDrawer->ShadingAspect();
Graphic3d_MaterialAspect aMat = anAspect->Aspect()->FrontMaterial();
aMat.SetAmbientColor (Quantity_NOC_BLACK);
aMat.SetDiffuseColor (Quantity_NOC_BLACK);
aMat.SetSpecularColor(Quantity_NOC_BLACK);
aMat.SetEmissiveColor(Quantity_NOC_BLACK);
aMat.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
aMat.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
aMat.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
aMat.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
anAspect->SetMaterial (aMat);
aGroup->SetPrimitivesAspect (anAspect->Aspect());

View File

@@ -19,11 +19,14 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_ShortReal.hxx>
#include <Standard_ShortReal.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Quantity_TypeOfColor.hxx>
#include <TCollection_AsciiString.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
#include <Standard_Integer.hxx>
#include <NCollection_Vec4.hxx>
class Quantity_ColorDefinitionError;
@@ -48,10 +51,11 @@ public:
DEFINE_STANDARD_ALLOC
//! Creates Quantity_NOC_YELLOW color.
//! Creates a colour with the default value of
//! Colour name : YELLOW
Standard_EXPORT Quantity_Color();
//! Creates the color from enumeration value.
//! Creates the colour <AName>.
Standard_EXPORT Quantity_Color(const Quantity_NameOfColor AName);
//! Creates a color according to the definition system theType.
@@ -94,12 +98,12 @@ public:
Standard_EXPORT void SetValues (const Quantity_NameOfColor AName);
//! Updates a color according to the mode specified by theType.
//! Quantity_TOC_RGB:
//! TOC_RGB:
//! - theR1 the value of Red within range [0.0; 1.0]
//! - theR2 the value of Green within range [0.0; 1.0]
//! - theR3 the value of Blue within range [0.0; 1.0]
//!
//! Quantity_TOC_HLS:
//! TOC_HLS:
//! - theR1 is the Hue (H) angle in degrees within range [0.0; 360.0], 0.0 being Red.
//! -1.0 is a special value reserved for grayscale color (S should be 0.0).
//! - theR2 is the Lightness (L) within range [0.0; 1.0]
@@ -243,16 +247,6 @@ Standard_Boolean operator == (const Quantity_Color& Other) const
//! @return true if parsing was successful, or false otherwise
Standard_EXPORT static bool ColorFromHex (const Standard_CString theHexColorString, Quantity_Color& theColor);
//! Returns hex sRGB string in format "#FFAAFF".
static TCollection_AsciiString ColorToHex (const Quantity_Color& theColor)
{
NCollection_Vec3<Standard_ShortReal> anSRgb = (NCollection_Vec3<Standard_ShortReal> )theColor;
NCollection_Vec3<Standard_Integer> anSRgbInt (anSRgb * 255.0f);
char aBuff[10];
Sprintf (aBuff, "#%02X%02X%02X", anSRgbInt.r(), anSRgbInt.g(), anSRgbInt.b());
return aBuff;
}
//! Converts HLS components into RGB ones.
Standard_EXPORT static void HlsRgb (const Standard_Real H, const Standard_Real L, const Standard_Real S, Standard_Real& R, Standard_Real& G, Standard_Real& B);

View File

@@ -17,8 +17,7 @@
#ifndef _Quantity_NameOfColor_HeaderFile
#define _Quantity_NameOfColor_HeaderFile
//! Definition of names of known colors.
//! The names come (mostly) from the X11 specification.
//! Definition of names of known colours.
enum Quantity_NameOfColor
{
Quantity_NOC_BLACK,

View File

@@ -555,6 +555,7 @@
#include <StepAP203_ChangeRequest.hxx>
#include <StepAP203_StartRequest.hxx>
#include <StepAP203_StartWork.hxx>
#include <StepAP214.hxx>
#include <StepAP214_AppliedApprovalAssignment.hxx>
#include <StepAP214_AppliedDateAndTimeAssignment.hxx>
#include <StepAP214_AppliedDateAssignment.hxx>
@@ -1374,6 +1375,7 @@ RWStepAP214_GeneralModule::RWStepAP214_GeneralModule ()
catstr = Interface_Category::Number("Structure");
catdsc = Interface_Category::Number("Description");
cataux = Interface_Category::Number("Auxiliary");
//// Interface_GeneralLib::SetGlobal(Handle(RWStepAP214_GeneralModule)::DownCast(This()), StepAP214::Protocol());
}

View File

@@ -56,14 +56,11 @@ void RWStepVisual_RWDraughtingModel::ReadStep (const Handle(StepData_StepReaderD
if ( data->ReadSubList (num, 2, "representation.items", ach, sub2) ) {
Standard_Integer num2 = sub2;
Standard_Integer nb0 = data->NbParams(num2);
if (nb0 > 0)
{
aRepresentation_Items = new StepRepr_HArray1OfRepresentationItem (1, nb0);
for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
Handle(StepRepr_RepresentationItem) anIt0;
data->ReadEntity (num2, i0, "representation.items", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anIt0);
aRepresentation_Items->SetValue(i0, anIt0);
}
aRepresentation_Items = new StepRepr_HArray1OfRepresentationItem (1, nb0);
for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
Handle(StepRepr_RepresentationItem) anIt0;
data->ReadEntity (num2, i0, "representation.items", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anIt0);
aRepresentation_Items->SetValue(i0, anIt0);
}
}

View File

@@ -54,15 +54,12 @@ void RWStepVisual_RWPresentationLayerAssignment::ReadStep
Standard_Integer nsub3;
if (data->ReadSubList (num,3,"assigned_items",ach,nsub3)) {
Standard_Integer nb3 = data->NbParams(nsub3);
if (nb3 > 0)
{
aAssignedItems = new StepVisual_HArray1OfLayeredItem (1, nb3);
for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
//szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
if (data->ReadEntity (nsub3,i3,"assigned_items",ach,aAssignedItemsItem))
aAssignedItems->SetValue(i3,aAssignedItemsItem);
}
}
aAssignedItems = new StepVisual_HArray1OfLayeredItem (1, nb3);
for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
//szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
if (data->ReadEntity (nsub3,i3,"assigned_items",ach,aAssignedItemsItem))
aAssignedItems->SetValue(i3,aAssignedItemsItem);
}
}
//--- Initialisation of the read entity ---

View File

@@ -1156,10 +1156,6 @@ Standard_Boolean ShapeFix_Face::FixOrientation(TopTools_DataMapOfShapeListOfShap
for(;ew.More(); ew.Next()) {
TopoDS_Edge ed = TopoDS::Edge (ew.Value());
Handle(Geom2d_Curve) cw = BRep_Tool::CurveOnSurface (ed,myFace,cf,cl);
if (cw.IsNull ())
{
continue;
}
Geom2dAdaptor_Curve gac;
Standard_Real aFirst = cw->FirstParameter();
Standard_Real aLast = cw->LastParameter();
@@ -1892,7 +1888,6 @@ Standard_Boolean ShapeFix_Face::FixSmallAreaWire(const Standard_Boolean theIsRem
TopoDS_Shape anEmptyCopy = myFace.EmptyCopied();
TopoDS_Face aFace = TopoDS::Face(anEmptyCopy);
aFace.Orientation (TopAbs_FORWARD);
const Standard_Real aTolerance3d = ShapeFix_Root::Precision();
for (TopoDS_Iterator aWIt(myFace, Standard_False); aWIt.More(); aWIt.Next())
@@ -1936,9 +1931,8 @@ Standard_Boolean ShapeFix_Face::FixSmallAreaWire(const Standard_Boolean theIsRem
#ifdef OCCT_DEBUG
std::cout << "Warning: ShapeFix_Face: " << nbRemoved << " small area wire(s) removed" << std::endl;
#endif
aFace.Orientation (myFace.Orientation ());
if (!Context ().IsNull ())
Context ()->Replace (myFace, aFace);
if ( !Context().IsNull() )
Context()->Replace(myFace, aFace);
myFace = aFace;
return Standard_True;

View File

@@ -34,20 +34,20 @@
// Primary definitions
#define OCC_VERSION_MAJOR 7
#define OCC_VERSION_MINOR 4
#define OCC_VERSION_MAINTENANCE 0
#define OCC_VERSION_MINOR 3
#define OCC_VERSION_MAINTENANCE 1
//! This macro must be commented in official release, and set to non-empty
//! string in other situations, to identify specifics of the version, e.g.:
//! - "dev" for official (certified) version (master branch) between releases
//! - "beta..." or "rc..." for beta releases or release candidates
//! - "project..." for version containing project-specific fixes
#define OCC_VERSION_DEVELOPMENT "beta"
#define OCC_VERSION_DEVELOPMENT "dev"
// Derived (manually): version as real and string (major.minor)
#define OCC_VERSION 7.4
#define OCC_VERSION_STRING "7.4"
#define OCC_VERSION_COMPLETE "7.4.0"
#define OCC_VERSION 7.3
#define OCC_VERSION_STRING "7.3"
#define OCC_VERSION_COMPLETE "7.3.1"
//! Derived: extended version as string ("major.minor.maintenance.dev")
#ifdef OCC_VERSION_DEVELOPMENT

View File

@@ -3,8 +3,14 @@ StepData.hxx
StepData_Array1OfField.hxx
StepData_DefaultGeneral.cxx
StepData_DefaultGeneral.hxx
StepData_DescrGeneral.cxx
StepData_DescrGeneral.hxx
StepData_Described.cxx
StepData_Described.hxx
StepData_DescrProtocol.cxx
StepData_DescrProtocol.hxx
StepData_DescrReadWrite.cxx
StepData_DescrReadWrite.hxx
StepData_ECDescr.cxx
StepData_ECDescr.hxx
StepData_EDescr.cxx
@@ -34,6 +40,8 @@ StepData_GeneralModule.hxx
StepData_GlobalNodeOfWriterLib.hxx
StepData_GlobalNodeOfWriterLib_0.cxx
StepData_HArray1OfField.hxx
StepData_HeaderTool.cxx
StepData_HeaderTool.hxx
StepData_Logical.hxx
StepData_NodeOfWriterLib.hxx
StepData_NodeOfWriterLib_0.cxx

View File

@@ -0,0 +1,62 @@
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_Check.hxx>
#include <Interface_CopyTool.hxx>
#include <Interface_EntityIterator.hxx>
#include <Interface_ShareTool.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <StepData_DescrGeneral.hxx>
#include <StepData_Described.hxx>
#include <StepData_EDescr.hxx>
#include <StepData_Protocol.hxx>
IMPLEMENT_STANDARD_RTTIEXT(StepData_DescrGeneral,StepData_GeneralModule)
StepData_DescrGeneral::StepData_DescrGeneral
(const Handle(StepData_Protocol)& proto)
: theproto (proto) { }
void StepData_DescrGeneral::FillSharedCase
(const Standard_Integer, const Handle(Standard_Transient)& ent,
Interface_EntityIterator& iter) const
{
Handle(StepData_Described) ds = Handle(StepData_Described)::DownCast(ent);
if (!ds.IsNull()) ds->Shared (iter);
}
void StepData_DescrGeneral::CheckCase(const Standard_Integer ,
const Handle(Standard_Transient)&,
const Interface_ShareTool&,
Handle(Interface_Check)&) const
{
} // pour l instant
void StepData_DescrGeneral::CopyCase(const Standard_Integer,
const Handle(Standard_Transient)&,
const Handle(Standard_Transient)&,
Interface_CopyTool&) const
{
} // pour l instant
Standard_Boolean StepData_DescrGeneral::NewVoid
(const Standard_Integer CN, Handle(Standard_Transient)& ent) const
{
ent = theproto->Descr(CN)->NewEntity();
return (!ent.IsNull());
}

View File

@@ -0,0 +1,78 @@
// Created on: 1997-05-21
// Created by: Christian CAILLET
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StepData_DescrGeneral_HeaderFile
#define _StepData_DescrGeneral_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <StepData_GeneralModule.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class StepData_Protocol;
class Standard_Transient;
class Interface_EntityIterator;
class Interface_ShareTool;
class Interface_Check;
class Interface_CopyTool;
class StepData_DescrGeneral;
DEFINE_STANDARD_HANDLE(StepData_DescrGeneral, StepData_GeneralModule)
//! Works with a Protocol by considering its entity descriptions
class StepData_DescrGeneral : public StepData_GeneralModule
{
public:
Standard_EXPORT StepData_DescrGeneral(const Handle(StepData_Protocol)& proto);
Standard_EXPORT void FillSharedCase (const Standard_Integer CN, const Handle(Standard_Transient)& ent, Interface_EntityIterator& iter) const Standard_OVERRIDE;
Standard_EXPORT void CheckCase (const Standard_Integer CN, const Handle(Standard_Transient)& ent, const Interface_ShareTool& shares, Handle(Interface_Check)& ach) const Standard_OVERRIDE;
Standard_EXPORT void CopyCase (const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean NewVoid (const Standard_Integer CN, Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(StepData_DescrGeneral,StepData_GeneralModule)
protected:
private:
Handle(StepData_Protocol) theproto;
};
#endif // _StepData_DescrGeneral_HeaderFile

View File

@@ -0,0 +1,41 @@
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_GeneralLib.hxx>
#include <Interface_ReaderLib.hxx>
#include <Standard_Type.hxx>
#include <StepData_DescrGeneral.hxx>
#include <StepData_DescrProtocol.hxx>
#include <StepData_DescrReadWrite.hxx>
#include <StepData_WriterLib.hxx>
IMPLEMENT_STANDARD_RTTIEXT(StepData_DescrProtocol,StepData_FileProtocol)
StepData_DescrProtocol::StepData_DescrProtocol () { }
void StepData_DescrProtocol::SetSchemaName (const Standard_CString name)
{ thename.Clear(); thename.AssignCat (name); }
void StepData_DescrProtocol::LibRecord () const
{
if (!HasDescr()) return; // rien a recorder dans la lib ?
Handle(StepData_DescrGeneral) gen = new StepData_DescrGeneral (this);
Handle(StepData_DescrReadWrite) rwm = new StepData_DescrReadWrite (this);
Interface_GeneralLib::SetGlobal (gen,this);
Interface_ReaderLib::SetGlobal (rwm,this);
StepData_WriterLib::SetGlobal (rwm,this);
}
Standard_CString StepData_DescrProtocol::SchemaName () const
{ return thename.ToCString(); }

View File

@@ -0,0 +1,86 @@
// Created on: 1997-05-21
// Created by: Christian CAILLET
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StepData_DescrProtocol_HeaderFile
#define _StepData_DescrProtocol_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <StepData_FileProtocol.hxx>
#include <Standard_CString.hxx>
class StepData_DescrProtocol;
DEFINE_STANDARD_HANDLE(StepData_DescrProtocol, StepData_FileProtocol)
//! A DescrProtocol is a protocol dynamically (at execution time)
//! defined with :
//! - a list of resources (inherits FileProtocol)
//! - a list of entity descriptions
//! i.e. it can be defined with only C++ writing to initialize it
//! Its initialization must :
//! - set its schema name
//! - define its resources (which can also be other DescrProtocol)
//! - define its entity descriptions
//! - record it in the system by calling RecordLib
class StepData_DescrProtocol : public StepData_FileProtocol
{
public:
Standard_EXPORT StepData_DescrProtocol();
//! Defines a specific Schema Name for this Protocol
Standard_EXPORT void SetSchemaName (const Standard_CString name);
//! Records this Protocol in the service libraries, with a
//! DescrGeneral and a DescrReadWrite
//! Does nothing if the Protocol brings no proper description
Standard_EXPORT void LibRecord() const;
//! Returns the Schema Name attached to each class of Protocol
//! here, returns the SchemaName set by SetSchemaName
//! was C++ : return const
Standard_EXPORT virtual Standard_CString SchemaName() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(StepData_DescrProtocol,StepData_FileProtocol)
protected:
private:
TCollection_AsciiString thename;
};
#endif // _StepData_DescrProtocol_HeaderFile

View File

@@ -0,0 +1,143 @@
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_Check.hxx>
#include <Interface_Macros.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <StepData_DescrReadWrite.hxx>
#include <StepData_ECDescr.hxx>
#include <StepData_EDescr.hxx>
#include <StepData_ESDescr.hxx>
#include <StepData_FieldListN.hxx>
#include <StepData_Plex.hxx>
#include <StepData_Protocol.hxx>
#include <StepData_Simple.hxx>
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(StepData_DescrReadWrite,StepData_ReadWriteModule)
static TCollection_AsciiString nocp("?");
StepData_DescrReadWrite::StepData_DescrReadWrite
(const Handle(StepData_Protocol)& proto)
: theproto (proto) { }
Standard_Integer StepData_DescrReadWrite::CaseStep
(const TCollection_AsciiString& atype) const
{
Handle(StepData_ESDescr) descr = theproto->ESDescr (atype.ToCString(),Standard_False);
if (descr.IsNull()) return 0;
return theproto->DescrNumber (descr);
}
Standard_Integer StepData_DescrReadWrite::CaseStep
(const TColStd_SequenceOfAsciiString& types) const
{
Handle(StepData_ECDescr) descr = theproto->ECDescr (types,Standard_False);
if (descr.IsNull()) return 0;
return theproto->DescrNumber (descr);
}
Standard_Boolean StepData_DescrReadWrite::IsComplex
(const Standard_Integer CN) const
{
Handle(StepData_EDescr) descr = theproto->Descr (CN);
if (descr.IsNull()) return Standard_False;
return descr->IsComplex();
}
const TCollection_AsciiString& StepData_DescrReadWrite::StepType
(const Standard_Integer CN) const
{
Handle(StepData_ESDescr) descr = Handle(StepData_ESDescr)::DownCast
(theproto->Descr (CN));
if (descr.IsNull()) return nocp;
return descr->StepType();
}
Standard_Boolean StepData_DescrReadWrite::ComplexType
(const Standard_Integer CN, TColStd_SequenceOfAsciiString& types) const
{
Handle(StepData_ECDescr) descr = Handle(StepData_ECDescr)::DownCast
(theproto->Descr (CN));
if (descr.IsNull()) return Standard_False;
Handle(TColStd_HSequenceOfAsciiString) list = descr->TypeList();
if (list.IsNull()) return Standard_False;
Standard_Integer i, nb = list->Length();
for (i = 1; i <= nb; i ++) types.Append (list->Value(i));
return Standard_True;
}
void StepData_DescrReadWrite::ReadStep(const Standard_Integer CN,
const Handle(StepData_StepReaderData)& data,
const Standard_Integer num,
Handle(Interface_Check)& ach,
const Handle(Standard_Transient)&ent) const
{
if (CN == 0) return;
DeclareAndCast(StepData_Simple,sent,ent);
if (!sent.IsNull()) {
Handle(StepData_ESDescr) sdescr = sent->ESDescr();
StepData_FieldListN& fl = sent->CFields();
data->ReadList (num,ach,sdescr,fl);
return;
}
DeclareAndCast(StepData_Plex,cent,ent);
Standard_Integer i, nb=0;
if (!cent.IsNull()) nb = cent->NbMembers();
Standard_Integer n0 = num;
for (i = 1; i <= nb; i ++) {
Handle(StepData_Simple) si = cent->Member(i);
Handle(StepData_ESDescr) sdescr = si->ESDescr();
StepData_FieldListN& fl = si->CFields();
data->ReadList (n0,ach,sdescr,fl);
if (i < nb) n0 = data->NextForComplex(n0);
}
}
void StepData_DescrReadWrite::WriteStep
(const Standard_Integer CN,
StepData_StepWriter& SW,
const Handle(Standard_Transient)&ent) const
{
if (CN == 0) return;
DeclareAndCast(StepData_Simple,sent,ent);
if (!sent.IsNull()) {
Handle(StepData_ESDescr) sdescr = sent->ESDescr();
const StepData_FieldListN& fl = sent->Fields();
SW.SendList (fl,sdescr);
return;
}
DeclareAndCast(StepData_Plex,cent,ent);
Standard_Integer i, nb=0;
if (!cent.IsNull()) nb = cent->NbMembers();
for (i = 1; i <= nb; i ++) {
Handle(StepData_Simple) si = cent->Member(i);
Handle(StepData_ESDescr) sdescr = si->ESDescr();
const StepData_FieldListN& fl = si->Fields();
SW.StartEntity (sdescr->TypeName());
SW.SendList (fl,sdescr);
}
}

View File

@@ -0,0 +1,85 @@
// Created on: 1997-05-21
// Created by: Christian CAILLET
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StepData_DescrReadWrite_HeaderFile
#define _StepData_DescrReadWrite_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <StepData_ReadWriteModule.hxx>
#include <Standard_Integer.hxx>
#include <TColStd_SequenceOfAsciiString.hxx>
#include <Standard_Boolean.hxx>
class StepData_Protocol;
class TCollection_AsciiString;
class StepData_StepReaderData;
class Interface_Check;
class Standard_Transient;
class StepData_StepWriter;
class StepData_DescrReadWrite;
DEFINE_STANDARD_HANDLE(StepData_DescrReadWrite, StepData_ReadWriteModule)
class StepData_DescrReadWrite : public StepData_ReadWriteModule
{
public:
Standard_EXPORT StepData_DescrReadWrite(const Handle(StepData_Protocol)& proto);
Standard_EXPORT Standard_Integer CaseStep (const TCollection_AsciiString& atype) const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Integer CaseStep (const TColStd_SequenceOfAsciiString& types) const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean IsComplex (const Standard_Integer CN) const Standard_OVERRIDE;
Standard_EXPORT const TCollection_AsciiString& StepType (const Standard_Integer CN) const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean ComplexType (const Standard_Integer CN, TColStd_SequenceOfAsciiString& types) const Standard_OVERRIDE;
Standard_EXPORT void ReadStep (const Standard_Integer CN, const Handle(StepData_StepReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
Standard_EXPORT void WriteStep (const Standard_Integer CN, StepData_StepWriter& SW, const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(StepData_DescrReadWrite,StepData_ReadWriteModule)
protected:
private:
Handle(StepData_Protocol) theproto;
};
#endif // _StepData_DescrReadWrite_HeaderFile

View File

@@ -0,0 +1,152 @@
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Interface_Protocol.hxx>
#include <Interface_ReaderLib.hxx>
#include <StepData_FileProtocol.hxx>
#include <StepData_HeaderTool.hxx>
#include <StepData_Protocol.hxx>
#include <StepData_StepReaderData.hxx>
#include <TCollection_AsciiString.hxx>
// HeaderTool prend en charge le Schema de Donnees utilise pour un Fichier
// Ce Schema peut etre compose de un ou plusieurs Protocoles, chacun etant
// designe par une String. Les Strings correspondent au type "SCHEMA_NAME"
// (typedef) et le Schema est une entite de Header de type "FILE_SCHEMA",
// il a cette forme dans le fichier :
static Interface_ReaderLib lib;
StepData_HeaderTool::StepData_HeaderTool
(const Handle(StepData_StepReaderData)& data)
{
lib.SetComplete();
thedone = Standard_False;
Standard_Integer num = 0;
while ( (num = data->FindNextRecord(num)) != 0) {
const TCollection_AsciiString& headertype = data->RecordType(num);
if (headertype == "FILE_SCHEMA") {
Standard_Integer numsub = data->SubListNumber(num,1,Standard_True);
Standard_Integer nb = data->NbParams(numsub);
for (Standard_Integer i = 1; i <= nb; i ++) {
TCollection_AsciiString unom = data->ParamCValue(numsub,i);
unom.Remove(unom.Length());
unom.Remove(1); // quotes debut et fin
thenames.Append(unom);
}
}
}
}
StepData_HeaderTool::StepData_HeaderTool
(const TColStd_SequenceOfAsciiString& names)
{
lib.SetComplete();
thedone = Standard_False;
Standard_Integer nb = names.Length();
for (Standard_Integer i = 1; i <= nb; i ++) thenames.Append(names.Value(i));
}
Standard_Integer StepData_HeaderTool::NbSchemaNames () const
{ return thenames.Length(); }
const TCollection_AsciiString& StepData_HeaderTool::SchemaName
(const Standard_Integer num) const
{ return thenames.Value(num); }
Handle(StepData_Protocol) StepData_HeaderTool::NamedProtocol
(const TCollection_AsciiString& name) const
{
Handle(StepData_Protocol) proto;
for (lib.Start(); lib.More(); lib.Next()) {
proto = Handle(StepData_Protocol)::DownCast(lib.Protocol());
if ( name.IsEqual(proto->SchemaName()) ) return proto;
}
return proto;
}
void StepData_HeaderTool::Build
(const Handle(StepData_FileProtocol)& proto)
{
thedone = Standard_True;
theignored.Clear();
Standard_Integer nb = thenames.Length();
for (Standard_Integer i = 1; i <= nb; i ++) {
Handle(StepData_Protocol) unproto = NamedProtocol(thenames.Value(i));
if (unproto.IsNull()) theignored.Append(thenames.Value(i));
else proto->Add(unproto);
}
}
Handle(StepData_Protocol) StepData_HeaderTool::Protocol ()
{
thedone = Standard_True;
theignored.Clear();
Handle(StepData_Protocol) unproto;
if (thenames.IsEmpty()) return unproto;
if (thenames.Length() == 1) {
unproto = NamedProtocol (thenames.Value(1));
if (unproto.IsNull()) theignored.Append (thenames.Value(1));
return unproto;
}
Handle(StepData_FileProtocol) proto = new StepData_FileProtocol;
Build(proto);
return proto;
}
Standard_Boolean StepData_HeaderTool::IsDone () const
{ return thedone; }
Standard_Integer StepData_HeaderTool::NbIgnoreds () const
{ return theignored.Length(); }
const TCollection_AsciiString& StepData_HeaderTool::Ignored
(const Standard_Integer num) const
{ return theignored.Value(num); }
void StepData_HeaderTool::Print (Standard_OStream& S) const
{
Standard_Integer nb = thenames.Length();
Standard_Integer lng = 0; Standard_Integer ln1;
S << " --- StepData_HeaderTool : List of Protocol Names --- Count : "
<< nb << std::endl;
Standard_Integer i; // svv Jan11 2000 : porting on DEC
for (i = 1; i <= nb; i ++) {
ln1 = thenames.Value(i).Length() + 8; lng += ln1;
if (lng > 80) { S << std::endl; lng = ln1; }
S << " " << i << " : " << thenames.Value(i);
}
if (lng == 0) S << std::endl;
nb = theignored.Length();
if (!thedone) {
S << " --- Evaluation of Protocol not Done ---" << std::endl;
} else if (nb == 0) {
S << " --- All Names correspond to a known Protocol ---" << std::endl;
} else {
lng = ln1 = 0;
S << " --- Among them, " << nb << " remain unrecognized ---" << std::endl;
for (i = 1; i <= nb; i ++) {
ln1 = theignored.Value(i).Length() + 3; lng += ln1;
if (lng > 80) { S << std::endl; lng = ln1; }
S << " : " << theignored.Value(i);
}
if (lng == 0) S << std::endl;
}
}

View File

@@ -0,0 +1,117 @@
// Created on: 1993-07-23
// Created by: Christian CAILLET
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _StepData_HeaderTool_HeaderFile
#define _StepData_HeaderTool_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TColStd_SequenceOfAsciiString.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
class StepData_StepReaderData;
class TCollection_AsciiString;
class StepData_Protocol;
class StepData_FileProtocol;
//! HeaderTool exploits data from Header to build a Protocol :
//! it uses the Header Entity FileSchema to do this.
//! It builds a Protocol from the Global List of Protocols
//! stored in the Library ReaderLib
class StepData_HeaderTool
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a HeaderTool from data read from a File. Computes the
//! list of Schema Names. The Protocol will be computed later
//! (because there are several options)
Standard_EXPORT StepData_HeaderTool(const Handle(StepData_StepReaderData)& data);
//! Creates a HeaderTool directly from a list of Schema Names
Standard_EXPORT StepData_HeaderTool(const TColStd_SequenceOfAsciiString& names);
//! Returns the count of SchemaNames
Standard_EXPORT Standard_Integer NbSchemaNames() const;
//! Returns a SchemaName, given its rank
Standard_EXPORT const TCollection_AsciiString& SchemaName (const Standard_Integer num) const;
//! Returns the Protocol which corresponds to a Schema Name
//! Returns a Null Handle if this Schema Name is attached to no
//! Protocol recorded in the Global List of ReaderLib
Standard_EXPORT Handle(StepData_Protocol) NamedProtocol (const TCollection_AsciiString& name) const;
//! Fills a FileProtocol with the list of Protocols attached to
//! the list of Schema Names. It can remain empty ...
Standard_EXPORT void Build (const Handle(StepData_FileProtocol)& protocol);
//! Returns a Protocol computed from the list of Schema Names :
//! - a Null Handle if no SchemaName has been recognized (or list
//! empty)
//! - a single Protocol if only one SchemaName has been recognized
//! - a FileProtocol with its componants if several SchemaNames
//! have been recognized
Standard_EXPORT Handle(StepData_Protocol) Protocol();
//! Returns True if either Build or Protocol has been called
//! If it is False, Ignored and NbIgnored should not be called
Standard_EXPORT Standard_Boolean IsDone() const;
//! Returns the count of ignored SchemaNames (0 if all were OK)
Standard_EXPORT Standard_Integer NbIgnoreds() const;
//! Returns an ignored SchemaName, given its rank in the list of
//! Ignored SchemaNames (not in the total list)
Standard_EXPORT const TCollection_AsciiString& Ignored (const Standard_Integer num) const;
//! Sends the state of the HeaderTool in a comprehensive way,
//! to an output stream
Standard_EXPORT void Print (Standard_OStream& S) const;
protected:
private:
TColStd_SequenceOfAsciiString thenames;
Standard_Boolean thedone;
TColStd_SequenceOfAsciiString theignored;
};
#endif // _StepData_HeaderTool_HeaderFile

View File

@@ -21,8 +21,6 @@
#include <StepData_SelectNamed.hxx>
#include <StepData_SelectReal.hxx>
#include <StepData_SelectType.hxx>
#include <StepData_UndefinedEntity.hxx>
Standard_Boolean StepData_SelectType::Matches
(const Handle(Standard_Transient)& ent) const
@@ -37,8 +35,6 @@ Standard_Boolean StepData_SelectType::Matches
void StepData_SelectType::SetValue (const Handle(Standard_Transient)& ent)
{
if (ent.IsNull()) thevalue.Nullify();
else if (ent->IsKind(STANDARD_TYPE(StepData_UndefinedEntity)))
thevalue = ent;
else if (!Matches(ent))
throw Standard_TypeMismatch("StepData : SelectType, SetValue");
else thevalue = ent;

View File

@@ -141,22 +141,11 @@ void StepData_StepModel::SetIdentLabel
Standard_Integer num = Number(ent);
if (!num)
return;
Standard_Integer nbEnt = NbEntities();
if(theidnums.IsNull())
{
theidnums = new TColStd_HArray1OfInteger(1,nbEnt);
theidnums = new TColStd_HArray1OfInteger(1, NbEntities());
theidnums->Init(0);
}
else if(nbEnt > theidnums->Length())
{
Standard_Integer prevLength = theidnums->Length();
Handle(TColStd_HArray1OfInteger) idnums1 = new TColStd_HArray1OfInteger(1,nbEnt);
idnums1->Init(0);
Standard_Integer k =1;
for( ; k <= prevLength; k++)
idnums1->SetValue(k , theidnums->Value(k));
theidnums = idnums1;
}
theidnums->SetValue(num,ident);
}

View File

@@ -19,6 +19,7 @@
#include <Interface_HArray1OfHAsciiString.hxx>
#include <Interface_Macros.hxx>
#include <Interface_ParamList.hxx>
#include <Interface_Static.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <Standard_Transient.hxx>
@@ -45,7 +46,6 @@
#include <TColStd_HSequenceOfReal.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <StepData_UndefinedEntity.hxx>
#include <stdio.h>
IMPLEMENT_STANDARD_RTTIEXT(StepData_StepReaderData, Interface_FileReaderData)
@@ -117,6 +117,7 @@ StepData_StepReaderData::StepData_StepReaderData
thenbscop = 0; thenbents = 0; thelastn = 0; thenbhead = nbheader;
//themults.Init(0);
thecheck = new Interface_Check;
//:S4136 acceptvoid = Interface_Static::IVal("step.readaccept.void");
if (initstr) return;
//for (Standard_Integer i = 0; i < Maxlst; i ++) {
// sprintf(textnum,"$%d",i+1);
@@ -998,8 +999,8 @@ Standard_Boolean StepData_StepReaderData::ReadReal(const Standard_Integer num,
Handle(String) errmess; // Null si pas d erreur
if (nump > 0 && nump <= NbParams(num)) {
const Interface_FileParameter& FP = Param(num, nump);
if (FP.ParamType() == Interface_ParamReal || FP.ParamType() == Interface_ParamInteger)
val = Interface_FileReaderData::Fastof(FP.CValue());
if (FP.ParamType() == Interface_ParamReal) val =
Interface_FileReaderData::Fastof(FP.CValue());
else errmess = new String("Parameter n0.%d (%s) not a Real");
}
else errmess = new String("Parameter n0.%d (%s) absent");
@@ -1034,14 +1035,10 @@ Standard_Boolean StepData_StepReaderData::ReadEntity(const Standard_Integer num,
if (FP.ParamType() == Interface_ParamIdent) {
warn = (acceptvoid > 0);
if (nent > 0) {
Handle(Standard_Transient) entent = BoundEntity(nent);
Handle(Standard_Transient) entent = BoundEntity(nent);
if (entent.IsNull() || !entent->IsKind(atype))
{
errmess = new String("Parameter n0.%d (%s) : Entity has illegal type");
if (entent->IsKind(STANDARD_TYPE(StepData_UndefinedEntity)))
ent = entent;
}
else ent = entent;
else ent = entent;
}
else errmess = new String("Parameter n0.%d (%s) : Unresolved reference");
}
@@ -1082,15 +1079,10 @@ Standard_Boolean StepData_StepReaderData::ReadEntity(const Standard_Integer num,
if (FP.ParamType() == Interface_ParamIdent) {
warn = (acceptvoid > 0);
if (nent > 0) {
Handle(Standard_Transient) entent = BoundEntity(nent);
Handle(Standard_Transient) entent = BoundEntity(nent);
if (!sel.Matches(entent))
{
errmess = new String("Parameter n0.%d (%s) : Entity has illegal type");
//fot not suppported STEP entity
if (entent->IsKind(STANDARD_TYPE(StepData_UndefinedEntity)))
sel.SetValue(entent);
}
else
else
sel.SetValue(entent);
}
else

View File

@@ -70,16 +70,8 @@ Standard_Integer StepSelect_WorkLibrary::ReadFile
long status = 1;
DeclareAndCast(StepData_Protocol,stepro,protocol);
if (stepro.IsNull()) return 1;
Handle(StepData_StepModel) stepmodel;
if(!model.IsNull())
stepmodel = Handle(StepData_StepModel)::DownCast(model);
if(stepmodel.IsNull())
{
stepmodel = new StepData_StepModel;
model = stepmodel;
}
Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
model = stepmodel;
StepFile_ReadTrace (0);
char *pName=(char *)name;
status = StepFile_Read (pName,stepmodel,stepro);

View File

@@ -105,7 +105,7 @@ static void RemovePCurves(const TopoDS_Wire& aWire, const TopoDS_Face& aFace)
TopExp_Explorer EdgeExp(aWire, TopAbs_EDGE);
while (EdgeExp.More()) {
const TopoDS_Edge& myEdge = TopoDS::Edge(EdgeExp.Current());
RemoveSinglePCurve(myEdge, aFace);
RemoveSinglePCurve(myEdge,aFace);
EdgeExp.Next();
}
}
@@ -117,17 +117,17 @@ static void RemovePCurves(const TopoDS_Wire& aWire, const TopoDS_Face& aFace)
// ============================================================================
static void CheckPCurves (TopoDS_Wire& aWire, const TopoDS_Face& aFace,
const Standard_Boolean isPlane, const Standard_Real preci)
const Standard_Boolean isPlane,const Standard_Real preci )
{
if (isPlane) { RemovePCurves (aWire, aFace);return; }
if (isPlane) { RemovePCurves (aWire,aFace);return; }
BRep_Builder B;
Standard_Real w1, w2, cf, cl;
Handle(Geom_Surface) mySurf = BRep_Tool::Surface(aFace);
Handle(ShapeExtend_WireData) sbwd = new ShapeExtend_WireData (aWire);
Handle(ShapeExtend_WireData) sbwd = new ShapeExtend_WireData ( aWire );
for (Standard_Integer i = 1; i <= sbwd->NbEdges(); i++) {
const TopoDS_Edge& myEdge = sbwd->Edge(i);
// First Check : 2D Parameters on Edge :
// Case 1 : w1 == w2 illegal => Drop the PCurve
// Case 2 : on bounded curve w1 < FirstParameter => w1 = FirstParameter
@@ -135,46 +135,42 @@ static void CheckPCurves (TopoDS_Wire& aWire, const TopoDS_Face& aFace,
Handle(Geom2d_Curve) thePC;
ShapeAnalysis_Edge sae;
if (!sae.PCurve (myEdge, aFace, thePC, w1, w2, Standard_False)) {
if (!sae.PCurve (myEdge, aFace, thePC, w1, w2, Standard_False )) {
continue;
}
cf = thePC->FirstParameter();
cl = thePC->LastParameter();
if (w1 == w2) {
RemoveSinglePCurve(myEdge, aFace);
RemoveSinglePCurve(myEdge,aFace);
#ifdef OCCT_DEBUG
std::cout<<"Removing pcuve w1=w2"<<std::endl;
#endif
continue;
}
//check parameters of range only for not periodic curves
if (!thePC->IsPeriodic())
{
if (w1 < cf) {
B.Range(myEdge, aFace, cf, w2);
w1 = cf;
}
if (w2 > cl) {
B.Range(myEdge, aFace, w1, cl);
w2 = cl;
}
if (w1 < cf) {
B.Range(myEdge, aFace, cf, w2);
w1 = cf;
}
if (w2 > cl) {
B.Range(myEdge, aFace, w1, cl);
w2 = cf;
}
if (w1 > w2 && mySurf->IsUPeriodic())
{
Standard_Real u1, u2, v1, v2;
mySurf->Bounds(u1, u2, v1, v2);
ElCLib::AdjustPeriodic(u1, u2,
Min(Abs(w2-w1)/2, Precision::PConfusion()),
Standard_Real u1,u2,v1,v2;
mySurf->Bounds(u1,u2,v1,v2);
ElCLib::AdjustPeriodic(u1, u2,
Min(Abs(w2-w1)/2,Precision::PConfusion()),
w1, w2);
B.Range(myEdge, aFace, w1, w2);
B.Range(myEdge, aFace, w1, w2);
}
// advanced check
XSAlgo::AlgoContainer()->CheckPCurve (myEdge, aFace, preci, sbwd->IsSeam(i));
XSAlgo::AlgoContainer()->CheckPCurve (myEdge, aFace, preci, sbwd->IsSeam(i) );
}
}
@@ -193,13 +189,13 @@ StepToTopoDS_TranslateEdgeLoop::StepToTopoDS_TranslateEdgeLoop()
// Purpose : Constructor with a FaceSurface and a Tool
// ============================================================================
StepToTopoDS_TranslateEdgeLoop::StepToTopoDS_TranslateEdgeLoop(const Handle(StepShape_FaceBound)& FB,
const TopoDS_Face& Face,
const Handle(Geom_Surface)& GeomSurf,
const Handle(StepGeom_Surface)& StepSurf,
const Standard_Boolean sameSense,
StepToTopoDS_Tool& T,
StepToTopoDS_NMTool& NMTool) {
StepToTopoDS_TranslateEdgeLoop::StepToTopoDS_TranslateEdgeLoop(const Handle(StepShape_FaceBound)& FB,
const TopoDS_Face& Face,
const Handle(Geom_Surface)& GeomSurf,
const Handle(StepGeom_Surface)& StepSurf,
const Standard_Boolean sameSense,
StepToTopoDS_Tool& T,
StepToTopoDS_NMTool& NMTool) {
Init(FB, Face, GeomSurf, StepSurf, sameSense, T, NMTool);
}
@@ -208,15 +204,15 @@ StepToTopoDS_TranslateEdgeLoop::StepToTopoDS_TranslateEdgeLoop(const Handle(Step
// Purpose : Init with a EdgeLoop and a Tool
// ============================================================================
void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& FaceBound,
const TopoDS_Face& Face,
const Handle(Geom_Surface)& GeomSurf,
const Handle(StepGeom_Surface)& StepSurf,
const Standard_Boolean sameSense,
StepToTopoDS_Tool& aTool,
StepToTopoDS_NMTool& NMTool) {
void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& FaceBound,
const TopoDS_Face& Face,
const Handle(Geom_Surface)& GeomSurf,
const Handle(StepGeom_Surface)& StepSurf,
const Standard_Boolean sameSense,
StepToTopoDS_Tool& aTool,
StepToTopoDS_NMTool& NMTool) {
done = Standard_True;
Handle(StepShape_EdgeLoop) EL =
Handle(StepShape_EdgeLoop) EL =
Handle(StepShape_EdgeLoop)::DownCast(FaceBound->Bound());
if (aTool.IsBound(EL)) {
@@ -226,33 +222,34 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
return;
}
Standard_Integer modepcurve = Interface_Static::IVal("read.surfacecurve.mode");
// 0,1 : suivre le code, 2 : ne prendre que pcurve, 3 : ne prendre que C3D
// 0,1 : suivre le code, 2 : ne prendre que pcurve, 3 : ne prendre que C3D
BRep_Builder B;
Handle(Transfer_TransientProcess) TP = aTool.TransientProcess();
Standard_Real preci = Precision();
TopoDS_Wire W;
TopoDS_Edge E;
TopoDS_Vertex V;
Standard_Boolean isSeam, isLikeSeam;
Handle(StepShape_Edge) StepEdge, StepEdge1;
Handle(StepShape_OrientedEdge) OrEdge1, OrEdge2;
Handle(StepGeom_Curve) StepCurve, StepCurve1, StepCurve2;
Handle(StepRepr_DefinitionalRepresentation) DRI, Dri1, Dri2;
Handle(Geom2d_Curve) C2d, C2d1, C2d2, WhichC2d1, WhichC2d2;
TopoDS_Edge suspectE; //:f1, degEdge;
Standard_Integer j, NbEdge = EL->NbEdgeList();
if (NbEdge == 0) {
TP->AddWarning(EL, "Wire not done. EdgeLoop does not contain edges.");
if( NbEdge == 0) {
TP->AddWarning(EL,"Wire not done. EdgeLoop does not contain edges.");
done = Standard_False;
return;
}
// PTV 16.09.2000
// default value set as Standard_True (if not correct see logic of algorithm).
// PTV 16.09.2000
// default value set as Standard_True (if not correct see logic of algorithm).
Standard_Boolean hasPcurve = Standard_True;
Standard_Boolean isPlane = GeomSurf->IsKind(STANDARD_TYPE(Geom_Plane));
Handle(Geom_Surface) ConvSurf = GeomSurf;
@@ -263,7 +260,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
}
aTool.ComputePCurve(Standard_False);
// What is the Wire Orientation
Standard_Boolean ForwardWire = FaceBound->Orientation();
@@ -280,23 +277,15 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
// This case may not be processed, PCurves has to be recomputed from scratch
// -----------------------------------------------
// Standard_Integer theSame = 1; //gka 15.12.98
for (j=1; j<=NbEdge; j++) {
for (j=1; j<=NbEdge; j++ ) {
OrEdge1 = EL->EdgeListValue(j);
// see bug #29979: oriented edge contains another oriented edge
if (OrEdge1->EdgeElement()->IsKind (STANDARD_TYPE(StepShape_OrientedEdge)))
OrEdge1 = Handle(StepShape_OrientedEdge)::DownCast (OrEdge1->EdgeElement());
Handle(StepShape_EdgeCurve) EC = Handle(StepShape_EdgeCurve)::DownCast(OrEdge1->EdgeElement());
if (EC.IsNull())
{
TP->AddWarning (OrEdge1, "Edge does not contain EDGE_CURVE, skipped");
continue;
}
StepEdge = OrEdge1->EdgeElement();
// if(j>1 && StepEdge == StepEdge1) theSame++; //gka 15.12.98
StepEdge1 = StepEdge; //
Handle(StepShape_EdgeCurve) EC = Handle(StepShape_EdgeCurve)::DownCast(StepEdge);
Handle(StepGeom_Curve) C = EC->EdgeGeometry();
if (!C.IsNull()) {
if (!C.IsNull()){
if (C->IsKind(STANDARD_TYPE(StepGeom_SurfaceCurve))) {
Handle(StepGeom_SurfaceCurve) Sc = Handle(StepGeom_SurfaceCurve)::DownCast(C);
C = Sc->Curve3d();
@@ -307,13 +296,13 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
try
{
OCC_CATCH_SIGNALS
C1 = Handle(Geom_Curve)::DownCast (TP->FindTransient(C));
C1 = Handle(Geom_Curve)::DownCast (TP->FindTransient(C));
if (C1.IsNull()) {
C1 = StepToGeom::MakeCurve (C);
if (! C1.IsNull())
TP->BindTransient (C, C1);
TP->BindTransient (C,C1);
else
TP->AddWarning(C, "Could not convert a curve. Curve definition is incorrect");
TP->AddWarning(C,"Could not convert a curve. Curve definition is incorrect");
}
}
catch (Standard_Failure const& anException) {
@@ -322,7 +311,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
anException.Print(std::cout); std::cout << std::endl;
#endif
(void)anException;
TP->AddFail(C, "Exeption was raised. Curve geometry definition is incorrect");
TP->AddFail(C,"Exeption was raised. Curve geometry definition is incorrect");
}
}
@@ -349,14 +338,14 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
V2 = TopoDS::Vertex(myTranVertex2.Value());
gp_Pnt p1 = BRep_Tool::Pnt(V1);
gp_Pnt p2 = BRep_Tool::Pnt(V2);
if (p1.Distance(p2) <= Precision::Confusion()) { //:S4136: preci) {
Standard_Boolean Fixed = Standard_True;
if (!iseV) aTool.Bind(Vend, V1); //gka 21.08.1998 bug PRO7656
else if (!istV) aTool.Bind (Vstart, V2);
else aTool.Bind (Vend, V1);
if (!C1.IsNull() && !C1->IsClosed() && Fixed)
TP->AddWarning(EL->EdgeListValue(j),
"Vertex of same coordinates, set confused");
if (p1.Distance(p2) <= Precision::Confusion() ) { //:S4136: preci) {
Standard_Boolean Fixed = Standard_True;
if(!iseV) aTool.Bind(Vend,V1); //gka 21.08.1998 bug PRO7656
else if(!istV) aTool.Bind (Vstart,V2);
else aTool.Bind (Vend,V1);
if (!C1.IsNull() && !C1->IsClosed() && Fixed)
TP->AddWarning(EL->EdgeListValue(j),
"Vertex of same coordinates, set confused");
}
}
}
@@ -366,100 +355,88 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
// and make it be one vertex
// NOTE: this is done only for the case if at least one of edges
// was not yet translated; else nothing will help
for (j=1; j<=NbEdge; j++) {
OrEdge1 = EL->EdgeListValue (j);
OrEdge2 = EL->EdgeListValue (j < NbEdge ? j + 1 : 1);
Handle(StepShape_EdgeCurve) EC1 =
Handle(StepShape_EdgeCurve)::DownCast (OrEdge1->EdgeElement());
Handle(StepShape_EdgeCurve) EC2 =
Handle(StepShape_EdgeCurve)::DownCast (OrEdge2->EdgeElement());
if (EC1.IsNull() || EC2.IsNull()) // see #29979
{
continue;
}
for (j=1; j<=NbEdge; j++ ) {
OrEdge1 = EL->EdgeListValue ( j );
OrEdge2 = EL->EdgeListValue ( j < NbEdge ? j + 1 : 1 );
Handle(StepShape_EdgeCurve) EC1 =
Handle(StepShape_EdgeCurve)::DownCast ( OrEdge1->EdgeElement() );
Handle(StepShape_EdgeCurve) EC2 =
Handle(StepShape_EdgeCurve)::DownCast ( OrEdge2->EdgeElement() );
Handle(StepShape_Vertex) Vs1, Vs2, Vs11, Vs22;
Vs1 = (OrEdge1->Orientation() ? EC1->EdgeEnd() : EC1->EdgeStart());
Vs2 = (OrEdge2->Orientation() ? EC2->EdgeStart() : EC2->EdgeEnd());
Handle(StepShape_Vertex) Vs1, Vs2,Vs11,Vs22;
Vs1 = ( OrEdge1->Orientation() ? EC1->EdgeEnd() : EC1->EdgeStart() );
Vs2 = ( OrEdge2->Orientation() ? EC2->EdgeStart() : EC2->EdgeEnd() );
Vs11 = (OrEdge1->Orientation() ? EC1->EdgeStart() : EC1->EdgeEnd());
Vs22 = (OrEdge2->Orientation() ? EC2->EdgeEnd() : EC2->EdgeStart());
Vs11 = ( OrEdge1->Orientation() ? EC1->EdgeStart() : EC1->EdgeEnd());
Vs22 = ( OrEdge2->Orientation() ? EC2->EdgeEnd() : EC2->EdgeStart() );
if ((Vs1 == Vs2) || (Vs1 == Vs22) || (Vs2 == Vs11) || (Vs22 == Vs11)) continue;
if((Vs1 == Vs2) || (Vs1 == Vs22) || (Vs2 == Vs11) || (Vs22 == Vs11)) continue;
StepToTopoDS_TranslateVertex myTranVertex1 (Vs1, aTool, NMTool);
StepToTopoDS_TranslateVertex myTranVertex2 (Vs2, aTool, NMTool);
TopoDS_Vertex V1, V2;
if (myTranVertex1.IsDone())
V1 = TopoDS::Vertex (myTranVertex1.Value());
if (myTranVertex2.IsDone())
V2 = TopoDS::Vertex (myTranVertex2.Value());
if (V1.IsNull() || V2.IsNull()) continue; // not treated
if (V1.IsSame(V2)) continue; // OK
if ( myTranVertex1.IsDone() )
V1 = TopoDS::Vertex ( myTranVertex1.Value() );
if ( myTranVertex2.IsDone() )
V2 = TopoDS::Vertex ( myTranVertex2.Value() );
if ( V1.IsNull() || V2.IsNull() ) continue; // not treated
if ( V1.IsSame(V2) ) continue; // OK
gp_Pnt p1 = BRep_Tool::Pnt(V1);
gp_Pnt p2 = BRep_Tool::Pnt(V2);
Standard_Boolean locFixed = Standard_True;
if (p1.Distance(p2) <= preci) {
if (! aTool.IsBound (EC1)) aTool.Bind (Vs1, V2);
else if (! aTool.IsBound (EC2)) aTool.Bind (Vs2, V1);
if ( ! aTool.IsBound ( EC1 ) ) aTool.Bind ( Vs1, V2 );
else if ( ! aTool.IsBound ( EC2 ) ) aTool.Bind ( Vs2, V1 );
else locFixed = Standard_False;
}
else locFixed = Standard_False;
if (locFixed) TP->AddWarning(EL, "Adjacent edges do not have common vertex; set confused");
else TP->AddWarning(EL, "Adjacent edges are not connected");
if ( locFixed ) TP->AddWarning(EL,"Adjacent edges do not have common vertex; set confused");
else TP->AddWarning(EL,"Adjacent edges are not connected");
}
// -----------------------------------------------
// Iteration on each Oriented Edge of the EdgeLoop
// -----------------------------------------------
for (j=1; j<=NbEdge; j++) {
for (j=1; j<=NbEdge; j++ ) {
Standard_Boolean ThereIsLikeSeam = Standard_False;
#ifdef OCCT_DEBUG
std::cout << " Processing Edge :" << j << std::endl;
#endif
OrEdge1 = EL->EdgeListValue(j);
// see bug #29979: oriented edge contains another oriented edge
if (OrEdge1->EdgeElement()->IsKind (STANDARD_TYPE(StepShape_OrientedEdge)))
OrEdge1 = Handle(StepShape_OrientedEdge)::DownCast (OrEdge1->EdgeElement());
Handle(StepShape_EdgeCurve) EC = Handle(StepShape_EdgeCurve)::DownCast(OrEdge1->EdgeElement());
if (EC.IsNull())
{
continue;
}
StepEdge = OrEdge1->EdgeElement();
Handle(StepShape_EdgeCurve) EC = Handle(StepShape_EdgeCurve)::DownCast(StepEdge);
// ----------------
// Map the StepEdge
// ----------------
StepToTopoDS_TranslateEdge myTranEdge;
myTranEdge.SetPrecision(preci);
myTranEdge.SetMaxTol(MaxTol());
myTranEdge.Init(OrEdge1, aTool, NMTool);
if (myTranEdge.IsDone()) {
E = TopoDS::Edge(myTranEdge.Value());
if (E.IsNull()) continue; // NULL, on saute
Handle(StepGeom_Curve) C = EC->EdgeGeometry();
if (OrEdge1->Orientation() && EC->SameSense())
E.Orientation(TopAbs_FORWARD);
if (OrEdge1->Orientation() && EC->SameSense())
E.Orientation(TopAbs_FORWARD);
else if (!OrEdge1->Orientation() && !EC->SameSense())
E.Orientation(TopAbs_FORWARD);
E.Orientation(TopAbs_FORWARD);
else E.Orientation(TopAbs_REVERSED);
isSeam = isLikeSeam = Standard_False;
// ------------------------------------------
// Map the StepEdge parametric representation
// ------------------------------------------
@@ -510,9 +487,9 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
// --- or is like a seam curve ---
// --- (see CATIA cylinder) ---
// -------------------------------------------
isLikeSeam = StepToTopoDS_GeometricTool::IsLikeSeam(SurfCurve, StepSurf, EC, EL);
isLikeSeam = StepToTopoDS_GeometricTool::IsLikeSeam(SurfCurve, StepSurf, StepEdge, EL);
isSeam = StepToTopoDS_GeometricTool::IsSeamCurve(SurfCurve, StepSurf, EC, EL);
isSeam = StepToTopoDS_GeometricTool::IsSeamCurve(SurfCurve, StepSurf, StepEdge, EL);
if (isSeam || isLikeSeam) {
// isLikeSeam = Two faces on the same Surface
@@ -551,7 +528,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
aTool.ComputePCurve(Standard_True);
}
}
// ----------------------------------------------------------
// CASE 3 : The EdgeCurve Geometry is not a Pcurve
// nor a SurfaceCurve (i.e. it is a single 3D curve)
@@ -561,7 +538,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
aTool.ComputePCurve(Standard_True);
hasPcurve = Standard_False;
}
// ----------------------------------
// update the edge with the pcurve(s)
// ----------------------------------
@@ -589,7 +566,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
Standard_Integer forwardPC =
ShapeAnalysis_Curve().SelectForwardSeam(C2d1, C2d2);
if (forwardPC == 0) {
TP->AddFail(EC, " Seam curve not mapped");
TP->AddFail(StepEdge, " Seam curve not mapped");
done = Standard_False;
myError = StepToTopoDS_TranslateEdgeLoopOther;
continue;
@@ -621,7 +598,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
}
}
else {
TP->AddFail(EC, " Seam curve not mapped");
TP->AddFail(StepEdge, " Seam curve not mapped");
done = Standard_False;
myError = StepToTopoDS_TranslateEdgeLoopOther;
continue;
@@ -638,7 +615,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
B.UpdateEdge(E, C2d, Face, 0.);
}
else {
TP->AddFail(EC, " Edge: Trimming of 2D curve failed");
TP->AddFail(StepEdge, " Edge: Trimming of 2D curve failed");
done = Standard_False;
myError = StepToTopoDS_TranslateEdgeLoopOther;
continue;
@@ -647,25 +624,25 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
}
if (E.IsNull()) {
TP->AddFail(EC, " an Edge not mapped");
TP->AddFail(StepEdge, " an Edge not mapped");
done = Standard_False;
myError = StepToTopoDS_TranslateEdgeLoopOther;
}
}
else { // The Edge is Not mapped => switch to next wire ?
TP->AddFail(EC," an Edge not mapped");
TP->AddFail(StepEdge," an Edge not mapped");
done = Standard_False;
myError = StepToTopoDS_TranslateEdgeLoopOther;
}
if (done) B.Add (W, E); // on le fait ici. Sauf si erreur rencontree ... !
if (done) B.Add (W,E); // on le fait ici. Sauf si erreur rencontree ... !
else {
Handle(StepShape_Vertex) Vs1, Vs2;
Vs1 = EC->EdgeStart();
Vs2 = EC->EdgeEnd();
if (!Vs1.IsNull() && !Vs2.IsNull() && Vs1==Vs2) {
Vs1 = StepEdge->EdgeStart();
Vs2 = StepEdge->EdgeEnd();
if(!Vs1.IsNull() && !Vs2.IsNull() && Vs1==Vs2) {
done = Standard_True;
TP->AddFail(EL, " Edge with equal vertices failed, scipped");
TP->AddFail(EL," Edge with equal vertices failed, scipped");
}
}
}
@@ -673,18 +650,18 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
// The EdgeLoop is binded in the Wire
if (!done) {
TP->AddFail(EL, "At least one edge failed : wire not done");
TP->AddFail(EL,"At least one edge failed : wire not done");
return;
}
W.Closed (BRep_Tool::IsClosed (W));
aTool.Bind(EL, W);
// ----------------------------------------------
// Computes the 2D parameter of Vertices on Edges
// ----------------------------------------------
//pdn compute parameter of Vertices using projecting
if (!aTool.ComputePCurve())
for (TopoDS_Iterator EdgeIt(W);EdgeIt.More();EdgeIt.Next()) {
if (!aTool.ComputePCurve())
for (TopoDS_Iterator EdgeIt(W);EdgeIt.More();EdgeIt.Next()){
TopoDS_Edge edge = TopoDS::Edge(EdgeIt.Value());
Handle(ShapeFix_EdgeProjAux) myEdgePro = ShapeAlgo::AlgoContainer()->ToolContainer()->EdgeProjAux();
myEdgePro->Init (Face, edge);
@@ -692,7 +669,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
if (myEdgePro->IsFirstDone() && myEdgePro->IsLastDone()) {
if (Abs (myEdgePro->FirstParam() - myEdgePro->LastParam()) < Precision::PConfusion())
continue;
B.Range(edge, Face, myEdgePro->FirstParam(), myEdgePro->LastParam());
B.Range(edge, Face,myEdgePro->FirstParam(), myEdgePro->LastParam());
}
else {
RemoveSinglePCurve(edge, Face);
@@ -700,13 +677,13 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
std::cout <<"Removing after prj"<<std::endl;
#endif
}
}
}
myResult = W;
myError = StepToTopoDS_TranslateEdgeLoopDone;
done = Standard_True;
// Check des PCurves SYSTEMATIQUE, s il n y en a que quelques unes
CheckPCurves (W, Face, isPlane, preci);
CheckPCurves (W, Face,isPlane,preci);
return;
}
@@ -717,7 +694,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
// Purpose : Return the mapped Shape
// ============================================================================
const TopoDS_Shape& StepToTopoDS_TranslateEdgeLoop::Value() const
const TopoDS_Shape& StepToTopoDS_TranslateEdgeLoop::Value() const
{
StdFail_NotDone_Raise_if (!done, "StepToTopoDS_TranslateEdgeLoop::Value() - no result");
return myResult;

View File

@@ -91,7 +91,7 @@ V3d_Trihedron::V3d_Trihedron()
// Set material.
Graphic3d_MaterialAspect aShadingMaterial;
aShadingMaterial.SetSpecularColor(Quantity_NOC_BLACK);
aShadingMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
aShadingMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)

View File

@@ -1964,6 +1964,12 @@ struct ViewerTest_AspectsChangeSet
std::cout << "Error: alpha cutoff value should be within (0; 1) range (specified " << AlphaCutoff << ")\n";
isOk = Standard_False;
}
if (ToSetMaterial == 1
&& Material == Graphic3d_NOM_DEFAULT)
{
std::cout << "Error: unknown material " << MatName << ".\n";
isOk = Standard_False;
}
if (FreeBoundaryWidth <= 0.0
|| FreeBoundaryWidth > 10.0)
{
@@ -2415,13 +2421,9 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
return 1;
}
aChangeSet->ToSetMaterial = 1;
aChangeSet->MatName = aNames.Last();
aChangeSet->MatName = aNames.Last();
aChangeSet->Material = Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString());
aNames.Remove (aNames.Length());
if (!Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString(), aChangeSet->Material))
{
std::cout << "Syntax error: unknown material '" << aChangeSet->MatName << "'.\n";
return 1;
}
}
else if (aCmdName == "vunsetmaterial")
{
@@ -2859,12 +2861,8 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
return 1;
}
aChangeSet->ToSetMaterial = 1;
aChangeSet->MatName = theArgVec[anArgIter];
if (!Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString(), aChangeSet->Material))
{
std::cout << "Syntax error: unknown material '" << aChangeSet->MatName << "'.\n";
return 1;
}
aChangeSet->MatName = theArgVec[anArgIter];
aChangeSet->Material = Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString());
}
else if (anArg == "-unsetmat"
|| anArg == "-unsetmaterial")
@@ -6610,7 +6608,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
"\n\t\t: [-isoontriangulation 0|1]"
"\n\t\t: [-setMaxParamValue {value}]"
"\n\t\t: [-setSensitivity {selection_mode} {value}]"
"\n\t\t: [-setShadingModel {unlit|flat|gouraud|phong}]"
"\n\t\t: [-setShadingModel {color|flat|gouraud|phong}]"
"\n\t\t: [-unsetShadingModel]"
"\n\t\t: [-setInterior {solid|hatch|hidenline|point}]"
"\n\t\t: [-unsetInterior] [-setHatch HatchStyle]"
@@ -6625,9 +6623,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
"\n\t\t: When -defaults is specified than presentation properties will be"
"\n\t\t: assigned to all objects that have not their own specified properties"
"\n\t\t: and to all objects to be displayed in the future."
"\n\t\t: If -defaults is used there should not be any objects' names and -subshapes specifier."
"\n\t\t: See also vlistcolors and vlistmaterials to list named colors and materials"
"\n\t\t: accepted by arguments -setMaterial and -setColor",
"\n\t\t: If -defaults is used there should not be any objects' names and -subshapes specifier.",
__FILE__,VAspects,group);
theCommands.Add("vsetcolor",

View File

@@ -3048,8 +3048,8 @@ static int VDrawSphere (Draw_Interpretor& /*di*/, Standard_Integer argc, const c
// Setting material properties, very important for desirable visual result!
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_PLASTIC);
aMat.SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (0.04f)));
aMat.SetSpecularColor(Quantity_Color (Graphic3d_Vec3 (0.50f)));
aMat.SetAmbient (0.2f);
aMat.SetSpecular (0.5f);
Handle(Graphic3d_AspectFillArea3d) anAspect
= new Graphic3d_AspectFillArea3d (Aspect_IS_SOLID,
Quantity_NOC_RED,

View File

@@ -22,7 +22,6 @@
#include <Graphic3d_Group.hxx>
#include <Graphic3d_ShaderObject.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <Image_AlienPixMap.hxx>
#include <OpenGl_Aspects.hxx>
#include <OpenGl_Context.hxx>
#include <OpenGl_Element.hxx>
@@ -46,7 +45,6 @@
#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
#include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
#include <OpenGl_Group.hxx>
#include <OSD_OpenFile.hxx>
extern Standard_Boolean VDisplayAISObject (const TCollection_AsciiString& theName,
const Handle(AIS_InteractiveObject)& theAISObj,
@@ -875,466 +873,6 @@ static Standard_Integer VShaderProg (Draw_Interpretor& theDI,
return 0;
}
//! Print triplet of values.
template<class S, class T> static S& operator<< (S& theStream, const NCollection_Vec3<T>& theVec)
{
theStream << theVec[0] << " " << theVec[1] << " " << theVec[2];
return theStream;
}
//! Print 4 values.
template<class S, class T> static S& operator<< (S& theStream, const NCollection_Vec4<T>& theVec)
{
theStream << theVec[0] << " " << theVec[1] << " " << theVec[2] << " " << theVec[3];
return theStream;
}
//! Print fresnel model.
static const char* fresnelModelString (const Graphic3d_FresnelModel theModel)
{
switch (theModel)
{
case Graphic3d_FM_SCHLICK: return "SCHLICK";
case Graphic3d_FM_CONSTANT: return "CONSTANT";
case Graphic3d_FM_CONDUCTOR: return "CONDUCTOR";
case Graphic3d_FM_DIELECTRIC: return "DIELECTRIC";
}
return "N/A";
}
//! Create a colored rectangle SVG element.
static TCollection_AsciiString formatSvgColoredRect (const Quantity_Color& theColor)
{
return TCollection_AsciiString()
+ "<svg width='20px' height='20px'><rect width='20px' height='20px' fill='" + Quantity_Color::ColorToHex (theColor) + "' /></svg>";
}
//==============================================================================
//function : VListMaterials
//purpose :
//==============================================================================
static Standard_Integer VListMaterials (Draw_Interpretor& theDI,
Standard_Integer theArgNb,
const char** theArgVec)
{
TCollection_AsciiString aDumpFile;
NCollection_Sequence<Graphic3d_NameOfMaterial> aMatList;
for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
TCollection_AsciiString anArg (theArgVec[anArgIter]);
anArg.LowerCase();
Graphic3d_NameOfMaterial aMat = Graphic3d_MaterialAspect::MaterialFromName (theArgVec[anArgIter]);
if (aMat != Graphic3d_NOM_DEFAULT)
{
aMatList.Append (aMat);
}
else if (anArg == "*")
{
for (Standard_Integer aMatIter = 0; aMatIter < (Standard_Integer )Graphic3d_NOM_DEFAULT; ++aMatIter)
{
aMatList.Append ((Graphic3d_NameOfMaterial )aMatIter);
}
}
else if (aDumpFile.IsEmpty()
&& (anArg.EndsWith (".obj")
|| anArg.EndsWith (".mtl")
|| anArg.EndsWith (".htm")
|| anArg.EndsWith (".html")))
{
aDumpFile = theArgVec[anArgIter];
}
else
{
std::cout << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n";
return 1;
}
}
if (aMatList.IsEmpty())
{
if (aDumpFile.IsEmpty())
{
for (Standard_Integer aMatIter = 1; aMatIter <= Graphic3d_MaterialAspect::NumberOfMaterials(); ++aMatIter)
{
theDI << Graphic3d_MaterialAspect::MaterialName (aMatIter) << " ";
}
return 0;
}
for (Standard_Integer aMatIter = 0; aMatIter < (Standard_Integer )Graphic3d_NOM_DEFAULT; ++aMatIter)
{
aMatList.Append ((Graphic3d_NameOfMaterial )aMatIter);
}
}
// geometry for dumping
const Graphic3d_Vec3 aBoxVerts[8] =
{
Graphic3d_Vec3( 1, -1, -1),
Graphic3d_Vec3( 1, -1, 1),
Graphic3d_Vec3(-1, -1, 1),
Graphic3d_Vec3(-1, -1, -1),
Graphic3d_Vec3( 1, 1, -1),
Graphic3d_Vec3( 1, 1, 1),
Graphic3d_Vec3(-1, 1, 1),
Graphic3d_Vec3(-1, 1, -1)
};
const Graphic3d_Vec4i aBoxQuads[6] =
{
Graphic3d_Vec4i (1, 2, 3, 4),
Graphic3d_Vec4i (5, 8, 7, 6),
Graphic3d_Vec4i (1, 5, 6, 2),
Graphic3d_Vec4i (2, 6, 7, 3),
Graphic3d_Vec4i (3, 7, 8, 4),
Graphic3d_Vec4i (5, 1, 4, 8)
};
std::ofstream aMatFile, anObjFile, anHtmlFile;
if (aDumpFile.EndsWith (".obj")
|| aDumpFile.EndsWith (".mtl"))
{
const TCollection_AsciiString aMatFilePath = aDumpFile.SubString (1, aDumpFile.Length() - 3) + "mtl";
const TCollection_AsciiString anObjFilePath = aDumpFile.SubString (1, aDumpFile.Length() - 3) + "obj";
OSD_OpenStream (aMatFile, aMatFilePath.ToCString(), std::ios::out | std::ios::binary);
if (!aMatFile.is_open())
{
std::cout << "Error: unable creating material file\n";
return 0;
}
if (!aDumpFile.EndsWith (".mtl"))
{
OSD_OpenStream (anObjFile, anObjFilePath.ToCString(), std::ios::out | std::ios::binary);
if (!anObjFile.is_open())
{
std::cout << "Error: unable creating OBJ file\n";
return 0;
}
TCollection_AsciiString anMtlName, aFolder;
OSD_Path::FolderAndFileFromPath (aMatFilePath, aFolder, anMtlName);
anObjFile << "mtllib " << anMtlName << "\n";
}
}
else if (aDumpFile.EndsWith (".htm")
|| aDumpFile.EndsWith (".html"))
{
OSD_OpenStream (anHtmlFile, aDumpFile.ToCString(), std::ios::out | std::ios::binary);
if (!anHtmlFile.is_open())
{
std::cout << "Error: unable creating HTML file\n";
return 0;
}
anHtmlFile << "<html>\n"
"<head><title>OCCT Material table</title></head>\n"
"<body>\n"
"<table border='1'><tbody>\n"
"<tr>\n"
"<th rowspan='2'><div title='Material name.\n"
"See also Graphic3d_NameOfMaterial enumeration'>"
"Name</div></th>\n"
"<th rowspan='2'><div title='Material type: PHYSIC or ASPECT.\n"
"ASPECT material does not define final colors, it is taken from Internal Color instead.\n"
"See also Graphic3d_TypeOfMaterial enumeration'>"
"Type</div></th>\n"
"<th colspan='5'><div title='Common material definition for Phong shading model'>"
"Common</div></th>\n"
"<th rowspan='2'>Transparency</th>\n"
"<th rowspan='2'>Refraction Index</th>\n"
"<th colspan='9'><div title='BSDF (Bidirectional Scattering Distribution Function).\n"
"Used for physically-based rendering (in path tracing engine).\n"
"BSDF is represented as weighted mixture of basic BRDFs/BTDFs (Bidirectional Reflectance (Transmittance) Distribution Functions).\n"
"See also Graphic3d_BSDF structure.'>"
"BSDF</div></th>\n"
"</tr>\n"
"<tr>\n"
"<th>Ambient</th>\n"
"<th>Diffuse</th>\n"
"<th>Specular</th>\n"
"<th>Emissive</th>\n"
"<th>Shiness</th>\n"
"<th><div title='Weight of coat specular/glossy BRDF'>"
"Kc</div></th>\n"
"<th><div title='Weight of base diffuse BRDF'>"
"Kd</div></th>\n"
"<th><div title='Weight of base specular/glossy BRDF'>"
"Ks</div></th>\n"
"<th><div title='Weight of base specular/glossy BTDF'>"
"Kt</div></th>\n"
"<th><div title='Radiance emitted by the surface'>"
"Le</div></th>\n"
"<th><div title='Volume scattering color/density'>"
"Absorption</div></th>\n"
"<th><div title='Parameters of Fresnel reflectance of coat layer'>"
"FresnelCoat</div></th>\n"
"<th><div title='Parameters of Fresnel reflectance of base layer'>"
"FresnelBase</div></th>\n"
"</tr>\n";
}
else if (!aDumpFile.IsEmpty())
{
std::cout << "Syntax error: unknown output file format\n";
return 1;
}
Standard_Integer aMatIndex = 0, anX = 0, anY = 0;
for (NCollection_Sequence<Graphic3d_NameOfMaterial>::Iterator aMatIter (aMatList); aMatIter.More(); aMatIter.Next(), ++aMatIndex)
{
Graphic3d_MaterialAspect aMat (aMatIter.Value());
const TCollection_AsciiString aMatName = aMat.StringName();
const Graphic3d_Vec3 anAmbient = (Graphic3d_Vec3 )aMat.AmbientColor();
const Graphic3d_Vec3 aDiffuse = (Graphic3d_Vec3 )aMat.DiffuseColor();
const Graphic3d_Vec3 aSpecular = (Graphic3d_Vec3 )aMat.SpecularColor();
const Graphic3d_Vec3 anEmission = (Graphic3d_Vec3 )aMat.EmissiveColor();
const Standard_Real aShiness = aMat.Shininess() * 1000.0;
if (aMatFile.is_open())
{
aMatFile << "newmtl " << aMatName << "\n";
aMatFile << "Ka " << anAmbient << "\n";
aMatFile << "Kd " << aDiffuse << "\n";
aMatFile << "Ks " << aSpecular << "\n";
aMatFile << "Ns " << aShiness << "\n";
if (aMat.Transparency() >= 0.0001)
{
aMatFile << "Tr " << aMat.Transparency() << "\n";
}
aMatFile << "\n";
}
else if (anHtmlFile.is_open())
{
anHtmlFile << "<tr>\n";
anHtmlFile << "<td>" << aMat.StringName() << "</td>\n";
anHtmlFile << "<td>" << (aMat.MaterialType() == Graphic3d_MATERIAL_PHYSIC ? "PHYSIC" : "ASPECT") << "</td>\n";
anHtmlFile << "<td>" << formatSvgColoredRect (Quantity_Color (anAmbient)) << anAmbient << "</td>\n";
anHtmlFile << "<td>" << formatSvgColoredRect (Quantity_Color (aDiffuse)) << aDiffuse << "</td>\n";
anHtmlFile << "<td>" << formatSvgColoredRect (Quantity_Color (aSpecular)) << aSpecular << "</td>\n";
anHtmlFile << "<td>" << formatSvgColoredRect (Quantity_Color (anEmission)) << anEmission << "</td>\n";
anHtmlFile << "<td>" << aMat.Shininess() << "</td>\n";
anHtmlFile << "<td>" << aMat.Transparency() << "</td>\n";
anHtmlFile << "<td>" << aMat.RefractionIndex() << "</td>\n";
anHtmlFile << "<td>" << aMat.BSDF().Kc << "</td>\n";
anHtmlFile << "<td>" << aMat.BSDF().Kd << "</td>\n";
anHtmlFile << "<td>" << aMat.BSDF().Ks << "</td>\n";
anHtmlFile << "<td>" << aMat.BSDF().Kt << "</td>\n";
anHtmlFile << "<td>" << aMat.BSDF().Le << "</td>\n";
anHtmlFile << "<td>" << aMat.BSDF().Absorption << "</td>\n";
anHtmlFile << "<td>" << fresnelModelString (aMat.BSDF().FresnelCoat.FresnelType()) << "</td>\n";
anHtmlFile << "<td>" << fresnelModelString (aMat.BSDF().FresnelBase.FresnelType()) << "</td>\n";
anHtmlFile << "</tr>\n";
}
else
{
theDI << aMat.StringName() << "\n";
theDI << " Common.Ambient: " << anAmbient << "\n";
theDI << " Common.Diffuse: " << aDiffuse << "\n";
theDI << " Common.Specular: " << aSpecular << "\n";
theDI << " Common.Emissive: " << anEmission << "\n";
theDI << " Common.Shiness: " << aMat.Shininess() << "\n";
theDI << " Common.Transparency: " << aMat.Transparency() << "\n";
theDI << " RefractionIndex: " << aMat.RefractionIndex() << "\n";
theDI << " BSDF.Kc: " << aMat.BSDF().Kc << "\n";
theDI << " BSDF.Kd: " << aMat.BSDF().Kd << "\n";
theDI << " BSDF.Ks: " << aMat.BSDF().Ks << "\n";
theDI << " BSDF.Kt: " << aMat.BSDF().Kt << "\n";
theDI << " BSDF.Le: " << aMat.BSDF().Le << "\n";
theDI << " BSDF.Absorption: " << aMat.BSDF().Absorption << "\n";
theDI << " BSDF.FresnelCoat: " << fresnelModelString (aMat.BSDF().FresnelCoat.FresnelType()) << "\n";
theDI << " BSDF.FresnelBase: " << fresnelModelString (aMat.BSDF().FresnelBase.FresnelType()) << "\n";
}
if (anObjFile.is_open())
{
anObjFile << "g " << aMatName << "\n";
anObjFile << "usemtl " << aMatName << "\n";
for (Standard_Integer aVertIter = 0; aVertIter < 8; ++aVertIter)
{
anObjFile << "v " << (aBoxVerts[aVertIter] + Graphic3d_Vec3 (3.0f * anX, -3.0f * anY, 0.0f)) << "\n";
}
anObjFile << "s off\n";
for (Standard_Integer aFaceIter = 0; aFaceIter < 6; ++aFaceIter)
{
anObjFile << "f " << (aBoxQuads[aFaceIter] + Graphic3d_Vec4i (8 * aMatIndex)) << "\n";
}
anObjFile << "\n";
if (++anX > 5)
{
anX = 0;
++anY;
}
}
}
if (anHtmlFile.is_open())
{
anHtmlFile << "</tbody></table>\n</body>\n</html>\n";
}
return 0;
}
//==============================================================================
//function : VListColors
//purpose :
//==============================================================================
static Standard_Integer VListColors (Draw_Interpretor& theDI,
Standard_Integer theArgNb,
const char** theArgVec)
{
TCollection_AsciiString aDumpFile;
NCollection_Sequence<Quantity_NameOfColor> aColList;
for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
TCollection_AsciiString anArg (theArgVec[anArgIter]);
anArg.LowerCase();
Quantity_NameOfColor aName;
if (Quantity_Color::ColorFromName (theArgVec[anArgIter], aName))
{
aColList.Append (aName);
}
else if (anArg == "*")
{
for (Standard_Integer aColIter = 0; aColIter <= (Standard_Integer )Quantity_NOC_WHITE; ++aColIter)
{
aColList.Append ((Quantity_NameOfColor )aColIter);
}
}
else if (aDumpFile.IsEmpty()
&& (anArg.EndsWith (".htm")
|| anArg.EndsWith (".html")))
{
aDumpFile = theArgVec[anArgIter];
}
else
{
std::cout << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'\n";
return 1;
}
}
if (aColList.IsEmpty())
{
if (aDumpFile.IsEmpty())
{
for (Standard_Integer aColIter = 0; aColIter <= (Standard_Integer )Quantity_NOC_WHITE; ++aColIter)
{
theDI << Quantity_Color::StringName (Quantity_NameOfColor (aColIter)) << " ";
}
return 0;
}
for (Standard_Integer aColIter = 0; aColIter <= (Standard_Integer )Quantity_NOC_WHITE; ++aColIter)
{
aColList.Append ((Quantity_NameOfColor )aColIter);
}
}
std::ofstream anHtmlFile;
TCollection_AsciiString aFileNameBase, aFolder;
if (aDumpFile.EndsWith (".htm")
|| aDumpFile.EndsWith (".html"))
{
OSD_Path::FolderAndFileFromPath (aDumpFile, aFolder, aFileNameBase);
aFileNameBase = aFileNameBase.SubString (1, aFileNameBase.Length() - (aDumpFile.EndsWith (".htm") ? 4 : 5));
}
else if (!aDumpFile.IsEmpty())
{
std::cout << "Syntax error: unknown output file format\n";
return 1;
}
Standard_Integer aMaxNameLen = 1;
for (NCollection_Sequence<Quantity_NameOfColor>::Iterator aColIter (aColList); aColIter.More(); aColIter.Next())
{
aMaxNameLen = Max (aMaxNameLen, TCollection_AsciiString (Quantity_Color::StringName (aColIter.Value())).Length());
}
V3d_ImageDumpOptions anImgParams;
anImgParams.Width = 60;
anImgParams.Height = 30;
anImgParams.BufferType = Graphic3d_BT_RGB;
anImgParams.StereoOptions = V3d_SDO_MONO;
anImgParams.ToAdjustAspect = Standard_True;
Handle(V3d_View) aView;
if (!aDumpFile.IsEmpty())
{
ViewerTest::ViewerInit (0, 0, anImgParams.Width, anImgParams.Height, "TmpDriver/TmpViewer/TmpView");
aView = ViewerTest::CurrentView();
aView->SetImmediateUpdate (false);
aView->SetBgGradientStyle (Aspect_GFM_NONE, false);
}
if (!aDumpFile.IsEmpty())
{
OSD_OpenStream (anHtmlFile, aDumpFile.ToCString(), std::ios::out | std::ios::binary);
if (!anHtmlFile.is_open())
{
std::cout << "Error: unable creating HTML file\n";
return 0;
}
anHtmlFile << "<html>\n"
<< "<head><title>OCCT Color table</title></head>\n"
<< "<body>\n"
<< "<table border='1'><tbody>\n"
<< "<tr>\n"
<< "<th>HTML</th>\n"
<< "<th>OCCT</th>\n"
<< "<th>Color name</th>\n"
<< "<th>sRGB hex</th>\n"
<< "<th>sRGB dec</th>\n"
<< "<th>RGB linear</th>\n"
<< "</tr>\n";
}
Image_AlienPixMap anImg;
Standard_Integer aColIndex = 0;
for (NCollection_Sequence<Quantity_NameOfColor>::Iterator aColIter (aColList); aColIter.More(); aColIter.Next(), ++aColIndex)
{
Quantity_Color aCol (aColIter.Value());
const TCollection_AsciiString aColName = Quantity_Color::StringName (aColIter.Value());
const TCollection_AsciiString anSRgbHex = Quantity_Color::ColorToHex (aCol);
const Graphic3d_Vec3i anSRgbInt ((Graphic3d_Vec3 )aCol * 255.0f);
if (anHtmlFile.is_open())
{
const TCollection_AsciiString anImgPath = aFileNameBase + "_" + aColName + ".png";
if (!aView.IsNull())
{
aView->SetImmediateUpdate (false);
aView->SetBackgroundColor (aCol);
if (!aView->ToPixMap (anImg, anImgParams)
|| !anImg.Save (aFolder + anImgPath))
{
theDI << "Error: image dump failed\n";
return 0;
}
}
anHtmlFile << "<tr>\n";
anHtmlFile << "<td style='background-color:" << anSRgbHex << "'><pre> </pre></td>\n";
anHtmlFile << "<td><img src='" << (!aView.IsNull() ? anImgPath : "") << "'></img></td>\n";
anHtmlFile << "<td style='text-align:left'>" << aColName << "</td>\n";
anHtmlFile << "<td style='text-align:left'><pre>" << anSRgbHex << "</pre></td>\n";
anHtmlFile << "<td style='text-align:left'>(" << anSRgbInt.r() << " " << anSRgbInt.g() << " " << anSRgbInt.b() << ")</td>\n";
anHtmlFile << "<td style='text-align:left'>(" << aCol.Red() << " " << aCol.Green() << " " << aCol.Blue() << ")</td>\n";
anHtmlFile << "</tr>\n";
}
else
{
TCollection_AsciiString aColNameLong (aColName);
aColNameLong.RightJustify (aMaxNameLen, ' ');
theDI << aColNameLong << " [" << anSRgbHex << "]: " << aCol.Red() << " " << aCol.Green() << " " << aCol.Blue() << "\n";
}
}
if (!aView.IsNull())
{
ViewerTest::RemoveView (aView);
}
if (anHtmlFile.is_open())
{
anHtmlFile << "</tbody></table>\n</body>\n</html>\n";
}
return 0;
}
//=======================================================================
//function : OpenGlCommands
//purpose :
@@ -1372,18 +910,4 @@ void ViewerTest::OpenGlCommands(Draw_Interpretor& theCommands)
"\n\t\t: -reload restores dump of specified GLSL program",
__FILE__, VShaderProg, aGroup);
theCommands.Add("vshaderprog", "Alias for vshader", __FILE__, VShaderProg, aGroup);
theCommands.Add("vlistmaterials",
"vlistmaterials [*] [MaterialName1 [MaterialName2 [...]]] [dump.obj|dump.html]"
"\n\t\t: Without arguments, command prints the list of standard materials."
"\n\t\t: Otherwise, properties of specified materials will be printed"
"\n\t\t: or dumped into specified file."
"\n\t\t: * can be used to refer to complete list of standard materials.",
__FILE__, VListMaterials, aGroup);
theCommands.Add("vlistcolors",
"vlistcolors [*] [ColorName1 [ColorName2 [...]]] [dump.html]"
"\n\t\t: Without arguments, command prints the list of standard colors."
"\n\t\t: Otherwise, properties of specified colors will be printed"
"\n\t\t: or dumped into specified file."
"\n\t\t: * can be used to refer to complete list of standard colors.",
__FILE__, VListColors, aGroup);
}

View File

@@ -7203,10 +7203,18 @@ public:
const Handle(Graphic3d_AspectFillArea3d)& aFillAspect = myDrawer->ShadingAspect()->Aspect();
Graphic3d_MaterialAspect aMat;
aMat.SetMaterialType (Graphic3d_MATERIAL_PHYSIC);
aMat.SetAmbientColor (Quantity_NOC_BLACK);
aMat.SetDiffuseColor (Quantity_NOC_WHITE);
aMat.SetSpecularColor (Quantity_NOC_BLACK);
aMat.SetEmissiveColor (Quantity_NOC_BLACK);
aMat.SetAmbient (1.0);
aMat.SetDiffuse (1.0);
aMat.SetSpecular (1.0);
aMat.SetEmissive (1.0);
aMat.SetReflectionModeOn (Graphic3d_TOR_AMBIENT);
aMat.SetReflectionModeOn (Graphic3d_TOR_DIFFUSE);
aMat.SetReflectionModeOn (Graphic3d_TOR_SPECULAR);
aMat.SetReflectionModeOn (Graphic3d_TOR_EMISSION);
aMat.SetAmbientColor (Quantity_Color (0.0, 0.0, 0.0, Quantity_TOC_RGB));
aMat.SetDiffuseColor (Quantity_Color (1.0, 1.0, 1.0, Quantity_TOC_RGB));
aMat.SetSpecularColor (Quantity_Color (0.0, 0.0, 0.0, Quantity_TOC_RGB));
aMat.SetEmissiveColor (Quantity_Color (0.0, 0.0, 0.0, Quantity_TOC_RGB));
aFillAspect->SetFrontMaterial (aMat);
aFillAspect->SetTextureMap (new Graphic3d_Texture2Dmanual (theImage));
aFillAspect->SetTextureMapOn();
@@ -9586,22 +9594,13 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
std::cout << "Syntax error: need more arguments.\n";
return 1;
}
aClipPlane->SetCappingColor (aColor);
Graphic3d_MaterialAspect aMat = aClipPlane->CappingMaterial();
aMat.SetAmbientColor (aColor);
aMat.SetDiffuseColor (aColor);
aClipPlane->SetCappingMaterial (aMat);
anArgIter += aNbParsed;
}
else if (aNbChangeArgs >= 1
&& (aChangeArg == "-material"
|| aChangeArg == "material"))
{
++anArgIter;
Graphic3d_NameOfMaterial aMatName;
if (!Graphic3d_MaterialAspect::MaterialFromName (aChangeArgs[1], aMatName))
{
std::cout << "Syntax error: unknown material '" << aChangeArgs[1] << "'.\n";
return 1;
}
aClipPlane->SetCappingMaterial (aMatName);
}
else if ((aChangeArg == "-transparency"
|| aChangeArg == "-transp")
&& aNbChangeArgs >= 2)
@@ -10467,7 +10466,7 @@ static int VDefaults (Draw_Interpretor& theDi,
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
std::cout << "Error: no active viewer\n";
std::cerr << "No active viewer!\n";
return 1;
}
@@ -10536,20 +10535,27 @@ static int VDefaults (Draw_Interpretor& theDi,
|| anArg == "-AUTOTRIANG"
|| anArg == "-AUTOTRIANGULATION")
{
++anArgIter;
bool toTurnOn = true;
if (anArgIter >= theArgsNb
|| !ViewerTest::ParseOnOff (theArgVec[anArgIter], toTurnOn))
if (++anArgIter >= theArgsNb)
{
std::cout << "Syntax error at '" << anArg << "'\n";
std::cout << "Error: wrong syntax at " << anArg << "\n";
return 1;
}
aDefParams->SetAutoTriangulation (toTurnOn);
TCollection_AsciiString aValue (theArgVec[anArgIter]);
aValue.LowerCase();
if (aValue == "on"
|| aValue == "1")
{
aDefParams->SetAutoTriangulation (Standard_True);
}
else if (aValue == "off"
|| aValue == "0")
{
aDefParams->SetAutoTriangulation (Standard_False);
}
}
else
{
std::cout << "Syntax error: unknown argument '" << anArg << "'\n";
return 1;
std::cerr << "Warning, unknown argument '" << anArg.ToCString() << "'\n";
}
}
@@ -14241,7 +14247,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
"\n '-nbtiles 64..1024' Specifies number of screen tiles per Redraw in ISS mode (256 by default)"
"\n '-rebuildGlsl on|off' Rebuild Ray-Tracing GLSL programs (for debugging)"
"\n '-shadingModel model' Controls shading model from enumeration"
"\n unlit, flat, gouraud, phong"
"\n color, flat, gouraud, phong"
"\n '-resolution value' Sets a new pixels density (PPI), defines scaling factor for parameters like text size"
"\n '-aperture >= 0.0' Aperture size of perspective camera for depth-of-field effect (0 disables DOF)"
"\n '-focal >= 0.0' Focal distance of perspective camera for depth-of-field effect"

View File

@@ -378,6 +378,8 @@ void XCAFDoc_GraphNode::Paste(const Handle(TDF_Attribute)& into,
if (!func.IsNull())
{
intof->SetFather(func);
if (func->ChildIndex(this) && !func->ChildIndex(intof))
func->SetChild(intof);
}
}
@@ -391,6 +393,8 @@ void XCAFDoc_GraphNode::Paste(const Handle(TDF_Attribute)& into,
if (!func.IsNull())
{
intof->SetChild(func);
if (func->FatherIndex(this) && !func->FatherIndex(intof))
func->SetFather(intof);
}
}
intof->SetGraphID(myGraphID);

View File

@@ -1,13 +1,28 @@
puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_"
puts "========"
puts "0025923: Remove small wires on face read from STEP"
puts "OCC25923"
puts "========"
puts ""
#############################################
# Remove small wires on face read from STEP
#############################################
smallview
restore [locate_data_file OCC25923_FixSmallWire_Orientation.brep] a
fit
checkshape a
fixshape r a +s +o 1e-3
fixshape r1 a +s +o 1e-3
checkshape r
checknbshapes r -face 1 -wire 2 -edge 32 -vertex 32
fixshape r2 r1 +o
if {[regexp {This shape seems to be valid} [checkshape r1] ]} {
puts "ERRROR: OCC25923 is reproduced. Algorythm of removing small wires on face does not work."
}
if {![regexp {This shape seems to be valid} [checkshape r2] ]} {
puts "ERRROR: OCC25923 is reproduced. Algorythm of removing small wires on face does not work."
}
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,28 +0,0 @@
puts "# ======================================================================"
puts "# 0029334: Simple offsets complicate geometry"
puts "# ======================================================================"
puts "Make box, fillet one of its edges, and extract two planar faces connected by fillet"
box b 10 10 10
explode b e
blend r b 1 b_5
explode r f
compound r_1 r_3 r_6 shape
puts "Offset these faces using simple offset algo"
offsetshapesimple result shape 1
puts "Verify that all faces of the result are either planes or cylinders"
set i 1
foreach f [explode result f] {
mksurface surf_$i $f
set surf_dump [dump surf_$i]
if { [regexp {Offset} $surf_dump] } {
puts "Error: surface $i is offset, should be plane or cylinder"
}
if { ! [regexp {Plane|CylindricalSurface} $surf_dump] } {
puts "Error: surface $i is not plane or cylinder"
}
incr i
}

View File

@@ -1,12 +0,0 @@
puts "========"
puts "0030196: REGRESSION: Modeling Algorithms - Crash in BRepBuilderAPI_GTransform"
puts "========"
puts ""
cpulimit 300
pload XDE
testreadstep [locate_data_file bug30196.stp] s
dchrono m start
deform res s 1 1 1
dchrono m stop counter deform
checkview -display res -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,17 +0,0 @@
puts "========"
puts "0030778: \[Regression to 7.3.0\] Extrema raises excep-tion StdFail_InfiniteSolutions"
puts "========"
puts ""
restore [locate_data_file bug30778.brep] a
explode a
pcurve c1 a_1 a_3
pcurve c2 a_2 a_3
trim c1 c1 0.0833292423088664 1
trim c2 c2 0 0.91666977216245
set out [2dextrema c1 c2]
regexp {distance = ([0-9+-.eE]*)} $out full dist
checkreal distance $dist 0 1e-9 0

View File

@@ -1,13 +0,0 @@
puts "========"
puts "0030880: Bug in BRepExtrema_ExtCF"
puts "========"
puts ""
pload QAcommands
restore [locate_data_file bug30880_edge.brep] e
restore [locate_data_file bug30880_face.brep] f
if {![regexp "No solutions" [OCC30880 e f]]} {
puts "Error: Incorrect extrema solutions"
}

View File

@@ -1,10 +0,0 @@
puts "========"
puts "0030880: Bug in BRepExtrema_ExtCF"
puts "========"
puts ""
restore [locate_data_file bug30880_face.brep] f
point p2d -0.0034857302428251678 0.016350559703980902
if {![regexp "OUT" [b2dclassifx f p2d -tol 1.e-7]]} {
puts "Error: Incorrect classification of the point"
}

View File

@@ -1,42 +0,0 @@
puts "========"
puts "CR27534"
puts "========"
puts ""
####################################################################
## [Regression to 6.9.1]: Infinite loop in Curve on Surface projection algorithm
####################################################################
# This test produces different results on windows and linux.
# Windows result is unstable. Linux result is used as reference.
puts "TODO ?OCC29268 Windows: The length of result shape is"
# Prepare initial data
sphere s 0 0 0 10
circle c 0 0 0 0 0 1 10
# Trim curve
trim c c 0 pi
# Convert geometry to topology
mkface f s
mkedge e c
# Convert to splines
nurbsconvert f f
nurbsconvert e e
# Switch back to geometry
mksurface s f
mkcurve c e
# Build projection
project c2d c s -t 0.2
# Length check
checklength c2d -l 3.1415926535897931
# Visual Check
v2d
2dfit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,15 +0,0 @@
puts "============"
puts "0030704: Oriented bounding box (Bnd_OBB) gives a wrong result if a box is added to a void box"
puts "============"
pload QAcommands
set ret1 [OCC30704]
if { ${ret1} != "150 150 150" } {
puts "Error: add bounding box to void bounding box"
}
set ret2 [OCC30704_1]
if { ${ret2} != "100 200 300" } {
puts "Error: add point to void bounding box"
}

View File

@@ -1,11 +0,0 @@
puts "==============================================================="
puts "0029979: Data Exchange - Crash by reading STEP file"
puts "==============================================================="
puts ""
puts "Read only the solid that contains broken edges"
stepread [locate_data_file bug29979_firetherm_12.step] a #10154
tpstat c
puts "\nCheck that result is not empty"
checknbshapes a_1 -solid 1 -face 1565

View File

@@ -13,12 +13,12 @@ tclean s
incmesh s 0.001
trinfo s
vclear
vinit View1
vclear
vaxo
vcaps -vbo 0
vsetdispmode 1
vdefaults -absDefl 1.0
vdefaults absDefl=1.0
vselprops -autoactivate 0
set aMemInit [meminfo h]

View File

@@ -1,15 +1,13 @@
# !!!! This file is generated automatically, do not edit manually! See end script
set filename stepBF3.stp
puts "TODO 29269 ALL: B_SPLINE_CURVE_WITH_KNOTS: Update of 3D-Parameters has failed"
set ref_data {
DATA : Faulties = 0 ( 22 ) Warnings = 0 ( 0 ) Summary = 0 ( 22 )
TPSTAT : Faulties = 0 ( 0 ) Warnings = 4 ( 88 ) Summary = 4 ( 88 )
CHECKSHAPE : Wires = 1 ( 1 ) Faces = 1 ( 1 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 1 ( 1 ) Shell = 1 ( 1 ) Face = 153 ( 153 )
STATSHAPE : Solid = 1 ( 1 ) Shell = 1 ( 1 ) Face = 153 ( 153 ) FreeWire = 0 ( 0 )
TOLERANCE : MaxTol = 14.04618892 ( 14.04618892 ) AvgTol = 0.02494942781 ( 0.02495341469 )
DATA : Faulties = 0 ( 26 ) Warnings = 0 ( 0 ) Summary = 0 ( 26 )
TPSTAT : Faulties = 0 ( 2 ) Warnings = 0 ( 0 ) Summary = 0 ( 2 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 ) FreeWire = 0 ( 0 )
TOLERANCE : MaxTol = 0 ( 0 ) AvgTol = 0 ( 0 )
LABELS : N0Labels = 1 ( 1 ) N1Labels = 0 ( 0 ) N2Labels = 0 ( 0 ) TotalLabels = 1 ( 1 ) NameLabels = 1 ( 1 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 0 ( 0 )

Some files were not shown because too many files have changed in this diff Show More