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

Compare commits

..

58 Commits

Author SHA1 Message Date
kgv
850d0c5d90 # Use float sRGB values for finding a color name 2019-09-21 15:04:59 +03:00
kgv
dd8e065f5f # update test cases 2019-09-21 15:04:16 +03:00
kgv
dcf2a3737e 0030991: Draw Harness - ViewerTest::ParseColors() defines out-of-range alpha component 2019-09-21 11:41:40 +03:00
kgv
8541e78cde #Quantity_Color::Name() - look for nearest sRGB color rather than nearest linear RGB color. 2019-09-20 22:34:58 +03:00
kgv
e67b461e6c Test cases have been updated to new sRGB rendered results. 2019-09-20 15:46:57 +03:00
kgv
341e87e4ae 0029528: Visualization, TKOpenGl - allow defining sRGB textures
Quantity_Color definition has been modified to store RGB components
in linear color space within Quantity_TOC_RGB type.
Standard colors defined by Quantity_NameOfColor enumeration has been updated accordingly.
New Quantity_TOC_sRGB type has been introduced to handle RGB components in non-linear sRGB color space.

OpenGl_TextureFormat class definition has been moved to dedicated files.
New method OpenGl_TextureFormat::FindFormat() replaces OpenGl_Texture::GetDataFormat().
New method OpenGl_TextureFormat::FindSizedFormat() replaces OpenGl_FrameBuffer::getColorDataFormat()
and OpenGl_FrameBuffer::getDepthDataFormat().

Graphic3d_TextureRoot::IsColorMap() - introduced new property defining
if RGB(A)8 image formats should be loaded as sRGB(A) textures or as data RGB(A) textures.
OpenGl_Texture initialization methods have been extended with new theIsColorMap argument.

vreadpixel - added argument -sRGB printing color in sRGB color space.
2019-09-20 13:19:39 +03:00
kgv
8f7b001d68 0030952: Draw Harness, ViewerTest - add command showing on-screen GUI for configuring material properties 2019-09-20 13:19:39 +03:00
kgv
7103ac61c3 0029902: Data Exchange, XCAF - provide extended Material definition for visualization purposes
Introduced new attribute XCAFDoc_VisMaterial storing visualization material definition.
2019-09-20 13:19:39 +03:00
kgv
f2f06fbc45 0030969: Coding Rules - refactor Quantity_Color.cxx color table definition
The table of named colors has been compressed and moved out
from Quantity_Color.cxx into Quantity_ColorTable.pxx.

Quantity_NameOfColor - grayscale enumeration values have been re-ordered to fix discontinuity.
Duplicating colors has been merged within enumeration:
  CHARTREUSE=CHARTREUSE1, GOLD=GOLD1, GREEN=GREEN1, ORANGE=ORANGE1,
  ORANGERED=ORANGERED1, RED=RED1, TOMATO=TOMATO1, YELLOW=YELLOW1.
Added aliases to several other common colors:
  BLUE=BLUE1, CYAN=CYAN1, LIGHTCYAN=LIGHTCYAN1, MAGENTA=MAGENTA1.

Quantity_Color::ColorToHex() now rounds-up float values to closest integer.
Quantity_ColorRGBA::ColorToHex() - added method formatting color into hex with alpha component.

Quantity_Color class definition has been cleaned to follow OCCT coding style.
Quantity_Color now stores NCollection_Vec3<float> as class field instead of separate components.
Removed unused class Quantity_ColorDefinitionError.

New methods Quantity_Color::Convert_LinearRGB_To_sRGB() and Quantity_Color::Convert_sRGB_To_LinearRGB()
converting RGB components from linear to non-linear sRGB colorspace and vice versa.
Image_PixMap::PixelColor() and Image_PixMap::SetPixelColor() methods have been extended
with an optional argument for performing linearization/delinearization of 8-bit sRGB pixel formats.

Draw Harness command AISColor has been corrected to take color name instead of enumeration index.

vdrawtext command now uses ViewerTest::ParseColor() for parsing color argument, so that it accepts hex.
vreadpixel command now has been extended with -hex argument for printing color in hex format.
XSetColor command has been extended to accept color names and hex.
2019-09-20 13:19:36 +03:00
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
jgv
a22151d83c 0030927: Modeling Algorithms - UnifySameDom looses the Closed flag for wires
Add setting the Closed flag for a new wire
2019-08-30 18:07:53 +03:00
vro
990d032c90 0030926: Data Exchange - Change of the number of GDT points of a View may lead to a crash 2019-08-29 19:09:49 +03:00
kgv
b383a61fbd 0030923: Visualization, AIS_ViewCube - avoid mixing non-zoomable text and trihedron-persistence
Box sides labels are now drawn with zoomable flag.
2019-08-29 19:08:55 +03:00
anv
07f2064617 0030919: ACIS Import - Improving translation of string attributes into XDE
- Added possibility to get (or create if absent) a properties attribute via ShapeTool;
- Added Draw command to print properties attached to a Label.
2019-08-29 19:07:12 +03:00
emv
fb64d0f4a2 0030914: Modeling Algorithms - Improve performance of UnifySameDom algorithm for specific case with many edges
Use cached containers to find the necessary shapes.
2019-08-29 19:06:12 +03:00
emv
115d350e09 0030913: Invalid result of Fusing slices
Refactoring of the Line-Line intersection method strengthening the parallel and coincidence criteria to allow almost parallel lines have an intersection point.
2019-08-29 19:04:39 +03:00
emv
3dd193aa6d 0030903: Bug in IntCurvesFace_ShapeIntersector
When classifying the intersection point check the ON status in 3D - compare the 3D distances with 3D tolerance.
2019-08-29 19:03:48 +03:00
kgv
87018b452a 0030924: Coding - incorrect header in file OSD_ThreadPool.hxx
Fixed license statements within files BRepGProp_MeshProps.cxx, BRepGProp_MeshProps.hxx,
OSD_ThreadPool.cxx and OSD_ThreadPool.hxx.

Removed non-ASCII char from BRepMesh_ModelHealer.hxx.
2019-08-29 19:02:45 +03:00
kgv
61f73653ba 0030915: Visualization - AIS_ColorScale::FindColor() returns Wrong color for maximal value
Map the very upper value (theValue==theMax) to the largest color interval.
2019-08-26 15:16:14 +03:00
nds
8ed0708507 0030857: Visualization - using one implementation of Text in graphic group
Graphic3d_Group::Text(...) are obsolete, AddText() should be used instead of these methods.
Graphic3d_Text is a new class for parameters necessary to fill OpenGl_Text. All parameters of Graphic3d_Group::Text() are moved into this class.

OpenGl_TextParam is removed, these fields were moved into Graphic3d_Text.
OpenGl_Text constructors/Init with OpenGl_TextParam parameter were removed. Constructor with Graphic3d_Text should be used instead of it.
Using OpenGl_Text Init() with OpenGl_TextParam should be now replaced on two cases. The first case is setting values into Graphic3d_Text and the second case is calling Reset() after. As example, look at modification in OpenGl_FrameStatsPrs.
2019-08-23 16:58:25 +03:00
iko
077a220c51 0030807: Visualization, TKOpenGl - supporting cubemaps
A cubemap texture initialization has been implemented.
Setting environment cubemap as interactive background is posssible now.
2019-08-23 16:56:40 +03:00
emv
c5cee3222f 0030905: Modeling Algorithms - Faulty shapes in UnifySameDomain
Make face FORWARD before adding wire in it.
2019-08-23 16:56:39 +03:00
anv
e837b3a26c 0029662: Modeling Data - Allow replacement of Compounds via BRepTools_ReShape
- Fixed condition to allow proceeding of nested compounds;
- Added new key to "reshape" draw command to state a level of type until which requests are taken into account;
- Test case added.
2019-08-23 16:56:39 +03:00
drazmyslovich
846245d4b2 0030874: Modeling Algorithms - GCPnts_TangentialDeflection inserts the points between nearby points
Check the points distance before inserting a new point in between.
2019-08-23 16:56:38 +03:00
kgv
d7fa57a7a3 0030906: Visualization, SelectMgr_ViewerSelector - Object clipping planes overrides View clipping plane for next objects
Clipping range has been moved from SelectMgr_RectangularFrustum to SelectMgr_SelectingVolumeManager
and passed to frustum as an argument to Overlap() methods.
This fixes an issue when Clipping is customized per-object within SelectMgr_ViewerSelector::traverseObject()
in case when shallow copy of SelectMgr_SelectingVolumeManager is created
(frustums are copied from global frustum manager by Handle).
2019-08-23 16:56:37 +03:00
787 changed files with 12794 additions and 11944 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"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -1716,6 +1716,75 @@ 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*.
The previous code:
~~~~
Standard_Real x, y, z;
theAttachmentPoint.Coord(x,y,z);
theGroup->Text (theText,
Graphic3d_Vertex(x,y,z),
theAspect->Height(),
theAspect->Angle(),
theAspect->Orientation(),
theAspect->HorizontalJustification(),
theAspect->VerticalJustification());
~~~~
should be replaced by the new code:
~~~~
Handle(Graphic3d_Text) aText = new Graphic3d_Text (theAspect->Height());
aText->SetText (theText.ToExtString());
aText->SetPosition (theAttachmentPoint);
aText->SetHorizontalAlignment (theAspect->HorizontalJustification());
aText->SetVerticalAlignment (theAspect->VerticalJustification());
theGroup->AddText (aText);
~~~~
*OpenGl_Text* contains *Graphic3d_Text* field.
*OpenGl_TextParam* struct is removed. Constructor and *Init* of *OpenGl_Text* with *OpenGl_TextParam* are also removed.
Instead of using them, change *OpenGl_Text*.
Please, note, that after modifying *OpenGl_Text*, *Reset* of *OpenGl_Text* should be called.
*FormatParams* of *OpenGl_Text* is replaced by *Text*.
@subsection upgrade_740_prsupdate Presentation invalidation
Historically AIS_InteractiveObject provided two independent mechanisms invalidating presentation (asking presentation manager to recompute specific display mode or all modes):
@@ -1764,3 +1833,26 @@ The following API changes have been made:
@subsection upgrade_740_stdnamespace Standard_Stream.hxx no more has "using std::" statements
*Standard_Stream.hxx* header, commonly included by other OCCT header files, does no more add entities from *std namespace* related to streams (like *std::cout*, *std::istream* and others) into global namespace.
The application code relying on this matter should be updated to either specify std namespace explicitly (like std::cout) or add "using std::" statements locally.
@section upgrade_occt750 Upgrade to OCCT 7.5.0
@subsection upgrade_750_srgb_color RGB color definition
OCCT 3D Viewer has been improved to properly perform lighting using in linear RGB color space and then convert result into non-linear gamma-shifted sRGB color space before displaying on display.
This change affects texture mapping, material definition and color definition.
Previously *Quantity_Color* definition was provided with unspecified RGB color space.
In practice, mixed color spaces have been actually used, with non-linear sRGB prevailing in general.
Since OCCT 7.5.0, *Quantity_Color* now specifies that components are defined in linear RGB color space.
This change affects following parts:
* Standard colors defined by *Quantity_NameOfColor* enumeration have been converted into linear RGB values within Quantity_Color construction.
* Application may use new enumeration value *Quantity_TOC_sRGB* for passing/fetching colors in sRGB color space,
which can be useful for interoperation with color picking widgets (returning 8-bit integer values within [0..255] range)
or for porting colors constants within old application code without manual conversion.
* *Graphic3d_MaterialAspect* color components are now expected in linear RGB color space,
and standard OCCT materials within *Graphic3d_NameOfMaterial* enumeration have been updated accordingly.
* Texture mapping now handles new *Graphic3d_TextureRoot::IsColorMap()* for interpreting content in linear RGB or sRGB color space.
It is responsibility of user specifying this flag correctly. The flag value is TRUE by default.
* Method *Image_PixMap::PixelColor()* has been extended with a new Boolean flag for performing linearization of non-linear sRGB.
This flag is FALSE by default; application should consider passing TRUE instead for further handling *Quantity_Color* properly as linear RGB values.

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

@@ -276,7 +276,7 @@ blend result _model 2 _model_161
# Show result
pload VISUALIZATION
vinit Driver1/Viewer1/View1
vbackground -color 0.784314 0.784314 1
vbackground -color C8C8FF
vdisplay -dispMode 1 result
vfit
vaspects result -setFaceBoundaryDraw 1 -mostContinuity c2

View File

@@ -262,7 +262,7 @@ unifysamedom result p_1
# Show result
pload VISUALIZATION
vinit Driver1/Viewer1/View1
vbackground -color 0.784314 0.784314 1
vbackground -color C8C8FF
vdisplay -dispMode 1 result
vfit
vaspects result -setFaceBoundaryDraw 1

View File

@@ -68,18 +68,18 @@ vlight add directional direction 0 -10 0 head 1 color white
vdisplay b1 b2 b3 b4 b5 b6 b7 b8 b9 b10
# set colors like in boxes of on OCC logo
vsetcolor b1 0.8671875 0 0.16015625
vsetcolor b2 0.96484375 0.8671875 0
vsetcolor b3 0.609375 0.97734375 0.09375
vsetcolor b4 0.90234375 0 0.48046875
vsetcolor b5 0 0.48046875 0.73828125
vsetcolor b6 0.578125 0 0.48046875
vsetcolor b7 0.93359375 0.609375 0
vsetcolor b8 0 0.70703125 0.9296875
vsetcolor b9 0 0.64453125 0.48046875
vsetcolor b10 0 0.48046875 0.73828125
vsetcolor b1 DD0029
vsetcolor b2 F6DD00
vsetcolor b3 98F918
vsetcolor b4 E9007A
vsetcolor b5 007ABC
vsetcolor b6 93007A
vsetcolor b7 EE9800
vsetcolor b8 00B489
vsetcolor b9 00A47A
vsetcolor b10 007ABC
# set material to plastic for better look
for {set i 1} {$i <= 10} {incr i} {vsetmaterial b$i plastic}
vdrawtext label "Which\nbox\nis\ncloser\nto\nyou?" -pos 0 -6 -2 -color 0 0 0 -halign left -valign bottom -angle 0 -zoom 0 -height 40
vdrawtext label "Which\nbox\nis\ncloser\nto\nyou?" -pos 0 -6 -2 -color BLACK -halign left -valign bottom -angle 0 -zoom 0 -height 40

View File

@@ -255,27 +255,27 @@ if [info exists i7_show_3dview] {
vlight add directional direction 1 -1 -2 head 1
vdisplay case
vsetcolor case 0.7 0.7 0.7
vsetcolor case GRAY70
vdisplay title
vsetcolor title 0.1 0.1 0.1
vsetcolor title GRAY10
# board is mostly yellow (edges, triangle markers)
foreach f [explode board f] { vdisplay $f; vsetcolor $f 0.7 0.5 0.3 }
foreach f [explode board f] { vdisplay $f; vsetcolor $f B3803D }
# top and bottom faces are light-green (outside) and dark-green (inside)
vsetcolor board_4 0 0.6 0.55
vsetcolor board_5 0 0.6 0.55
vsetcolor board_12 0 0.3 0.33
vsetcolor board_14 0 0.3 0.33
vsetcolor board_4 00998C
vsetcolor board_5 00998C
vsetcolor board_12 004D54
vsetcolor board_14 004D54
vdisplay rpads
vsetcolor rpads 0.7 0.6 0.4
vsetcolor rpads B39966
vdisplay bpads
vsetcolor bpads 0.7 0.6 0.4
vsetcolor bpads B39966
vdisplay brpk
vsetcolor brpk 0.5 0.4 0.3
vsetcolor brpk 80664D
donly board case rpads brpk; fit
}
@@ -287,17 +287,17 @@ pload OCAF XDE
NewDocument D MDTV-XCAF
SetName D [XAddShape D board 0] "Board"
foreach f [explode board f] { XSetColor D $f 0.7 0.5 0.3 }
XSetColor D board_4 0 0.6 0.55
XSetColor D board_5 0 0.6 0.55
XSetColor D board_12 0 0.3 0.33
XSetColor D board_14 0 0.3 0.33
foreach f [explode board f] { XSetColor D $f B3803D }
XSetColor D board_4 00998C
XSetColor D board_5 00998C
XSetColor D board_12 004D54
XSetColor D board_14 004D54
SetName D [XAddShape D case 0] "Case"
XSetColor D case 0.7 0.7 0.7
XSetColor D case GRAY70
SetName D [XAddShape D title 0] "Case title"
XSetColor D title 0.1 0.1 0.1
XSetColor D title GRAY10
SetName D [XAddShape D rpads 1] "Top side contact pads"
SetName D [XAddShape D bpads 1] "Bottom contact pads"
@@ -306,17 +306,17 @@ SetName D [XFindShape D rpad] "Round pad"
SetName D [XFindShape D Rpad] "Big round pad"
SetName D [XFindShape D spad_1] "Square pad 1"
SetName D [XFindShape D spad_2] "Square pad 2"
XSetColor D rpad 0.7 0.6 0.4
XSetColor D Rpad 0.7 0.6 0.4
XSetColor D bpad 0.7 0.6 0.4
XSetColor D spad_1 0.7 0.6 0.4
XSetColor D spad_2 0.7 0.6 0.4
XSetColor D rpad B39966
XSetColor D Rpad B39966
XSetColor D bpad B39966
XSetColor D spad_1 B39966
XSetColor D spad_2 B39966
SetName D [XAddShape D brpk 1] "Bottom packages"
SetName D [XFindShape D rpk] "Bottom package"
XSetColor D rpk1 0.7 0.7 0.7
XSetColor D rpk2 0.5 0.4 0.3
XSetColor D rpk3 0.7 0.7 0.7
XSetColor D rpk1 GRAY70
XSetColor D rpk2 80664D
XSetColor D rpk3 GRAY70
XShow D
vlight clear

View File

