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

Compare commits

..

34 Commits

Author SHA1 Message Date
gka
5859be3886 0030302: XCAF - Typo in XCAFDoc_GeomTolerance
Typo in the XCAFDoc_GeomTolerance.cxx where Loc is used instead of aPnt was corrected.
2019-09-14 11:45:37 +03:00
gka
d45b7860a5 0030113: Data Exchange - STL file in text format with "Facet" keywords can't be imported
Case-sensitive method strncmp used in the REStl_Reader cosidered register of letter was replaced on the method _strnicmp for Windows and strncasecmp for Linux and MacOs
Test script for case 0030113
2019-09-14 11:45:36 +03:00
agv
0cdaa8a4a5 0030831: ShapeFix algorithm (creation of seam edge) takes too long time with thin faces
In class ShapeFix_ComposeShell the U- and V-closedness of input face is taken immediately avoiding the error when the face is small in any of these dimensions.
Test case for bug 0030831
2019-09-14 11:45:36 +03:00
abv
3b80dc166a 0030948: Configuration, CMake - problem building with CMake 3.15.2
Minor corrections in CMake procedures and include statements
2019-09-14 11:45:35 +03:00
mzernova
fdae2107d9 0030946: Visualization - Image_AlienPixMap ignores 1-bit pixelformat when using FreeImage
Convert 1-bit image to 8-bit one during its loading because only greyscale images are supported by visualization
2019-09-14 11:45:35 +03:00
kgv
44b80414d3 0030775: Foundation Classes - Preserve application-defined top-level exception filter
New overload for method OSD::SetSignal() is added accepting argument specifying how to set or unset handlers.
New enum OSD_SignalMode describes different modes of signal handlers setting used in extended version of OSD::SetSignal().
Method OSD::SignalMode() returns mode set by the last call to SetSignal().
Method OSD::IsFloatingSignalSet() is changed to return value based on actual floating point exception flags (rather than on variable set by previous call to SetSignal()).

Added new method OSD::SetThreadLocalSignal() intended to setup thread-specific handlers (e.g. _set_se_translator() on Windows) and FPE settings.
OSD_ThreadPool and Media_PlayerContext now use new method instead of OSD::SetSignal(), to avoid overriding global handlers.

dsetsignal syntax has been extended to support choice of signal handling mode.

DRAW command OCC30775 is added allowing to test signal handling in multithreaded process.
2019-09-14 11:45:34 +03:00
mzernova
b1492cb30f 0022777: Visualization - Unsafe way to get attribute values from MeshVS_Drawer
Set default values for local variables used for storing values that are obtained by MeshVS_Drawer::Get****() methods
2019-09-14 10:49:50 +03:00
iko
5c225e8e07 0030963: Visualization, TKOpenGl - texture unit error during FFP global texture's parameters processing
The texture units used in FFP texture functions are correct now.
2019-09-14 10:49:49 +03:00
oan
3068c3bb65 0030959: OSD_Parallel_TBB: number of execution threads is strictly limited by the root scope
Do not limit number of available threads by number of items processed within the root scope due to possibility of spawning of an additional threads within the subscopes.
2019-09-14 10:49:48 +03:00
tma
ac293bde7f 0030957: Data Exchange - Assembly item Id should not start with '/' symbol
Fix test case: added parsing of the output of the dump note command
2019-09-11 18:48:14 +03:00
jgv
a53d3975c9 0023380: BRepOffsetAPI_MakeFilling fails and leaves boundary faces with high tolerance
Avoid exception: use BRep_Builder for building wire instead of using BRepLib_MakeWire.
2019-09-09 19:27:59 +03:00
aml
94beb42a68 0029858: Modeling Data - Regression in GeomAPI_ExtremaCurveCurve
Fix Newton's minimum projection algorithm onto boundaries in case of conditional optimization.
Add possibility to detect several optimal points at initialization of the math_GlobOptMin.
2019-09-09 19:26:39 +03:00
bugmaster
5a7808160e Increment OCCT version up to 7.4.0beta 2019-09-06 19:24:56 +03:00
drazmyslovich
9063f1e089 0030870: Data Exchange - Add the support for empty draughting models and empty presentation layer assignments for step import
Protections to avoid exception in the methods  RWStepVisual_RWDraughtingModel::ReadStep and RWStepVisual_RWPresentationLayerAssignment::ReadStep for case when assigned items are absent were added
2019-09-06 19:24:56 +03:00
abv
fa68c1e116 0029979: Data Exchange - Crash by reading STEP file
Added work-around against specific problem of ORIENTED_EDGE referring to another ORIENTED_EDGE instead of EDGE_CURVE.
Added handling of edges with null EDGE_CURVE, to allow passing the translation further instead of exception.

Off-topic: text of warning message is corrected in genproj

Added test bugs step bug29979
2019-09-06 19:23:19 +03:00
emv
ba165db3d3 0030880: Modeling Algorithms - Bug in BRepExtrema_ExtCF
Use the BRepTopAdaptor_FClass2d instead of BRepClass_FaceClassifier in BRepExtrema_ExtCF for classification of the found intersection points.
2019-09-06 19:23:19 +03:00
vro
f2c862db07 0030704: Modeling Data, Bnd_OBB - Oriented bounding box gives a wrong result if a box is added to a void box
Added protection on a void box to methods Bnd_OBB::Add() to escape taking into account "heap trash" coordinates of a void box.
2019-09-06 19:23:18 +03:00
drazmyslovich
a90dd15e6b 0030876: Data Exchange - StepToTopoDS edge translation should be resistant to malformed parameter values
Corrected misprint in the method CheckPCurves of the class StepToTopoDS_TranslateEdgeLoop for case when higher bound of the range of pcurve on the edge greater then last parameter of the pcurve.
Added check on the not periodic flag for pcurve when range pcurve on the edge is adjusted to parameters pcurve.
2019-09-06 19:23:17 +03:00
gka
f9c58d7c4e 0029269: Improvement for thread safety of the STEP translator - cleanup
Removal of unused stuff and some protections implemented within #29269
2019-09-06 18:26:44 +03:00
msv
ce64c9ad5e 0030778: [Regression to 7.3.0] Extrema raises exception StdFail_InfiniteSolutions
The exception StdFail_InfiniteSolutions has been suppressed in all Points() methods.
2019-09-06 18:26:44 +03:00
ifv
dec7af167b 0030196: [REGRESSION] Modeling Algorithms - Crash in BRepBuilderAPI_GTransform
Test case is added
2019-09-06 18:26:43 +03:00
kgv
14c7f553a9 0030942: Draw Harness, ViewerTest - command vdefaults should abort script on unknown argument 2019-09-06 18:26:42 +03:00
aml
7a74087601 0027534: [Regression to 6.9.1]: Infinite loop in Curve on Surface projection algorithm
Add test case.
2019-09-06 18:26:42 +03:00
kgv
9eefb360a7 0030846: Foundation Classes - StorageInfo violates the C++ One Definition Rule
Local definitions have been put into anonymouse namespace within files
OSD_MAllocHook.cxx and NCollection_BaseAllocator.cxx.
2019-09-06 18:26:41 +03:00
drazmyslovich
3f50e94e33 0029717: Shape Healing - ShapeFix_Face::FixSmallAreaWire delivers a face with wrong-oriented wires + 1 small crash-fix
- Fix FixSmallAreaWire for the reversed faces.

- Add nullptr check for FixOrient...

- Test bugs heal bug25923 is corrected to avoid relying on wrong orientation of face after fixing small wire
2019-09-06 18:26:41 +03:00
kgv
bbd8ce1008 0030721: Visualization - Arrows in dimensions are drawn behind some other lines after applying 30716
AIS_Dimension::DrawArrow() now disables polygon offsets for drawing 2D arrow,
so that it is expected to be drawn at the same depth as dimension line.
2019-09-05 18:01:39 +03:00
abv
30870f51f4 Test for 0023979: Performance problem of STEP export for large files 2019-09-04 18:34:07 +03:00
nds
741c4f3ecc 0030728: Visualization - using one implementation of highlight/unhighlight in context 2019-09-04 18:05:55 +03:00
kgv
611684187d 0029516: Visualization - eliminate redundant property Graphic3d_MaterialAspect::ReflectionMode()
Decomposition of Ambient, Diffuse, Specular and Emissive properties has been eliminated within *Graphic3d_MaterialAspect* definition,
so that following methods of *Graphic3d_MaterialAspect* class have been removed:
SetReflectionMode(), SetReflectionModeOn(), Ambient(), Diffuse(), Emissive(), Specular(), SetAmbient(), SetDiffuse(), SetSpecular(), SetEmissive().

Graphic3d_NOM_NEON_GNC non-physical material definition has been corrected
and define WHITE emission color coefficient instead of YELLOW.

Added method Graphic3d_ClipPlane::SetCappingColor() for more straight-forward modification of Capping color in case of non-physical material.
Prs3d_ShadingAspect::Color() has been fixed to return InteriorColor instead of material color coefficient in case of non-physical material.
2019-09-04 15:13:18 +03:00
abv
c8428cb3e4 0030938: Configuration, genproj - Support building with VS 2019
Commands genproj and genconf are updated to support generation of projects for VS 2019, toolset v142
2019-09-04 15:08:14 +03:00
kgv
1202160b57 0030931: Visualization, TKOpenGl - do not render into GL_FRONT within "GDI Generic" renderer
OpenGl_Workspace now disables at initialization time
OpenGl_View::SetImmediateModeDrawToFront() property in case of "GDI Generic" OpenGL implementation.

OpenGl_View::redrawImmediate() - fixed no buffer swap in case of
myTransientDrawToFront without offscreen FBO.
2019-09-02 19:18:36 +03:00
kgv
59ee34efc0 0030930: Draw Harness, ViewerTest - add commands vlistcolors and vlistmaterials listing standard Colors and Materials
Introduced two new commands vlistcolors listing named colors and vlistmaterials listing standard materials.
These commands also can generate HTML table listing colors/materials with their properties.
vlistmaterials can generate OBJ model for comparing OCCT materials in different viewers.
New test cases use these commands for generating HTML tables.

Graphic3d_MaterialAspect::MaterialType() - added missing getter.
Corrected name of unlit shading model within vaspects and vrenderparams commands.
2019-09-02 19:17:23 +03:00
abv
7185019ae6 0028242: [Regression] HLR Poly Algo has broken edges
Added test hlr poly_hlr bug28242
2019-09-02 19:16:38 +03:00
abv
090ef04012 0029334: Simple offsets complicate geometry
Method BRepOffset::Surface() is used in simple offset algorithm to create offset surface, instead of direct and unconditional construction of new Geom_OffsetSurface instance.

Added test bugs modalg_7 bug29334
2019-09-02 08:08:37 +03:00
138 changed files with 2623 additions and 2638 deletions

View File

@@ -274,7 +274,7 @@ macro (COLLECT_AND_INSTALL_OCCT_HEADER_FILES ROOT_TARGET_OCCT_DIR OCCT_BUILD_TOO
list (LENGTH OCCT_ALL_FILE_NAMES ALL_FILES_NB)
math (EXPR ALL_FILES_NB "${ALL_FILES_NB} - 1" )
# emit warnings if there is unprocessed headers
# emit warnings if there are unprocessed headers
file (GLOB OCCT_ALL_FILES_IN_DIR "${OCCT_COLLECT_SOURCE_DIR}/${OCCT_PACKAGE}/*.*")
file (GLOB OCCT_ALL_FILES_IN_PATCH_DIR "${BUILD_PATCH}/src/${OCCT_PACKAGE}/*.*")
@@ -307,8 +307,8 @@ macro (COLLECT_AND_INSTALL_OCCT_HEADER_FILES ROOT_TARGET_OCCT_DIR OCCT_BUILD_TOO
list (APPEND OCCT_HEADER_FILES_COMPLETE ${OCCT_FILE_IN_DIR})
# collect header files with name that does not contain its package one
string (FIND "${OCCT_FILE_NAME}" "${OCCT_PACKAGE}_" FOUND_INDEX)
if (NOT ${FOUND_INDEX} EQUAL 0)
string (REGEX MATCH "^${OCCT_PACKAGE}[_.]" IS_HEADER_MATHCING_PACKAGE "${OCCT_FILE_NAME}")
if (NOT IS_HEADER_MATHCING_PACKAGE)
list (APPEND OCCT_HEADER_FILE_WITH_PROPER_NAMES "${OCCT_FILE_NAME}")
endif()
endif()
@@ -355,12 +355,12 @@ macro (COLLECT_AND_INSTALL_OCCT_HEADER_FILES ROOT_TARGET_OCCT_DIR OCCT_BUILD_TOO
list (FIND OCCT_USED_PACKAGES ${PACKAGE_NAME} IS_HEADER_FOUND)
if (NOT ${IS_HEADER_FOUND} EQUAL -1)
if (NOT EXISTS "${OCCT_COLLECT_SOURCE_DIR}/${PACKAGE_NAME}/${HEADER_FILE_NAME}")
message (STATUS "Warning. ${OCCT_HEADER_FILE_OLD} is not presented in the sources and will be removed from ${ROOT_TARGET_OCCT_DIR}/inc")
message (STATUS "Warning. ${OCCT_HEADER_FILE_OLD} is not present in the sources and will be removed from ${ROOT_TARGET_OCCT_DIR}/inc")
file (REMOVE "${OCCT_HEADER_FILE_OLD}")
else()
list (FIND OCCT_HEADER_FILE_NAMES_NOT_IN_FILES ${PACKAGE_NAME} IS_HEADER_FOUND)
if (NOT ${IS_HEADER_FOUND} EQUAL -1)
message (STATUS "Warning. ${OCCT_HEADER_FILE_OLD} is presented in the sources but not involved in FILES and will be removed from ${ROOT_TARGET_OCCT_DIR}/inc")
message (STATUS "Warning. ${OCCT_HEADER_FILE_OLD} is present in the sources but not involved in FILES and will be removed from ${ROOT_TARGET_OCCT_DIR}/inc")
file (REMOVE "${OCCT_HEADER_FILE_OLD}")
endif()
endif()

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,6 +69,16 @@ 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" "cbp" "xcd" "pro"}
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "cbp" "xcd" "pro"}
set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
set isHelpRequire false
@@ -312,6 +312,7 @@ 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
@@ -510,7 +511,8 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl } {
"vc11" -
"vc12" -
"vc14" -
"vc141" { OS:MKVC $anOutDir $aModules $anAllSolution $theFormat $isUWP}
"vc141" -
"vc142" { OS:MKVC $anOutDir $aModules $anAllSolution $theFormat $isUWP}
"cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution $thePlatform $theCmpl }
"xcd" {
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
@@ -934,7 +936,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 presented in the sources and will be removed from ${theIncPath}!"
puts "Warning: file ${anIncPath}/${anIncFile} is not present in the sources and will be removed from ${theIncPath}"
file delete -force "${theIncPath}/${anIncFile}"
}
}
@@ -965,7 +967,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"} {
} elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" || "$vcversion" == "vc142" } {
append var \
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
"# Visual Studio 14\n"
@@ -1203,6 +1205,9 @@ 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,6 +1716,40 @@ 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.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
material.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
material.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
material.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
material.SetAmbientColor (Quantity_NOC_BLACK);
material.SetDiffuseColor (Quantity_NOC_BLACK);
material.SetSpecularColor(Quantity_NOC_BLACK);
material.SetEmissiveColor(Quantity_NOC_BLACK);
myAspect->SetFrontMaterial(material);
mygroup->SetPrimitivesAspect(myAspect);

