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

Compare commits

...

3 Commits

Author SHA1 Message Date
pdn
d209b3176e 0025262: Foundation Classes - Poly package improvements
Improvements of functionality of Poly package:
* Add function to intersect a triangulation by an axis.
* Add function to intersect a triangle by an axis.
* Correct the bugs in the methods RemoveDegenerated, RemoveTriangle and ReplaceNodes of the class Poly_CoherentTriangulation.
2021-03-19 20:01:58 +03:00
jgv
f0ac52281d 0032140: Modeling Algorithms - unify same domain calls crossed for opposite vectors
1. Correct unification of circular edges: avoid trying to make an axis with null magnitude.
2. New method UnionPCurves: unify existing pcurves of chain instead of projecting the curve of unified edge onto surfaces
2021-03-18 20:04:36 +03:00
kgv
60cbc333da 0032206: Visualization, TKOpenGl - move out OpenGL ES support to dedicated library TKOpenGles
Added TKOpenGles and TKOpenGlesTest toolkits built with HAVE_GLES2 macros.
Added CSF_OpenGlesLibs as alternative to CSF_OpenGlLibs.
2021-03-18 20:01:08 +03:00
48 changed files with 907 additions and 224 deletions

View File

@@ -414,6 +414,14 @@ if (NOT DEFINED BUILD_DOC_Overview)
set (BUILD_DOC_Overview ${CAN_DOXYGEN_BE_USED} CACHE BOOL "${BUILD_DOC_Overview_DESCR}")
endif()
if (ANDROID OR IOS OR EMSCRIPTEN OR "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
list (REMOVE_ITEM Visualization_TOOLKITS TKOpenGl)
list (REMOVE_ITEM Draw_TOOLKITS TKOpenGlTest)
elseif (NOT USE_GLES2)
list (REMOVE_ITEM Visualization_TOOLKITS TKOpenGles)
list (REMOVE_ITEM Draw_TOOLKITS TKOpenGlesTest)
endif()
if (NOT USE_D3D)
list (REMOVE_ITEM Visualization_TOOLKITS TKD3DHost)
list (REMOVE_ITEM Draw_TOOLKITS TKD3DHostTest)
@@ -486,7 +494,8 @@ endif()
OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGE)
OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE)
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_GLES2)
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlLibs CAN_USE_OPENGL)
OCCT_IS_PRODUCT_REQUIRED (CSF_OpenGlesLibs CAN_USE_GLES2)
OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB)
OCCT_IS_PRODUCT_REQUIRED (CSF_EIGEN CAN_USE_EIGEN)
@@ -607,6 +616,16 @@ else()
OCCT_CHECK_AND_UNSET ("INSTALL_FFMPEG")
endif()
# OpenGL
if (CAN_USE_OPENGL)
set (USE_OPENGL ON CACHE BOOL "${USE_OPENGL_DESCR}")
if (USE_OPENGL)
add_definitions (-DHAVE_OPENGL_EXT)
endif()
else()
OCCT_CHECK_AND_UNSET ("USE_OPENGL")
endif()
# OpenGL ES 2.0
if (CAN_USE_GLES2)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
@@ -616,9 +635,9 @@ if (CAN_USE_GLES2)
endif()
if (USE_GLES2)
add_definitions (-DHAVE_GLES2)
add_definitions (-DHAVE_GLES2_EXT)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2")

View File

@@ -1,7 +1,7 @@
FoundationClasses TKernel TKMath
ModelingData TKG2d TKG3d TKGeomBase TKBRep
ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
Visualization TKService TKV3d TKOpenGl TKMeshVS TKIVtk TKD3DHost
Visualization TKService TKV3d TKOpenGl TKOpenGles TKMeshVS TKIVtk TKD3DHost
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF
DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh
Draw TKDraw TKTopTest TKOpenGlTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE

View File

@@ -207,6 +207,7 @@ n Image
n Media
n MeshVS
n OpenGl
n OpenGles
n D3DHost
n Prs3d
n PrsMgr
@@ -224,6 +225,7 @@ r Shaders
r XRResources
t TKMeshVS
t TKOpenGl
t TKOpenGles
t TKD3DHost
t TKService
t TKV3d
@@ -403,6 +405,7 @@ n MeshTest
n SWDRAW
n TObjDRAW
n OpenGlTest
n OpenGlesTest
n D3DHostTest
n ViewerTest
n XDEDRAW
@@ -416,6 +419,7 @@ t TKDraw
t TKTObjDRAW
t TKTopTest
t TKOpenGlTest
t TKOpenGlesTest
t TKD3DHostTest
t TKViewerTest
t TKXDEDRAW

View File

@@ -1,3 +1,3 @@
# OpenGL ES 2.0
THIRDPARTY_PRODUCT("GLES2" "GLES2/gl2.h" "CSF_OpenGlLibs" "")
THIRDPARTY_PRODUCT("GLES2" "GLES2/gl2.h" "CSF_OpenGlesLibs" "")

View File

@@ -74,12 +74,8 @@ if (WIN32)
set (CSF_psapi "psapi.lib")
set (CSF_winmm "winmm.lib")
set (CSF_d3d9 "D3D9.lib")
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore" OR USE_GLES2)
set (CSF_OpenGlLibs "libEGL libGLESv2")
else()
set (CSF_OpenGlLibs "opengl32.lib")
endif()
set (CSF_OpenGlLibs "opengl32.lib")
set (CSF_OpenGlesLibs "libEGL libGLESv2")
else()
if (APPLE)
@@ -100,9 +96,9 @@ else()
OCCT_CHECK_AND_UNSET (IOKit_LIB)
if (IOS)
find_library (OpenGlLibs_LIB NAMES OpenGLES)
set (CSF_OpenGlLibs ${OpenGlLibs_LIB})
OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB)
find_library (OpenGlesLibs_LIB NAMES OpenGLES)
set (CSF_OpenGlesLibs ${OpenGlesLibs_LIB})
OCCT_CHECK_AND_UNSET (OpenGlesLibs_LIB)
elseif (USE_GLX)
set (CSF_OpenGlLibs GL)
set (CSF_XwLibs "X11 Xext Xmu Xi")
@@ -111,18 +107,15 @@ else()
set (CSF_OpenGlLibs ${OpenGlLibs_LIB})
OCCT_CHECK_AND_UNSET (OpenGlLibs_LIB)
endif()
elseif (ANDROID)
set (CSF_ThreadLibs "c")
set (CSF_OpenGlLibs "EGL GLESv2")
set (CSF_OpenGlesLibs "EGL GLESv2")
set (CSF_androidlog "log")
elseif (UNIX)
set (CSF_ThreadLibs "pthread rt stdc++")
if (USE_GLES2)
set (CSF_OpenGlLibs "EGL GLESv2")
else()
set (CSF_OpenGlLibs "GL")
endif()
set (CSF_OpenGlLibs "GL")
set (CSF_OpenGlesLibs "EGL GLESv2")
set (CSF_XwLibs "X11 Xext Xmu Xi")
set (CSF_dl "dl")
set (CSF_fontconfig "fontconfig")

View File

@@ -303,6 +303,13 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
else() # get CSF_ value
set (CURRENT_CSF ${${USED_ITEM}})
if (NOT "x${CURRENT_CSF}" STREQUAL "x")
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlLibs")
add_definitions (-DHAVE_OPENGL)
endif()
if ("${CURRENT_CSF}" STREQUAL "CSF_OpenGlesLibs")
add_definitions (-DHAVE_GLES2)
endif()
set (LIBRARY_FROM_CACHE 0)
separate_arguments (CURRENT_CSF)
foreach (CSF_LIBRARY ${CURRENT_CSF})

View File