@@ -36,9 +36,7 @@ set anArrAngle [expr 3.14 * 12.0 / 180.0]
# Form dimension names list to set parameters with vdimparam command
set aList {rd_1 rd_2 ad_1 ad_2 ad_3}
for {set i 1} {$i <= 10} {incr i} {
lappend aList ld_$i
}
for {set i 1} {$i <= 10} {incr i} { lappend aList ld_$i }
puts "Creating dimensions..."
vdimension ld_1 -length -shapes bs_27 -plane xoy -color black -flyout -15
@@ -67,29 +65,14 @@ foreach i $aList {
vfit
puts "Displaying exported shapes..."
vdisplay a b
vsetdispmode a 1
vsetdispmode b 1
vdisplay -dispMode 1 a b
vaspects a -setmaterial steel
vaspects b -setmaterial bronze
puts "Clipping shapes for better view..."
vclipplane create pa
vclipplane change pa equation 0 0 1 0
vclipplane change pa capping on
vclipplane change pa capping color 0.9 0.9 0.9
vclipplane set pa object a
vclipplane create pb
vclipplane change pb equation 0 0 1 0
vclipplane change pb capping on
vclipplane change pb capping color 1.0 0.8 0.0
vclipplane set pb object b
vclipplane change pa capping texname $aHatch
vclipplane change pa capping texscale 0.05 -0.05
vclipplane change pb capping texname $aHatch
vclipplane change pb capping texscale 0.05 0.05
vclipplane pa -set a -equation 0 0 1 0 -capping on -color GRAY90 -texName $aHatch -texScale 0.05 -0.05
vclipplane pb -set b -equation 0 0 1 0 -capping on -color GOLD -texName $aHatch -texScale 0.05 -0.05
vbottom
vrotate -0.3 -0.3 0

View File

@@ -77,14 +77,13 @@ SetName D $main "OCC Logo 2019"
SetName D [XFindShape D sb] "Core"
SetName D [XFindShape D tp] "Loop"
SetName D [XFindShape D rs] "Connector"
XSetColor D sb 1 0.21 0.32
XSetColor D tp 0 0.667 0.855
XSetColor D rs 0 0.45 0.69
XSetColor D sb FF3652
XSetColor D tp 00AADA
XSetColor D rs 0073B0
# display
vinit
vsetcolorbg 1 1 1
vsetdispmode 1
XDisplay D
vinit View1
vbackground -color WHITE
XDisplay -dispMode 1 D
vtop
vfit

View File

@@ -56,7 +56,7 @@ for { set aMarkerType 0 } { $aMarkerType <= 13 } { incr aMarkerType } {
set aRow [expr $aMarkerType - 7]
set aCol 5
set aName [lindex $aMarkerTypeNames $aMarkerType]
vdrawtext "$aName" "$aName" -pos 0 [expr $aRow + 0.5] 0 -color 0.5 1.0 1.0 -halign center -valign center -angle 000 -zoom 0 -height 12 -aspect bold -font $aLabelFont -noupdate
vdrawtext "$aName" "$aName" -pos 0 [expr $aRow + 0.5] 0 -color 7FFFFF -halign center -valign center -angle 000 -zoom 0 -height 12 -aspect bold -font $aLabelFont -noupdate
vdisplay -top -noupdate "$aName"
if { $aMarkerType == 13 } {
vmarkerstest m${aMarkerType}_${aCol} $aCol $aRow 0 PointsOnSide=1 FileName=$aCustom1

View File

@@ -4,36 +4,22 @@
#Title: Material properties in viewer
set THE_MATERIALS {brass bronze copper gold jade neon_phc pewter obsidian plaster plastic satin silver steel stone chrome aluminium water glass diamond charcoal}
set THE_COLORS {default red green blue1}
set THE_COLORS {default red green blue}
set THE_ROW_DIST 35
proc drawLabels {} {
set x 20
set y 15
set r 0.098
set g 0.098
set b 0.098
foreach aMatIter $::THE_MATERIALS {
vdrawtext "$aMatIter" "$aMatIter" -pos $x $y 0 -color $r $g $b -halign right -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
vdrawtext "$aMatIter" "$aMatIter" -pos $x $y 0 -color GRAY10 -halign right -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
incr y 10
}
set x 40
set y 5
foreach aColIter $::THE_COLORS {
if { $aColIter == "red" } {
set r 1.0
set g 0.0
set b 0
} elseif { $aColIter == "green" } {
set r 0.0
set g 1.0
set b 0.0
} elseif { $aColIter == "blue1" } {
set r 0.0
set g 0.0
set b 1.0
}
vdrawtext "$aColIter" "$aColIter" -pos $x $y 0 -color $r $g $b -halign center -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
set aLabColor "$aColIter"
if { "$aColIter" == "default" } { set aLabColor BLACK }
vdrawtext "$aColIter" "$aColIter" -pos $x $y 0 -color "$aLabColor" -halign center -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
incr x $::THE_ROW_DIST
}
}
@@ -69,7 +55,7 @@ vclose ALL
vinit View1 w=768 h=768
vtop
vglinfo
vbackground -gradient 0.705882 0.784314 1 0.705882 0.705882 0.705882 -gradientMode VERTICAL
vbackground -gradient B4C8FF B4B4B4 -gradientMode VERTICAL
vlight -change 0 -dir 0.577 -0.577 -0.577
vrenderparams -msaa 8
@@ -86,3 +72,4 @@ drawObjects 0 ""
drawObjects 1 red
drawObjects 2 green
drawObjects 3 blue1
vrepaint

View File

@@ -75,4 +75,4 @@ vrenderparams -ray -gi -rayDepth 10
puts "Make several path tracing iterations to refine the picture, please wait..."
vfps 100
puts "Done. To improve the image further, or after view manipulations, give command:"
puts "vfps \[nb_iteratons\]"
puts "vfps \[nb_iteratons\] or vrepaint -continuous"

View File

@@ -85,4 +85,4 @@ vrenderparams -ray -gi -rayDepth 8
puts "Make several path tracing iterations to refine the picture, please wait..."
vfps 100
puts "Done. To improve the image further, or after view manipulations, give command:"
puts "vfps \[nb_iteratons\]"
puts "vfps \[nb_iteratons\] or vrepaint -continuous"

View File

@@ -223,4 +223,4 @@ vrenderparams -ray -gi -rayDepth 10
puts "Make several path tracing iterations to refine the picture, please wait..."
vfps 512
puts "Done. To improve the image further, or after view manipulations, give command:"
puts "vfps \[nb_iteratons\]"
puts "vfps \[nb_iteratons\] or vrepaint -continuous"

View File

@@ -46,18 +46,17 @@ NewDocument D
XAddShape D body_1
XAddShape D core_1
#XSetColor D body_1 0. 0. 1.
for {set i 1} {$i <= 26} {incr i} {XSetColor D body_1_$i 0. 0. 1.}
XSetColor D body_1_1 0.9 0.5 0.4
XSetColor D body_1_9 0.9 0.5 0.4
for {set i 10} {$i <= 22} {incr i} {XSetColor D body_1_$i 0.6 0.7 0.0}
XSetColor D core_1 0.1 0.1 1.
foreach ff [explode core_1 f] { XSetColor D $ff 0.1 0.1 1. ; puts "set color $ff" }
XShow D
for {set i 1} {$i <= 26} {incr i} {XSetColor D body_1_$i BLUE}
XSetColor D body_1_1 E68066
XSetColor D body_1_9 E68066
for {set i 10} {$i <= 22} {incr i} {XSetColor D body_1_$i 99B300}
XSetColor D core_1 1A1AFF
foreach ff [explode core_1 f] { XSetColor D $ff 1A1AFF ; puts "set color $ff" }
vclear
vinit View1
XDisplay -dispMode 1 D -explore
vfit
vsetdispmode 1
vrenderparams -msaa 8
vbackground -color WHITE

View File

@@ -28,19 +28,20 @@ SetName D [XFindShape D link]:2 "Nut instance 1"
SetName D [XFindShape D link]:3 "Nut instance 2"
puts "- Pin will be white"
XSetColor D [XFindShape D pin] 1 1 1
XSetColor D [XFindShape D pin] WHITE
puts "- Nut itself will be dark gray"
XSetColor D [XFindShape D nut] 0.1 0.1 0.1
XSetColor D [XFindShape D nut] GRAY10
puts "- Nut instance #1 will be red"
XSetColor D [XFindShape D link]:2 1 0 0
XSetColor D [XFindShape D link]:2 RED
puts "- Nut instance #2 will be green"
XSetColor D [XFindShape D link]:3 0 1 0
XSetColor D [XFindShape D link]:3 GREEN
puts "Starting DF browser..."
DFBrowse D
puts "Expand the document tree to see its structure and assigned names"
puts "Showing assembly in 3d view..."
XShow D
vclear
vinit View1
XDisplay -dispMode 1 D -explore
vfit
vsetdispmode 1

View File

@@ -26,6 +26,7 @@
#include <Graphic3d_AspectText3d.hxx>
#include <Graphic3d_GraphicDriver.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Graphic3d_Text.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_ShadingAspect.hxx>
@@ -78,6 +79,31 @@ namespace
Standard_Real aSaturation = NCollection_Lerp<Standard_Real>::Interpolate (theHlsMin[2], theHlsMax[2], aValue);
return Quantity_Color (AIS_ColorScale::hueToValidRange (aHue), aLightness, aSaturation, Quantity_TOC_HLS);
}
//! Return the index of discrete interval for specified value.
//! Note that when value lies exactly on the border between two intervals,
//! determining which interval to return is undefined operation;
//! Current implementation returns the following interval in this case.
//! @param theValue [in] value to map
//! @param theMin [in] values range, lower value
//! @param theMax [in] values range, upper value
//! @param theNbIntervals [in] number of discrete intervals
//! @return index of interval within [1, theNbIntervals] range
static Standard_Integer colorDiscreteInterval (Standard_Real theValue,
Standard_Real theMin,
Standard_Real theMax,
Standard_Integer theNbIntervals)
{
if (Abs (theMax - theMin) <= Precision::Approximation())
{
return 1;
}
Standard_Integer anInterval = 1 + (Standard_Integer )Floor (Standard_Real (theNbIntervals) * (theValue - theMin) / (theMax - theMin));
// map the very upper value (theValue==theMax) to the largest color interval
anInterval = Min (anInterval, theNbIntervals);
return anInterval;
}
}
//=======================================================================
@@ -347,21 +373,14 @@ Standard_Boolean AIS_ColorScale::FindColor (const Standard_Real theValue,
if (myColorType == Aspect_TOCSD_USER)
{
Standard_Integer anIndex = 0;
if (Abs (myMax - myMin) > Precision::Approximation())
{
anIndex = (theValue - myMin < Precision::Confusion())
? 1
: Standard_Integer (Ceiling (( theValue - myMin ) / ( (myMax - myMin) / myNbIntervals)));
}
if (anIndex <= 0 || anIndex > myColors.Length())
const Standard_Integer anInterval = colorDiscreteInterval (theValue, myMin, myMax, myNbIntervals);
if (anInterval < myColors.Lower() || anInterval > myColors.Upper())
{
theColor = Quantity_Color();
return Standard_False;
}
theColor = myColors.Value (anIndex);
theColor = myColors.Value (anInterval);
return Standard_True;
}
@@ -385,13 +404,8 @@ Standard_Boolean AIS_ColorScale::FindColor (const Standard_Real theValue,
return Standard_False;
}
Standard_Real anInterval = 0.0;
if (Abs (theMax - theMin) > Precision::Approximation())
{
anInterval = Floor (Standard_Real (theColorsCount) * (theValue - theMin) / (theMax - theMin));
}
theColor = colorFromValueEx (anInterval, 0, theColorsCount - 1, theColorHlsMin, theColorHlsMax);
const Standard_Integer anInterval = colorDiscreteInterval (theValue, theMin, theMax, theColorsCount);
theColor = colorFromValueEx (anInterval - 1, 0, theColorsCount - 1, theColorHlsMin, theColorHlsMax);
return Standard_True;
}
@@ -796,16 +810,14 @@ void AIS_ColorScale::drawText (const Handle(Graphic3d_Group)& theGroup,
const Graphic3d_VerticalTextAlignment theVertAlignment)
{
const Handle(Prs3d_TextAspect)& anAspect = myDrawer->TextAspect();
theGroup->Text (theText,
gp_Ax2 (gp_Pnt (theX, theY, 0.0), gp::DZ()),
anAspect->Height(),
anAspect->Angle(),
anAspect->Orientation(),
Graphic3d_HTA_LEFT,
theVertAlignment,
Standard_True,
Standard_False); // has own anchor
Handle(Graphic3d_Text) aText = new Graphic3d_Text ((Standard_ShortReal)anAspect->Height());
aText->SetText (theText.ToExtString());
aText->SetOrientation (gp_Ax2 (gp_Pnt (theX, theY, 0.0), gp::DZ()));
aText->SetOwnAnchorPoint (Standard_False);
aText->SetVerticalAlignment (theVertAlignment);
theGroup->AddText (aText);
}
//=======================================================================

View File

@@ -26,6 +26,7 @@ public:
//! Default constructor.
AIS_ColoredDrawer (const Handle(Prs3d_Drawer)& theLink)
: myIsHidden (false),
myHasOwnMaterial(false),
myHasOwnColor (false),
myHasOwnTransp(false),
myHasOwnWidth (false)
@@ -36,6 +37,10 @@ public:
bool IsHidden() const { return myIsHidden; }
void SetHidden (const bool theToHide) { myIsHidden = theToHide;}
bool HasOwnMaterial() const { return myHasOwnMaterial; }
void UnsetOwnMaterial() { myHasOwnMaterial = false; }
void SetOwnMaterial() { myHasOwnMaterial = true; }
bool HasOwnColor() const { return myHasOwnColor; }
void UnsetOwnColor() { myHasOwnColor = false; }
void SetOwnColor (const Quantity_Color& /*theColor*/) { myHasOwnColor = true; }
@@ -51,6 +56,7 @@ public:
public: //! @name list of overridden properties
bool myIsHidden;
bool myHasOwnMaterial;
bool myHasOwnColor;
bool myHasOwnTransp;
bool myHasOwnWidth;

View File

@@ -333,7 +333,11 @@ void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
for (AIS_DataMapOfShapeDrawer::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
{
const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
//if (aDrawer->HasOwnMaterial()) continue;
if (aDrawer->HasOwnMaterial())
{
continue;
}
if (aDrawer->HasOwnShadingAspect())
{
setMaterial (aDrawer, theMaterial, aDrawer->HasOwnColor(), aDrawer->HasOwnTransparency());
@@ -633,9 +637,6 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
{
aShadedGroup = thePrs->NewGroup();
aShadedGroup->SetClosed (isClosed);
if (isClosed
&& !myCappingStyle.IsNull())
aShadedGroup->SetGroupPrimitivesAspect (myCappingStyle);
}
aShadedGroup->SetPrimitivesAspect (aDrawer->ShadingAspect()->Aspect());
aShadedGroup->AddPrimitiveArray (aTriangles);

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

@@ -18,7 +18,6 @@
#include <AIS_InteractiveContext.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectFillCapping.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectText3d.hxx>
@@ -84,37 +83,6 @@ void AIS_InteractiveObject::SetContext (const Handle(AIS_InteractiveContext)& th
}
}
//=======================================================================
//function : SetCappingStyle
//purpose :
//=======================================================================
void AIS_InteractiveObject::SetCappingStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle)
{
myCappingStyle = theStyle;
// Modify existing presentations
for (Standard_Integer aPrsIter = 1, n = myPresentations.Length(); aPrsIter <= n; ++aPrsIter)
{
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter);
if (!aPrs3d.IsNull())
{
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
if (!aStruct.IsNull())
{
const Graphic3d_SequenceOfGroup& aGroups = aStruct->Groups();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
{
Handle(Graphic3d_Group)& aGrp = aGroupIter.ChangeValue();
if (aGrp.IsNull())
continue;
aGrp->SetGroupPrimitivesAspect (theStyle);
}
}
}
}
}
//=======================================================================
//function : HasPresentation
//purpose :

View File

@@ -104,12 +104,6 @@ public:
void ClearOwner() { myOwner.Nullify(); }
public:
//! Set style of filling capping section created by clipping planes.
Standard_EXPORT virtual void SetCappingStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle);
//! Returns style for filling capping section created by clipping planes.
const Handle(Graphic3d_AspectFillCapping)& CappingStyle() const { return myCappingStyle; }
//! Returns the context pointer to the interactive context.
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
@@ -134,7 +128,6 @@ protected:
AIS_InteractiveContext* myCTXPtr; //!< pointer to Interactive Context, where object is currently displayed; @sa SetContext()
Handle(Standard_Transient) myOwner; //!< application-specific owner object
Handle(Graphic3d_AspectFillCapping) myCappingStyle;
};

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

@@ -180,7 +180,10 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
try
{
OCC_CATCH_SIGNALS
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer, myCappingStyle);
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer,
myDrawer->ShadingAspect()->Aspect()->ToMapTexture()
&& !myDrawer->ShadingAspect()->Aspect()->TextureMap().IsNull(),
myUVOrigin, myUVRepeat, myUVScale);
}
catch (Standard_Failure const& anException)
{
@@ -634,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

@@ -19,6 +19,7 @@
#include <AIS_InteractiveContext.hxx>
#include <gp_Ax2.hxx>
#include <Graphic3d_ViewAffinity.hxx>
#include <Graphic3d_Text.hxx>
#include <NCollection_Lerp.hxx>
#include <Prs3d.hxx>
#include <Prs3d_Arrow.hxx>
@@ -193,6 +194,7 @@ void AIS_ViewCube::setDefaultAttributes()
myDrawer->TextAspect()->SetColor (Quantity_NOC_BLACK);
myDrawer->TextAspect()->SetFont (Font_NOF_SANS_SERIF);
myDrawer->TextAspect()->SetHeight (16.0);
myDrawer->TextAspect()->Aspect()->SetTextZoomable (true); // the whole object is drawn within transformation-persistence
// this should be forced back-face culling regardless Closed flag
myDrawer->TextAspect()->Aspect()->SetSuppressBackFaces (true);
@@ -221,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);
@@ -717,7 +719,14 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
const Standard_Real anOffset = 2.0; // extra offset to avoid overlapping with triangulation
const gp_Pnt aPos = aDir.XYZ() * (mySize * 0.5 + myBoxFacetExtension + anOffset);
const gp_Ax2 aPosition (aPos, aDir, anUp.Crossed (aDir));
Prs3d_Text::Draw (aTextGroup, myDrawer->TextAspect(), aLabel, aPosition);
Handle(Graphic3d_Text) aText = new Graphic3d_Text ((Standard_ShortReal)myDrawer->TextAspect()->Height());
aText->SetText (aLabel);
aText->SetOrientation (aPosition);
aText->SetOwnAnchorPoint (false);
aText->SetHorizontalAlignment(myDrawer->TextAspect()->HorizontalJustification());
aText->SetVerticalAlignment (myDrawer->TextAspect()->VerticalJustification());
aTextGroup->AddText (aText);
}
}

View File