View File

@@ -403,16 +403,17 @@ void AIS_Dimension::DrawArrow (const Handle(Prs3d_Presentation)& thePresentation
anArrow->AddVertex (aRightPoint);
// Set aspect for arrow triangles
Graphic3d_MaterialAspect aShadeMat (Graphic3d_NOM_DEFAULT);
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
Handle(Prs3d_ShadingAspect) aShadingStyle = new Prs3d_ShadingAspect();
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->SetMaterial (aShadeMat);
aShadingStyle->SetShadingModel (Graphic3d_TOSM_UNLIT);
aShadingStyle->SetPolygonOffset (aPolOffset);
aGroup->SetPrimitivesAspect (aShadingStyle->Aspect());
aGroup->SetPrimitivesAspect (aShadingStyle);
aGroup->AddPrimitiveArray (anArrow);
}
@@ -530,9 +531,9 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
}
Graphic3d_MaterialAspect aShadeMat (Graphic3d_NOM_DEFAULT);
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
aShadeMat.SetAmbientColor (Quantity_NOC_BLACK);
aShadeMat.SetDiffuseColor (Quantity_NOC_BLACK);
aShadeMat.SetSpecularColor(Quantity_NOC_BLACK);
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;
unhighlightOwners (theIObj);
unselectOwners (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 : unhighlightOwners
//function : unselectOwners
//purpose :
//=======================================================================
void AIS_InteractiveContext::unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject)
void AIS_InteractiveContext::unselectOwners (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;
}
unhighlightOwners (theIObj);
unselectOwners (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 unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
Standard_EXPORT void unselectOwners (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,12 +1246,16 @@ 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;
const Standard_Integer theDispMode);
//! 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.
@@ -1259,9 +1263,14 @@ 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) const;
Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj);
//! Helper function that turns on sub-intensity in global status and highlights
//! given objects with sub-intensity color

View File

@@ -85,6 +85,7 @@ 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())
{
@@ -98,17 +99,15 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
{
if (aSelIter.Value()->IsSameSelectable (anObj))
{
aSeq.Append (aSelIter.Value());
anOwners.Append (aSelIter.Value());
}
}
anObj->HilightSelected (myMainPM, aSeq);
}
else
{
const Handle(Prs3d_Drawer)& aStyle = getSelStyle (anObj, theOwner);
const Standard_Integer aHiMode = getHilightMode (anObj, aStyle, -1);
theOwner->HilightWithColor (myMainPM, aStyle, aHiMode);
anOwners.Append (theOwner);
}
highlightOwners (anOwners);
}
//=======================================================================
@@ -117,7 +116,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
const Standard_Integer theDispMode)
{
if (theObj.IsNull())
{
@@ -133,6 +132,7 @@ 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))
{
aSeq.Append (aSelIter.Value());
anOwners.Append (aSelIter.Value());
}
}
theObj->HilightSelected (myMainPM, aSeq);
}
else
{
aGlobOwner->HilightWithColor (myMainPM, theStyle, aHiMode);
anOwners.Append (aGlobOwner);
}
highlightOwners (anOwners);
}
//=======================================================================
@@ -156,9 +156,19 @@ 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 (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
for (AIS_NListOfEntityOwner::Iterator aSelIter (theOwners); aSelIter.More(); aSelIter.Next())
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
@@ -186,7 +196,7 @@ void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsTo
}
if (anOwner == anInteractive->GlobalSelOwner())
{
myObjects.ChangeFind (anInteractive)->SetHilightStatus (Standard_False);
aStatus->SetHilightStatus (Standard_False);
}
}
for (NCollection_IndexedMap<Handle(AIS_InteractiveObject)>::Iterator anIter (anObjToClear); anIter.More(); anIter.Next())
@@ -201,7 +211,7 @@ void AIS_InteractiveContext::unhighlightSelected (const Standard_Boolean theIsTo
//function : unhighlightGlobal
//purpose :
//=======================================================================
void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const
void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj)
{
if (theObj.IsNull())
{
@@ -215,15 +225,9 @@ void AIS_InteractiveContext::unhighlightGlobal (const Handle(AIS_InteractiveObje
return;
}
if (aGlobOwner->IsAutoHilight())
{
aGlobOwner->Unhilight (myMainPM);
}
else
{
myMainPM->Unhighlight (theObj);
theObj->ClearSelected();
}
AIS_NListOfEntityOwner anOwners;
anOwners.Append (aGlobOwner);
unhighlightOwners (anOwners);
}
//=======================================================================
@@ -720,11 +724,27 @@ 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 (mySelection->Objects()); aSelIter.More(); aSelIter.Next())
for (AIS_NListOfEntityOwner::Iterator aSelIter (theOwners); 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())
@@ -761,9 +781,6 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
}
anObjOwnerMap.Clear();
}
if (theToUpdateViewer)
UpdateCurrentViewer();
}
//=======================================================================
@@ -772,17 +789,7 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
//=======================================================================
void AIS_InteractiveContext::UnhilightSelected (const Standard_Boolean theToUpdateViewer)
{
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);
}
unhighlightSelected();
if (theToUpdateViewer)
UpdateCurrentViewer();
@@ -937,13 +944,6 @@ 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,28 +990,17 @@ 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
{
if (theOwner->IsAutoHilight())
{
theOwner->Unhilight (myMainPM);
}
else
{
anObj->ClearSelected();
}
aStatus->SetHilightStatus (Standard_False);
AIS_NListOfEntityOwner anOwners;
anOwners.Append (theOwner);
unhighlightOwners (anOwners);
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.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
aShadingMaterial.SetSpecularColor(Quantity_NOC_BLACK);
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.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
aHilightMaterial.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
aHilightMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
aHilightMaterial.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
aHilightMaterial.SetAmbientColor (Quantity_NOC_BLACK);
aHilightMaterial.SetDiffuseColor (Quantity_NOC_BLACK);
aHilightMaterial.SetSpecularColor(Quantity_NOC_BLACK);
aHilightMaterial.SetEmissiveColor(Quantity_NOC_BLACK);
aHilightMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
myHighlightAspect = new Prs3d_ShadingAspect();
@@ -153,11 +153,10 @@ void AIS_Manipulator::init()
myHighlightAspect->SetMaterial (aHilightMaterial);
Graphic3d_MaterialAspect aDraggerMaterial;
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
aDraggerMaterial.SetAmbientColor (Quantity_NOC_BLACK);
aDraggerMaterial.SetDiffuseColor (Quantity_NOC_BLACK);
aDraggerMaterial.SetSpecularColor(Quantity_NOC_BLACK);
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()->Material (myCurrentFacingModel).Color();
const Quantity_Color aColor = theDrawer->ShadingAspect()->Color (myCurrentFacingModel);
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;
Standard_Real ambient = aspect->FrontMaterial().Ambient();
const Standard_Real ambient = 0.2;
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.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
aHighlightMaterial.SetAmbientColor (Quantity_NOC_BLACK);
aHighlightMaterial.SetDiffuseColor (Quantity_NOC_BLACK);
aHighlightMaterial.SetSpecularColor(Quantity_NOC_BLACK);
aHighlightMaterial.SetEmissiveColor(Quantity_NOC_BLACK);
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 <BRepClass_FaceClassifier.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <gp_Pnt2d.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepAdaptor_HSurface.hxx>
@@ -94,8 +94,14 @@ void BRepExtrema_ExtCF::Perform(const TopoDS_Edge& E, const TopoDS_Face& F2)
else
{
// Exploration of points and classification
BRepClass_FaceClassifier classifier;
const Standard_Real Tol = BRep_Tool::Tolerance(F2);
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;
Extrema_POnCurv P1;
Extrema_POnSurf P2;
@@ -104,8 +110,7 @@ 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);
classifier.Perform(F2, Puv, Tol);
const TopAbs_State state = classifier.State();
const TopAbs_State state = classifier.Perform (Puv, isAdjustPeriodic);
if (state == TopAbs_ON || state == TopAbs_IN)
{
mySqDist.Append(myExtCS.SquareDistance(i));

View File

@@ -91,31 +91,50 @@ static gp_Vec MakeFinVec( const TopoDS_Wire aWire, const TopoDS_Vertex aVertex )
static TopoDS_Wire WireFromList(TopTools_ListOfShape& Edges)
{
BRepLib_MakeWire MW;
BRep_Builder BB;
TopoDS_Wire aWire;
BB.MakeWire(aWire);
TopoDS_Edge anEdge = TopoDS::Edge(Edges.First());
MW.Add(anEdge);
BB.Add(aWire, anEdge);
Edges.RemoveFirst();
TopoDS_Vertex V1, V2;
TopExp::Vertices(anEdge, V1, V2, Standard_True); //with orientation
while (!Edges.IsEmpty())
{
TopoDS_Wire CurWire = MW.Wire();
TopoDS_Vertex V1, V2;
TopExp::Vertices(CurWire, V1, V2);
TopTools_ListIteratorOfListOfShape itl(Edges);
for (; itl.More(); itl.Next())
{
anEdge = TopoDS::Edge(itl.Value());
TopoDS_Vertex V3, V4;
TopExp::Vertices(anEdge, V3, V4);
TopExp::Vertices(anEdge, V3, V4, Standard_True); //with orientation
if (V1.IsSame(V3) || V1.IsSame(V4) ||
V2.IsSame(V3) || V2.IsSame(V4))
{
if (V1.IsSame(V3))
{
anEdge.Reverse();
V1 = V4;
}
else if (V1.IsSame(V4))
V1 = V3;
else if (V2.IsSame(V3))
V2 = V4;
else
{
anEdge.Reverse();
V2 = V3;
}
break;
}
}
MW.Add(anEdge);
BB.Add(aWire, anEdge);
Edges.Remove(itl);
}
return (MW.Wire());
aWire.Closed(Standard_True);
return aWire;
}
//=======================================================================
@@ -707,8 +726,6 @@ void BRepFill_Filling::Build()
}
TopoDS_Wire FinalWire = WireFromList(FinalEdges);
if (!(FinalWire.Closed()))
throw Standard_Failure("Wire is not closed");
myFace = BRepLib_MakeFace( Surface, FinalWire );
}

View File

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

View File

@@ -973,11 +973,24 @@ Standard_Boolean Bnd_OBB::IsCompletelyInside(const Bnd_OBB& theOther) const
// =======================================================================
void Bnd_OBB::Add(const gp_Pnt& theP)
{
gp_Pnt aList[9];
GetVertex(aList);
aList[8] = theP;
ReBuild(TColgp_Array1OfPnt(aList[0], 0, 8));
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));
}
}
// =======================================================================
@@ -986,9 +999,26 @@ void Bnd_OBB::Add(const gp_Pnt& theP)
// =======================================================================
void Bnd_OBB::Add(const Bnd_OBB& theOther)
{
gp_Pnt aList[16];
GetVertex(&aList[0]);
theOther.GetVertex(&aList[8]);
ReBuild(TColgp_Array1OfPnt(aList[0], 0, 15));
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));
}
}
}

View File

