mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Compare commits
70 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
68d403eda6 | ||
|
bbc5899a8c | ||
|
bff660919f | ||
|
c69e0e408f | ||
|
6c2cf030e2 | ||
|
285b5189cd | ||
|
e816dce36e | ||
|
6387996871 | ||
|
0d828ac838 | ||
|
a076535090 | ||
|
1a96d253a5 | ||
|
bbd9292784 | ||
|
ef188756a0 | ||
|
f7ad1e7e37 | ||
|
0c2517292f | ||
|
b8ef513c8f | ||
|
e22a91ccc9 | ||
|
b8db9379fe | ||
|
655e883cb9 | ||
|
9b329b9aa4 | ||
|
43eddb470f | ||
|
b470ebea04 | ||
|
61a05a3658 | ||
|
941f6cae55 | ||
|
a604968547 | ||
|
114db5a5ce | ||
|
3ae8c60b87 | ||
|
442850c032 | ||
|
58210e5983 | ||
|
19ed08fda6 | ||
|
e70625d6b1 | ||
|
395d00e058 | ||
|
d6e050ac44 | ||
|
6498be7036 | ||
|
952a0565d7 | ||
|
e3d4b87912 | ||
|
329e5df986 | ||
|
7fd4958d45 | ||
|
42ddd0028c | ||
|
33425a46b8 | ||
|
ba590cbf15 | ||
|
bc0711a5c3 | ||
|
53219061ca | ||
|
decbff0dfd | ||
|
1507ccda40 | ||
|
478862fcc2 | ||
|
39e6123e3b | ||
|
79d49683d6 | ||
|
72ed06442e | ||
|
02a2beaad9 | ||
|
4bf072e4eb | ||
|
4464c6b591 | ||
|
9299697997 | ||
|
93cdaa76da | ||
|
127330f9d7 | ||
|
374dffea0b | ||
|
e44b849de9 | ||
|
a13df0fee0 | ||
|
930b466c9b | ||
|
a8b605eb5e | ||
|
008210c3e2 | ||
|
92f8ec2f01 | ||
|
9ee2481598 | ||
|
8d55cb22a8 | ||
|
2daa5d95a5 | ||
|
9779ff75fd | ||
|
830616a60b | ||
|
e03a03fdc2 | ||
|
1ff3663c91 | ||
|
665dc9e50b |
@@ -366,10 +366,14 @@ endif()
|
||||
# whether use optional 3rdparty or not
|
||||
if (APPLE)
|
||||
set (USE_GLX OFF CACHE BOOL "${USE_GLX_DESCR}")
|
||||
else()
|
||||
set (USE_GLX OFF)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
set (USE_D3D OFF CACHE BOOL "${USE_D3D_DESCR}")
|
||||
else()
|
||||
set (USE_D3D OFF)
|
||||
endif()
|
||||
|
||||
# Enable/Disable the floating point exceptions (FPE) during runtime.
|
||||
@@ -383,6 +387,15 @@ else()
|
||||
set (BUILD_ENABLE_FPE_SIGNAL_HANDLER 0)
|
||||
endif()
|
||||
|
||||
# OpenGL
|
||||
if (ANDROID OR IOS OR EMSCRIPTEN OR "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
|
||||
set (USE_OPENGL OFF)
|
||||
set (USE_GLES2 ON)
|
||||
else()
|
||||
set (USE_OPENGL ON CACHE BOOL "${USE_OPENGL_DESCR}")
|
||||
set (USE_GLES2 OFF CACHE BOOL "${USE_GLES2_DESCR}")
|
||||
endif()
|
||||
|
||||
# include the patched or original list of modules
|
||||
# list <MODULENAME>_TOOLKITS is created foreach module and contains its toolkits
|
||||
# list <OCCT_MODULES> will contain all modules
|
||||
@@ -414,10 +427,6 @@ if (NOT DEFINED BUILD_DOC_Overview)
|
||||
set (BUILD_DOC_Overview ${CAN_DOXYGEN_BE_USED} CACHE BOOL "${BUILD_DOC_Overview_DESCR}")
|
||||
endif()
|
||||
|
||||
if (NOT USE_D3D)
|
||||
list (REMOVE_ITEM Visualization_TOOLKITS TKD3DHost)
|
||||
endif()
|
||||
|
||||
# accumulate used toolkits (first level) in BUILD_TOOLKITS variable
|
||||
list (APPEND BUILD_TOOLKITS ${BUILD_ADDITIONAL_TOOLKITS})
|
||||
|
||||
@@ -485,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)
|
||||
|
||||
@@ -532,14 +542,6 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# D3D
|
||||
if (USE_D3D)
|
||||
add_definitions (-DHAVE_D3D)
|
||||
#if(MSVC_VERSION LESS 1700)
|
||||
#OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/d3d")
|
||||
#endif()
|
||||
endif()
|
||||
|
||||
# GLX
|
||||
if (USE_GLX)
|
||||
add_definitions (-DMACOSX_USE_GLX)
|
||||
@@ -547,7 +549,6 @@ if (USE_GLX)
|
||||
endif()
|
||||
|
||||
# FREEIMAGE
|
||||
|
||||
if (CAN_USE_FREEIMAGE)
|
||||
set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}")
|
||||
|
||||
@@ -606,23 +607,31 @@ else()
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_FFMPEG")
|
||||
endif()
|
||||
|
||||
# OpenGL
|
||||
if (CAN_USE_OPENGL)
|
||||
if (USE_OPENGL)
|
||||
add_definitions (-DHAVE_OPENGL_EXT)
|
||||
else()
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS TKOpenGl)
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS TKOpenGlTest)
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_OPENGL")
|
||||
endif()
|
||||
|
||||
# OpenGL ES 2.0
|
||||
if (CAN_USE_GLES2)
|
||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
|
||||
set (USE_GLES2 ON)
|
||||
else()
|
||||
set (USE_GLES2 OFF CACHE BOOL "${USE_GLES2_DESCR}")
|
||||
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")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_EGL")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_GLES2")
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS TKOpenGles)
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS TKOpenGlesTest)
|
||||
endif()
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_GLES2")
|
||||
@@ -633,6 +642,17 @@ else()
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_GLES2")
|
||||
endif()
|
||||
|
||||
# D3D
|
||||
if (USE_D3D)
|
||||
add_definitions (-DHAVE_D3D)
|
||||
#if(MSVC_VERSION LESS 1700)
|
||||
#OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/d3d")
|
||||
#endif()
|
||||
else()
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS TKD3DHost)
|
||||
list (REMOVE_ITEM BUILD_TOOLKITS TKD3DHostTest)
|
||||
endif()
|
||||
|
||||
# TBB
|
||||
if (NOT DEFINED ANDROID AND CAN_USE_TBB)
|
||||
set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}")
|
||||
@@ -1139,6 +1159,9 @@ foreach (OCCT_TOOLKIT ${BUILD_TOOLKITS})
|
||||
endforeach()
|
||||
list (REMOVE_DUPLICATES OCCT_MODULES_ENABLED)
|
||||
list (REMOVE_DUPLICATES OCCT_COMPILE_DEFINITIONS)
|
||||
# these macros are defined for specific tookits, not globalwise
|
||||
list (REMOVE_ITEM OCCT_COMPILE_DEFINITIONS HAVE_OPENGL)
|
||||
list (REMOVE_ITEM OCCT_COMPILE_DEFINITIONS HAVE_GLES2)
|
||||
|
||||
# export compile definitions and C/C++ flags for each configuration to OpenCASCADE config files
|
||||
foreach (OCCT_CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
|
||||
|
@@ -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 TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
|
||||
Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
|
||||
|
@@ -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
|
||||
@@ -402,6 +404,9 @@ n HLRTest
|
||||
n MeshTest
|
||||
n SWDRAW
|
||||
n TObjDRAW
|
||||
n OpenGlTest
|
||||
n OpenGlesTest
|
||||
n D3DHostTest
|
||||
n ViewerTest
|
||||
n XDEDRAW
|
||||
n XSDRAW
|
||||
@@ -413,6 +418,9 @@ t TKDCAF
|
||||
t TKDraw
|
||||
t TKTObjDRAW
|
||||
t TKTopTest
|
||||
t TKOpenGlTest
|
||||
t TKOpenGlesTest
|
||||
t TKD3DHostTest
|
||||
t TKViewerTest
|
||||
t TKXDEDRAW
|
||||
t TKXSDRAW
|
||||
|
@@ -1,3 +1,3 @@
|
||||
# EGL
|
||||
|
||||
THIRDPARTY_PRODUCT("EGL" "EGL/egl.h" "CSF_OpenGlLibs" "")
|
||||
THIRDPARTY_PRODUCT("EGL" "EGL/egl.h" "CSF_OpenGlesLibs" "")
|
||||
|
@@ -1,3 +1,3 @@
|
||||
# OpenGL ES 2.0
|
||||
|
||||
THIRDPARTY_PRODUCT("GLES2" "GLES2/gl2.h" "CSF_OpenGlLibs" "")
|
||||
THIRDPARTY_PRODUCT("GLES2" "GLES2/gl2.h" "CSF_OpenGlesLibs" "")
|
||||
|
@@ -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")
|
||||
|
@@ -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})
|
||||
|
@@ -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,
|
||||
|
@@ -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) ""
|
||||
|
@@ -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}
|
||||
|
@@ -15,8 +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)
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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%"
|
||||
|
@@ -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
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -94,6 +94,7 @@ GeomAdaptor_HCurve GeomAdaptor_Curve
|
||||
GeomAdaptor_HSurface GeomAdaptor_Surface
|
||||
GeomAdaptor_HSurfaceOfLinearExtrusion GeomAdaptor_SurfaceOfLinearExtrusion
|
||||
GeomAdaptor_HSurfaceOfRevolution GeomAdaptor_SurfaceOfRevolution
|
||||
PrsMgr_PresentationManager3d PrsMgr_PresentationManager
|
||||
|
||||
[tcollection]
|
||||
AdvApp2Var_SequenceOfNode
|
||||
|
@@ -446,12 +446,7 @@ Download the necessary archive from https://www.vtk.org/VTK/resources/software.h
|
||||
All 3rd-party products required for building of OCCT could be installed
|
||||
from official repositories. You may install them from console using apt-get utility:
|
||||
|
||||
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libxt-dev libxmu-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libfreeimage-dev libtbb-dev
|
||||
|
||||
To launch binaries built with WOK you need to install C shell and 32-bit libraries on x86_64 distributives:
|
||||
|
||||
# you may need to add i386 if not done already by command "dpkg --add-architecture i386"
|
||||
sudo apt-get install csh libstdc++6:i386 libxt6:i386 libxext6:i386 libxmu6:i386
|
||||
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libxt-dev libxmu-dev libxi-dev libgl1-mesa-dev libfreeimage-dev
|
||||
|
||||
Building is possible with C++ compliant compiler:
|
||||
|
||||
|
@@ -15,8 +15,6 @@ On OS X we recommend to use native libraries.
|
||||
|
||||
This article describes the **CMake**-based build process, which is now suggested as a standard way to produce the binaries of Open CASCADE Technology from sources. *OCCT requires CMake version 2.8.12 or later*.
|
||||
|
||||
@note Compared to the previous (6.x) releases of Open CASCADE Technology, OCCT 7.x has a complete set of CMake scripts and projects, so that there is no need to use WOK anymore. Moreover, CMake gives you a powerful configuration tool, which allows to control many aspects of OCCT deployment. At the same time this tool is quite intuitive, which is a significant advantage over the legacy WOK utilities.
|
||||
|
||||
Here we describe the build procedure on the example of Windows platform with Visual Studio 2010.
|
||||
However, CMake is cross-platform and can be used to build OCCT on Linux and OS X in essentially the same way.
|
||||
|
||||
|
@@ -391,7 +391,7 @@ Ray tracing requires OpenGL 4.0+ or OpenGL 3.3+ with *GL_ARB_texture_buffer_obje
|
||||
Textures within ray tracing will be available only when *GL_ARB_bindless_texture extension* is provided by driver.
|
||||
|
||||
On mobile platforms, OpenGL ES 2.0+ is required for 3D viewer (OpenGL ES 3.1+ is recommended).
|
||||
The ray tracing is not yet available on mobile platforms.
|
||||
Ray tracing requires OpenGL ES 3.2.
|
||||
Some old hardware might be unable to execute complex GLSL programs (e.g. with high number of light sources, clipping planes).
|
||||
|
||||
OCCT 3D Viewer, in general, supports wide range of graphics hardware - from very old to new.
|
||||
|
@@ -884,7 +884,7 @@ Old APIs based on global callback functions for creating *UserDraw* objects and
|
||||
class UserDrawElement : public OpenGl_Element {};
|
||||
|
||||
//! Implementation of virtual method AIS_InteractiveObject::Compute().
|
||||
void UserDrawObject::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
void UserDrawObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
@@ -2210,3 +2210,30 @@ BRep and Binary BRep Shape formats (only in case of triangulation-only Faces, wi
|
||||
|
||||
Versions of formats have been changed (11 for BinOCAF, 10 for XmlOCAF, 4 for BRep Shape and 3 for Binary BRep Shape).
|
||||
Files written with the new version will not be readable by applications of old versions.
|
||||
|
||||
@subsection upgrade_occt760_poly Changes in *Poly* package and *Poly_Triangulation* class
|
||||
|
||||
*Poly_Triangulation* does no more provide access to internal array structures: methods Nodes(), ChangeNode(), Triangles(), ChangeTriangle(), UVNodes(), ChangeUVNode(), Normals() have been removed.
|
||||
Methods of *Poly_Triangulation* for accessing individual nodal properties / triangles by index and implementing copy semantics should be used instead.
|
||||
The same is applicable to *Poly_PolygonOnTriangulation* interface.
|
||||
|
||||
@subsection upgrade_occt760_glsl Custom GLSL programs
|
||||
|
||||
Accessors to standard materials have been modified within *Declarations.glsl* (*occFrontMaterial_Diffuse()* -> *occMaterial_Diffuse(bool)* and similar).
|
||||
Applications defining custom GLSL programs should take into account syntax changes.
|
||||
|
||||
@subsection upgrade_occt760_noral_colors Nodal color modulation
|
||||
|
||||
Nodal color vertex attribute is now modulated in the same way as a color texture - color is multiplied by material coefficients (diffuse/ambient/specular in case of a common material definition).
|
||||
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.
|
||||
|
@@ -1465,17 +1465,6 @@ vchangeselected shape
|
||||
~~~~~
|
||||
Adds a shape to selection or removes one from it.
|
||||
|
||||
@subsubsection occt_draw_4_2_15 vzclipping
|
||||
|
||||
Syntax:
|
||||
~~~~~
|
||||
vzclipping [mode] [depth width]
|
||||
~~~~~
|
||||
Gets or sets ZClipping mode, width and depth, where
|
||||
- *mode = OFF|BACK|FRONT|SLICE*
|
||||
- *depth* is a real value from segment [0,1]
|
||||
- *width* is a real value from segment [0,1]
|
||||
|
||||
@subsubsection occt_draw_4_2_16 vnbselected
|
||||
|
||||
Syntax:
|
||||
@@ -1484,14 +1473,6 @@ vnbselected
|
||||
~~~~~
|
||||
Returns the number of selected objects in the interactive context.
|
||||
|
||||
@subsubsection occt_draw_4_2_18 vpurgedisplay
|
||||
|
||||
Syntax:
|
||||
~~~~~
|
||||
vpurgedisplay [CollectorToo = 0|1]
|
||||
~~~~~
|
||||
Removes structures which do not belong to objects displayed in neutral point.
|
||||
|
||||
@subsubsection occt_draw_4_2_19 vhlr
|
||||
|
||||
Syntax:
|
||||
|
@@ -551,7 +551,7 @@ If you are creating your own type of interactive object, you must implement the
|
||||
#### For 3D:
|
||||
|
||||
~~~~~{.cpp}
|
||||
void PackageName_ClassName::Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
void PackageName_ClassName::Compute (const Handle(PrsMgr_PresentationManager)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode);
|
||||
~~~~~
|
||||
@@ -650,7 +650,7 @@ Standard_Boolean myPk_IShape::AcceptDisplayMode (const Standard_Integer theMode)
|
||||
return theMode == 0 || theMode == 1;
|
||||
}
|
||||
|
||||
void myPk_IShape::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
void myPk_IShape::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
@@ -2096,7 +2096,7 @@ i.e. in hidden line removal and wireframe modes.
|
||||
Let us look at the example of compute methods
|
||||
|
||||
~~~~~{.cpp}
|
||||
void MyPresentableObject::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsManager,
|
||||
void MyPresentableObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsManager,
|
||||
const Handle(Graphic3d_Structure)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
(
|
||||
|
@@ -46,7 +46,7 @@ AdaptorCurve2d_AIS::AdaptorCurve2d_AIS (const Handle(Geom2d_Curve)& theGeom2dCur
|
||||
//
|
||||
}
|
||||
|
||||
void AdaptorCurve2d_AIS::Compute (const Handle(PrsMgr_PresentationManager3d)&,
|
||||
void AdaptorCurve2d_AIS::Compute (const Handle(PrsMgr_PresentationManager)&,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
|
@@ -53,7 +53,7 @@ private:
|
||||
virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
|
||||
|
||||
//! Compute presentation.
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#include <StdPrs_PoleCurve.hxx>
|
||||
#include <StdPrs_Curve.hxx>
|
||||
|
||||
void AdaptorCurve_AIS::Compute (const Handle(PrsMgr_PresentationManager3d)&,
|
||||
void AdaptorCurve_AIS::Compute (const Handle(PrsMgr_PresentationManager)&,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
|
@@ -37,7 +37,7 @@ private:
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0 || theMode == 1; }
|
||||
|
||||
//! Compute presentation.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
|
@@ -24,7 +24,7 @@
|
||||
#include <Geom_CartesianPoint.hxx>
|
||||
#include <StdPrs_Point.hxx>
|
||||
|
||||
void AdaptorPnt2d_AIS::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
void AdaptorPnt2d_AIS::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
|
@@ -40,7 +40,7 @@ private:
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
|
||||
|
||||
//! Compute presentation.
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
|
@@ -39,7 +39,7 @@ AdaptorVec_AIS::AdaptorVec_AIS (const gp_Pnt2d& thePnt1,
|
||||
myLength = aVec.Magnitude();
|
||||
}
|
||||
|
||||
void AdaptorVec_AIS::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
void AdaptorVec_AIS::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
|
@@ -101,7 +101,7 @@ private:
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
|
||||
|
||||
//! Compute presentation.
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
|
@@ -219,7 +219,7 @@ void Sample2D_Face::FillData(Standard_Boolean isSizesRecompute)
|
||||
}
|
||||
}
|
||||
|
||||
void Sample2D_Face::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
void Sample2D_Face::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
@@ -303,7 +303,7 @@ void Sample2D_Face::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
thePresentation->CurrentGroup()->AddPrimitiveArray(myExternalArray);
|
||||
}
|
||||
|
||||
void Sample2D_Face::HilightSelected (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
void Sample2D_Face::HilightSelected (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const SelectMgr_SequenceOfOwner& theOwners)
|
||||
{
|
||||
Handle(Prs3d_Presentation) aSelectionPrs = GetSelectPresentation (thePrsMgr);
|
||||
@@ -368,7 +368,7 @@ void Sample2D_Face::ClearSelected()
|
||||
}
|
||||
}
|
||||
|
||||
void Sample2D_Face::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
void Sample2D_Face::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Handle(Prs3d_Drawer)& theStyle,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner)
|
||||
{
|
||||
|
@@ -56,7 +56,7 @@ private:
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
|
||||
|
||||
//! Compute presentation.
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
@@ -67,11 +67,11 @@ private:
|
||||
virtual void ClearSelected() Standard_OVERRIDE;
|
||||
|
||||
//! Method for advanced customizable selection of picked object
|
||||
virtual void HilightSelected (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
virtual void HilightSelected (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const SelectMgr_SequenceOfOwner& theOwners) Standard_OVERRIDE;
|
||||
|
||||
//! Method for advanced customizable highlighting of picked object.
|
||||
virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Handle(Prs3d_Drawer)& theStyle,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
|
||||
|
||||
|
@@ -54,7 +54,7 @@ Sample2D_Markers::Sample2D_Markers (const Standard_Real theXPosition,
|
||||
myArrayOfPoints = theArrayOfPoints;
|
||||
}
|
||||
|
||||
void Sample2D_Markers::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
void Sample2D_Markers::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
|
@@ -61,7 +61,7 @@ private:
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
|
||||
|
||||
//! Compute presentation.
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& /*aPresentation*/,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
|
@@ -70,14 +70,9 @@ void TriangulationSamples::Triangulation3dSample()
|
||||
TopLoc_Location aLocation;
|
||||
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(aFace, aLocation);
|
||||
|
||||
TColgp_Array1OfPnt aTriangNodes(1, (aTriangulation->NbNodes()));
|
||||
aTriangNodes = aTriangulation->Nodes();
|
||||
Poly_Array1OfTriangle aTriangles(1, aTriangulation->NbTriangles());
|
||||
aTriangles = aTriangulation->Triangles();
|
||||
|
||||
for (Standard_Integer i = 1; i <= (aTriangulation->NbTriangles()); i++)
|
||||
for (Standard_Integer i = 1; i <= aTriangulation->NbTriangles(); i++)
|
||||
{
|
||||
Poly_Triangle trian = aTriangles.Value(i);
|
||||
const Poly_Triangle trian = aTriangulation->Triangle (i);
|
||||
Standard_Integer index1, index2, index3, M = 0, N = 0;
|
||||
trian.Get(index1, index2, index3);
|
||||
|
||||
@@ -96,7 +91,7 @@ void TriangulationSamples::Triangulation3dSample()
|
||||
M = index2;
|
||||
}
|
||||
|
||||
BRepBuilderAPI_MakeEdge anEdgeMaker(aTriangNodes.Value(M), aTriangNodes.Value(N));
|
||||
BRepBuilderAPI_MakeEdge anEdgeMaker(aTriangulation->Node (M), aTriangulation->Node (N));
|
||||
if (anEdgeMaker.IsDone())
|
||||
{
|
||||
aBuilder.Add(aCompound, anEdgeMaker.Edge());
|
||||
|
@@ -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 */,
|
||||
|
@@ -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))
|
||||
{
|
||||
|
@@ -11,7 +11,7 @@ set (anOcctLibs
|
||||
TKIGES
|
||||
TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP
|
||||
# OCCT Visualization
|
||||
TKService TKHLR TKV3d TKOpenGl
|
||||
TKService TKHLR TKV3d TKOpenGles
|
||||
)
|
||||
|
||||
set(aLibDeps "")
|
||||
|
@@ -1217,14 +1217,12 @@ void CGeometryDoc::simplify(const TopoDS_Shape& aShape)
|
||||
"\n"
|
||||
" if(!aTr.IsNull())\n"
|
||||
" { \n"
|
||||
" // takes the array of nodes for this triangulation\n"
|
||||
" const TColgp_Array1OfPnt& aNodes = aTr->Nodes(); \n"
|
||||
" nbNodes = aNodes.Length();\n"
|
||||
" nbNodes = aTr->NbNodes();\n"
|
||||
"\n"
|
||||
" for( Standard_Integer i = 1; i <= nbNodes; i++)\n"
|
||||
" {\n"
|
||||
" // create seguence of node points in absolute coordinate system\n"
|
||||
" gp_Pnt aPnt = aNodes(i).Transformed(aLocation);\n"
|
||||
" gp_Pnt aPnt = aTr->Node (i).Transformed (aLocation);\n"
|
||||
" aPoints.Append(aPnt);\n"
|
||||
" \n"
|
||||
" }\n"
|
||||
@@ -1371,13 +1369,12 @@ void CGeometryDoc::simplify(const TopoDS_Shape& aShape)
|
||||
if(!aTr.IsNull())
|
||||
{
|
||||
// takes the array of nodes for this triangulation
|
||||
const TColgp_Array1OfPnt& aNodes = aTr->Nodes();
|
||||
nbNodes = aNodes.Length();
|
||||
nbNodes = aTr->NbNodes();
|
||||
|
||||
for( Standard_Integer i = 1; i <= nbNodes; i++)
|
||||
{
|
||||
// create seguence of node points in absolute coordinate system
|
||||
gp_Pnt aPnt = aNodes(i).Transformed(aLocation);
|
||||
gp_Pnt aPnt = aTr->Node (i).Transformed (aLocation);
|
||||
aPoints.Append(aPnt);
|
||||
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ ISession2D_Curve::ISession2D_Curve(const Handle(Geom2d_Curve) aGeom2dCurve,
|
||||
myradiusratio = 1;
|
||||
}
|
||||
|
||||
void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer )
|
||||
{
|
||||
|
@@ -63,7 +63,7 @@ private:
|
||||
|
||||
// Methods PRIVATE
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const { return theMode == 0; }
|
||||
virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
|
||||
virtual void Compute(const Handle(PrsMgr_PresentationManager)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
|
||||
void ComputeSelection(const Handle(SelectMgr_Selection)& ,const Standard_Integer ) {}
|
||||
|
||||
// Fields PRIVATE
|
||||
|
@@ -14,7 +14,7 @@ IMPLEMENT_STANDARD_RTTIEXT(ISession_Curve,AIS_InteractiveObject)
|
||||
static char THIS_FILE[]=__FILE__;
|
||||
#endif
|
||||
|
||||
void ISession_Curve::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
void ISession_Curve::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
|
@@ -17,7 +17,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
|
||||
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
|
||||
virtual void ComputeSelection (const Handle(SelectMgr_Selection)& ,const Standard_Integer ) {}
|
||||
|
||||
private:
|
||||
|
@@ -69,7 +69,7 @@ ISession_Direction::~ISession_Direction()
|
||||
|
||||
}
|
||||
|
||||
void ISession_Direction::Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
void ISession_Direction::Compute (const Handle(PrsMgr_PresentationManager)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer /*aMode*/)
|
||||
{
|
||||
|
@@ -30,7 +30,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
|
||||
void Compute (const Handle(PrsMgr_PresentationManager)& aPresentationManager,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer aMode);
|
||||
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode) ;
|
||||
|
@@ -41,7 +41,7 @@ ISession_Point::~ISession_Point()
|
||||
|
||||
}
|
||||
|
||||
void ISession_Point::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
void ISession_Point::Compute(const Handle(PrsMgr_PresentationManager)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer /*aMode*/)
|
||||
{
|
||||
|
@@ -26,7 +26,7 @@ public:
|
||||
|
||||
private :
|
||||
|
||||
void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
|
||||
void Compute (const Handle(PrsMgr_PresentationManager)& aPresentationManager,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer aMode);
|
||||
|
||||
|
@@ -18,7 +18,7 @@ static char THIS_FILE[]=__FILE__;
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(ISession_Surface,AIS_InteractiveObject)
|
||||
|
||||
void ISession_Surface::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
void ISession_Surface::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
|
@@ -17,7 +17,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0);
|
||||
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0);
|
||||
virtual void ComputeSelection (const Handle(SelectMgr_Selection)& ,const Standard_Integer ) {}
|
||||
|
||||
private:
|
||||
|
@@ -215,7 +215,7 @@
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
|
@@ -31,7 +31,7 @@ ISession_Direction::ISession_Direction(const gp_Pnt& aPnt,const gp_Vec& aVec)
|
||||
}
|
||||
|
||||
|
||||
void ISession_Direction::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
void ISession_Direction::Compute(const Handle(PrsMgr_PresentationManager)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer /*aMode*/)
|
||||
{
|
||||
|
@@ -28,7 +28,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
|
||||
void Compute (const Handle(PrsMgr_PresentationManager)& aPresentationManager,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer aMode);
|
||||
|
||||
|
@@ -31,7 +31,7 @@ ISession_Curve::~ISession_Curve()
|
||||
{
|
||||
|
||||
}
|
||||
void ISession_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
void ISession_Curve::Compute(const Handle(PrsMgr_PresentationManager)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer /*aMode*/)
|
||||
{
|
||||
|
@@ -23,7 +23,7 @@ public:
|
||||
DEFINE_STANDARD_RTTIEXT(ISession_Curve,AIS_InteractiveObject)
|
||||
private:
|
||||
|
||||
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
|
||||
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
|
||||
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode) ;
|
||||
|
||||
Handle(Geom_Curve) myCurve;
|
||||
|
@@ -31,7 +31,7 @@ ISession_Curve::~ISession_Curve()
|
||||
{
|
||||
|
||||
}
|
||||
void ISession_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
void ISession_Curve::Compute(const Handle(PrsMgr_PresentationManager)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer /*aMode*/)
|
||||
{
|
||||
|
@@ -23,7 +23,7 @@ public:
|
||||
DEFINE_STANDARD_RTTIEXT(ISession_Curve,AIS_InteractiveObject)
|
||||
private:
|
||||
|
||||
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
|
||||
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
|
||||
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode) ;
|
||||
|
||||
Handle(Geom_Curve) myCurve;
|
||||
|
@@ -126,15 +126,10 @@ void Tesselate_Presentation::tesselateShape(const TopoDS_Shape& aShape)
|
||||
|
||||
" if(!aTr.IsNull()) // if this triangulation is not NULL" EOL
|
||||
" { " EOL
|
||||
" // takes the array of nodes for this triangulation:" EOL
|
||||
" const TColgp_Array1OfPnt& aNodes = aTr->Nodes();" EOL
|
||||
" // takes the array of triangles for this triangulation:" EOL
|
||||
" const Poly_Array1OfTriangle& triangles = aTr->Triangles();" EOL EOL
|
||||
|
||||
" // create array of node points in absolute coordinate system" EOL
|
||||
" TColgp_Array1OfPnt aPoints(1, aNodes.Length());" EOL
|
||||
" for( Standard_Integer i = 1; i < aNodes.Length()+1; i++)" EOL
|
||||
" aPoints(i) = aNodes(i).Transformed(aLocation);" EOL EOL
|
||||
" TColgp_Array1OfPnt aPoints(1, aTr->NbNodes());" EOL
|
||||
" for( Standard_Integer i = 1; i < aTr->NbNodes()+1; i++)" EOL
|
||||
" aPoints(i) = aTr->Node (i).Transformed (aLocation);" EOL EOL
|
||||
|
||||
" // Takes the node points of each triangle of this triangulation." EOL
|
||||
" // takes a number of triangles:" EOL
|
||||
@@ -143,7 +138,7 @@ void Tesselate_Presentation::tesselateShape(const TopoDS_Shape& aShape)
|
||||
" for( nt = 1 ; nt < nnn+1 ; nt++)" EOL
|
||||
" {" EOL
|
||||
" // takes the node indices of each triangle in n1,n2,n3:" EOL
|
||||
" triangles(nt).Get(n1,n2,n3);" EOL
|
||||
" aTr->Triangle (nt).Get (n1,n2,n3);" EOL
|
||||
" // takes the node points:" EOL
|
||||
" gp_Pnt aPnt1 = aPoints(n1);" EOL
|
||||
" gp_Pnt aPnt2 = aPoints(n2);" EOL
|
||||
@@ -211,11 +206,9 @@ void Tesselate_Presentation::tesselateShape(const TopoDS_Shape& aShape)
|
||||
|
||||
if(!aTr.IsNull())
|
||||
{
|
||||
const TColgp_Array1OfPnt& aNodes = aTr->Nodes();
|
||||
aNumOfNodes += aTr->NbNodes();
|
||||
//Standard_Integer aLower = aNodes.Lower();
|
||||
//Standard_Integer anUpper = aNodes.Upper();
|
||||
const Poly_Array1OfTriangle& triangles = aTr->Triangles();
|
||||
aNumOfTriangles += aTr->NbTriangles();
|
||||
|
||||
if(aCount == aNumOfFace)
|
||||
@@ -251,8 +244,8 @@ void Tesselate_Presentation::tesselateShape(const TopoDS_Shape& aShape)
|
||||
Standard_Integer aLower = aNodesOfPol.Lower(), anUpper = aNodesOfPol.Upper();
|
||||
for( int i = aLower; i < anUpper ; i++)
|
||||
{
|
||||
gp_Pnt aPnt1 = aNodes(aNodesOfPol(i)).Transformed(aLocation);
|
||||
gp_Pnt aPnt2 = aNodes(aNodesOfPol(i+1)).Transformed(aLocation);
|
||||
gp_Pnt aPnt1 = aTr->Node (aNodesOfPol (i)).Transformed (aLocation);
|
||||
gp_Pnt aPnt2 = aTr->Node (aNodesOfPol (i+1)).Transformed (aLocation);
|
||||
TopoDS_Vertex aVertex1 = BRepBuilderAPI_MakeVertex (aPnt1);
|
||||
TopoDS_Vertex aVertex2 = BRepBuilderAPI_MakeVertex (aPnt2);
|
||||
|
||||
@@ -283,9 +276,9 @@ void Tesselate_Presentation::tesselateShape(const TopoDS_Shape& aShape)
|
||||
TopTools_DataMapOfIntegerShape aEdges;
|
||||
TopTools_SequenceOfShape aVertices;
|
||||
|
||||
for( Standard_Integer i = 1; i < aNodes.Length()+1; i++)
|
||||
for( Standard_Integer i = 1; i < aTr->NbNodes()+1; i++)
|
||||
{
|
||||
gp_Pnt aPnt = aNodes(i).Transformed(aLocation);
|
||||
gp_Pnt aPnt = aTr->Node (i).Transformed (aLocation);
|
||||
TopoDS_Vertex aVertex = BRepBuilderAPI_MakeVertex(aPnt);
|
||||
|
||||
if(!aVertex.IsNull())
|
||||
@@ -302,7 +295,7 @@ void Tesselate_Presentation::tesselateShape(const TopoDS_Shape& aShape)
|
||||
|
||||
for( nt = 1 ; nt < nnn+1 ; nt++)
|
||||
{
|
||||
triangles(nt).Get(n1,n2,n3);
|
||||
aTr->Triangle (nt).Get (n1,n2,n3);
|
||||
|
||||
Standard_Integer key[3];
|
||||
|
||||
|
@@ -157,13 +157,9 @@ for (TopExp_Explorer ex(ShapeFused,TopAbs_FACE) ; ex.More(); ex.Next()) {
|
||||
TopoDS_Face F =TopoDS::Face(ex.Current());
|
||||
TopLoc_Location L;
|
||||
Handle (Poly_Triangulation) facing = BRep_Tool::Triangulation(F,L);
|
||||
TColgp_Array1OfPnt tab(1,(facing->NbNodes()));
|
||||
tab = facing->Nodes();
|
||||
Poly_Array1OfTriangle tri(1,facing->NbTriangles());
|
||||
tri = facing->Triangles();
|
||||
|
||||
for (Standard_Integer i=1;i<=(facing->NbTriangles());i++) {
|
||||
Poly_Triangle trian = tri.Value(i);
|
||||
const Poly_Triangle trian = facing->Triangle (i);
|
||||
Standard_Integer index1,index2,index3,M = 0, N = 0;
|
||||
trian.Get(index1,index2,index3);
|
||||
|
||||
@@ -180,7 +176,7 @@ for (TopExp_Explorer ex(ShapeFused,TopAbs_FACE) ; ex.More(); ex.Next()) {
|
||||
M = index2;
|
||||
}
|
||||
|
||||
BRepBuilderAPI_MakeEdge ME(tab.Value(M),tab.Value(N));
|
||||
BRepBuilderAPI_MakeEdge ME(facing->Node (M), facing->Node (N));
|
||||
if (ME.IsDone()) {
|
||||
builder.Add(Comp,ME.Edge());
|
||||
}
|
||||
@@ -210,13 +206,9 @@ for (TopExp_Explorer ex(ShapeFused,TopAbs_FACE) ; ex.More(); ex.Next()) { \n\
|
||||
TopoDS_Face F =TopoDS::Face(ex.Current()); \n\
|
||||
TopLoc_Location L; \n\
|
||||
Handle (Poly_Triangulation) facing = BRep_Tool::Triangulation(F,L); \n\
|
||||
TColgp_Array1OfPnt tab(1,(facing->NbNodes())); \n\
|
||||
tab = facing->Nodes(); \n\
|
||||
Poly_Array1OfTriangle tri(1,facing->NbTriangles()); \n\
|
||||
tri = facing->Triangles(); \n\
|
||||
\n\
|
||||
\n\
|
||||
for (Standard_Integer i=1;i<=(facing->NbTriangles());i++) { \n\
|
||||
Poly_Triangle trian = tri.Value(i); \n\
|
||||
Poly_Triangle trian = facing->Triangle (i); \n\
|
||||
Standard_Integer index1,index2,index3,M,N; \n\
|
||||
trian.Get(index1,index2,index3); \n\
|
||||
\n\
|
||||
@@ -233,7 +225,7 @@ for (TopExp_Explorer ex(ShapeFused,TopAbs_FACE) ; ex.More(); ex.Next()) { \n\
|
||||
M = index2; \n\
|
||||
} \n\
|
||||
\n\
|
||||
BRepBuilderAPI_MakeEdge ME(tab.Value(M),tab.Value(N)); \n\
|
||||
BRepBuilderAPI_MakeEdge ME(facing->Node (M),facing->Node (N)); \n\
|
||||
if (ME.IsDone()) { \n\
|
||||
builder.Add(Comp,ME.Edge()); \n\
|
||||
} \n\
|
||||
|
@@ -31,7 +31,7 @@ ISession_Curve::~ISession_Curve()
|
||||
{
|
||||
|
||||
}
|
||||
void ISession_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
void ISession_Curve::Compute(const Handle(PrsMgr_PresentationManager)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer /*aMode*/)
|
||||
{
|
||||
|
@@ -23,7 +23,7 @@ public:
|
||||
DEFINE_STANDARD_RTTIEXT(ISession_Curve,AIS_InteractiveObject)
|
||||
private:
|
||||
|
||||
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
|
||||
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
|
||||
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode) ;
|
||||
|
||||
Handle(Geom_Curve) myCurve;
|
||||
|
@@ -75,7 +75,7 @@ void ISession2D_Shape::BuildPolyAlgo()
|
||||
myPolyAlgo->Update();
|
||||
}
|
||||
|
||||
void ISession2D_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePresentationManager*/,
|
||||
void ISession2D_Shape::Compute(const Handle(PrsMgr_PresentationManager)& /*thePresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
|
@@ -51,7 +51,7 @@ private:
|
||||
const TopoDS_Shape& theCompound,
|
||||
const Handle(Prs3d_LineAspect) theAspect);
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0);
|
||||
|
||||
|
@@ -171,7 +171,7 @@ void Sample2D_Face::FillData(Standard_Boolean isSizesRecompute)
|
||||
}
|
||||
}
|
||||
|
||||
void Sample2D_Face::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePresentationManager*/,
|
||||
void Sample2D_Face::Compute (const Handle(PrsMgr_PresentationManager)& /*thePresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
@@ -257,7 +257,7 @@ void Sample2D_Face::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
|
||||
|
||||
//Method for advanced customizable selection of picked object
|
||||
void Sample2D_Face::HilightSelected
|
||||
( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
( const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const SelectMgr_SequenceOfOwner& theOwners)
|
||||
{
|
||||
Handle( Prs3d_Presentation ) aSelectionPrs;
|
||||
@@ -329,7 +329,7 @@ void Sample2D_Face::ClearSelected ()
|
||||
|
||||
|
||||
//Method for advanced customizable highlighting of picked object
|
||||
void Sample2D_Face::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
void Sample2D_Face::HilightOwnerWithColor ( const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Handle(Prs3d_Drawer)& theStyle,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner)
|
||||
{
|
||||
|
@@ -49,14 +49,14 @@ private:
|
||||
//private methods
|
||||
void FillData(Standard_Boolean isSizesRecomputed = Standard_False);
|
||||
void ClearSelected ();
|
||||
void HilightSelected( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
void HilightSelected( const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const SelectMgr_SequenceOfOwner& theOwners);
|
||||
|
||||
void HilightOwnerWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
void HilightOwnerWithColor( const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Handle(Prs3d_Drawer)& theStyle,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner);
|
||||
|
||||
void Compute ( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
void Compute ( const Handle(PrsMgr_PresentationManager)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode);
|
||||
|
||||
|
@@ -36,7 +36,7 @@ Sample2D_Markers::Sample2D_Markers (const Standard_Real theXPosition,
|
||||
}
|
||||
|
||||
|
||||
void Sample2D_Markers::Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
void Sample2D_Markers::Compute (const Handle(PrsMgr_PresentationManager)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer /*aMode*/)
|
||||
{
|
||||
|
@@ -37,7 +37,7 @@ DEFINE_STANDARD_RTTIEXT(Sample2D_Markers,AIS_InteractiveObject)
|
||||
|
||||
private:
|
||||
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& /*aPresentation*/,
|
||||
const Standard_Integer /*aMode*/);
|
||||
|
||||
|
@@ -70,7 +70,7 @@
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
#include <Prs3d_Text.hxx>
|
||||
|
||||
|
@@ -11,7 +11,7 @@ IMPLEMENT_STANDARD_RTTIEXT(User_Cylinder,AIS_InteractiveObject)
|
||||
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_StructureManager.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
#include <StdPrs_ToolTriangulatedShape.hxx>
|
||||
#include <Poly_Connect.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
@@ -49,7 +49,7 @@ AIS_InteractiveObject(PrsMgr_TOP_ProjectorDependant)
|
||||
myColor = Quantity_NOC_KHAKI4;
|
||||
}
|
||||
|
||||
void User_Cylinder::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
void User_Cylinder::Compute(const Handle(PrsMgr_PresentationManager)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer aMode )
|
||||
{
|
||||
@@ -158,10 +158,6 @@ case 6: //color
|
||||
return;
|
||||
}
|
||||
|
||||
const TColgp_Array1OfPnt& Nodes= myT->Nodes();
|
||||
|
||||
const Poly_Array1OfTriangle& triangles = myT->Triangles();
|
||||
|
||||
Standard_Integer nnn = myT->NbTriangles(); // nnn : nombre de triangles
|
||||
Standard_Integer nt, n1, n2, n3 = 0;// nt : triangle courant
|
||||
// ni : sommet i du triangle courant
|
||||
@@ -171,15 +167,15 @@ case 6: //color
|
||||
// triangles(nt).Get(n1,n2,n3); // le triangle est n1,n2,n3
|
||||
|
||||
if (myFace.Orientation() == TopAbs_REVERSED) // si la face est "reversed"
|
||||
triangles(nt).Get(n1,n3,n2); // le triangle est n1,n3,n2
|
||||
myT->Triangle (nt).Get (n1,n3,n2); // le triangle est n1,n3,n2
|
||||
else
|
||||
triangles(nt).Get(n1,n2,n3); // le triangle est n1,n2,n3
|
||||
myT->Triangle (nt).Get (n1,n2,n3); // le triangle est n1,n2,n3
|
||||
|
||||
if (TriangleIsValid (Nodes(n1),Nodes(n2),Nodes(n3)) )
|
||||
if (TriangleIsValid (myT->Node (n1), myT->Node (n2), myT->Node (n3)) )
|
||||
{ // Associates a vertexNT to each node
|
||||
gp_Pnt p = Nodes(n1).Transformed(myLocation.Transformation());
|
||||
gp_Pnt q = Nodes(n2).Transformed(myLocation.Transformation());
|
||||
gp_Pnt r = Nodes(n3).Transformed(myLocation.Transformation());
|
||||
gp_Pnt p = myT->Node (n1).Transformed (myLocation.Transformation());
|
||||
gp_Pnt q = myT->Node (n2).Transformed (myLocation.Transformation());
|
||||
gp_Pnt r = myT->Node (n3).Transformed (myLocation.Transformation());
|
||||
|
||||
if (p.Z() > H.Z()) H=p;
|
||||
if (q.Z() > H.Z()) H=q;
|
||||
@@ -213,12 +209,13 @@ case 6: //color
|
||||
return;
|
||||
}
|
||||
Poly_Connect pc(myT);
|
||||
const TColgp_Array1OfPnt& Nodes= myT->Nodes();
|
||||
TColgp_Array1OfPnt Nodes (1, myT->NbNodes());
|
||||
for (Standard_Integer in = 1; in <= myT->NbNodes(); in++)
|
||||
{
|
||||
Nodes.SetValue(in, myT->Node (in));
|
||||
}
|
||||
BAR = GProp_PGProps::Barycentre(Nodes);
|
||||
|
||||
|
||||
//const TColgp_Array1OfPnt2d& UVNodes = myT->UVNodes();
|
||||
const Poly_Array1OfTriangle& triangles = myT->Triangles();
|
||||
TColgp_Array1OfDir myNormal(Nodes.Lower(), Nodes.Upper());
|
||||
|
||||
StdPrs_ToolTriangulatedShape::Normal(myFace, pc, myNormal);
|
||||
@@ -238,15 +235,15 @@ case 6: //color
|
||||
{
|
||||
// triangles(nt).Get(n1,n2,n3); // le triangle est n1,n2,n3
|
||||
if (myFace.Orientation() == TopAbs_REVERSED) // si la face est "reversed"
|
||||
triangles(nt).Get(n1,n3,n2); // le triangle est n1,n3,n2
|
||||
myT->Triangle (nt).Get (n1,n3,n2); // le triangle est n1,n3,n2
|
||||
else
|
||||
triangles(nt).Get(n1,n2,n3); // le triangle est n1,n2,n3
|
||||
myT->Triangle (nt).Get (n1,n2,n3); // le triangle est n1,n2,n3
|
||||
|
||||
if (TriangleIsValid (Nodes(n1),Nodes(n2),Nodes(n3)) )
|
||||
{ // Associates a vertexNT to each node
|
||||
gp_Pnt p = Nodes(n1).Transformed(myLocation.Transformation());
|
||||
gp_Pnt q = Nodes(n2).Transformed(myLocation.Transformation());
|
||||
gp_Pnt r = Nodes(n3).Transformed(myLocation.Transformation());
|
||||
gp_Pnt p = myT->Node(n1).Transformed(myLocation.Transformation());
|
||||
gp_Pnt q = myT->Node(n2).Transformed(myLocation.Transformation());
|
||||
gp_Pnt r = myT->Node(n3).Transformed(myLocation.Transformation());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,18 +255,18 @@ case 6: //color
|
||||
std::cout << "On traite actuellement le triangle : "<< nt <<"\n";
|
||||
#endif
|
||||
if (myFace.Orientation() == TopAbs_REVERSED) // si la face est "reversed"
|
||||
triangles(nt).Get(n1,n3,n2); // le triangle est n1,n3,n2
|
||||
myT->Triangle (nt).Get (n1,n3,n2); // le triangle est n1,n3,n2
|
||||
else
|
||||
triangles(nt).Get(n1,n2,n3); // le triangle est n1,n2,n3
|
||||
myT->Triangle (nt).Get (n1,n2,n3); // le triangle est n1,n2,n3
|
||||
|
||||
if (TriangleIsValid (Nodes(n1),Nodes(n2),Nodes(n3)) )
|
||||
{ // Associates a vertexNT to each node
|
||||
|
||||
TColgp_Array1OfPnt Points(1,3);
|
||||
|
||||
gp_Pnt p = Nodes(n1).Transformed(myLocation.Transformation());
|
||||
gp_Pnt q = Nodes(n2).Transformed(myLocation.Transformation());
|
||||
gp_Pnt r = Nodes(n3).Transformed(myLocation.Transformation());
|
||||
gp_Pnt p = myT->Node(n1).Transformed(myLocation.Transformation());
|
||||
gp_Pnt q = myT->Node(n2).Transformed(myLocation.Transformation());
|
||||
gp_Pnt r = myT->Node(n3).Transformed(myLocation.Transformation());
|
||||
|
||||
Points(1).SetCoord(p.X(), p.Y(), p.Z());
|
||||
Points(2).SetCoord(q.X(), q.Y(), q.Z());
|
||||
|
@@ -25,7 +25,7 @@ public:
|
||||
void SetColor(const Quantity_Color &aColor);
|
||||
|
||||
private:
|
||||
void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
|
||||
void Compute(const Handle(PrsMgr_PresentationManager)& aPresentationManager,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer aMode = 0) ;
|
||||
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
|
||||
|
@@ -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
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#Category: Modeling
|
||||
#Title: Snowflake - creation of 2d drawing
|
||||
|
||||
pload MODELING AISV
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
puts "Generating sample drawing of snowflake..."
|
||||
|
||||
|
@@ -19,7 +19,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --bind")
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s SAFE_HEAP=1")
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_EXIT_RUNTIME=1")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s TOTAL_MEMORY=256MB")
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s TOTAL_MEMORY=16MB")
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ABORTING_MALLOC=0")
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s FORCE_FILESYSTEM=1")
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --preload-file myFile")
|
||||
@@ -29,6 +29,7 @@ endif()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s MODULARIZE=1")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXPORT_NAME='createOccViewerModule'")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EXTRA_EXPORTED_RUNTIME_METHODS=['ccall','cwrap']")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --extern-post-js ${CMAKE_CURRENT_SOURCE_DIR}/occt-webgl-viewer.js")
|
||||
|
||||
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
|
||||
file(GLOB SOURCES
|
||||
@@ -37,12 +38,10 @@ file(GLOB SOURCES
|
||||
)
|
||||
source_group ("Headers" FILES
|
||||
WasmOcctView.h
|
||||
WasmOcctPixMap.h
|
||||
WasmOcctObject.h)
|
||||
WasmOcctPixMap.h)
|
||||
source_group ("Sources" FILES
|
||||
WasmOcctView.cpp
|
||||
WasmOcctPixMap.cpp
|
||||
WasmOcctObject.cpp
|
||||
main.cpp)
|
||||
|
||||
# FreeType
|
||||
@@ -65,10 +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)
|
||||
|
||||
INCLUDE_DIRECTORIES("c:/workssd/Develop/3rdparty/android/rapidjson-1.1.0/include")
|
||||
add_definitions (-DHAVE_RAPIDJSON)
|
||||
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(
|
||||
@@ -85,10 +81,5 @@ if (NOT "${SOURCE_MAP_BASE}" STREQUAL "")
|
||||
endif()
|
||||
endif()
|
||||
install(FILES occt-webgl-sample.html DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
install(FILES threejs-sample.html DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
install(FILES threejs-sample.js DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
install(DIRECTORY threejs DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
install(DIRECTORY textures DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
install(DIRECTORY models DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
install(FILES ${OpenCASCADE_RESOURCE_DIR}/DrawResources/OCC_logo.png DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
install(FILES ${OpenCASCADE_RESOURCE_DIR}/DrawResources/lamp.ico DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
@@ -1,98 +0,0 @@
|
||||
/**
|
||||
* OCC Viewer global object.
|
||||
*/
|
||||
interface OccViewerModule {
|
||||
|
||||
/**
|
||||
* Set cubemap background.
|
||||
* File will be loaded asynchronously.
|
||||
* @param {string} theImagePath [in] image path to load
|
||||
*/
|
||||
void setCubemapBackground (DOMString theImagePath);
|
||||
|
||||
/**
|
||||
* Clear all named objects from viewer.
|
||||
*/
|
||||
void removeAllObjects();
|
||||
|
||||
/**
|
||||
* Fit all/selected objects into view.
|
||||
* @param {boolean} theAuto [in] fit selected objects (TRUE) or all objects (FALSE)
|
||||
*/
|
||||
void fitAllObjects (boolean theAuto);
|
||||
|
||||
/**
|
||||
* Remove named object from viewer.
|
||||
* @param {string} theName [in] object name
|
||||
* @param {boolean} theToUpdate [in] immediatly request viewer update
|
||||
* @return {boolean} FALSE if object was not found
|
||||
*/
|
||||
boolean removeObject (DOMString theName,
|
||||
boolean theToUpdate);
|
||||
|
||||
/**
|
||||
* Temporarily hide named object.
|
||||
* @param {string} theName [in] object name
|
||||
* @return {boolean} FALSE if object was not found
|
||||
*/
|
||||
boolean eraseObject (DOMString theName);
|
||||
|
||||
/**
|
||||
* Display temporarily hidden object.
|
||||
* @param {string} theName [in] object name
|
||||
* @return {boolean} FALSE if object was not found
|
||||
*/
|
||||
boolean displayObject (DOMString theName);
|
||||
|
||||
/**
|
||||
* Show/hide ground.
|
||||
* @param {boolean} theToShow [in] show or hide flag
|
||||
*/
|
||||
void displayGround (boolean theToShow);
|
||||
|
||||
/**
|
||||
* Open object from the given URL.
|
||||
* File will be loaded asynchronously.
|
||||
* @param {string} theName [in] object name
|
||||
* @param {string} theModelPath [in] model path
|
||||
*/
|
||||
void openFromUrl (DOMString theName,
|
||||
DOMString theModelPath);
|
||||
|
||||
/**
|
||||
* Open object from memory.
|
||||
* @param theName [in] object name
|
||||
* @param theBuffer [in] pointer to data
|
||||
* @param theDataLen [in] data length
|
||||
* @param theToFree [in] free theBuffer if set to TRUE
|
||||
* @return {boolean} FALSE on reading error
|
||||
*/
|
||||
//boolean openFromMemory (DOMString theName,
|
||||
// long theBuffer, int theDataLen,
|
||||
// boolean theToFree);
|
||||
|
||||
/**
|
||||
* Open BRep object from memory.
|
||||
* @param theName [in] object name
|
||||
* @param theBuffer [in] pointer to data
|
||||
* @param theDataLen [in] data length
|
||||
* @param theToFree [in] free theBuffer if set to TRUE
|
||||
* @return FALSE on reading error
|
||||
*/
|
||||
//static boolean openBRepFromMemory (DOMString theName,
|
||||
// long theBuffer, int theDataLen,
|
||||
// boolean theToFree);
|
||||
|
||||
/**
|
||||
* Open glTF object from memory.
|
||||
* @param theName [in] object name
|
||||
* @param theBuffer [in] pointer to data
|
||||
* @param theDataLen [in] data length
|
||||
* @param theToFree [in] free theBuffer if set to TRUE
|
||||
* @return FALSE on reading error
|
||||
*/
|
||||
//static boolean openGltfFromMemory (DOMString theName,
|
||||
// long theBuffer, int theDataLen,
|
||||
// boolean theToFree);
|
||||
|
||||
};
|
@@ -1,251 +0,0 @@
|
||||
// Copyright (c) 2021 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of the examples of the Open CASCADE Technology software library.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
||||
|
||||
#include "WasmOcctObject.h"
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Select3D_SensitiveTriangulation.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <XCAFDoc_VisMaterial.hxx>
|
||||
|
||||
//! Gets triangulation of every face of shape and fills output array of triangles
|
||||
static Handle(Graphic3d_ArrayOfTriangles) fillTriangles (const TopoDS_Shape& theShape,
|
||||
const bool theHasTexels,
|
||||
const gp_Pnt2d& theUVOrigin,
|
||||
const gp_Pnt2d& theUVRepeat,
|
||||
const gp_Pnt2d& theUVScale)
|
||||
{
|
||||
TopLoc_Location aLoc;
|
||||
Standard_Integer aNbTriangles = 0, aNbVertices = 0;
|
||||
bool hasNormals = true;
|
||||
for (TopExp_Explorer aFaceIt (theShape, TopAbs_FACE); aFaceIt.More(); aFaceIt.Next())
|
||||
{
|
||||
const TopoDS_Face& aFace = TopoDS::Face (aFaceIt.Current());
|
||||
if (const Handle(Poly_Triangulation)& aT = BRep_Tool::Triangulation (aFace, aLoc))
|
||||
{
|
||||
aNbTriangles += aT->NbTriangles();
|
||||
aNbVertices += aT->NbNodes();
|
||||
hasNormals = hasNormals && aT->HasNormals();
|
||||
}
|
||||
}
|
||||
if (aNbVertices < 3 || aNbTriangles < 1)
|
||||
{
|
||||
return Handle(Graphic3d_ArrayOfTriangles)();
|
||||
}
|
||||
|
||||
const Graphic3d_ArrayFlags aFlags = (hasNormals ? Graphic3d_ArrayFlags_VertexNormal : Graphic3d_ArrayFlags_None)
|
||||
| (theHasTexels ? Graphic3d_ArrayFlags_VertexTexel : Graphic3d_ArrayFlags_None);
|
||||
Handle(Graphic3d_ArrayOfTriangles) anArray = new Graphic3d_ArrayOfTriangles (aNbVertices, 3 * aNbTriangles, aFlags);
|
||||
Standard_Real aUmin (0.0), aUmax (1.0), aVmin (0.0), aVmax (1.0), dUmax (1.0), dVmax (1.0);
|
||||
for (TopExp_Explorer aFaceIt(theShape, TopAbs_FACE); aFaceIt.More(); aFaceIt.Next())
|
||||
{
|
||||
const TopoDS_Face& aFace = TopoDS::Face (aFaceIt.Current());
|
||||
const Handle(Poly_Triangulation)& aT = BRep_Tool::Triangulation (aFace, aLoc);
|
||||
if (aT.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determinant of transform matrix less then 0 means that mirror transform applied.
|
||||
const gp_Trsf& aTrsf = aLoc.Transformation();
|
||||
const bool isMirrored = aTrsf.VectorialPart().Determinant() < 0;
|
||||
|
||||
// Extracts vertices & normals from nodes
|
||||
const TColgp_Array1OfPnt& aNodes = aT->Nodes();
|
||||
const TColgp_Array1OfPnt2d* aUVNodes = theHasTexels && aT->HasUVNodes() && aT->UVNodes().Upper() == aNodes.Upper()
|
||||
? &aT->UVNodes()
|
||||
: NULL;
|
||||
|
||||
const TShort_Array1OfShortReal* aNormals = aT->HasNormals() ? &aT->Normals() : NULL;
|
||||
const Standard_ShortReal* aNormArr = aNormals != NULL ? &aNormals->First() : NULL;
|
||||
|
||||
const Standard_Integer aVertFrom = anArray->VertexNumber();
|
||||
for (Standard_Integer aNodeIter = aNodes.Lower(); aNodeIter <= aNodes.Upper(); ++aNodeIter)
|
||||
{
|
||||
gp_Pnt aPoint = aNodes (aNodeIter);
|
||||
const Standard_Integer anId = 3 * (aNodeIter - aNodes.Lower());
|
||||
gp_Dir aNorm = aNormArr != NULL ? gp_Dir (aNormArr[anId + 0], aNormArr[anId + 1], aNormArr[anId + 2]) : gp::DZ();
|
||||
if ((aFace.Orientation() == TopAbs_REVERSED) ^ isMirrored)
|
||||
{
|
||||
aNorm.Reverse();
|
||||
}
|
||||
if (!aLoc.IsIdentity())
|
||||
{
|
||||
aPoint.Transform (aTrsf);
|
||||
aNorm .Transform (aTrsf);
|
||||
}
|
||||
|
||||
if (aUVNodes != NULL)
|
||||
{
|
||||
const gp_Pnt2d aTexel = (dUmax == 0.0 || dVmax == 0.0)
|
||||
? aUVNodes->Value (aNodeIter)
|
||||
: gp_Pnt2d ((-theUVOrigin.X() + (theUVRepeat.X() * (aUVNodes->Value (aNodeIter).X() - aUmin)) / dUmax) / theUVScale.X(),
|
||||
(-theUVOrigin.Y() + (theUVRepeat.Y() * (aUVNodes->Value (aNodeIter).Y() - aVmin)) / dVmax) / theUVScale.Y());
|
||||
anArray->AddVertex (aPoint, aNorm, aTexel);
|
||||
}
|
||||
else
|
||||
{
|
||||
anArray->AddVertex (aPoint, aNorm);
|
||||
}
|
||||
}
|
||||
|
||||
// Fill array with vertex and edge visibility info
|
||||
const Poly_Array1OfTriangle& aTriangles = aT->Triangles();
|
||||
Standard_Integer anIndex[3] = {};
|
||||
for (Standard_Integer aTriIter = 1; aTriIter <= aT->NbTriangles(); ++aTriIter)
|
||||
{
|
||||
aTriangles (aTriIter).Get (anIndex[0], anIndex[1], anIndex[2]);
|
||||
if (aFace.Orientation() == TopAbs_REVERSED) { std::swap (anIndex[1], anIndex[2]); }
|
||||
anArray->AddEdges (anIndex[0] + aVertFrom, anIndex[1] + aVertFrom, anIndex[2] + aVertFrom);
|
||||
}
|
||||
}
|
||||
return anArray;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : WasmOcctObject
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
WasmOcctObject::WasmOcctObject()
|
||||
{
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : ~WasmOcctObject
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
WasmOcctObject::~WasmOcctObject()
|
||||
{
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : Compute
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void WasmOcctObject::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (theMode != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Pnt2d anUVOrigin, anUVRepeat, anUVScale;
|
||||
bool hasTexCoords = false;
|
||||
|
||||
NCollection_DataMap<Handle(XCAFDoc_VisMaterial), TopoDS_Compound> aMatMap;
|
||||
|
||||
RWMesh_NodeAttributes aDefAttribs;
|
||||
{
|
||||
Handle(XCAFDoc_VisMaterial) aDefMat = new XCAFDoc_VisMaterial();
|
||||
XCAFDoc_VisMaterialPBR aPbrMar;
|
||||
aPbrMar.IsDefined = true;
|
||||
aPbrMar.BaseColor.SetValues (0.243137f, 0.243137f, 0.243137f, 1.0f);
|
||||
aDefMat->SetPbrMaterial (aPbrMar);
|
||||
aDefAttribs.Style.SetMaterial (aDefMat);
|
||||
}
|
||||
for (TopTools_SequenceOfShape::Iterator aRootIter (myRootShapes); aRootIter.More(); aRootIter.Next())
|
||||
{
|
||||
const TopoDS_Shape& aShape = aRootIter.Value();
|
||||
/*if (Handle(Graphic3d_ArrayOfTriangles) aPArray = fillTriangles (aShape, hasTexCoords, anUVOrigin, anUVRepeat, anUVScale))
|
||||
{
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroup->AddPrimitiveArray (aPArray);
|
||||
}*/
|
||||
|
||||
for (TopExp_Explorer aFaceIter (aShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
const TopoDS_Face& aFace = TopoDS::Face (aFaceIter.Value());
|
||||
const RWMesh_NodeAttributes* anAttribs = myAttribMap.Seek (aFace);
|
||||
if (anAttribs == NULL)
|
||||
{
|
||||
anAttribs = myAttribMap.Seek (aFace.Located (TopLoc_Location()));
|
||||
if (anAttribs == NULL)
|
||||
{
|
||||
anAttribs = &aDefAttribs;
|
||||
}
|
||||
}
|
||||
if (Handle(XCAFDoc_VisMaterial) aVisMat = anAttribs->Style.Material())
|
||||
{
|
||||
TopoDS_Compound* aComp = aMatMap.ChangeSeek (aVisMat);
|
||||
if (aComp == NULL)
|
||||
{
|
||||
aComp = aMatMap.Bound (aVisMat, TopoDS_Compound());
|
||||
BRep_Builder().MakeCompound (*aComp);
|
||||
}
|
||||
BRep_Builder().Add (*aComp, aFace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (NCollection_DataMap<Handle(XCAFDoc_VisMaterial), TopoDS_Compound>::Iterator aMatIter (aMatMap); aMatIter.More(); aMatIter.Next())
|
||||
{
|
||||
const Handle(XCAFDoc_VisMaterial)& aVisMat = aMatIter.Key();
|
||||
const TopoDS_Compound& aShape = aMatIter.Value();
|
||||
if (Handle(Graphic3d_ArrayOfTriangles) aPArray = fillTriangles (aShape, hasTexCoords, anUVOrigin, anUVRepeat, anUVScale))
|
||||
{
|
||||
Handle(Graphic3d_AspectFillArea3d) anAspects = new Graphic3d_AspectFillArea3d();
|
||||
*anAspects = *myDrawer->ShadingAspect()->Aspect();
|
||||
aVisMat->FillAspect (anAspects);
|
||||
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (anAspects);
|
||||
aGroup->AddPrimitiveArray (aPArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : ComputeSelection
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void WasmOcctObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (theMode != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this, 5);
|
||||
for (TopTools_SequenceOfShape::Iterator aRootIter (myRootShapes); aRootIter.More(); aRootIter.Next())
|
||||
{
|
||||
const TopoDS_Shape& aShape = aRootIter.Value();
|
||||
for (TopExp_Explorer aFaceIter (aShape, TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
const TopoDS_Face& aFace = TopoDS::Face (aFaceIter.Value());
|
||||
TopLoc_Location aLoc;
|
||||
if (Handle(Poly_Triangulation) aPolyTri = BRep_Tool::Triangulation (aFace, aLoc))
|
||||
{
|
||||
Handle(Select3D_SensitiveTriangulation) aSensTris = new Select3D_SensitiveTriangulation (anOwner, aPolyTri, aLoc);
|
||||
theSel->Add (aSensTris);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,80 +0,0 @@
|
||||
// Copyright (c) 2021 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of the examples of the Open CASCADE Technology software library.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
||||
|
||||
#ifndef _WasmOcctObject_HeaderFile
|
||||
#define _WasmOcctObject_HeaderFile
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <RWMesh_NodeAttributes.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
|
||||
//! Sample presentation.
|
||||
class WasmOcctObject : public AIS_InteractiveObject
|
||||
{
|
||||
public:
|
||||
//! Default constructor.
|
||||
Standard_EXPORT WasmOcctObject();
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~WasmOcctObject();
|
||||
|
||||
//! Return sequence of root shapes.
|
||||
TopTools_SequenceOfShape& ChangeShapes() { return myRootShapes; }
|
||||
|
||||
//! Return shape attributes.
|
||||
RWMesh_NodeAttributeMap& ChangeAttributes() { return myAttribMap; }
|
||||
|
||||
//! Set a single shape.
|
||||
void SetShape (const TopoDS_Shape& theShape)
|
||||
{
|
||||
myRootShapes.Clear();
|
||||
myRootShapes.Append (theShape);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//! Return TRUE for supported display mode.
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
|
||||
|
||||
//! Compute 3D part of View Cube.
|
||||
//! @param thePrsMgr [in] presentation manager.
|
||||
//! @param thePrs [in] input presentation that is to be filled with flat presentation primitives.
|
||||
//! @param theMode [in] display mode.
|
||||
//! @warning this object accept only 0 display mode.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Redefine computing of sensitive entities for View Cube.
|
||||
//! @param theSelection [in] input selection object that is to be filled with sensitive entities.
|
||||
//! @param theMode [in] selection mode.
|
||||
//! @warning object accepts only 0 selection mode.
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
TopTools_SequenceOfShape myRootShapes; //!< sequence of result root shapes
|
||||
RWMesh_NodeAttributeMap myAttribMap; //!< shape attributes
|
||||
|
||||
};
|
||||
|
||||
#endif // _WasmOcctObject_HeaderFile
|
@@ -41,7 +41,6 @@
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <Standard_ArrayStreamBuffer.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <emscripten/bind.h>
|
||||
|
||||
@@ -75,22 +74,15 @@ namespace
|
||||
{
|
||||
std::string Name;
|
||||
std::string Path;
|
||||
bool ToExpand;
|
||||
OSD_Timer Timer;
|
||||
|
||||
ModelAsyncLoader (const char* theName, const char* thePath, const bool theToExpand)
|
||||
: Name (theName), Path (thePath), ToExpand (theToExpand)
|
||||
{
|
||||
Timer.Start();
|
||||
}
|
||||
ModelAsyncLoader (const char* theName, const char* thePath)
|
||||
: Name (theName), Path (thePath) {}
|
||||
|
||||
//! File data read event.
|
||||
static void onDataRead (void* theOpaque, void* theBuffer, int theDataLen)
|
||||
{
|
||||
ModelAsyncLoader* aTask = (ModelAsyncLoader* )theOpaque;
|
||||
WasmOcctView::openFromMemory (aTask->Name, aTask->ToExpand, reinterpret_cast<uintptr_t>(theBuffer), theDataLen, false);
|
||||
aTask->Timer.Stop();
|
||||
Message::SendInfo() << aTask->Path << " loaded in " << aTask->Timer.ElapsedTime() << " s";
|
||||
const ModelAsyncLoader* aTask = (ModelAsyncLoader* )theOpaque;
|
||||
WasmOcctView::openFromMemory (aTask->Name, reinterpret_cast<uintptr_t>(theBuffer), theDataLen, false);
|
||||
delete aTask;
|
||||
}
|
||||
|
||||
@@ -114,9 +106,6 @@ namespace
|
||||
if (anImage->Init (theFilePath))
|
||||
{
|
||||
aCubemap = new Graphic3d_CubeMapPacked (anImage);
|
||||
/// TODO WebGL 2.0 ensures sRGB conformance within glGenerateMipmap()
|
||||
/// which leads to extremely SLOW generation (5 seconds instead of 0.035)
|
||||
aCubemap->SetColorMap (false);
|
||||
}
|
||||
WasmOcctView::Instance().View()->SetBackgroundCubeMap (aCubemap, true, false);
|
||||
WasmOcctView::Instance().UpdateView();
|
||||
@@ -128,9 +117,6 @@ namespace
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString("Error: unable to load image ") + theFilePath, Message_Fail);
|
||||
}
|
||||
};
|
||||
|
||||
//! Object list separator.
|
||||
static const char THE_LIST_SEPARATOR = '\n';
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
@@ -151,8 +137,6 @@ WasmOcctView::WasmOcctView()
|
||||
: myDevicePixelRatio (1.0f),
|
||||
myUpdateRequests (0)
|
||||
{
|
||||
SetLockOrbitZUp (true);
|
||||
|
||||
addActionHotKeys (Aspect_VKey_NavForward, Aspect_VKey_W, Aspect_VKey_W | Aspect_VKeyFlags_SHIFT);
|
||||
addActionHotKeys (Aspect_VKey_NavBackward , Aspect_VKey_S, Aspect_VKey_S | Aspect_VKeyFlags_SHIFT);
|
||||
addActionHotKeys (Aspect_VKey_NavSlideLeft, Aspect_VKey_A, Aspect_VKey_A | Aspect_VKeyFlags_SHIFT);
|
||||
@@ -332,14 +316,10 @@ bool WasmOcctView::initViewer()
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: font '") + aFontPath + "' is not found", Message_Fail);
|
||||
}*/
|
||||
|
||||
const bool toAntialias = myDevicePixelRatio <= 1.25f;
|
||||
|
||||
Handle(Aspect_DisplayConnection) aDisp;
|
||||
Handle(OpenGl_GraphicDriver) aDriver = new OpenGl_GraphicDriver (aDisp, false);
|
||||
aDriver->ChangeOptions().buffersNoSwap = true; // swap has no effect in WebGL
|
||||
aDriver->ChangeOptions().buffersOpaqueAlpha = true; // avoid unexpected blending of canvas with page background
|
||||
aDriver->ChangeOptions().useSystemBuffer = false; ///
|
||||
//aDriver->ChangeOptions().useSystemBuffer = true; ///
|
||||
if (!aDriver->InitContext())
|
||||
{
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: EGL initialization failed"), Message_Fail);
|
||||
@@ -357,8 +337,6 @@ bool WasmOcctView::initViewer()
|
||||
if (aLight->Type() == Graphic3d_TOLS_DIRECTIONAL)
|
||||
{
|
||||
aLight->SetCastShadows (true);
|
||||
aLight->SetHeadlight (false);
|
||||
aLight->SetDirection (gp_Dir (0.098f, -0.20f, -0.98f));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,11 +361,8 @@ bool WasmOcctView::initViewer()
|
||||
|
||||
myView = new V3d_View (aViewer);
|
||||
myView->Camera()->SetProjectionType (Graphic3d_Camera::Projection_Perspective);
|
||||
myView->Camera()->SetFOV2d (360.0f);
|
||||
myView->Camera()->SetFOVy (45.0f);
|
||||
myView->SetImmediateUpdate (false);
|
||||
//myView->ChangeRenderingParams().NbMsaaSamples = toAntialias ? 4 : 0;
|
||||
myView->ChangeRenderingParams().RenderResolutionScale = toAntialias ? 2.0f : 1.0f;
|
||||
myView->ChangeRenderingParams().IsShadowEnabled = false;
|
||||
myView->ChangeRenderingParams().Resolution = (unsigned int )(96.0 * myDevicePixelRatio + 0.5);
|
||||
myView->ChangeRenderingParams().ToShowStats = true;
|
||||
myView->ChangeRenderingParams().StatsTextAspect = myTextStyle->Aspect();
|
||||
@@ -395,26 +370,7 @@ bool WasmOcctView::initViewer()
|
||||
myView->SetWindow (aWindow);
|
||||
dumpGlInfo (false);
|
||||
|
||||
myView->SetShadingModel (aDriver->InquireLimit (Graphic3d_TypeOfLimit_HasPBR) == 1 ? Graphic3d_TOSM_PBR : Graphic3d_TOSM_FRAGMENT);
|
||||
///myView->ChangeRenderingParams().IsShadowEnabled = aDriver->InquireLimit (Graphic3d_TypeOfLimit_HasPBR) == 1; /// TODO
|
||||
myView->ChangeRenderingParams().IsShadowEnabled = true; ///
|
||||
|
||||
myContext = new AIS_InteractiveContext (aViewer);
|
||||
{
|
||||
{
|
||||
const Handle(Prs3d_Drawer)& aHiStyle = myContext->HighlightStyle();
|
||||
aHiStyle->SetTransparency (0.8f);
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) anAspect = new Graphic3d_AspectFillArea3d();
|
||||
*anAspect = *myContext->DefaultDrawer()->ShadingAspect()->Aspect();
|
||||
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_STONE);
|
||||
aMat.SetColor (aHiStyle->Color());
|
||||
aMat.SetTransparency (aHiStyle->Transparency());
|
||||
anAspect->SetFrontMaterial (aMat);
|
||||
anAspect->SetInteriorColor (aHiStyle->Color());
|
||||
aHiStyle->SetBasicFillAreaAspect (anAspect);
|
||||
}
|
||||
}
|
||||
initPixelScaleRatio();
|
||||
return true;
|
||||
}
|
||||
@@ -754,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;
|
||||
@@ -909,95 +865,10 @@ bool WasmOcctView::processKeyPress (Aspect_VKey theKey)
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : toDynamicHighlight
|
||||
// Function : setCubemapBackground
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool WasmOcctView::toDynamicHighlight()
|
||||
{
|
||||
return WasmOcctView::Instance().ToAllowHighlight();
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : setDynamicHighlight
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void WasmOcctView::setDynamicHighlight (bool theToEnable)
|
||||
{
|
||||
WasmOcctView::Instance().SetAllowHighlight (theToEnable);
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : toCastShadows
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool WasmOcctView::toCastShadows()
|
||||
{
|
||||
return WasmOcctView::Instance().View()->RenderingParams().IsShadowEnabled;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : setCastShadows
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void WasmOcctView::setCastShadows (bool theUseShadows,
|
||||
bool theToUpdate)
|
||||
{
|
||||
if (WasmOcctView::Instance().View()->RenderingParams().IsShadowEnabled != theUseShadows)
|
||||
{
|
||||
WasmOcctView::Instance().View()->ChangeRenderingParams().IsShadowEnabled = theUseShadows;
|
||||
if (theToUpdate)
|
||||
{
|
||||
WasmOcctView::Instance().UpdateView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : isAntiAliasingOn
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool WasmOcctView::isAntiAliasingOn()
|
||||
{
|
||||
return WasmOcctView::Instance().View()->RenderingParams().RenderResolutionScale > 1.1f;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : setAntiAliasingOn
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void WasmOcctView::setAntiAliasingOn (bool theToEnable, bool theToUpdate)
|
||||
{
|
||||
if (isAntiAliasingOn() != theToEnable)
|
||||
{
|
||||
WasmOcctView::Instance().View()->ChangeRenderingParams().RenderResolutionScale = theToEnable ? 2.0f : 1.0f;
|
||||
if (theToUpdate)
|
||||
{
|
||||
WasmOcctView::Instance().UpdateView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : setBackgroundColor
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void WasmOcctView::setBackgroundColor (float theR, float theG, float theB,
|
||||
bool theToUpdate)
|
||||
{
|
||||
Quantity_Color aColor (theR, theG, theB, Quantity_TOC_RGB);
|
||||
WasmOcctView::Instance().View()->SetBackgroundColor (aColor);
|
||||
WasmOcctView::Instance().View()->SetBackgroundCubeMap (Handle(Graphic3d_CubeMap)(), true);
|
||||
if (theToUpdate)
|
||||
{
|
||||
WasmOcctView::Instance().UpdateView();
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : setBackgroundCubemap
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void WasmOcctView::setBackgroundCubemap (const std::string& theImagePath)
|
||||
void WasmOcctView::setCubemapBackground (const std::string& theImagePath)
|
||||
{
|
||||
if (!theImagePath.empty())
|
||||
{
|
||||
@@ -1014,8 +885,7 @@ void WasmOcctView::setBackgroundCubemap (const std::string& theImagePath)
|
||||
// Function : fitAllObjects
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void WasmOcctView::fitAllObjects (bool theAuto,
|
||||
bool theToUpdate)
|
||||
void WasmOcctView::fitAllObjects (bool theAuto)
|
||||
{
|
||||
WasmOcctView& aViewer = Instance();
|
||||
if (theAuto)
|
||||
@@ -1026,219 +896,81 @@ void WasmOcctView::fitAllObjects (bool theAuto,
|
||||
{
|
||||
aViewer.View()->FitAll (0.01, false);
|
||||
}
|
||||
if (theToUpdate)
|
||||
{
|
||||
aViewer.UpdateView();
|
||||
}
|
||||
}
|
||||
|
||||
EM_JS(void, jsOnDisplayedObjectsChanged, (), {
|
||||
Module.onDisplayedObjectsChanged();
|
||||
});
|
||||
EM_JS(void, jsOnSelectedObjectsChanged, (), {
|
||||
Module.onSelectedObjectsChanged();
|
||||
});
|
||||
|
||||
// ================================================================
|
||||
// Function : onDisplayedObjectsChanged
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void WasmOcctView::onDisplayedObjectsChanged()
|
||||
{
|
||||
jsOnDisplayedObjectsChanged();
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : OnSelectionChanged
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void WasmOcctView::OnSelectionChanged (const Handle(AIS_InteractiveContext)& ,
|
||||
const Handle(V3d_View)& )
|
||||
{
|
||||
jsOnSelectedObjectsChanged();
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : displayedObjects
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
std::string WasmOcctView::displayedObjects()
|
||||
{
|
||||
WasmOcctView& aViewer = Instance();
|
||||
std::string aList;
|
||||
for (NCollection_IndexedDataMap<TCollection_AsciiString, Handle(AIS_InteractiveObject)>::Iterator anObjIter (aViewer.myObjects);
|
||||
anObjIter.More(); anObjIter.Next())
|
||||
{
|
||||
if (!aList.empty()) { aList += THE_LIST_SEPARATOR; }
|
||||
aList += anObjIter.Key().ToCString();
|
||||
}
|
||||
return aList;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : selectedObjects
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
std::string WasmOcctView::selectedObjects()
|
||||
{
|
||||
WasmOcctView& aViewer = Instance();
|
||||
std::string aList;
|
||||
for (NCollection_IndexedDataMap<TCollection_AsciiString, Handle(AIS_InteractiveObject)>::Iterator anObjIter (aViewer.myObjects);
|
||||
anObjIter.More(); anObjIter.Next())
|
||||
{
|
||||
if (aViewer.Context()->IsSelected (anObjIter.Value()))
|
||||
{
|
||||
if (!aList.empty()) { aList += THE_LIST_SEPARATOR; }
|
||||
aList += anObjIter.Key().ToCString();
|
||||
}
|
||||
}
|
||||
return aList;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : erasedObjects
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
std::string WasmOcctView::erasedObjects()
|
||||
{
|
||||
WasmOcctView& aViewer = Instance();
|
||||
std::string aList;
|
||||
for (NCollection_IndexedDataMap<TCollection_AsciiString, Handle(AIS_InteractiveObject)>::Iterator anObjIter (aViewer.myObjects);
|
||||
anObjIter.More(); anObjIter.Next())
|
||||
{
|
||||
if (!aViewer.Context()->IsDisplayed (anObjIter.Value()))
|
||||
{
|
||||
if (!aList.empty()) { aList += THE_LIST_SEPARATOR; }
|
||||
aList += anObjIter.Key().ToCString();
|
||||
}
|
||||
}
|
||||
return aList;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : displayObjectList
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool WasmOcctView::displayObjectList (const std::string& theNames,
|
||||
bool theToUpdate)
|
||||
{
|
||||
WasmOcctView& aViewer = Instance();
|
||||
|
||||
std::stringstream aListStream (theNames);
|
||||
std::string aName;
|
||||
bool hasChanged = false;
|
||||
while (std::getline (aListStream, aName, THE_LIST_SEPARATOR))
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anObj;
|
||||
if (!aViewer.myObjects.FindFromKey (aName.c_str(), anObj))
|
||||
{
|
||||
Message::SendFail() << "Error: unknown object '" << aName << "'";
|
||||
return false;
|
||||
}
|
||||
|
||||
hasChanged = true;
|
||||
aViewer.Context()->Display (anObj, false);
|
||||
}
|
||||
if (theToUpdate
|
||||
&& hasChanged)
|
||||
{
|
||||
aViewer.UpdateView();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : removeObjectList
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool WasmOcctView::removeObjectList (const std::string& theNames,
|
||||
bool theToUpdate)
|
||||
{
|
||||
WasmOcctView& aViewer = Instance();
|
||||
|
||||
std::stringstream aListStream (theNames);
|
||||
std::string aName;
|
||||
bool hasChanged = false;
|
||||
while (std::getline (aListStream, aName, THE_LIST_SEPARATOR))
|
||||
{
|
||||
/// TODO filtering should be done for all keys starting with aName
|
||||
Handle(AIS_InteractiveObject) anObj;
|
||||
if (!aViewer.myObjects.FindFromKey (aName.c_str(), anObj))
|
||||
{
|
||||
//Message::SendFail() << "Error: unknown object '" << aName << "'";
|
||||
return false;
|
||||
}
|
||||
|
||||
hasChanged = true;
|
||||
aViewer.Context()->Remove (anObj, false);
|
||||
aViewer.myObjects.RemoveKey (aName.c_str());
|
||||
}
|
||||
|
||||
if (hasChanged)
|
||||
{
|
||||
if (theToUpdate) { aViewer.UpdateView(); }
|
||||
aViewer.onDisplayedObjectsChanged();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : eraseObjectList
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool WasmOcctView::eraseObjectList (const std::string& theNames,
|
||||
bool theToUpdate)
|
||||
{
|
||||
WasmOcctView& aViewer = Instance();
|
||||
|
||||
std::stringstream aListStream (theNames);
|
||||
std::string aName;
|
||||
bool hasChanged = false;
|
||||
while (std::getline (aListStream, aName, THE_LIST_SEPARATOR))
|
||||
{
|
||||
/// TODO filtering should be done for all keys starting with aName
|
||||
Handle(AIS_InteractiveObject) anObj;
|
||||
if (!aViewer.myObjects.FindFromKey (aName.c_str(), anObj))
|
||||
{
|
||||
Message::SendFail() << "Error: unknown object '" << aName << "'";
|
||||
return false;
|
||||
}
|
||||
|
||||
hasChanged = true;
|
||||
aViewer.Context()->Erase (anObj, false);
|
||||
}
|
||||
|
||||
if (hasChanged
|
||||
&& theToUpdate)
|
||||
{
|
||||
aViewer.UpdateView();
|
||||
}
|
||||
return true;
|
||||
aViewer.UpdateView();
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : removeAllObjects
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void WasmOcctView::removeAllObjects (bool theToUpdate)
|
||||
void WasmOcctView::removeAllObjects()
|
||||
{
|
||||
WasmOcctView& aViewer = Instance();
|
||||
if (aViewer.myObjects.IsEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (NCollection_IndexedDataMap<TCollection_AsciiString, Handle(AIS_InteractiveObject)>::Iterator anObjIter (aViewer.myObjects);
|
||||
anObjIter.More(); anObjIter.Next())
|
||||
{
|
||||
aViewer.Context()->Remove (anObjIter.Value(), false);
|
||||
}
|
||||
aViewer.myObjects.Clear();
|
||||
if (theToUpdate)
|
||||
aViewer.UpdateView();
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : removeObject
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool WasmOcctView::removeObject (const std::string& theName)
|
||||
{
|
||||
WasmOcctView& aViewer = Instance();
|
||||
Handle(AIS_InteractiveObject) anObj;
|
||||
if (!theName.empty()
|
||||
&& !aViewer.myObjects.FindFromKey (theName.c_str(), anObj))
|
||||
{
|
||||
aViewer.UpdateView();
|
||||
return false;
|
||||
}
|
||||
aViewer.onDisplayedObjectsChanged();
|
||||
|
||||
aViewer.Context()->Remove (anObj, false);
|
||||
aViewer.myObjects.RemoveKey (theName.c_str());
|
||||
aViewer.UpdateView();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : eraseObject
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool WasmOcctView::eraseObject (const std::string& theName)
|
||||
{
|
||||
WasmOcctView& aViewer = Instance();
|
||||
Handle(AIS_InteractiveObject) anObj;
|
||||
if (!theName.empty()
|
||||
&& !aViewer.myObjects.FindFromKey (theName.c_str(), anObj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
aViewer.Context()->Erase (anObj, false);
|
||||
aViewer.UpdateView();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : displayObject
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool WasmOcctView::displayObject (const std::string& theName)
|
||||
{
|
||||
WasmOcctView& aViewer = Instance();
|
||||
Handle(AIS_InteractiveObject) anObj;
|
||||
if (!theName.empty()
|
||||
&& !aViewer.myObjects.FindFromKey (theName.c_str(), anObj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
aViewer.Context()->Display (anObj, false);
|
||||
aViewer.UpdateView();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
@@ -1246,10 +978,9 @@ void WasmOcctView::removeAllObjects (bool theToUpdate)
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void WasmOcctView::openFromUrl (const std::string& theName,
|
||||
const std::string& theModelPath,
|
||||
const bool theToExpand)
|
||||
const std::string& theModelPath)
|
||||
{
|
||||
ModelAsyncLoader* aTask = new ModelAsyncLoader (theName.c_str(), theModelPath.c_str(), theToExpand);
|
||||
ModelAsyncLoader* aTask = new ModelAsyncLoader (theName.c_str(), theModelPath.c_str());
|
||||
emscripten_async_wget_data (theModelPath.c_str(), (void* )aTask, ModelAsyncLoader::onDataRead, ModelAsyncLoader::onReadFailed);
|
||||
}
|
||||
|
||||
@@ -1258,11 +989,10 @@ void WasmOcctView::openFromUrl (const std::string& theName,
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool WasmOcctView::openFromMemory (const std::string& theName,
|
||||
const bool theToExpand,
|
||||
uintptr_t theBuffer, int theDataLen,
|
||||
bool theToFree)
|
||||
{
|
||||
removeObjectList (theName, false);
|
||||
removeObject (theName);
|
||||
char* aBytes = reinterpret_cast<char*>(theBuffer);
|
||||
if (aBytes == nullptr
|
||||
|| theDataLen <= 0)
|
||||
@@ -1275,11 +1005,11 @@ bool WasmOcctView::openFromMemory (const std::string& theName,
|
||||
|
||||
if (dataStartsWithHeader(aBytes, "DBRep_DrawableShape"))
|
||||
{
|
||||
return openBRepFromMemory (theName, theToExpand, theBuffer, theDataLen, theToFree);
|
||||
return openBRepFromMemory (theName, theBuffer, theDataLen, theToFree);
|
||||
}
|
||||
else if (dataStartsWithHeader(aBytes, "glTF"))
|
||||
{
|
||||
return openGltfFromMemory (theName, theToExpand, theBuffer, theDataLen, theToFree);
|
||||
//return openGltfFromMemory (theName, theBuffer, theDataLen, theToFree);
|
||||
}
|
||||
if (theToFree)
|
||||
{
|
||||
@@ -1295,13 +1025,12 @@ bool WasmOcctView::openFromMemory (const std::string& theName,
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool WasmOcctView::openBRepFromMemory (const std::string& theName,
|
||||
const bool theToExpand,
|
||||
uintptr_t theBuffer, int theDataLen,
|
||||
bool theToFree)
|
||||
{
|
||||
removeObjectList (theName, false);
|
||||
removeObject (theName);
|
||||
|
||||
/*WasmOcctView& aViewer = Instance();
|
||||
WasmOcctView& aViewer = Instance();
|
||||
TopoDS_Shape aShape;
|
||||
BRep_Builder aBuilder;
|
||||
bool isLoaded = false;
|
||||
@@ -1333,322 +1062,18 @@ bool WasmOcctView::openBRepFromMemory (const std::string& theName,
|
||||
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString("Loaded file ") + theName.c_str(), Message_Info);
|
||||
Message::DefaultMessenger()->Send (OSD_MemInfo::PrintInfo(), Message_Trace);
|
||||
return true;*/
|
||||
return false;
|
||||
}
|
||||
|
||||
#include <OSD_OpenFile.hxx>
|
||||
#include <RWGltf_GltfJsonParser.hxx>
|
||||
#include <RWGltf_TriangulationReader.hxx>
|
||||
#include "WasmOcctObject.h"
|
||||
|
||||
class WasmTriangulationReader : public RWGltf_TriangulationReader
|
||||
{
|
||||
public:
|
||||
|
||||
WasmTriangulationReader (std::istream& theStream,
|
||||
const TCollection_AsciiString& theFile)
|
||||
: myRootStream (&theStream), myRootPath (theFile)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
virtual bool load (const Handle(RWGltf_GltfLatePrimitiveArray)& theMesh) override
|
||||
{
|
||||
reset();
|
||||
if (theMesh.IsNull()
|
||||
|| theMesh->PrimitiveMode() == RWGltf_GltfPrimitiveMode_UNKNOWN)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (NCollection_Sequence<RWGltf_GltfPrimArrayData>::Iterator aDataIter (theMesh->Data()); aDataIter.More(); aDataIter.Next())
|
||||
{
|
||||
const RWGltf_GltfPrimArrayData& aData = aDataIter.Value();
|
||||
if (!aData.StreamData.IsNull())
|
||||
{
|
||||
Standard_ArrayStreamBuffer aStreamBuffer ((const char* )aData.StreamData->Data(), aData.StreamData->Size());
|
||||
std::istream aStream (&aStreamBuffer);
|
||||
aStream.seekg ((std::streamoff )aData.StreamOffset, std::ios_base::beg);
|
||||
if (!readBuffer (aStream, theMesh->Id(), aData.Accessor, aData.Type, theMesh->PrimitiveMode()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (aData.StreamUri.IsEmpty())
|
||||
{
|
||||
reportError (TCollection_AsciiString ("Buffer '") + theMesh->Id() + "' does not define uri.");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::istream* aStream = &mySharedStream.Stream;
|
||||
if (aData.StreamUri == myRootPath
|
||||
&& myRootStream != NULL)
|
||||
{
|
||||
aStream = myRootStream;
|
||||
}
|
||||
else if (mySharedStream.Path != aData.StreamUri)
|
||||
{
|
||||
mySharedStream.Stream.close();
|
||||
mySharedStream.Path = aData.StreamUri;
|
||||
}
|
||||
if (aStream == &mySharedStream.Stream
|
||||
&& !mySharedStream.Stream.is_open())
|
||||
{
|
||||
OSD_OpenStream (mySharedStream.Stream, aData.StreamUri.ToCString(), std::ios::in | std::ios::binary);
|
||||
if (!mySharedStream.Stream.is_open())
|
||||
{
|
||||
mySharedStream.Stream.close();
|
||||
reportError (TCollection_AsciiString ("Buffer '") + theMesh->Id() + "refers to non-existing file '" + aData.StreamUri + "'.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
aStream->seekg ((std::streamoff )aData.StreamOffset, std::ios_base::beg);
|
||||
if (!aStream->good())
|
||||
{
|
||||
mySharedStream.Stream.close();
|
||||
reportError (TCollection_AsciiString ("Buffer '") + theMesh->Id() + "refers to invalid location.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!readBuffer (*aStream, theMesh->Id(), aData.Accessor, aData.Type, theMesh->PrimitiveMode()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::istream* myRootStream;
|
||||
TCollection_AsciiString myRootPath;
|
||||
|
||||
};
|
||||
|
||||
//! Parse glTF data.
|
||||
static bool parseGltfFromMemory (RWGltf_GltfJsonParser& theParser,
|
||||
std::istream& theStream,
|
||||
const TCollection_AsciiString& theFile)
|
||||
{
|
||||
bool isBinaryFile = false;
|
||||
char aGlbHeader[12] = {};
|
||||
theStream.read (aGlbHeader, sizeof(aGlbHeader));
|
||||
int64_t aBinBodyOffset = 0, aBinBodyLen = 0, aJsonBodyOffset = 0, aJsonBodyLen = 0;
|
||||
if (::strncmp (aGlbHeader, "glTF", 4) == 0)
|
||||
{
|
||||
isBinaryFile = true;
|
||||
const uint32_t* aVer = (const uint32_t* )(aGlbHeader + 4);
|
||||
const uint32_t* aLen = (const uint32_t* )(aGlbHeader + 8);
|
||||
if (*aVer != 2)
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString ("File '") + theFile + "' is written using unknown version " + int(*aVer));
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int aChunkIter = 0; !theStream.eof() && aChunkIter < 2; ++aChunkIter)
|
||||
{
|
||||
char aChunkHeader2[8] = {};
|
||||
if (int64_t(theStream.tellg()) + int64_t(sizeof(aChunkHeader2)) > int64_t(*aLen))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
theStream.read (aChunkHeader2, sizeof(aChunkHeader2));
|
||||
if (!theStream.good())
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString ("File '") + theFile + "' is written using unsupported format");
|
||||
return false;
|
||||
}
|
||||
|
||||
const uint32_t* aChunkLen = (const uint32_t* )(aChunkHeader2 + 0);
|
||||
const uint32_t* aChunkType = (const uint32_t* )(aChunkHeader2 + 4);
|
||||
if (*aChunkType == 0x4E4F534A)
|
||||
{
|
||||
aJsonBodyOffset = int64_t(theStream.tellg());
|
||||
aJsonBodyLen = int64_t(*aChunkLen);
|
||||
}
|
||||
else if (*aChunkType == 0x004E4942)
|
||||
{
|
||||
aBinBodyOffset = int64_t(theStream.tellg());
|
||||
aBinBodyLen = int64_t(*aChunkLen);
|
||||
}
|
||||
if (*aChunkLen != 0)
|
||||
{
|
||||
theStream.seekg (*aChunkLen, std::ios_base::cur);
|
||||
}
|
||||
}
|
||||
|
||||
theStream.seekg ((std::streamoff )aJsonBodyOffset, std::ios_base::beg);
|
||||
}
|
||||
else
|
||||
{
|
||||
theStream.seekg (0, std::ios_base::beg);
|
||||
}
|
||||
if (isBinaryFile)
|
||||
{
|
||||
theParser.SetBinaryFormat (aBinBodyOffset, aBinBodyLen);
|
||||
}
|
||||
|
||||
rapidjson::ParseResult aRes;
|
||||
rapidjson::IStreamWrapper aFileStream (theStream);
|
||||
if (isBinaryFile)
|
||||
{
|
||||
aRes = theParser.ParseStream<rapidjson::kParseStopWhenDoneFlag, rapidjson::UTF8<>, rapidjson::IStreamWrapper> (aFileStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
aRes = theParser.ParseStream (aFileStream);
|
||||
}
|
||||
if (aRes.IsError())
|
||||
{
|
||||
if (aRes.Code() == rapidjson::kParseErrorDocumentEmpty)
|
||||
{
|
||||
Message::SendFail (TCollection_AsciiString ("File '") + theFile + "' is empty");
|
||||
return false;
|
||||
}
|
||||
TCollection_AsciiString anErrDesc (RWGltf_GltfJsonParser::FormatParseError (aRes.Code()));
|
||||
Message::SendFail (TCollection_AsciiString ("File '") + theFile + "' defines invalid JSON document!\n"
|
||||
+ anErrDesc + " [at offset " + (int )aRes.Offset() + "].");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!theParser.Parse (Message_ProgressRange()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : openGltfFromMemory
|
||||
// Function : displayGround
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool WasmOcctView::openGltfFromMemory (const std::string& theName,
|
||||
const bool theToExpand,
|
||||
uintptr_t theBuffer, int theDataLen,
|
||||
bool theToFree)
|
||||
void WasmOcctView::displayGround (bool theToShow)
|
||||
{
|
||||
removeObjectList (theName, false);
|
||||
static Handle(AIS_Shape) aGroundPrs = new AIS_Shape (TopoDS_Shape());
|
||||
|
||||
WasmOcctView& aViewer = Instance();
|
||||
|
||||
char* aRawData = reinterpret_cast<char*>(theBuffer);
|
||||
Standard_ArrayStreamBuffer aStreamBuffer (aRawData, theDataLen);
|
||||
std::istream aStream (&aStreamBuffer);
|
||||
|
||||
Handle(WasmOcctObject) aShapePrs = new WasmOcctObject();
|
||||
|
||||
RWMesh_CoordinateSystemConverter aTrsf;
|
||||
aTrsf.SetInputLengthUnit (1.0); // meters
|
||||
aTrsf.SetInputCoordinateSystem (RWMesh_CoordinateSystem_glTF);
|
||||
aTrsf.SetOutputLengthUnit (1.0); // meters
|
||||
aTrsf.SetOutputCoordinateSystem(RWMesh_CoordinateSystem_Zup);
|
||||
|
||||
RWGltf_GltfJsonParser aParser (aShapePrs->ChangeShapes());
|
||||
aParser.SetFilePath (theName.c_str());
|
||||
aParser.SetErrorPrefix (TCollection_AsciiString ("File '") + theName.c_str() + "' defines invalid glTF!\n");
|
||||
aParser.SetAttributeMap (aShapePrs->ChangeAttributes());
|
||||
aParser.SetCoordinateSystemConverter (aTrsf);
|
||||
//aParser.SetSkipEmptyNodes (myToSkipEmptyNodes);
|
||||
//aParser.SetMeshNameAsFallback (myUseMeshNameAsFallback);
|
||||
bool isParsed = parseGltfFromMemory (aParser, aStream, theName.c_str());
|
||||
if (isParsed)
|
||||
{
|
||||
Handle(RWGltf_PrimitiveArrayReader) aReader = new WasmTriangulationReader (aStream, theName.c_str());
|
||||
aReader->SetCoordinateSystemConverter (aTrsf);
|
||||
for (NCollection_Vector<TopoDS_Face>::Iterator aFaceIter (aParser.FaceList()); aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
TopoDS_Face& aFace = aFaceIter.ChangeValue();
|
||||
TopLoc_Location aDummyLoc;
|
||||
Handle(RWGltf_GltfLatePrimitiveArray) aLateData = Handle(RWGltf_GltfLatePrimitiveArray)::DownCast (BRep_Tool::Triangulation (aFace, aDummyLoc));
|
||||
Handle(Poly_Triangulation) aPolyData = aReader->Load (aLateData);
|
||||
BRep_Builder aBuilder;
|
||||
aBuilder.UpdateFace (aFace, aPolyData);
|
||||
}
|
||||
}
|
||||
if (theToFree)
|
||||
{
|
||||
free (aRawData);
|
||||
}
|
||||
|
||||
if (!isParsed)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (theToExpand)
|
||||
{
|
||||
/// TODO this is just a dummy logic for testing - expanding should be done by assembly tree, not faces!
|
||||
Standard_Integer aSubIndex = 0;
|
||||
for (TopTools_SequenceOfShape::Iterator aShapeIter (aShapePrs->ChangeShapes()); aShapeIter.More(); aShapeIter.Next())
|
||||
{
|
||||
for (TopExp_Explorer aFaceIter (aShapeIter.Value(), TopAbs_FACE); aFaceIter.More(); aFaceIter.Next())
|
||||
{
|
||||
const TopoDS_Shape& aSubShape = aFaceIter.Current();
|
||||
Handle(WasmOcctObject) aSubShapePrs = new WasmOcctObject();
|
||||
aSubShapePrs->SetShape (aSubShape);
|
||||
if (const RWMesh_NodeAttributes* anAttribs = aShapePrs->ChangeAttributes().Seek (aSubShape.Located (TopLoc_Location())))
|
||||
{
|
||||
aSubShapePrs->ChangeAttributes().Bind (aSubShape.Located (TopLoc_Location()), *anAttribs);
|
||||
}
|
||||
if (!theName.empty())
|
||||
{
|
||||
++aSubIndex;
|
||||
TCollection_AsciiString aName = TCollection_AsciiString (theName.c_str()) + "/" + aSubIndex;
|
||||
aViewer.myObjects.Add (aName, aSubShapePrs);
|
||||
}
|
||||
aViewer.Context()->Display (aSubShapePrs, 0, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!theName.empty())
|
||||
{
|
||||
aViewer.myObjects.Add (theName.c_str(), aShapePrs);
|
||||
}
|
||||
aViewer.Context()->Display (aShapePrs, 0, 0, false);
|
||||
}
|
||||
|
||||
aViewer.View()->FitAll (0.01, false);
|
||||
aViewer.View()->Invalidate();
|
||||
aViewer.updateView();
|
||||
|
||||
setShowGround (aViewer.myToShowGround, false);
|
||||
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString("Loaded file ") + theName.c_str(), Message_Info);
|
||||
Message::DefaultMessenger()->Send (OSD_MemInfo::PrintInfo(), Message_Trace);
|
||||
if (!theName.empty())
|
||||
{
|
||||
aViewer.onDisplayedObjectsChanged();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : toShowGround
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
bool WasmOcctView::toShowGround()
|
||||
{
|
||||
return Instance().myToShowGround;
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// Function : setShowGround
|
||||
// Purpose :
|
||||
// ================================================================
|
||||
void WasmOcctView::setShowGround (bool theToShow,
|
||||
bool theToUpdate)
|
||||
{
|
||||
static Handle(WasmOcctObject) aGroundPrs = new WasmOcctObject();
|
||||
|
||||
WasmOcctView& aViewer = Instance();
|
||||
aViewer.myToShowGround = theToShow;
|
||||
Bnd_Box aBox;
|
||||
if (theToShow)
|
||||
{
|
||||
@@ -1662,10 +1087,7 @@ void WasmOcctView::setShowGround (bool theToShow,
|
||||
&& aGroundPrs->HasInteractiveContext())
|
||||
{
|
||||
aViewer.Context()->Remove (aGroundPrs, false);
|
||||
if (theToUpdate)
|
||||
{
|
||||
aViewer.UpdateView();
|
||||
}
|
||||
aViewer.UpdateView();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1698,37 +1120,21 @@ void WasmOcctView::setShowGround (bool theToShow,
|
||||
aGroundPrs->SetToUpdate();
|
||||
aGroundPrs->SetMaterial (Graphic3d_NameOfMaterial_Stone);
|
||||
aGroundPrs->SetInfiniteState (false);
|
||||
aViewer.Context()->Display (aGroundPrs, 0, -1, false);
|
||||
aViewer.Context()->Display (aGroundPrs, AIS_Shaded, -1, false);
|
||||
aGroundPrs->SetInfiniteState (true);
|
||||
if (theToUpdate)
|
||||
{
|
||||
aViewer.UpdateView();
|
||||
}
|
||||
aViewer.UpdateView();
|
||||
}
|
||||
|
||||
// Module exports
|
||||
EMSCRIPTEN_BINDINGS(OccViewerModule) {
|
||||
emscripten::function("toDynamicHighlight", &WasmOcctView::toDynamicHighlight);
|
||||
emscripten::function("setDynamicHighlight", &WasmOcctView::setDynamicHighlight);
|
||||
emscripten::function("toCastShadows", &WasmOcctView::toCastShadows);
|
||||
emscripten::function("setCastShadows", &WasmOcctView::setCastShadows);
|
||||
//emscripten::property("toCastShadows", &WasmOcctView::toCastShadows, &WasmOcctView::setCastShadows); // this could be only in class
|
||||
emscripten::function("isAntiAliasingOn", &WasmOcctView::isAntiAliasingOn);
|
||||
emscripten::function("setAntiAliasingOn", &WasmOcctView::setAntiAliasingOn);
|
||||
emscripten::function("setBackgroundColor", &WasmOcctView::setBackgroundColor);
|
||||
emscripten::function("setBackgroundCubemap", &WasmOcctView::setBackgroundCubemap);
|
||||
emscripten::function("fitAllObjects", &WasmOcctView::fitAllObjects);
|
||||
emscripten::function("removeAllObjects", &WasmOcctView::removeAllObjects);
|
||||
emscripten::function("removeObjectList", &WasmOcctView::removeObjectList);
|
||||
emscripten::function("eraseObjectList", &WasmOcctView::eraseObjectList);
|
||||
emscripten::function("displayedObjects", &WasmOcctView::displayedObjects);
|
||||
emscripten::function("selectedObjects", &WasmOcctView::selectedObjects);
|
||||
emscripten::function("erasedObjects", &WasmOcctView::erasedObjects);
|
||||
emscripten::function("displayObjectList", &WasmOcctView::displayObjectList);
|
||||
emscripten::function("toShowGround", &WasmOcctView::toShowGround);
|
||||
emscripten::function("setShowGround", &WasmOcctView::setShowGround);
|
||||
emscripten::function("openFromUrl", &WasmOcctView::openFromUrl);
|
||||
emscripten::function("openFromMemory", &WasmOcctView::openFromMemory, emscripten::allow_raw_pointers());
|
||||
emscripten::function("openBRepFromMemory", &WasmOcctView::openBRepFromMemory, emscripten::allow_raw_pointers());
|
||||
emscripten::function("openGltfFromMemory", &WasmOcctView::openGltfFromMemory, emscripten::allow_raw_pointers());
|
||||
emscripten::function("setCubemapBackground", &WasmOcctView::setCubemapBackground);
|
||||
emscripten::function("fitAllObjects", &WasmOcctView::fitAllObjects);
|
||||
emscripten::function("removeAllObjects", &WasmOcctView::removeAllObjects);
|
||||
emscripten::function("removeObject", &WasmOcctView::removeObject);
|
||||
emscripten::function("eraseObject", &WasmOcctView::eraseObject);
|
||||
emscripten::function("displayObject", &WasmOcctView::displayObject);
|
||||
emscripten::function("displayGround", &WasmOcctView::displayGround);
|
||||
emscripten::function("openFromUrl", &WasmOcctView::openFromUrl);
|
||||
emscripten::function("openFromMemory", &WasmOcctView::openFromMemory, emscripten::allow_raw_pointers());
|
||||
emscripten::function("openBRepFromMemory", &WasmOcctView::openBRepFromMemory, emscripten::allow_raw_pointers());
|
||||
}
|
||||
|
@@ -41,125 +41,64 @@ public:
|
||||
|
||||
public: //! @name methods exported by Module
|
||||
|
||||
//! Returns TRUE if dynamic highlighting is turned ON.
|
||||
static bool toDynamicHighlight();
|
||||
|
||||
//! Set if dynamic highlighting should be enabled or not.
|
||||
static void setDynamicHighlight (bool theToEnable);
|
||||
|
||||
//! Returns TRUE if shadows are turned ON.
|
||||
static bool toCastShadows();
|
||||
|
||||
//! Turn shadows on/off.
|
||||
static void setCastShadows (bool theUseShadows,
|
||||
bool theToUpdate);
|
||||
|
||||
//! Returns TRUE if anti-aliasing is turned ON.
|
||||
static bool isAntiAliasingOn();
|
||||
|
||||
//! Turn antialiasing on/off.
|
||||
static void setAntiAliasingOn (bool theToEnable, bool theToUpdate);
|
||||
|
||||
//! Set solid color background.
|
||||
static void setBackgroundColor (float theR, float theG, float theB,
|
||||
bool theToUpdate);
|
||||
|
||||
//! Set cubemap background.
|
||||
//! File will be loaded asynchronously.
|
||||
//! @param theImagePath [in] image path to load
|
||||
static void setBackgroundCubemap (const std::string& theImagePath);
|
||||
static void setCubemapBackground (const std::string& theImagePath);
|
||||
|
||||
//! Clear all named objects from viewer.
|
||||
static void removeAllObjects (bool theToUpdate);
|
||||
static void removeAllObjects();
|
||||
|
||||
//! Fit all/selected objects into view.
|
||||
//! @param theAuto [in] fit selected objects (TRUE) or all objects (FALSE)
|
||||
static void fitAllObjects (bool theAuto,
|
||||
bool theToUpdate);
|
||||
static void fitAllObjects (bool theAuto);
|
||||
|
||||
//! Return the list of displayed objects.
|
||||
static std::string displayedObjects();
|
||||
//! Remove named object from viewer.
|
||||
//! @param theName [in] object name
|
||||
//! @return FALSE if object was not found
|
||||
static bool removeObject (const std::string& theName);
|
||||
|
||||
//! Return the list of selected objects.
|
||||
static std::string selectedObjects();
|
||||
|
||||
//! Return the list of erased objects.
|
||||
static std::string erasedObjects();
|
||||
//! Temporarily hide named object.
|
||||
//! @param theName [in] object name
|
||||
//! @return FALSE if object was not found
|
||||
static bool eraseObject (const std::string& theName);
|
||||
|
||||
//! Display temporarily hidden object.
|
||||
//! @param theNames [in] object name list
|
||||
//! @param theName [in] object name
|
||||
//! @return FALSE if object was not found
|
||||
static bool displayObjectList (const std::string& theNames,
|
||||
bool theToUpdate);
|
||||
|
||||
//! Remove named objects from viewer.
|
||||
//! @param theNames [in] object name found
|
||||
//! @return FALSE if object was not found
|
||||
static bool removeObjectList (const std::string& theNames,
|
||||
bool theToUpdate);
|
||||
|
||||
//! Temporarily hide named objects.
|
||||
//! @param theNames [in] object name list
|
||||
//! @return FALSE if object was not found
|
||||
static bool eraseObjectList (const std::string& theNames,
|
||||
bool theToUpdate);
|
||||
|
||||
//! Return TRUE if ground is displayed.
|
||||
static bool toShowGround();
|
||||
static bool displayObject (const std::string& theName);
|
||||
|
||||
//! Show/hide ground.
|
||||
//! @param theToShow [in] show or hide flag
|
||||
static void setShowGround (bool theToShow,
|
||||
bool theToUpdate);
|
||||
static void displayGround (bool theToShow);
|
||||
|
||||
//! Open object from the given URL.
|
||||
//! File will be loaded asynchronously.
|
||||
//! @param theName [in] object name
|
||||
//! @param theModelPath [in] model path
|
||||
//! @param theToExpand [in] expand model or display as a single part
|
||||
static void openFromUrl (const std::string& theName,
|
||||
const std::string& theModelPath,
|
||||
const bool theToExpand);
|
||||
const std::string& theModelPath);
|
||||
|
||||
//! Open object from memory.
|
||||
//! @param theName [in] object name
|
||||
//! @param theToExpand [in] expand model or display as a single part
|
||||
//! @param theBuffer [in] pointer to data
|
||||
//! @param theDataLen [in] data length
|
||||
//! @param theToFree [in] free theBuffer if set to TRUE
|
||||
//! @param theName [in] object name
|
||||
//! @param theBuffer [in] pointer to data
|
||||
//! @param theDataLen [in] data length
|
||||
//! @param theToFree [in] free theBuffer if set to TRUE
|
||||
//! @return FALSE on reading error
|
||||
static bool openFromMemory (const std::string& theName,
|
||||
const bool theToExpand,
|
||||
uintptr_t theBuffer, int theDataLen,
|
||||
bool theToFree);
|
||||
|
||||
//! Open BRep object from memory.
|
||||
//! @param theName [in] object name
|
||||
//! @param theToExpand [in] expand model or display as a single part
|
||||
//! @param theBuffer [in] pointer to data
|
||||
//! @param theDataLen [in] data length
|
||||
//! @param theToFree [in] free theBuffer if set to TRUE
|
||||
//! @param theName [in] object name
|
||||
//! @param theBuffer [in] pointer to data
|
||||
//! @param theDataLen [in] data length
|
||||
//! @param theToFree [in] free theBuffer if set to TRUE
|
||||
//! @return FALSE on reading error
|
||||
static bool openBRepFromMemory (const std::string& theName,
|
||||
const bool theToExpand,
|
||||
uintptr_t theBuffer, int theDataLen,
|
||||
bool theToFree);
|
||||
|
||||
//! Open glTF object from memory.
|
||||
//! @param theName [in] object name
|
||||
//! @param theToExpand [in] expand model or display as a single part
|
||||
//! @param theBuffer [in] pointer to data
|
||||
//! @param theDataLen [in] data length
|
||||
//! @param theToFree [in] free theBuffer if set to TRUE
|
||||
//! @return FALSE on reading error
|
||||
static bool openGltfFromMemory (const std::string& theName,
|
||||
const bool theToExpand,
|
||||
uintptr_t theBuffer, int theDataLen,
|
||||
bool theToFree);
|
||||
|
||||
//! Displayed map changed notification.
|
||||
void onDisplayedObjectsChanged();
|
||||
|
||||
public:
|
||||
|
||||
//! Default constructor.
|
||||
@@ -270,11 +209,6 @@ private:
|
||||
static EM_BOOL onKeyUpCallback (int theEventType, const EmscriptenKeyboardEvent* theEvent, void* theView)
|
||||
{ return ((WasmOcctView* )theView)->onKeyUpEvent (theEventType, theEvent); }
|
||||
|
||||
//! Callback called by handleMoveTo() on Selection in 3D Viewer.
|
||||
//! This method is expected to be called from rendering thread.
|
||||
virtual void OnSelectionChanged (const Handle(AIS_InteractiveContext)& theCtx,
|
||||
const Handle(V3d_View)& theView) override;
|
||||
|
||||
private:
|
||||
|
||||
//! Register hot-keys for specified Action.
|
||||
@@ -303,8 +237,6 @@ private:
|
||||
private:
|
||||
|
||||
NCollection_IndexedDataMap<TCollection_AsciiString, Handle(AIS_InteractiveObject)> myObjects; //!< map of named objects
|
||||
bool myToShowGround = true;
|
||||
|
||||
|
||||
NCollection_DataMap<unsigned int, Aspect_VKey> myNavKeyMap; //!< map of Hot-Key (key+modifiers) to Action
|
||||
|
||||
|
@@ -20,7 +20,7 @@ extern "C" void onMainLoop()
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE int main()
|
||||
{
|
||||
Message::DefaultMessenger()->Printers().First()->SetTraceLevel (Message_Info);
|
||||
Message::DefaultMessenger()->Printers().First()->SetTraceLevel (Message_Trace);
|
||||
Handle(Message_PrinterSystemLog) aJSConsolePrinter = new Message_PrinterSystemLog ("webgl-sample", Message_Trace);
|
||||
Message::DefaultMessenger()->AddPrinter (aJSConsolePrinter); // open JavaScript console within the Browser to see this output
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString("NbLogicalProcessors: ") + OSD_Parallel::NbLogicalProcessors(), Message_Trace);
|
||||
|
@@ -9,29 +9,17 @@
|
||||
|
||||
<h2>OCCT WebGL Viewer Sample</h2>
|
||||
<div>
|
||||
<canvas id=occViewerCanvas oncontextmenu=event.preventDefault() tabindex=-1 style="border:0 none;background-color:#000" width="409" height="409"></canvas>
|
||||
<canvas id=occViewerCanvas oncontextmenu=event.preventDefault() tabindex=-1 style="border:0 none;background-color:#000" width="409" height="409"></canvas>
|
||||
<img id=occlogo src="OCC_logo.png" style="position: absolute; left: 20px; top: 0px; z-index: 2;" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="inputCheckShadows"><label for="inputCheckShadows">Shadows</label>
|
||||
<input type="checkbox" id="inputAntiAliasing"><label for="inputAntiAliasing">Antialiasing</label>
|
||||
<input type="checkbox" id="inputCheckGround" ><label for="inputCheckGround">Ground</label>
|
||||
<input type="checkbox" id="inputCheckSkyBox" ><label for="inputCheckSkyBox">SkyBox</label>
|
||||
<input type="checkbox" id="inputCheckHighlight"><label for="inputCheckHighlight">Dynamic highlight</label>
|
||||
<br>
|
||||
<input type="button" value="Clear All" onclick="OccViewerModule.removeAllObjects(true)">
|
||||
<input type="file" id="inputUploadModel" accept=".gltf, .glb">
|
||||
<input type="button" value="Upload File" onclick="doInputUploadModel()">
|
||||
<input type="button" value="Fit All" onclick="OccViewerModule.fitAllObjects(true, true)">
|
||||
<input type="button" value="Hide selected" onclick="doEraseSelected()">
|
||||
<input type="button" value="Show hidden" onclick="doShowErased()">
|
||||
<br>
|
||||
<input type="checkbox" id="inputCheckExpand" ><label for="inputCheckExpand">Expand model</label>
|
||||
<label for="fileInput">Choose BREP file to upload: </label><input type="file" id="fileInput" accept=".brep">
|
||||
<input type="button" value="Clear All" onclick="OccViewerModule.removeAllObjects()">
|
||||
<input type="button" value="Fit All" onclick="OccViewerModule.fitAllObjects(true)">
|
||||
</div>
|
||||
<h4>Console output:</h4>
|
||||
<p id="output"></p>
|
||||
|
||||
<script type="text/javascript" src="occt-webgl-sample.js" charset="utf-8"></script>
|
||||
<script>
|
||||
//! Resize canvas to fit into window.
|
||||
function updateCanvasSize()
|
||||
@@ -48,6 +36,8 @@ function updateCanvasSize()
|
||||
var aDevicePixelRatio = window.devicePixelRatio || 1;
|
||||
occViewerCanvas.width = aSizeX * aDevicePixelRatio;
|
||||
occViewerCanvas.height = aSizeY * aDevicePixelRatio;
|
||||
|
||||
occlogo.style.top = (aSizeY - 30) + "px";
|
||||
}
|
||||
window.onresize = updateCanvasSize;
|
||||
updateCanvasSize();
|
||||
@@ -73,89 +63,25 @@ if (!isWasmSupported())
|
||||
anElement.innerHTML += "Browser is too old - WebAssembly support is missing!<br>Please check updates or install a modern browser.<br>";
|
||||
}
|
||||
|
||||
var OccViewerModule =
|
||||
{
|
||||
print: (function() {
|
||||
var anElement = document.getElementById('output');
|
||||
return function(theText) { anElement.innerHTML += theText + "<br>"; };
|
||||
})(),
|
||||
printErr: function(theText) { console.warn(theText); },
|
||||
canvas: (function() {
|
||||
var aCanvas = document.getElementById('occViewerCanvas');
|
||||
//var aGlCtx = aCanvas.getContext ('webgl2', { alpha: false, depth: true, antialias: false, preserveDrawingBuffer: true } );
|
||||
//if (aGlCtx == null) { aGlCtx = aCanvas.getContext ('webgl', { alpha: false, depth: true, antialias: false, preserveDrawingBuffer: true } ); }
|
||||
return aCanvas;
|
||||
})(),
|
||||
|
||||
onRuntimeInitialized: function() {
|
||||
//console.log(" @@ onRuntimeInitialized()" + Object.getOwnPropertyNames(OccViewerModule));
|
||||
},
|
||||
|
||||
onDisplayedObjectsChanged: function() {
|
||||
console.log(" @@ onDisplayedObjectsChanged() " + OccViewerModule.displayedObjects());
|
||||
},
|
||||
onSelectedObjectsChanged: function() {
|
||||
console.log(" @@ onSelectedObjectsChanged() " + OccViewerModule.selectedObjects());
|
||||
}
|
||||
};
|
||||
|
||||
const OccViewerModuleInitialized = createOccViewerModule(OccViewerModule);
|
||||
OccViewerModuleInitialized.then(function(Module) {
|
||||
//var aSkyBox = "textures/cubemap512.jpg"; // "textures/cubemap2048.jpg";
|
||||
var aSkyBox = "textures/cubemap2048.jpg";
|
||||
var aDefModel = "models/yellow_up.glb";
|
||||
OccViewerModule.setBackgroundCubemap (aSkyBox);
|
||||
OccViewerModule.openFromUrl (aDefModel, aDefModel, false);
|
||||
|
||||
inputCheckShadows.checked = OccViewerModule.toCastShadows();
|
||||
inputCheckShadows.onchange = function() { OccViewerModule.setCastShadows (inputCheckShadows.checked, true); }
|
||||
inputAntiAliasing.checked = OccViewerModule.isAntiAliasingOn();
|
||||
inputAntiAliasing.onchange = function() { OccViewerModule.setAntiAliasingOn (inputAntiAliasing.checked, true); }
|
||||
inputCheckGround .checked = OccViewerModule.toShowGround();
|
||||
inputCheckGround .onchange = function() { OccViewerModule.setShowGround (inputCheckGround.checked, true); }
|
||||
inputCheckHighlight.checked = OccViewerModule.toDynamicHighlight();
|
||||
inputCheckHighlight.onchange = function() { OccViewerModule.setDynamicHighlight (inputCheckHighlight.checked); }
|
||||
inputCheckSkyBox .checked = true;
|
||||
inputCheckSkyBox .onchange = function() {
|
||||
if (inputCheckSkyBox.checked) { OccViewerModule.setBackgroundCubemap (aSkyBox); }
|
||||
else { OccViewerModule.setBackgroundColor (0.0, 0.0, 0.0, true); }
|
||||
}
|
||||
inputCheckExpand.checked = false;
|
||||
inputCheckExpand.onchange = function() {
|
||||
OccViewerModule.removeAllObjects (true);
|
||||
OccViewerModule.openFromUrl (aDefModel, aDefModel, inputCheckExpand.checked);
|
||||
}
|
||||
});
|
||||
|
||||
//! Handle erasing.
|
||||
function doEraseSelected()
|
||||
{
|
||||
var aSelected = OccViewerModule.selectedObjects();
|
||||
OccViewerModule.eraseObjectList (aSelected, true);
|
||||
}
|
||||
|
||||
//! Handle show all.
|
||||
function doShowErased()
|
||||
{
|
||||
var anErased = OccViewerModule.erasedObjects();
|
||||
OccViewerModule.displayObjectList (anErased, true);
|
||||
}
|
||||
|
||||
//! Handle file uploading.
|
||||
function doInputUploadModel()
|
||||
fileInput.onchange = function()
|
||||
{
|
||||
if (inputUploadModel.files.length == 0) { return; }
|
||||
var aFile = inputUploadModel.files[0];
|
||||
var aReader = new FileReader(); // Warning! Entire file is pre-loaded into memory
|
||||
aReader.onload = function() {
|
||||
if (fileInput.files.length == 0) { return; }
|
||||
// Warning! Entire file is pre-loaded into memory.
|
||||
var aFile = fileInput.files[0];
|
||||
var aReader = new FileReader();
|
||||
aReader.onload = function()
|
||||
{
|
||||
var aDataArray = new Uint8Array (aReader.result);
|
||||
const aDataBuffer = OccViewerModule._malloc (aDataArray.length);
|
||||
OccViewerModule.HEAPU8.set (aDataArray, aDataBuffer);
|
||||
OccViewerModule.openFromMemory (aFile.name, inputCheckExpand.checked, aDataBuffer, aDataArray.length, true);
|
||||
OccViewerModule.openFromMemory (aFile.name, aDataBuffer, aDataArray.length, true);
|
||||
//OccViewerModule._free (aDataBuffer); will be freed by called method
|
||||
OccViewerModule.displayGround (true);
|
||||
};
|
||||
aReader.readAsArrayBuffer (aFile);
|
||||
aReader.readAsArrayBuffer(aFile);
|
||||
};
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="occt-webgl-sample.js" charset="utf-8"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
28
samples/webgl/occt-webgl-viewer.js
Normal file
28
samples/webgl/occt-webgl-viewer.js
Normal file
@@ -0,0 +1,28 @@
|
||||
var OccViewerModule =
|
||||
{
|
||||
print: (function() {
|
||||
var anElement = document.getElementById('output');
|
||||
return function(theText) { anElement.innerHTML += theText + "<br>"; };
|
||||
})(),
|
||||
printErr: function(theText) {
|
||||
//var anElement = document.getElementById('output');
|
||||
//anElement.innerHTML += theText + "<br>";
|
||||
console.warn(theText);
|
||||
},
|
||||
canvas: (function() {
|
||||
var aCanvas = document.getElementById('occViewerCanvas');
|
||||
var aGlCtx = aCanvas.getContext ('webgl2', { alpha: false, depth: true, antialias: false, preserveDrawingBuffer: true } );
|
||||
if (aGlCtx == null) { aGlCtx = aCanvas.getContext ('webgl', { alpha: false, depth: true, antialias: false, preserveDrawingBuffer: true } ); }
|
||||
return aCanvas;
|
||||
})(),
|
||||
|
||||
onRuntimeInitialized: function() {
|
||||
//console.log(" @@ onRuntimeInitialized()" + Object.getOwnPropertyNames(OccViewerModule));
|
||||
}
|
||||
};
|
||||
|
||||
const OccViewerModuleInitialized = createOccViewerModule(OccViewerModule);
|
||||
OccViewerModuleInitialized.then(function(Module) {
|
||||
//OccViewerModule.setCubemapBackground ("cubemap.jpg");
|
||||
OccViewerModule.openFromUrl ("ball", "samples/Ball.brep");
|
||||
});
|
@@ -1,110 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang=en-us>
|
||||
<head>
|
||||
<meta charset=utf-8><meta content="text/html; charset=utf-8" http-equiv=Content-Type>
|
||||
<link rel="shortcut icon" href="lamp.ico" type="image/x-icon" />
|
||||
<title>Three.js Viewer Sample</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h2>Three.js Viewer Sample</h2>
|
||||
<div>
|
||||
<canvas id=occViewerCanvas oncontextmenu=event.preventDefault() tabindex=-1 style="border:0 none;background-color:#000" width="409" height="409"></canvas>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="checkbox" id="inputCheckShadows"><label for="inputCheckShadows">Shadows</label>
|
||||
<input type="checkbox" id="inputAntiAliasing"><label for="inputAntiAliasing">Antialiasing</label>
|
||||
<input type="checkbox" id="inputCheckGround" ><label for="inputCheckGround">Ground</label>
|
||||
<input type="checkbox" id="inputCheckSkyBox" ><label for="inputCheckSkyBox">SkyBox</label>
|
||||
<input type="checkbox" id="inputCheckHighlight"><label for="inputCheckHighlight">Dynamic highlight</label>
|
||||
<br>
|
||||
<input type="button" value="Clear All" onclick="OccViewerModule.removeAllObjects(true)">
|
||||
<input type="file" id="inputUploadModel" accept=".gltf, .glb">
|
||||
<input type="button" value="Upload File" onclick="doInputUploadModel()">
|
||||
<input type="button" value="Fit All" onclick="OccViewerModule.fitAllObjects(true, true)">
|
||||
<input type="button" value="Hide selected" onclick="doEraseSelected()">
|
||||
<input type="button" value="Show hidden" onclick="doShowErased()">
|
||||
<br>
|
||||
<input type="checkbox" id="inputCheckExpand" ><label for="inputCheckExpand">Expand model</label>
|
||||
</div>
|
||||
<h4>Console output:</h4>
|
||||
<p id="output"></p>
|
||||
|
||||
<script src="threejs/three.min.js"></script>
|
||||
<script src="threejs/OrbitControls.js"></script>
|
||||
<script src="threejs/GLTFLoader.js"></script>
|
||||
<script src="threejs/BufferGeometryUtils.js"></script>
|
||||
<script src="threejs/stats.min.js"></script>
|
||||
<script src="threejs-sample.js"></script>
|
||||
<script>
|
||||
//! Resize canvas to fit into window.
|
||||
function updateCanvasSize()
|
||||
{
|
||||
// size of canvas in logical (density-independent) units
|
||||
var aSizeX = Math.min (window.innerWidth, window.screen.availWidth);
|
||||
var aSizeY = Math.min (window.innerHeight, window.screen.availHeight);
|
||||
aSizeX = Math.max (300, aSizeX - 30);
|
||||
aSizeY = Math.max (300, aSizeY / 2);
|
||||
occViewerCanvas.style.width = aSizeX + "px";
|
||||
occViewerCanvas.style.height = aSizeY + "px";
|
||||
|
||||
// drawing buffer size (aka backing store)
|
||||
var aDevicePixelRatio = window.devicePixelRatio || 1;
|
||||
occViewerCanvas.width = aSizeX * aDevicePixelRatio;
|
||||
occViewerCanvas.height = aSizeY * aDevicePixelRatio;
|
||||
}
|
||||
window.onresize = updateCanvasSize;
|
||||
updateCanvasSize();
|
||||
|
||||
var aSkyBox = "textures/landing_pad/";
|
||||
var aDefModel = "models/yellow_up.glb";
|
||||
var aDefName = "yellow";
|
||||
var aDevicePixelRatio = window.devicePixelRatio || 1;
|
||||
inputAntiAliasing.checked = aDevicePixelRatio <= 1.25;
|
||||
var OccViewerModule = createOccThreejsViewer (document.getElementById ('occViewerCanvas'), aSkyBox, inputAntiAliasing.checked);
|
||||
OccViewerModule.openFromUrl (aDefName, aDefModel, false);
|
||||
//OccViewerModule.openFromUrl ("stork", "models/Stork.glb");
|
||||
//OccViewerModule.openFromUrl ("spheres", "models/spheres.glb");
|
||||
|
||||
inputCheckShadows.checked = OccViewerModule.toCastShadows();
|
||||
inputCheckShadows.onchange = function() { OccViewerModule.setCastShadows (inputCheckShadows.checked, true); }
|
||||
inputAntiAliasing.onchange = function() {}
|
||||
inputCheckGround .checked = OccViewerModule.toShowGround();
|
||||
inputCheckGround .onchange = function() { OccViewerModule.setShowGround (inputCheckGround.checked, true); }
|
||||
inputCheckHighlight.checked = OccViewerModule.toDynamicHighlight();
|
||||
inputCheckHighlight.onchange = function() { OccViewerModule.setDynamicHighlight (inputCheckHighlight.checked); }
|
||||
inputCheckSkyBox .checked = true;
|
||||
inputCheckSkyBox .onchange = function() {
|
||||
if (inputCheckSkyBox.checked) { OccViewerModule.setBackgroundCubemap (aSkyBox, true); }
|
||||
else { OccViewerModule.setBackgroundColor (0.0, 0.0, 0.0, true); }
|
||||
}
|
||||
inputCheckExpand.checked = false;
|
||||
inputCheckExpand.onchange = function() {
|
||||
OccViewerModule.removeAllObjects (true);
|
||||
OccViewerModule.openFromUrl (aDefName, aDefModel, inputCheckExpand.checked);
|
||||
}
|
||||
|
||||
//! Handle file uploading.
|
||||
inputUploadModel.onchange = function()
|
||||
{
|
||||
if (inputUploadModel.files.length == 0) { return; }
|
||||
// Warning! Entire file is pre-loaded into memory.
|
||||
var aFile = inputUploadModel.files[0];
|
||||
/*var aReader = new FileReader();
|
||||
aReader.onload = function()
|
||||
{
|
||||
var aDataArray = new Uint8Array (aReader.result);
|
||||
const aDataBuffer = OccViewerModule._malloc (aDataArray.length);
|
||||
OccViewerModule.HEAPU8.set (aDataArray, aDataBuffer);
|
||||
//OccViewerModule.openBRepFromMemory (aFile.name, aDataBuffer, aDataArray.length, true);
|
||||
OccViewerModule.openGltfFromMemory (aFile.name, aDataBuffer, aDataArray.length, true);
|
||||
//OccViewerModule._free (aDataBuffer); will be freed by called method
|
||||
OccViewerModule.displayGround (true);
|
||||
};
|
||||
aReader.readAsArrayBuffer(aFile);*/
|
||||
//OccViewerModule.openFromUrl ("object", aFile.name);
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@@ -1,354 +0,0 @@
|
||||
class OccThreejsViewer
|
||||
{
|
||||
myScene = new THREE.Scene();
|
||||
myRaycaster = new THREE.Raycaster();
|
||||
myObjects = new Map();
|
||||
myLastPicked = null;
|
||||
myLastPickedName = "";
|
||||
myToDynamicHighlight = true;
|
||||
myDynHighlightColor = 0x00FFFF;
|
||||
mySelectionColor = 0xFFFF00;
|
||||
myGround = null;
|
||||
myDirLight = new THREE.DirectionalLight (0xffffff, 1);
|
||||
|
||||
myFpsMeter = new Stats();
|
||||
|
||||
constructor (theCanvas, theCubemap, theAntiAlias)
|
||||
{
|
||||
var aViewer = this;
|
||||
|
||||
var aGlCtx = theCanvas.getContext ('webgl2', { alpha: false, depth: true, antialias: theAntiAlias, preserveDrawingBuffer: true } );
|
||||
if (aGlCtx == null) { aGlCtx = theCanvas.getContext ('webgl', { alpha: false, depth: true, antialias: theAntiAlias, preserveDrawingBuffer: true } ); }
|
||||
this.myCamera = new THREE.PerspectiveCamera (45, theCanvas.width / theCanvas.height, 0.1, 1000);
|
||||
this.myCamera.position.set (1, 1, 1);
|
||||
|
||||
this.myRenderer = new THREE.WebGLRenderer ({antialias: false, canvas: theCanvas, context: aGlCtx});
|
||||
this.myRenderer.autoClear = true;
|
||||
this.myRenderer.autoClearColor = true;
|
||||
this.myRenderer.autoClearDepth = true;
|
||||
this.myRenderer.autoClearStencil = true;
|
||||
this.myRenderer.setSize (theCanvas.width, theCanvas.height);
|
||||
this.myRenderer.outputEncoding = THREE.sRGBEncoding;
|
||||
this.myRenderer.shadowMap.enabled = true;
|
||||
//this.myRenderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
|
||||
|
||||
//this.myScene.background = new THREE.Color('black');
|
||||
this.setBackgroundCubemap (theCubemap, false);
|
||||
|
||||
this.myControls = new THREE.OrbitControls (this.myCamera, theCanvas);
|
||||
this.myControls.target.set (0, 0, -0.2);
|
||||
this.myControls.update();
|
||||
this.myControls.addEventListener ('change', function() { aViewer.updateView(); });
|
||||
|
||||
this.myDirLight.position.set (-0.098, 0.98, -0.20);
|
||||
this.myDirLight.position.normalize()
|
||||
this.myDirLight.castShadow = true;
|
||||
this.myScene.add (new THREE.HemisphereLight (0xffffff, 0x000000, 0.4));
|
||||
this.myScene.add (this.myDirLight);
|
||||
//const aShadowHelper = new THREE.CameraHelper (this.myDirLight.shadow.camera); this.myScene.add (aShadowHelper)
|
||||
|
||||
const aPlaneGeom = new THREE.PlaneBufferGeometry (15, 15, 32, 32);
|
||||
const aPlaneMat = new THREE.MeshStandardMaterial ({ color: 0xAAAAAA });
|
||||
this.myGround = new THREE.Mesh (aPlaneGeom, aPlaneMat);
|
||||
this.myGround.receiveShadow = true;
|
||||
this.myGround.position.y = -1.0;
|
||||
this.myGround.rotation.x = -1.57;
|
||||
this.myScene.add (this.myGround);
|
||||
this.updateView();
|
||||
|
||||
theCanvas.addEventListener ('click', this.onClick, false);
|
||||
theCanvas.addEventListener ('mousemove', this.onMouseMove, false);
|
||||
|
||||
// FPS meter
|
||||
this.myFpsMeter.showPanel (0);
|
||||
document.body.appendChild (this.myFpsMeter.dom);
|
||||
}
|
||||
|
||||
toDynamicHighlight() { return this.myToDynamicHighlight; }
|
||||
setDynamicHighlight(theToEnable) { this.myToDynamicHighlight = theToEnable; }
|
||||
|
||||
onMouseMove()
|
||||
{
|
||||
if (event.buttons !== 0) { return; }
|
||||
|
||||
var aViewer = OccViewerModule;
|
||||
if (!aViewer.myToDynamicHighlight) { return; }
|
||||
|
||||
var aTime1 = performance.now();
|
||||
event.preventDefault();
|
||||
var aMouse = new THREE.Vector2();
|
||||
aMouse.x = (event.clientX / aViewer.myRenderer.domElement.width) * 2 - 1;
|
||||
aMouse.y = -(event.clientY / aViewer.myRenderer.domElement.height) * 2 + 1;
|
||||
aViewer.myRaycaster.setFromCamera (aMouse, aViewer.myCamera);
|
||||
var anRes = aViewer.myRaycaster.intersectObject (aViewer.myScene, true);
|
||||
var aNewPicked = anRes.length > 0 ? anRes[0].object : null;
|
||||
if (aNewPicked !== aViewer.myLastPicked)
|
||||
{
|
||||
aViewer.myLastPickedName = "";
|
||||
if (aViewer.myLastPicked !== null)
|
||||
{
|
||||
aViewer.myLastPicked.material.color.set (aViewer.myLastPicked.material.userData.oldColor);
|
||||
aViewer.myLastPicked = null;
|
||||
}
|
||||
if (aNewPicked !== null)
|
||||
{
|
||||
for (var aParentIter = aNewPicked; aParentIter != null; aParentIter = aParentIter.parent)
|
||||
{
|
||||
if (aParentIter.name !== "")
|
||||
{
|
||||
if (aViewer.myLastPickedName !== "") { aViewer.myLastPickedName = "/" + aViewer.myLastPickedName; }
|
||||
aViewer.myLastPickedName = aParentIter.name + aViewer.myLastPickedName;
|
||||
}
|
||||
}
|
||||
var aTime2 = performance.now();
|
||||
console.log ( "New picked '" + aViewer.myLastPickedName + "' in " + ((aTime2 - aTime1) * 0.001) + " s") ///
|
||||
|
||||
aNewPicked.material.userData.oldColor = aNewPicked.material.color.getHex();
|
||||
aNewPicked.material.color.set (aViewer.myDynHighlightColor);
|
||||
aViewer.myLastPicked = aNewPicked;
|
||||
}
|
||||
aViewer.updateView();
|
||||
}
|
||||
}
|
||||
|
||||
onClick()
|
||||
{
|
||||
var aViewer = OccViewerModule;
|
||||
event.preventDefault();
|
||||
if (aViewer.myLastPicked !== null)
|
||||
{
|
||||
aViewer.myLastPicked.material.color.set (aViewer.mySelectionColor);
|
||||
aViewer.myLastPicked = null
|
||||
}
|
||||
aViewer.updateView();
|
||||
}
|
||||
|
||||
setBackgroundColor (theR, theG, theB, theToUpdate)
|
||||
{
|
||||
this.myScene.background = new THREE.Color (theR, theG, theB);
|
||||
if (theToUpdate) { this.updateView(); }
|
||||
}
|
||||
|
||||
setBackgroundCubemap (theFolderPath, theToUpdate)
|
||||
{
|
||||
this.myScene.background = new THREE.CubeTextureLoader()
|
||||
.setPath (theFolderPath)
|
||||
.load (['px.jpg','nx.jpg','py.jpg','ny.jpg','pz.jpg','nz.jpg']);
|
||||
|
||||
/// TODO disable sRGB for consistency with OCCT sample workaround
|
||||
//this.myScene.background.encoding = THREE.sRGBEncoding;
|
||||
|
||||
if (theToUpdate) { this.updateView(); }
|
||||
}
|
||||
|
||||
/**
|
||||
* Fit all/selected objects into view.
|
||||
* @param {boolean} theAuto [in] fit selected objects (TRUE) or all objects (FALSE)
|
||||
*/
|
||||
fitAllObjects(theAuto, theToUpdate)
|
||||
{
|
||||
const aFitOffset = 1.2
|
||||
const aBox = new THREE.Box3();
|
||||
//this.myScene.traverse (function (theChild) { aBox.expandByObject (theChild) });
|
||||
for (let [aKey, anObjIter] of this.myObjects)
|
||||
{
|
||||
aBox.expandByObject (anObjIter);
|
||||
}
|
||||
|
||||
const aSize = aBox.getSize (new THREE.Vector3());
|
||||
const aCenter = aBox.getCenter(new THREE.Vector3());
|
||||
console.log (" @@ aSize= " + aSize.x + "x" + aSize.y + "x" + aSize.z) ///
|
||||
|
||||
const aMaxSize = Math.max (aSize.x, aSize.y, aSize.z);
|
||||
const aFitHeightDist = aMaxSize / (2 * Math.atan (Math.PI * this.myCamera.fov / 360));
|
||||
const aFitWidthDist = aFitHeightDist / this.myCamera.aspect;
|
||||
const aDist = aFitOffset * Math.max (aFitHeightDist, aFitWidthDist);
|
||||
|
||||
const aDir = this.myControls.target.clone()
|
||||
.sub (this.myCamera.position).normalize().multiplyScalar (aDist);
|
||||
this.myControls.maxDistance = aDist * 10;
|
||||
this.myControls.target.copy (aCenter);
|
||||
|
||||
this.myCamera.near = aDist / 100;
|
||||
this.myCamera.far = aDist * 100;
|
||||
this.myCamera.updateProjectionMatrix();
|
||||
|
||||
this.myCamera.position.copy (this.myControls.target).sub (aDir);
|
||||
this.myControls.update();
|
||||
if (theToUpdate) { this.updateView(); }
|
||||
}
|
||||
|
||||
/**
|
||||
* Redraw the view.
|
||||
*/
|
||||
updateView()
|
||||
{
|
||||
this.myFpsMeter.begin();
|
||||
|
||||
this.myRenderer.render (this.myScene, this.myCamera);
|
||||
|
||||
this.myFpsMeter.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove named object from viewer.
|
||||
* @param {string} theName [in] object name
|
||||
* @param {boolean} theToUpdate [in] immediatly request viewer update
|
||||
* @return {boolean} FALSE if object was not found
|
||||
*/
|
||||
removeObject (theName, theToUpdate)
|
||||
{
|
||||
var anOldObj = this.myObjects.get (theName);
|
||||
if (anOldObj !== undefined)
|
||||
{
|
||||
this.myScene.remove (anOldObj);
|
||||
this.myObjects.delete (theName)
|
||||
if (theToUpdate) { this.updateView(); }
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all named objects from viewer.
|
||||
*/
|
||||
removeAllObjects (theToUpdate)
|
||||
{
|
||||
for (let [aKey, anObjIter] of this.myObjects)
|
||||
{
|
||||
this.myScene.remove (anObjIter);
|
||||
}
|
||||
this.myObjects.clear();
|
||||
if (theToUpdate) { this.updateView(); }
|
||||
}
|
||||
|
||||
/** Return TRUE if ground is displayed */
|
||||
toShowGround() { return this.myGround.parent === this.myScene; }
|
||||
|
||||
/**
|
||||
* Show/hide ground.
|
||||
* @param theToShow [in] show or hide flag
|
||||
*/
|
||||
setShowGround (theToShow, theToUpdate)
|
||||
{
|
||||
if (theToShow)
|
||||
{
|
||||
if (this.myGround.parent !== this.myScene)
|
||||
{
|
||||
this.myScene.add (this.myGround);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.myScene.remove (this.myGround);
|
||||
}
|
||||
if (theToUpdate) { this.updateView(); }
|
||||
}
|
||||
|
||||
/** Returns TRUE if shadows are turned ON */
|
||||
toCastShadows() { return this.myDirLight.castShadow; }
|
||||
|
||||
/** Turn shadows on/off */
|
||||
setCastShadows (theUseShadows, theToUpdate)
|
||||
{
|
||||
this.myDirLight.castShadow = theUseShadows;
|
||||
if (theToUpdate) { this.updateView(); }
|
||||
}
|
||||
|
||||
/**
|
||||
* Open object from the given URL.
|
||||
* File will be loaded asynchronously.
|
||||
* @param {string} theName [in] object name
|
||||
* @param {string} theModelPath [in] model path
|
||||
* @param {boolean} theToExpand [in] expand (explore) model or represent it as single object
|
||||
*/
|
||||
openFromUrl (theName, theModelPath, theToExpand)
|
||||
{
|
||||
this.removeObject (theName, false);
|
||||
var aViewer = this;
|
||||
|
||||
var aTime1 = performance.now();
|
||||
const aLoader = new THREE.GLTFLoader();
|
||||
//aLoader.setPath();
|
||||
aLoader.load (theModelPath, function (theGltf) {
|
||||
if (theToExpand)
|
||||
{
|
||||
theGltf.scene.traverse (function (theChild) {
|
||||
if (theChild.isMesh)
|
||||
{
|
||||
theChild.material = theChild.material.clone(); // duplicate materials to dynamically highlight nodes
|
||||
theChild.material.envMap = aViewer.myScene.background;
|
||||
theChild.castShadow = true;
|
||||
theChild.receiveShadow = true
|
||||
}
|
||||
});
|
||||
|
||||
var aModelRoot = theGltf.scene;
|
||||
aModelRoot.name = theName;
|
||||
aViewer.myScene.add (aModelRoot);
|
||||
aViewer.myObjects.set (theName, aModelRoot);
|
||||
aViewer.fitAllObjects();
|
||||
return;
|
||||
}
|
||||
|
||||
// merge meshes with common material
|
||||
var isFirst = true
|
||||
const aMatMap = new Map();
|
||||
theGltf.scene.traverse (function (theChild) {
|
||||
if (theChild.isMesh)
|
||||
{
|
||||
var aMatObjects = aMatMap.get (theChild.material.name)
|
||||
if (aMatObjects === undefined)
|
||||
{
|
||||
var aMatObjects = [];
|
||||
aMatMap.set (theChild.material.name, aMatObjects)
|
||||
}
|
||||
aMatObjects.push (theChild)
|
||||
}
|
||||
});
|
||||
|
||||
var aModelRoot = new THREE.Group();
|
||||
aModelRoot.name = theName;
|
||||
theGltf.scene.updateMatrixWorld();
|
||||
for (let [aMatName, aMeshes] of aMatMap)
|
||||
{
|
||||
const aGeomList = [];
|
||||
for (let i = 0; i < aMeshes.length; ++i)
|
||||
{
|
||||
const aMesh = aMeshes[i];
|
||||
if (aMesh.geometry.applyMatrix4 != undefined)
|
||||
{
|
||||
aMesh.geometry.applyMatrix4 (aMesh.matrixWorld); // pre-apply transformation
|
||||
}
|
||||
else
|
||||
{
|
||||
aMesh.geometry.applyMatrix (aMesh.matrixWorld); // pre-apply transformation
|
||||
}
|
||||
aGeomList.push (aMesh.geometry);
|
||||
}
|
||||
|
||||
const aMaterial = aMeshes[0].material;
|
||||
aMaterial.envMap = aViewer.myScene.background;
|
||||
const aGeom = THREE.BufferGeometryUtils.mergeBufferGeometries (aGeomList);
|
||||
const aNode = new THREE.Mesh (aGeom, aMaterial);
|
||||
aNode.name = "";
|
||||
aNode.castShadow = true;
|
||||
aNode.receiveShadow = true
|
||||
aModelRoot.add (aNode);
|
||||
}
|
||||
|
||||
aViewer.myScene.add (aModelRoot);
|
||||
aViewer.myObjects.set (theName, aModelRoot);
|
||||
aViewer.fitAllObjects();
|
||||
|
||||
var aTime2 = performance.now();
|
||||
console.log ("glTF '" + theModelPath + "' loading time: " + ((aTime2 - aTime1) * 0.001) + " s");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function createOccThreejsViewer (theCanvas, theCubemap, theAntiAlias)
|
||||
{
|
||||
let aViewer = new OccThreejsViewer (theCanvas, theCubemap, theAntiAlias);
|
||||
return aViewer;
|
||||
}
|
@@ -42,11 +42,8 @@ DEFINE_STANDARD_HANDLE(AIS_AttributeFilter, SelectMgr_Filter)
|
||||
//! filters, which are in position when a local context is open.
|
||||
class AIS_AttributeFilter : public SelectMgr_Filter
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
||||
//! Constructs an empty attribute filter object.
|
||||
//! This filter object determines whether selectable
|
||||
//! interactive objects have a non-null owner.
|
||||
@@ -65,29 +62,33 @@ public:
|
||||
|
||||
//! Indicates that the Interactive Object has the color
|
||||
//! setting specified by the argument aCol at construction time.
|
||||
Standard_Boolean HasColor() const;
|
||||
|
||||
Standard_Boolean HasColor() const { return hasC; }
|
||||
|
||||
//! Indicates that the Interactive Object has the width
|
||||
//! setting specified by the argument aWidth at
|
||||
//! construction time.
|
||||
Standard_Boolean HasWidth() const;
|
||||
|
||||
//! Sets the color aCol.
|
||||
//! This must be chosen from the list of colors in Quantity_NameOfColor.
|
||||
void SetColor (const Quantity_NameOfColor aCol);
|
||||
|
||||
//! Sets the line width aWidth.
|
||||
void SetWidth (const Standard_Real aWidth);
|
||||
|
||||
Standard_Boolean HasWidth() const { return hasW; }
|
||||
|
||||
//! Sets the color.
|
||||
void SetColor (const Quantity_NameOfColor theCol)
|
||||
{
|
||||
myCol = theCol;
|
||||
hasC = Standard_True;
|
||||
}
|
||||
|
||||
//! Sets the line width.
|
||||
void SetWidth (const Standard_Real theWidth)
|
||||
{
|
||||
myWid = theWidth;
|
||||
hasW = Standard_True;
|
||||
}
|
||||
|
||||
//! Removes the setting for color from the filter.
|
||||
void UnsetColor();
|
||||
|
||||
void UnsetColor() { hasC = Standard_False; }
|
||||
|
||||
//! Removes the setting for width from the filter.
|
||||
void UnsetWidth();
|
||||
|
||||
void UnsetWidth() { hasW = Standard_False; }
|
||||
|
||||
//! Indicates that the selected Interactive Object passes
|
||||
//! the filter. The owner, anObj, can be either direct or
|
||||
//! user. A direct owner is the corresponding
|
||||
@@ -98,32 +99,15 @@ public:
|
||||
//! the mouse, the object is kept; if not, it is rejected.
|
||||
Standard_EXPORT virtual Standard_Boolean IsOk (const Handle(SelectMgr_EntityOwner)& anObj) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_AttributeFilter,SelectMgr_Filter)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Quantity_NameOfColor myCol;
|
||||
Standard_Real myWid;
|
||||
Standard_Boolean hasC;
|
||||
Standard_Boolean hasW;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <AIS_AttributeFilter.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_AttributeFilter_HeaderFile
|
||||
|
@@ -1,33 +0,0 @@
|
||||
// Created on: 1997-03-04
|
||||
// Created by: Robert COUBLANC
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
inline void AIS_AttributeFilter::SetColor(const Quantity_NameOfColor aCol)
|
||||
{myCol = aCol;hasC = Standard_True;}
|
||||
|
||||
inline void AIS_AttributeFilter::SetWidth(const Standard_Real aWid)
|
||||
{myWid=aWid;hasW = Standard_True;}
|
||||
|
||||
inline void AIS_AttributeFilter::UnsetColor()
|
||||
{hasC = Standard_False;}
|
||||
|
||||
inline void AIS_AttributeFilter::UnsetWidth()
|
||||
{hasW = Standard_False;}
|
||||
|
||||
inline Standard_Boolean AIS_AttributeFilter::HasColor() const
|
||||
{return hasC;}
|
||||
|
||||
inline Standard_Boolean AIS_AttributeFilter::HasWidth() const
|
||||
{return hasW;}
|
@@ -161,24 +161,23 @@ void AIS_Axis::SetAxis1Placement(const Handle(Geom_Axis1Placement)& anAxis)
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Axis::Compute(const Handle(PrsMgr_PresentationManager3d)&,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer)
|
||||
void AIS_Axis::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer )
|
||||
{
|
||||
aPresentation->SetInfiniteState (myInfiniteState);
|
||||
|
||||
aPresentation->SetDisplayPriority(5);
|
||||
if (!myIsXYZAxis ){
|
||||
GeomAdaptor_Curve curv(myComponent);
|
||||
StdPrs_Curve::Add(aPresentation,curv,myDrawer);
|
||||
thePrs->SetInfiniteState (myInfiniteState);
|
||||
thePrs->SetDisplayPriority(5);
|
||||
if (!myIsXYZAxis)
|
||||
{
|
||||
GeomAdaptor_Curve curv (myComponent);
|
||||
StdPrs_Curve::Add (thePrs, curv, myDrawer);
|
||||
}
|
||||
else
|
||||
{
|
||||
DsgPrs_XYZAxisPresentation::Add (aPresentation,myLineAspect,myDir,myVal,
|
||||
DsgPrs_XYZAxisPresentation::Add (thePrs, myLineAspect, myDir, myVal,
|
||||
myDrawer->DatumAspect()->ToDrawLabels() ? myText : "",
|
||||
myPfirst, myPlast);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -98,10 +98,13 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void ComputeFields();
|
||||
|
||||
private:
|
||||
|
@@ -229,9 +229,9 @@ void AIS_CameraFrustum::fillBorders()
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_CameraFrustum::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
void AIS_CameraFrustum::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
thePrs->SetInfiniteState (true);
|
||||
if (myTriangles.IsNull())
|
||||
|
@@ -58,9 +58,9 @@ public:
|
||||
protected:
|
||||
|
||||
//! Computes presentation of camera frustum.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Compute selection.
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
|
@@ -72,15 +72,14 @@ AIS_Circle::AIS_Circle(const Handle(Geom_Circle)& theComponent,
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Circle::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer /*aMode*/)
|
||||
void AIS_Circle::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer )
|
||||
{
|
||||
aPresentation->SetDisplayPriority(5);
|
||||
|
||||
if (myCircleIsArc) ComputeArc(aPresentation);
|
||||
else ComputeCircle(aPresentation);
|
||||
thePrs->SetDisplayPriority (5);
|
||||
|
||||
if (myCircleIsArc) { ComputeArc (thePrs); }
|
||||
else { ComputeCircle (thePrs); }
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -92,16 +92,19 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& theprs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void ComputeCircle (const Handle(Prs3d_Presentation)& aPresentation);
|
||||
|
||||
|
||||
Standard_EXPORT void ComputeArc (const Handle(Prs3d_Presentation)& aPresentation);
|
||||
|
||||
|
||||
Standard_EXPORT void ComputeCircleSelection (const Handle(SelectMgr_Selection)& aSelection);
|
||||
|
||||
|
||||
Standard_EXPORT void ComputeArcSelection (const Handle(SelectMgr_Selection)& aSelection);
|
||||
|
||||
//! Replace aspects of already computed groups with the new value.
|
||||
|
@@ -545,7 +545,7 @@ void AIS_ColorScale::updateTextAspect()
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ColorScale::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
void AIS_ColorScale::Compute (const Handle(PrsMgr_PresentationManager)& ,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
|
@@ -392,7 +392,7 @@ public:
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
|
||||
|
||||
//! Compute presentation.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
|
@@ -33,7 +33,7 @@
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <StdSelect_BRepSelectionTool.hxx>
|
||||
#include <StdPrs_ShadedShape.hxx>
|
||||
@@ -349,9 +349,9 @@ void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (myshape.IsNull())
|
||||
{
|
||||
|
@@ -95,9 +95,9 @@ public:
|
||||
protected: //! @name override presentation computation
|
||||
|
||||
//! Compute presentation considering sub-shape color map.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Compute selection considering sub-shape hidden state.
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
|
@@ -110,9 +110,9 @@ void AIS_ConnectedInteractive::Disconnect()
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_ConnectedInteractive::Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
void AIS_ConnectedInteractive::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (HasConnection())
|
||||
{
|
||||
|
@@ -103,7 +103,9 @@ protected:
|
||||
//! compute anything, but just uses the
|
||||
//! presentation of this last object, with
|
||||
//! a transformation if there's one stored.
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& theprs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Computes the presentation according to a point of view.
|
||||
Standard_EXPORT virtual void computeHLR (const Handle(Graphic3d_Camera)& theProjector,
|
||||
|
@@ -17,12 +17,9 @@
|
||||
#ifndef _AIS_DisplayStatus_HeaderFile
|
||||
#define _AIS_DisplayStatus_HeaderFile
|
||||
|
||||
#include <PrsMgr_DisplayStatus.hxx>
|
||||
|
||||
//! To give the display status of an Interactive Object.
|
||||
enum AIS_DisplayStatus
|
||||
{
|
||||
AIS_DS_Displayed, //!< the Interactive Object is displayed in the main viewer
|
||||
AIS_DS_Erased, //!< the Interactive Object is hidden in main viewer
|
||||
AIS_DS_None //!< the Interactive Object is nowhere displayed
|
||||
};
|
||||
typedef PrsMgr_DisplayStatus AIS_DisplayStatus;
|
||||
|
||||
#endif // _AIS_DisplayStatus_HeaderFile
|
||||
|
@@ -28,7 +28,6 @@
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
class SelectMgr_EntityOwner;
|
||||
|
||||
|
||||
class AIS_ExclusionFilter;
|
||||
DEFINE_STANDARD_HANDLE(AIS_ExclusionFilter, SelectMgr_Filter)
|
||||
|
||||
@@ -79,43 +78,26 @@ public:
|
||||
Standard_EXPORT Standard_Boolean Remove (const AIS_KindOfInteractive TypeToExclude, const Standard_Integer SignatureInType);
|
||||
|
||||
Standard_EXPORT void Clear();
|
||||
|
||||
Standard_Boolean IsExclusionFlagOn() const;
|
||||
|
||||
void SetExclusionFlag (const Standard_Boolean Status);
|
||||
|
||||
|
||||
Standard_Boolean IsExclusionFlagOn() const { return myIsExclusionFlagOn; }
|
||||
|
||||
void SetExclusionFlag (const Standard_Boolean theStatus) { myIsExclusionFlagOn = theStatus; }
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsStored (const AIS_KindOfInteractive aType) const;
|
||||
|
||||
Standard_EXPORT void ListOfStoredTypes (TColStd_ListOfInteger& TheList) const;
|
||||
|
||||
Standard_EXPORT void ListOfSignature (const AIS_KindOfInteractive aType, TColStd_ListOfInteger& TheStoredList) const;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_ExclusionFilter,SelectMgr_Filter)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsSignatureIn (const AIS_KindOfInteractive aType, const Standard_Integer aSignature) const;
|
||||
|
||||
Standard_Boolean myIsExclusionFlagOn;
|
||||
TColStd_DataMapOfIntegerListOfInteger myStoredTypes;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <AIS_ExclusionFilter.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_ExclusionFilter_HeaderFile
|
||||
|
@@ -1,26 +0,0 @@
|
||||
// Copyright (c) 1998-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.
|
||||
|
||||
inline Standard_Boolean AIS_ExclusionFilter::IsExclusionFlagOn() const
|
||||
{
|
||||
return myIsExclusionFlagOn;
|
||||
}
|
||||
|
||||
|
||||
inline void AIS_ExclusionFilter::SetExclusionFlag(const Standard_Boolean Status)
|
||||
{
|
||||
myIsExclusionFlagOn = Status;
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user