@@ -1395,7 +1395,7 @@ BRepCheck_Status BRepCheck_Wire::SelfIntersect(const TopoDS_Face& F,
if (aCT1==GeomAbs_Line && aCT2==GeomAbs_Line) {
// check for the two lines coincidence
Standard_Real aPAR_T, aT11, aT12, aT21, aT22, aT1m, aT2m;
Standard_Real aD2, aTolE1, aTolE2, aTol2, aDot;
Standard_Real aD2, aTolE1, aTolE2, aTol2;
gp_Lin2d aL1, aL2;
gp_Pnt2d aP1m;
//
@@ -1423,14 +1423,10 @@ BRepCheck_Status BRepCheck_Wire::SelfIntersect(const TopoDS_Face& F,
if (aT2m>aT21 && aT2m<aT22) {
const gp_Dir2d& aDir1=aL1.Direction();
const gp_Dir2d& aDir2=aL2.Direction();
aDot=aDir1*aDir2;
if (aDot<0.) {
aDot=-aDot;
}
//
if ((1.-aDot)<5.e-11){//0.00001 rad
localok = Standard_False;
break;// from for (k = 0; k < 2; ++k){...
if (aDir1.IsParallel (aDir2, Precision::Angular()))
{
localok = Standard_False;
break;// from for (k = 0; k < 2; ++k){...
}
}//if (aT2m>aT21 && aT2m<aT22) {
}//if (aD2<aTol2) {

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

@@ -1,25 +1,26 @@
// Copyright (c) 2018 OPEN CASCADE SAS
// This file is part of commercial software by OPEN CASCADE SAS,
// furnished in accordance with the terms and conditions of the contract
// and with the inclusion of this copyright notice.
// This file or any part thereof may not be provided or otherwise
// made available to any third party.
//
// No ownership title to the software is transferred hereby.
//
// OPEN CASCADE SAS makes no representation or warranties with respect to the
// performance of this software, and specifically disclaims any responsibility
// for any damages, special or consequential, connected with its use.
//
// 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 <BRepGProp_MeshProps.hxx>
#include <BRepGProp.hxx>
#include <ElSLib.hxx>
#include <gp_Ax3.hxx>
#include <gp_Pnt.hxx>
#include <GProp.hxx>
#include <Poly_Triangulation.hxx>
#include <Poly_Triangle.hxx>
#include<ElSLib.hxx>
#include<gp_Ax3.hxx>
#include <BRepGProp.hxx>
#include <TopLoc_Location.hxx>
#include <GProp.hxx>
//=======================================================================
//function : CalculateElSProps

View File

@@ -1,23 +1,19 @@
// Copyright (c) 2018 OPEN CASCADE SAS
// This file is part of commercial software by OPEN CASCADE SAS,
// furnished in accordance with the terms and conditions of the contract
// and with the inclusion of this copyright notice.
// This file or any part thereof may not be provided or otherwise
// made available to any third party.
//
// No ownership title to the software is transferred hereby.
//
// OPEN CASCADE SAS makes no representation or warranties with respect to the
// performance of this software, and specifically disclaims any responsibility
// for any damages, special or consequential, connected with its use.
//
// 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 _BRepGProp_MeshProps_HeaderFile
#define _BRepGProp_MeshProps_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Type.hxx>
#include <GProp_GProps.hxx>
#include <TopAbs_Orientation.hxx>
#include <Poly_Array1OfTriangle.hxx>
@@ -36,11 +32,11 @@ public:
DEFINE_STANDARD_ALLOC
//! Describes types of geometric objects.
//! - Vinert is 3D closed region of space delimited with
//! Point and surface mesh;
//! - Sinert is surface mesh in 3D space.
typedef enum { Vinert = 0, Sinert } BRepGProp_MeshObjType;
//! Describes types of geometric objects.
//! - Vinert is 3D closed region of space delimited with
//! Point and surface mesh;
//! - Sinert is surface mesh in 3D space.
typedef enum { Vinert = 0, Sinert } BRepGProp_MeshObjType;
//! Constructor takes the type of object.
BRepGProp_MeshProps(const BRepGProp_MeshObjType theType) :

View File

@@ -25,14 +25,14 @@
//! Class implements functionality of model healer tool.
//! Iterates over model's faces and checks consistency of their wires,
//! i.e.whether wires are closed and do not contain self - intersections.
//! In case if wire contains disconnected parts, ends of adjacent edges
//! forming the gaps are connected in parametric space forcibly. The notion
//! of this operation is to create correct discrete model defined relatively
//! In case if wire contains disconnected parts, ends of adjacent edges
//! forming the gaps are connected in parametric space forcibly. The notion
//! of this operation is to create correct discrete model defined relatively
//! parametric space of target face taking into account connectivity and
//! tolerances of 3D space only. This means that there are no specific
//! computations are made for the sake of determination of U and V tolerance.
//! Registers intersections on edges forming the face<EFBFBD>s shape and tries to
//! amplify discrete represenation by decreasing of deflection for the target edge.
//! Registers intersections on edges forming the face's shape and tries to
//! amplify discrete represenation by decreasing of deflection for the target edge.
//! Checks can be performed in parallel mode.
class BRepMesh_ModelHealer : public IMeshTools_ModelAlgo
{

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

@@ -363,8 +363,8 @@ TopoDS_Shape BRepTools_ReShape::Apply (const TopoDS_Shape& shape,
return res;
}
TopAbs_ShapeEnum st = shape.ShapeType(); //, subt;
if ( st >= until ) return newsh; // critere d arret
TopAbs_ShapeEnum st = shape.ShapeType();
if (st > until || (st == until && until > TopAbs_COMPOUND)) return newsh; // stopping criteria
if(st == TopAbs_VERTEX || st == TopAbs_SHAPE)
return shape;
// define allowed types of components

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

@@ -193,14 +193,11 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dInterop (const Handle(OpenGl_Contex
myIsOwnDepth = true;
theCtx->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
GLenum aPixelFormat = 0, aDataType = 0;
if (myDepthFormat != 0
&& getDepthDataFormat (myDepthFormat, aPixelFormat, aDataType)
&& !myDepthStencilTexture->Init (theCtx, myDepthFormat,
aPixelFormat, aDataType,
aSizeX, aSizeY, Graphic3d_TOT_2D))
const OpenGl_TextureFormat aDepthFormat = OpenGl_TextureFormat::FindSizedFormat (theCtx, myDepthFormat);
if (aDepthFormat.IsValid()
&& !myDepthStencilTexture->Init (theCtx, aDepthFormat, Graphic3d_Vec2i (aSizeX, aSizeY), Graphic3d_TOT_2D))
{
Release (theCtx.operator->());
Release (theCtx.get());
theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
TCollection_AsciiString("D3DHost_FrameBuffer, could not initialize GL_DEPTH24_STENCIL8 texture ") + aSizeX + "x" + aSizeY);
return Standard_False;
@@ -288,17 +285,16 @@ void D3DHost_FrameBuffer::BindBuffer (const Handle(OpenGl_Context)& theCtx)
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
myColorTextures (0)->GetTarget(), myColorTextures (0)->TextureId(), 0);
GLenum aDepthPixelFormat = 0, aDepthDataType = 0;
getDepthDataFormat (myDepthFormat, aDepthPixelFormat, aDepthDataType);
const OpenGl_TextureFormat aDepthFormat = OpenGl_TextureFormat::FindSizedFormat (theCtx, myDepthFormat);
if (myDepthStencilTexture->IsValid())
{
#ifdef GL_DEPTH_STENCIL_ATTACHMENT
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, aDepthPixelFormat == GL_DEPTH_STENCIL ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT,
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, aDepthFormat.PixelFormat() == GL_DEPTH_STENCIL ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT,
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
#else
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
if (aDepthPixelFormat == GL_DEPTH_STENCIL)
if (aDepthFormat.PixelFormat() == GL_DEPTH_STENCIL)
{
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
@@ -310,12 +306,12 @@ void D3DHost_FrameBuffer::BindBuffer (const Handle(OpenGl_Context)& theCtx)
if (myDepthStencilTexture->IsValid())
{
#ifdef GL_DEPTH_STENCIL_ATTACHMENT
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, aDepthPixelFormat == GL_DEPTH_STENCIL ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT,
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, aDepthFormat.PixelFormat() == GL_DEPTH_STENCIL ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT,
myDepthStencilTexture->GetTarget(), 0, 0);
#else
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
myDepthStencilTexture->GetTarget(), 0, 0);
if (aDepthPixelFormat == GL_DEPTH_STENCIL)
if (aDepthFormat.PixelFormat() == GL_DEPTH_STENCIL)
{
theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
myDepthStencilTexture->GetTarget(), 0, 0);

View File

@@ -367,35 +367,57 @@ static Standard_Integer DPrsStd_AISColor (Draw_Interpretor& di,
Standard_Integer nb,
const char** arg)
{
if (nb >= 3) {
Handle(TDocStd_Document) D;
if (!DDocStd::GetDocument(arg[1],D)) return 1;
TDF_Label L;
if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
Handle(TPrsStd_AISViewer) viewer;
if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;
Handle(TPrsStd_AISPresentation) prs;
if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
if( nb == 4 ) {
prs->SetColor((Quantity_NameOfColor)Draw::Atoi(arg[3]));
TPrsStd_AISViewer::Update(L);
}
else
if (prs->HasOwnColor()){
di << "Color = " << prs->Color() << "\n";
di<<prs->Color();
}
else{
di << "DPrsStd_AISColor: Warning : Color wasn't set\n";
di<<(-1);
}
return 0;
}
if (nb != 3 && nb != 4)
{
std::cout << "Syntax error: wrong number of arguments\n";
return 1;
}
di << "DPrsStd_AISColor : Error" << "\n";
return 1;
Handle(TDocStd_Document) D;
if (!DDocStd::GetDocument (arg[1], D))
{
std::cout << "Syntax error: '" << arg[1] << "' is not a document\n";
return 1;
}
TDF_Label L;
if (!DDF::FindLabel (D->GetData(), arg[2], L))
{
std::cout << "Syntax error: '" << arg[2] << "' label cannot be found in the document\n";
return 1;
}
Handle(TPrsStd_AISViewer) viewer;
Handle(TPrsStd_AISPresentation) prs;
if (!TPrsStd_AISViewer::Find (L, viewer)
||!L.FindAttribute (TPrsStd_AISPresentation::GetID(), prs))
{
std::cout << "Syntax error: '" << arg[2] << "' label has no presentation\n";
return 1;
}
if (nb == 4)
{
Quantity_NameOfColor aColor = Quantity_NOC_BLACK;
if (!Quantity_Color::ColorFromName (arg[3], aColor))
{
std::cout << "Syntax error: unknown color '" << arg[3] << "'\n";
return 1;
}
prs->SetColor (aColor);
TPrsStd_AISViewer::Update (L);
}
else if (prs->HasOwnColor())
{
di << "Color = " << Quantity_Color::StringName (prs->Color()) << "\n";
di << Quantity_Color::StringName (prs->Color());
}
else
{
di << "DPrsStd_AISColor: Warning : Color wasn't set\n";
di << (-1);
}
return 0;
}
//=======================================================================

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

@@ -19,6 +19,7 @@
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_Text.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
@@ -36,7 +37,7 @@ void DsgPrs_XYZAxisPresentation::Add(
const Handle(Prs3d_LineAspect)& aLineAspect,
const gp_Dir & aDir,
const Standard_Real aVal,
const Standard_CString aText,
const Standard_CString theText,
const gp_Pnt& aPfirst,
const gp_Pnt& aPlast)
{
@@ -50,10 +51,12 @@ void DsgPrs_XYZAxisPresentation::Add(
Prs3d_Arrow::Draw (Prs3d_Root::CurrentGroup (aPresentation), aPlast,aDir, M_PI/180.*10., aVal/10.);
if (*aText != '\0')
if (*theText != '\0')
{
Graphic3d_Vertex a2(aPlast.X(),aPlast.Y(),aPlast.Z());
Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,a2,1./81.);
Handle(Graphic3d_Text) aText = new Graphic3d_Text (1.0f/81.0f);
aText->SetText (theText);
aText->SetPosition (aPlast);
Prs3d_Root::CurrentGroup(aPresentation)->AddText (aText);
}
}
@@ -64,7 +67,7 @@ void DsgPrs_XYZAxisPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
const Handle(Prs3d_TextAspect)& aTextAspect,
const gp_Dir & aDir,
const Standard_Real aVal,
const Standard_CString aText,
const Standard_CString theText,
const gp_Pnt& aPfirst,
const gp_Pnt& aPlast)
{
@@ -81,9 +84,11 @@ void DsgPrs_XYZAxisPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
G->SetPrimitivesAspect(aTextAspect->Aspect());
if (*aText != '\0')
if (*theText != '\0')
{
Graphic3d_Vertex a2(aPlast.X(),aPlast.Y(),aPlast.Z());
Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,a2,1./81.);
Handle(Graphic3d_Text) aText = new Graphic3d_Text (1.0f/81.0f);
aText->SetText (theText);
aText->SetPosition (aPlast);
Prs3d_Root::CurrentGroup(aPresentation)->AddText(aText);
}
}

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

@@ -593,6 +593,12 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
{
U1 = parameters(i);
U2 = parameters(i + 1);
if (U2 - U1 <= uTol)
{
continue;
}
// Check maximal deflection on interval;
Standard_Real dmax = 0.;
Standard_Real umax = 0.;

View File

@@ -15,8 +15,6 @@ Graphic3d_Aspects.cxx
Graphic3d_Aspects.hxx
Graphic3d_AspectFillArea3d.cxx
Graphic3d_AspectFillArea3d.hxx
Graphic3d_AspectFillCapping.cxx
Graphic3d_AspectFillCapping.hxx
Graphic3d_AspectLine3d.cxx
Graphic3d_AspectLine3d.hxx
Graphic3d_AspectMarker3d.cxx
@@ -50,6 +48,15 @@ Graphic3d_ClipPlane.hxx
Graphic3d_CStructure.cxx
Graphic3d_CStructure.hxx
Graphic3d_CTexture.hxx
Graphic3d_CubeMap.cxx
Graphic3d_CubeMap.hxx
Graphic3d_CubeMapOrder.cxx
Graphic3d_CubeMapOrder.hxx
Graphic3d_CubeMapPacked.cxx
Graphic3d_CubeMapPacked.hxx
Graphic3d_CubeMapSeparate.cxx
Graphic3d_CubeMapSeparate.hxx
Graphic3d_CubeMapSide.hxx
Graphic3d_CullingTool.cxx
Graphic3d_CullingTool.hxx
Graphic3d_CView.cxx
@@ -129,6 +136,8 @@ Graphic3d_StructureDefinitionError.hxx
Graphic3d_StructureManager.cxx
Graphic3d_StructureManager.hxx
Graphic3d_TextPath.hxx
Graphic3d_Text.cxx
Graphic3d_Text.hxx
Graphic3d_Texture1D.cxx
Graphic3d_Texture1D.hxx
Graphic3d_Texture1Dmanual.cxx

View File

@@ -1,110 +0,0 @@
// Created on: 2017-04-14
// Created by: Anton POLETAEV
// Copyright (c) 2017 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 <Graphic3d_AspectFillCapping.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectFillCapping, Standard_Transient)
// =======================================================================
// function : Graphic3d_AspectFillCapping
// purpose :
// =======================================================================
Graphic3d_AspectFillCapping::Graphic3d_AspectFillCapping()
: myFlags (Flags_None),
myHatchingState (0)
{
Graphic3d_MaterialAspect aMaterial;
aMaterial.SetColor (Quantity_NOC_BLACK);
aMaterial.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
aMaterial.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
aMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
aMaterial.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
aMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
SetHatchStyle (Aspect_HS_HORIZONTAL);
SetHatchMaterial (aMaterial);
}
// =======================================================================
// function : SetHatchStyle
// purpose :
// =======================================================================
void Graphic3d_AspectFillCapping::SetHatchStyle (const Aspect_HatchStyle theStyle)
{
myStippleHatch = new Graphic3d_HatchStyle (theStyle);
myTextureHatch.Nullify();
myHatchingState++;
}
// =======================================================================
// function : SetHatchStyle
// purpose :
// =======================================================================
void Graphic3d_AspectFillCapping::SetHatchStyle (const Handle(Graphic3d_HatchStyle)& theStyle)
{
myStippleHatch = theStyle;
myTextureHatch.Nullify();
myHatchingState++;
}
// =======================================================================
// function : SetHatchStyle
// purpose :
// =======================================================================
void Graphic3d_AspectFillCapping::SetHatchStyle (const Handle(Graphic3d_TextureMap)& theTexture)
{
myStippleHatch.Nullify();
myTextureHatch = theTexture;
myHatchingState++;
}
// =======================================================================
// function : SetHatchMaterial
// purpose :
// =======================================================================
void Graphic3d_AspectFillCapping::SetHatchMaterial (const Graphic3d_MaterialAspect& theMaterial)
{
myHatchMaterial = theMaterial;
myHatchingState++;
}
// =======================================================================
// function : SetToDrawHatch
// purpose :
// =======================================================================
void Graphic3d_AspectFillCapping::SetToDrawHatch (const Standard_Boolean theToDraw)
{
setFlag (theToDraw, Flags_DrawHatching);
myHatchingState++;
}
// =======================================================================
// function : SetHatchZoomPeristent
// purpose :
// =======================================================================
void Graphic3d_AspectFillCapping::SetHatchZoomPeristent (const Standard_Boolean theToSet)
{
setFlag (theToSet, Flags_HatchZoomPersistent);
myHatchingState++;
}
// =======================================================================
// function : SetHatchRotationPeristent
// purpose :
// =======================================================================
void Graphic3d_AspectFillCapping::SetHatchRotationPeristent (const Standard_Boolean theToSet)
{
setFlag (theToSet, Flags_HatchRotationPersistent);
myHatchingState++;
}

View File

@@ -1,164 +0,0 @@
// Created on: 2017-04-14
// Created by: Anton POLETAEV
// Copyright (c) 2017 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 _Graphic3d_AspectFillCapping_HeaderFile
#define _Graphic3d_AspectFillCapping_HeaderFile
#include <Aspect_HatchStyle.hxx>
#include <Graphic3d_Aspects.hxx>
#include <Graphic3d_HatchStyle.hxx>
#include <Graphic3d_MaterialAspect.hxx>
#include <Graphic3d_ShaderProgram.hxx>
#include <Graphic3d_TextureMap.hxx>
#include <Standard_Transient.hxx>
//! Defines graphical attributes for drawing section planes on solids resulted from clipping (cutting) planes.
class Graphic3d_AspectFillCapping : public Graphic3d_Aspects
{
public:
//! Default constructor.
Standard_EXPORT Graphic3d_AspectFillCapping();
public:
//! Sets material for filling section created by clipping.
void SetMaterial (const Graphic3d_MaterialAspect& theMaterial) { myMaterial = theMaterial; }
//! Returns material for filling section created by clipping.
const Graphic3d_MaterialAspect& Material() const { return myMaterial; }
//! Sets flag indicating whether object's material (instead of defined by this aspect) should be used for filling section.
void SetUseObjectMaterial (const Standard_Boolean theToUse) { setFlag (theToUse, Flags_UseObjectMaterial); }
//! Returns flag indicating whether object's material (instead of defined by this aspect) should be used for filling section.
Standard_Boolean ToUseObjectMaterial() const { return (myFlags & Flags_UseObjectMaterial) != 0; }
//! Sets texture for filling section created by clipping.
void SetTexture (const Handle(Graphic3d_TextureMap)& theTexture) { myTexture = theTexture; }
//! Returns texture for filling section created by clipping.
const Handle(Graphic3d_TextureMap)& Texture() const { return myTexture; }
//! Sets flag indicating whether object's texture (instead of defined by this aspect) should be used for filling section.
void SetUseObjectTexture (const Standard_Boolean theToUse) { setFlag (theToUse, Flags_UseObjectTexture); }
//! Returns flag indicating whether object's texture (instead of defined by this aspect) should be used for filling section.
Standard_Boolean ToUseObjectTexture() const { return (myFlags & Flags_UseObjectTexture) != 0; }
//! Sets OpenGL/GLSL shader program.
void SetShader (const Handle(Graphic3d_ShaderProgram)& theShader) { myShader = theShader; }
//! Returns OpenGL/GLSL shader program.
const Handle(Graphic3d_ShaderProgram)& Shader() const { return myShader; }
//! Sets flag indicating whether object's shader (instead of defined by this aspect) should be used for filling section.
void SetUseObjectShader (const Standard_Boolean theToUse) { setFlag (theToUse, Flags_UseObjectShader); }
//! Returns flag indicating whether object's shader (instead of defined by this aspect) should be used for filling section.
Standard_Boolean ToUseObjectShader() const { return (myFlags & Flags_UseObjectShader) != 0; }
public:
//! Sets style of hatch defined by predefined stipple mask.
Standard_EXPORT void SetHatchStyle (const Aspect_HatchStyle theStyle);
//! Sets style of hatch defined by custom stipple mask.
Standard_EXPORT void SetHatchStyle (const Handle(Graphic3d_HatchStyle)& theStyle);
//! Sets style of hatch defined by texture map (decal texture with alpha channel should be used).
Standard_EXPORT void SetHatchStyle (const Handle(Graphic3d_TextureMap)& theTexture);
//! Sets material style for hatch lines (texture).
Standard_EXPORT void SetHatchMaterial (const Graphic3d_MaterialAspect& theMaterial);
//! Returns material style for hatch lines (texture).
const Graphic3d_MaterialAspect& HatchMaterial() const { return myHatchMaterial; }
//! Sets boolean flag indicating whether the hatch layer should be drawn or not.
Standard_EXPORT void SetToDrawHatch (const Standard_Boolean theToDraw);
//! Returns boolean flag indicating whether the hatch layer should be drawn or not.
Standard_Boolean ToDrawHatch() const { return (myFlags & Flags_DrawHatching) != 0; }
//! Sets flag controlling behavior of hatch texture mapping on zooming.
//! @param theToSet [in] if passed TRUE the texture will keep constant screen-scale independent of zooming.
Standard_EXPORT void SetHatchZoomPeristent (const Standard_Boolean theToSet);
//! Returns value of flag controlling behavior of hatch texture mapping on zooming.
Standard_Boolean IsHatchZoomPersistent() { return (myFlags & Flags_HatchZoomPersistent) != 0; }
//! Sets flag controlling behavior of hatch texture mapping on camera rotation around heading vector.
Standard_EXPORT void SetHatchRotationPeristent (const Standard_Boolean theToSet);
//! Returns value of flag controlling behavior of hatch texture mapping on camera rotation around heading vector.
Standard_Boolean IsHatchRotationPersistent() { return (myFlags & Flags_HatchRotationPersistent) != 0; }
//! Returns true if hatch is defined by texture.
Standard_Boolean IsTextureHatch() const { return !myTextureHatch.IsNull(); }
//! Returns texture map defining the hatch.
const Handle(Graphic3d_TextureMap)& TextureHatch() const { return myTextureHatch; }
//! Returns true if hatch is defined by stipple mask.
Standard_Boolean IsStippleHatch() const { return !myStippleHatch.IsNull(); }
//! Returns the stipple mask.
const Handle(Graphic3d_HatchStyle)& StippleHatch() const { return myStippleHatch; }
//! Returns modification counter for hatching state.
Standard_Size HatchingState() const { return myHatchingState; }
private:
enum Flags
{
Flags_None = 0x00, //!< no flags
Flags_UseObjectMaterial = 0x01, //!< use object material
Flags_UseObjectTexture = 0x02, //!< use object texture
Flags_UseObjectShader = 0x04, //!< use object GLSL program
Flags_HatchZoomPersistent = 0x08, //!< zoom-persistent texturing
Flags_HatchRotationPersistent = 0x10, //!< rotation-persistent texturing
Flags_DrawHatching = 0x20, //!< draw hatching
Flags_UseObjectProperties = //!< use entire fill area aspect from object
Flags_UseObjectMaterial
| Flags_UseObjectTexture
| Flags_UseObjectShader
};
void setFlag (const Standard_Boolean theToUse, const unsigned int theFlag)
{
myFlags = theToUse ? myFlags | theFlag : myFlags & ~theFlag;
}
private:
Graphic3d_MaterialAspect myMaterial;
Handle(Graphic3d_TextureMap) myTexture;
Handle(Graphic3d_ShaderProgram) myShader;
Handle(Graphic3d_HatchStyle) myStippleHatch;
Handle(Graphic3d_TextureMap) myTextureHatch;
Graphic3d_MaterialAspect myHatchMaterial;
unsigned int myFlags;
Standard_Size myHatchingState;
public:
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectFillCapping, Graphic3d_Aspects)
};
DEFINE_STANDARD_HANDLE (Graphic3d_AspectFillCapping, Graphic3d_Aspects)
#endif // _Graphic3d_AspectFillCapping_HeaderFile

View File

@@ -19,6 +19,7 @@
#include <Aspect_Window.hxx>
#include <Graphic3d_BufferType.hxx>
#include <Graphic3d_Camera.hxx>
#include <Graphic3d_CubeMap.hxx>
#include <Graphic3d_CLight.hxx>
#include <Graphic3d_CStructure.hxx>
#include <Graphic3d_DataStructureManager.hxx>
@@ -373,6 +374,12 @@ public:
//! Sets background image fill style.
virtual void SetBackgroundImageStyle (const Aspect_FillMethod theFillStyle) = 0;
//! Returns cubemap being setted last time on background.
virtual Handle(Graphic3d_CubeMap) BackgroundCubeMap() const = 0;
//! Sets environment cubemap as background.
virtual void SetBackgroundCubeMap (const Handle(Graphic3d_CubeMap)& theCubeMap) = 0;
//! Returns environment texture set for the view.
virtual Handle(Graphic3d_TextureEnv) TextureEnv() const = 0;

View File

@@ -24,6 +24,19 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ClipPlane,Standard_Transient)
namespace
{
static volatile Standard_Integer THE_CLIP_PLANE_COUNTER = 0;
static Handle(Graphic3d_AspectFillArea3d) defaultAspect()
{
Graphic3d_MaterialAspect aMaterial (Graphic3d_NOM_DEFAULT);
Handle(Graphic3d_AspectFillArea3d) anAspect = new Graphic3d_AspectFillArea3d();
anAspect->SetDistinguishOff();
anAspect->SetFrontMaterial (aMaterial);
anAspect->SetHatchStyle (Aspect_HS_HORIZONTAL);
anAspect->SetInteriorStyle (Aspect_IS_SOLID);
anAspect->SetInteriorColor (Quantity_NOC_GRAY20);
anAspect->SetSuppressBackFaces (false);
return anAspect;
}
}
// =======================================================================
@@ -31,8 +44,19 @@ namespace
// purpose :
// =======================================================================
Graphic3d_ClipPlane::Graphic3d_ClipPlane()
: myAspect (defaultAspect()),
myPrevInChain(NULL),
myPlane (0.0, 0.0, 1.0, 0.0),
myEquation (0.0, 0.0, 1.0, 0.0),
myEquationRev(0.0, 0.0,-1.0, 0.0),
myChainLenFwd(1),
myFlags (Graphic3d_CappingFlags_None),
myEquationMod(0),
myAspectMod (0),
myIsOn (Standard_True),
myIsCapping (Standard_False)
{
init();
makeId();
}
// =======================================================================
@@ -40,8 +64,19 @@ Graphic3d_ClipPlane::Graphic3d_ClipPlane()
// purpose :
// =======================================================================
Graphic3d_ClipPlane::Graphic3d_ClipPlane (const Graphic3d_Vec4d& theEquation)
: myAspect (defaultAspect()),
myPrevInChain(NULL),
myPlane (theEquation.x(), theEquation.y(), theEquation.z(), theEquation.w()),
myEquation (theEquation),
myEquationRev(0.0, 0.0,-1.0, 0.0),
myChainLenFwd(1),
myFlags (Graphic3d_CappingFlags_None),
myEquationMod(0),
myAspectMod (0),
myIsOn (Standard_True),
myIsCapping (Standard_False)
{
init (gp_Pln (theEquation.x(), theEquation.y(), theEquation.z(), theEquation.a()));
makeId();
updateInversedPlane();
}
@@ -49,27 +84,42 @@ Graphic3d_ClipPlane::Graphic3d_ClipPlane (const Graphic3d_Vec4d& theEquation)
// function : Graphic3d_ClipPlane
// purpose :
// =======================================================================
Graphic3d_ClipPlane::Graphic3d_ClipPlane (const Graphic3d_ClipPlane& theOther)
: Standard_Transient (theOther)
Graphic3d_ClipPlane::Graphic3d_ClipPlane(const Graphic3d_ClipPlane& theOther)
: Standard_Transient(theOther),
myAspect (defaultAspect()),
myPrevInChain(NULL),
myPlane (theOther.myPlane),
myEquation (theOther.myEquation),
myEquationRev(theOther.myEquationRev),
myChainLenFwd(1),
myFlags (theOther.myFlags),
myEquationMod(0),
myAspectMod (0),
myIsOn (theOther.myIsOn),
myIsCapping (theOther.myIsCapping)
{
*mySectionStyle = *theOther.CappingSectionStyle();
init (theOther.myPlane,
theOther.myEquationRev,
theOther.myIsOn,
theOther.myIsCapping,
theOther.ToOverrideCappingAspect(),
theOther.CappingSectionStyle());
updateInversedPlane();
makeId();
*myAspect = *theOther.CappingAspect();
}
// =======================================================================
// function : Graphic3d_ClipPlane
// purpose :
// =======================================================================
Graphic3d_ClipPlane::Graphic3d_ClipPlane (const gp_Pln& thePlane)
Graphic3d_ClipPlane::Graphic3d_ClipPlane(const gp_Pln& thePlane)
: myAspect (defaultAspect()),
myPrevInChain(NULL),
myPlane (thePlane),
myChainLenFwd(1),
myFlags (Graphic3d_CappingFlags_None),
myEquationMod(0),
myAspectMod (0),
myIsOn (Standard_True),
myIsCapping (Standard_False)
{
init (thePlane);
thePlane.Coefficients (myEquation[0], myEquation[1], myEquation[2], myEquation[3]);
updateInversedPlane();
makeId();
}
// =======================================================================
@@ -81,7 +131,7 @@ void Graphic3d_ClipPlane::SetEquation (const Graphic3d_Vec4d& theEquation)
myPlane = gp_Pln (theEquation.x(), theEquation.y(), theEquation.z(), theEquation.w());
myEquation = theEquation;
updateInversedPlane();
myOrientationDirty = Standard_True;
myEquationMod++;
}
// =======================================================================
@@ -93,7 +143,7 @@ void Graphic3d_ClipPlane::SetEquation (const gp_Pln& thePlane)
myPlane = thePlane;
thePlane.Coefficients (myEquation[0], myEquation[1], myEquation[2], myEquation[3]);
updateInversedPlane();
myOrientationDirty = Standard_True;
myEquationMod++;
}
// =======================================================================
@@ -128,106 +178,133 @@ Handle(Graphic3d_ClipPlane) Graphic3d_ClipPlane::Clone() const
}
// =======================================================================
// function : SetCappingSectionStyle
// function : SetCappingColor
// purpose :
// =======================================================================
void Graphic3d_ClipPlane::SetCappingSectionStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle)
void Graphic3d_ClipPlane::SetCappingColor (const Quantity_Color& theColor)
{
mySectionStyle = theStyle;
myAspect->SetInteriorColor (theColor);
myAspect->ChangeFrontMaterial().SetColor (theColor);
++myAspectMod;
}
// =======================================================================
// function : OrientationMatrix
// function : SetCappingMaterial
// purpose :
// =======================================================================
const Graphic3d_Mat4& Graphic3d_ClipPlane::OrientationMatrix() const
void Graphic3d_ClipPlane::SetCappingMaterial (const Graphic3d_MaterialAspect& theMat)
{
if (myOrientationDirty)
myAspect->SetFrontMaterial (theMat);
if (myAspect->FrontMaterial().MaterialType() != Graphic3d_MATERIAL_ASPECT)
{
const Standard_ShortReal aDirection[] = {
static_cast<Standard_ShortReal> (myEquation[0]),
static_cast<Standard_ShortReal> (myEquation[1]),
static_cast<Standard_ShortReal> (myEquation[2])
};
myAspect->SetInteriorColor (theMat.Color());
}
++myAspectMod;
}
const Standard_ShortReal aTranslate[] = {
static_cast<Standard_ShortReal> (myEquation[0] * -myEquation[3]),
static_cast<Standard_ShortReal> (myEquation[1] * -myEquation[3]),
static_cast<Standard_ShortReal> (myEquation[2] * -myEquation[3])
};
Standard_ShortReal aSide1[] = { 0.0f, 0.0f, 0.0f };
Standard_ShortReal aSide2[] = { 0.0f, 0.0f, 0.0f };
const Standard_ShortReal aMagintude = static_cast<Standard_ShortReal> (Sqrt (myEquation[0] * myEquation[0] + myEquation[2] * myEquation[2]));
if (aMagintude < ShortRealSmall())
// =======================================================================
// function : SetCappingTexture
// purpose :
// =======================================================================
void Graphic3d_ClipPlane::SetCappingTexture (const Handle(Graphic3d_TextureMap)& theTexture)
{
if (!theTexture.IsNull())
{
myAspect->SetTextureMapOn();
Handle(Graphic3d_TextureSet) aTextureSet = myAspect->TextureSet();
if (aTextureSet.IsNull() || aTextureSet->Size() != 1)
{
aSide1[0] = 1.0f;
aTextureSet = new Graphic3d_TextureSet (theTexture);
}
else
{
aSide1[0] = aDirection[2] / aMagintude;
aSide1[2] = -aDirection[0] / aMagintude;
aTextureSet->SetFirst (theTexture);
}
aSide2[0] = (-aSide1[1] * aDirection[2]) - (-aSide1[2] * aDirection[1]);
aSide2[1] = (-aSide1[2] * aDirection[0]) - (-aSide1[0] * aDirection[2]);
aSide2[2] = (-aSide1[0] * aDirection[1]) - (-aSide1[1] * aDirection[0]);
myOrientationMat.SetValue (0, 0, aSide1[0]);
myOrientationMat.SetValue (1, 0, aSide1[1]);
myOrientationMat.SetValue (2, 0, aSide1[2]);
myOrientationMat.SetValue (3, 0, 0.0F);
myOrientationMat.SetValue (0, 1, aDirection[0]);
myOrientationMat.SetValue (1, 1, aDirection[1]);
myOrientationMat.SetValue (2, 1, aDirection[2]);
myOrientationMat.SetValue (3, 1, 0.0F);
myOrientationMat.SetValue (0, 2, aSide2[0]);
myOrientationMat.SetValue (1, 2, aSide2[1]);
myOrientationMat.SetValue (2, 2, aSide2[2]);
myOrientationMat.SetValue (3, 2, 0.0F);
myOrientationMat.SetValue (0, 3, aTranslate[0]);
myOrientationMat.SetValue (1, 3, aTranslate[1]);
myOrientationMat.SetValue (2, 3, aTranslate[2]);
myOrientationMat.SetValue (3, 3, 1.0F);
myOrientationDirty = Standard_False;
myAspect->SetTextureSet (aTextureSet);
}
return myOrientationMat;
else
{
myAspect->SetTextureMapOff();
myAspect->SetTextureSet (Handle(Graphic3d_TextureSet)());
}
++myAspectMod;
}
// =======================================================================
// function : init
// function : SetCappingHatch
// purpose :
// =======================================================================
void Graphic3d_ClipPlane::init (const gp_Pln& thePlane,
const Graphic3d_Vec4d& theEquationRev,
const Standard_Boolean theIsOn,
const Standard_Boolean theIsCapping,
const Standard_Boolean theOverrideStyle,
const Handle(Graphic3d_AspectFillCapping)& theStyle)
void Graphic3d_ClipPlane::SetCappingHatch (const Aspect_HatchStyle theStyle)
{
if (myEntityUID.IsEmpty())
{
myEntityUID = TCollection_AsciiString ("Graphic3d_ClipPlane_") //DynamicType()->Name()
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_CLIP_PLANE_COUNTER));
}
myAspect->SetHatchStyle (theStyle);
++myAspectMod;
}
myPrevInChain = NULL;
myEquationRev = theEquationRev;
myChainLenFwd = 1;
myPlane = thePlane;
myPlane.Coefficients (myEquation[0], myEquation[1], myEquation[2], myEquation[3]);
myIsOn = theIsOn;
myIsCapping = theIsCapping;
myOverrideObjectStyle = theOverrideStyle;
mySectionStyle = theStyle.IsNull() ? new Graphic3d_AspectFillCapping() : theStyle;
myOrientationDirty = Standard_True;
// =======================================================================
// function : SetCappingCustomHatch
// purpose :
// =======================================================================
void Graphic3d_ClipPlane::SetCappingCustomHatch (const Handle(Graphic3d_HatchStyle)& theStyle)
{
myAspect->SetHatchStyle (theStyle);
++myAspectMod;
}
// =======================================================================
// function : SetCappingHatchOn
// purpose :
// =======================================================================
void Graphic3d_ClipPlane::SetCappingHatchOn()
{
myAspect->SetInteriorStyle (Aspect_IS_HATCH);
++myAspectMod;
}
// =======================================================================
// function : SetCappingHatchOff
// purpose :
// =======================================================================
void Graphic3d_ClipPlane::SetCappingHatchOff()
{
myAspect->SetInteriorStyle (Aspect_IS_SOLID);
++myAspectMod;
}
// =======================================================================
// function : SetCappingAspect
// purpose :
// =======================================================================
void Graphic3d_ClipPlane::SetCappingAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect)
{
myAspect = theAspect;
++myAspectMod;
}
// =======================================================================
// function : setCappingFlag
// purpose :
// =======================================================================
void Graphic3d_ClipPlane::setCappingFlag (bool theToUse, int theFlag)
{
if (theToUse)
{
myFlags |= theFlag;
}
else
{
myFlags &= ~(theFlag);
}
++myAspectMod;
}
// =======================================================================
// function : makeId
// purpose :
// =======================================================================
void Graphic3d_ClipPlane::makeId()
{
myId = TCollection_AsciiString ("Graphic3d_ClipPlane_") //DynamicType()->Name()
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_CLIP_PLANE_COUNTER));
}
// =======================================================================
@@ -249,7 +326,7 @@ void Graphic3d_ClipPlane::updateChainLen()
// =======================================================================
void Graphic3d_ClipPlane::SetChainNextPlane (const Handle(Graphic3d_ClipPlane)& thePlane)
{
myOrientationDirty = Standard_True;
++myEquationMod;
if (!myNextInChain.IsNull())
{
myNextInChain->myPrevInChain = NULL;

View File

@@ -19,12 +19,9 @@
#include <Aspect_HatchStyle.hxx>
#include <gp_Pln.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectFillCapping.hxx>
#include <Graphic3d_BndBox3d.hxx>
#include <Graphic3d_CappingFlags.hxx>
#include <Graphic3d_Mat4.hxx>
#include <Graphic3d_TextureMap.hxx>
#include <NCollection_Handle.hxx>
#include <NCollection_Vec4.hxx>
#include <Standard_Macro.hxx>
#include <Standard_TypeDef.hxx>
@@ -169,6 +166,50 @@ 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);
//! @return capping material.
const Graphic3d_MaterialAspect& CappingMaterial() const { return myAspect->FrontMaterial(); }
//! Set texture to be applied on capping surface.
//! @param theTexture [in] the texture.
Standard_EXPORT void SetCappingTexture (const Handle(Graphic3d_TextureMap)& theTexture);
//! @return capping texture map.
Handle(Graphic3d_TextureMap) CappingTexture() const { return !myAspect->TextureSet().IsNull() && !myAspect->TextureSet()->IsEmpty()
? myAspect->TextureSet()->First()
: Handle(Graphic3d_TextureMap)(); }
//! Set hatch style (stipple) and turn hatching on.
//! @param theStyle [in] the hatch style.
Standard_EXPORT void SetCappingHatch (const Aspect_HatchStyle theStyle);
//! @return hatching style.
Aspect_HatchStyle CappingHatch() const { return (Aspect_HatchStyle)myAspect->HatchStyle()->HatchType(); }
//! Set custom hatch style (stipple) and turn hatching on.
//! @param theStyle [in] the hatch pattern.
Standard_EXPORT void SetCappingCustomHatch (const Handle(Graphic3d_HatchStyle)& theStyle);
//! @return hatching style.
const Handle(Graphic3d_HatchStyle)& CappingCustomHatch() const { return myAspect->HatchStyle(); }
//! Turn on hatching.
Standard_EXPORT void SetCappingHatchOn();
//! Turn off hatching.
Standard_EXPORT void SetCappingHatchOff();
//! @return True if hatching mask is turned on.
Standard_Boolean IsHatchOn() const { return myAspect->InteriorStyle() == Aspect_IS_HATCH; }
//! This ID is used for managing associated resources in graphical driver.
//! The clip plane can be assigned within a range of IO which can be
@@ -179,18 +220,41 @@ public: // @name user-defined graphical attributes
//! @return clip plane resource identifier string.
const TCollection_AsciiString& GetId() const
{
return myEntityUID;
return myId;
}
public:
//! Returns style used for drawing capping section.
//! Return capping aspect.
//! @return capping surface rendering aspect.
const Handle(Graphic3d_AspectFillCapping)& CappingSectionStyle() const { return mySectionStyle; }
const Handle(Graphic3d_AspectFillArea3d)& CappingAspect() const { return myAspect; }
//! Sets clipping section filling aspect.
Standard_EXPORT void SetCappingSectionStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle);
//! Assign capping aspect.
Standard_EXPORT void SetCappingAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect);
//! Flag indicating whether material for capping plane should be taken from object.
//! Default value: FALSE (use dedicated capping plane material).
bool ToUseObjectMaterial() const { return (myFlags & Graphic3d_CappingFlags_ObjectMaterial) != 0; }
//! Set flag for controlling the source of capping plane material.
void SetUseObjectMaterial (bool theToUse) { setCappingFlag (theToUse, Graphic3d_CappingFlags_ObjectMaterial); }
//! Flag indicating whether texture for capping plane should be taken from object.
//! Default value: FALSE.
bool ToUseObjectTexture() const { return (myFlags & Graphic3d_CappingFlags_ObjectTexture) != 0; }
//! Set flag for controlling the source of capping plane texture.
void SetUseObjectTexture (bool theToUse) { setCappingFlag (theToUse, Graphic3d_CappingFlags_ObjectTexture); }
//! Flag indicating whether shader program for capping plane should be taken from object.
//! Default value: FALSE.
bool ToUseObjectShader() const { return (myFlags & Graphic3d_CappingFlags_ObjectShader) != 0; }
//! Set flag for controlling the source of capping plane shader program.
void SetUseObjectShader(bool theToUse) { setCappingFlag (theToUse, Graphic3d_CappingFlags_ObjectShader); }
//! Return true if some fill area aspect properties should be taken from object.
bool ToUseObjectProperties() const { return myFlags != Graphic3d_CappingFlags_None; }
public:
@@ -326,25 +390,14 @@ public: // @name modification counters
{
return myAspectMod;
}
//! Flag indicating whether section style of the plane should overrides similar property of object presentation.
//! Default value: FALSE (use dedicated presentation aspect style).
bool ToOverrideCappingAspect() const { return myOverrideObjectStyle; }
//! Sets flag for controlling the preference of using section style between clip plane and object.
void SetToOverrideCappingAspect (const bool theToOverride) { myOverrideObjectStyle = theToOverride; }
//! Returns plane's orientation matrix.
Standard_EXPORT const Graphic3d_Mat4& OrientationMatrix() const;
private:
//! Initializes plane and makes unique identifier (UID) to differentiate clipping plane entities.
void init (const gp_Pln& thePlane = gp_Pln(),
const Graphic3d_Vec4d& theEquationRev = Graphic3d_Vec4d(0.0, 0.0,-1.0, 0.0),
const Standard_Boolean theIsOn = Standard_True,
const Standard_Boolean theIsCapping = Standard_False,
const Standard_Boolean theOverrideStyle = Standard_False,
const Handle(Graphic3d_AspectFillCapping)& theStyle = Handle(Graphic3d_AspectFillCapping)());
//! Generate unique object id for OpenGL graphic resource manager.
void makeId();
//! Set capping flag.
Standard_EXPORT void setCappingFlag (bool theToUse, int theFlag);
//! Update chain length in backward direction.
void updateChainLen();
@@ -359,10 +412,10 @@ private:
private:
Handle(Graphic3d_AspectFillCapping) mySectionStyle; //!< Style set for drawing capped solid section.
Handle(Graphic3d_AspectFillArea3d) myAspect; //!< fill area aspect
Handle(Graphic3d_ClipPlane) myNextInChain; //!< next plane in a chain of planes defining logical AND operation
Graphic3d_ClipPlane* myPrevInChain; //!< previous plane in a chain of planes defining logical AND operation
TCollection_AsciiString myEntityUID; //!< Unique identifier for the plane
TCollection_AsciiString myId; //!< resource id
gp_Pln myPlane; //!< plane definition
Graphic3d_Vec4d myEquation; //!< plane equation vector
Graphic3d_Vec4d myEquationRev; //!< reversed plane equation
@@ -372,9 +425,6 @@ private:
unsigned int myAspectMod; //!< modification counter of aspect
Standard_Boolean myIsOn; //!< state of the clipping plane
Standard_Boolean myIsCapping; //!< state of graphic driver capping
Standard_Boolean myOverrideObjectStyle; //!< Flag forcing to use plane's section style rather than section style defined for object
mutable Standard_Boolean myOrientationDirty; //!< Boolean flag indicating whether orientation matrix is dirty or not.
mutable Graphic3d_Mat4 myOrientationMat; //!< Plane orientation matrix (for visualization purposes).
};