@@ -437,7 +437,7 @@ static void CurveHermite (const TopOpeBRepDS_DataStructure& DStr,
GeomAdaptor_Curve L (Bezier);
Extrema_ExtCC ext (C,L);
if (ext.IsDone()){
if (ext.NbExt()!=0){
if (!ext.IsParallel() && ext.NbExt()!=0){
Extrema_POnCurv POnC, POnL;
ext.Points(1, POnC, POnL);
if (POnC.Value().Distance(POnL.Value()) < Precision::Confusion())

View File

@@ -17,12 +17,13 @@
#ifdef _WIN32
#include <windows.h>
#include <COMMANDWINDOW.h>
#include <Draw_Window.hxx>
#include <MAINWINDOW.h>
#include <Draw_Appli.hxx>
#include <TCollection_AsciiString.hxx>
#include <MainWindow.h>
#include <CommandWindow.h>
#define CLIENTWND 0
#define THE_PROMPT L"Command >> "

View File

@@ -913,21 +913,70 @@ static int dperf (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char
static int dsetsignal (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
{
// arm FPE handler if argument is provided and its first symbol is not '0'
// or if environment variable CSF_FPE is set and its first symbol is not '0'
bool setFPE = false;
if (theArgNb > 1)
OSD_SignalMode aMode = OSD_SignalMode_Set;
Standard_Boolean aSetFPE = OSD::ToCatchFloatingSignals();
// default for FPE signal is defined by CSF_FPE variable, if set
OSD_Environment aEnv("CSF_FPE");
TCollection_AsciiString aEnvStr = aEnv.Value();
if (!aEnvStr.IsEmpty())
{
setFPE = (theArgVec[1][0] == '1' || theArgVec[1][0] == 't');
aSetFPE = (aEnvStr.Value(1) != '0');
}
else
// parse arguments
for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
OSD_Environment aEnv ("CSF_FPE");
TCollection_AsciiString aEnvStr = aEnv.Value();
setFPE = (! aEnvStr.IsEmpty() && aEnvStr.Value(1) != '0');
TCollection_AsciiString anArg(theArgVec[anArgIter]);
anArg.LowerCase();
if (anArg == "asis")
{
aMode = OSD_SignalMode_AsIs;
}
else if (anArg == "set")
{
aMode = OSD_SignalMode_Set;
}
else if (anArg == "unhandled")
{
aMode = OSD_SignalMode_SetUnhandled;
}
else if (anArg == "unset")
{
aMode = OSD_SignalMode_Unset;
}
else if (anArg == "1" || anArg == "on")
{
aSetFPE = Standard_True;
}
else if (anArg == "0" || anArg == "off")
{
aSetFPE = Standard_False;
}
else if (anArg == "default")
{
}
else
{
std::cout << "Syntax error: unknown argument '" << anArg << "'\n";
return 1;
}
}
OSD::SetSignal (setFPE);
theDI << "Signal handlers are set, with FPE " << (setFPE ? "armed" : "disarmed");
OSD::SetSignal(aMode, aSetFPE);
// report actual status in the end
const char* aModeStr = 0;
switch (OSD::SignalMode())
{
default:
case OSD_SignalMode_AsIs: aModeStr = "asis"; break;
case OSD_SignalMode_Set: aModeStr = "set"; break;
case OSD_SignalMode_SetUnhandled: aModeStr = "unhandled"; break;
case OSD_SignalMode_Unset: aModeStr = "unset"; break;
}
theDI << "Signal mode: " << aModeStr << "\n"
<< "Catch FPE: " << (OSD::ToCatchFloatingSignals() ? "1" : "0") << "\n";
return 0;
}
@@ -1057,7 +1106,7 @@ void Draw::BasicCommands(Draw_Interpretor& theCommands)
__FILE__, dmeminfo, g);
theCommands.Add("dperf","dperf [reset] -- show performance counters, reset if argument is provided",
__FILE__,dperf,g);
theCommands.Add("dsetsignal","dsetsignal [fpe=0] -- set OSD signal handler, with FPE option if argument is given",
theCommands.Add("dsetsignal","dsetsignal [{asis|set|unhandled|unset}=set] [{0|1|default=$CSF_FPE}]\n -- set OSD signal handler, with FPE option if argument is given",
__FILE__,dsetsignal,g);
theCommands.Add("dparallel",

View File

@@ -19,8 +19,9 @@
#include <windows.h>
#include <DrawRessource.h>
#include <init.h>
#include <MainWindow.h>
#include <Draw_Window.hxx>
#include <MainWindow.h>
#include <CommandWindow.h>
Standard_Boolean Draw_Interprete(const char* command); // Implemented in Draw.cxx

View File

@@ -28,9 +28,7 @@
#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;
@@ -38,7 +36,6 @@ class gp_Pnt;
class gp_Vec;
class Extrema_ECC
{
public:

View File

@@ -28,9 +28,7 @@
#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;
@@ -38,7 +36,6 @@ class gp_Pnt2d;
class gp_Vec2d;
class Extrema_ECC2d
{
public:

View File

@@ -16,9 +16,6 @@
#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,9 +16,6 @@
#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,7 +43,6 @@
#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>
@@ -327,11 +326,6 @@ 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,9 +29,7 @@
#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,10 +34,7 @@
#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,9 +28,7 @@
#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,10 +36,7 @@
#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>
@@ -497,11 +494,6 @@ 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,9 +36,7 @@
#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>
@@ -1100,11 +1098,6 @@ 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,9 +25,7 @@
#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,9 +27,7 @@
#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>
//=======================================================================
@@ -459,11 +457,6 @@ 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,9 +25,7 @@
#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,7 +37,6 @@
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_OutOfRange.hxx>
#include <StdFail_InfiniteSolutions.hxx>
#include <StdFail_NotDone.hxx>
#include <TColStd_ListOfInteger.hxx>
@@ -827,11 +826,6 @@ 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,9 +27,7 @@
#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,7 +24,6 @@
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_OutOfRange.hxx>
#include <StdFail_InfiniteSolutions.hxx>
#include <StdFail_NotDone.hxx>
Extrema_ExtElSS::Extrema_ExtElSS()
@@ -165,11 +164,6 @@ 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,9 +26,7 @@
#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,10 +24,7 @@
#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()
@@ -263,11 +260,6 @@ 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,11 +658,6 @@ 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()
{
const Graphic3d_MaterialAspect aMaterial (Graphic3d_NOM_DEFAULT);
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 (aMaterial.Color());
anAspect->SetInteriorColor (Quantity_NOC_GRAY20);
anAspect->SetSuppressBackFaces (false);
return anAspect;
}
@@ -177,6 +177,17 @@ 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 :
@@ -184,7 +195,10 @@ Handle(Graphic3d_ClipPlane) Graphic3d_ClipPlane::Clone() const
void Graphic3d_ClipPlane::SetCappingMaterial (const Graphic3d_MaterialAspect& theMat)
{
myAspect->SetFrontMaterial (theMat);
myAspect->SetInteriorColor (theMat.Color());
if (myAspect->FrontMaterial().MaterialType() != Graphic3d_MATERIAL_ASPECT)
{
myAspect->SetInteriorColor (theMat.Color());
}
++myAspectMod;
}

View File

@@ -166,6 +166,12 @@ 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];
Standard_ShortReal ColorCoef[Graphic3d_TypeOfReflection_NB];
Quantity_Color Colors[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,62 +80,59 @@ 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:
Shininess = 0.0078125f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.50f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.24f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.06f;
MaterialType = Graphic3d_MATERIAL_ASPECT;
BSDF.Kd = static_cast<Graphic3d_Vec3> (Colors[Graphic3d_TOR_DIFFUSE]);
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.Ks = Graphic3d_Vec4 (0.00784314f, 0.00784314f, 0.00784314f, 0.25f);
BSDF.Normalize();
break;
case Graphic3d_NOM_SHINY_PLASTIC:
Shininess = 1.00f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.44f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.50f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
MaterialType = Graphic3d_MATERIAL_ASPECT;
BSDF.Kd = static_cast<Graphic3d_Vec3> (Colors[Graphic3d_TOR_DIFFUSE]);
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.Ks = Graphic3d_Vec4 (0.145f, 0.145f, 0.145f, 0.17f);
BSDF.Normalize();
break;
case Graphic3d_NOM_SATIN:
Shininess = 0.09375f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.33f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.40f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.44f;
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));
BSDF.Kd = Graphic3d_Vec3 (0.2f);
BSDF.Ks = Graphic3d_Vec4 (0.6f);
break;
case Graphic3d_NOM_NEON_GNC:
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;
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));
BSDF.Kd = Graphic3d_Vec3 (0.0f);
BSDF.Ks = Graphic3d_Vec4 (0.5f, 0.5f, 0.5f, 0.f);
@@ -143,199 +140,160 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.FresnelBase = Graphic3d_Fresnel::CreateDielectric (1.5f);
break;
case Graphic3d_NOM_METALIZED:
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);
}
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);
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:
Shininess = 0.01f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.26f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.75f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.05f;
MaterialType = Graphic3d_MATERIAL_ASPECT;
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));
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));
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;
Shininess = 0.17f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.19f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.75f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.08f;
// special case for SetColor()
AmbientCoef = 0.19f * 0.25f;
DiffuseCoef = 0.75f;
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));
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));
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;
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));
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));
BSDF.Kd = Graphic3d_Vec3 (0.0f);
BSDF.Ks = Graphic3d_Vec4 (0.5f, 0.5f, 0.5f, 0.f);
@@ -345,14 +303,11 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
case Graphic3d_NOM_OBSIDIAN:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.3f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.0f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.0f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.0f;
Shininess = 0.3f;
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);
@@ -360,14 +315,11 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
case Graphic3d_NOM_JADE:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
Shininess = 0.10f;
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
Shininess = 0.10f;
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);
@@ -376,14 +328,11 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
case Graphic3d_NOM_CHARCOAL:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
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));
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));
BSDF.Kd = Graphic3d_Vec3 (0.02f, 0.02f, 0.02f);
BSDF.Ks = Graphic3d_Vec4 (0.1f, 0.1f, 0.1f, 0.3f);
@@ -391,10 +340,6 @@ 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),
@@ -402,17 +347,15 @@ 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),
@@ -420,17 +363,15 @@ 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),
@@ -438,18 +379,16 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
RefractionIndex);
TransparencyCoef = 0.80f;
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));
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));
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);
@@ -457,22 +396,26 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
BSDF.FresnelBase = Graphic3d_Fresnel::CreateConstant (0.0f);
TransparencyCoef = 0.80f;
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));
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));
break;
case Graphic3d_NOM_UserDefined:
MaterialType = Graphic3d_MATERIAL_PHYSIC;
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));
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));
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;
}
}
@@ -510,20 +453,12 @@ 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];
}
// =======================================================================
@@ -553,42 +488,28 @@ 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)
{
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)
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)))
{
setUserMaterial();
}
myColors[Graphic3d_TOR_AMBIENT] = anAmbient;
myColors[Graphic3d_TOR_DIFFUSE] = aDiffuse;
}
// =======================================================================
@@ -597,12 +518,13 @@ void Graphic3d_MaterialAspect::SetColor (const Quantity_Color& theColor)
// =======================================================================
void Graphic3d_MaterialAspect::SetAmbientColor (const Quantity_Color& theColor)
{
myColors[Graphic3d_TOR_AMBIENT] = theColor;
if (myReflActivity[Graphic3d_TOR_AMBIENT]
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
&& myMaterialName != Graphic3d_NOM_UserDefined
&& !myColors[Graphic3d_TOR_AMBIENT].IsEqual (theColor))
{
setUserMaterial();
}
myColors[Graphic3d_TOR_AMBIENT] = theColor;
}
// =======================================================================
@@ -611,12 +533,13 @@ void Graphic3d_MaterialAspect::SetAmbientColor (const Quantity_Color& theColor)
// =======================================================================
void Graphic3d_MaterialAspect::SetDiffuseColor (const Quantity_Color& theColor)
{
myColors[Graphic3d_TOR_DIFFUSE] = theColor;
if (myReflActivity[Graphic3d_TOR_DIFFUSE]
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
&& myMaterialName != Graphic3d_NOM_UserDefined
&& !myColors[Graphic3d_TOR_DIFFUSE].IsEqual (theColor))
{
setUserMaterial();
}
myColors[Graphic3d_TOR_DIFFUSE] = theColor;
}
// =======================================================================
@@ -625,12 +548,13 @@ void Graphic3d_MaterialAspect::SetDiffuseColor (const Quantity_Color& theColor)
// =======================================================================
void Graphic3d_MaterialAspect::SetSpecularColor (const Quantity_Color& theColor)
{
myColors[Graphic3d_TOR_SPECULAR] = theColor;
if (myReflActivity[Graphic3d_TOR_SPECULAR]
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
&& myMaterialName != Graphic3d_NOM_UserDefined
&& !myColors[Graphic3d_TOR_SPECULAR].IsEqual (theColor))
{
setUserMaterial();
}
myColors[Graphic3d_TOR_SPECULAR] = theColor;
}
// =======================================================================
@@ -639,86 +563,13 @@ 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))
{
setUserMaterial();
}
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();
}
}
// =======================================================================
@@ -762,8 +613,11 @@ void Graphic3d_MaterialAspect::SetShininess (const Standard_ShortReal theValue)
throw Graphic3d_MaterialDefinitionError("Bad value for Shininess < 0. or > 1.0");
}
myShininess = theValue;
setUserMaterial();
if (myShininess != theValue)
{
myShininess = theValue;
setUserMaterial();
}
}
// =======================================================================
@@ -784,47 +638,55 @@ Standard_CString Graphic3d_MaterialAspect::MaterialName (const Standard_Integer
// function : MaterialFromName
// purpose :
// =======================================================================
Graphic3d_NameOfMaterial Graphic3d_MaterialAspect::MaterialFromName (const Standard_CString theName)
Standard_Boolean Graphic3d_MaterialAspect::MaterialFromName (const Standard_CString theName,
Graphic3d_NameOfMaterial& theMat)
{
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)
{
return Graphic3d_NameOfMaterial(aMatIter);
theMat = Graphic3d_NameOfMaterial(aMatIter);
return Standard_True;
}
}
// parse aliases
if (aName == "Plastic") // Plastified
{
return Graphic3d_NOM_PLASTIC;
theMat = Graphic3d_NOM_PLASTIC;
return Standard_True;
}
else if (aName == "Shiny_plastic") // Shiny_plastified
{
return Graphic3d_NOM_SHINY_PLASTIC;
theMat = Graphic3d_NOM_SHINY_PLASTIC;
return Standard_True;
}
else if (aName == "Plaster") // Plastered
{
return Graphic3d_NOM_PLASTER;
theMat = Graphic3d_NOM_PLASTER;
return Standard_True;
}
else if (aName == "Satin") // Satined
{
return Graphic3d_NOM_SATIN;
theMat = Graphic3d_NOM_SATIN;
return Standard_True;
}
else if (aName == "Neon_gnc") // Ionized
{
return Graphic3d_NOM_NEON_GNC;
theMat = Graphic3d_NOM_NEON_GNC;
return Standard_True;
}
else if (aName == "Neon_phc") // Neon
{
return Graphic3d_NOM_NEON_PHC;
theMat = Graphic3d_NOM_NEON_PHC;
return Standard_True;
}
return Graphic3d_NOM_DEFAULT;
return Standard_False;
}
// =======================================================================

View File

@@ -42,8 +42,20 @@ 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.
Standard_EXPORT static Graphic3d_NameOfMaterial MaterialFromName (const Standard_CString theName);
static Graphic3d_NameOfMaterial MaterialFromName (const Standard_CString theName)
{
Graphic3d_NameOfMaterial aMat = Graphic3d_NOM_DEFAULT;
MaterialFromName (theName, aMat);
return aMat;
}
public:
@@ -87,9 +99,11 @@ 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.
@@ -132,34 +146,6 @@ 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; }
@@ -187,26 +173,11 @@ public:
//! Returns TRUE if the reflection mode is active, FALSE otherwise.
Standard_Boolean ReflectionMode (const Graphic3d_TypeOfReflection theType) const
{
return myReflActivity[theType];
return !myColors[theType].IsEqual (Quantity_NOC_BLACK);
}
//! 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 material type.
Graphic3d_TypeOfMaterial MaterialType() const { return myMaterialType; }
//! Returns TRUE if type of this material is equal to specified type.
Standard_Boolean MaterialType (const Graphic3d_TypeOfMaterial theType) const { return myMaterialType == theType; }
@@ -223,27 +194,39 @@ public:
//! Returns TRUE if this material is identical to specified one.
Standard_Boolean IsEqual (const Graphic3d_MaterialAspect& theOther) const
{
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
return 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]
&& 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];
&& 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];
}
//! 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.
@@ -254,16 +237,18 @@ private:
{
// if a component of a "standard" material change, the
// result is no more standard (a blue gold is not a gold)
myMaterialName = Graphic3d_NOM_UserDefined;
myStringName = "UserDefined";
if (myMaterialName != Graphic3d_NOM_UserDefined)
{
myMaterialName = Graphic3d_NOM_UserDefined;
myStringName = "UserDefined";
}
}
private:
Graphic3d_BSDF myBSDF;
TCollection_AsciiString myStringName;
Quantity_Color myColors [Graphic3d_TypeOfReflection_NB];
Standard_ShortReal myColorCoef[Graphic3d_TypeOfReflection_NB];
Quantity_Color myColors[Graphic3d_TypeOfReflection_NB];
Standard_ShortReal myTransparencyCoef;
Standard_ShortReal myRefractionIndex;
Standard_ShortReal myShininess;
@@ -272,8 +257,6 @@ 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,
Graphic3d_MATERIAL_PHYSIC
Graphic3d_MATERIAL_ASPECT, //!< aspect material definition with configurable color (like plastic)
Graphic3d_MATERIAL_PHYSIC //!< physical material definition with fixed color (like gold)
};
#endif // _Graphic3d_TypeOfMaterial_HeaderFile