@@ -174,9 +174,10 @@ set (USE_EGL_DESCR
"Indicates whether EGL should be used in OCCT visualization
module instead of conventional OpenGL context creation APIs")
set (USE_OPENGL_DESCR
"Indicates whether OpenGL desktop should be used in OCCT visualization module")
set (USE_GLES2_DESCR
"Indicates whether OpenGL ES 2.0 should be used in OCCT visualization
module instead of desktop OpenGL")
"Indicates whether OpenGL ES 2.0 should be used in OCCT visualization module")
set (USE_TBB_DESCR
"Indicates whether TBB is used or not. TBB stands for Threading Building Blocks,

View File

@@ -1461,9 +1461,7 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
set aLibsMap(CSF_netapi32) "netapi32"
set aLibsMap(CSF_winmm) "winmm"
set aLibsMap(CSF_OpenGlLibs) "opengl32"
if { "$::HAVE_GLES2" == "true" } {
set aLibsMap(CSF_OpenGlLibs) "libEGL libGLESv2"
}
set aLibsMap(CSF_OpenGlesLibs) "libEGL libGLESv2"
set aLibsMap(CSF_psapi) "Psapi"
set aLibsMap(CSF_d3d9) "d3d9"
@@ -1484,14 +1482,18 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
}
} else {
set aLibsMap(CSF_dl) "dl"
set aLibsMap(CSF_OpenGlLibs) "GL"
set aLibsMap(CSF_OpenGlesLibs) "EGL GLESv2"
if { "$theOS" == "mac" || "$theOS" == "ios" } {
set aLibsMap(CSF_objc) "objc"
set aLibsMap(CSF_objc) "objc"
set aLibsMap(CSF_OpenGlLibs) ""
set aLibsMap(CSF_OpenGlesLibs) ""
set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
set aFrmsMap(CSF_OpenGlesLibs) "OpenGLES"
if { "$theOS" == "ios" } {
set aFrmsMap(CSF_Appkit) "UIKit"
set aFrmsMap(CSF_OpenGlLibs) "OpenGLES"
set aFrmsMap(CSF_Appkit) "UIKit"
} else {
set aFrmsMap(CSF_Appkit) "AppKit"
set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
set aFrmsMap(CSF_Appkit) "AppKit"
}
set aFrmsMap(CSF_IOKit) "IOKit"
set aFrmsMap(CSF_TclLibs) "Tcl"
@@ -1500,24 +1502,17 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
set aLibsMap(CSF_TclTkLibs) ""
set aLibsMap(CSF_QT) "QtCore QtGui"
} elseif { "$theOS" == "android" } {
set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
set aLibsMap(CSF_androidlog) "log"
} else {
set aLibsMap(CSF_fontconfig) "fontconfig"
if { "$theOS" == "qnx" } {
# CSF_ThreadLibs - pthread API is part of libc on QNX
set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
} else {
set aLibsMap(CSF_ThreadLibs) "pthread rt"
set aLibsMap(CSF_OpenGlLibs) "GL"
set aLibsMap(CSF_TclTkLibs) "X11 tk8.6"
set aLibsMap(CSF_XwLibs) "X11 Xext Xmu Xi"
set aLibsMap(CSF_MotifLibs) "X11"
}
if { "$::HAVE_GLES2" == "true" } {
set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
}
}
}
}
@@ -1785,9 +1780,14 @@ proc osutils:vcproj { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir
global path
set aHasQtDep "false"
set aTkDefines ""
foreach aCsfElem [osutils:tk:csfInExternlib "$path/$theSrcDir/${theToolKit}/EXTERNLIB"] {
if { "$aCsfElem" == "CSF_QT" } {
set aHasQtDep "true"
} elseif { "$aCsfElem" == "CSF_OpenGlLibs" } {
set aTkDefines "$aTkDefines;HAVE_OPENGL"
} elseif { "$aCsfElem" == "CSF_OpenGlesLibs" } {
set aTkDefines "$aTkDefines;HAVE_GLES2"
}
}
set theProjTmpl [osutils:vcproj:readtemplate $theVcVer $isUWP 0]
@@ -1822,9 +1822,9 @@ proc osutils:vcproj { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir
# depending on VC version
regsub -all -- {__TKDEP__} $theProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] theProjTmpl
regsub -all -- {__TKDEP_DEBUG__} $theProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] theProjTmpl
regsub -all -- {__TKDEFINES__} $theProjTmpl $aTkDefines theProjTmpl
set anIncPaths "..\\..\\..\\inc"
# set aTKDefines ""
set aFilesSection ""
set aVcFilesCxx(units) ""
set aVcFilesHxx(units) ""
@@ -2108,6 +2108,7 @@ proc osutils:vcprojx { theVcVer isUWP theOutDir theToolKit theGuidsMap theSrcDir
set aVCRTVer [string range $theVcVer 0 3]
regsub -all -- {__TKDEP__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsReleaseLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEP_DEBUG__} $aProjTmpl [osutils:depLibraries $aUsedLibs $anOsDebugLibs $theVcVer] aProjTmpl
regsub -all -- {__TKDEFINES__} $aProjTmpl "" aProjTmpl
set aFilesSection ""
set aVcFilesCxx(units) ""

View File

@@ -153,5 +153,4 @@ win32 {
}
}
#OBJECTS_DIR = $$DESTDIR/../obj$${MY_BUILDTYPE}/$${TARGET}
OBJECTS_DIR = $$DESTDIR/../obj$${MY_BUILDTYPE}
OBJECTS_DIR = $$DESTDIR/../obj$${MY_BUILDTYPE}/$${TARGET}

View File