View File

@@ -1,6 +1,5 @@
// Created on: 2011-09-20
// Created by: Sergey ZERCHANINOV
// Copyright (c) 2011-2014 OPEN CASCADE SAS
// Author: Ilya Khramov
// Copyright (c) 2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -13,18 +12,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _OpenGl_TextParam_Header
#define _OpenGl_TextParam_Header
#include <Graphic3d_CubeMap.hxx>
#include <Graphic3d_HorizontalTextAlignment.hxx>
#include <Graphic3d_VerticalTextAlignment.hxx>
struct OpenGl_TextParam
{
int Height;
Graphic3d_HorizontalTextAlignment HAlign;
Graphic3d_VerticalTextAlignment VAlign;
DEFINE_STANDARD_ALLOC
};
#endif //_OpenGl_TextParam_Header
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CubeMap, Graphic3d_TextureMap)

View File

@@ -0,0 +1,110 @@
// Author: Ilya Khramov
// 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 _Graphic3d_CubeMap_HeaderFile
#define _Graphic3d_CubeMap_HeaderFile
#include <Graphic3d_CubeMapOrder.hxx>
#include <Graphic3d_TextureMap.hxx>
//! Base class for cubemaps.
//! It is iterator over cubemap sides.
class Graphic3d_CubeMap : public Graphic3d_TextureMap
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_CubeMap, Graphic3d_TextureMap)
public:
//! Constructor defining loading cubemap from file.
Graphic3d_CubeMap (const TCollection_AsciiString& theFileName) :
Graphic3d_TextureMap (theFileName, Graphic3d_TOT_CUBEMAP),
myCurrentSide (Graphic3d_CMS_POS_X),
myEndIsReached (false),
myIsTopDown (true),
myZIsInverted (false)
{}
//! Constructor defining direct cubemap initialization from PixMap.
Graphic3d_CubeMap (const Handle(Image_PixMap)& thePixmap = Handle(Image_PixMap)()) :
Graphic3d_TextureMap (thePixmap, Graphic3d_TOT_CUBEMAP),
myCurrentSide (Graphic3d_CMS_POS_X),
myEndIsReached (false),
myIsTopDown (true),
myZIsInverted (false)
{}
//! Returns whether the iterator has reached the end (true if it hasn't).
Standard_Boolean More() const { return !myEndIsReached; }
//! Returns current cubemap side (iterator state).
Graphic3d_CubeMapSide CurrentSide() const { return myCurrentSide; }
//! Moves iterator to the next cubemap side.
//! Uses OpenGL cubemap sides order +X -> -X -> +Y -> -Y -> +Z -> -Z.
void Next()
{
if (!myEndIsReached && myCurrentSide == Graphic3d_CMS_NEG_Z)
{
myEndIsReached = true;
}
else
{
myCurrentSide = Graphic3d_CubeMapSide (myCurrentSide + 1);
}
}
//! Returns whether row's memory layout is top-down.
Standard_Boolean IsTopDown() const
{
return myIsTopDown;
}
//! Sets Z axis inversion (vertical flipping).
void SetZInversion (Standard_Boolean theZIsInverted)
{
myZIsInverted = theZIsInverted;
}
//! Returns whether Z axis is inverted.
Standard_Boolean ZIsInverted() const
{
return myZIsInverted;
}
//! Returns PixMap containing current side of cubemap.
//! Returns null handle if current side is invalid.
virtual Handle(Image_PixMap) Value() = 0;
//! Sets iterator state to +X cubemap side.
Graphic3d_CubeMap& Reset()
{
myCurrentSide = Graphic3d_CMS_POS_X;
myEndIsReached = false;
return *this;
}
//! Empty destructor.
~Graphic3d_CubeMap() {}
protected:
Graphic3d_CubeMapSide myCurrentSide; //!< Iterator state
Standard_Boolean myEndIsReached; //!< Indicates whether end of iteration has been reached or hasn't
Standard_Boolean myIsTopDown; //!< Stores rows's memory layout
Standard_Boolean myZIsInverted; //!< Indicates whether Z axis is inverted that allows to synchronize vertical flip of cubemap
};
DEFINE_STANDARD_HANDLE(Graphic3d_CubeMap, Graphic3d_TextureMap)
#endif // _Graphic3d_CubeMap_HeaderFile