View File

@@ -6,7 +6,5 @@ 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

@@ -1,51 +0,0 @@
// 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

@@ -1,66 +0,0 @@
// 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,62 +877,6 @@ 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)
{
@@ -2494,7 +2438,6 @@ 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

@@ -589,6 +589,13 @@ bool Image_AlienPixMap::Load (const Standard_Byte* theData,
return false;
}
if (FreeImage_GetBPP (anImage) == 1)
{
FIBITMAP* aTmpImage = FreeImage_ConvertTo8Bits (anImage);
FreeImage_Unload (anImage);
anImage = aTmpImage;
}
Image_Format aFormat = convertFromFreeFormat (FreeImage_GetImageType(anImage),
FreeImage_GetColorType(anImage),
FreeImage_GetBPP (anImage));

View File

@@ -66,7 +66,7 @@ Interface_FileReaderTool::Interface_FileReaderTool ()
{
themessenger = Message::DefaultMessenger();
theerrhand = Standard_True;
thetrace = 1;
thetrace = 0;
thenbrep0 = thenbreps = 0;
}
@@ -334,8 +334,11 @@ void Interface_FileReaderTool::LoadModel
}
catch (Standard_Failure const&) {
// Sendinf of message : Internal error during the header reading
Message_Msg Msg11("XSTEP_11");
TF->Send (Msg11, Message_Info);
if (!TF.IsNull())
{
Message_Msg Msg11("XSTEP_11");
TF->Send(Msg11, Message_Info);
}
}
}
else
@@ -367,9 +370,12 @@ void Interface_FileReaderTool::LoadModel
// .. Fin Lecture ..
if (anent.IsNull()) {
// Sending of message : Number of ignored Null Entities
Message_Msg Msg21("XSTEP_21");
Msg21.Arg(amodel->NbEntities());
TF->Send (Msg21, Message_Info);
if (!TF.IsNull())
{
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)
@@ -392,13 +398,18 @@ 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
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
if (!TF.IsNull())
{
Message_Msg Msg21("XSTEP_21");
Msg21.Arg(amodel->NbEntities() + 1);
TF->Send(Msg21, Message_Info);
}
continue;
}
}
/*Handle(Interface_Check)*/ ach = new Interface_Check(anent);
@@ -408,10 +419,13 @@ void Interface_FileReaderTool::LoadModel
ach->SendFail (Msg278);
if (ierr == 2) {
// Sending of message : reading of entity failed
Message_Msg Msg22("XSTEP_22");
Msg22.Arg(amodel->StringLabel(anent));
TF->Send (Msg22, Message_Info);
// 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);
}
return;
}
@@ -420,10 +434,13 @@ 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
Message_Msg Msg23("XSTEP_23");
Msg23.Arg(num);
TF->Send (Msg23, Message_Info);
// Sending of message : recovered entity
if (!TF.IsNull())
{
Message_Msg Msg23("XSTEP_23");
Msg23.Arg(num);
TF->Send(Msg23, Message_Info);
}
}
// Finalement, on charge une Entite Inconnue
@@ -444,9 +461,12 @@ void Interface_FileReaderTool::LoadModel
else {
if (thetrace > 0) {
// Sending of message : reading of entity failed
Message_Msg Msg22("XSTEP_22");
Msg22.Arg(amodel->StringLabel(anent));
TF->Send (Msg22, Message_Info);
if (!TF.IsNull())
{
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
@@ -460,9 +480,12 @@ void Interface_FileReaderTool::LoadModel
if (thetrace > 0)
{
// Sending of message : report
Message_Msg Msg24("XSTEP_24");
Msg24.Arg(thenbreps);
TF->Send (Msg24, Message_Info);
if (!TF.IsNull())
{
Message_Msg Msg24("XSTEP_24");
Msg24.Arg(thenbreps);
TF->Send(Msg24, Message_Info);
}
}
amodel->Reservate (-thenbreps-10);
thenbreps = thereports->Upper();
@@ -483,8 +506,11 @@ void Interface_FileReaderTool::LoadModel
}
catch (Standard_Failure const&) {
// Sendinf of message : Internal error during the header reading
Message_Msg Msg11("XSTEP_11");
TF->Send (Msg11, Message_Info);
if (!TF.IsNull())
{
Message_Msg Msg11("XSTEP_11");
TF->Send(Msg11, Message_Info);
}
}
}
else
@@ -513,10 +539,13 @@ Handle(Standard_Transient) Interface_FileReaderTool::LoadedEntity
// Trace Entite Inconnue
if (thetrace >= 2 && theproto->IsUnknownEntity(anent)) {
Handle(Message_Messenger) TF = Messenger();
Message_Msg Msg22("XSTEP_22");
// Sending of message : reading of entity failed
Msg22.Arg(themodel->StringLabel(anent)->String());
TF->Send (Msg22, Message_Info);
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);
}
}
// .. Chargement proprement dit : Specifique de la Norme ..
AnalyseRecord(num,anent,ach);
@@ -545,7 +574,7 @@ Handle(Standard_Transient) Interface_FileReaderTool::LoadedEntity
}
thereports->SetValue(irep,rep);
if ( thetrace >= 2)
if ( thetrace >= 2 && !Messenger().IsNull())
ach->Print (Messenger(),2);
}

View File

@@ -508,7 +508,11 @@ bool Media_PlayerContext::receiveFrame (const Handle(Media_Frame)& theFrame,
//================================================================
void Media_PlayerContext::doThreadLoop()
{
OSD::SetSignal (false);
// always set OCCT signal handler to catch signals if any;
// this is safe (for thread local handler) since the thread
// is owned by this class
OSD::SetThreadLocalSignal (OSD_SignalMode_Set, false);
Handle(Media_Frame) aFrame;
bool wasSeeked = false;
for (;;)

View File

@@ -34,6 +34,7 @@ MeshVS_CommonSensitiveEntity::MeshVS_CommonSensitiveEntity (const Handle(SelectM
myDataSource (theParentMesh->GetDataSource()),
mySelMethod (theSelMethod)
{
myMaxFaceNodes = 0;
theParentMesh->GetDrawer()->GetInteger (MeshVS_DA_MaxFaceNodes, myMaxFaceNodes);
Standard_ASSERT_RAISE (myMaxFaceNodes > 0,
"The maximal amount of nodes in a face must be greater than zero to create sensitive entity");

View File

@@ -179,8 +179,7 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
//Now we are ready to draw faces with equal colors
Aspect_TypeOfLine anEdgeType = Aspect_TOL_SOLID;
Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID;
Standard_Integer anEdgeInt, aLineInt;
Standard_Real anEdgeWidth, aLineWidth;
Standard_Real anEdgeWidth = 1.0, aLineWidth = 1.0;
Quantity_Color anInteriorColor;
Quantity_Color anEdgeColor, aLineColor;
Standard_Boolean anEdgeOn = Standard_True, IsReflect = Standard_False,
@@ -197,9 +196,11 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
aDrawer->GetBoolean( MeshVS_DA_SmoothShading, IsMeshSmoothShading );
aDrawer->GetBoolean (MeshVS_DA_SupressBackFaces, toSupressBackFaces);
Standard_Integer anEdgeInt = Aspect_TOL_SOLID;
if ( aDrawer->GetInteger ( MeshVS_DA_EdgeType, anEdgeInt) )
anEdgeType = (Aspect_TypeOfLine) anEdgeInt;
Standard_Integer aLineInt = Aspect_TOL_SOLID;
if ( aDrawer->GetInteger ( MeshVS_DA_BeamType, aLineInt) )
aLineType = (Aspect_TypeOfLine) aLineInt;
@@ -215,13 +216,14 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
PolygonVerticesFor3D, PolygonBoundsFor3D );
}
Graphic3d_MaterialAspect aMaterial[2];
Graphic3d_MaterialAspect aMaterial[2] = { Graphic3d_NOM_PLASTIC, Graphic3d_NOM_PLASTIC };
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] = Graphic3d_MaterialAspect ( Graphic3d_NOM_PLASTIC );
aMaterial[i].SetSpecularColor (Quantity_NOC_BLACK);
aMaterial[i].SetEmissiveColor (Quantity_NOC_BLACK);
// 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,
@@ -229,10 +231,8 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
// and there is no need to spend time on updating material properties
if ( !IsReflect )
{
aMaterial[i].SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
aMaterial[i].SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
aMaterial[i].SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
aMaterial[i].SetReflectionModeOff(Graphic3d_TOR_EMISSION);
aMaterial[i].SetAmbientColor (Quantity_NOC_BLACK);
aMaterial[i].SetDiffuseColor (Quantity_NOC_BLACK);
}
else
{
@@ -241,10 +241,8 @@ 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].SetAmbient( .5 );
aMaterial[i].SetDiffuse( .5 );
aMaterial[i].SetSpecular( 0. );
aMaterial[i].SetEmissive( 0. );
aMaterial[i].SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (0.5f)));
aMaterial[i].SetDiffuseColor (Quantity_Color (Graphic3d_Vec3 (0.5f)));
}
}
@@ -481,13 +479,14 @@ void MeshVS_ElementalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)&
CustomBuild(Prs, aCustomElements, IDsToExclude, DisplayMode);
}
Graphic3d_MaterialAspect aMaterial2[2];
Graphic3d_MaterialAspect aMaterial2[2] = { Graphic3d_NOM_PLASTIC, Graphic3d_NOM_PLASTIC };
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] = Graphic3d_MaterialAspect ( Graphic3d_NOM_PLASTIC );
aMaterial2[i].SetSpecularColor (Quantity_NOC_BLACK);
aMaterial2[i].SetEmissiveColor (Quantity_NOC_BLACK);
if ( !IsReflect )
{
@@ -496,14 +495,8 @@ 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].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. );
aMaterial2[i].SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (1.0f)));
aMaterial2[i].SetDiffuseColor (Quantity_NOC_BLACK);
}
else
{
@@ -512,10 +505,8 @@ 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].SetAmbient( .5 );
aMaterial2[i].SetDiffuse( .5 );
aMaterial2[i].SetSpecular( 0. );
aMaterial2[i].SetEmissive( 0. );
aMaterial2[i].SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (0.5f)));
aMaterial2[i].SetDiffuseColor (Quantity_Color (Graphic3d_Vec3 (0.5f)));
}
}

View File