@@ -15,9 +15,14 @@ for (aModuleIter, aModuleList) {
equals (aToolKit, $$OCC_MODULE_NAME) { toSkipToolkit = 1 }
!HAVE_VTK:equals (aToolKit, "TKIVtk") { toSkipToolkit = 1 }
!HAVE_VTK:equals (aToolKit, "TKIVtkDraw") { toSkipToolkit = 1 }
#!HAVE_OPENGL: equals (aToolKit, "TKOpenGl") { toSkipToolkit = 1 }
#!HAVE_OPENGL: equals (aToolKit, "TKOpenGlTest") { toSkipToolkit = 1 }
!HAVE_GLES2: equals (aToolKit, "TKOpenGles") { toSkipToolkit = 1 }
!HAVE_GLES2: equals (aToolKit, "TKOpenGlesTest") { toSkipToolkit = 1 }
!win32: equals (aToolKit, "TKD3DHost") { toSkipToolkit = 1 }
!win32: equals (aToolKit, "TKD3DHostTest") { toSkipToolkit = 1 }
equals (toSkipToolkit, 0) {
#warning(aToolKit($$OCC_MODULE_NAME)=$$aToolKit)
eval(occtkgen_$${aToolKit}.input = $$_PRO_FILE_PWD_/../OccToolkit.pro.in)
eval(occtkgen_$${aToolKit}.output = $$_PRO_FILE_PWD_/$${aToolKit}/$${aToolKit}.pro)

View File

@@ -36,7 +36,7 @@ win32 {
CSF_wsock32 = -lwsock32
CSF_netapi32 = -lnetapi32
CSF_OpenGlLibs = -lopengl32
HAVE_GLES2 { CSF_OpenGlLibs = -llibEGL -llibGLESv2 }
CSF_OpenGlesLibs = -llibEGL -llibGLESv2
CSF_psapi = -lPsapi
CSF_winmm = -lwinmm
CSF_d3d9 = -ld3d9
@@ -46,12 +46,12 @@ win32 {
} else:mac {
CSF_dl = -ldl
CSF_objc = -lobjc
CSF_OpenGlLibs = -framework OpenGL
CSF_OpenGlesLibs = -framework OpenGLES
iphoneos {
CSF_Appkit = -framework UIKit
CSF_OpenGlLibs = -framework OpenGLES
} else {
CSF_Appkit = -framework AppKit
CSF_OpenGlLibs = -framework OpenGL
}
CSF_IOKit = -framework IOKit
CSF_TclLibs = -framework Tcl
@@ -60,17 +60,19 @@ win32 {
CSF_dl = -ldl
CSF_ThreadLibs = -lpthread -lrt
CSF_OpenGlLibs = -lGL
CSF_OpenGlesLibs = -lEGL -lGLESv2
CSF_TclTkLibs = -lX11 -ltk8.6
CSF_XwLibs = -lX11 -lXext -lXmu -lXi
CSF_MotifLibs = -lX11
CSF_fontconfig = -lfontconfig
HAVE_GLES2 { CSF_OpenGlLibs = -lEGL -lGLESv2 }
}
for (aCfgIter, CONFIG) {
aRes = $$find(aCfgIter, "^HAVE_")
count(aRes, 1) {
DEFINES += $$aCfgIter
!equals(aCfgIter, "HAVE_GLES2") {
count(aRes, 1) {
DEFINES += $$aCfgIter
}
}
}
@@ -103,6 +105,12 @@ for (anExternLib, anExternLibs) {
count(hasCsf, 1) {
aList = $$split($$anExternLib, "\n")
LIBS += $$aList
equals(anExternLib, "CSF_OpenGlLibs") {
DEFINES += "HAVE_OPENGL"
}
equals(anExternLib, "CSF_OpenGlesLibs") {
DEFINES += "HAVE_GLES2"
}
} else {
LIBS += -l$$anExternLib
}

View File

@@ -185,7 +185,7 @@ if ["%HAVE_OPENCL%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DH
if ["%HAVE_FREEIMAGE%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FREEIMAGE" & set "CSF_DEFINES=HAVE_FREEIMAGE;%CSF_DEFINES%"
if ["%HAVE_FFMPEG%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FFMPEG" & set "CSF_DEFINES=HAVE_FFMPEG;%CSF_DEFINES%"
if ["%HAVE_VTK%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_VTK" & set "CSF_DEFINES=HAVE_VTK;%CSF_DEFINES%"
if ["%HAVE_GLES2%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GLES2" & set "CSF_DEFINES=HAVE_GLES2;%CSF_DEFINES%"
if ["%HAVE_GLES2%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GLES2_EXT" & set "CSF_DEFINES=HAVE_GLES2_EXT;%CSF_DEFINES%"
if ["%HAVE_D3D%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_D3D" & set "CSF_DEFINES=HAVE_D3D;%CSF_DEFINES%"
if ["%HAVE_ZLIB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_ZLIB" & set "CSF_DEFINES=HAVE_ZLIB;%CSF_DEFINES%"
if ["%HAVE_LIBLZMA%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_LIBLZMA" & set "CSF_DEFINES=HAVE_LIBLZMA;%CSF_DEFINES%"

View File

@@ -102,7 +102,7 @@ if [ "$HAVE_TBB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -D
if [ "$HAVE_OPENCL" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_OPENCL"; fi
if [ "$HAVE_FREEIMAGE" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FREEIMAGE"; fi
if [ "$HAVE_FFMPEG" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_FFMPEG"; fi
if [ "$HAVE_GLES2" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_GLES2"; fi
if [ "$HAVE_GLES2" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_GLES2_EXT"; fi
if [ "$HAVE_VTK" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_VTK"; fi
if [ "$HAVE_ZLIB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_ZLIB"; fi
if [ "$HAVE_LIBLZMA" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_LIBLZMA"; fi

View File

@@ -90,7 +90,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -107,7 +107,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
@@ -138,7 +138,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>.\..\..\..\win32\__VCVER__\objd\__TKNAM__/</AssemblerListingLocation>
@@ -156,7 +156,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>
@@ -186,7 +186,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -203,7 +203,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
@@ -234,7 +234,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>.\..\..\..\win64\__VCVER__\objd\__TKNAM__/</AssemblerListingLocation>
@@ -252,7 +252,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>

View File

@@ -85,7 +85,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -100,7 +100,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
@@ -130,7 +130,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>.\..\..\..\win32\__VCVER__\objd\__XQTNAM__/</AssemblerListingLocation>
@@ -146,7 +146,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>
@@ -175,7 +175,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -190,7 +190,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;No_Exception;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;No_Exception;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
@@ -219,7 +219,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>.\..\..\..\win64\__VCVER__\objd\__XQTNAM__/</AssemblerListingLocation>
@@ -235,7 +235,7 @@
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\inc;$(CSF_OPT_INC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;__TKDEFINES__;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>

View File

@@ -2229,3 +2229,11 @@ Existing code defining nodal colors should be updated to:
- Use *Graphic3d_TOSM_UNLIT* shading model when lighting is not needed.
- Adjust diffuse/ambient material coefficients, which have been previously ignored.
- Remove code multiplying nodal colors, intended to compensate over-brightness due to addition of specular color from material definition, as specular component is now also modulated by a vertex color.
@subsection upgrade_occt760_tkopengles TKOpenGles library
OCCT now provides two separate toolkits - *TKOpenGl* depending on desktop OpenGL and *TKOpenGles* depending on OpenGL ES.
Both libraries can be now built simultaneously on systems providing both APIs (like desktop Linux).
Existing applications depending on OpenGL ES (mobile projects first of all) should be adjusted to link against *TKOpenGles*.
Note that both *TKOpenGl* and *TKOpenGles* keep exporting classes with the same name, so applications should not attempt to link both libraries simultaneously.

View File

@@ -32,7 +32,7 @@
0A7DEE351E2D2AE000267B9B /* libTKXCAF.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE151E2D2AC000267B9B /* libTKXCAF.a */; };
0A7DEE371E2D2AE000267B9B /* libTKXDESTEP.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE171E2D2AC700267B9B /* libTKXDESTEP.a */; };
0A7DEE3E1E2D2B8100267B9B /* libTKBO.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE021E2D2A7F00267B9B /* libTKBO.a */; };
0A7DEE3F1E2D2BB000267B9B /* libTKOpenGl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE091E2D2A9700267B9B /* libTKOpenGl.a */; };
0A7DEE3F1E2D2BB000267B9B /* libTKOpenGles.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE091E2D2A9700267B9B /* libTKOpenGles.a */; };
0A7DEE401E2D2BEA00267B9B /* libTKSTEP209.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE0F1E2D2AAB00267B9B /* libTKSTEP209.a */; };
0A7DEE411E2D2C1500267B9B /* libTKXSBase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A7DEE1D1E2D2ADC00267B9B /* libTKXSBase.a */; };
0AAE0DE61EAF816E00C1F65B /* screw.step in Resources */ = {isa = PBXBuildFile; fileRef = 0AAE0DE51EAF816D00C1F65B /* screw.step */; };
@@ -82,7 +82,7 @@
0A7DEE061E2D2A8C00267B9B /* libTKIGES.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKIGES.a; path = ../occt/lib/libTKIGES.a; sourceTree = "<group>"; };
0A7DEE071E2D2A8F00267B9B /* libTKMeshVS.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKMeshVS.a; path = ../occt/lib/libTKMeshVS.a; sourceTree = "<group>"; };
0A7DEE081E2D2A9300267B9B /* libTKOffset.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKOffset.a; path = ../occt/lib/libTKOffset.a; sourceTree = "<group>"; };
0A7DEE091E2D2A9700267B9B /* libTKOpenGl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKOpenGl.a; path = ../occt/lib/libTKOpenGl.a; sourceTree = "<group>"; };
0A7DEE091E2D2A9700267B9B /* libTKOpenGles.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKOpenGles.a; path = ../occt/lib/libTKOpenGles.a; sourceTree = "<group>"; };
0A7DEE0A1E2D2A9A00267B9B /* libTKPrim.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKPrim.a; path = ../occt/lib/libTKPrim.a; sourceTree = "<group>"; };
0A7DEE0B1E2D2A9D00267B9B /* libTKService.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKService.a; path = ../occt/lib/libTKService.a; sourceTree = "<group>"; };
0A7DEE0C1E2D2AA100267B9B /* libTKStd.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTKStd.a; path = ../occt/lib/libTKStd.a; sourceTree = "<group>"; };
@@ -135,7 +135,7 @@
0AE286641EB0D29B00A9D719 /* libz.tbd in Frameworks */,
0A7DEE411E2D2C1500267B9B /* libTKXSBase.a in Frameworks */,
0A7DEE401E2D2BEA00267B9B /* libTKSTEP209.a in Frameworks */,
0A7DEE3F1E2D2BB000267B9B /* libTKOpenGl.a in Frameworks */,
0A7DEE3F1E2D2BB000267B9B /* libTKOpenGles.a in Frameworks */,
0A7DEE3E1E2D2B8100267B9B /* libTKBO.a in Frameworks */,
0A7DEE2B1E2D2AE000267B9B /* libTKService.a in Frameworks */,
0A7DEE2E1E2D2AE000267B9B /* libTKSTEP.a in Frameworks */,
@@ -234,7 +234,7 @@
0A7DEE061E2D2A8C00267B9B /* libTKIGES.a */,
0A7DEE071E2D2A8F00267B9B /* libTKMeshVS.a */,
0A7DEE081E2D2A9300267B9B /* libTKOffset.a */,
0A7DEE091E2D2A9700267B9B /* libTKOpenGl.a */,
0A7DEE091E2D2A9700267B9B /* libTKOpenGles.a */,
0A7DEE0A1E2D2A9A00267B9B /* libTKPrim.a */,
0A7DEE0B1E2D2A9D00267B9B /* libTKService.a */,
0A7DEE0C1E2D2AA100267B9B /* libTKStd.a */,

View File

@@ -147,7 +147,7 @@ public class OcctJniActivity extends Activity implements OnClickListener
|| !loadLibVerbose ("TKService", aLoaded, aFailed)
|| !loadLibVerbose ("TKHLR", aLoaded, aFailed)
|| !loadLibVerbose ("TKV3d", aLoaded, aFailed)
|| !loadLibVerbose ("TKOpenGl", aLoaded, aFailed)
|| !loadLibVerbose ("TKOpenGles", aLoaded, aFailed)
// application code
|| !loadLibVerbose ("TKJniSample", aLoaded, aFailed))
{

View File

@@ -11,7 +11,7 @@ set (anOcctLibs
TKIGES
TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP
# OCCT Visualization
TKService TKHLR TKV3d TKOpenGl
TKService TKHLR TKV3d TKOpenGles
)
set(aLibDeps "")

View File

@@ -38,7 +38,7 @@ LIBS += -lTKernel \
-lTKMesh \
-lTKHLR \
-lTKV3d \
-lTKOpenGl
-lTKOpenGles
# IMPORTANT. load libraries in a proper order
ANDROID_EXTRA_LIBS = $$3rdparty_lib_path/libfreeimage.so \
@@ -56,4 +56,4 @@ ANDROID_EXTRA_LIBS = $$3rdparty_lib_path/libfreeimage.so \
$$occt_lib_path/libTKMesh.so \
$$occt_lib_path/libTKHLR.so \
$$occt_lib_path/libTKV3d.so \
$$occt_lib_path/libTKOpenGl.so
$$occt_lib_path/libTKOpenGles.so

View File

@@ -64,7 +64,7 @@ else()
set(OCCT_BIN_DIR)
endif()
set(OpenCASCADE_LIBS TKRWMesh TKBinXCAF TKBin TKBinL TKOpenGl TKXCAF TKVCAF TKCAF TKV3d TKHLR TKMesh TKService TKShHealing TKPrim TKTopAlgo TKGeomAlgo TKBRep TKGeomBase TKG3d TKG2d TKMath TKLCAF TKCDF TKernel)
set(OpenCASCADE_LIBS TKRWMesh TKBinXCAF TKBin TKBinL TKOpenGles TKXCAF TKVCAF TKCAF TKV3d TKHLR TKMesh TKService TKShHealing TKPrim TKTopAlgo TKGeomAlgo TKBRep TKGeomBase TKG3d TKG2d TKMath TKLCAF TKCDF TKernel)
add_executable(${APP_TARGET} ${SOURCES})
target_link_libraries(

View File

@@ -710,7 +710,7 @@ EM_BOOL WasmOcctView::onTouchEvent (int theEventType, const EmscriptenTouchEvent
myDoubleTapTimer.Stop();
myDoubleTapTimer.Reset();
myDoubleTapTimer.Start();
SelectInViewer (Graphic3d_Vec2i (myClickTouch.From), false);
SelectInViewer (Graphic3d_Vec2i (myClickTouch.From), AIS_SelectionScheme_Replace);
}
}
hasUpdates = true;

View File

@@ -358,10 +358,11 @@ static Standard_Integer dversion(Draw_Interpretor& di, Standard_Integer, const c
#else
di << "FFmpeg disabled\n";
#endif
#ifdef HAVE_GLES2
di << "OpenGL: ES2\n";
#else
di << "OpenGL: desktop\n";
#ifdef HAVE_OPENGL_EXT
di << "OpenGL: enabled (HAVE_OPENGL_EXT)\n";
#endif
#ifdef HAVE_GLES2_EXT
di << "OpenGL ES: enabled (HAVE_GLES2_EXT)\n";
#endif
#ifdef HAVE_OPENVR
di << "OpenVR enabled (HAVE_OPENVR)\n";

View File

@@ -42,7 +42,10 @@ ALL : MODELING, OCAFKERNEL, DATAEXCHANGE
TOPTEST : TKTopTest
DCAF : TKDCAF
AISV : TKViewerTest
GL : TKOpenGlTest
OPENGL : TKOpenGlTest
GLES : TKOpenGlesTest
OPENGLES : TKOpenGlesTest
D3DHOST : TKD3DHostTest
XSDRAW : TKXSDRAW
XDEDRAW : TKXDEDRAW

View File

@@ -18,6 +18,9 @@ proc Draw:toolkits { } {
set aResult [list TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw]
lappend aResult "TKOpenGlTest"
if { [info exists ::env(HAVE_GLES2)] && "$::env(HAVE_GLES2)" == "true" } {
lappend aResult "TKOpenGlesTest"
}
if { "$::tcl_platform(platform)" == "windows" } {
if { [info exists ::env(HAVE_D3D)] } {
if { "$::env(HAVE_D3D)" == "true" } {

View File

@@ -18,6 +18,9 @@ proc Visualization:toolkits { } {
set aResult [list TKService TKV3d TKMeshVS]
lappend aResult "TKOpenGl"
if { [info exists ::env(HAVE_GLES2)] && "$::env(HAVE_GLES2)" == "true" } {
lappend aResult "TKOpenGles"
}
if { "$::tcl_platform(platform)" == "windows" } {
if { [info exists ::env(HAVE_D3D)] } {
if { "$::env(HAVE_D3D)" == "true" } {

View File

@@ -145,15 +145,18 @@ OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnectio
const Standard_Boolean theToInitialize)
: Graphic3d_GraphicDriver (theDisp),
myIsOwnContext (Standard_False),
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
myEglDisplay ((Aspect_Display )EGL_NO_DISPLAY),
myEglContext ((Aspect_RenderingContext )EGL_NO_CONTEXT),
myEglDisplay (NULL),
myEglContext (NULL),
myEglConfig (NULL),
#endif
myCaps (new OpenGl_Caps()),
myMapOfView (1, NCollection_BaseAllocator::CommonBaseAllocator()),
myMapOfStructure (1, NCollection_BaseAllocator::CommonBaseAllocator())
{
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
myEglDisplay = (Aspect_Display )EGL_NO_DISPLAY;
myEglContext = (Aspect_RenderingContext )EGL_NO_CONTEXT;
#endif
#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
if (myDisplayConnection.IsNull())
{
@@ -354,7 +357,6 @@ Standard_Boolean OpenGl_GraphicDriver::InitContext()
return Standard_True;
}
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
// =======================================================================
// function : InitEglContext
// purpose :
@@ -364,6 +366,7 @@ Standard_Boolean OpenGl_GraphicDriver::InitEglContext (Aspect_Display t
void* theEglConfig)
{
ReleaseContext();
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
if (myDisplayConnection.IsNull())
{
@@ -390,8 +393,13 @@ Standard_Boolean OpenGl_GraphicDriver::InitEglContext (Aspect_Display t
}
chooseVisualInfo();
return Standard_True;
}
#else
(void )theEglDisplay;
(void )theEglContext;
(void )theEglConfig;
throw Standard_NotImplemented ("OpenGl_GraphicDriver::InitEglContext() is not implemented");
#endif
}
// =======================================================================
// function : chooseVisualInfo

View File

@@ -68,7 +68,6 @@ public:
//! Perform initialization of default OpenGL context.
Standard_EXPORT Standard_Boolean InitContext();
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
//! Initialize default OpenGL context using existing one.
//! @param theEglDisplay EGL connection to the Display
//! @param theEglContext EGL rendering context
@@ -76,7 +75,6 @@ public:
Standard_EXPORT Standard_Boolean InitEglContext (Aspect_Display theEglDisplay,
Aspect_RenderingContext theEglContext,
void* theEglConfig);
#endif
//! Request limit of graphic resource of specific type.
Standard_EXPORT virtual Standard_Integer InquireLimit (const Graphic3d_TypeOfLimit theType) const Standard_OVERRIDE;
@@ -175,11 +173,9 @@ public:
//! any context will be returned otherwise
Standard_EXPORT const Handle(OpenGl_Context)& GetSharedContext (bool theBound = false) const;
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
Aspect_Display getRawGlDisplay() const { return myEglDisplay; }
Aspect_RenderingContext getRawGlContext() const { return myEglContext; }
void* getRawGlConfig() const { return myEglConfig; }
#endif
//! Set device lost flag for redrawn views.
Standard_EXPORT void setDeviceLost();
@@ -200,11 +196,10 @@ protected:
protected:
Standard_Boolean myIsOwnContext; //!< indicates that shared context has been created within OpenGl_GraphicDriver
#if defined(HAVE_EGL) || defined(HAVE_GLES2) || defined(OCCT_UWP) || defined(__ANDROID__) || defined(__QNX__) || defined(__EMSCRIPTEN__)
Aspect_Display myEglDisplay; //!< EGL connection to the Display : EGLDisplay
Aspect_RenderingContext myEglContext; //!< EGL rendering context : EGLContext
void* myEglConfig; //!< EGL configuration : EGLConfig
#endif
Handle(OpenGl_Caps) myCaps;
NCollection_Map<Handle(OpenGl_View)> myMapOfView;

View File

@@ -15,6 +15,12 @@
#include <OpenGl_GraphicDriver.hxx>
#ifdef HAVE_GLES2
#define OpenGl_DRIVER_NAME "TKOpenGles"
#else
#define OpenGl_DRIVER_NAME "TKOpenGl"
#endif
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraphicDriverFactory, Graphic3d_GraphicDriverFactory)
// =======================================================================
@@ -22,7 +28,7 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraphicDriverFactory, Graphic3d_GraphicDriverF
// purpose :
// =======================================================================
OpenGl_GraphicDriverFactory::OpenGl_GraphicDriverFactory()
: Graphic3d_GraphicDriverFactory ("TKOpenGl"),
: Graphic3d_GraphicDriverFactory (OpenGl_DRIVER_NAME),
myDefaultCaps (new OpenGl_Caps())
{
//

View File

@@ -14,11 +14,12 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Poly.hxx>
#include <gp_Ax1.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_XY.hxx>
#include <Poly.hxx>
#include <Poly_Array1OfTriangle.hxx>
#include <Poly_ListOfTriangulation.hxx>
#include <Poly_Polygon2D.hxx>
@@ -562,3 +563,122 @@ Standard_Real Poly::PointOnTriangle (const gp_XY& theP1, const gp_XY& theP2, con
}
}
//=======================================================================
//function : Intersect
//purpose :
//=======================================================================
Standard_Boolean Poly::Intersect (const Handle(Poly_Triangulation)& theTri,
const gp_Ax1& theAxis,
const Standard_Boolean theIsClosest,
Poly_Triangle& theTriangle,
Standard_Real& theDistance)
{
const Standard_Real aConf = 1E-15;
const gp_XYZ& aLoc = theAxis.Location().XYZ();
const gp_Dir& aDir = theAxis.Direction();
Standard_Real aResult = theIsClosest ? RealLast() : 0.0;
Standard_Real aParam = 0.0;
Standard_Integer aTriNodes[3] = {};
for (Standard_Integer aTriIter = 1; aTriIter <= theTri->NbTriangles(); ++aTriIter)
{
const Poly_Triangle& aTri = theTri->Triangle (aTriIter);
aTri.Get (aTriNodes[0], aTriNodes[1], aTriNodes[2]);
if (IntersectTriLine (aLoc, aDir,
theTri->Node (aTriNodes[0]).XYZ(),
theTri->Node (aTriNodes[1]).XYZ(),
theTri->Node (aTriNodes[2]).XYZ(),
aParam))
{
if (aParam > aConf)
{
if (theIsClosest)
{
if (aParam < aResult)
{
aResult = aParam;
theTriangle = aTri;
}
}
else if (aParam > aResult)
{
aResult = aParam;
theTriangle = aTri;
}
}
}
}
if (aConf < aResult && aResult < RealLast())
{
theDistance = aResult;
return Standard_True;
}
return Standard_False;
}
//! Calculate the minor of the given matrix, defined by the columns specified by values c1, c2, c3.
static double Determinant (const double a[3][4],
const int c1,
const int c2,
const int c3)
{
return a[0][c1]*a[1][c2]*a[2][c3] +
a[0][c2]*a[1][c3]*a[2][c1] +
a[0][c3]*a[1][c1]*a[2][c2] -
a[0][c3]*a[1][c2]*a[2][c1] -
a[0][c2]*a[1][c1]*a[2][c3] -
a[0][c1]*a[1][c3]*a[2][c2];
}
//=======================================================================
//function : IntersectTriLine
//purpose : Intersect a triangle with a line
//=======================================================================
Standard_Integer Poly::IntersectTriLine (const gp_XYZ& theStart,
const gp_Dir& theDir,
const gp_XYZ& theV0,
const gp_XYZ& theV1,
const gp_XYZ& theV2,
Standard_Real& theParam)
{
int aRes = 0;
const double aConf = 1E-15;
const double aMat34[3][4] =
{
{ -theDir.X(),
theV1.X() - theV0.X(), theV2.X() - theV0.X(), theStart.X() - theV0.X() },
{ -theDir.Y(),
theV1.Y() - theV0.Y(), theV2.Y() - theV0.Y(), theStart.Y() - theV0.Y() },
{ -theDir.Z(),
theV1.Z() - theV0.Z(), theV2.Z() - theV0.Z(), theStart.Z() - theV0.Z() }
};
const double aD = Determinant (aMat34, 0, 1, 2);
const double aDt = Determinant (aMat34, 3, 1, 2);
if (aD > aConf)
{
const double aDa = Determinant (aMat34, 0, 3, 2);
if (aDa > -aConf)
{
const double aDb = Determinant (aMat34, 0, 1, 3);
aRes = ((aDb > -aConf) && (aDa + aDb <= aD + aConf));
}
}
else if (aD < -aConf)
{
const double aDa = Determinant (aMat34, 0, 3, 2);
if (aDa < aConf)
{
const double aDb = Determinant (aMat34, 0, 1, 3);
aRes = ((aDb < aConf) && (aDa + aDb >= aD - aConf));
}
}
if (aRes != 0)
{
theParam = aDt / aD;
}
return aRes;
}

View File

@@ -125,6 +125,33 @@ public:
//! point is inside).
Standard_EXPORT static Standard_Real PointOnTriangle (const gp_XY& P1, const gp_XY& P2, const gp_XY& P3, const gp_XY& P, gp_XY& UV);
//! Computes the intersection between axis and triangulation.
//! @param theTri [in] input triangulation
//! @param theAxis [in] intersecting ray
//! @param theIsClosest [in] finds the closest intersection when TRUE, finds the farthest otherwise
//! @param theTriangle [out] intersected triangle
//! @param theDistance [out] distance along ray to intersection point
//! @return TRUE if intersection takes place, FALSE otherwise.
Standard_EXPORT static Standard_Boolean Intersect (const Handle(Poly_Triangulation)& theTri,
const gp_Ax1& theAxis,
const Standard_Boolean theIsClosest,
Poly_Triangle& theTriangle,
Standard_Real& theDistance);
//! Computes the intersection between a triangle defined by three vertexes and a line.
//! @param theStart [in] picking ray origin
//! @param theDir [in] picking ray direction
//! @param theV0 [in] first triangle node
//! @param theV1 [in] second triangle node
//! @param theV2 [in] third triangle node
//! @param theParam [out] param on line of the intersection point
//! @return 1 if intersection was found, 0 otherwise.
Standard_EXPORT static Standard_Integer IntersectTriLine (const gp_XYZ& theStart,
const gp_Dir& theDir,
const gp_XYZ& theV0,
const gp_XYZ& theV1,
const gp_XYZ& theV2,
Standard_Real& theParam);
//! Returns area and perimeter of 2D-polygon given by its vertices.
//! theArea will be negative if the polygon is bypassed clockwise
@@ -169,18 +196,8 @@ public:
return Standard_True;
}
protected:
private:
friend class Poly_Triangle;
friend class Poly_Triangulation;
friend class Poly_Polygon3D;
@@ -190,10 +207,4 @@ friend class Poly_Connect;
};
#endif // _Poly_HeaderFile

View File

@@ -222,34 +222,42 @@ Standard_Boolean Poly_CoherentTriangulation::RemoveDegenerated
const Standard_Integer ip1(aTri.Node(ind[i+1]));
// Disconnect from both neighbours
Poly_CoherentTriangle * pTriConn[2] = {
const_cast<Poly_CoherentTriangle *>(aTri.GetConnectedTri(ind[i-1])),
const_cast<Poly_CoherentTriangle *>(aTri.GetConnectedTri(ind[i+1]))
};
RemoveTriangle(aTri);
// Reconnect all triangles from Node(ind[i+1]) to Node(ind[i-1])
Poly_CoherentTriPtr::Iterator anIterConn =
pNode[ind[i+1]]->TriangleIterator();
for (; anIterConn.More(); anIterConn.Next()) {
for (;;)
{
Poly_CoherentTriPtr::Iterator anIterConn = pNode[ind[i+1]]->TriangleIterator();
if (!anIterConn.More())
{
break;
}
Poly_CoherentTriangle& aTriConn = anIterConn.ChangeValue();
if (&aTriConn != &aTri) {
if (aTriConn.Node(0) == ip1)
aTriConn.myNodes[0] = im1;
else if (aTriConn.Node(1) == ip1)
aTriConn.myNodes[1] = im1;
else if (aTriConn.Node(2) == ip1)
aTriConn.myNodes[2] = im1;
pNode[ind[i+1]]->RemoveTriangle(aTriConn, myAlloc);
pNode[ind[i-1]]->AddTriangle(aTriConn, myAlloc);
Standard_Integer aNewTriConn[] = {aTriConn.Node(0), aTriConn.Node(1), aTriConn.Node(2)};
if (&aTriConn != &aTri)
{
if (aNewTriConn[0] == ip1)
aNewTriConn[0] = im1;
else if (aNewTriConn[1] == ip1)
aNewTriConn[1] = im1;
else if (aNewTriConn[2] == ip1)
aNewTriConn[2] = im1;
RemoveTriangle (aTriConn);
AddTriangle (aNewTriConn[0], aNewTriConn[1], aNewTriConn[2]);
}
else
{
anIterConn.Next();
if (!anIterConn.More())
{
break;
}
}
}
// Set the new mutual connection between the neighbours of the
// removed degenerated triangle.
if (pTriConn[0] && pTriConn[1]) {
pTriConn[0]->SetConnection(* pTriConn[1]);
}
if (pLstRemovedNode) {
if (pLstRemovedNode)
{
pLstRemovedNode->Append(TwoIntegers(ip1, im1));
}
aResult = Standard_True;
@@ -440,10 +448,6 @@ Standard_Boolean Poly_CoherentTriangulation::RemoveTriangle
for (Standard_Integer i = 0; i < 3; i++) {
if (theTriangle.Node(i) >= 0) {
Poly_CoherentNode& aNode = myNodes(theTriangle.Node(i));
if (aNode.RemoveTriangle(theTriangle, myAlloc)) {
theTriangle.myNodes[i] = -1;
aResult = Standard_True;
}
// If Links exist in this Triangulation, remove or update a Link
Poly_CoherentLink * aLink =
const_cast<Poly_CoherentLink *>(theTriangle.mypLink[i]);
@@ -456,10 +460,10 @@ Standard_Boolean Poly_CoherentTriangulation::RemoveTriangle
for (Standard_Integer j = 0; j < 3; j++) {
if (aLink == pTriOpp->GetLink(j)) {
if (aLink->OppositeNode(0) == theTriangle.Node(i)) {
aLink->myOppositeNode[0] = 0L;
aLink->myOppositeNode[0] = -1;
toRemoveLink = Standard_False;
} else if (aLink->OppositeNode(1) == theTriangle.Node(i)) {
aLink->myOppositeNode[1] = 0L;
aLink->myOppositeNode[1] = -1;
toRemoveLink = Standard_False;
}
break;
@@ -469,6 +473,11 @@ Standard_Boolean Poly_CoherentTriangulation::RemoveTriangle
if (toRemoveLink)
RemoveLink(* aLink);
}
if (aNode.RemoveTriangle(theTriangle, myAlloc))
{
theTriangle.myNodes[i] = -1;
aResult = Standard_True;
}
}
theTriangle.RemoveConnection(i);
}
@@ -540,7 +549,6 @@ Standard_Boolean Poly_CoherentTriangulation::ReplaceNodes
toAddLink = Standard_False;
}
}
break;
}
}
}

View File

@@ -29,6 +29,9 @@
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_Hyperbola.hxx>
#include <Geom_Parabola.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_ElementarySurface.hxx>
#include <Geom_Line.hxx>
@@ -67,6 +70,7 @@
#include <TColGeom_SequenceOfSurface.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_SequenceOfBoolean.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
@@ -96,12 +100,6 @@
IMPLEMENT_STANDARD_RTTIEXT(ShapeUpgrade_UnifySameDomain,Standard_Transient)
struct SubSequenceOfEdges
{
TopTools_SequenceOfShape SeqsEdges;
TopoDS_Edge UnionEdges;
};
static Standard_Real TrueValueOfOffset(const Standard_Real theValue,
const Standard_Real thePeriod)
{
@@ -135,6 +133,40 @@ static void UpdateBoundaries(const Handle(Geom2d_Curve)& thePCurve,
}
}
static Standard_Boolean TryMakeLine(const Handle(Geom2d_Curve)& thePCurve,
const Standard_Real theFirst,
const Standard_Real theLast,
Handle(Geom2d_Line)& theLine)
{
gp_Pnt2d aFirstPnt = thePCurve->Value (theFirst);
gp_Pnt2d aLastPnt = thePCurve->Value (theLast);
gp_Vec2d aVec (aFirstPnt, aLastPnt);
Standard_Real aSqLen = aVec.SquareMagnitude();
Standard_Real aSqParamLen = (theLast - theFirst)*(theLast - theFirst);
if (Abs(aSqLen - aSqParamLen) > Precision::Confusion())
return Standard_False;
gp_Dir2d aDir = aVec;
gp_Vec2d anOffset = -aDir;
anOffset *= theFirst;
gp_Pnt2d anOrigin = aFirstPnt.Translated(anOffset);
gp_Lin2d aLin (anOrigin, aDir);
const Standard_Integer NbSamples = 10;
Standard_Real aDelta = (theLast - theFirst)/NbSamples;
for (Standard_Integer i = 1; i < NbSamples; i++)
{
Standard_Real aParam = theFirst + i*aDelta;
gp_Pnt2d aPnt = thePCurve->Value(aParam);
Standard_Real aDist = aLin.Distance (aPnt);
if (aDist > Precision::Confusion())
return Standard_False;
}
theLine = new Geom2d_Line (aLin);
return Standard_True;
}
static void RemoveEdgeFromMap(const TopoDS_Edge& theEdge,
TopTools_IndexedDataMapOfShapeListOfShape& theVEmap)
{
@@ -1444,18 +1476,330 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
return ResEdge;
}
//=======================================================================
//function : UnionPCurves
//purpose :
//=======================================================================
void ShapeUpgrade_UnifySameDomain::UnionPCurves(const TopTools_SequenceOfShape& theChain,
TopoDS_Edge& theEdge)
{
TopTools_SequenceOfShape aFaceSeq;
const TopoDS_Edge& aFirstEdge = TopoDS::Edge(theChain.Value(1));
const TopTools_ListOfShape& aFaceList = myEFmap.FindFromKey (aFirstEdge);
TopTools_ListIteratorOfListOfShape anItl (aFaceList);
for (; anItl.More(); anItl.Next())
{
TopoDS_Face aFace = TopoDS::Face (anItl.Value());
if (myFacePlaneMap.IsBound(aFace))
continue;
if (myFaceNewFace.IsBound(aFace))
aFace = TopoDS::Face (myFaceNewFace(aFace));
BRepAdaptor_Surface aBAsurf (aFace, Standard_False);
if (aBAsurf.GetType() == GeomAbs_Plane)
continue;
TopLoc_Location aLoc;
Handle(Geom_Surface) aSurf = BRep_Tool::Surface (aFace, aLoc);
Standard_Boolean isFound = Standard_False;
for (Standard_Integer ii = 1; ii <= aFaceSeq.Length(); ii++)
{
TopLoc_Location aPrevLoc;
Handle(Geom_Surface) aPrevSurf = BRep_Tool::Surface (TopoDS::Face(aFaceSeq(ii)), aPrevLoc);
if (aPrevSurf == aSurf && aPrevLoc == aLoc)
{
isFound = Standard_True;
break;
}
}
if (isFound)
continue;
Standard_Real aFirst, aLast;
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface (aFirstEdge, aFace, aFirst, aLast);
aFaceSeq.Append (aFace);
}
TColGeom2d_SequenceOfCurve ResPCurves;
TColStd_SequenceOfReal ResFirsts;
TColStd_SequenceOfReal ResLasts;
TColStd_SequenceOfReal aTolVerSeq;
TopoDS_Edge aPrevEdge;
for (Standard_Integer j = 1; j <= aFaceSeq.Length(); j++)
{
TColGeom2d_SequenceOfCurve aPCurveSeq;
TColStd_SequenceOfReal aFirstsSeq;
TColStd_SequenceOfReal aLastsSeq;
TColStd_SequenceOfBoolean aForwardsSeq;
GeomAbs_CurveType aCurrentType = GeomAbs_OtherCurve;
Standard_Real aFirst, aLast;
for (Standard_Integer i = 1; i <= theChain.Length(); i++)
{
TopoDS_Edge anEdge = TopoDS::Edge(theChain.Value(i));
Standard_Boolean isForward = (anEdge.Orientation() != TopAbs_REVERSED);
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, TopoDS::Face(aFaceSeq(j)),
aFirst, aLast);
if (aPCurve.IsNull())
continue;
Geom2dAdaptor_Curve anAdaptor(aPCurve);
GeomAbs_CurveType aType = anAdaptor.GetType();
Handle(Geom2d_Line) aLine;
if (aType == GeomAbs_BSplineCurve ||
aType == GeomAbs_BezierCurve)
TryMakeLine (aPCurve, aFirst, aLast, aLine);
if (!aLine.IsNull())
{
aPCurve = aLine;
anAdaptor.Load (aPCurve);
aType = GeomAbs_Line;
}
if (aPCurveSeq.IsEmpty()) {
Handle(Geom2d_Curve) aCopyPCurve = Handle(Geom2d_Curve)::DownCast(aPCurve->Copy());
aPCurveSeq.Append(aCopyPCurve);
aFirstsSeq.Append(aFirst);
aLastsSeq.Append(aLast);
aForwardsSeq.Append(isForward);
aCurrentType = aType;
aPrevEdge = anEdge;
continue;
}
Standard_Boolean isSameCurve = Standard_False;
Standard_Real aNewF = aFirst;
Standard_Real aNewL = aLast;
if (aPCurve == aPCurveSeq.Last())
{
isSameCurve = Standard_True;
}
else if (aType == aCurrentType)
{
Geom2dAdaptor_Curve aPrevAdaptor(aPCurveSeq.Last());
switch (aType) {
case GeomAbs_Line: {
gp_Lin2d aPrevLin = aPrevAdaptor.Line();
gp_Pnt2d aFirstP2d = aPCurve->Value (aFirst);
gp_Pnt2d aLastP2d = aPCurve->Value (aLast);
if (aPrevLin.Contains (aFirstP2d, Precision::Confusion()) &&
aPrevLin.Contains (aLastP2d, Precision::Confusion()))
{
isSameCurve = Standard_True;
gp_Pnt2d p1 = anAdaptor.Value(aFirst);
gp_Pnt2d p2 = anAdaptor.Value(aLast);
aNewF = ElCLib::Parameter(aPrevLin, p1);
aNewL = ElCLib::Parameter(aPrevLin, p2);
if (aNewF > aNewL)
{
Standard_Real aTmp = aNewF;
aNewF = aNewL;
aNewL = aTmp;
}
}
break;
}
case GeomAbs_Circle: {
gp_Circ2d aCirc = anAdaptor.Circle();
gp_Circ2d aPrevCirc = aPrevAdaptor.Circle();
if (aCirc.Location().Distance(aPrevCirc.Location()) <= Precision::Confusion() &&
Abs(aCirc.Radius() - aPrevCirc.Radius()) <= Precision::Confusion())
{
isSameCurve = Standard_True;
gp_Pnt2d p1 = anAdaptor.Value(aFirst);
gp_Pnt2d p2 = anAdaptor.Value(aLast);
aNewF = ElCLib::Parameter(aPrevCirc, p1);
aNewL = ElCLib::Parameter(aPrevCirc, p2);
if (aNewF > aNewL)
{
Standard_Real aTmp = aNewF;
aNewF = aNewL;
aNewL = aTmp;
}
}
break;
}
default:
break;
}
}
if (isSameCurve) {
if (aForwardsSeq.Last() == Standard_True)
aLastsSeq.ChangeLast() = aNewL;
else
aFirstsSeq.ChangeLast() = aNewF;
}
else
{
Handle(Geom2d_Curve) aCopyPCurve = Handle(Geom2d_Curve)::DownCast(aPCurve->Copy());
aPCurveSeq.Append(aCopyPCurve);
aFirstsSeq.Append(aFirst);
aLastsSeq.Append(aLast);
aForwardsSeq.Append(isForward);
aCurrentType = aType;
TopoDS_Vertex aV;
TopExp::CommonVertex(aPrevEdge, anEdge, aV);
Standard_Real aTol = BRep_Tool::Tolerance(aV);
aTolVerSeq.Append (aTol);
}
aPrevEdge = anEdge;
}
Handle(Geom2d_Curve) aResPCurve;
Standard_Real aResFirst, aResLast;
if (aPCurveSeq.Length() == 1) {
aResPCurve = aPCurveSeq.Last();
aResFirst = aFirstsSeq.Last();
aResLast = aLastsSeq.Last();
if (aForwardsSeq.Last() == Standard_False)
{
Standard_Real aNewLast = aResPCurve->ReversedParameter (aResFirst);
Standard_Real aNewFirst = aResPCurve->ReversedParameter (aResLast);
aResPCurve->Reverse();
aResFirst = aNewFirst;
aResLast = aNewLast;
}
}
else {
//C1 concatenation for PCurveSeq
TColGeom2d_Array1OfBSplineCurve tab_c2d(0, aPCurveSeq.Length() - 1);
for (Standard_Integer i = 1; i <= aPCurveSeq.Length(); i++) {
Handle(Geom2d_TrimmedCurve) aTrPCurve = new Geom2d_TrimmedCurve(aPCurveSeq(i), aFirstsSeq(i), aLastsSeq(i));
if (aForwardsSeq(i) == Standard_False)
{
aTrPCurve->Reverse();
}
tab_c2d(i - 1) = Geom2dConvert::CurveToBSplineCurve(aTrPCurve);
Geom2dConvert::C0BSplineToC1BSplineCurve(tab_c2d(i - 1), Precision::Confusion());
}
TColStd_Array1OfReal tabtolvertex(0, aTolVerSeq.Length() - 1);
Standard_Real aMaxTol = 0.0;
for (Standard_Integer i = 1; i <= aTolVerSeq.Length(); i++)
{
Standard_Real aTol = aTolVerSeq(i);
tabtolvertex(i - 1) = aTol;
if (aTol > aMaxTol)
aMaxTol = aTol;
}
Handle(TColGeom2d_HArray1OfBSplineCurve) concatc2d; //array of the concatenated curves
Handle(TColStd_HArray1OfInteger) ArrayOfInd2d; //array of the remining Vertex
Standard_Boolean aClosedFlag = Standard_False;
Geom2dConvert::ConcatC1(tab_c2d,
tabtolvertex,
ArrayOfInd2d,
concatc2d,
aClosedFlag,
Precision::Confusion()); //C1 concatenation
if (concatc2d->Length() > 1)
{
Geom2dConvert_CompCurveToBSplineCurve Concat2d(concatc2d->Value(concatc2d->Lower()));
for (Standard_Integer i = concatc2d->Lower() + 1; i <= concatc2d->Upper(); i++)
Concat2d.Add(concatc2d->Value(i), aMaxTol, Standard_True);
concatc2d->SetValue(concatc2d->Lower(), Concat2d.BSplineCurve());
}
Handle(Geom2d_BSplineCurve) aBSplineCurve = concatc2d->Value(concatc2d->Lower());
aResPCurve = aBSplineCurve;
aResFirst = aBSplineCurve->FirstParameter();
aResLast = aBSplineCurve->LastParameter();
}
ResPCurves.Append(aResPCurve);
ResFirsts.Append(aResFirst);
ResLasts.Append(aResLast);
}
BRep_Builder aBuilder;
Standard_Real aTol = BRep_Tool::Tolerance(theEdge);
//Reparametrize pcurves if needed
for (Standard_Integer ii = 2; ii <= ResPCurves.Length(); ii++)
{
if (Abs (ResFirsts(1) - ResFirsts(ii)) > Precision::Confusion() ||
Abs (ResLasts(1) - ResLasts(ii)) > Precision::Confusion())
{
Handle(Geom2d_TrimmedCurve) aTrPCurve =
new Geom2d_TrimmedCurve (ResPCurves(ii), ResFirsts(ii), ResLasts(ii));
Handle(Geom2d_BSplineCurve) aBSplinePCurve = Geom2dConvert::CurveToBSplineCurve(aTrPCurve);
TColStd_Array1OfReal aKnots (1, aBSplinePCurve->NbKnots());
aBSplinePCurve->Knots (aKnots);
BSplCLib::Reparametrize (ResFirsts(1), ResLasts(1), aKnots);
aBSplinePCurve->SetKnots (aKnots);
ResPCurves(ii) = aBSplinePCurve;
}
}
//Reparametrize 3d curve if needed
if (!ResPCurves.IsEmpty())
{
Standard_Real aFirst, aLast;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve (theEdge, aFirst, aLast);
if (Abs (aFirst - ResFirsts(1)) > Precision::Confusion() ||
Abs (aLast - ResLasts(1)) > Precision::Confusion())
{
GeomAdaptor_Curve aGAcurve (aCurve);
GeomAbs_CurveType aType = aGAcurve.GetType();
if (aType == GeomAbs_Line)
{
gp_Lin aLin = aGAcurve.Line();
gp_Dir aDir = aLin.Direction();
gp_Pnt aPnt = aGAcurve.Value (aFirst);
gp_Vec anOffset = -aDir;
anOffset *= ResFirsts(1);
aPnt.Translate (anOffset);
Handle(Geom_Line) aLine = new Geom_Line (aPnt, aDir);
aBuilder.UpdateEdge (theEdge, aLine, aTol);
}
else if (aType == GeomAbs_Circle)
{
gp_Circ aCirc = aGAcurve.Circle();
Standard_Real aRadius = aCirc.Radius();
gp_Ax2 aPosition = aCirc.Position();
gp_Ax1 anAxis = aPosition.Axis();
Standard_Real anOffset = aFirst - ResFirsts(1);
aPosition.Rotate (anAxis, anOffset);
Handle(Geom_Circle) aCircle = new Geom_Circle (aPosition, aRadius);
aBuilder.UpdateEdge (theEdge, aCircle, aTol);
}
else //general case
{
Handle(Geom_TrimmedCurve) aTrCurve =
new Geom_TrimmedCurve (aCurve, aFirst, aLast);
Handle(Geom_BSplineCurve) aBSplineCurve = GeomConvert::CurveToBSplineCurve(aTrCurve);
TColStd_Array1OfReal aKnots (1, aBSplineCurve->NbKnots());
aBSplineCurve->Knots (aKnots);
BSplCLib::Reparametrize (ResFirsts(1), ResLasts(1), aKnots);
aBSplineCurve->SetKnots (aKnots);
aBuilder.UpdateEdge (theEdge, aBSplineCurve, aTol);
}
}
aBuilder.Range(theEdge, ResFirsts(1), ResLasts(1));
}
for (Standard_Integer j = 1; j <= ResPCurves.Length(); j++)
{
aBuilder.UpdateEdge(theEdge, ResPCurves(j), TopoDS::Face(aFaceSeq(j)), aTol);
}
}
//=======================================================================
//function : MergeSubSeq
//purpose : Merges a sequence of edges into one edge if possible
//=======================================================================
static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
TopoDS_Edge& OutEdge,
double theAngTol,
Standard_Boolean ConcatBSplines,
Standard_Boolean isSafeInputMode,
Handle(ShapeBuild_ReShape)& theContext)
Standard_Boolean ShapeUpgrade_UnifySameDomain::MergeSubSeq(const TopTools_SequenceOfShape& theChain,
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
TopoDS_Edge& OutEdge)
{
ShapeAnalysis_Edge sae;
BRep_Builder B;
@@ -1521,12 +1865,12 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
if(c3d1.IsNull() || c3d2.IsNull())
return Standard_False;
while(c3d1->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
if (c3d1->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
Handle(Geom_TrimmedCurve) tc =
Handle(Geom_TrimmedCurve)::DownCast(c3d1);
c3d1 = tc->BasisCurve();
}
while(c3d2->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
if (c3d2->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
Handle(Geom_TrimmedCurve) tc =
Handle(Geom_TrimmedCurve)::DownCast(c3d2);
c3d2 = tc->BasisCurve();
@@ -1536,7 +1880,7 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
Handle(Geom_Line) L2 = Handle(Geom_Line)::DownCast(c3d2);
gp_Dir Dir1 = L1->Position().Direction();
gp_Dir Dir2 = L2->Position().Direction();
if(!Dir1.IsParallel(Dir2,theAngTol))
if (!Dir1.IsParallel (Dir2, myAngTol))
IsUnionOfLinesPossible = Standard_False;
}
else
@@ -1564,15 +1908,15 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
V[1] = sae.LastVertex(TopoDS::Edge(theChain.Last()));
gp_Pnt PV2 = BRep_Tool::Pnt(V[1]);
gp_Vec Vec(PV1, PV2);
if (isSafeInputMode) {
if (mySafeInputMode) {
for (int k = 0; k < 2; k++) {
if (!theContext->IsRecorded(V[k])) {
if (!myContext->IsRecorded(V[k])) {
TopoDS_Vertex Vcopy = TopoDS::Vertex(V[k].EmptyCopied());
theContext->Replace(V[k], Vcopy);
myContext->Replace(V[k], Vcopy);
V[k] = Vcopy;
}
else
V[k] = TopoDS::Vertex(theContext->Apply(V[k]));
V[k] = TopoDS::Vertex (myContext->Apply(V[k]));
}
}
Handle(Geom_Line) L = new Geom_Line(gp_Ax1(PV1,Vec));
@@ -1583,6 +1927,7 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
B.Add (E,V[0]); B.Add (E,V[1]);
B.UpdateVertex(V[0], 0., E, 0.);
B.UpdateVertex(V[1], dist, E, 0.);
UnionPCurves(theChain, E);
OutEdge = E;
return Standard_True;
}
@@ -1593,7 +1938,7 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
TopoDS_Edge FE = TopoDS::Edge(theChain.First());
Handle(Geom_Curve) c3d = BRep_Tool::Curve(FE,f,l);
while(c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
if (c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
Handle(Geom_TrimmedCurve) tc =
Handle(Geom_TrimmedCurve)::DownCast(c3d);
c3d = tc->BasisCurve();
@@ -1638,55 +1983,53 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
B.Add(E,V[1]);
}
}
else {
if (isSafeInputMode) {
else //open chain
{
Standard_Real ParamFirst = BRep_Tool::Parameter(V[0], FE);
TopoDS_Vertex VertexLastOnFE = sae.LastVertex(FE);
Standard_Real ParamLast = BRep_Tool::Parameter(VertexLastOnFE, FE);
if (mySafeInputMode) {
for (int k = 0; k < 2; k++) {
if (!theContext->IsRecorded(V[k])) {
if (!myContext->IsRecorded(V[k])) {
TopoDS_Vertex Vcopy = TopoDS::Vertex(V[k].EmptyCopied());
theContext->Replace(V[k], Vcopy);
myContext->Replace(V[k], Vcopy);
V[k] = Vcopy;
}
else
V[k] = TopoDS::Vertex(theContext->Apply(V[k]));
V[k] = TopoDS::Vertex (myContext->Apply(V[k]));
}
}
gp_Pnt PV1 = BRep_Tool::Pnt(V[0]);
gp_Pnt PV2 = BRep_Tool::Pnt(V[1]);
TopoDS_Vertex VM = sae.LastVertex(FE);
gp_Pnt PVM = BRep_Tool::Pnt(VM);
GC_MakeCircle MC (PV1,PVM,PV2);
Handle(Geom_Circle) C = MC.Value();
gp_Pnt P0 = C->Location();
gp_Dir D1(gp_Vec(P0,PV1));
gp_Dir D2(gp_Vec(P0,PV2));
Standard_Real fpar = C->XAxis().Direction().Angle(D1);
if(fabs(fpar)>Precision::Confusion()) {
// check orientation
gp_Dir ND = C->XAxis().Direction().Crossed(D1);
if(ND.IsOpposite(C->Axis().Direction(),Precision::Confusion())) {
fpar = -fpar;
}
}
Standard_Real lpar = C->XAxis().Direction().Angle(D2);
if(fabs(lpar)>Precision::Confusion()) {
// check orientation
gp_Dir ND = C->XAxis().Direction().Crossed(D2);
if(ND.IsOpposite(C->Axis().Direction(),Precision::Confusion())) {
lpar = -lpar;
}
}
if (lpar < fpar) lpar += 2*M_PI;
Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(C,fpar,lpar);
gp_Pnt PointFirst = BRep_Tool::Pnt(V[0]);
while (Abs(ParamLast - ParamFirst) > 7*M_PI/8)
ParamLast = (ParamFirst + ParamLast)/2;
BRepAdaptor_Curve BAcurveFE(FE);
gp_Pnt PointLast = BAcurveFE.Value(ParamLast);
gp_Pnt Origin = Cir->Circ().Location();
gp_Dir Dir1 = gp_Vec(Origin, PointFirst);
gp_Dir Dir2 = gp_Vec(Origin, PointLast);
gp_Dir Vdir = Dir1 ^ Dir2;
gp_Ax2 anAx2(Origin, Vdir, Dir1);
Handle(Geom_Circle) aNewCircle = new Geom_Circle(anAx2, Cir->Radius());
gp_Pnt PointLastInChain = BRep_Tool::Pnt(V[1]);
gp_Dir DirLastInChain = gp_Vec(Origin, PointLastInChain);
Standard_Real lpar = Dir1.AngleWithRef(DirLastInChain, Vdir);
if (lpar < 0.)
lpar += 2*M_PI;
Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(aNewCircle,0.,lpar);
B.MakeEdge (E,tc,Precision::Confusion());
B.Add(E,V[0]);
B.Add(E,V[1]);
B.UpdateVertex(V[0], fpar, E, 0.);
B.UpdateVertex(V[0], 0., E, 0.);
B.UpdateVertex(V[1], lpar, E, 0.);
}
UnionPCurves(theChain, E);
OutEdge = E;
return Standard_True;
}
if (theChain.Length() > 1 && ConcatBSplines) {
if (theChain.Length() > 1 && myConcatBSplines) {
// second step: union edges with various curves
// skl for bug 0020052 from Mantis: perform such unions
// only if curves are bspline or bezier
@@ -1699,7 +2042,7 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
TopLoc_Location Loc;
Handle(Geom_Curve) c3d = BRep_Tool::Curve(edge,Loc,fp1,lp1);
if(c3d.IsNull()) continue;
while(c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
if (c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
Handle(Geom_TrimmedCurve) tc =
Handle(Geom_TrimmedCurve)::DownCast(c3d);
c3d = tc->BasisCurve();
@@ -1912,15 +2255,10 @@ static void GenerateSubSeq (const TopTools_SequenceOfShape& anInpEdgeSeq,
//function : MergeEdges
//purpose : auxilary
//=======================================================================
static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
const Standard_Real theAngTol,
const Standard_Real theLinTol,
const Standard_Boolean ConcatBSplines,
const Standard_Boolean isSafeInputMode,
Handle(ShapeBuild_ReShape)& theContext,
NCollection_Sequence<SubSequenceOfEdges>& SeqOfSubSeqOfEdges,
const TopTools_MapOfShape& NonMergVrt)
Standard_Boolean ShapeUpgrade_UnifySameDomain::MergeEdges(TopTools_SequenceOfShape& SeqEdges,
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
NCollection_Sequence<SubSequenceOfEdges>& SeqOfSubSeqOfEdges,
const TopTools_MapOfShape& NonMergVrt)
{
TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
Standard_Integer j;
@@ -2001,7 +2339,7 @@ static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
// split chain by vertices at which merging is not possible
NCollection_Sequence<SubSequenceOfEdges> aOneSeq;
GenerateSubSeq(aChain, aOneSeq, IsClosed, theAngTol, theLinTol, VerticesToAvoid, theVFmap);
GenerateSubSeq(aChain, aOneSeq, IsClosed, myAngTol, myLinTol, VerticesToAvoid, theVFmap);
// put sub-chains in the result
SeqOfSubSeqOfEdges.Append(aOneSeq);
@@ -2012,9 +2350,7 @@ static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
TopoDS_Edge UE;
if (SeqOfSubSeqOfEdges(i).SeqsEdges.Length() < 2)
continue;
if (MergeSubSeq(SeqOfSubSeqOfEdges(i).SeqsEdges, theVFmap,
UE, theAngTol,
ConcatBSplines, isSafeInputMode, theContext))
if (MergeSubSeq(SeqOfSubSeqOfEdges(i).SeqsEdges, theVFmap, UE))
SeqOfSubSeqOfEdges(i).UnionEdges = UE;
}
return Standard_True;
@@ -2025,25 +2361,19 @@ static Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
//purpose : Tries to unify the sequence of edges with the set of
// another edges which lies on the same geometry
//=======================================================================
static Standard_Boolean MergeSeq (TopTools_SequenceOfShape& SeqEdges,
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
const Standard_Real theAngTol,
const Standard_Real theLinTol,
const Standard_Boolean ConcatBSplines,
const Standard_Boolean isSafeInputMode,
Handle(ShapeBuild_ReShape)& theContext,
const TopTools_MapOfShape& nonMergVert)
Standard_Boolean ShapeUpgrade_UnifySameDomain::MergeSeq (TopTools_SequenceOfShape& SeqEdges,
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
const TopTools_MapOfShape& nonMergVert)
{
NCollection_Sequence<SubSequenceOfEdges> SeqOfSubsSeqOfEdges;
if (MergeEdges(SeqEdges, theVFmap, theAngTol, theLinTol, ConcatBSplines, isSafeInputMode,
theContext, SeqOfSubsSeqOfEdges, nonMergVert))
if (MergeEdges(SeqEdges, theVFmap, SeqOfSubsSeqOfEdges, nonMergVert))
{
for (Standard_Integer i = 1; i <= SeqOfSubsSeqOfEdges.Length(); i++ )
{
if (SeqOfSubsSeqOfEdges(i).UnionEdges.IsNull())
continue;
theContext->Merge(SeqOfSubsSeqOfEdges(i).SeqsEdges,
myContext->Merge(SeqOfSubsSeqOfEdges(i).SeqsEdges,
SeqOfSubsSeqOfEdges(i).UnionEdges);
}
return Standard_True;
@@ -2143,6 +2473,8 @@ void ShapeUpgrade_UnifySameDomain::Initialize(const TopoDS_Shape& aShape,
myContext->Clear();
myKeepShapes.Clear();
myFacePlaneMap.Clear();
myEFmap.Clear();
myFaceNewFace.Clear();
myHistory->Clear();
}
@@ -2974,6 +3306,9 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
BB.Add(aResult, InternalWires(ii));
aResult.Orientation(RefFaceOrientation);
myContext->Merge(faces, aResult);
//Update the map Face-NewFace
for (Standard_Integer jj = 1; jj <= faces.Length(); jj++)
myFaceNewFace.Bind (faces(jj), aResult);
}
else if (NewFaces.Length() == 1)
{
@@ -2983,6 +3318,9 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
for (Standard_Integer ii = 1; ii <= InternalWires.Length(); ii++)
BB.Add(aNewFace, InternalWires(ii));
myContext->Merge(faces, NewFaces(1));
//Update the map Face-NewFace
for (Standard_Integer jj = 1; jj <= faces.Length(); jj++)
myFaceNewFace.Bind (faces(jj), NewFaces(1));
}
else
{
@@ -3016,6 +3354,9 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
facesForThisFace.Append(faces(jj));
}
myContext->Merge(facesForThisFace, NewFaces(ii));
//Update the map Face-NewFace
for (Standard_Integer jj = 1; jj <= facesForThisFace.Length(); jj++)
myFaceNewFace.Bind (facesForThisFace(jj), NewFaces(ii));
}
}
} //if (faces.Length() > 1)
@@ -3052,8 +3393,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyEdges()
TopTools_MapOfShape aSharedVert;
CheckSharedVertices(aSeqEdges, aMapEdgesVertex, myKeepShapes, aSharedVert);
// Merge the edges avoiding removal of the shared vertices
Standard_Boolean isMerged = MergeSeq(aSeqEdges, aVFmap, myAngTol, myLinTol, myConcatBSplines,
mySafeInputMode, myContext, aSharedVert);
Standard_Boolean isMerged = MergeSeq(aSeqEdges, aVFmap, aSharedVert);
// Collect faces to rebuild
TopTools_IndexedMapOfShape aChangedFaces;
if (isMerged)
@@ -3140,6 +3480,8 @@ void ShapeUpgrade_UnifySameDomain::UnifyEdges()
//=======================================================================
void ShapeUpgrade_UnifySameDomain::Build()
{
TopExp::MapShapesAndAncestors(myInitShape, TopAbs_EDGE, TopAbs_FACE, myEFmap);
if (myUnifyFaces)
UnifyFaces();
if (myUnifyEdges)

View File

@@ -27,6 +27,7 @@
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <Geom_Plane.hxx>
#include <Precision.hxx>
class ShapeBuild_ReShape;
@@ -64,6 +65,13 @@ DEFINE_STANDARD_HANDLE(ShapeUpgrade_UnifySameDomain, Standard_Transient)
//! The algorithm provides a place holder for the history and collects the
//! history by default.
//! To avoid collecting of the history the place holder should be set to null handle.
struct SubSequenceOfEdges
{
TopTools_SequenceOfShape SeqsEdges;
TopoDS_Edge UnionEdges;
};
class ShapeUpgrade_UnifySameDomain : public Standard_Transient
{
@@ -166,6 +174,27 @@ protected:
void IntUnifyFaces(const TopoDS_Shape& theInpShape,
TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces);
//! Splits the sequence of edges into the sequence of chains
Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
NCollection_Sequence<SubSequenceOfEdges>& SeqOfSubSeqOfEdges,
const TopTools_MapOfShape& NonMergVrt);
//! Tries to unify the sequence of edges with the set of
//! another edges which lies on the same geometry
Standard_Boolean MergeSeq(TopTools_SequenceOfShape& SeqEdges,
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
const TopTools_MapOfShape& nonMergVert);
//! Merges a sequence of edges into one edge if possible
Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
TopoDS_Edge& OutEdge);
//! Unifies the pcurve of the chain into one pcurve of the edge
void UnionPCurves(const TopTools_SequenceOfShape& theChain,
TopoDS_Edge& theEdge);
//! Fills the history of the modifications during the operation.
Standard_EXPORT void FillHistory();
@@ -183,6 +212,8 @@ private:
Handle(ShapeBuild_ReShape) myContext;
TopTools_MapOfShape myKeepShapes;
DataMapOfFacePlane myFacePlaneMap;
TopTools_IndexedDataMapOfShapeListOfShape myEFmap;
TopTools_DataMapOfShapeShape myFaceNewFace;
Handle(BRepTools_History) myHistory; //!< The history.
};

View File

@@ -0,0 +1,4 @@
project(TKOpenGles)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
#add_definitions("-DOCCT_OPENGL")

12
src/TKOpenGles/EXTERNLIB Normal file
View File

@@ -0,0 +1,12 @@
TKernel
TKService
TKMath
CSF_TBB
CSF_FREETYPE
CSF_OpenGlesLibs
CSF_user32
CSF_gdi32
CSF_XwLibs
CSF_Appkit
CSF_IOKit
CSF_objc

3
src/TKOpenGles/FILES Normal file
View File

@@ -0,0 +1,3 @@
DEFINES
EXTERNLIB
PACKAGES

1
src/TKOpenGles/PACKAGES Normal file
View File

@@ -0,0 +1 @@
OpenGl

View File

@@ -0,0 +1,3 @@
project(TKOpenGlesTest)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)

View File

@@ -0,0 +1,8 @@
TKernel
TKMath
TKDraw
TKOpenGles
TKService
TKV3d
TKViewerTest
CSF_OpenGlesLibs

2
src/TKOpenGlesTest/FILES Normal file
View File

@@ -0,0 +1,2 @@
EXTERNLIB
PACKAGES

View File

@@ -0,0 +1 @@
OpenGlTest

View File

@@ -1688,7 +1688,12 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft
aFactory = Graphic3d_GraphicDriverFactory::DefaultDriverFactory();
if (aFactory.IsNull())
{
throw Standard_ProgramError("Error: no graphic driver factory found");
Draw::GetInterpretor().Eval ("pload GLES");
aFactory = Graphic3d_GraphicDriverFactory::DefaultDriverFactory();
if (aFactory.IsNull())
{
throw Standard_ProgramError("Error: no graphic driver factory found");
}
}
}
@@ -2020,6 +2025,12 @@ static int VDriver (Draw_Interpretor& theDi, Standard_Integer theArgsNb, const c
{
aNewActive = "tkopengl";
}
else if (TCollection_AsciiString::IsSameString (aNewActive, "gles", false)
|| TCollection_AsciiString::IsSameString (aNewActive, "opengles", false)
|| TCollection_AsciiString::IsSameString (aNewActive, "tkopengles", false))
{
aNewActive = "tkopengles";
}
else if (TCollection_AsciiString::IsSameString (aNewActive, "d3d", false)
|| TCollection_AsciiString::IsSameString (aNewActive, "d3dhost", false)
|| TCollection_AsciiString::IsSameString (aNewActive, "tkd3dhost", false))
@@ -2033,6 +2044,10 @@ static int VDriver (Draw_Interpretor& theDi, Standard_Integer theArgsNb, const c
{
Draw::GetInterpretor().Eval ("pload OPENGL");
}
else if (aNewActive == "tkopengles")
{
Draw::GetInterpretor().Eval ("pload GLES");
}
else if (aNewActive == "tkd3dhost")
{
Draw::GetInterpretor().Eval ("pload D3DHOST");

View File

@@ -32,7 +32,7 @@ CheckIsFeatureRemoved feature3 {v e f}
removefeatures res5 s feature4
checkshape res5
checkprops res5 -s 2387.67 -v 1060.67 -deps 1.e-7
checkprops res5 -s 2387.67 -v 1060.68 -deps 1.e-7
checknbshapes res5 -vertex 67 -edge 100 -wire 35 -face 35 -shell 1 -solid 1 -t
CheckIsFeatureRemoved feature4 {v e f}

View File

@@ -10,6 +10,6 @@ compound s_2 s_25 s_1 s_4 feature
removefeatures result s feature
checkshape result
checkprops result -s 2392.41 -v 1063.75 -deps 1.e-7
checkprops result -s 2392.42 -v 1063.76 -deps 1.e-7
checknbshapes result -vertex 61 -edge 91 -wire 34 -face 33 -shell 1 -solid 1
CheckIsFeatureRemoved feature {e f}

12
tests/bugs/heal/bug31524 Normal file
View File

@@ -0,0 +1,12 @@
puts "TODO OCC31524 ALL: Faulty shapes in variables faulty_1"
puts "==============================================================================================="
puts "0031524: Modeling Algorithms - Unify same domain corrupts shape representing a cylindrical tube"
puts "==============================================================================================="
puts ""
restore [locate_data_file bug31524.brep] shape
unifysamedom res shape
checkshape shape

28
tests/bugs/heal/bug31778 Normal file
View File

@@ -0,0 +1,28 @@
puts "============================================="
puts "OCC31778: UnifySameDomain fails in Debug mode"
puts "============================================="
puts ""
brestore [locate_data_file bug31778.brep] s
explode s
bclearobjects
bcleartools
baddobjects s_1
baddtools s_2 s_3
bfillds
bbop q 1
explode q
unifysamedom result q_1
checkshape result
checknbshapes result -solid 1 -shell 1 -face 19 -wire 21 -edge 51 -vertex 34
set tolres [checkmaxtol result]
if { ${tolres} > 5.e-5} {
puts "Error: bad tolerance of result"
}
checkprops result -v 15173.9

18
tests/bugs/heal/bug32140 Normal file
View File

@@ -0,0 +1,18 @@
puts "=============================================================="
puts "OCC32140: unify same domain calls crossed for opposite vectors"
puts "=============================================================="
puts ""
restore [locate_data_file bug32140.brep] a
unifysamedom result a
checkshape result
checknbshapes result -solid 1 -shell 1 -face 26 -wire 32 -edge 69 -vertex 41
set tolres [checkmaxtol result]
if { ${tolres} > 6.e-6} {
puts "Error: bad tolerance of result"
}