View File

@@ -0,0 +1,278 @@
// Author: Ilya Khramov
// 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.
#include <Graphic3d_CubeMapOrder.hxx>
#include <Standard_Failure.hxx>
#include <bitset>
// =======================================================================
// function : Graphic3d_CubeMapOrder
// purpose :
// =======================================================================
Graphic3d_CubeMapOrder::Graphic3d_CubeMapOrder()
:
myConvolution (0),
myHasOverflows (false)
{}
// =======================================================================
// function : Graphic3d_CubeMapOrder
// purpose :
// =======================================================================
Graphic3d_CubeMapOrder::Graphic3d_CubeMapOrder (unsigned char thePosXLocation,
unsigned char theNegXLocation,
unsigned char thePosYLocation,
unsigned char theNegYLocation,
unsigned char thePosZLocation,
unsigned char theNegZLocation)
:
myConvolution (0),
myHasOverflows (false)
{
Set (Graphic3d_CMS_POS_X, thePosXLocation);
Set (Graphic3d_CMS_NEG_X, theNegXLocation);
Set (Graphic3d_CMS_POS_Y, thePosYLocation);
Set (Graphic3d_CMS_NEG_Y, theNegYLocation);
Set (Graphic3d_CMS_POS_Z, thePosZLocation);
Set (Graphic3d_CMS_NEG_Z, theNegZLocation);
}
// =======================================================================
// function : Graphic3d_CubeMapOrder
// purpose :
// =======================================================================
Graphic3d_CubeMapOrder::Graphic3d_CubeMapOrder (const Graphic3d_ValidatedCubeMapOrder theOrder)
:
myConvolution (theOrder.Order.myConvolution),
myHasOverflows (theOrder.Order.myHasOverflows)
{}
// =======================================================================
// function : Set
// purpose :
// =======================================================================
Graphic3d_CubeMapOrder& Graphic3d_CubeMapOrder::Set (const Graphic3d_CubeMapOrder& theOrder)
{
myConvolution = theOrder.myConvolution;
myHasOverflows = theOrder.myHasOverflows;
return *this;
}
// =======================================================================
// function : operator=
// purpose :
// =======================================================================
Graphic3d_ValidatedCubeMapOrder Graphic3d_CubeMapOrder::Validated() const
{
if (!IsValid())
{
throw Standard_Failure("Try of Graphic3d_ValidatedCubeMapOrder creation using invalid Graphic3d_CubeMapOrder");
}
return *this;
}
// =======================================================================
// function : Set
// purpose :
// =======================================================================
Graphic3d_CubeMapOrder& Graphic3d_CubeMapOrder::Set (Graphic3d_CubeMapSide theCubeMapSide, unsigned char theValue)
{
if (theValue > 5)
{
myHasOverflows = true;
return *this;
}
set (theCubeMapSide, theValue);
return *this;
}
// =======================================================================
// function : Get
// purpose :
// =======================================================================
unsigned char Graphic3d_CubeMapOrder::Get (Graphic3d_CubeMapSide theCubeMapSide) const
{
return get (static_cast<unsigned char> (theCubeMapSide));
}
// =======================================================================
// function : operator[]
// purpose :
// =======================================================================
unsigned char Graphic3d_CubeMapOrder::operator[] (Graphic3d_CubeMapSide theCubeMapSide) const
{
return Get (theCubeMapSide);
}
// =======================================================================
// function : SetDefault
// purpose :
// =======================================================================
Graphic3d_CubeMapOrder& Graphic3d_CubeMapOrder::SetDefault()
{
for (unsigned char i = 0; i < 6; ++i)
{
set (Graphic3d_CubeMapSide (i), i);
}
return *this;
}
// =======================================================================
// function : Permute
// purpose :
// =======================================================================
Graphic3d_CubeMapOrder& Graphic3d_CubeMapOrder::Permute (Graphic3d_ValidatedCubeMapOrder thePermutation)
{
for (unsigned char i = 0; i < 6; ++i)
{
set (i, thePermutation->get (get (i)));
}
return *this;
}
// =======================================================================
// function : Permuted
// purpose :
// =======================================================================
Graphic3d_CubeMapOrder Graphic3d_CubeMapOrder::Permuted (Graphic3d_ValidatedCubeMapOrder thePermutation) const
{
Graphic3d_CubeMapOrder anOrder = *this;
anOrder.Permute (thePermutation);
return anOrder;
}
// =======================================================================
// function : Swap
// purpose :
// =======================================================================
Graphic3d_CubeMapOrder& Graphic3d_CubeMapOrder::Swap (Graphic3d_CubeMapSide theFirstSide,
Graphic3d_CubeMapSide theSecondSide)
{
unsigned char aTmp = Get (theFirstSide);
set (theFirstSide, Get(theSecondSide));
set (theSecondSide, aTmp);
return *this;
}
// =======================================================================
// function : Swapped
// purpose :
// =======================================================================
Graphic3d_CubeMapOrder Graphic3d_CubeMapOrder::Swapped (Graphic3d_CubeMapSide theFirstSide,
Graphic3d_CubeMapSide theSecondSide) const
{
Graphic3d_CubeMapOrder anOrder = *this;
anOrder.Swap (theFirstSide, theSecondSide);
return anOrder;
}
// =======================================================================
// function : Clear
// purpose :
// =======================================================================
Graphic3d_CubeMapOrder& Graphic3d_CubeMapOrder::Clear()
{
myConvolution = 0;
myHasOverflows = false;
return *this;
}
// =======================================================================
// function : IsEmpty
// purpose :
// =======================================================================
bool Graphic3d_CubeMapOrder::IsEmpty() const
{
return myConvolution == 0;
}
// =======================================================================
// function : HasRepetitions
// purpose :
// =======================================================================
bool Graphic3d_CubeMapOrder::HasRepetitions() const
{
std::bitset<6> aBitSet;
for (unsigned char i = 0; i < 6; ++i)
{
std::bitset<6>::reference aFlag = aBitSet[get (i)];
if (aFlag)
{
return true;
}
aFlag = true;
}
return false;
}
// =======================================================================
// function : HasOverflows
// purpose :
// =======================================================================
bool Graphic3d_CubeMapOrder::HasOverflows() const
{
return myHasOverflows;
}
// =======================================================================
// function : IsValid
// purpose :
// =======================================================================
bool Graphic3d_CubeMapOrder::IsValid() const
{
return !HasRepetitions() && !HasOverflows();
}
// =======================================================================
// function : get
// purpose :
// =======================================================================
unsigned char Graphic3d_CubeMapOrder::get (unsigned char theCubeMapSide) const
{
return (myConvolution / (1 << (theCubeMapSide * 3))) % (1 << 3);
}
// =======================================================================
// function : set
// purpose :
// =======================================================================
void Graphic3d_CubeMapOrder::set (unsigned char theCubeMapSide, unsigned char theValue)
{
unsigned int aValuePlace = 1 << (theCubeMapSide * 3);
myConvolution -= aValuePlace * get (theCubeMapSide);
myConvolution += aValuePlace * theValue;
}
// =======================================================================
// function : set
// purpose :
// =======================================================================
void Graphic3d_CubeMapOrder::set (Graphic3d_CubeMapSide theCubeMapSide, unsigned char theValue)
{
set (static_cast<unsigned char> (theCubeMapSide), theValue);
}
// =======================================================================
// function : Default
// purpose :
// =======================================================================
const Graphic3d_ValidatedCubeMapOrder& Graphic3d_CubeMapOrder::Default()
{
static const Graphic3d_ValidatedCubeMapOrder aCubeMapOrder = Graphic3d_CubeMapOrder().SetDefault().Validated();
return aCubeMapOrder;
}