@@ -195,7 +195,7 @@ void MeshVS_MeshPrsBuilder::BuildElements( const Handle(Prs3d_Presentation)& Prs
aDispMode &= MeshVS_DMF_OCCMask;
//--------------------------------------------------------
Standard_Real aShrinkCoef;
Standard_Real aShrinkCoef = 0.0;
aDrawer->GetDouble ( MeshVS_DA_ShrinkCoeff, aShrinkCoef );
Standard_Boolean IsWireFrame = ( aDispMode==MeshVS_DMF_WireFrame ),
@@ -203,11 +203,12 @@ void MeshVS_MeshPrsBuilder::BuildElements( const Handle(Prs3d_Presentation)& Prs
IsShrink = ( aDispMode==MeshVS_DMF_Shrink ),
HasHilightFlag = ( ( DisplayMode & MeshVS_DMF_HilightPrs ) != 0 ),
HasSelectFlag = ( ( DisplayMode & MeshVS_DMF_SelectionPrs ) != 0 ),
IsMeshReflect, IsMeshAllowOverlap, IsReflect, IsMeshSmoothShading = Standard_False;
IsMeshReflect = Standard_False, IsMeshAllowOverlap = Standard_False,
IsMeshSmoothShading = Standard_False;
aDrawer->GetBoolean ( MeshVS_DA_Reflection, IsMeshReflect );
aDrawer->GetBoolean ( MeshVS_DA_IsAllowOverlapped, IsMeshAllowOverlap );
IsReflect = ( IsMeshReflect && !HasHilightFlag );
const Standard_Boolean IsReflect = ( IsMeshReflect && !HasHilightFlag );
aDrawer->GetBoolean ( MeshVS_DA_SmoothShading, IsMeshSmoothShading );
// display mode for highlighted prs of groups
@@ -219,10 +220,10 @@ void MeshVS_MeshPrsBuilder::BuildElements( const Handle(Prs3d_Presentation)& Prs
aDrawer->GetMaterial ( MeshVS_DA_FrontMaterial, AMat );
if ( !IsReflect )
{
AMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
AMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
AMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
AMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
AMat.SetAmbientColor (Quantity_NOC_BLACK);
AMat.SetDiffuseColor (Quantity_NOC_BLACK);
AMat.SetSpecularColor(Quantity_NOC_BLACK);
AMat.SetEmissiveColor(Quantity_NOC_BLACK);
}
Handle( Graphic3d_AspectFillArea3d ) aFill = MeshVS_Tool::CreateAspectFillArea3d( GetDrawer(), AMat );
Handle( Graphic3d_AspectLine3d ) aBeam = MeshVS_Tool::CreateAspectLine3d ( GetDrawer() );
@@ -533,10 +534,10 @@ void MeshVS_MeshPrsBuilder::BuildHilightPrs ( const Handle(Prs3d_Presentation)&
Graphic3d_MaterialAspect AMat;
aDrawer->GetMaterial ( MeshVS_DA_FrontMaterial, AMat );
AMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
AMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
AMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
AMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
AMat.SetAmbientColor (Quantity_NOC_BLACK);
AMat.SetDiffuseColor (Quantity_NOC_BLACK);
AMat.SetSpecularColor(Quantity_NOC_BLACK);
AMat.SetEmissiveColor(Quantity_NOC_BLACK);
Handle( Graphic3d_AspectFillArea3d ) aFill = MeshVS_Tool::CreateAspectFillArea3d( GetDrawer(), AMat );
Handle( Graphic3d_AspectLine3d ) aBeam = MeshVS_Tool::CreateAspectLine3d( GetDrawer() );

View File

@@ -189,20 +189,16 @@ 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 (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++ )
// 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)
{
aMaterial[i].SetSpecularColor (Quantity_NOC_BLACK);
aMaterial[i].SetEmissiveColor (Quantity_NOC_BLACK);
if ( !IsReflect )
{
aMaterial[ i ].SetReflectionModeOff( Graphic3d_TOR_SPECULAR );
aMaterial[ i ].SetReflectionModeOff( Graphic3d_TOR_AMBIENT );
aMaterial[ i ].SetReflectionModeOff( Graphic3d_TOR_DIFFUSE );
aMaterial[ i ].SetReflectionModeOff( Graphic3d_TOR_EMISSION );
aMaterial[i].SetAmbientColor (Quantity_NOC_BLACK);
aMaterial[i].SetDiffuseColor (Quantity_NOC_BLACK);
}
else{
// OCC20644 Using the material with reflection properties same as in
@@ -215,14 +211,10 @@ 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].SetAmbient( .5 );
aMaterial[i].SetDiffuse( .5 );
aMaterial[i].SetSpecular( 0. );
aMaterial[i].SetEmissive( 0. );
aMaterial[i].SetAmbientColor (Quantity_Color (Graphic3d_Vec3 (0.5f)));
aMaterial[i].SetDiffuseColor (Quantity_Color (Graphic3d_Vec3 (0.5f)));
}
}
}
// Create array of polygons for interior presentation of faces and volumes
Handle(Graphic3d_ArrayOfPolygons) aCPolyArr = new Graphic3d_ArrayOfPolygons
@@ -283,7 +275,7 @@ void MeshVS_NodalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
gp_Dir aDefNorm( 0., 0., 1. );
// Prepare for scaling the incoming colors
Standard_Real anColorRatio = aMaterial[0].Ambient();
const Standard_Real anColorRatio = !IsReflect ? 0.44f : 0.5f;
for (it.Reset(); it.More(); it.Next())
{
@@ -419,8 +411,7 @@ void MeshVS_NodalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
// Aspect_InteriorStyle aStyle;
// Standard_Integer aStyleInt;
Aspect_TypeOfLine anEdgeType = Aspect_TOL_SOLID;
Standard_Integer anEdgeInt;
Standard_Real anEdgeWidth;
Standard_Real anEdgeWidth = 1.0;
Quantity_Color anInteriorColor;
Quantity_Color anEdgeColor, aLineColor;
Standard_Boolean aShowEdges = Standard_True;
@@ -431,6 +422,7 @@ void MeshVS_NodalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
aDrawer->GetDouble ( MeshVS_DA_EdgeWidth, anEdgeWidth );
aDrawer->GetBoolean( MeshVS_DA_ShowEdges, aShowEdges );
Standard_Integer anEdgeInt = Aspect_TOL_SOLID;
if ( aDrawer->GetInteger ( MeshVS_DA_EdgeType, anEdgeInt ) )
anEdgeType = (Aspect_TypeOfLine) anEdgeInt;

View File

@@ -167,27 +167,29 @@ void MeshVS_TextPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
Standard_Real AExpansionFactor = 1.0;
Standard_Real ASpace = 0.0;
Aspect_TypeOfStyleText ATextStyle = Aspect_TOST_ANNOTATION;
Standard_Integer AStyleInt;
Aspect_TypeOfDisplayText ADisplayType = Aspect_TODT_NORMAL;
TCollection_AsciiString AFontString;
Standard_Integer ADispInt;
// Bold font is used by default for better text readability
Font_FontAspect AFontAspectType = Font_FA_Bold;
Standard_Integer AAspect;
aDrawer->GetColor ( MeshVS_DA_TextColor, AColor );
aDrawer->GetDouble ( MeshVS_DA_TextExpansionFactor, AExpansionFactor );
aDrawer->GetDouble ( MeshVS_DA_TextSpace, ASpace );
TCollection_AsciiString AFontString = Font_NOF_ASCII_MONO;
if ( aDrawer->GetAsciiString ( MeshVS_DA_TextFont, AFontString ) )
AFont = AFontString.ToCString();
Standard_Integer AStyleInt = Aspect_TOST_ANNOTATION;
if ( aDrawer->GetInteger ( MeshVS_DA_TextStyle, AStyleInt ) )
ATextStyle = (Aspect_TypeOfStyleText) AStyleInt;
Standard_Integer ADispInt = Aspect_TODT_NORMAL;
if ( aDrawer->GetInteger ( MeshVS_DA_TextDisplayType, ADispInt ) )
ADisplayType = (Aspect_TypeOfDisplayText) ADispInt;
Standard_Integer AAspect = Font_FA_Bold;
if ( aDrawer->GetInteger ( MeshVS_DA_TextFontAspect, AAspect ) )
AFontAspectType = (Font_FontAspect)AAspect;
AFontAspectType = (Font_FontAspect)AAspect;
Handle (Graphic3d_AspectText3d) aTextAspect = new Graphic3d_AspectText3d ( AColor, AFont, AExpansionFactor, ASpace,
ATextStyle, ADisplayType );

View File

@@ -13,9 +13,8 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// Purpose: Implementation of the BaseAllocator class
#include <NCollection_BaseAllocator.hxx>
#include <NCollection_IncAllocator.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_Map.hxx>
@@ -60,62 +59,50 @@ const Handle(NCollection_BaseAllocator)&
return pAllocator;
}
// 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
namespace
{
Standard_Size roundSize;
int nbAlloc;
int nbFree;
StorageInfo()
: roundSize(0), nbAlloc(0), nbFree(0) {}
StorageInfo(Standard_Size theSize)
: roundSize(theSize), nbAlloc(0), nbFree(0) {}
};
// global variable to ensure that allocator will be created during loading the library
static Handle(NCollection_BaseAllocator) theAllocInit = NCollection_BaseAllocator::CommonBaseAllocator();
//=======================================================================
/**
* 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;
}
//! 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 (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 (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 map (AllocationID)
*/
//=======================================================================
static NCollection_Map<Standard_Size>& StorageIDSet()
{
static NCollection_IncAllocator TheAlloc;
static NCollection_Map<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;
}
//=======================================================================
@@ -147,14 +134,6 @@ 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
@@ -170,11 +149,6 @@ 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

@@ -93,3 +93,4 @@ OSD_Timer.hxx
OSD_WhoAmI.hxx
OSD_WNT.cxx
OSD_WNT.hxx
OSD_SignalMode.hxx

View File

@@ -16,49 +16,26 @@
#define _OSD_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <Standard_PCharacter.hxx>
#include <Standard_CString.hxx>
class OSD_Error;
class OSD_Protection;
class OSD_Path;
class OSD_FileNode;
class OSD_Disk;
class OSD_File;
class OSD_FileIterator;
class OSD_Directory;
class OSD_DirectoryIterator;
class OSD_Timer;
class OSD_Host;
class OSD_Environment;
class OSD_EnvironmentIterator;
class OSD_Process;
class OSD_SharedLibrary;
class OSD_Thread;
#include <OSD_SignalMode.hxx>
//! Set of Operating Sytem Dependent Tools
//! (O)perating (S)ystem (D)ependent
//! Set of Operating Sytem Dependent (OSD) Tools
class OSD
{
public:
DEFINE_STANDARD_ALLOC
//! Sets signal and exception handlers.
//! Sets or removes signal and FPE (floating-point exception) handlers.
//! OCCT signal handlers translate signals raised by C subsystem to C++
//! exceptions inheriting Standard_Failure.
//!
//! ### Windows-specific notes
//!
//! Compiled with MS VC++ sets 3 main handlers:
//! @li Signal handlers (via ::signal() functions) that translate system signals
//! (SIGSEGV, SIGFPE, SIGILL) into C++ exceptions (classes inheriting
//! Standard_Failure). They only be called if user calls ::raise() function
//! Standard_Failure). They only be called if function ::raise() is called
//! with one of supported signal type set.
//! @li Exception handler OSD::WntHandler() (via ::SetUnhandledExceptionFilter())
//! that will be used when user's code is compiled with /EHs option.
@@ -71,41 +48,68 @@ public:
//! compile his code with (/EHs or /EHa), signals (or SE exceptions) will be
//! translated into Open CASCADE C++ exceptions.
//!
//! If @a theFloatingSignal is TRUE then floating point exceptions will be
//! generated in accordance with the mask
//! <tt>_EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW</tt> that is
//! used to call ::_controlfp() system function. If @a theFloatingSignal is FALSE
//! corresponding operations (e.g. division by zero) will gracefully complete
//! without an exception.
//! MinGW should use SEH exception mode for signal handling to work.
//!
//! ### Unix-specific notes
//! ### Linux-specific notes
//!
//! OSD::SetSignal() sets handlers (via ::sigaction()) for multiple signals
//! (SIGFPE, SIGSEGV, etc). Currently the number of handled signals is much
//! greater than for Windows, in the future this may change to provide better
//! consistency with Windows.
//!
//! @a theFloatingSignal is recognized on Sun Solaris, Linux, and SGI Irix to
//! generate floating-point exception according to the mask
//! <tt>FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW</tt> (in Linux conventions).<br>
//! When compiled with OBJS macro defined, already set signal handlers (e.g.
//! by Data Base Managers) are not redefined.
//! (SIGFPE, SIGSEGV, etc).
//!
//! ### Common notes
//!
//! If OSD::SetSignal() method is used in at least one thread, it must also be
//! called in any other thread where Open CASCADE will be used, to ensure
//! consistency of behavior. Its @a aFloatingSignal argument must be consistent
//! across threads.
//! If @a theFloatingSignal is TRUE then floating point exceptions will
//! generate SIGFPE in accordance with the mask
//! - Windows: _EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW,
//! see _controlfp() system function.
//! - Linux: FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW,
//! see feenableexcept() system function.
//!
//! Keep in mind that whether the C++ exception will really be thrown (i.e.
//! ::throw() will be called) is regulated by the
//! OCC_CONVERT_SIGNALS macro used during compilation of Open CASCADE and
//! user's code. Refer to Foundation Classes User's Guide for further details.
//! If @a theFloatingSignal is FALSE then floating point calculations will gracefully
//! complete regardless of occurred exceptions (e.g. division by zero).
//! Otherwise the (thread-specific) FPE flags are set to raise signal if one of
//! floating-point exceptions (division by zero, overflow, or invalid operation) occurs.
//!
Standard_EXPORT static void SetSignal (const Standard_Boolean theFloatingSignal = Standard_True);
//! The recommended approach is to call OSD::SetSignal() in the beginning of the
//! execution of the program, in function main() or its equivalent.
//! In multithreaded programs it is advisable to call OSD::SetSignal() or
//! OSD::SetThreadLocalSignal() with the same parameters in other threads where
//! OCCT is used, to ensure consistency of behavior.
//!
//! Note that in order to handle signals as C++ exceptions on Linux and under
//! MinGW on Windows it is necessary to compile both OCCT and application with
//! OCC_CONVERT_SIGNALS macro, and use macro OCC_CATCH_SIGNALS within each try{}
//! block that has to catch this kind of exceptions.
//!
//! Refer to documentation of Standard_ErrorHandler.hxx for details.
Standard_EXPORT static void SetSignal (OSD_SignalMode theSignalMode,
Standard_Boolean theFloatingSignal);
//! Return floating signal catching value previously set by SetSignal().
//! Sets signal and FPE handlers.
//! Short-cut for OSD::SetSignal (OSD_SignalMode_Set, theFloatingSignal).
static void SetSignal (const Standard_Boolean theFloatingSignal = Standard_True)
{
SetSignal (OSD_SignalMode_Set, theFloatingSignal);
}
//! Initializes thread-local signal handlers.
//! This includes _set_se_translator() on Windows platform, and SetFloatingSignal().
//! The main purpose of this method is initializing handlers for newly created threads
//! without overriding global handlers (set by application or by OSD::SetSignal()).
Standard_EXPORT static void SetThreadLocalSignal (OSD_SignalMode theSignalMode,
Standard_Boolean theFloatingSignal);
//! Enables / disables generation of C signal on floating point exceptions (FPE).
//! This call does NOT register a handler for signal raised in case of FPE -
//! SetSignal() should be called beforehand for complete setup.
//! Note that FPE setting is thread-local, new threads inherit it from parent.
Standard_EXPORT static void SetFloatingSignal (Standard_Boolean theFloatingSignal);
//! Returns signal mode set by the last call to SetSignal().
//! By default, returns OSD_SignalMode_AsIs.
Standard_EXPORT static OSD_SignalMode SignalMode();
//! Returns true if floating point exceptions will raise C signal
//! according to current (platform-dependent) settings in this thread.
Standard_EXPORT static Standard_Boolean ToCatchFloatingSignals();
//! Commands the process to sleep for a number of seconds.

View File

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

View File

@@ -40,7 +40,7 @@ void OSD_Parallel::forEachExternal (UniversalIterator& theBegin,
{
const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
const Standard_Integer aNbThreads = theNbItems > 0 ?
Min (theNbItems, aThreadPool->NbDefaultThreadsToLaunch()) : -1;
aThreadPool->NbDefaultThreadsToLaunch() : -1;
tbb::task_scheduler_init aScheduler (aNbThreads);
tbb::parallel_for_each (theBegin, theEnd, theFunctor);

View File

@@ -0,0 +1,26 @@
// Copyright (c) 2019 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 _OSD_SignalMode_HeaderFile
#define _OSD_SignalMode_HeaderFile
//! Mode of operation for OSD::SetSignal() function
enum OSD_SignalMode
{
OSD_SignalMode_AsIs, //!< Do not set or remove signal handlers
OSD_SignalMode_Set, //!< Set OCCT signal handlers
OSD_SignalMode_SetUnhandled, //!< Set OCCT signal handler but only if no handler is set, for each particular signal type
OSD_SignalMode_Unset //!< Unset signal handler to system default
};
#endif // _OSD_SignalMode_HeaderFile

View File

@@ -309,7 +309,7 @@ void OSD_ThreadPool::performJob (Handle(Standard_Failure)& theFailure,
// =======================================================================
void OSD_ThreadPool::EnumeratedThread::performThread()
{
OSD::SetSignal (false);
OSD::SetThreadLocalSignal (OSD::SignalMode(), false);
for (;;)
{
myWakeEvent.Wait();
@@ -322,7 +322,7 @@ void OSD_ThreadPool::EnumeratedThread::performThread()
myFailure.Nullify();
if (myJob != NULL)
{
OSD::SetSignal (myToCatchFpe);
OSD::SetThreadLocalSignal (OSD::SignalMode(), myToCatchFpe);
OSD_ThreadPool::performJob (myFailure, myJob, myThreadIndex);
myJob = NULL;
}

View File

@@ -16,16 +16,17 @@
#include <OSD_Exception_CTRL_BREAK.hxx>
#include <Standard_DivideByZero.hxx>
#include <Standard_Overflow.hxx>
#include <Standard_Assert.hxx>
static Standard_THREADLOCAL Standard_Boolean fFltExceptions = Standard_False;
static OSD_SignalMode OSD_WasSetSignal = OSD_SignalMode_AsIs;
//=======================================================================
//function : ToCatchFloatingSignals
//function : SignalMode
//purpose :
//=======================================================================
Standard_Boolean OSD::ToCatchFloatingSignals()
OSD_SignalMode OSD::SignalMode()
{
return fFltExceptions;
return OSD_WasSetSignal;
}
#ifdef _WIN32
@@ -90,7 +91,6 @@ static Standard_Boolean fDbgLoaded;
static LONG _osd_debug ( void );
#endif
//# define _OSD_FPX ( _EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW | _EM_UNDERFLOW )
# define _OSD_FPX ( _EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW )
#ifdef OCC_CONVERT_SIGNALS
@@ -236,15 +236,16 @@ static LONG CallHandler (DWORD dwExceptionCode,
} // end switch
// reset FPE state (before message box, otherwise it may fail to show up)
if ( flterr ) {
OSD::SetFloatingSignal (Standard_True);
}
#if ! defined(OCCT_UWP) && !defined(__MINGW32__) && !defined(__CYGWIN32__)
// provide message to the user with possibility to stop
size_t idx;
StringCchLengthW (buffer, _countof(buffer),&idx);
if ( idx && fMsgBox && dwExceptionCode != EXCEPTION_NONCONTINUABLE_EXCEPTION ) {
// reset FP operations before message box, otherwise it may fail to show up
_fpreset();
_clearfp();
#if ! defined(OCCT_UWP) && !defined(__MINGW32__) && !defined(__CYGWIN32__)
MessageBeep ( MB_ICONHAND );
int aChoice = ::MessageBoxW (0, buffer, L"OCCT Exception Handler", MB_ABORTRETRYIGNORE | MB_ICONSTOP);
if (aChoice == IDRETRY)
@@ -253,17 +254,8 @@ static LONG CallHandler (DWORD dwExceptionCode,
DebugBreak();
} else if (aChoice == IDABORT)
exit(0xFFFF);
}
#endif
}
// reset FPE state
if ( flterr ) {
if ( !fFltExceptions ) return EXCEPTION_EXECUTE_HANDLER;
_fpreset () ;
_clearfp() ;
_controlfp ( 0, _OSD_FPX ) ; // JR add :
// std::cout << "OSD::WntHandler _controlfp( 0, _OSD_FPX ) " << std::hex << _controlfp(0,0) << std::dec << std::endl ;
}
char aBufferA[2048];
WideCharToMultiByte(CP_UTF8, 0, buffer, -1, aBufferA, sizeof(aBufferA), NULL, NULL);
@@ -367,13 +359,60 @@ static LONG WINAPI WntHandler (EXCEPTION_POINTERS *lpXP)
lpXP->ExceptionRecord->ExceptionInformation[0]);
}
//=======================================================================
//function : SetFloatingSignal
//purpose :
//=======================================================================
void OSD::SetFloatingSignal (Standard_Boolean theFloatingSignal)
{
_fpreset();
_clearfp();
// Note: zero bit means exception will be raised
_controlfp (theFloatingSignal ? 0 : _OSD_FPX, _OSD_FPX);
}
//=======================================================================
//function : ToCatchFloatingSignals
//purpose :
//=======================================================================
Standard_Boolean OSD::ToCatchFloatingSignals()
{
// return true if at least one of bits within _OSD_FPX
// is unset, which means relevant FPE will raise exception
int aControlWord = _controlfp (0, 0);
return (_OSD_FPX & ~aControlWord) != 0;
}
//=======================================================================
//function : SetThreadLocalSignal
//purpose :
//=======================================================================
void OSD::SetThreadLocalSignal (OSD_SignalMode theSignalMode,
Standard_Boolean theFloatingSignal)
{
#ifdef _MSC_VER
_se_translator_function aPreviousFunc = NULL;
if (theSignalMode == OSD_SignalMode_Set || theSignalMode == OSD_SignalMode_SetUnhandled)
aPreviousFunc = _set_se_translator(TranslateSE);
if (theSignalMode == OSD_SignalMode_Unset || (theSignalMode == OSD_SignalMode_SetUnhandled && aPreviousFunc != NULL))
_set_se_translator(aPreviousFunc);
#else
(void)theSignalMode;
#endif
SetFloatingSignal (theFloatingSignal);
}
//=======================================================================
//function : SetSignal
//purpose :
//=======================================================================
void OSD::SetSignal (const Standard_Boolean theFloatingSignal)
void OSD::SetSignal (OSD_SignalMode theSignalMode,
Standard_Boolean theFloatingSignal)
{
Standard_Mutex::Sentry aSentry (THE_SIGNAL_MUTEX); // lock the mutex to prevent simultaneous handling
OSD_WasSetSignal = theSignalMode;
#if !defined(OCCT_UWP) || defined(NTDDI_WIN10_TH2)
OSD_Environment env ("CSF_DEBUG_MODE");
TCollection_AsciiString val = env.Value();
@@ -391,37 +430,53 @@ void OSD::SetSignal (const Standard_Boolean theFloatingSignal)
// when user's code is compiled with /EHs
// Replaces the existing top-level exception filter for all existing and all future threads
// in the calling process
::SetUnhandledExceptionFilter (/*(LPTOP_LEVEL_EXCEPTION_FILTER)*/ WntHandler);
{
LPTOP_LEVEL_EXCEPTION_FILTER aPreviousFunc = NULL;
if (theSignalMode == OSD_SignalMode_Set || theSignalMode == OSD_SignalMode_SetUnhandled)
{
aPreviousFunc = ::SetUnhandledExceptionFilter(WntHandler);
}
if (theSignalMode == OSD_SignalMode_Unset || (theSignalMode == OSD_SignalMode_SetUnhandled && aPreviousFunc != NULL))
{
::SetUnhandledExceptionFilter(aPreviousFunc);
}
}
#endif // NTDDI_WIN10_TH2
// Signal handlers will only be used when the method ::raise() will be used
// Handlers must be set for every thread
if (signal (SIGSEGV, (void(*)(int))SIGWntHandler) == SIG_ERR)
std::cout << "signal(OSD::SetSignal) error\n";
if (signal (SIGFPE, (void(*)(int))SIGWntHandler) == SIG_ERR)
std::cout << "signal(OSD::SetSignal) error\n";
if (signal (SIGILL, (void(*)(int))SIGWntHandler) == SIG_ERR)
std::cout << "signal(OSD::SetSignal) error\n";
// Signal handlers will only be used when function ::raise() is called
const int NBSIG = 3;
const int aSignalTypes[NBSIG] = { SIGSEGV, SIGILL, SIGFPE };
for (int i = 0; i < NBSIG; ++i)
{
typedef void (*SignalFuncType)(int); // same as _crt_signal_t available since vc14
SignalFuncType aPreviousFunc = SIG_DFL;
if (theSignalMode == OSD_SignalMode_Set || theSignalMode == OSD_SignalMode_SetUnhandled)
{
aPreviousFunc = signal(aSignalTypes[i], (SignalFuncType)SIGWntHandler);
}
if (theSignalMode == OSD_SignalMode_Unset ||
(theSignalMode == OSD_SignalMode_SetUnhandled && aPreviousFunc != SIG_DFL && aPreviousFunc != SIG_ERR))
{
aPreviousFunc = signal(aSignalTypes[i], aPreviousFunc);
}
Standard_ASSERT(aPreviousFunc != SIG_ERR, "signal() failed", std::cout << "OSD::SetSignal(): signal() returns SIG_ERR");
}
// Set Ctrl-C and Ctrl-Break handler
fCtrlBrk = Standard_False;
#ifndef OCCT_UWP
SetConsoleCtrlHandler (&_osd_ctrl_break_handler, TRUE);
#endif
#ifdef _MSC_VER
// _se_translator_function pOldSeFunc =
_set_se_translator (TranslateSE);
if (theSignalMode == OSD_SignalMode_Set || theSignalMode == OSD_SignalMode_SetUnhandled)
{
SetConsoleCtrlHandler(&_osd_ctrl_break_handler, true);
}
else if (theSignalMode == OSD_SignalMode_Unset)
{
SetConsoleCtrlHandler(&_osd_ctrl_break_handler, false);
}
#endif
fFltExceptions = theFloatingSignal;
if (theFloatingSignal)
{
_controlfp (0, _OSD_FPX); // JR add :
}
else {
_controlfp (_OSD_FPX, _OSD_FPX); // JR add :
}
} // end OSD :: SetSignal
SetThreadLocalSignal (theSignalMode, theFloatingSignal);
}
//============================================================================
//==== ControlBreak
@@ -636,18 +691,12 @@ static Standard_Boolean fCtrlBrk;
typedef void (ACT_SIGIO_HANDLER)(void) ;
ACT_SIGIO_HANDLER *ADR_ACT_SIGIO_HANDLER = NULL ;
#ifdef DECOSF1
typedef void (* SIG_PFV) (int);
#endif
#ifdef __GNUC__
# include <stdlib.h>
# include <stdio.h>
#else
# ifdef SA_SIGINFO
# ifndef _AIX
# include <sys/siginfo.h>
# endif
# endif
#endif
typedef void (* SIG_PFV) (int);
@@ -658,6 +707,8 @@ typedef void (* SIG_PFV) (int);
#include <sys/signal.h>
#endif
# define _OSD_FPX (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW)
//============================================================================
//==== Handler
//==== Catche the differents signals:
@@ -696,11 +747,7 @@ static void Handler (const int theSignal)
// std::cout << "OSD::Handler: signal " << (int) theSignal << " occured inside a try block " << std::endl ;
if ( ADR_ACT_SIGIO_HANDLER != NULL )
(*ADR_ACT_SIGIO_HANDLER)() ;
#ifdef __linux__
if (fFltExceptions)
feenableexcept (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
//feenableexcept (FE_INVALID | FE_DIVBYZERO);
#endif
sigset_t set;
sigemptyset(&set);
switch (theSignal) {
@@ -746,10 +793,8 @@ static void Handler (const int theSignal)
case SIGFPE:
sigaddset(&set, SIGFPE);
sigprocmask(SIG_UNBLOCK, &set, NULL) ;
#ifdef DECOSF1
// Pour DEC/OSF1 SIGFPE = Division par zero.
Standard_DivideByZero::NewInstance('')->Jump;
break;
#ifdef __linux__
OSD::SetFloatingSignal (Standard_True);
#endif
#if (!defined (__sun)) && (!defined(SOLARIS))
Standard_NumericError::NewInstance("SIGFPE Arithmetic exception detected")->Jump();
@@ -788,12 +833,6 @@ static void Handler (const int theSignal)
}
#endif
break;
#if defined (__sgi) || defined(IRIX)
case SIGTRAP:
sigaddset(&set, SIGTRAP);
sigprocmask(SIG_UNBLOCK, &set, NULL) ;
Standard_DivideByZero::NewInstance("SIGTRAP IntegerDivideByZero")->Jump(); break;
#endif
default:
#ifdef OCCT_DEBUG
std::cout << "Unexpected signal " << theSignal << std::endl ;
@@ -814,11 +853,6 @@ static void SegvHandler(const int theSignal,
(void)theSignal; // silence GCC warnings
(void)theContext;
#ifdef __linux__
if (fFltExceptions)
feenableexcept (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
//feenableexcept (FE_INVALID | FE_DIVBYZERO);
#endif
// std::cout << "OSD::SegvHandler activated(SA_SIGINFO)" << std::endl ;
if ( ip != NULL ) {
sigset_t set;
@@ -874,160 +908,127 @@ static void SegvHandler(const int theSignal,
#endif
//=======================================================================
//function : SetFloatingSignal
//purpose :
//=======================================================================
void OSD::SetFloatingSignal (Standard_Boolean theFloatingSignal)
{
#if defined (__linux__)
feclearexcept (FE_ALL_EXCEPT);
if (theFloatingSignal)
{
feenableexcept (_OSD_FPX);
}
else
{
fedisableexcept (_OSD_FPX);
}
#elif defined (__sun) || defined (SOLARIS)
int aSunStat = 0;
sigfpe_handler_type anFpeHandler = (theFloatingSignal ? (sigfpe_handler_type)Handler : NULL);
aSunStat = ieee_handler ("set", "invalid", anFpeHandler);
aSunStat = ieee_handler ("set", "division", anFpeHandler) || aSunStat;
aSunStat = ieee_handler ("set", "overflow", anFpeHandler) || aSunStat;
if (aSunStat)
{
#ifdef OCCT_DEBUG
std::cerr << "ieee_handler does not work !!! KO\n";
#endif
}
#else
(void)theFloatingSignal;
#endif
}
//=======================================================================
//function : ToCatchFloatingSignals
//purpose :
//=======================================================================
Standard_Boolean OSD::ToCatchFloatingSignals()
{
#if defined (__linux__)
return (fegetexcept() & _OSD_FPX) != 0;
#else
return Standard_False;
#endif
}
//=======================================================================
//function : SetThreadLocalSignal
//purpose :
//=======================================================================
void OSD::SetThreadLocalSignal (OSD_SignalMode /*theSignalMode*/,
Standard_Boolean theFloatingSignal)
{
SetFloatingSignal (theFloatingSignal);
}
//============================================================================
//==== SetSignal
//==== Set the differents signals:
//============================================================================
void OSD::SetSignal(const Standard_Boolean aFloatingSignal)
void OSD::SetSignal (OSD_SignalMode theSignalMode,
Standard_Boolean theFloatingSignal)
{
struct sigaction act, oact;
int stat = 0;
SetFloatingSignal (theFloatingSignal);
if( aFloatingSignal ) {
//==== Enable the floating point exceptions ===============
#if defined (__sun) || defined (SOLARIS)
sigfpe_handler_type PHandler = (sigfpe_handler_type) Handler ;
stat = ieee_handler("set", "invalid", PHandler);
stat = ieee_handler("set", "division", PHandler) || stat;
stat = ieee_handler("set", "overflow", PHandler) || stat;
OSD_WasSetSignal = theSignalMode;
if (theSignalMode == OSD_SignalMode_AsIs)
{
return; // nothing to be done with signal handlers
}
//stat = ieee_handler("set", "underflow", PHandler) || stat;
//stat = ieee_handler("set", "inexact", PHandler) || stat;
// Prepare signal descriptors
struct sigaction anActSet, anActDfl, anActOld;
sigemptyset(&anActSet.sa_mask);
sigemptyset(&anActDfl.sa_mask);
sigemptyset(&anActOld.sa_mask);
#ifdef SA_RESTART
anActSet.sa_flags = anActDfl.sa_flags = anActOld.sa_flags = SA_RESTART;
#else
anActSet.sa_flags = anActDfl.sa_flags = anActOld.sa_flags = 0;
#endif
#ifdef SA_SIGINFO
anActSet.sa_flags = anActSet.sa_flags | SA_SIGINFO;
anActSet.sa_sigaction = Handler;
#else
anActSet.sa_handler = Handler;
#endif
anActDfl.sa_handler = SIG_DFL;
if (stat) {
#ifdef OCCT_DEBUG
std::cerr << "ieee_handler does not work !!! KO " << std::endl;
// Set signal handlers; NB: SIGSEGV must be the last one!
const int NBSIG = 8;
const int aSignalTypes[NBSIG] = { SIGFPE, SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGBUS, SIGSYS, SIGSEGV };
for (int i = 0; i < NBSIG; ++i)
{
// SIGSEGV has special handler
if (aSignalTypes[i] == SIGSEGV)
{
#ifdef SA_SIGINFO
anActSet.sa_sigaction = /*(void(*)(int, siginfo_t *, void*))*/ SegvHandler;
#else
anActSet.sa_handler = /*(SIG_PFV)*/ SegvHandler;
#endif
}
#elif defined (__linux__)
feenableexcept (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
fFltExceptions = Standard_True;
#endif
// set handler according to specified mode and current handler
int retcode = -1;
if (theSignalMode == OSD_SignalMode_Set || theSignalMode == OSD_SignalMode_SetUnhandled)
{
retcode = sigaction (aSignalTypes[i], &anActSet, &anActOld);
}
else if (theSignalMode == OSD_SignalMode_Unset)
{
retcode = sigaction (aSignalTypes[i], &anActDfl, &anActOld);
}
if (theSignalMode == OSD_SignalMode_SetUnhandled && retcode == 0 && anActOld.sa_handler != SIG_DFL)
{
retcode = sigaction (aSignalTypes[i], &anActOld, &anActOld);
}
Standard_ASSERT(retcode == 0, "sigaction() failed", std::cout << "OSD::SetSignal(): sigaction() failed for " << aSignalTypes[i] << std::endl);
}
else
{
#if defined (__linux__)
fedisableexcept (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
fFltExceptions = Standard_False;
#endif
}
#if defined (sgi) || defined (IRIX )
char *TRAP_FPE = getenv("TRAP_FPE") ;
if ( TRAP_FPE == NULL ) {
#ifdef OCCT_DEBUG
std::cout << "On SGI you must set TRAP_FPE environment variable : " << std::endl ;
std::cout << "set env(TRAP_FPE) \"UNDERFL=FLUSH_ZERO;OVERFL=DEFAULT;DIVZERO=DEFAULT;INT_OVERFL=DEFAULT\" or" << std::endl ;
std::cout << "setenv TRAP_FPE \"UNDERFL=FLUSH_ZERO;OVERFL=DEFAULT;DIVZERO=DEFAULT;INT_OVERFL=DEFAULT\"" << std::endl ;
#endif
}
#endif
//==== Save the old Signal Handler, and set the new one ===================
sigemptyset(&act.sa_mask) ;
#ifdef SA_RESTART
act.sa_flags = SA_RESTART ;
#else
act.sa_flags = 0 ;
#endif
#ifdef SA_SIGINFO
act.sa_flags = act.sa_flags | SA_SIGINFO ;
act.sa_sigaction = /*(void(*)(int, siginfo_t *, void*))*/ Handler;
#else
act.sa_handler = /*(SIG_PFV)*/ Handler;
#endif
//==== Always detected the signal "SIGFPE" =================================
stat = sigaction(SIGFPE,&act,&oact); // ...... floating point exception
if (stat) {
#ifdef OCCT_DEBUG
std::cerr << "sigaction does not work !!! KO " << std::endl;
#endif
perror("sigaction ");
}
//==== Detected the only the "free" signals ================================
sigaction(SIGHUP,&act,&oact); // ...... hangup
#ifdef OBJS
if(oact.sa_handler)
sigaction(SIGHUP,&oact,&oact);
#endif
sigaction(SIGINT,&act,&oact); // ...... interrupt
#ifdef OBJS
if(oact.sa_handler)
sigaction(SIGINT,&oact,&oact);
#endif
sigaction(SIGQUIT,&act,&oact); // ...... quit
#ifdef OBJS
if(oact.sa_handler)
sigaction(SIGQUIT,&oact,&oact);
#endif
sigaction(SIGILL,&act,&oact); // ...... illegal instruction
#ifdef OBJS
if(oact.sa_handler)
sigaction(SIGILL,&oact,&oact);
#endif
sigaction(SIGBUS,&act,&oact); // ...... bus error
#ifdef OBJS
if(oact.sa_handler)
sigaction(SIGBUS,&oact,&oact);
#endif
#if !defined(__linux__)
sigaction(SIGSYS,&act,&oact); // ...... bad argument to system call
# ifdef OBJS
if(oact.sa_handler)
sigaction(SIGSYS,&oact,&oact);
# endif
#endif
#if defined (__sgi) || defined(IRIX)
sigaction(SIGTRAP,&act,&oact); // Integer Divide By Zero (IRIX)
# ifdef OBJS
if(oact.sa_handler)
sigaction(SIGTRAP,&oact,&oact);
# endif
#endif
#ifdef SA_SIGINFO
act.sa_sigaction = /*(void(*)(int, siginfo_t *, void*))*/ SegvHandler;
#else
act.sa_handler = /*(SIG_PFV)*/ SegvHandler;
#endif
if ( sigaction( SIGSEGV , &act , &oact ) ) // ...... segmentation violation
perror("OSD::SetSignal sigaction( SIGSEGV , &act , &oact ) ") ;
#ifdef OBJS
if(oact.sa_handler)
sigaction(SIGSEGV,&oact,&oact);
#endif
#if defined(__osf__) || defined(DECOSF1)
struct sigaction action, prev_action;
action.sa_handler = SIG_IGN;
action.sa_mask = 0;
action.sa_flags = 0;
if (sigaction (SIGFPE, &action, &prev_action) == -1) {
perror ("sigaction");
exit (1);
}
#endif
}
//============================================================================

View File

@@ -25,14 +25,10 @@ namespace
{
Graphic3d_MaterialAspect aMat;
aMat.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
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.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.SetShininess (10.0f / 128.0f);
aMat.SetRefractionIndex (1.0f);
return aMat;

View File

@@ -162,6 +162,7 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
myTexClamp (GL_CLAMP_TO_EDGE),
myMaxTexDim (1024),
myMaxTexCombined (1),
myMaxTexUnitsFFP (1),
myMaxDumpSizeX (1024),
myMaxDumpSizeY (1024),
myMaxClipPlanes (6),
@@ -1557,18 +1558,19 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
}
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &myMaxTexDim);
#if !defined(GL_ES_VERSION_2_0)
if (IsGlGreaterEqual (1, 3) && core11 != NULL)
{
// this is a maximum of texture units for FFP functionality,
// usually smaller than combined texture units available for GLSL
glGetIntegerv (GL_MAX_TEXTURE_UNITS, &myMaxTexUnitsFFP);
myMaxTexCombined = myMaxTexUnitsFFP;
}
#endif
if (IsGlGreaterEqual (2, 0))
{
glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &myMaxTexCombined);
}
#if !defined(GL_ES_VERSION_2_0)
else if (IsGlGreaterEqual (1, 3))
{
// this is a maximum of texture units for FFP functionality,
// dramatically smaller than combined texture units available for GLSL
glGetIntegerv (GL_MAX_TEXTURE_UNITS, &myMaxTexCombined);
}
#endif
mySpriteTexUnit = myMaxTexCombined >= 2
? Graphic3d_TextureUnit_1
: Graphic3d_TextureUnit_0;
@@ -3233,13 +3235,13 @@ Handle(OpenGl_TextureSet) OpenGl_Context::BindTextures (const Handle(OpenGl_Text
{
if (const Handle(OpenGl_Texture)& aTextureOld = aTextureIterOld.Value())
{
aTextureOld->Unbind(aThisCtx);
#if !defined(GL_ES_VERSION_2_0)
if (core11 != NULL)
{
OpenGl_Sampler::resetGlobalTextureParams (aThisCtx, *aTextureOld, aTextureOld->Sampler()->Parameters());
}
#endif
aTextureOld->Unbind (aThisCtx);
}
}
break;
@@ -3260,13 +3262,13 @@ Handle(OpenGl_TextureSet) OpenGl_Context::BindTextures (const Handle(OpenGl_Text
{
if (!aTextureOld.IsNull())
{
aTextureOld->Unbind(aThisCtx);
#if !defined(GL_ES_VERSION_2_0)
if (core11 != NULL)
{
OpenGl_Sampler::resetGlobalTextureParams (aThisCtx, *aTextureOld, aTextureOld->Sampler()->Parameters());
}
#endif
aTextureOld->Unbind (aThisCtx);
}
aTextureIterNew.Next();

View File

@@ -497,6 +497,11 @@ public:
//! @return value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
Standard_Integer MaxCombinedTextureUnits() const { return myMaxTexCombined; }
//! This method returns the multi-texture limit for obsolete fixed-function pipeline.
//! Use MaxCombinedTextureUnits() instead for limits for using programmable pipeline.
//! @return value for GL_MAX_TEXTURE_UNITS
Standard_Integer MaxTextureUnitsFFP() const { return myMaxTexUnitsFFP; }
//! @return texture unit to be used for sprites
Graphic3d_TextureUnit SpriteTextureUnit() const { return mySpriteTexUnit; }
@@ -965,6 +970,7 @@ private: // context info
Standard_Integer myTexClamp; //!< either GL_CLAMP_TO_EDGE (1.2+) or GL_CLAMP (1.1)
Standard_Integer myMaxTexDim; //!< value for GL_MAX_TEXTURE_SIZE
Standard_Integer myMaxTexCombined; //!< value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
Standard_Integer myMaxTexUnitsFFP; //!< value for GL_MAX_TEXTURE_UNITS (fixed-function pipeline only)
Standard_Integer myMaxDumpSizeX; //!< maximum FBO width for image dump
Standard_Integer myMaxDumpSizeY; //!< maximum FBO height for image dump
Standard_Integer myMaxClipPlanes; //!< value for GL_MAX_CLIP_PLANES

View File

@@ -43,6 +43,14 @@ 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

@@ -276,7 +276,8 @@ void OpenGl_Sampler::applyGlobalTextureParams (const Handle(OpenGl_Context)& the
(void )theTexture;
(void )theParams;
#else
if (theCtx->core11 == NULL)
if (theCtx->core11 == NULL
|| theParams->TextureUnit() >= theCtx->MaxTextureUnitsFFP())
{
return;
}

View File

@@ -47,66 +47,6 @@ 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,89 +43,35 @@ namespace OpenGl_Raytrace
}
//! Stores properties of surface material.
class OpenGl_RaytraceMaterial
struct OpenGl_RaytraceMaterial
{
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;
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
//! Physically-based material properties (used in path tracing engine).
struct Physical
{
//! 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;
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
} BSDF;
public:
//! Creates new default material.
//! Empty constructor.
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()
{
@@ -134,15 +80,11 @@ public:
};
//! Stores properties of OpenGL light source.
class OpenGl_RaytraceLight
struct OpenGl_RaytraceLight
{
public:
//! Diffuse intensity (in terms of OpenGL).
BVH_Vec4f Emission;
//! Position of light source (in terms of OpenGL).
BVH_Vec4f Position;
BVH_Vec4f Emission; //!< Diffuse intensity (in terms of OpenGL)
BVH_Vec4f Position; //!< Position of light source (in terms of OpenGL)
public:

View File

@@ -58,7 +58,6 @@ 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,90 +350,67 @@ void buildTextureTransform (const Handle(Graphic3d_TextureParams)& theParams, BV
OpenGl_RaytraceMaterial OpenGl_View::convertMaterial (const OpenGl_Aspects* theAspect,
const Handle(OpenGl_Context)& theGlContext)
{
OpenGl_RaytraceMaterial theMaterial;
OpenGl_RaytraceMaterial aResMat;
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());
// ambient component
if (aSrcMat.ReflectionMode (Graphic3d_TOR_AMBIENT))
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())
{
const OpenGl_Vec3& aSrcAmb = isPhysic ? aSrcMat.AmbientColor() : aMatCol;
theMaterial.Ambient = BVH_Vec4f (aSrcAmb * (float )aSrcMat.Ambient(), 1.0f);
}
else
{
theMaterial.Ambient = THE_BLACK_COLOR;
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;
}
}
// diffusion component
if (aSrcMat.ReflectionMode (Graphic3d_TOR_DIFFUSE))
{
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()));
// 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 Standard_ShortReal aReflectionScale = 0.75f / aMaxRefl;
// 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;
aResMat.Reflection.SetValues (aSrcSpe * aReflectionScale, 0.0f);
}
const float anIndex = (float )aSrcMat.RefractionIndex();
theMaterial.Transparency = BVH_Vec4f (aSrcMat.Alpha(), aSrcMat.Transparency(),
anIndex == 0 ? 1.0f : anIndex,
anIndex == 0 ? 1.0f : 1.0f / anIndex);
aResMat.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();
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.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.Absorption = aBSDF.Absorption;
aResMat.BSDF.Absorption = aBSDF.Absorption;
theMaterial.BSDF.FresnelCoat = aBSDF.FresnelCoat.Serialize ();
theMaterial.BSDF.FresnelBase = aBSDF.FresnelBase.Serialize ();
aResMat.BSDF.FresnelCoat = aBSDF.FresnelCoat.Serialize ();
aResMat.BSDF.FresnelBase = aBSDF.FresnelBase.Serialize ();
// Handle material textures
if (!theAspect->Aspect()->ToMapTexture())
{
return theMaterial;
return aResMat;
}
const Handle(OpenGl_TextureSet)& aTextureSet = theAspect->TextureSet (theGlContext);
@@ -441,30 +418,26 @@ OpenGl_RaytraceMaterial OpenGl_View::convertMaterial (const OpenGl_Aspects* theA
|| aTextureSet->IsEmpty()
|| aTextureSet->First().IsNull())
{
return theMaterial;
return aResMat;
}
if (theGlContext->HasRayTracingTextures())
{
const Handle(OpenGl_Texture)& aTexture = aTextureSet->First();
buildTextureTransform (aTexture->Sampler()->Parameters(), theMaterial.TextureTransform);
buildTextureTransform (aTexture->Sampler()->Parameters(), aResMat.TextureTransform);
// write texture ID to diffuse w-component
theMaterial.Diffuse.w() = theMaterial.BSDF.Kd.w() = static_cast<Standard_ShortReal> (myRaytraceGeometry.AddTexture (aTexture));
aResMat.Diffuse.w() = aResMat.BSDF.Kd.w() = static_cast<Standard_ShortReal> (myRaytraceGeometry.AddTexture (aTexture));
}
else if (!myIsRaytraceWarnTextures)
{
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);
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.");
myIsRaytraceWarnTextures = Standard_True;
}
return theMaterial;
return aResMat;
}
// =======================================================================

View File

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

View File

@@ -57,52 +57,30 @@ 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();
// ambient component
if (theMat.ReflectionMode (Graphic3d_TOR_AMBIENT))
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())
{
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;
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;
}
}
}
@@ -146,6 +124,12 @@ 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,9 +76,13 @@ const Quantity_Color& Prs3d_ShadingAspect::Color (const Aspect_TypeOfFacingModel
default:
case Aspect_TOFM_BOTH_SIDE:
case Aspect_TOFM_FRONT_SIDE:
return myAspect->FrontMaterial().Color();
return myAspect->FrontMaterial().MaterialType() == Graphic3d_MATERIAL_ASPECT
? myAspect->InteriorColor()
: myAspect->FrontMaterial().Color();
case Aspect_TOFM_BACK_SIDE:
return myAspect->BackMaterial().Color();
return myAspect->BackMaterial().MaterialType() == Graphic3d_MATERIAL_ASPECT
? myAspect->BackInteriorColor()
: myAspect->BackMaterial().Color();
}
}

View File

@@ -55,6 +55,7 @@
#include <OSD_Exception_ACCESS_VIOLATION.hxx>
#include <OSD_Exception_STACK_OVERFLOW.hxx>
#include <OSD.hxx>
#include <OSD_ThreadPool.hxx>
#include <STEPCAFControl_Writer.hxx>
#include <STEPControl_StepModelType.hxx>
#include <Interface_Static.hxx>
@@ -2458,6 +2459,68 @@ static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, co
return 0;
}
//! Auxiliary functor.
struct TestParallelFunctor
{
TestParallelFunctor() : myNbNotRaised (0), myNbSigSegv (0), myNbUnknown (0) {}
Standard_Integer NbNotRaised() const { return myNbNotRaised; }
Standard_Integer NbSigSegv() const { return myNbSigSegv; }
Standard_Integer NbUnknown() const { return myNbUnknown; }
void operator() (int theThreadId, int theTaskId) const
{
(void )theThreadId;
(void )theTaskId;
// Test Access Violation
{
try {
OCC_CATCH_SIGNALS
int* pint = NULL;
*pint = 4;
Standard_Atomic_Increment (&myNbNotRaised);
}
#ifdef _WIN32
catch (OSD_Exception_ACCESS_VIOLATION const&)
#else
catch (OSD_SIGSEGV const&)
#endif
{
Standard_Atomic_Increment (&myNbSigSegv);
}
catch (Standard_Failure const& )
{
Standard_Atomic_Increment (&myNbUnknown);
}
}
}
private:
mutable volatile Standard_Integer myNbNotRaised;
mutable volatile Standard_Integer myNbSigSegv;
mutable volatile Standard_Integer myNbUnknown;
};
static Standard_Integer OCC30775 (Draw_Interpretor& theDI, Standard_Integer theNbArgs, const char** )
{
if (theNbArgs != 1)
{
std::cout << "Syntax error: wrong number of arguments\n";
return 1;
}
Handle(OSD_ThreadPool) aPool = new OSD_ThreadPool (4);
OSD_ThreadPool::Launcher aLauncher (*aPool, 4);
TestParallelFunctor aFunctor;
aLauncher.Perform (0, 100, aFunctor);
theDI << "NbRaised: " << (aFunctor.NbSigSegv() + aFunctor.NbUnknown()) << "\n"
<< "NbNotRaised: " << aFunctor.NbNotRaised() << "\n"
<< "NbSigSeg: " << aFunctor.NbSigSegv() << "\n"
<< "NbUnknown: " << aFunctor.NbUnknown() << "\n";
return 0;
}
#if defined(_MSC_VER)
#pragma optimize( "", on )
#endif
@@ -4816,7 +4879,8 @@ void QABugs::Commands_11(Draw_Interpretor& theCommands) {
theCommands.Add("OCC5739", "OCC5739 name shape step", __FILE__, OCC5739_UniAbs, group);
theCommands.Add("OCC6046", "OCC6046 nb_of_vectors size", __FILE__, OCC6046, group);
theCommands.Add("OCC5698", "OCC5698 wire", __FILE__, OCC5698, group);
theCommands.Add("OCC6143", "OCC6143", __FILE__, OCC6143, group);
theCommands.Add("OCC6143", "OCC6143 catching signals", __FILE__, OCC6143, group);
theCommands.Add("OCC30775", "OCC30775 catching signals in threads", __FILE__, OCC30775, group);
theCommands.Add("OCC7141", "OCC7141 [nCount] aPath", __FILE__, OCC7141, group);
theCommands.Add("OCC7372", "OCC7372", __FILE__, OCC7372, group);
theCommands.Add("OCC8169", "OCC8169 edge1 edge2 plane", __FILE__, OCC8169, group);

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(aColF);
aFront.SetEmissiveColor(Quantity_NOC_BLACK);
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(aColB);
aBack.SetEmissiveColor(Quantity_NOC_BLACK);
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(colf);
front.SetEmissiveColor(Quantity_NOC_BLACK);
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(colb);
back.SetEmissiveColor(Quantity_NOC_BLACK);
back.SetTransparency (0.2f);
sa->SetMaterial(back,Aspect_TOFM_BACK_SIDE);

View File

@@ -3239,6 +3239,108 @@ 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";
@@ -3296,5 +3398,12 @@ 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.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
aMat.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
aMat.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
aMat.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
aMat.SetAmbientColor (Quantity_NOC_BLACK);
aMat.SetDiffuseColor (Quantity_NOC_BLACK);
aMat.SetSpecularColor(Quantity_NOC_BLACK);
aMat.SetEmissiveColor(Quantity_NOC_BLACK);
anAspect->SetMaterial (aMat);
aGroup->SetPrimitivesAspect (anAspect->Aspect());

View File

@@ -19,14 +19,11 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_ShortReal.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Quantity_TypeOfColor.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
#include <Standard_Integer.hxx>
#include <TCollection_AsciiString.hxx>
#include <NCollection_Vec4.hxx>
class Quantity_ColorDefinitionError;
@@ -51,11 +48,10 @@ public:
DEFINE_STANDARD_ALLOC
//! Creates a colour with the default value of
//! Colour name : YELLOW
//! Creates Quantity_NOC_YELLOW color.
Standard_EXPORT Quantity_Color();
//! Creates the colour <AName>.
//! Creates the color from enumeration value.
Standard_EXPORT Quantity_Color(const Quantity_NameOfColor AName);
//! Creates a color according to the definition system theType.
@@ -98,12 +94,12 @@ public:
Standard_EXPORT void SetValues (const Quantity_NameOfColor AName);
//! Updates a color according to the mode specified by theType.
//! TOC_RGB:
//! Quantity_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]
//!
//! TOC_HLS:
//! Quantity_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]
@@ -247,6 +243,16 @@ 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,7 +17,8 @@
#ifndef _Quantity_NameOfColor_HeaderFile
#define _Quantity_NameOfColor_HeaderFile
//! Definition of names of known colours.
//! Definition of names of known colors.
//! The names come (mostly) from the X11 specification.
enum Quantity_NameOfColor
{
Quantity_NOC_BLACK,

View File

@@ -555,7 +555,6 @@
#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>
@@ -1375,7 +1374,6 @@ 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,11 +56,14 @@ 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);
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);
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);
}
}
}

View File

@@ -54,12 +54,15 @@ void RWStepVisual_RWPresentationLayerAssignment::ReadStep
Standard_Integer nsub3;
if (data->ReadSubList (num,3,"assigned_items",ach,nsub3)) {
Standard_Integer nb3 = data->NbParams(nsub3);
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);
}
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);
}
}
}
//--- Initialisation of the read entity ---