View File

@@ -0,0 +1,158 @@
// Author: Ilya Khramov
// 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 _Graphic3d_CubeMapOrder_HeaderFile
#define _Graphic3d_CubeMapOrder_HeaderFile
#include <Graphic3d_CubeMapSide.hxx>
#include <Standard_Macro.hxx>
class Graphic3d_ValidatedCubeMapOrder;
//! Graphic3d_CubeMapOrder maps sides of cubemap on tiles in packed cubemap image
//! to support different tiles order in such images.
//! Also it can be considered as permutation of numbers from 0 to 5.
//! It stores permutation in one integer as convolution.
class Graphic3d_CubeMapOrder
{
public:
//! Default constructor.
//! Creates empty order with zero convolution.
Standard_EXPORT Graphic3d_CubeMapOrder();
//! Initializes order with values.
Standard_EXPORT Graphic3d_CubeMapOrder (unsigned char thePosXLocation,
unsigned char theNegXLocation,
unsigned char thePosYLocation,
unsigned char theNegYLocation,
unsigned char thePosZLocation,
unsigned char theNegZLocation);
//! Creates Graphic3d_CubeMapOrder using Graphic3d_ValidatedCubeMapOrder.
Standard_EXPORT Graphic3d_CubeMapOrder (const Graphic3d_ValidatedCubeMapOrder theOrder);
//! Alias of 'operator='.
Standard_EXPORT Graphic3d_CubeMapOrder& Set (const Graphic3d_CubeMapOrder& theOrder);
//! Checks whether order is valid and returns object containing it.
//! If order is invalid then exception will be thrown.
//! This method is only way to create Graphic3d_ValidatedCubeMapOrder except copy constructor.
Standard_EXPORT Graphic3d_ValidatedCubeMapOrder Validated() const;
public:
//! Sets number of tile in packed cubemap image according passed cubemap side.
Standard_EXPORT Graphic3d_CubeMapOrder& Set (Graphic3d_CubeMapSide theCubeMapSide, unsigned char theValue);
//! Sets default order (just from 0 to 5)
Standard_EXPORT Graphic3d_CubeMapOrder& SetDefault();
//! Applies another cubemap order as permutation for the current one.
Standard_EXPORT Graphic3d_CubeMapOrder& Permute (Graphic3d_ValidatedCubeMapOrder anOrder);
//! Returns permuted by other cubemap order copy of current one.
Standard_EXPORT Graphic3d_CubeMapOrder Permuted (Graphic3d_ValidatedCubeMapOrder anOrder) const;
//! Swaps values of two cubemap sides.
Standard_EXPORT Graphic3d_CubeMapOrder& Swap (Graphic3d_CubeMapSide theFirstSide,
Graphic3d_CubeMapSide theSecondSide);
//! Returns copy of current order with swapped values of two cubemap sides.
Standard_EXPORT Graphic3d_CubeMapOrder Swapped (Graphic3d_CubeMapSide theFirstSide,
Graphic3d_CubeMapSide theSecondSide) const;
//! Returns value of passed cubemap side.
Standard_EXPORT unsigned char Get (Graphic3d_CubeMapSide theCubeMapSide) const;
//! Alias of 'Get'.
Standard_EXPORT unsigned char operator[] (Graphic3d_CubeMapSide theCubeMapSide) const;
//! Makes order empty.
Standard_EXPORT Graphic3d_CubeMapOrder& Clear();
//! Checks whether order is empty.
Standard_EXPORT bool IsEmpty() const;
//! Checks whether order has repetitions.
Standard_EXPORT bool HasRepetitions() const;
//! Checks whether attempts to assign index greater than 5 to any side happed.
Standard_EXPORT bool HasOverflows() const;
//! Checks whether order is valid.
//! Order is valid when it doesn't have repetitions
//! and there were not attempts to assign indexes greater than 5.
Standard_EXPORT bool IsValid() const;
public:
//! Returns default order in protector container class.
//! It is guaranteed to be valid.
Standard_EXPORT static const Graphic3d_ValidatedCubeMapOrder& Default();
private:
//! Alias of 'Get' with other parameter's type for more handful iteration.
unsigned char get (unsigned char theCubeMapSide) const;
//! Alias of 'set' with other parameter's type for more handful iteration and applying permutations.
void set (unsigned char theCubeMapSide, unsigned char theValue);
//! 'Set' without overflow's checking.
void set (Graphic3d_CubeMapSide theCubeMapSide, unsigned char theValue);
private:
unsigned int myConvolution; //!< Contains all values of permutation as power convolution
bool myHasOverflows; //!< Indicates if there are attempts to assign index greater than 5
};
//! Graphic3d_ValidatedCubeMapOrder contains completely valid order object.
//! The only way to create this class except copy constructor is 'Validated' method of Graphic3d_CubeMapOrder.
//! This class can initialize Graphic3d_CubeMapOrder.
//! It is supposed to be used in case of necessity of completely valid order (in function argument as example).
//! It helps to automate order's valid checks.
class Graphic3d_ValidatedCubeMapOrder
{
public:
friend class Graphic3d_CubeMapOrder;
//! Allows skip access to 'Order' field and work directly.
const Graphic3d_CubeMapOrder* operator->() const
{
return &Order;
}
public:
const Graphic3d_CubeMapOrder Order; //!< Completely valid order
private:
//! Only Graphic3d_CubeMapOrder can generate Graphic3d_ValidatedCubeMapOrder in 'Validated' method.
Graphic3d_ValidatedCubeMapOrder(const Graphic3d_CubeMapOrder theOrder)
:
Order(theOrder)
{}
//! Deleted 'operator='
Graphic3d_ValidatedCubeMapOrder& operator= (const Graphic3d_ValidatedCubeMapOrder&);
};
#endif // _Graphic3d_CubeMapOrder_HeaderFile

View File

@@ -0,0 +1,196 @@
// Author: Ilya Khramov
// 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.
#include <Graphic3d_CubeMapPacked.hxx>
#include <Image_AlienPixMap.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CubeMapPacked, Graphic3d_CubeMap)
// =======================================================================
// function : Graphic3d_CubeMapPacked
// purpose :
// =======================================================================
Graphic3d_CubeMapPacked::Graphic3d_CubeMapPacked (const TCollection_AsciiString& theFilePath,
const Graphic3d_ValidatedCubeMapOrder theOrder)
:
Graphic3d_CubeMap (theFilePath),
myOrder (theOrder),
myTileNumberX (1)
{}
// =======================================================================
// function : Graphic3d_CubeMapPacked
// purpose :
// =======================================================================
Graphic3d_CubeMapPacked::Graphic3d_CubeMapPacked (const Handle(Image_PixMap)& theImage,
const Graphic3d_ValidatedCubeMapOrder theOrder)
:
Graphic3d_CubeMap (Handle(Image_PixMap)()),
myOrder (theOrder),
myTileNumberX (1)
{
if (checkImage (theImage, myTileNumberX))
{
myPixMap = theImage;
}
}
// =======================================================================
// function : Value
// purpose :
// =======================================================================
Handle(Image_PixMap) Graphic3d_CubeMapPacked::Value()
{
if (myTileNumberX != 0)
{
if (myPixMap.IsNull())
{
TCollection_AsciiString aFilePath;
myPath.SystemName (aFilePath);
if (!aFilePath.IsEmpty())
{
tryLoadImage (aFilePath);
}
}
if (!myPixMap.IsNull())
{
Handle(Image_PixMap) aWrapper = new Image_PixMap();
Standard_Size aTileSize = myPixMap->SizeX() / myTileNumberX;
myIsTopDown = myPixMap->IsTopDown();
Graphic3d_CubeMapOrder anOrder = myOrder;
if (!myIsTopDown)
{
myPixMap->SetTopDown (true);
anOrder.Swap (Graphic3d_CMS_POS_Y, Graphic3d_CMS_NEG_Y);
}
unsigned int aTileIndexX = anOrder[myCurrentSide] % myTileNumberX;
unsigned int aTileIndexY = anOrder[myCurrentSide] / myTileNumberX;
aTileIndexY = myIsTopDown ? aTileIndexY : (6 / myTileNumberX - 1 - aTileIndexY);
if (aWrapper->InitWrapper (myPixMap->Format(),
myPixMap->ChangeRawValue(aTileIndexY * aTileSize, aTileIndexX * aTileSize),
aTileSize,
aTileSize,
myPixMap->SizeRowBytes()))
{
myPixMap->SetTopDown (myIsTopDown);
return aWrapper;
}
else
{
myPixMap->SetTopDown(myIsTopDown);
}
}
}
return Handle(Image_PixMap)();
}
// =======================================================================
// function : checkOrder
// purpose :
// =======================================================================
Standard_Boolean Graphic3d_CubeMapPacked::checkOrder (const NCollection_Array1<unsigned int>& theOrder)
{
Standard_Boolean anOrderIsValid = Standard_True;
if (theOrder.Size() != 6)
{
anOrderIsValid = Standard_False;
}
else
{
for (unsigned int i = 0; i < 6 && anOrderIsValid; ++i)
{
if (theOrder[i] > 5)
{
anOrderIsValid = Standard_False;
break;
}
for (unsigned int j = i + 1; j < 6; ++j)
{
if (theOrder[i] == theOrder[j])
{
anOrderIsValid = Standard_False;
break;
}
}
}
}
if (!anOrderIsValid)
{
throw Standard_Failure ("Ivalid order format in tiles of Graphic3d_CubeMapPacked");
}
return anOrderIsValid;
}
// =======================================================================
// function : checkImage
// purpose :
// =======================================================================
Standard_Boolean Graphic3d_CubeMapPacked::checkImage (const Handle(Image_PixMap)& theImage,
unsigned int& theTileNumberX)
{
Standard_Size aSizeX = theImage->SizeX();
Standard_Size aSizeY = theImage->SizeY();
if ((aSizeY % aSizeX == 0) && (aSizeY / aSizeX == 6))
{
theTileNumberX = 1;
}
else if ((aSizeX % aSizeY == 0) && (aSizeX / aSizeY == 6))
{
theTileNumberX = 6;
}
else if ((aSizeX % 2 == 0) && (aSizeY % 3 == 0) && (aSizeX / 2 == aSizeY / 3))
{
theTileNumberX = 2;
}
else if ((aSizeX % 3 == 0) && (aSizeY % 2 == 0) && (aSizeX / 3 == aSizeY / 2))
{
theTileNumberX = 3;
}
else
{
return Standard_False;
}
return Standard_True;
}
// =======================================================================
// function : tryLoadImage
// purpose :
// =======================================================================
void Graphic3d_CubeMapPacked::tryLoadImage (const TCollection_AsciiString& theFilePath)
{
Handle(Image_AlienPixMap) anImage = new Image_AlienPixMap;
if (anImage->Load (theFilePath))
{
if (checkImage (anImage, myTileNumberX))
{
myPixMap = anImage;
}
}
}

View File

@@ -0,0 +1,71 @@
// Author: Ilya Khramov
// 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 _Graphic3d_CubeMapPacked_HeaderFile
#define _Graphic3d_CubeMapPacked_HeaderFile
#include <Graphic3d_CubeMap.hxx>
#include <NCollection_Array1.hxx>
#include <OSD_Path.hxx>
//! Class is intended to process cubemap packed into single image plane.
class Graphic3d_CubeMapPacked : public Graphic3d_CubeMap
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_CubeMapPacked, Graphic3d_CubeMap)
public:
//! Initialization to load cubemef from file.
//! @theFileName - path to the cubemap image
//! @theOrder - array conaining six different indexes of cubemap sides which maps tile grid to cubemap sides
Standard_EXPORT Graphic3d_CubeMapPacked (const TCollection_AsciiString& theFileName,
const Graphic3d_ValidatedCubeMapOrder theOrder = Graphic3d_CubeMapOrder::Default());
//! Initialization to set cubemap directly by PixMap.
//! @thePixMap - origin PixMap
//! @theOrder - array conaining six different indexes of cubemap sides which maps tile grid to cubemap sides
Standard_EXPORT Graphic3d_CubeMapPacked (const Handle(Image_PixMap)& theImage,
const Graphic3d_ValidatedCubeMapOrder theOrder = Graphic3d_CubeMapOrder::Default());
//! Returns current cubemap side as PixMap.
//! Resulting PixMap is memory wrapper over original image.
//! Returns null handle if current side or whole cubemap is invalid.
//! Origin image has to contain six quad tiles having one sizes without any gaps to be valid.
Standard_EXPORT Handle(Image_PixMap) Value() Standard_OVERRIDE;
//! Empty destructor.
~Graphic3d_CubeMapPacked() {}
private:
//! Checks whether given tiles order is valid.
static Standard_Boolean checkOrder (const NCollection_Array1<unsigned int>& theOrder);
//! Checks whether given pixmap is valid to contain six tiles.
static Standard_Boolean checkImage (const Handle(Image_PixMap)& theImage,
unsigned int& theTileNumberX);
//! Tries to load image from file and checks it after that.
//! Does nothing in case of fail.
void tryLoadImage (const TCollection_AsciiString &theFilePath);
protected:
Graphic3d_CubeMapOrder myOrder; //!< order mapping tile grit to cubemap sides
unsigned int myTileNumberX; //!< width of tile grid
};
DEFINE_STANDARD_HANDLE(Graphic3d_CubeMapPacked, Graphic3d_CubeMap)
#endif // _Graphic3d_CubeMapPacked_HeaderFile

View File

@@ -0,0 +1,185 @@
// Author: Ilya Khramov
// 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.
#include <Graphic3d_CubeMapSeparate.hxx>
#include <Image_AlienPixMap.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <OSD_File.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CubeMapSeparate, Graphic3d_CubeMap)
// =======================================================================
// function : Graphic3d_CubeMapSeparate
// purpose :
// =======================================================================
Graphic3d_CubeMapSeparate::Graphic3d_CubeMapSeparate (const NCollection_Array1<TCollection_AsciiString>& thePaths)
{
if (thePaths.Size() == 6)
{
for (unsigned int i = 0; i < 6; ++i)
{
myPaths[i] = thePaths[i];
}
}
else
{
throw Standard_Failure("Invalid number of paths to load Graphic3d_CubeMapSeparate");
}
}
// =======================================================================
// function : Graphic3d_CubeMapSeparate
// purpose :
// =======================================================================
Graphic3d_CubeMapSeparate::Graphic3d_CubeMapSeparate (const NCollection_Array1<Handle(Image_PixMap)>& theImages)
{
if (theImages.Size() == 6)
{
if (theImages[0].IsNull())
{
return;
}
if (theImages[0]->SizeX() != theImages[0]->SizeY())
{
return;
}
myImages[0] = theImages[0];
myIsTopDown = myImages[0]->IsTopDown();
for (unsigned int i = 1; i < 6; ++i)
{
if (!theImages[i].IsNull())
{
if (theImages[i]->SizeX() == myImages[0]->SizeX()
&& theImages[i]->SizeY() == myImages[0]->SizeY()
&& theImages[i]->Format() == myImages[0]->Format()
&& theImages[i]->IsTopDown() == myImages[0]->IsTopDown())
{
myImages[i] = theImages[i];
continue;
}
}
resetImages();
return;
}
}
else
{
throw Standard_Failure("Invalid number of images in Graphic3d_CubeMapSeparate initialization");
}
}
// =======================================================================
// function : Value
// purpose :
// =======================================================================
Handle(Image_PixMap) Graphic3d_CubeMapSeparate::Value()
{
Graphic3d_CubeMapOrder anOrder = Graphic3d_CubeMapOrder::Default();
if (!myIsTopDown)
{
anOrder.Swap(Graphic3d_CMS_POS_Y, Graphic3d_CMS_NEG_Y);
}
if (!myImages[anOrder[myCurrentSide]].IsNull())
{
return myImages[anOrder[myCurrentSide]];
}
else
{
TCollection_AsciiString aFilePath;
myPaths[anOrder[myCurrentSide]].SystemName(aFilePath);
if (!aFilePath.IsEmpty())
{
Handle(Image_AlienPixMap) anImage = new Image_AlienPixMap;
if (anImage->Load(aFilePath))
{
if (anImage->SizeX() == anImage->SizeY())
{
if (myCurrentSide == 0)
{
mySize = anImage->SizeX();
myFormat = anImage->Format();
myIsTopDown = anImage->IsTopDown();
return anImage;
}
else
{
if (anImage->Format() == myFormat
&& anImage->SizeX() == mySize
&& anImage->IsTopDown() == myIsTopDown)
{
return anImage;
}
else
{
Message::DefaultMessenger()->Send(TCollection_AsciiString() +
"'" + aFilePath + "' inconsistent image format or dimension in Graphic3d_CubeMapSeparate");
}
}
}
}
else
{
Message::DefaultMessenger()->Send(TCollection_AsciiString() +
"Unable to load '" + aFilePath + "' image of Graphic3d_CubeMapSeparate");
}
}
else
{
Message::DefaultMessenger()->Send(TCollection_AsciiString() +
"[" + myCurrentSide + "] path of Graphic3d_CubeMapSeparate is invalid");
}
}
return Handle(Image_PixMap)();
}
// =======================================================================
// function : IsDone
// purpose :
// =======================================================================
Standard_Boolean Graphic3d_CubeMapSeparate::IsDone() const
{
if (!myImages[0].IsNull())
{
return Standard_True;
}
for (unsigned int i = 0; i < 6; ++i)
{
OSD_File aCubeMapFile(myPaths[i]);
if (!aCubeMapFile.Exists())
{
return Standard_False;
}
}
return Standard_True;
}
// =======================================================================
// function : resetImages
// purpose :
// =======================================================================
void Graphic3d_CubeMapSeparate::resetImages()
{
for (unsigned int i = 0; i < 6; ++i)
{
myImages[i].Nullify();
}
}

View File

@@ -0,0 +1,71 @@
// Author: Ilya Khramov
// 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 _Graphic3d_CubeMapSeparate_HeaderFile
#define _Graphic3d_CubeMapSeparate_HeaderFile
#include <Graphic3d_CubeMap.hxx>
#include <NCollection_Array1.hxx>
#include <OSD_Path.hxx>
//! Class to manage cubemap located in six different images.
class Graphic3d_CubeMapSeparate : public Graphic3d_CubeMap
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_CubeMapSeparate, Graphic3d_CubeMap)
public:
//! Initializes cubemap to be loaded from file.
//! @thePaths - array of paths to separate image files (has to have size equal 6).
Standard_EXPORT Graphic3d_CubeMapSeparate (const NCollection_Array1<TCollection_AsciiString>& thePaths);
//! Initializes cubemap to be setted directly from PixMaps.
//! @theImages - array if PixMaps (has to have size equal 6).
Standard_EXPORT Graphic3d_CubeMapSeparate(const NCollection_Array1<Handle(Image_PixMap)>& theImages);
//! Returns current side of cubemap as PixMap.
//! Returns null handle if current side or whole cubemap is invalid.
//! All origin images have to have the same sizes, format and quad shapes to form valid cubemap.
Standard_EXPORT Handle(Image_PixMap) Value() Standard_OVERRIDE;
//! Returns NULL.
virtual Handle(Image_PixMap) GetImage() const Standard_OVERRIDE
{
return Handle(Image_PixMap)();
}
//! Checks if a texture class is valid or not.
//! Returns true if the construction of the class is correct.
Standard_EXPORT Standard_Boolean IsDone() const Standard_OVERRIDE;
//! Empty destructor.
~Graphic3d_CubeMapSeparate() {}
protected:
OSD_Path myPaths[6]; //!< array of paths to cubemap images
Handle(Image_PixMap) myImages[6]; //!< array of cubemap images
Standard_Size mySize; //!< size of each side of cubemap
Image_Format myFormat; //!< format each side of cubemap
private:
//! Nulifies whole images array.
void resetImages();
};
DEFINE_STANDARD_HANDLE(Graphic3d_CubeMapSeparate, Graphic3d_CubeMap)
#endif // _Graphic3d_CubeMapSeparate_HeaderFile

View File

@@ -0,0 +1,29 @@
// Author: Ilya Khramov
// 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 _Graphic3d_CubeMapSide_HeaderFile
#define _Graphic3d_CubeMapSide_HeaderFile
//! Sides of cubemap in order of OpenGL rules
enum Graphic3d_CubeMapSide
{
Graphic3d_CMS_POS_X, //!< X axis positive direction side
Graphic3d_CMS_NEG_X, //!< X axis negative direction side
Graphic3d_CMS_POS_Y, //!< Y axis positive direction side
Graphic3d_CMS_NEG_Y, //!< Y axis negative direction side
Graphic3d_CMS_POS_Z, //!< Z axis positive direction side
Graphic3d_CMS_NEG_Z, //!< Z axis negative direction side
};
#endif // _Graphic3d_CubeMapSide_HeaderFile

View File

@@ -29,6 +29,7 @@
#include <Graphic3d_Structure.hxx>
#include "Graphic3d_Structure.pxx"
#include <Graphic3d_StructureManager.hxx>
#include <Graphic3d_Text.hxx>
#include <Graphic3d_TextureMap.hxx>
#include <Graphic3d_TransModeFlags.hxx>
#include <Message.hxx>
@@ -310,31 +311,21 @@ void Graphic3d_Group::Marker (const Graphic3d_Vertex& thePoint,
// function : Text
// purpose :
// =======================================================================
void Graphic3d_Group::Text (const Standard_CString /*theText*/,
void Graphic3d_Group::Text (const Standard_CString theText,
const Graphic3d_Vertex& thePoint,
const Standard_Real /*theHeight*/,
const Standard_Real theHeight,
const Standard_Real /*theAngle*/,
const Graphic3d_TextPath /*theTp*/,
const Graphic3d_HorizontalTextAlignment /*theHta*/,
const Graphic3d_VerticalTextAlignment /*theVta*/,
const Graphic3d_HorizontalTextAlignment theHta,
const Graphic3d_VerticalTextAlignment theVta,
const Standard_Boolean theToEvalMinMax)
{
if (IsDeleted())
{
return;
}
if (theToEvalMinMax)
{
Standard_ShortReal x, y, z;
thePoint.Coord (x, y, z);
myStructure->CStructure()->Is2dText = Standard_True;
myBounds.Add (Graphic3d_Vec4 (static_cast<Standard_ShortReal> (x),
static_cast<Standard_ShortReal> (y),
static_cast<Standard_ShortReal> (z),
1.0f));
}
Update();
Handle(Graphic3d_Text) aText = new Graphic3d_Text ((Standard_ShortReal)theHeight);
aText->SetText (theText);
aText->SetPosition (gp_Pnt (thePoint.X(), thePoint.Y(), thePoint.Z()));
aText->SetHorizontalAlignment (theHta);
aText->SetVerticalAlignment (theVta);
AddText (aText, theToEvalMinMax);
}
// =======================================================================
@@ -346,8 +337,10 @@ void Graphic3d_Group::Text (const Standard_CString theText,
const Standard_Real theHeight,
const Standard_Boolean theToEvalMinMax)
{
Text (theText, thePoint, theHeight, 0.0,
Graphic3d_TP_RIGHT, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM, theToEvalMinMax);
Handle(Graphic3d_Text) aText = new Graphic3d_Text ((Standard_ShortReal)theHeight);
aText->SetText (theText);
aText->SetPosition (gp_Pnt (thePoint.X(), thePoint.Y(), thePoint.Z()));
AddText (aText, theToEvalMinMax);
}
// =======================================================================
@@ -357,15 +350,18 @@ void Graphic3d_Group::Text (const Standard_CString theText,
void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
const Graphic3d_Vertex& thePoint,
const Standard_Real theHeight,
const Standard_Real theAngle,
const Graphic3d_TextPath theTp,
const Standard_Real /*theAngle*/,
const Graphic3d_TextPath /*theTp*/,
const Graphic3d_HorizontalTextAlignment theHta,
const Graphic3d_VerticalTextAlignment theVta,
const Standard_Boolean theToEvalMinMax)
{
const NCollection_String aText (theText.ToExtString());
Text (aText.ToCString(), thePoint, theHeight, theAngle,
theTp, theHta, theVta, theToEvalMinMax);
Handle(Graphic3d_Text) aText = new Graphic3d_Text ((Standard_ShortReal)theHeight);
aText->SetText (theText.ToExtString());
aText->SetPosition (gp_Pnt (thePoint.X(), thePoint.Y(), thePoint.Z()));
aText->SetHorizontalAlignment (theHta);
aText->SetVerticalAlignment (theVta);
AddText (aText, theToEvalMinMax);
}
// =======================================================================
@@ -375,53 +371,43 @@ void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
const gp_Ax2& theOrientation,
const Standard_Real theHeight,
const Standard_Real theAngle,
const Graphic3d_TextPath theTP,
const Graphic3d_HorizontalTextAlignment theHTA,
const Graphic3d_VerticalTextAlignment theVTA,
const Standard_Real /*theAngle*/,
const Graphic3d_TextPath /*theTP*/,
const Graphic3d_HorizontalTextAlignment theHta,
const Graphic3d_VerticalTextAlignment theVta,
const Standard_Boolean theToEvalMinMax,
const Standard_Boolean theHasOwnAnchor)
{
const NCollection_String aText (theText.ToExtString());
Text (aText.ToCString(),
theOrientation,
theHeight,
theAngle,
theTP,
theHTA,
theVTA,
theToEvalMinMax,
theHasOwnAnchor);
Handle(Graphic3d_Text) aText = new Graphic3d_Text ((Standard_ShortReal)theHeight);
aText->SetText (theText.ToExtString());
aText->SetOrientation (theOrientation);
aText->SetOwnAnchorPoint (theHasOwnAnchor);
aText->SetHorizontalAlignment (theHta);
aText->SetVerticalAlignment (theVta);
AddText (aText, theToEvalMinMax);
}
// =======================================================================
// function : Text
// purpose :
// =======================================================================
void Graphic3d_Group::Text (const Standard_CString /*theText*/,
void Graphic3d_Group::Text (const Standard_CString theText,
const gp_Ax2& theOrientation,
const Standard_Real /*theHeight*/,
const Standard_Real theHeight,
const Standard_Real /*theAngle*/,
const Graphic3d_TextPath /*theTp*/,
const Graphic3d_HorizontalTextAlignment /*theHta*/,
const Graphic3d_VerticalTextAlignment /*theVta*/,
const Graphic3d_HorizontalTextAlignment theHta,
const Graphic3d_VerticalTextAlignment theVta,
const Standard_Boolean theToEvalMinMax,
const Standard_Boolean /*theHasOwnAnchor*/)
const Standard_Boolean theHasOwnAnchor)
{
if (IsDeleted())
{
return;
}
if (theToEvalMinMax)
{
myStructure->CStructure()->Is2dText = Standard_False;
myBounds.Add (Graphic3d_Vec4 (static_cast<Standard_ShortReal> (theOrientation.Location().X()),
static_cast<Standard_ShortReal> (theOrientation.Location().Y()),
static_cast<Standard_ShortReal> (theOrientation.Location().Z()),
1.0f));
}
Update();
Handle(Graphic3d_Text) aText = new Graphic3d_Text ((Standard_ShortReal)theHeight);
aText->SetText (theText);
aText->SetOrientation (theOrientation);
aText->SetOwnAnchorPoint (theHasOwnAnchor);
aText->SetHorizontalAlignment (theHta);
aText->SetVerticalAlignment (theVta);
AddText (aText, theToEvalMinMax);
}
// =======================================================================
@@ -433,7 +419,31 @@ void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
const Standard_Real theHeight,
const Standard_Boolean theToEvalMinMax)
{
const NCollection_String aText (theText.ToExtString());
Text (aText.ToCString(), thePoint, theHeight, 0.0,
Graphic3d_TP_RIGHT, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM, theToEvalMinMax);
Handle(Graphic3d_Text) aText = new Graphic3d_Text ((Standard_ShortReal)theHeight);
aText->SetText (theText.ToExtString());
aText->SetPosition (gp_Pnt (thePoint.X(), thePoint.Y(), thePoint.Z()));
AddText (aText, theToEvalMinMax);
}
// =======================================================================
// function : AddText
// purpose :
// =======================================================================
void Graphic3d_Group::AddText (const Handle(Graphic3d_Text)& theTextParams,
const Standard_Boolean theToEvalMinMax)
{
if (IsDeleted())
{
return;
}
if (theToEvalMinMax)
{
myStructure->CStructure()->Is2dText = !theTextParams->HasPlane();
gp_Pnt aPosition = theTextParams->Position();
myBounds.Add (Graphic3d_Vec4 ((Standard_ShortReal)aPosition.X(), (Standard_ShortReal)aPosition.Y(), (Standard_ShortReal)aPosition.Z(), 1.0f));
}
Update();
}

View File

@@ -37,7 +37,7 @@
class Graphic3d_Structure;
class Graphic3d_ArrayOfPrimitives;
class Graphic3d_AspectFillCapping;
class Graphic3d_Text;
//! This class allows the definition of groups
//! of primitives inside of graphic objects (presentations).
@@ -105,96 +105,22 @@ public:
//! Modifies the current context of the group to give another aspect for all the primitives created after this call in the group.
virtual void SetPrimitivesAspect (const Handle(Graphic3d_Aspects)& theAspect) = 0;
//! Returns style of filling clipping sections on closed shell primitives.
virtual Handle(Graphic3d_AspectFillCapping) FillCappingAspect() const = 0;
//! Update presentation aspects after their modification.
virtual void SynchronizeAspects() = 0;
//! Replace aspects specified in the replacement map.
virtual void ReplaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap) = 0;
public:
//! Creates the string <AText> at position <APoint>.
//! The 3D point of attachment is projected. The text is
//! written in the plane of projection.
//! The attributes are given with respect to the plane of
//! projection.
//! AHeight : Height of text.
//! (Relative to the Normalized Projection
//! Coordinates (NPC) Space).
//! AAngle : Orientation of the text
//! (with respect to the horizontal).
Standard_EXPORT virtual void Text (const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Real AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
//! Creates the string <AText> at position <APoint>.
//! The 3D point of attachment is projected. The text is
//! written in the plane of projection.
//! The attributes are given with respect to the plane of
//! projection.
//! AHeight : Height of text.
//! (Relative to the Normalized Projection
//! Coordinates (NPC) Space).
//! The other attributes have the following default values:
//! AAngle : PI / 2.
//! ATp : TP_RIGHT
//! AHta : HTA_LEFT
//! AVta : VTA_BOTTOM
Standard_EXPORT void Text (const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True);
//! Creates the string <AText> at position <APoint>.
//! The 3D point of attachment is projected. The text is
//! written in the plane of projection.
//! The attributes are given with respect to the plane of
//! projection.
//! AHeight : Height of text.
//! (Relative to the Normalized Projection
//! Coordinates (NPC) Space).
//! AAngle : Orientation of the text
//! (with respect to the horizontal).
Standard_EXPORT void Text (const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Real AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
//! Creates the string <AText> at position <APoint>.
//! The 3D point of attachment is projected. The text is
//! written in the plane of projection.
//! The attributes are given with respect to the plane of
//! projection.
//! AHeight : Height of text.
//! (Relative to the Normalized Projection
//! Coordinates (NPC) Space).
//! The other attributes have the following default values:
//! AAngle : PI / 2.
//! ATp : TP_RIGHT
//! AHta : HTA_LEFT
//! AVta : VTA_BOTTOM
Standard_EXPORT void Text (const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True);
//! Creates the string <theText> at orientation <theOrientation> in 3D space.
Standard_EXPORT virtual void Text (const Standard_CString theTextUtf,
const gp_Ax2& theOrientation,
const Standard_Real theHeight,
const Standard_Real theAngle,
const Graphic3d_TextPath theTp,
const Graphic3d_HorizontalTextAlignment theHTA,
const Graphic3d_VerticalTextAlignment theVTA,
const Standard_Boolean theToEvalMinMax = Standard_True,
const Standard_Boolean theHasOwnAnchor = Standard_True);
//! Creates the string <theText> at orientation <theOrientation> in 3D space.
Standard_EXPORT virtual void Text (const TCollection_ExtendedString& theText,
const gp_Ax2& theOrientation,
const Standard_Real theHeight,
const Standard_Real theAngle,
const Graphic3d_TextPath theTp,
const Graphic3d_HorizontalTextAlignment theHTA,
const Graphic3d_VerticalTextAlignment theVTA,
const Standard_Boolean theToEvalMinMax = Standard_True,
const Standard_Boolean theHasOwnAnchor = Standard_True);
//! Adds a text for display
Standard_EXPORT virtual void AddText (const Handle(Graphic3d_Text)& theTextParams,
const Standard_Boolean theToEvalMinMax = Standard_True);
//! Adds an array of primitives for display
Standard_EXPORT virtual void AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theType, const Handle(Graphic3d_IndexBuffer)& theIndices, const Handle(Graphic3d_Buffer)& theAttribs, const Handle(Graphic3d_BoundBuffer)& theBounds, const Standard_Boolean theToEvalMinMax = Standard_True);
Standard_EXPORT virtual void AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theType,
const Handle(Graphic3d_IndexBuffer)& theIndices,
const Handle(Graphic3d_Buffer)& theAttribs,
const Handle(Graphic3d_BoundBuffer)& theBounds,
const Standard_Boolean theToEvalMinMax = Standard_True);
//! Adds an array of primitives for display
Standard_EXPORT void AddPrimitiveArray (const Handle(Graphic3d_ArrayOfPrimitives)& thePrim, const Standard_Boolean theToEvalMinMax = Standard_True);
@@ -244,6 +170,112 @@ public:
//! Return true if primitive arrays within this graphic group form closed volume (do no contain open shells).
bool IsClosed() const { return myIsClosed; }
//! @name obsolete methods
public:
//! Creates the string <AText> at position <APoint>.
//! The 3D point of attachment is projected. The text is
//! written in the plane of projection.
//! The attributes are given with respect to the plane of
//! projection.
//! AHeight : Height of text.
//! (Relative to the Normalized Projection
//! Coordinates (NPC) Space).
//! AAngle : Orientation of the text
//! (with respect to the horizontal).
Standard_DEPRECATED("Deprecated method Text() with obsolete arguments, use AddText() instead of it")
Standard_EXPORT virtual void Text (const Standard_CString AText,
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Standard_Real AAngle,
const Graphic3d_TextPath ATp,
const Graphic3d_HorizontalTextAlignment AHta,
const Graphic3d_VerticalTextAlignment AVta,
const Standard_Boolean EvalMinMax = Standard_True);
//! Creates the string <AText> at position <APoint>.
//! The 3D point of attachment is projected. The text is
//! written in the plane of projection.
//! The attributes are given with respect to the plane of
//! projection.
//! AHeight : Height of text.
//! (Relative to the Normalized Projection
//! Coordinates (NPC) Space).
//! The other attributes have the following default values:
//! AAngle : PI / 2.
//! ATp : TP_RIGHT
//! AHta : HTA_LEFT
//! AVta : VTA_BOTTOM
Standard_DEPRECATED("Deprecated method Text() with obsolete arguments, use AddText() instead of it")
Standard_EXPORT void Text (const Standard_CString AText,
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Standard_Boolean EvalMinMax = Standard_True);
//! Creates the string <AText> at position <APoint>.
//! The 3D point of attachment is projected. The text is
//! written in the plane of projection.
//! The attributes are given with respect to the plane of
//! projection.
//! AHeight : Height of text.
//! (Relative to the Normalized Projection
//! Coordinates (NPC) Space).
//! AAngle : Orientation of the text
//! (with respect to the horizontal).
Standard_DEPRECATED("Deprecated method Text() with obsolete arguments, use AddText() instead of it")
Standard_EXPORT void Text (const TCollection_ExtendedString& AText,
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Standard_Real AAngle,
const Graphic3d_TextPath ATp,
const Graphic3d_HorizontalTextAlignment AHta,
const Graphic3d_VerticalTextAlignment AVta,
const Standard_Boolean EvalMinMax = Standard_True);
//! Creates the string <AText> at position <APoint>.
//! The 3D point of attachment is projected. The text is
//! written in the plane of projection.
//! The attributes are given with respect to the plane of
//! projection.
//! AHeight : Height of text.
//! (Relative to the Normalized Projection
//! Coordinates (NPC) Space).
//! The other attributes have the following default values:
//! AAngle : PI / 2.
//! ATp : TP_RIGHT
//! AHta : HTA_LEFT
//! AVta : VTA_BOTTOM
Standard_DEPRECATED("Deprecated method Text() with obsolete arguments, use AddText() instead of it")
Standard_EXPORT void Text (const TCollection_ExtendedString& AText,
const Graphic3d_Vertex& APoint,
const Standard_Real AHeight,
const Standard_Boolean EvalMinMax = Standard_True);
//! Creates the string <theText> at orientation <theOrientation> in 3D space.
Standard_DEPRECATED("Deprecated method Text() with obsolete arguments, use AddText() instead of it")
Standard_EXPORT virtual void Text (const Standard_CString theTextUtf,
const gp_Ax2& theOrientation,
const Standard_Real theHeight,
const Standard_Real theAngle,
const Graphic3d_TextPath theTp,
const Graphic3d_HorizontalTextAlignment theHTA,
const Graphic3d_VerticalTextAlignment theVTA,
const Standard_Boolean theToEvalMinMax = Standard_True,
const Standard_Boolean theHasOwnAnchor = Standard_True);
//! Creates the string <theText> at orientation <theOrientation> in 3D space.
Standard_DEPRECATED("Deprecated method Text() with obsolete arguments, use AddText() instead of it")
Standard_EXPORT virtual void Text (const TCollection_ExtendedString& theText,
const gp_Ax2& theOrientation,
const Standard_Real theHeight,
const Standard_Real theAngle,
const Graphic3d_TextPath theTp,
const Graphic3d_HorizontalTextAlignment theHTA,
const Graphic3d_VerticalTextAlignment theVTA,
const Standard_Boolean theToEvalMinMax = Standard_True,
const Standard_Boolean theHasOwnAnchor = Standard_True);
protected:
//! Creates a group in the structure <AStructure>.