View File

@@ -236,10 +236,14 @@ Standard_Boolean RWStl_Reader::IsAscii (Standard_IStream& theStream)
#define GETPOS(aPos) ((int64_t)aPos)
#endif
# if defined(_MSC_VER) && ! defined(strncasecmp)
# define strncasecmp _strnicmp
# endif
static inline bool str_starts_with (const char* theStr, const char* theWord, int theN)
{
while (isspace (*theStr) && *theStr != '\0') theStr++;
return !strncmp (theStr, theWord, theN);
return !strncasecmp (theStr, theWord, theN);
}
static bool ReadVertex (const char* theStr, double& theX, double& theY, double& theZ)

View File

@@ -30,7 +30,7 @@
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dInt_GInter.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <Geom_ElementarySurface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Lin2d.hxx>
@@ -118,26 +118,32 @@ void ShapeFix_ComposeShell::Init (const Handle(ShapeExtend_CompositeSurface) &Gr
// DTK-CKY 100531 : protection against very thin face
// Test "isclosed" should be filtered on the overall (non trimmed) surface, must be closed
Handle(Geom_Surface) theSurface = BRep_Tool::Surface(Face,myLoc);
Standard_Real U0,U1,V0,V1,GU0 = 0.,GU1 = 0.,GV0 = 0.,GV1 = 0.;
theSurface->Bounds(U0,U1,V0,V1);
if (::Precision::IsInfinite (U0) || ::Precision::IsInfinite (U1) ||
::Precision::IsInfinite (V0) || ::Precision::IsInfinite (V1))
BRepTools::UVBounds(Face, GU0, GU1, GV0, GV1);
if (myUClosed) {
if (::Precision::IsInfinite (V0)) V0 = GV0;
if (::Precision::IsInfinite (V1)) V1 = GV1;
gp_Pnt P0 = theSurface->Value(U0,(V0+V1)/2.);
gp_Pnt P1 = theSurface->Value(U1,(V0+V1)/2.);
if (P0.Distance(P1) > Precision::Confusion()*10)
myUClosed = Standard_False;
}
if (myVClosed) {
if (::Precision::IsInfinite (U0)) U0 = GU0;
if (::Precision::IsInfinite (U1)) U1 = GU1;
gp_Pnt P0 = theSurface->Value((U0+U1)/2.,V0);
gp_Pnt P1 = theSurface->Value((U0+U1)/2.,V1);
if (P0.Distance(P1) > Precision::Confusion()*10)
myVClosed = Standard_False;
// avoid false detection of 'Closed' on very thin faces
if (theSurface->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) {
myUClosed = myUClosed && theSurface->IsUClosed();
myVClosed = myVClosed && theSurface->IsVClosed();
} else {
Standard_Real U0,U1,V0,V1,GU0 = 0.,GU1 = 0.,GV0 = 0.,GV1 = 0.;
theSurface->Bounds(U0,U1,V0,V1);
if (::Precision::IsInfinite (U0) || ::Precision::IsInfinite (U1) ||
::Precision::IsInfinite (V0) || ::Precision::IsInfinite (V1))
BRepTools::UVBounds(Face, GU0, GU1, GV0, GV1);
if (myUClosed) {
if (::Precision::IsInfinite (V0)) V0 = GV0;
if (::Precision::IsInfinite (V1)) V1 = GV1;
gp_Pnt P0 = theSurface->Value(U0,(V0+V1)/2.);
gp_Pnt P1 = theSurface->Value(U1,(V0+V1)/2.);
if (P0.Distance(P1) > Precision::Confusion()*10)
myUClosed = Standard_False;
}
if (myVClosed) {
if (::Precision::IsInfinite (U0)) U0 = GU0;
if (::Precision::IsInfinite (U1)) U1 = GU1;
gp_Pnt P0 = theSurface->Value((U0+U1)/2.,V0);
gp_Pnt P1 = theSurface->Value((U0+U1)/2.,V1);
if (P0.Distance(P1) > Precision::Confusion()*10)
myVClosed = Standard_False;
}
}
// DTK-CKY 100531 end

View File

@@ -1156,6 +1156,10 @@ 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();
@@ -1888,6 +1892,7 @@ 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())
@@ -1931,8 +1936,9 @@ 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
if ( !Context().IsNull() )
Context()->Replace(myFace, aFace);
aFace.Orientation (myFace.Orientation ());
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 3
#define OCC_VERSION_MAINTENANCE 1
#define OCC_VERSION_MINOR 4
#define OCC_VERSION_MAINTENANCE 0
//! 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 "dev"
#define OCC_VERSION_DEVELOPMENT "beta"
// Derived (manually): version as real and string (major.minor)
#define OCC_VERSION 7.3
#define OCC_VERSION_STRING "7.3"
#define OCC_VERSION_COMPLETE "7.3.1"
#define OCC_VERSION 7.4
#define OCC_VERSION_STRING "7.4"
#define OCC_VERSION_COMPLETE "7.4.0"
//! Derived: extended version as string ("major.minor.maintenance.dev")
#ifdef OCC_VERSION_DEVELOPMENT

View File

@@ -3,14 +3,8 @@ 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
@@ -40,8 +34,6 @@ 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

@@ -1,62 +0,0 @@
// 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

@@ -1,78 +0,0 @@
// 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

@@ -1,41 +0,0 @@
// 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

@@ -1,86 +0,0 @@
// 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

@@ -1,143 +0,0 @@
// 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

@@ -1,85 +0,0 @@
// 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

@@ -1,152 +0,0 @@
// 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

@@ -1,117 +0,0 @@
// 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,6 +21,8 @@
#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
@@ -35,6 +37,8 @@ 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;

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