View File

@@ -21,15 +21,13 @@
//! - ASPECT_LINE: aspect for line primitives;
//! - ASPECT_TEXT: aspect for text primitives;
//! - ASPECT_MARKER: aspect for marker primitives;
//! - ASPECT_FILL_AREA: aspect for face primitives;
//! - Graphic3d_ASPECT_FILL_CAPPING: aspect for filling clipping sections.
//! - ASPECT_FILL_AREA: aspect for face primitives.
enum Graphic3d_GroupAspect
{
Graphic3d_ASPECT_LINE,
Graphic3d_ASPECT_TEXT,
Graphic3d_ASPECT_MARKER,
Graphic3d_ASPECT_FILL_AREA,
Graphic3d_ASPECT_FILL_CAPPING
Graphic3d_ASPECT_FILL_AREA
};
#endif // _Graphic3d_GroupAspect_HeaderFile

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.25f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.24f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.004896f));
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.22f));
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.165f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.40f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.162647f));
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.342392f));
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.170645f));
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);
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));
Shininess = 0.65f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.088428f, 0.041081f, 0.002090f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.570482f, 0.283555f, 0.012335f));
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);
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));
Shininess = 0.65f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.037301f, 0.014931f, 0.004305f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.468185f, 0.153344f, 0.027491f));
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);
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));
Shininess = 0.65f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.030370f, 0.006451f, 0.001780f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.323236f, 0.059254f, 0.007584f));
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);
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));
Shininess = 0.80f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.073239f, 0.043234f, 0.009264f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.525643f, 0.295700f, 0.010023f));
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);
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));
Shininess = 0.50f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.010979f, 0.004795f, 0.012335f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.152583f, 0.188174f, 0.253972f));
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.13f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.75f));
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.003936f));
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);
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));
Shininess = 0.75f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.061465f, 0.061465f, 0.050876f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.354692f, 0.354692f, 0.354692f));
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);
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));
Shininess = 0.90f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.019607f, 0.019607f, 0.027212f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.214041f, 0.223414f, 0.233022f));
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 (0.030074f, 0.020069f, 0.013011f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.522522f, 0.318547f, 0.183064f));
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);
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));
Shininess = 0.90f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.033105f, 0.033105f, 0.041436f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.263273f, 0.263273f, 0.263273f));
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);
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));
Shininess = 0.75f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.073239f, 0.073239f, 0.073239f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.318547f, 0.318547f, 0.318547f));
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.787412f, 0.142892f));
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;
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));
Shininess = 0.3f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.004305f, 0.003936f, 0.005532f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.028053f, 0.024515f, 0.041436f));
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;
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));
Shininess = 0.10f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.016338f, 0.040729f, 0.021493f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.252950f, 0.767769f, 0.354692f));
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.003936f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.019607f));
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;
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));
Shininess = 0.90f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.170645f, 0.170645f, 0.191627f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.003936f, 0.003936f, 0.006571f));
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;
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));
Shininess = 0.50f;
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.263273f, 0.290143f, 0.290143f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.003936f, 0.006571f, 0.006571f));
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.263273f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.010023f));
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.263273f));
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.010023f));
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.6f));
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.15f));
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

@@ -0,0 +1,49 @@
// 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.
#include <Graphic3d_Text.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Text, Standard_Transient)
// =======================================================================
// function : Graphic3d_Text
// purpose :
// =======================================================================
Graphic3d_Text::Graphic3d_Text (const Standard_ShortReal theHeight)
: myHeight (theHeight),
myHAlign (Graphic3d_HTA_LEFT),
myVAlign (Graphic3d_VTA_BOTTOM),
myHasPlane (Standard_False),
myHasOwnAnchor (Standard_True)
{
}
// =======================================================================
// function : SetOrientation
// purpose :
// =======================================================================
void Graphic3d_Text::SetOrientation (const gp_Ax2& theOrientation)
{
myOrientation = theOrientation;
myHasPlane = Standard_True;
}
// =======================================================================
// function : ResetOrientation
// purpose :
// =======================================================================
void Graphic3d_Text::ResetOrientation()
{
myOrientation = gp_Ax2();
myHasPlane = Standard_False;
}

View File

@@ -0,0 +1,115 @@
// 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 _Graphic3d_Text_HeaderFile
#define _Graphic3d_Text_HeaderFile
#include <gp_Ax2.hxx>
#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_HorizontalTextAlignment.hxx>
#include <Graphic3d_VerticalTextAlignment.hxx>
#include <NCollection_String.hxx>
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <TCollection_AsciiString.hxx>
//! This class allows the definition of a text object for display.
//! The text might be defined in one of ways, using:
//! - text value and position,
//! - text value, orientation and the state whether the text uses position as point of attach.
//! - text formatter. Formatter contains text, height and alignment parameter.
//!
//! This class also has parameters of the text height and H/V alignments.
class Graphic3d_Text : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_Text, Standard_Transient)
public:
//! Creates default text parameters.
Standard_EXPORT Graphic3d_Text (const Standard_ShortReal theHeight);
//! Destructor.
virtual ~Graphic3d_Text() {}
//! Returns text value.
const NCollection_String& Text() const { return myText; }
//! Sets text value.
void SetText (const NCollection_String& theText) { myText = theText; }
//! Sets text value.
void SetText (const TCollection_AsciiString& theText) { myText = theText.ToCString(); }
//! Sets text value.
void SetText (Standard_CString theText) { myText = theText; }
//! The 3D point of attachment is projected.
//! If the orientation is defined, the text is written in the plane of projection.
const gp_Pnt& Position() const { return myOrientation.Location(); }
//! Sets text point.
void SetPosition (const gp_Pnt& thePoint) { myOrientation.SetLocation (thePoint); }
//! Returns text orientation in 3D space.
const gp_Ax2& Orientation() const { return myOrientation; }
//! Returns true if the text is filled by a point
Standard_Boolean HasPlane() const { return myHasPlane; }
//! Sets text orientation in 3D space.
Standard_EXPORT void SetOrientation (const gp_Ax2& theOrientation);
//! Reset text orientation in 3D space.
Standard_EXPORT void ResetOrientation();
//! Returns true if the text has an anchor point
Standard_Boolean HasOwnAnchorPoint() const { return myHasOwnAnchor; }
//! Returns true if the text has an anchor point
void SetOwnAnchorPoint (const Standard_Boolean theHasOwnAnchor) { myHasOwnAnchor = theHasOwnAnchor; }
//! Sets height of text. (Relative to the Normalized Projection Coordinates (NPC) Space).
Standard_ShortReal Height() const { return myHeight; }
//! Returns height of text
void SetHeight (const Standard_ShortReal theHeight) { myHeight = theHeight; }
//! Returns horizontal alignment of text.
Graphic3d_HorizontalTextAlignment HorizontalAlignment() const { return myHAlign; }
//! Sets horizontal alignment of text.
void SetHorizontalAlignment (const Graphic3d_HorizontalTextAlignment theJustification) { myHAlign = theJustification; }
//! Returns vertical alignment of text.
Graphic3d_VerticalTextAlignment VerticalAlignment() const { return myVAlign; }
//! Sets vertical alignment of text.
void SetVerticalAlignment (const Graphic3d_VerticalTextAlignment theJustification) { myVAlign = theJustification; }
protected:
NCollection_String myText; //!< text value
gp_Ax2 myOrientation; //!< Text orientation in 3D space.
Standard_ShortReal myHeight; //!< height of text
Graphic3d_HorizontalTextAlignment myHAlign; //!< horizontal alignment
Graphic3d_VerticalTextAlignment myVAlign; //!< vertical alignment
Standard_Boolean myHasPlane; //!< Check if text have orientation in 3D space.
Standard_Boolean myHasOwnAnchor; //!< flag if text uses position as point of attach
};
DEFINE_STANDARD_HANDLE(Graphic3d_Text, Standard_Transient)
#endif // _Graphic3d_Text_HeaderFile

View File

@@ -17,98 +17,63 @@
#ifndef _Graphic3d_TextureMap_HeaderFile
#define _Graphic3d_TextureMap_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Graphic3d_TextureRoot.hxx>
#include <Graphic3d_TypeOfTexture.hxx>
#include <Standard_Boolean.hxx>
#include <Graphic3d_LevelOfTextureAnisotropy.hxx>
class TCollection_AsciiString;
class Graphic3d_TextureMap;
DEFINE_STANDARD_HANDLE(Graphic3d_TextureMap, Graphic3d_TextureRoot)
//! This is an abstract class for managing texture applyable on polygons.
class Graphic3d_TextureMap : public Graphic3d_TextureRoot
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_TextureMap, Graphic3d_TextureRoot)
public:
//! enable texture smoothing
Standard_EXPORT void EnableSmooth();
//! Returns TRUE if the texture is smoothed.
Standard_EXPORT Standard_Boolean IsSmoothed() const;
//! disable texture smoothing
Standard_EXPORT void DisableSmooth();
//! enable texture modulate mode.
//! enable texture modulate mode.
//! the image is modulate with the shading of the surface.
Standard_EXPORT void EnableModulate();
//! disable texture modulate mode.
//! the image is directly decal on the surface.
Standard_EXPORT void DisableModulate();
//! Returns TRUE if the texture is modulate.
Standard_EXPORT Standard_Boolean IsModulate() const;
//! use this methods if you want to enable
//! texture repetition on your objects.
Standard_EXPORT void EnableRepeat();
//! use this methods if you want to disable
//! texture repetition on your objects.
Standard_EXPORT void DisableRepeat();
//! Returns TRUE if the texture repeat is enable.
Standard_EXPORT Standard_Boolean IsRepeat() const;
//! @return level of anisontropy texture filter.
//! @return level of anisotropy texture filter.
//! Default value is Graphic3d_LOTA_OFF.
Standard_EXPORT Graphic3d_LevelOfTextureAnisotropy AnisoFilter() const;
//! @param theLevel level of anisontropy texture filter.
//! @param theLevel level of anisotropy texture filter.
Standard_EXPORT void SetAnisoFilter (const Graphic3d_LevelOfTextureAnisotropy theLevel);
DEFINE_STANDARD_RTTIEXT(Graphic3d_TextureMap,Graphic3d_TextureRoot)
protected:
Standard_EXPORT Graphic3d_TextureMap(const TCollection_AsciiString& theFileName, const Graphic3d_TypeOfTexture theType);
Standard_EXPORT Graphic3d_TextureMap(const Handle(Image_PixMap)& thePixMap, const Graphic3d_TypeOfTexture theType);
private:
};
DEFINE_STANDARD_HANDLE(Graphic3d_TextureMap, Graphic3d_TextureRoot)
#endif // _Graphic3d_TextureMap_HeaderFile

View File

@@ -89,7 +89,8 @@ Graphic3d_TextureRoot::Graphic3d_TextureRoot (const TCollection_AsciiString& the
: myParams (new Graphic3d_TextureParams()),
myPath (theFileName),
myRevision (0),
myType (theType)
myType (theType),
myIsColorMap (true)
{
generateId();
}
@@ -103,7 +104,8 @@ Graphic3d_TextureRoot::Graphic3d_TextureRoot (const Handle(Image_PixMap)& theP
: myParams (new Graphic3d_TextureParams()),
myPixMap (thePixMap),
myRevision (0),
myType (theType)
myType (theType),
myIsColorMap (true)
{
generateId();
}

View File

@@ -91,6 +91,19 @@ public:
//! @return low-level texture parameters
const Handle(Graphic3d_TextureParams)& GetParams() const { return myParams; }
//! Return flag indicating color nature of values within the texture; TRUE by default.
//!
//! This flag will be used to interpret 8-bit per channel RGB(A) images as sRGB(A) textures
//! with implicit linearizion of color components.
//! Has no effect on images with floating point values (always considered linearized).
//!
//! When set to FALSE, such images will be interpreted as textures will be linear component values,
//! which is useful for RGB(A) textures defining non-color properties (like Normalmap/Metalness/Roughness).
Standard_Boolean IsColorMap() const { return myIsColorMap; }
//! Set flag indicating color nature of values within the texture.
void SetColorMap (Standard_Boolean theIsColor) { myIsColorMap = theIsColor; }
protected:
//! Creates a texture from a file
@@ -114,6 +127,7 @@ protected:
OSD_Path myPath; //!< image file path - as one of the ways for defining the texture source
Standard_Size myRevision; //!< image revision - for signaling changes in the texture source (e.g. file update, pixmap update)
Graphic3d_TypeOfTexture myType; //!< texture type
Standard_Boolean myIsColorMap; //!< flag indicating color nature of values within the texture
};

View File

@@ -40,6 +40,8 @@ enum Graphic3d_TextureUnit
//Graphic3d_TextureUnit_MetallicRoughness = Graphic3d_TextureUnit_2, //!< metalness+roughness of the material
//Graphic3d_TextureUnit_Emissive = Graphic3d_TextureUnit_3, //!< emissive map controls the color and intensity of the light being emitted by the material
//Graphic3d_TextureUnit_Occlusion = Graphic3d_TextureUnit_4, //!< occlusion map indicating areas of indirect lighting
Graphic3d_TextureUnit_EnvMap = Graphic3d_TextureUnit_0 //!< environment cubemap for background
};
enum
{

View File

@@ -20,9 +20,15 @@
//! Describes type of view background.
enum Graphic3d_TypeOfBackground
{
Graphic3d_TOB_NONE,
Graphic3d_TOB_NONE = -1,
Graphic3d_TOB_GRADIENT,
Graphic3d_TOB_TEXTURE
Graphic3d_TOB_TEXTURE,
Graphic3d_TOB_CUBEMAP
};
enum
{
Graphic3d_TypeOfBackground_NB = Graphic3d_TOB_CUBEMAP + 1
};
#endif // _Graphic3d_TypeOfBackground_HeaderFile

View File

@@ -29,6 +29,7 @@ enum Graphic3d_TypeOfLimit
Graphic3d_TypeOfLimit_HasRayTracingTextures, //!< indicates whether ray tracing textures are supported
Graphic3d_TypeOfLimit_HasRayTracingAdaptiveSampling, //!< indicates whether adaptive screen sampling is supported
Graphic3d_TypeOfLimit_HasRayTracingAdaptiveSamplingAtomic,//!< indicates whether optimized adaptive screen sampling is supported (hardware supports atomic float operations)
Graphic3d_TypeOfLimit_HasSRGB, //!< indicates whether sRGB rendering is supported
Graphic3d_TypeOfLimit_HasBlendedOit, //!< indicates whether necessary GL extensions for Weighted, Blended OIT available (without MSAA).
Graphic3d_TypeOfLimit_HasBlendedOitMsaa, //!< indicates whether necessary GL extensions for Weighted, Blended OIT available (with MSAA).
Graphic3d_TypeOfLimit_HasFlatShading, //!< indicates whether Flat shading (Graphic3d_TOSM_FACET) is supported

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

@@ -22,7 +22,8 @@ enum Graphic3d_TypeOfTexture
{
Graphic3d_TOT_1D,
Graphic3d_TOT_2D,
Graphic3d_TOT_2D_MIPMAP
Graphic3d_TOT_2D_MIPMAP,
Graphic3d_TOT_CUBEMAP
};
#endif // _Graphic3d_TypeOfTexture_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;
}
}

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