mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a49f7ac41e |
149
CMakeLists.txt
149
CMakeLists.txt
@@ -6,10 +6,10 @@ set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FO
|
||||
|
||||
# macro: include patched file if it exists
|
||||
macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake")
|
||||
if (NOT "${APPLY_OCCT_PATCH_DIR}" STREQUAL "" AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake")
|
||||
include (${APPLY_OCCT_PATCH_DIR}/${BEING_INCLUDED_FILE}.cmake)
|
||||
else()
|
||||
include (${CMAKE_SOURCE_DIR}/${BEING_INCLUDED_FILE}.cmake)
|
||||
include (${BEING_INCLUDED_FILE}.cmake)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -41,11 +41,9 @@ if (DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE) # single-configuration ge
|
||||
set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||
endif()
|
||||
|
||||
# enable extended messages of many OCCT algorithms
|
||||
set (OCCT_ALGO_EXTENDED_OUTPUT OFF CACHE BOOL "${OCCT_ALGO_EXTENDED_OUTPUT_DESCR}")
|
||||
if (OCCT_ALGO_EXTENDED_OUTPUT_DESCR)
|
||||
add_definitions (-DOCCT_DEBUG)
|
||||
endif()
|
||||
|
||||
# Rebuild *.yacc and *.lex files
|
||||
set (REBUILD_PLATFORM_DEPENDENT_CODE OFF CACHE BOOL "${REBUILD_PLATFORM_DEPENDENT_CODE_DESCR}")
|
||||
|
||||
# copy samples to install directory
|
||||
set (INSTALL_OCCT_SAMPLES OFF CACHE BOOL "${INSTALL_OCCT_SAMPLES_DESCR}")
|
||||
@@ -69,8 +67,15 @@ if (APPLE)
|
||||
set (USE_GLX OFF CACHE BOOL "${USE_GLX_DESCR}")
|
||||
endif()
|
||||
|
||||
set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}")
|
||||
set (USE_VTK OFF CACHE BOOL "${USE_VTK_DESCR}")
|
||||
|
||||
if (NOT DEFINED ANDROID)
|
||||
set (USE_GL2PS OFF CACHE BOOL "${USE_GL2PS_DESCR}")
|
||||
set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}")
|
||||
#set (USE_OPENCL OFF CACHE BOOL "Is OpenCL used or not")
|
||||
endif()
|
||||
|
||||
# include occt macros
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
@@ -122,16 +127,6 @@ OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_defs_flags")
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro")
|
||||
|
||||
# Rebuild *.yacc and *.lex files that are contained by TKMath toolkit
|
||||
list (FIND BUILD_TOOLKITS TKMath CAN_REBUILD_PDC_FOR_TKMATH)
|
||||
list (FIND BUILD_TOOLKITS StepFile CAN_REBUILD_PDC_FOR_STEPFILE)
|
||||
|
||||
if (NOT "${CAN_REBUILD_PDC_FOR_TKMATH}" STREQUAL "-1" OR NOT "${CAN_REBUILD_PDC_FOR_STEPFILE}" STREQUAL "-1")
|
||||
set (REBUILD_PLATFORM_DEPENDENT_CODE OFF CACHE BOOL "${REBUILD_PLATFORM_DEPENDENT_CODE_DESCR}")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET (REBUILD_PLATFORM_DEPENDENT_CODE)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_DIR)
|
||||
set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_DESCR})
|
||||
endif()
|
||||
@@ -148,38 +143,32 @@ if ("${3RDPARTY_DIR}" STREQUAL "")
|
||||
endif()
|
||||
|
||||
# search for CSF_TclLibs variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_TclLibs USE_TCL)
|
||||
OCCT_IS_PRODUCT_REQUIRED(CSF_TclLibs USE_TCL)
|
||||
|
||||
if ("${USE_TCL}" STREQUAL ON)
|
||||
message (STATUS "Info: TCL is used by OCCT")
|
||||
message (STATUS "Info: tcl is used by OCCT")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tcl")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TCL")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TK")
|
||||
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TCL")
|
||||
endif()
|
||||
|
||||
# search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_FREETYPE USE_FREETYPE)
|
||||
OCCT_IS_PRODUCT_REQUIRED(CSF_FREETYPE USE_FREETYPE)
|
||||
|
||||
if ("${USE_FREETYPE}" STREQUAL ON)
|
||||
message (STATUS "Info: Freetype is used by OCCT")
|
||||
message (STATUS "Info: freetype is used by OCCT")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREETYPE")
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2")
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_FREETYPE")
|
||||
endif()
|
||||
|
||||
# VTK
|
||||
if (USE_VTK)
|
||||
add_definitions (-DHAVE_VTK)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vtk")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_VTK")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_VTK")
|
||||
endif()
|
||||
|
||||
# GLX
|
||||
@@ -189,26 +178,11 @@ if (USE_GLX)
|
||||
endif()
|
||||
|
||||
# FREEIMAGE
|
||||
# search for CSF_FREEIMAGE variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_FREEIMAGE CAN_USE_FREEIMAGE)
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_FreeImagePlus CAN_USE_FREEIMAGEPLUS)
|
||||
|
||||
if (CAN_USE_FREEIMAGE OR CAN_USE_FREEIMAGEPLUS)
|
||||
set (USE_FREEIMAGE OFF CACHE BOOL "${USE_FREEIMAGE_DESCR}")
|
||||
|
||||
if (USE_FREEIMAGE)
|
||||
add_definitions (-DHAVE_FREEIMAGE)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimageplus")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGEPLUS")
|
||||
endif()
|
||||
if (USE_FREEIMAGE)
|
||||
add_definitions (-DHAVE_FREEIMAGE)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimageplus")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_FREEIMAGE")
|
||||
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGE")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_FREEIMAGEPLUS")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_FREEIMAGE")
|
||||
@@ -216,44 +190,30 @@ else()
|
||||
endif()
|
||||
|
||||
# GL2PS
|
||||
# search for CSF_GL2PS variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_GL2PS CAN_USE_GL2PS)
|
||||
|
||||
if (NOT DEFINED ANDROID AND CAN_USE_GL2PS)
|
||||
set (USE_GL2PS OFF CACHE BOOL "${USE_GL2PS_DESCR}")
|
||||
|
||||
if (USE_GL2PS)
|
||||
add_definitions (-DHAVE_GL2PS)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS")
|
||||
endif()
|
||||
if (USE_GL2PS)
|
||||
add_definitions (-DHAVE_GL2PS)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_GL2PS")
|
||||
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_GL2PS")
|
||||
endif()
|
||||
|
||||
# OPENCL
|
||||
#if (USE_OPENCL)
|
||||
# add_definitions (-DHAVE_OPENCL)
|
||||
# OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/opencl")
|
||||
#else()
|
||||
# OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_OPENCL")
|
||||
# OCCT_CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_HEADER")
|
||||
# OCCT_CHECK_AND_UNSET ("3RDPARTY_OPENCL_ADDITIONAL_PATH_FOR_LIB")
|
||||
# OCCT_CHECK_AND_UNSET ("INSTALL_OPENCL")
|
||||
#endif()
|
||||
|
||||
# TBB
|
||||
# search for CSF_TBB variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED (CSF_TBB CAN_USE_TBB)
|
||||
|
||||
if (NOT DEFINED ANDROID AND CAN_USE_TBB)
|
||||
set (USE_TBB OFF CACHE BOOL "${USE_TBB_DESCR}")
|
||||
|
||||
if (USE_TBB)
|
||||
add_definitions (-DHAVE_TBB)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
|
||||
endif()
|
||||
if (USE_TBB)
|
||||
add_definitions (-DHAVE_TBB)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET ("USE_TBB")
|
||||
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC")
|
||||
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
|
||||
@@ -267,8 +227,7 @@ if (BUILD_DOC_OcctOverview)
|
||||
|
||||
if (INSTALL_DOC_OcctOverview)
|
||||
install (DIRECTORY "${CMAKE_BINARY_DIR}/doc/overview" DESTINATION "${INSTALL_DIR}/doc")
|
||||
|
||||
OCCT_INSTALL_FILE_OR_DIR ("dox/resources/overview.html" "${INSTALL_DIR}")
|
||||
install (FILES "${CMAKE_SOURCE_DIR}/dox/resources/overview.html" DESTINATION "${INSTALL_DIR}")
|
||||
endif()
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/doxygen")
|
||||
@@ -335,9 +294,8 @@ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
|
||||
|
||||
if (WIN32)
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
|
||||
endif()
|
||||
|
||||
if ("${INSTALL_DIR}" STREQUAL "")
|
||||
@@ -351,8 +309,13 @@ endif()
|
||||
|
||||
message (STATUS "\nInfo: Collecting all OCCT header files into ${CMAKE_BINARY_DIR}/inc ...")
|
||||
|
||||
# (!) patch is not taken into account COLLECT_AND_INSTALL_OCCT_HEADER_FILES
|
||||
# collect all the headers to <binary dir>/inc folder
|
||||
COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}")
|
||||
COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/adm/templates/header.in" "${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}")
|
||||
# apply patched header files
|
||||
#if (NOT "${APPLY_OCCT_PATCH_DIR}" STREQUAL "")
|
||||
# COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${APPLY_OCCT_PATCH_DIR}" "${CMAKE_SOURCE_DIR}/adm/templates/header.in" "${CMAKE_BINARY_DIR}")
|
||||
#endif()
|
||||
|
||||
OCCT_INSTALL_FILE_OR_DIR ("data" "${INSTALL_DIR}")
|
||||
OCCT_INSTALL_FILE_OR_DIR ("samples/tcl" "${INSTALL_DIR}/samples")
|
||||
@@ -372,7 +335,7 @@ else()
|
||||
endif()
|
||||
|
||||
# DRAW.BAT or DRAW.SH
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}")
|
||||
if (NOT "${APPLY_OCCT_PATCH_DIR}" STREQUAL "" AND EXISTS "${APPLY_OCCT_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}")
|
||||
install (FILES "${APPLY_OCCT_PATCH_DIR}/adm/templates/draw.${SCRIPT_EXT}" DESTINATION "${INSTALL_DIR}" PERMISSIONS
|
||||
OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE)
|
||||
else()
|
||||
@@ -409,7 +372,7 @@ OCCT_CONFIGURE ("adm/templates/custom.build.${SCRIPT_EXT}.in" "${SUB_CUSTOM_NAME
|
||||
|
||||
if (BUILD_MODULE_OcctMfcSamples)
|
||||
OCCT_INSTALL_FILE_OR_DIR ("adm/templates/sample.bat" "${INSTALL_DIR}")
|
||||
OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.bat" "${CMAKE_BINARY_DIR}")
|
||||
OCCT_COPY_FILE_OR_DIR ("adm/templates/sample.bat" "${CMAKE_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
# env script for draw in building environment
|
||||
@@ -441,8 +404,8 @@ install (FILES "${CMAKE_BINARY_DIR}/env.install.relwithdebinfo.${SCRIPT_EXT}"
|
||||
RENAME "env.${SCRIPT_EXT}")
|
||||
|
||||
# copy DrawAppliInit from OCCT source to build directory
|
||||
if (NOT EXISTS "${CMAKE_BINARY_DIR}/DrawAppliInit")
|
||||
OCCT_COPY_FILE_OR_DIR (DrawAppliInit "${CMAKE_BINARY_DIR}")
|
||||
if (EXISTS "${CMAKE_SOURCE_DIR}/DrawAppliInit" AND NOT EXISTS "${CMAKE_BINARY_DIR}/DrawAppliInit")
|
||||
file (COPY "${CMAKE_SOURCE_DIR}/DrawAppliInit" DESTINATION "${CMAKE_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
# RESOURCES
|
||||
@@ -459,11 +422,17 @@ endforeach()
|
||||
|
||||
# include patched toolkit projects or original ones
|
||||
foreach (BUILD_TOOLKIT ${BUILD_TOOLKITS})
|
||||
OCCT_ADD_SUBDIRECTORY ("src/${BUILD_TOOLKIT}")
|
||||
if (NOT "${APPLY_OCCT_PATCH_DIR}" STREQUAL "" AND EXISTS "${APPLY_OCCT_PATCH_DIR}/src/${BUILD_TOOLKIT}")
|
||||
add_subdirectory(${APPLY_OCCT_PATCH_DIR}/src/${BUILD_TOOLKIT})
|
||||
elseif (EXISTS "${CMAKE_SOURCE_DIR}/src/${BUILD_TOOLKIT}")
|
||||
add_subdirectory (${CMAKE_SOURCE_DIR}/src/${BUILD_TOOLKIT})
|
||||
else()
|
||||
message (STATUS "${BUILD_TOOLKIT} is not included")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (BUILD_DOC_OcctOverview)
|
||||
OCCT_ADD_SUBDIRECTORY (dox)
|
||||
add_subdirectory (dox)
|
||||
endif()
|
||||
|
||||
# patch DRAWEXE
|
||||
@@ -483,7 +452,7 @@ if (MSVC AND 3RDPARTY_DLL_DIRS)
|
||||
set (X_COMPILER_BITNESS "Win32")
|
||||
endif()
|
||||
|
||||
OCCT_CONFIGURE ("adm/templates/DRAWEXE.vcxproj.user.in" "${CMAKE_BINARY_DIR}/src/DRAWEXE/DRAWEXE.vcxproj.user")
|
||||
configure_file (${CMAKE_SOURCE_DIR}/adm/templates/DRAWEXE.vcxproj.user.in ${CMAKE_BINARY_DIR}/src/DRAWEXE/DRAWEXE.vcxproj.user @ONLY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@@ -80,29 +80,6 @@ function (SUBDIRECTORY_NAMES MAIN_DIRECTORY RESULT)
|
||||
set (${RESULT} ${LOCAL_RESULT} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function (OCCT_ORIGIN_AND_PATCHED_FILES RELATIVE_PATH SEARCH_TEMPLATE RESULT)
|
||||
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${RELATIVE_PATH}")
|
||||
file (GLOB FOUND_FILES "${APPLY_OCCT_PATCH_DIR}/${RELATIVE_PATH}/${SEARCH_TEMPLATE}")
|
||||
endif()
|
||||
|
||||
file (GLOB ORIGIN_FILES "${CMAKE_SOURCE_DIR}/${RELATIVE_PATH}/${SEARCH_TEMPLATE}")
|
||||
foreach (ORIGIN_FILE ${ORIGIN_FILES})
|
||||
# check for existence of patched version of current file
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${RELATIVE_PATH}")
|
||||
get_filename_component (ORIGIN_FILE_NAME "${ORIGIN_FILE}" NAME)
|
||||
if (EXISTS "${APPLY_OCCT_PATCH_DIR}/${RELATIVE_PATH}/${ORIGIN_FILE_NAME}")
|
||||
continue()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# append origin version if patched one is not found
|
||||
list (APPEND FOUND_FILES ${ORIGIN_FILE})
|
||||
endforeach()
|
||||
|
||||
set (${RESULT} ${FOUND_FILES} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function (FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
OCCT_MAKE_COMPILER_BITNESS()
|
||||
@@ -170,27 +147,17 @@ macro (OCCT_CONFIGURE_AND_INSTALL BEING_CONGIRUGED_FILE BUILD_NAME INSTALL_NAME
|
||||
install(FILES "${OCCT_BINARY_DIR}/${BUILD_NAME}" DESTINATION "${DESTINATION_PATH}" RENAME ${INSTALL_NAME})
|
||||
endmacro()
|
||||
|
||||
macro (COLLECT_AND_INSTALL_OCCT_HEADER_FILES ROOT_TARGET_OCCT_DIR OCCT_BUILD_TOOLKITS)
|
||||
macro (COLLECT_AND_INSTALL_OCCT_HEADER_FILES ROOT_OCCT_DIR TEMPLATE_HEADER_PATH ROOT_TARGET_OCCT_DIR OCCT_BUILD_TOOLKITS)
|
||||
set (OCCT_SOURCE_DIRS)
|
||||
|
||||
# consider patched header.in template
|
||||
set (TEMPLATE_HEADER_PATH "${CMAKE_SOURCE_DIR}/adm/templates/header.in")
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/adm/templates/header.in")
|
||||
set (TEMPLATE_HEADER_PATH "${APPLY_OCCT_PATCH_DIR}/adm/templates/header.in")
|
||||
endif()
|
||||
|
||||
set (ROOT_OCCT_DIR ${CMAKE_SOURCE_DIR})
|
||||
|
||||
foreach (OCCT_USED_TOOLKIT ${OCCT_BUILD_TOOLKITS})
|
||||
# append parent folder
|
||||
list (APPEND OCCT_SOURCE_DIRS ${OCCT_USED_TOOLKIT})
|
||||
|
||||
# append all required package folders
|
||||
set (OCCT_USED_TOOLKIT_DEPS)
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_USED_TOOLKIT}/PACKAGES")
|
||||
file (STRINGS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_USED_TOOLKIT}/PACKAGES" OCCT_USED_TOOLKIT_DEPS)
|
||||
elseif (EXISTS "${CMAKE_SOURCE_DIR}/src/${OCCT_USED_TOOLKIT}/PACKAGES")
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_USED_TOOLKIT}/PACKAGES" OCCT_USED_TOOLKIT_DEPS)
|
||||
if (EXISTS "${ROOT_OCCT_DIR}/src/${OCCT_USED_TOOLKIT}/PACKAGES")
|
||||
file (STRINGS "${ROOT_OCCT_DIR}/src/${OCCT_USED_TOOLKIT}/PACKAGES" OCCT_USED_TOOLKIT_DEPS)
|
||||
endif()
|
||||
|
||||
foreach (OCCT_USED_TOOLKIT_DEP ${OCCT_USED_TOOLKIT_DEPS})
|
||||
@@ -199,8 +166,9 @@ macro (COLLECT_AND_INSTALL_OCCT_HEADER_FILES ROOT_TARGET_OCCT_DIR OCCT_BUILD_TOO
|
||||
endforeach()
|
||||
|
||||
foreach (OCCT_SOURCE_DIR ${OCCT_SOURCE_DIRS})
|
||||
# get all header files from each src folder
|
||||
file (GLOB OCCT_HEADER_FILES "${CMAKE_SOURCE_DIR}/src/${OCCT_SOURCE_DIR}/*.[hgl]xx" "${CMAKE_SOURCE_DIR}/src/${OCCT_SOURCE_DIR}/*.h")
|
||||
# get all header files from each src folder
|
||||
file (GLOB OCCT_HEADER_FILES "${ROOT_OCCT_DIR}/src/${OCCT_SOURCE_DIR}/*.[hgl]xx" "${ROOT_OCCT_DIR}/src/${OCCT_SOURCE_DIR}/*.h")
|
||||
|
||||
install (FILES ${OCCT_HEADER_FILES} DESTINATION "${INSTALL_DIR}/inc")
|
||||
|
||||
# create new file including found header
|
||||
@@ -208,26 +176,12 @@ macro (COLLECT_AND_INSTALL_OCCT_HEADER_FILES ROOT_TARGET_OCCT_DIR OCCT_BUILD_TOO
|
||||
get_filename_component (HEADER_FILE_NAME ${OCCT_HEADER_FILE} NAME)
|
||||
configure_file ("${TEMPLATE_HEADER_PATH}" "${ROOT_TARGET_OCCT_DIR}/inc/${HEADER_FILE_NAME}" @ONLY)
|
||||
endforeach()
|
||||
|
||||
# consider pathed the source files
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_SOURCE_DIR}")
|
||||
file (GLOB PATCHED_OCCT_HEADER_FILES "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_SOURCE_DIR}/*.[hgl]xx" "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_SOURCE_DIR}/*.h")
|
||||
install (FILES ${PATCHED_OCCT_HEADER_FILES} DESTINATION "${INSTALL_DIR}/inc")
|
||||
|
||||
# create new patched file including found header
|
||||
foreach (OCCT_HEADER_FILE ${PATCHED_OCCT_HEADER_FILES})
|
||||
get_filename_component (HEADER_FILE_NAME ${OCCT_HEADER_FILE} NAME)
|
||||
configure_file ("${TEMPLATE_HEADER_PATH}" "${ROOT_TARGET_OCCT_DIR}/inc/${HEADER_FILE_NAME}" @ONLY)
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_COPY_FILE_OR_DIR BEING_COPIED_OBJECT DESTINATION_PATH)
|
||||
# first of all, copy original files
|
||||
if (EXISTS "${CMAKE_SOURCE_DIR}/${BEING_COPIED_OBJECT}")
|
||||
file (COPY "${CMAKE_SOURCE_DIR}/${BEING_COPIED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
|
||||
endif()
|
||||
file (COPY "${CMAKE_SOURCE_DIR}/${BEING_COPIED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
|
||||
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${BEING_COPIED_OBJECT}")
|
||||
# secondly, rewrite original files with patched ones
|
||||
@@ -243,16 +197,6 @@ macro (OCCT_CONFIGURE BEING_CONGIRUGED_FILE FINAL_NAME)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro (OCCT_ADD_SUBDIRECTORY BEING_ADDED_DIRECTORY)
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${BEING_ADDED_DIRECTORY}/CMakeLists.txt")
|
||||
add_subdirectory(${APPLY_OCCT_PATCH_DIR}/${BEING_ADDED_DIRECTORY})
|
||||
elseif (EXISTS "${CMAKE_SOURCE_DIR}/${BEING_ADDED_DIRECTORY}/CMakeLists.txt")
|
||||
add_subdirectory (${CMAKE_SOURCE_DIR}/${BEING_ADDED_DIRECTORY})
|
||||
else()
|
||||
message (STATUS "${BEING_ADDED_DIRECTORY} directory is not included")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
function (OCCT_IS_PRODUCT_REQUIRED CSF_VAR_NAME USE_PRODUCT)
|
||||
set (${USE_PRODUCT} OFF PARENT_SCOPE)
|
||||
|
||||
|
@@ -1,11 +1,26 @@
|
||||
# script for each OCCT toolkit
|
||||
|
||||
# Get all used packages from toolkit
|
||||
foreach (OCCT_PACKAGE ${TOOLKIT_MODULES})
|
||||
foreach (TOOLKIT_MODULE ${TOOLKIT_MODULES})
|
||||
if (WIN32)
|
||||
list (APPEND PRECOMPILED_DEFS "-D__${OCCT_PACKAGE}_DLL")
|
||||
list (APPEND PRECOMPILED_DEFS "-D__${TOOLKIT_MODULE}_DLL")
|
||||
endif()
|
||||
# ${OCCT_SOURCE_DIR}/src/${OCCT_PACKAGE}
|
||||
list (APPEND COMPILER_DIRECTORIES "${OCCT_SOURCE_DIR}/src/${TOOLKIT_MODULE}")
|
||||
endforeach()
|
||||
string (REGEX REPLACE ";" " " PRECOMPILED_DEFS "${PRECOMPILED_DEFS}")
|
||||
|
||||
# Get from toolkits EXTERNLIB all used libs
|
||||
OCCT_TOOLKIT_DEP (${PROJECT_NAME} ${PROJECT_NAME}_DEPS)
|
||||
foreach (PROJECT_DEP ${${PROJECT_NAME}_DEPS})
|
||||
IS_OCCT_TOOLKIT (${PROJECT_DEP} OCCT_MODULES FOUND_TOOLKIT)
|
||||
if ("${FOUND_TOOLKIT}" STREQUAL "ON")
|
||||
list (APPEND USED_LIBS "${PROJECT_DEP}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Get all source files from used packages
|
||||
foreach (CMP_DIR ${COMPILER_DIRECTORIES})
|
||||
get_filename_component (CMP_DIR_NAME ${CMP_DIR} NAME)
|
||||
|
||||
set (SOURCE_FILES)
|
||||
set (HEADER_FILES)
|
||||
@@ -14,12 +29,12 @@ foreach (OCCT_PACKAGE ${TOOLKIT_MODULES})
|
||||
if (${REBUILD_PLATFORM_DEPENDENT_CODE})
|
||||
|
||||
# flex files
|
||||
OCCT_ORIGIN_AND_PATCHED_FILES ("src/${OCCT_PACKAGE}" "*[.]lex" SOURCE_FILES_FLEX)
|
||||
file (GLOB SOURCE_FILES_FLEX "${CMP_DIR}/*[.]lex")
|
||||
list (LENGTH SOURCE_FILES_FLEX SOURCE_FILES_FLEX_LEN)
|
||||
list (SORT SOURCE_FILES_FLEX)
|
||||
|
||||
# bison files
|
||||
OCCT_ORIGIN_AND_PATCHED_FILES ("src/${OCCT_PACKAGE}" "*[.]yacc" SOURCE_FILES_BISON)
|
||||
file (GLOB SOURCE_FILES_BISON "${CMP_DIR}/*[.]yacc")
|
||||
list (LENGTH SOURCE_FILES_BISON SOURCE_FILES_BISON_LEN)
|
||||
list (SORT SOURCE_FILES_BISON)
|
||||
|
||||
@@ -49,65 +64,31 @@ foreach (OCCT_PACKAGE ${TOOLKIT_MODULES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# header files
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/FILES")
|
||||
file (STRINGS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_M REGEX ".+[.]h")
|
||||
file (STRINGS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_LXX REGEX ".+[.]lxx")
|
||||
file (STRINGS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_GXX REGEX ".+[.]gxx")
|
||||
|
||||
file (STRINGS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
|
||||
if(APPLE)
|
||||
file (STRINGS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_M REGEX ".+[.]mm")
|
||||
endif()
|
||||
else()
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_M REGEX ".+[.]h")
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_LXX REGEX ".+[.]lxx")
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_GXX REGEX ".+[.]gxx")
|
||||
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
|
||||
if(APPLE)
|
||||
file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_M REGEX ".+[.]mm")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# header files
|
||||
file (STRINGS "${CMP_DIR}/FILES" HEADER_FILES_M REGEX ".+[.]h")
|
||||
file (STRINGS "${CMP_DIR}/FILES" HEADER_FILES_LXX REGEX ".+[.]lxx")
|
||||
file (STRINGS "${CMP_DIR}/FILES" HEADER_FILES_GXX REGEX ".+[.]gxx")
|
||||
list (APPEND HEADER_FILES ${HEADER_FILES_M} ${HEADER_FILES_LXX} ${SOURCE_FILES_GXX})
|
||||
|
||||
foreach(HEADER_FILE ${HEADER_FILES})
|
||||
list (APPEND USED_INCFILES ${CMP_DIR}/${HEADER_FILE})
|
||||
SOURCE_GROUP ("Header Files\\${CMP_DIR_NAME}" FILES ${CMP_DIR}/${HEADER_FILE})
|
||||
endforeach()
|
||||
|
||||
# source files
|
||||
file (STRINGS "${CMP_DIR}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
|
||||
list (APPEND SOURCE_FILES ${SOURCE_FILES_C})
|
||||
|
||||
if(APPLE)
|
||||
file (STRINGS "${CMP_DIR}/FILES" SOURCE_FILES_M REGEX ".+[.]mm")
|
||||
list (APPEND SOURCE_FILES ${SOURCE_FILES_M})
|
||||
endif()
|
||||
|
||||
foreach(HEADER_FILE ${HEADER_FILES})
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
message (STATUS "Info. consider patched file: ${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
list (APPEND USED_INCFILES "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE}" FILES "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
else()
|
||||
list (APPEND USED_INCFILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE}" FILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(SOURCE_FILE ${SOURCE_FILES})
|
||||
if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
message (STATUS "Info. consider patched file: ${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
list (APPEND USED_SRCFILES "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE}" FILES "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
else()
|
||||
list (APPEND USED_SRCFILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE}" FILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
|
||||
endif()
|
||||
list (APPEND USED_SRCFILES ${CMP_DIR}/${SOURCE_FILE})
|
||||
SOURCE_GROUP ("Source Files\\${CMP_DIR_NAME}" FILES ${CMP_DIR}/${SOURCE_FILE})
|
||||
endforeach()
|
||||
endforeach()
|
||||
string (REGEX REPLACE ";" " " PRECOMPILED_DEFS "${PRECOMPILED_DEFS}")
|
||||
|
||||
# Get from toolkits EXTERNLIB all used libs
|
||||
OCCT_TOOLKIT_DEP (${PROJECT_NAME} ${PROJECT_NAME}_DEPS)
|
||||
foreach (PROJECT_DEP ${${PROJECT_NAME}_DEPS})
|
||||
IS_OCCT_TOOLKIT (${PROJECT_DEP} OCCT_MODULES FOUND_TOOLKIT)
|
||||
if ("${FOUND_TOOLKIT}" STREQUAL "ON")
|
||||
list (APPEND USED_LIBS "${PROJECT_DEP}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Create project for toolkit
|
||||
list (FIND BUILD_TOOLKITS ${PROJECT_NAME} CURRENT_PROJECT_IS_BUILT)
|
||||
|
@@ -58,11 +58,6 @@ if (WIN32 AND NOT DEFINED 3RDPARTY_TBBMALLOC_DLL_DIR)
|
||||
set (3RDPARTY_TBBMALLOC_DLL_DIR "" CACHE FILEPATH "The directory containing tbb malloc shared library")
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
add_definitions (-D__TBB_NO_IMPLICIT_LINKAGE)
|
||||
add_definitions (-D__TBBMALLOC_NO_IMPLICIT_LINKAGE)
|
||||
endif()
|
||||
|
||||
# include occt macros. compiler_bitness, os_wiht_bit, compiler
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
|
||||
|
||||
|
@@ -1,110 +1,47 @@
|
||||
# variable description
|
||||
|
||||
#
|
||||
set (APPLY_OCCT_PATCH_DIR_DESCR
|
||||
"Points to the directory recognized as a 'patch' for OCCT. If specified,
|
||||
the files from this directory take precedence over the corresponding native
|
||||
OCCT sources. This way you are able to introduce patches to Open CASCADE
|
||||
Technology not affecting the original source distribution")
|
||||
set (APPLY_OCCT_PATCH_DIR_DESCR "The directory contaning patched OCCT sources that should be used")
|
||||
set (BUILD_LIBRARY_TYPE_DESCR "The type of further OCCT libraries: shared or static")
|
||||
|
||||
|
||||
set (BUILD_LIBRARY_TYPE_DESCR
|
||||
"Specifies the type of library to be created. 'Shared' libraries
|
||||
are linked dynamically and loaded at runtime. 'Static' libraries
|
||||
are archives of object files for use when linking other targets")
|
||||
|
||||
set (REBUILD_PLATFORM_DEPENDENT_CODE_DESCR
|
||||
"Enables Flex/Bison lexical analyzers. OCCT source files relating to STEP reader and
|
||||
ExprIntrp functionality are generated automatically with Flex/Bison. Checking this options
|
||||
leads to automatic search of Flex/Bison binaries and regeneration of the mentioned files")
|
||||
|
||||
set (OCCT_ALGO_EXTENDED_OUTPUT_DESCR
|
||||
"Enables extended messages of many OCCT algorithms, usually printed to cout.
|
||||
These include messages on internal errors and special cases encountered, timing etc")
|
||||
set (REBUILD_PLATFORM_DEPENDENT_CODE_DESCR "OCCT has already compiled platform-depending code and it can be rebult once again (*.yacc/*.lex)")
|
||||
|
||||
# install variables
|
||||
set (INSTALL_DIR_DESCR
|
||||
"The place where built OCCT libraries, headers, test cases (INSTALL_OCCT_TEST_CASES variable),
|
||||
samples (INSTALL_OCCT_SAMPLES_DESCR variable) and certain 3rdparties (INSTALL_GL2PS, INSTALL_TBB and
|
||||
other similar variables) will be placed during the installation process (building INSTALL project)")
|
||||
set (INSTALL_DIR_DESCR "The place where built OCCT libraries, headers, test cases (INSTALL_OCCT_TEST_CASES variable), \n samples (INSTALL_OCCT_SAMPLES_DESCR variable) and certain 3rdparties (INSTALL_GL2PS, INSTALL_TBB and other similar variables) \n will be placed during the installation process (building INSTALL project)")
|
||||
|
||||
macro (INSTALL_MESSAGE INSTALL_TARGET_VARIABLE INSTALL_TARGET_STRING)
|
||||
set (${INSTALL_TARGET_VARIABLE}_DESCR
|
||||
"Indicates whether ${INSTALL_TARGET_STRING} should be installed (building INSTALL
|
||||
project) into the installation directory (INSTALL_DIR variable)")
|
||||
endmacro()
|
||||
set (INSTALL_OCCT_SAMPLES_DESCR "The installation process (building INSTALL project) also places OCCT samples into installation directory (INSTALL_DIR variable)")
|
||||
set (INSTALL_OCCT_TEST_CASES_DESCR "The installation process (building INSTALL project) also places OCCT test cases into installation directory (INSTALL_DIR variable)")
|
||||
set (INSTALL_DOC_OcctOverview_DESCR "The installation process (building INSTALL project) also places OCCT overview documentation (HTML format) \n into installation directory (INSTALL_DIR variable)")
|
||||
|
||||
INSTALL_MESSAGE (INSTALL_OCCT_SAMPLES "OCCT samples")
|
||||
INSTALL_MESSAGE (INSTALL_OCCT_TEST_CASES "non-regression OCCT test scripts")
|
||||
INSTALL_MESSAGE (INSTALL_DOC_OcctOverview "OCCT overview documentation (HTML format)")
|
||||
INSTALL_MESSAGE (INSTALL_FREEIMAGE "FreeImage binaries")
|
||||
INSTALL_MESSAGE (INSTALL_FREEIMAGEPLUS "FreeImagePlus binaries")
|
||||
INSTALL_MESSAGE (INSTALL_FREETYPE "FreeType binaries")
|
||||
INSTALL_MESSAGE (INSTALL_GL2PS "GL2PS binaries")
|
||||
INSTALL_MESSAGE (INSTALL_TBB "TBB binaries")
|
||||
INSTALL_MESSAGE (INSTALL_TCL "TCL binaries")
|
||||
INSTALL_MESSAGE (INSTALL_VTK "VTK binaries ")
|
||||
set (INSTALL_FREEIMAGE_DESCR "The installation process (building INSTALL project) also places FreeImage library \n into installation directory (INSTALL_DIR variable). After that OCCT can use this library in portable mode")
|
||||
set (INSTALL_FREEIMAGEPLUS_DESCR "The installation process (building INSTALL project) also places FreeImagePlus library into \n installation directory (INSTALL_DIR variable). After that OCCT can use this library in portable mode")
|
||||
set (INSTALL_FREETYPE_DESCR "The installation process (building INSTALL project) also places FreeType library into \n installation directory (INSTALL_DIR variable). After that OCCT can use this library in portable mode")
|
||||
set (INSTALL_GL2PS_DESCR "The installation process (building INSTALL project) also places GL2PS library into \n installation directory (INSTALL_DIR variable). After that OCCT can use this library in portable mode")
|
||||
set (INSTALL_TBB_DESCR "The installation process (building INSTALL project) also places tbb and tbbmalloc libraries into \n installation directory (INSTALL_DIR variable). After that OCCT can use these libraries in portable mode")
|
||||
set (INSTALL_TCL_DESCR "The installation process (building INSTALL project) also places Tcl (library and its nessecary sources) into \n installation directory (INSTALL_DIR variable). After that OCCT can use Tcl in portable mode")
|
||||
set (INSTALL_VTK_DESCR "The installation process (building INSTALL project) also places Vtk libraries into \n installation directory (INSTALL_DIR variable). After that OCCT can use these libraries in portable mode")
|
||||
|
||||
# build variables
|
||||
macro (BUILD_MODULE_MESSAGE BUILD_MODULE_TARGET_VARIABLE BUILD_MODULE_TARGET_STRING)
|
||||
set (${BUILD_MODULE_TARGET_VARIABLE}_DESCR
|
||||
"Indicates whether ${BUILD_MODULE_TARGET_STRING} module should be built or not.
|
||||
It should be noted that some toolkits of the module can be built even if this module
|
||||
is not checked (this happens if some other modules depend on these toolkits)")
|
||||
endmacro()
|
||||
set (BUILD_MODULE_ApplicationFramework_DESCR "Build all toolkits of ApplicationFramework module in the solution")
|
||||
set (BUILD_MODULE_DataExchange_DESCR "Build all toolkits of DataExchange module in the solution")
|
||||
set (BUILD_MODULE_Draw_DESCR "Build all toolkits of Draw module in the solution")
|
||||
set (BUILD_MODULE_FoundationClasses_DESCR "Build all toolkits of FoundationClasses module in the solution")
|
||||
set (BUILD_MODULE_ModelingAlgorithms_DESCR "Build all toolkits of ModelingAlgorithms module in the solution")
|
||||
set (BUILD_MODULE_ModelingData_DESCR "Build all toolkits of ModelingData module in the solution")
|
||||
set (BUILD_MODULE_Visualization_DESCR "Build all toolkits of Visualization module in the solution")
|
||||
|
||||
BUILD_MODULE_MESSAGE (BUILD_MODULE_ApplicationFramework "ApplicationFramework")
|
||||
BUILD_MODULE_MESSAGE (BUILD_MODULE_DataExchange "DataExchange")
|
||||
BUILD_MODULE_MESSAGE (BUILD_MODULE_Draw "Draw")
|
||||
BUILD_MODULE_MESSAGE (BUILD_MODULE_FoundationClasses "FoundationClasses")
|
||||
BUILD_MODULE_MESSAGE (BUILD_MODULE_ModelingAlgorithms "ModelingAlgorithms")
|
||||
BUILD_MODULE_MESSAGE (BUILD_MODULE_ModelingData "ModelingData")
|
||||
BUILD_MODULE_MESSAGE (BUILD_MODULE_Visualization "Visualization")
|
||||
set (BUILD_ADDITIONAL_TOOLKITS_DESCR "Build additional OCCT toolkits (including dependent ones) in the solution")
|
||||
|
||||
set (BUILD_MODULE_OcctMfcSamples_DESCR "Build several OCCT MFC sample projects in the solution. \n These samples show some possibilities of using OCCT and they can \n be executed with script samples.bat from the installation directory (INSTALL_DIR)")
|
||||
set (BUILD_DOC_OcctOverview_DESCR "Build a project containing OCCT overview documentation (Markdown format) \n in the solution. The building of the project executes doxygen command that generates \n the documentation in HTML format. The documentation will be available in the installation \n directory (overview.bat script) if INSTALL_DOC_OcctOverview variable is checked")
|
||||
|
||||
set (BUILD_ADDITIONAL_TOOLKITS_DESCR
|
||||
"Semicolon-separated individual toolkits to include into build process. If you
|
||||
want to build some particular libraries (toolkits) only, then you may uncheck
|
||||
all modules in the corresponding BUILD_MODUE_* options and provide the list of
|
||||
necessary libraries here. Of course, all dependencies will be resolved automatically")
|
||||
set (3RDPARTY_DIR_DESCR "The directory that contain several or all used 3rdparties. \n If the 3rdpartyies have been found - corresponding CMake variables \n will be specified (VTK: 3RDPARTY_VTK_DIR, 3RDPARTY_VTK_INCLUDE_DIR, 3RDPARTY_VTK_LIBRARY_DIR)")
|
||||
|
||||
set (BUILD_MODULE_OcctMfcSamples_DESCR
|
||||
"Indicates whether OCCT MFC samples should be built together with OCCT.
|
||||
These samples show some possibilities of using OCCT and they can be executed
|
||||
with script samples.bat from the installation directory (INSTALL_DIR)")
|
||||
|
||||
set (BUILD_DOC_OcctOverview_DESCR
|
||||
"Indicates whether OCCT overview documentation project (Markdown format) should be
|
||||
created together with OCCT. It is not built together with OCCT. Checking this options
|
||||
leads to automatic search of Doxygen binaries. Building of it will be call Doxygen command
|
||||
to generate the documentation in HTML format. The documentation will be available in the
|
||||
installation directory (overview.bat script) if INSTALL_DOC_OcctOverview variable is checked")
|
||||
|
||||
set (3RDPARTY_DIR_DESCR
|
||||
"The root directory where all required 3-rd party products will be searched. If a
|
||||
3-rd party product have been found - corresponding CMake variables will be specified
|
||||
(VTK: 3RDPARTY_VTK_DIR, 3RDPARTY_VTK_INCLUDE_DIR, 3RDPARTY_VTK_LIBRARY_DIR)")
|
||||
|
||||
set (USE_FREEIMAGE_DESCR
|
||||
"Indicates whether Freeimage product should be used in OCCT visualization
|
||||
module for support of popular graphics image formats (PNG, BMP etc)")
|
||||
|
||||
set (USE_GL2PS_DESCR
|
||||
"Indicates whether GL2PS product should be used in OCCT visualization
|
||||
module for support of vector image formats (PS, EPS etc)")
|
||||
|
||||
set (USE_TBB_DESCR
|
||||
"Indicates whether TBB 3-rd party is used or not. TBB stands for Threading Building Blocks,
|
||||
the technology of Intel Corp, which comes with different mechanisms and patterns for
|
||||
injecting parallelism into your application. OCCT remains parallel even without TBB product")
|
||||
|
||||
set (USE_VTK_DESCR
|
||||
"Indicates whether VTK 3-rd party is used or not. VTK stands for Visualization
|
||||
ToolKit, the technology of Kitware Inc intended for general-purpose scientific
|
||||
visualization. OCCT comes with a bridge between CAD data representation and
|
||||
VTK by means of its dedicated VIS component (VTK Integration Services).")
|
||||
|
||||
set (USE_GLX_DESCR "Indicates whether X11 OpenGl on OSX is used or not")
|
||||
set (USE_FREEIMAGE_DESCR "The solution can use FreeImage")
|
||||
set (USE_GL2PS_DESCR "The solution can use GL2PS")
|
||||
set (USE_TBB_DESCR "The solution can use tbb")
|
||||
set (USE_VTK_DESCR "The solution can use VTK")
|
||||
set (USE_GLX_DESCR "The solution can use X11 OpenGl on OSX")
|
||||
|
||||
macro (BUILD_MODULE MODULE_NAME)
|
||||
set (BUILD_MODULE_${MODULE_NAME} ON CACHE BOOL "${BUILD_MODULE_${MODULE_NAME}_DESCR}")
|
||||
|
753
adm/genproj.tcl
753
adm/genproj.tcl
@@ -17,7 +17,7 @@
|
||||
# =======================================================================
|
||||
# This script defines Tcl command genproj generating project files for
|
||||
# different IDEs:
|
||||
# "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd"
|
||||
# "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "amk" "xcd"
|
||||
#
|
||||
# Example:
|
||||
# genproj -path=D:/occt -target=vc10
|
||||
@@ -106,14 +106,14 @@ proc _get_used_files { pk {inc true} {src true} } {
|
||||
# Wrapper-function to generate VS project files
|
||||
proc genproj { args } {
|
||||
global path targetStation
|
||||
set aSupportedTargets { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd" }
|
||||
set aSupportedTargets { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "amk" "xcd" }
|
||||
set anArgs $args
|
||||
|
||||
# Setting default IDE.
|
||||
set anTarget ""
|
||||
switch -exact -- "$targetStation" {
|
||||
"wnt" {set anTarget "$::env(VCVER)"}
|
||||
"lin" {set anTarget "cbp"}
|
||||
"lin" {set anTarget "amk"}
|
||||
"mac" {set anTarget "xcd"}
|
||||
}
|
||||
|
||||
@@ -188,14 +188,18 @@ proc genproj { args } {
|
||||
vc12 - Visual Studio 2013
|
||||
vc14 - Visual Studio 2015
|
||||
cbp - CodeBlocks
|
||||
xcd - XCode"
|
||||
xcd - XCode
|
||||
amk - AutoMake"
|
||||
return
|
||||
}
|
||||
|
||||
if {!$isTargetDefault} {
|
||||
puts "the \'$anTarget\' target has been applied"
|
||||
}
|
||||
|
||||
|
||||
if {"$anTarget" == "amk"} {
|
||||
set targetStation "lin"
|
||||
}
|
||||
set anAdmPath "$path/adm"
|
||||
|
||||
OS:MKPRC "$anAdmPath" "$anTarget" "$aLibType" "$aPlatform"
|
||||
@@ -216,6 +220,8 @@ proc genprojbat {thePath theIDE} {
|
||||
|
||||
if {[regexp {(vc)[0-9]*$} $theIDE] == 1} {
|
||||
set aTargetPlatform wnt
|
||||
} elseif {"$theIDE" == "amk"} {
|
||||
set aTargetPlatform lin
|
||||
} elseif {"$theIDE" == "xcd"} {
|
||||
set aTargetPlatform mac
|
||||
}
|
||||
@@ -272,7 +278,7 @@ set THE_GUIDS_LIST($aTKNullKey) "{00000000-0000-0000-0000-000000000000}"
|
||||
# Entry function to generate project files and solutions for IDE
|
||||
proc OS:MKPRC { {theOutDir {}} {theIDE ""} {theLibType "dynamic"} {thePlatform ""} } {
|
||||
global path targetStation
|
||||
set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd" }
|
||||
set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "amk" "xcd" }
|
||||
|
||||
if { [lsearch $aSupportedIDE $theIDE] < 0 } {
|
||||
puts stderr "WOK does not support generation of project files for the selected IDE: $theIDE\nSupported IDEs: [join ${aSupportedIDE} " "]"
|
||||
@@ -344,6 +350,7 @@ proc OS:MKPRC { {theOutDir {}} {theIDE ""} {theLibType "dynamic"} {thePlatform "
|
||||
"vc12" -
|
||||
"vc14" { OS:MKVC $anOutDir $aModules $anAllSolution $theIDE }
|
||||
"cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution }
|
||||
"amk" { OS:MKAMK $anOutDir $aModules "adm/${aWokStation}/${theIDE}"}
|
||||
"xcd" {
|
||||
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
|
||||
OS:MKXCD $anOutDir $aModules $anAllSolution $theLibType $thePlatform
|
||||
@@ -1809,6 +1816,46 @@ proc osutils:vcproj:file { theVcVer theFile theOptions } {
|
||||
return $aText
|
||||
}
|
||||
|
||||
### AUTOMAKE ###############################################################################
|
||||
proc OS:MKAMK { theOutDir {theModules {}} theSubPath} {
|
||||
global path
|
||||
wokUtils:FILES:mkdir $theOutDir
|
||||
|
||||
foreach aModule $theModules {
|
||||
foreach aToolKit [$aModule:toolkits] {
|
||||
puts " toolkit: $aToolKit ==> $path/src/$aToolKit/EXTERNLIB"
|
||||
wokUtils:FILES:rmdir $theOutDir/$aToolKit
|
||||
wokUtils:FILES:mkdir $theOutDir/$aToolKit
|
||||
osutils:tk:mkam $theOutDir/$aToolKit $aToolKit
|
||||
}
|
||||
foreach anExecutable [OS:executable $aModule] {
|
||||
wokUtils:FILES:rmdir $theOutDir/$anExecutable
|
||||
wokUtils:FILES:mkdir $theOutDir/$anExecutable
|
||||
osutils:tk:mkamx $theOutDir/$anExecutable $anExecutable
|
||||
}
|
||||
}
|
||||
osutils:am:adm $theOutDir $theModules
|
||||
osutils:am:root $path $theSubPath $theModules
|
||||
|
||||
puts "The automake files are stored in the $theOutDir directory"
|
||||
}
|
||||
|
||||
proc wokUtils:FILES:rmdir { d } {
|
||||
global env
|
||||
global tcl_platform tcl_version
|
||||
regsub -all {\.[^.]*} $tcl_version "" major
|
||||
if { $major == 8 } {
|
||||
file delete -force $d
|
||||
} else {
|
||||
if { "$tcl_platform(platform)" == "unix" } {
|
||||
catch { exec rm -rf $d}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
proc wokUtils:FILES:mkdir { d } {
|
||||
global tcl_version
|
||||
regsub -all {\.[^.]*} $tcl_version "" major
|
||||
@@ -1830,6 +1877,51 @@ proc wokUtils:FILES:mkdir { d } {
|
||||
}
|
||||
}
|
||||
|
||||
# "Nice letter: %s" { a b c } => {Nice letter: %a} {Nice letter: %b} ..
|
||||
# as a string without backslash
|
||||
proc wokUtils:EASY:FmtSimple1 { fmt l {backslh 1} } {
|
||||
foreach e $l {
|
||||
if { $backslh } {
|
||||
append str [format $fmt $e] "\n"
|
||||
} else {
|
||||
append str [format $fmt $e]
|
||||
}
|
||||
}
|
||||
return $str
|
||||
}
|
||||
|
||||
# edit_last is performed ONCE fmt has been applied.
|
||||
proc wokUtils:EASY:FmtString2 { fmt l {yes_for_last 0} {edit_last {}} } {
|
||||
set ldeb [lrange $l 0 [expr [llength $l] -2]]
|
||||
set last [lrange $l end end]
|
||||
foreach e $ldeb {
|
||||
append str [format $fmt $e $e] " \\" "\n"
|
||||
}
|
||||
|
||||
if {$edit_last != {} } {
|
||||
set slast [$edit_last [format $fmt $last $last]]
|
||||
} else {
|
||||
set slast [format $fmt $last $last]
|
||||
}
|
||||
|
||||
if { $yes_for_last } {
|
||||
append str $slast " \\" "\n"
|
||||
} else {
|
||||
append str $slast "\n"
|
||||
}
|
||||
|
||||
return $str
|
||||
}
|
||||
|
||||
# { a.x b.c c.v } => { a b c}
|
||||
proc wokUtils:LIST:sanspoint { l } {
|
||||
set rr {}
|
||||
foreach x $l {
|
||||
lappend rr [file root $x]
|
||||
}
|
||||
return $rr
|
||||
}
|
||||
|
||||
# remove from listloc OpenCascade units indesirables on Unix
|
||||
proc osutils:justunix { listloc } {
|
||||
if { "$::tcl_platform(os)" == "Darwin" } {
|
||||
@@ -1840,6 +1932,653 @@ proc osutils:justunix { listloc } {
|
||||
return [osutils:juststation $goaway $listloc]
|
||||
}
|
||||
|
||||
# remove ":" from last item of dependencies list in target VPATH of Makefile.am
|
||||
proc osutils:am:__VPATH__lastoccur { str } {
|
||||
if { [regsub {:$} $str "" u] != 0 } {
|
||||
return $u
|
||||
}
|
||||
}
|
||||
|
||||
# ((((((((((((( Formats in Makefile.am )))))))))))))
|
||||
# Used to replace the string __VPATH__ in Makefile.am
|
||||
# l is the list of the units in a toolkit.
|
||||
proc osutils:am:__VPATH__ { l } {
|
||||
set fmt "@top_srcdir@/src/%s:"
|
||||
return [wokUtils:EASY:FmtString2 $fmt $l 0 osutils:am:__VPATH__lastoccur]
|
||||
}
|
||||
|
||||
# Used to replace the string __INCLUDES__ in Makefile.am
|
||||
# l is the list of packages in a toolkit.
|
||||
proc osutils:am:__INCLUDES__ { l } {
|
||||
set fmt "-I@top_srcdir@/src/%s"
|
||||
return [wokUtils:EASY:FmtString2 $fmt $l]
|
||||
}
|
||||
|
||||
# Used to replace the string __LIBADD__ in Makefile.am
|
||||
# l is the toolkit closure list of a toolkit.
|
||||
proc osutils:am:__LIBADD__ { theIncToolkits {final 0} } {
|
||||
global path
|
||||
global fBranch
|
||||
set aFatherModules ""
|
||||
set aCurrentWorkBench [file tail $path]
|
||||
if { $fBranch != "" } {
|
||||
set fd [open $fBranch/adm/UDLIST rb]
|
||||
set fileContent [split [read $fd] "\n"]
|
||||
close $fd
|
||||
set ftoolkits [lsearch -all -inline $fileContent "t *"]
|
||||
foreach ft $ftoolkits {
|
||||
set aFatherModules "$aFatherModules [string range $ft 2 end]"
|
||||
}
|
||||
}
|
||||
set aLibString ""
|
||||
foreach aIncToolkit $theIncToolkits {
|
||||
if { [lsearch [split $aFatherModules " "] $aIncToolkit] != -1} {
|
||||
append aLibString " \\\n-l$aIncToolkit"
|
||||
} else {
|
||||
append aLibString " \\\n../$aIncToolkit/lib$aIncToolkit.la"
|
||||
}
|
||||
}
|
||||
return $aLibString
|
||||
}
|
||||
|
||||
# Used to replace the string __SOURCES__ in Makefile.am
|
||||
# l is the list of all compilable files in a toolkit.
|
||||
proc osutils:am:__SOURCES__ { l } {
|
||||
set fmt "%s"
|
||||
return [wokUtils:EASY:FmtString1 $fmt $l]
|
||||
}
|
||||
|
||||
proc osutils:am:__CXXFLAG__ { l } {
|
||||
set fmt "%s"
|
||||
return [wokUtils:EASY:FmtString1 $fmt [osutils:am:PkCXXOption $l]]
|
||||
}
|
||||
|
||||
proc osutils:am:PkCXXOption { ppk } {
|
||||
global path
|
||||
#puts "\t 1 [lindex [wokparam -e %CMPLRS_CXX_Options [wokcd]] 0]"
|
||||
set CXXCOMMON [_get_options lin cmplrs_cxx b]
|
||||
#puts "\t 2 [wokparam -v %CMPLRS_CXX_Options [w_info -f]]"
|
||||
#puts "\t 3 [wokparam -v %CMPLRS_CXX_Options]"
|
||||
set FoundFlag "[lindex [osutils:intersect3 [split [_get_options lin cmplrs_cxx f]] [split [_get_options lin cmplrs_cxx b]] ] 2]"
|
||||
foreach pk $ppk {
|
||||
#puts $pk
|
||||
if {![file isdirectory $path/src/$pk]} {
|
||||
continue
|
||||
}
|
||||
set src_files [_get_used_files $pk false]
|
||||
set only_src_files {}
|
||||
foreach s $src_files {
|
||||
regexp {source ([^\s]+)} $s dummy name
|
||||
lappend only_src_files $name
|
||||
}
|
||||
if {[lsearch $only_src_files ${pk}_CMPLRS.edl] != "-1"} {
|
||||
set pk_cmplrs_cxx [_get_options lin cmplrs_cxx $pk]
|
||||
if {$pk_cmplrs_cxx == ""} {
|
||||
set pk_cmplrs_cxx [_get_options lin cmplrs_cxx b]
|
||||
}
|
||||
set CXXStr $pk_cmplrs_cxx
|
||||
#puts "\t 4 [wokparam -e %CMPLRS_CXX_Options [woklocate -u $pk]] $pk"
|
||||
set LastIndex [expr {[string length $CXXCOMMON ] - 1}]
|
||||
if {[string equal $CXXCOMMON [string range $CXXStr 0 $LastIndex]]} {
|
||||
set CXXOption " "
|
||||
} else {
|
||||
set CXXOption [string range $CXXStr 0 [expr {[string last $CXXCOMMON $CXXStr] - 1}]]
|
||||
}
|
||||
if {$CXXOption != " " && $CXXOption != "" && $CXXOption != " " && $CXXOption != " "} {
|
||||
set FoundList [split $CXXOption " "]
|
||||
foreach elem $FoundList {
|
||||
if {$elem != ""} {
|
||||
if {[string first "-I" $elem] == "-1" } {
|
||||
if {[string first $elem $FoundFlag] == "-1"} {
|
||||
set FoundFlag "$FoundFlag $elem"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $FoundFlag
|
||||
}
|
||||
|
||||
# Create in dir the Makefile.am associated with toolkit tkloc.
|
||||
# Returns the full path of the created file.
|
||||
proc osutils:tk:mkam { dir tkloc } {
|
||||
global path
|
||||
set pkgs $path/src/${tkloc}/PACKAGES
|
||||
if { ![file exists $pkgs] } {
|
||||
puts stderr "osutils:tk:mkam : Error. File PACKAGES not found for toolkit $tkloc."
|
||||
return {}
|
||||
}
|
||||
|
||||
set tmplat [osutils:readtemplate mam "Makefile.am"]
|
||||
set lpkgs [osutils:justunix [wokUtils:FILES:FileToList $pkgs]]
|
||||
set close [wokUtils:LIST:Purge [osutils:tk:close $tkloc]]
|
||||
set lsrc [lsort [osutils:tk:files $tkloc osutils:compilable 1 osutils:justunix]]
|
||||
set lobj [wokUtils:LIST:sanspoint $lsrc]
|
||||
|
||||
set lcsf [osutils:tk:csfInExternlib $path/src/${tkloc}/EXTERNLIB]
|
||||
|
||||
set final 0
|
||||
set externinc ""
|
||||
set externlib ""
|
||||
if { $lcsf != {} } {
|
||||
set final 1
|
||||
set fmtinc "\$(%s_INCLUDES) "
|
||||
set fmtlib "\$(%s_LIB) "
|
||||
set externinc [wokUtils:EASY:FmtSimple1 $fmtinc $lcsf 0]
|
||||
set externlib [wokUtils:EASY:FmtSimple1 $fmtlib $lcsf 0]
|
||||
}
|
||||
|
||||
regsub -all -- {__TKNAM__} $tmplat $tkloc tmplat
|
||||
set vpath [osutils:am:__VPATH__ $lpkgs]
|
||||
regsub -all -- {__VPATH__} $tmplat $vpath tmplat
|
||||
set inclu [osutils:am:__INCLUDES__ $lpkgs]
|
||||
regsub -all -- {__INCLUDES__} $tmplat $inclu tmplat
|
||||
if { $close != {} } {
|
||||
set libadd [osutils:am:__LIBADD__ $close $final]
|
||||
} else {
|
||||
set libadd ""
|
||||
}
|
||||
regsub -all -- {__LIBADD__} $tmplat $libadd tmplat
|
||||
set source [osutils:am:__SOURCES__ $lsrc]
|
||||
regsub -all -- {__SOURCES__} $tmplat $source tmplat
|
||||
regsub -all -- {__EXTERNINC__} $tmplat $externinc tmplat
|
||||
set CXXFl [osutils:am:__CXXFLAG__ $lpkgs]
|
||||
regsub -all -- {__CXXFLAG__} $tmplat $CXXFl tmplat
|
||||
set CFl [osutils:am:__CFLAG__ $lpkgs]
|
||||
regsub -all -- {__CFLAG__} $tmplat $CFl tmplat
|
||||
|
||||
regsub -all -- {__EXTERNLIB__} $tmplat $externlib tmplat
|
||||
|
||||
wokUtils:FILES:StringToFile $tmplat [set fmam [file join $dir Makefile.am]]
|
||||
return [list $fmam]
|
||||
}
|
||||
|
||||
# Write a string in a file
|
||||
proc wokUtils:FILES:StringToFile { str path } {
|
||||
if { [catch { set out [ open $path w ] } errout] == 0 } {
|
||||
puts -nonewline $out $str
|
||||
close $out
|
||||
return 1
|
||||
} else {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
# Create in dir the Makefile.am associated with toolkit tkloc.
|
||||
# Returns the full path of the created file.
|
||||
proc osutils:tk:mkamx { dir tkloc } {
|
||||
global path
|
||||
set src_files [_get_used_files $tkloc false]
|
||||
set only_src_files {}
|
||||
foreach s $src_files {
|
||||
regexp {source ([^\s]+)} $s dummy name
|
||||
lappend only_src_files $name
|
||||
}
|
||||
if { [lsearch $only_src_files ${tkloc}_WOKSteps.edl] != "-1"} {
|
||||
set pkgs "$path/src/${tkloc}/EXTERNLIB"
|
||||
if { $pkgs == {} } {
|
||||
puts stderr "osutils:tk:mkamx : Error. File EXTERNLIB not found for executable $tkloc."
|
||||
#return {}
|
||||
}
|
||||
set tmplat [osutils:readtemplate mamx "Makefile.am (executable)"]
|
||||
set close [wokUtils:LIST:Purge [osutils:tk:close $tkloc]]
|
||||
set lsrc [lsort [osutils:tk:files $tkloc osutils:compilable 1 osutils:justunix]]
|
||||
set lobj [wokUtils:LIST:sanspoint $lsrc]
|
||||
set CXXList {}
|
||||
foreach SourceFile $only_src_files {
|
||||
if {[file extension $SourceFile] == ".cxx"} {
|
||||
lappend CXXList [file rootname $SourceFile]
|
||||
}
|
||||
}
|
||||
set pkgs [LibToLinkX $tkloc [lindex $CXXList 0]]
|
||||
set lpkgs [osutils:justunix [wokUtils:FILES:FileToList $pkgs]]
|
||||
puts "pkgs $pkgs"
|
||||
#set lcsf [osutils:tk:csfInExternlib [woklocate -p ${tkloc}:source:EXTERNLIB [wokcd]]]
|
||||
|
||||
set lcsf {}
|
||||
foreach tk $pkgs {
|
||||
foreach element [osutils:tk:csfInExternlib "$path/src/${tk}/EXTERNLIB"] {
|
||||
if {[lsearch $lcsf $element] == "-1"} {
|
||||
set lcsf [concat $lcsf $element]
|
||||
}
|
||||
}
|
||||
}
|
||||
set final 0
|
||||
set externinc ""
|
||||
set externlib ""
|
||||
if { $lcsf != {} } {
|
||||
set final 1
|
||||
set fmtinc "\$(%s_INCLUDES) "
|
||||
set fmtlib "\$(%s_LIB) "
|
||||
set externinc [wokUtils:EASY:FmtSimple1 $fmtinc $lcsf 0]
|
||||
set externlib [wokUtils:EASY:FmtSimple1 $fmtlib $lcsf 0]
|
||||
}
|
||||
regsub -all -- {__XQTNAM__} $tmplat $tkloc tmplat
|
||||
set tmplat "$tmplat \nlib_LTLIBRARIES="
|
||||
foreach entity $CXXList {
|
||||
set tmplat "$tmplat lib${entity}.la"
|
||||
}
|
||||
set tmplat "$tmplat\n"
|
||||
set inclu [osutils:am:__INCLUDES__ $lpkgs]
|
||||
regsub -all -- {__INCLUDES__} $tmplat $inclu tmplat
|
||||
if { $pkgs != {} } {
|
||||
set libadd [osutils:am:__LIBADD__ $pkgs $final]
|
||||
} else {
|
||||
set libadd ""
|
||||
}
|
||||
regsub -all -- {__LIBADD__} $tmplat $libadd tmplat
|
||||
set source [osutils:am:__SOURCES__ $CXXList]
|
||||
regsub -all -- {__SOURCES__} $tmplat $source tmplat
|
||||
regsub -all -- {__EXTERNINC__} $tmplat $externinc tmplat
|
||||
foreach entity $CXXList {
|
||||
set tmplat "$tmplat lib${entity}_la_SOURCES = @top_srcdir@/src/${tkloc}/${entity}.cxx \n"
|
||||
}
|
||||
foreach entity $CXXList {
|
||||
set tmplat "$tmplat lib${entity}_la_LIBADD = $libadd $externlib \n"
|
||||
}
|
||||
wokUtils:FILES:StringToFile $tmplat [set fmam [file join $dir Makefile.am]]
|
||||
|
||||
unset tmplat
|
||||
|
||||
return [list $fmam]
|
||||
|
||||
} else {
|
||||
set pkgs "$path/src/${tkloc}/EXTERNLIB"
|
||||
if { $pkgs == {} } {
|
||||
puts stderr "osutils:tk:mkamx : Error. File EXTERNLIB not found for executable $tkloc."
|
||||
#return {}
|
||||
}
|
||||
set tmplat [osutils:readtemplate mamx "Makefile.am (executable)"]
|
||||
set close [wokUtils:LIST:Purge [osutils:tk:close $tkloc]]
|
||||
set lsrc [lsort [osutils:tk:files $tkloc osutils:compilable 1 osutils:justunix]]
|
||||
set lobj [wokUtils:LIST:sanspoint $lsrc]
|
||||
set CXXList {}
|
||||
foreach SourceFile $only_src_files {
|
||||
if {[file extension $SourceFile] == ".cxx"} {
|
||||
lappend CXXList [file rootname $SourceFile]
|
||||
}
|
||||
}
|
||||
set pkgs [LibToLinkX $tkloc [lindex $CXXList 0]]
|
||||
set lpkgs [osutils:justunix [wokUtils:FILES:FileToList $pkgs]]
|
||||
set lcsf [osutils:tk:csfInExternlib "$path/src/${tkloc}/EXTERNLIB"]
|
||||
|
||||
set lcsf {}
|
||||
foreach tk $pkgs {
|
||||
foreach element [osutils:tk:csfInExternlib "$path/src/${tk}/EXTERNLIB"] {
|
||||
if {[lsearch $lcsf $element] == "-1"} {
|
||||
set lcsf [concat $lcsf $element]
|
||||
}
|
||||
}
|
||||
}
|
||||
set final 0
|
||||
set externinc ""
|
||||
set externlib ""
|
||||
if { $lcsf != {} } {
|
||||
set final 1
|
||||
set fmtinc "\$(%s_INCLUDES) "
|
||||
set fmtlib "\$(%s_LIB) "
|
||||
set externinc [wokUtils:EASY:FmtSimple1 $fmtinc $lcsf 0]
|
||||
set externlib [wokUtils:EASY:FmtSimple1 $fmtlib $lcsf 0]
|
||||
}
|
||||
regsub -all -- {__XQTNAM__} $tmplat $tkloc tmplat
|
||||
set tmplat "$tmplat \nbin_PROGRAMS="
|
||||
foreach entity $CXXList {
|
||||
set tmplat "${tmplat} ${entity}"
|
||||
}
|
||||
|
||||
set tmplat "${tmplat}\n"
|
||||
set inclu [osutils:am:__INCLUDES__ $lpkgs]
|
||||
regsub -all -- {__INCLUDES__} $tmplat $inclu tmplat
|
||||
if { $pkgs != {} } {
|
||||
set libadd [osutils:am:__LIBADD__ $pkgs $final]
|
||||
} else {
|
||||
set libadd ""
|
||||
}
|
||||
set source [osutils:am:__SOURCES__ $CXXList]
|
||||
regsub -all -- {__SOURCES__} $tmplat $source tmplat
|
||||
regsub -all -- {__EXTERNINC__} $tmplat $externinc tmplat
|
||||
foreach entity $CXXList {
|
||||
set tmplat "$tmplat ${entity}_SOURCES = @top_srcdir@/src/${tkloc}/${entity}.cxx \n"
|
||||
}
|
||||
foreach entity $CXXList {
|
||||
set tmplat "$tmplat ${entity}_LDADD = $libadd $externlib \n"
|
||||
}
|
||||
wokUtils:FILES:StringToFile $tmplat [set fmam [file join $dir Makefile.am]]
|
||||
|
||||
return [list $fmam]
|
||||
}
|
||||
}
|
||||
|
||||
# Create in dir the Makefile.am in $dir directory.
|
||||
# Returns the full path of the created file.
|
||||
proc osutils:am:adm { dir {lesmodules {}} } {
|
||||
set amstring "srcdir = @srcdir@\n\n"
|
||||
set subdirs "SUBDIRS ="
|
||||
set vpath "VPATH = @srcdir@ ${dir}: "
|
||||
set make ""
|
||||
set phony ".PHONY:"
|
||||
foreach theModule $lesmodules {
|
||||
set units [osutils:tk:sort [$theModule:toolkits]]
|
||||
set units [concat $units [OS:executable $theModule]]
|
||||
append amstring "${theModule}_PKGS ="
|
||||
append vpath "\\\n"
|
||||
foreach unit $units {
|
||||
append amstring " ${unit}"
|
||||
append vpath "${dir}/${unit}: "
|
||||
}
|
||||
set up ${theModule}
|
||||
if { [info procs ${theModule}:alias] != "" } {
|
||||
set up [${theModule}:alias]
|
||||
}
|
||||
set up [string toupper ${up}]
|
||||
append amstring "\n\nif ENABLE_${up}\n"
|
||||
append amstring " ${theModule}_DIRS = \$(${theModule}_PKGS)\n"
|
||||
append amstring "else\n"
|
||||
append amstring " ${theModule}_DIRS = \n"
|
||||
append amstring "endif\n\n"
|
||||
append subdirs " \$(${theModule}_DIRS)"
|
||||
append make "${theModule}:\n"
|
||||
append make "\tfor d in \$(${theModule}_PKGS); do \\\n"
|
||||
append make "\t\tcd \$\$d; \$(MAKE) \$(AM_MAKEFLAGS) lib\$\$d.la; cd ..; \\\n"
|
||||
append make "\tdone\n\n"
|
||||
append phony " ${theModule}"
|
||||
}
|
||||
append amstring "$subdirs\n\n"
|
||||
append amstring "$vpath\n\n"
|
||||
append amstring $make
|
||||
append amstring $phony
|
||||
wokUtils:FILES:StringToFile $amstring [set fmam [file join $dir Makefile.am]]
|
||||
return [list $fmam]
|
||||
}
|
||||
|
||||
# retourne la liste de dependances de module.
|
||||
proc OS:lsdep { m } {
|
||||
set res {}
|
||||
set l [${m}:depends]
|
||||
if { $l != {} } {
|
||||
set res [concat $res $l]
|
||||
foreach h $l {
|
||||
set res [concat $res [OS:lsdep ${h}]]
|
||||
}
|
||||
}
|
||||
return $res
|
||||
}
|
||||
|
||||
# Create in dir the Makefile.am and configure.ac in CASROOT directory.
|
||||
# Returns the full path of the created file.
|
||||
proc osutils:am:root { dir theSubPath {lesmodules {}} } {
|
||||
global path
|
||||
set amstring "srcdir = @srcdir@\n\n"
|
||||
append amstring "SUBDIRS = ${theSubPath}\n\n"
|
||||
append amstring "VPATH = @srcdir@ @top_srcdir@/${theSubPath}: @top_srcdir@/${theSubPath}:\n\n"
|
||||
|
||||
set phony ".PHONY:"
|
||||
|
||||
set acstring [osutils:readtemplate ac "Makefile.am"]
|
||||
set enablestr ""
|
||||
set confstr ""
|
||||
set condstr ""
|
||||
set repstr ""
|
||||
set acconfstr ""
|
||||
|
||||
set exelocal "install-exec-local:\n"
|
||||
append exelocal "\t"
|
||||
append exelocal {$(INSTALL) -d $(prefix)/$(platform)}
|
||||
append exelocal "\n"
|
||||
foreach d {bin lib} {
|
||||
append exelocal "\t"
|
||||
append exelocal "if \[ -e \$(prefix)/${d} -a ! -e \$(prefix)/\$(platform)/${d} \]; then \\\n"
|
||||
append exelocal "\t\tcd \$(prefix)/\$(platform) && ln -s ../${d} ${d}; \\\n"
|
||||
append exelocal "\tfi\n"
|
||||
}
|
||||
append exelocal "\t"
|
||||
append exelocal {buildd=`pwd`; cd $(top_srcdir); sourced=`pwd`; cd $(prefix); installd=`pwd`; cd $$buildd;}
|
||||
append exelocal " \\\n"
|
||||
append exelocal "\t"
|
||||
append exelocal {if [ "$$installd" != "$$sourced" ]; then}
|
||||
append exelocal " \\\n"
|
||||
append exelocal "\t\t"
|
||||
append exelocal {$(INSTALL) -d $(prefix)/src;}
|
||||
append exelocal " \\\n"
|
||||
append exelocal "\t\t"
|
||||
append exelocal {cp -frL $(top_srcdir)/src $(prefix);}
|
||||
append exelocal " \\\n"
|
||||
append exelocal "\t\t"
|
||||
append exelocal {cp -frL $$buildd/config.h $(prefix);}
|
||||
append exelocal " \\\n"
|
||||
append exelocal "\t\tfor d in "
|
||||
|
||||
foreach theModule $lesmodules {
|
||||
append amstring "${theModule}_PKGS ="
|
||||
foreach r [${theModule}:ressources] {
|
||||
if { "[lindex $r 1]" == "r" } {
|
||||
append amstring " [lindex $r 2]"
|
||||
}
|
||||
}
|
||||
set up ${theModule}
|
||||
if { [info procs ${theModule}:alias] != "" } {
|
||||
set up [${theModule}:alias]
|
||||
}
|
||||
set up [string toupper ${up}]
|
||||
set lower ${theModule}
|
||||
if { [info procs ${theModule}:alias] != "" } {
|
||||
set lower [${theModule}:alias]
|
||||
}
|
||||
set lower [string tolower ${lower}]
|
||||
|
||||
append amstring "\n\nif ENABLE_${up}\n"
|
||||
append amstring " ${theModule}_DIRS = \$(${theModule}_PKGS)\n"
|
||||
append amstring "else\n"
|
||||
append amstring " ${theModule}_DIRS = \n"
|
||||
append amstring "endif\n\n"
|
||||
append amstring "${theModule}:\n"
|
||||
append amstring "\tcd \$(top_builddir)/${theSubPath} && \$(MAKE) \$(AM_MAKEFLAGS) ${theModule}\n\n"
|
||||
append phony " ${theModule}"
|
||||
|
||||
append exelocal " \$(${theModule}_DIRS)"
|
||||
|
||||
append enablestr "AC_ARG_ENABLE(\[${lower}\],\n"
|
||||
append enablestr " \[AS_HELP_STRING(\[--disable-${lower}\],\[Disable ${theModule} components\])\],\n"
|
||||
append enablestr " \[ENABLE_${up}=\${enableval}\],\[ENABLE_${up}=yes\])\n"
|
||||
|
||||
set deplist [OS:lsdep ${theModule}]
|
||||
set acdeplist {}
|
||||
if { [info procs ${theModule}:acdepends] != "" } {
|
||||
set acdeplist [${theModule}:acdepends]
|
||||
}
|
||||
|
||||
if { [llength $deplist] > 0 || [llength $acdeplist] > 0} {
|
||||
append confstr "if test \"xyes\" = \"x\$ENABLE_${up}\"; then\n"
|
||||
} else {
|
||||
append confstr "if test \"xyes\" != \"x\$ENABLE_${up}\"; then\n"
|
||||
}
|
||||
foreach dep $deplist {
|
||||
set dup ${dep}
|
||||
if { [info procs ${dep}:alias] != "" } {
|
||||
set dup [${dep}:alias]
|
||||
}
|
||||
set dup [string toupper ${dup}]
|
||||
append confstr " if test \"xyes\" = \"x\$ENABLE_${up}\" -a \"xyes\" != \"x\$ENABLE_${dup}\"; then\n"
|
||||
append confstr " AC_MSG_NOTICE(\[Disabling ${theModule}: not building ${dep} component\])\n"
|
||||
append confstr " DISABLE_${up}_REASON=\"(${dep} component disabled)\"\n"
|
||||
append confstr " ENABLE_${up}=no\n"
|
||||
append confstr " fi\n"
|
||||
}
|
||||
foreach dep $acdeplist {
|
||||
append confstr " if test \"xyes\" = \"x\$ENABLE_${up}\" -a \"xyes\" != \"x\$HAVE_${dep}\"; then\n"
|
||||
append confstr " AC_MSG_NOTICE(\[Disabling ${theModule}: ${dep} not found\])\n"
|
||||
append confstr " DISABLE_${up}_REASON=\"(${dep} not found)\"\n"
|
||||
append confstr " ENABLE_${up}=no\n"
|
||||
append confstr " fi\n"
|
||||
}
|
||||
if { [llength $deplist] > 0 || [llength $acdeplist] > 0 } {
|
||||
append confstr "else\n"
|
||||
}
|
||||
append confstr " DISABLE_${up}_REASON=\"(Disabled)\"\n"
|
||||
append confstr "fi\n"
|
||||
|
||||
append condstr "AM_CONDITIONAL(\[ENABLE_${up}\], \[test \"xyes\" = \"x\$ENABLE_${up}\"\])\n"
|
||||
append repstr [format "echo \"%-*s \$ENABLE_${up} \$DISABLE_${up}_REASON\"" 26 ${theModule}]
|
||||
append repstr "\n"
|
||||
|
||||
set units [$theModule:toolkits]
|
||||
set units [concat $units [OS:executable $theModule]]
|
||||
foreach unit $units {
|
||||
append acconfstr "${theSubPath}/${unit}/Makefile \\\n"
|
||||
}
|
||||
}
|
||||
|
||||
append exelocal "; do \\\n"
|
||||
append exelocal "\t\t\t"
|
||||
append exelocal {$(INSTALL) -d $(prefix)/src/$$d;}
|
||||
append exelocal " \\\n"
|
||||
append exelocal "\t\t\t"
|
||||
append exelocal {cp -frL $(top_srcdir)/src/$$d $(prefix)/src;}
|
||||
append exelocal " \\\n"
|
||||
append exelocal "\t\tdone; \\\n"
|
||||
append exelocal "\tfi\n"
|
||||
append exelocal "\t"
|
||||
append exelocal {if [ -e $(prefix)/src/config.h ]; then}
|
||||
append exelocal " \\\n"
|
||||
append exelocal "\t\t"
|
||||
append exelocal {unlink $(prefix)/src/config.h;}
|
||||
append exelocal " \\\n"
|
||||
append exelocal "\tfi\n"
|
||||
append exelocal "\t"
|
||||
append exelocal {cd $(prefix)/src && ln -s ../config.h config.h}
|
||||
append exelocal "\n"
|
||||
append exelocal "\t"
|
||||
append exelocal {cd $(top_srcdir) && cp *.sh $(prefix)}
|
||||
append exelocal "\n"
|
||||
append exelocal "\n"
|
||||
|
||||
append amstring $exelocal
|
||||
append amstring $phony
|
||||
|
||||
regsub -all -- {__ENABLEMODULES__} $acstring $enablestr acstring
|
||||
regsub -all -- {__CONFMODULES__} $acstring $confstr acstring
|
||||
regsub -all -- {__CONDMODULES__} $acstring $condstr acstring
|
||||
regsub -all -- {__REPMODULES__} $acstring $repstr acstring
|
||||
regsub -all -- {__ACCONFMODULES__} $acstring $acconfstr acstring
|
||||
|
||||
wokUtils:FILES:StringToFile $amstring [set fmam [file join $dir Makefile.am]]
|
||||
wokUtils:FILES:StringToFile $acstring [set fmam [file join $dir configure.ac]]
|
||||
file copy -force -- [file join $path/adm/templates build_configure] [file join $dir build_configure]
|
||||
file copy -force -- [file join $path/adm/templates acinclude.m4] [file join $dir acinclude.m4]
|
||||
file copy -force -- [file join $path/adm/templates custom.sh.in] [file join $dir custom.sh.in]
|
||||
return [list $fmam]
|
||||
}
|
||||
|
||||
proc wokUtils:EASY:FmtString1 { fmt l {yes_for_last 0} {edit_last {}} } {
|
||||
set ldeb [lrange $l 0 [expr [llength $l] -2]]
|
||||
set last [lrange $l end end]
|
||||
foreach e $ldeb {
|
||||
append str [format $fmt $e] " \\" "\n"
|
||||
}
|
||||
|
||||
if {$edit_last != {} } {
|
||||
set slast [$edit_last [format $fmt $last]]
|
||||
} else {
|
||||
set slast [format $fmt $last]
|
||||
}
|
||||
|
||||
if { $yes_for_last } {
|
||||
append str $slast " \\" "\n"
|
||||
} else {
|
||||
append str $slast "\n"
|
||||
}
|
||||
return $str
|
||||
}
|
||||
|
||||
# Used to replace the string __CFLAG__ in Makefile.am
|
||||
# l is the list of all compilable files in a toolkit.
|
||||
proc osutils:am:__CFLAG__ { l } {
|
||||
set fmt "%s"
|
||||
return [wokUtils:EASY:FmtString1 $fmt [osutils:am:PkCOption $l]]
|
||||
}
|
||||
|
||||
proc osutils:am:PkCOption { ppk } {
|
||||
global path
|
||||
#puts "\t\t $ppk"
|
||||
#puts "\t 5 [lindex [wokparam -e %CMPLRS_C_Options [wokcd]] 0]"
|
||||
set CCOMMON [_get_options lin cmplrs_c b]
|
||||
#puts "\t 6 [lindex [wokparam -v %CMPLRS_C_Options [w_info -f]] 0]"
|
||||
set FoundFlag "[lindex [osutils:intersect3 [split [_get_options lin cmplrs_c f]] [split [_get_options lin cmplrs_c b]]] 2]"
|
||||
foreach pk $ppk {
|
||||
if {![file isdirectory $path/src/$pk]} {
|
||||
continue
|
||||
}
|
||||
set src_files [_get_used_files $pk false]
|
||||
set only_src_files {}
|
||||
foreach s $src_files {
|
||||
regexp {source ([^\s]+)} $s dummy name
|
||||
lappend only_src_files $name
|
||||
}
|
||||
if {[lsearch $src_files ${pk}_CMPLRS.edl] != "-1"} {
|
||||
#puts "\t 7 [lindex [wokparam -e %CMPLRS_C_Options [woklocate -u $pk]] 0] $pk"
|
||||
set aPkList [split "[_get_options lin cmplrs_c $pk]" " "]
|
||||
set aCcomList [split "$CCOMMON" " "]
|
||||
|
||||
foreach aPkItem $aPkList {
|
||||
if { [lsearch aCcomList $aPkItem] != -1 } {
|
||||
if {[string first "-I" $aPkItem] == "-1" } {
|
||||
set FoundFlag "$FoundFlag $aPkItem"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $FoundFlag
|
||||
}
|
||||
|
||||
proc osutils:tksrcfiles { theUnits theRelatedPath {theCompatible {}} } {
|
||||
set aTKSrcFiles [list]
|
||||
|
||||
if [array exists written] { unset written }
|
||||
foreach anUnit $theUnits {
|
||||
set xlo $anUnit
|
||||
set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0]
|
||||
|
||||
if { $theCompatible != {} } {
|
||||
set aSrcFiles [osutils:tk:files $xlo $theCompatible 0]
|
||||
}
|
||||
|
||||
foreach aSrcFile [lsort $aSrcFiles] {
|
||||
if { ![info exists written([file tail $aSrcFile])] } {
|
||||
set written([file tail $aSrcFile]) 1
|
||||
lappend aTKSrcFiles "${theRelatedPath}/[wokUtils:FILES:wtail $aSrcFile 3]"
|
||||
} else {
|
||||
puts "Warning : more than one occurences for [file tail $aSrcFile]"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $aTKSrcFiles
|
||||
}
|
||||
|
||||
proc osutils:mm_compilable { } {
|
||||
return [list .mm]
|
||||
}
|
||||
|
||||
proc osutils:tkdefs { theUnits } {
|
||||
set aTKDefines [list]
|
||||
|
||||
foreach anUnit $theUnits {
|
||||
lappend aTKDefines "__${anUnit}_DLL"
|
||||
}
|
||||
|
||||
return $aTKDefines
|
||||
}
|
||||
|
||||
proc osutils:fileGroupName { theSrcFile } {
|
||||
set path [file dirname [file normalize ${theSrcFile}]]
|
||||
regsub -all [file normalize "${path}/.."] ${path} "" aGroupName
|
||||
|
||||
return $aGroupName
|
||||
}
|
||||
|
||||
|
||||
####### CODEBLOCK ###################################################################
|
||||
# Function to generate Code Blocks workspace and project files
|
||||
@@ -2090,7 +2829,6 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-MP\" />"
|
||||
} else {
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-O2\" />"
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-std=c++0x\" />"
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-mmmx\" />"
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-msse\" />"
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-msse2\" />"
|
||||
@@ -2148,7 +2886,6 @@ proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks t
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-MP\" />"
|
||||
} else {
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-O0\" />"
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-std=c++0x\" />"
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-g\" />"
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-mmmx\" />"
|
||||
puts $aFile "\t\t\t\t\t<Add option=\"-msse\" />"
|
||||
|
157
adm/templates/acinclude.m4
Normal file
157
adm/templates/acinclude.m4
Normal file
@@ -0,0 +1,157 @@
|
||||
#------------------------------------------------------------------------
|
||||
# Check for TCL
|
||||
# Options: --with-tcl= : Specify location of tclConfig.sh
|
||||
# --without-tcl= : Skip check for TCL, assume not installed
|
||||
# Defines:
|
||||
# HAVE_TCL : yes/no
|
||||
# Everything from tclConfig.sh
|
||||
#------------------------------------------------------------------------
|
||||
AC_DEFUN([SC_TCL_CFG], [
|
||||
AC_ARG_WITH(tcl,
|
||||
AC_HELP_STRING([--with-tcl=PATH],[Directory containing tclConfig.sh])
|
||||
AC_HELP_STRING([--without-tcl], [Assume no tcl libraries available]) ,
|
||||
[with_tcl="${withval}";require_tcl=yes],[with_tcl=yes;require_tcl=no])
|
||||
|
||||
# If user requested disabling of tcl check
|
||||
if test "xno" = "x$with_tcl"; then
|
||||
HAVE_TCL=no
|
||||
require_tcl=no
|
||||
# Otherwise...
|
||||
else
|
||||
HAVE_TCL=no
|
||||
# Search for tclConfig.sh
|
||||
if test "xyes" != "x$with_tcl"; then
|
||||
# If user specified location
|
||||
. "${with_tcl}/tclConfig.sh" || AC_MSG_ERROR("Cannot read file: ${with_tcl}/tclConfig.sh")
|
||||
HAVE_TCL=yes
|
||||
else
|
||||
# Search for tclConfig.sh in usual spots
|
||||
tcl_cfg_file=
|
||||
AC_MSG_CHECKING([for tclConfig.sh])
|
||||
for i in /usr /usr/local ${prefix} /opt/sfw /usr/tcltk; do
|
||||
if test -d $i; then
|
||||
for j in $i/lib $i/lib/tcl $i/lib/tcl[[8-9]].[[0-9]] $i/lib/itcl; do
|
||||
if test -r "$j/tclConfig.sh"; then
|
||||
tcl_cfg_file="$j/tclConfig.sh"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if test "x" != "x$tcl_cfg_file"; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
AC_MSG_RESULT("$tcl_cfg_file")
|
||||
|
||||
if test "x" != "x$tcl_cfg_file"; then
|
||||
. "$tcl_cfg_file" || AC_MSG_ERROR("Cannot read file: $tcl_cfg_file")
|
||||
HAVE_TCL=yes
|
||||
|
||||
# if TCL_INCLUDE_SPEC wasn't defined, try to define it using TCL_INC_DIR
|
||||
if test "x" = "x$TCL_INCLUDE_SPEC"; then
|
||||
inc_path=`expr "x$TCL_INC_DIR" : "x\(.*\)/tcl-private/generic"`
|
||||
if test "x" != "$inc_path"; then
|
||||
TCL_INCLUDE_SPEC="-I$inc_path"
|
||||
elif test "x" != "x$TCL_INC_DIR"; then
|
||||
TCL_INCLUDE_SPEC="-I$TCL_INC_DIR"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
HAVE_TCL=no
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for tcl.h
|
||||
AC_LANG_C
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC"
|
||||
AC_CHECK_HEADER([tcl.h],[],[HAVE_TCL=no])
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
|
||||
if test "xyes" = "x$require_tcl"; then
|
||||
if test "xno" = "x$HAVE_TCL"; then
|
||||
AC_MSG_ERROR([TCL not found.])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Check for Tk
|
||||
# Options: --with-tk= : Specify location of Tk
|
||||
# --without-tk= : Skip check for Tk, assume not installed
|
||||
# Defines:
|
||||
# HAVE_TK : yes/no
|
||||
# Everything from tkConfig.sh
|
||||
#------------------------------------------------------------------------
|
||||
AC_DEFUN([SC_TK_CFG], [
|
||||
AC_ARG_WITH(tk,
|
||||
AC_HELP_STRING([--with-tk=PATH],[Directory containing tkConfig.sh])
|
||||
AC_HELP_STRING([--without-tk], [Assume no Tk libraries available]) ,
|
||||
[with_tk="${withval}";require_tk=yes],[with_tk=yes;require_tk=no])
|
||||
|
||||
# If user requested disabling of Tk check
|
||||
if test "xno" = "x$with_tk"; then
|
||||
HAVE_TK=no
|
||||
require_tk=no
|
||||
# Otherwise...
|
||||
else
|
||||
HAVE_TK=no
|
||||
# Search for tkConfig.sh
|
||||
if test "xyes" != "x$with_tk"; then
|
||||
# If user specified location
|
||||
. "${with_tk}/tkConfig.sh" || AC_MSG_ERROR("Cannot read file: ${with_tk}/tkConfig.sh")
|
||||
HAVE_TK=yes
|
||||
else
|
||||
# Search for tkConfig.sh in usual spots
|
||||
tk_cfg_file=
|
||||
AC_MSG_CHECKING([for tkConfig.sh])
|
||||
for i in /usr /usr/local ${prefix} /opt/sfw /usr/tcltk; do
|
||||
if test -d $i; then
|
||||
for j in $i/lib $i/lib/tk $i/lib/tk[[8-9]].[[0-9]] $i/lib/itcl; do
|
||||
if test -r "$j/tkConfig.sh"; then
|
||||
tk_cfg_file="$j/tkConfig.sh"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if test "x" != "x$tk_cfg_file"; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
AC_MSG_RESULT("$tk_cfg_file")
|
||||
|
||||
if test "x" != "x$tk_cfg_file"; then
|
||||
. "$tk_cfg_file" || AC_MSG_ERROR("Cannot read file: $tk_cfg_file")
|
||||
HAVE_TK=yes
|
||||
|
||||
# if TK_INCLUDE_SPEC wasn't defined, try to define it using TK_INC_DIR
|
||||
if test "x" = "x$TK_INCLUDE_SPEC"; then
|
||||
inc_path=`expr "x$TK_INC_DIR" : "x\(.*\)/tk-private/generic"`
|
||||
if test "x" != "$inc_path"; then
|
||||
TK_INCLUDE_SPEC="-I$inc_path"
|
||||
elif test "x" != "x$TK_INC_DIR"; then
|
||||
TK_INCLUDE_SPEC="-I$TK_INC_DIR"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
HAVE_TK=no
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for tk.h
|
||||
AC_LANG_C
|
||||
HAVE_TK=yes
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC $TK_INCLUDE_SPEC"
|
||||
AC_CHECK_HEADER([tk.h],[],[HAVE_TK=no])
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
|
||||
if test "xyes" = "x$require_tk"; then
|
||||
if test "xno" = "x$HAVE_TK"; then
|
||||
AC_MSG_ERROR([Tk not found.])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
1170
adm/templates/template.ac
Normal file
1170
adm/templates/template.ac
Normal file
File diff suppressed because it is too large
Load Diff
22
adm/templates/template.mam
Normal file
22
adm/templates/template.mam
Normal file
@@ -0,0 +1,22 @@
|
||||
# Makefile.am for Open Cascade toolkit __TKNAM__
|
||||
srcdir = @srcdir@
|
||||
|
||||
VPATH = @srcdir@ : \
|
||||
__VPATH__
|
||||
|
||||
AM_CXXFLAGS = __CXXFLAG__
|
||||
|
||||
AM_CFLAGS = __CFLAG__
|
||||
|
||||
INCLUDES = $(CSF_OPT_INCLUDES) __EXTERNINC__ \
|
||||
-I@top_srcdir@/inc \
|
||||
__INCLUDES__
|
||||
|
||||
lib_LTLIBRARIES=lib__TKNAM__.la
|
||||
|
||||
lib__TKNAM___la_LIBADD = $(CSF_OPT_LIBS) \
|
||||
__LIBADD__ \
|
||||
__EXTERNLIB__
|
||||
|
||||
lib__TKNAM___la_SOURCES = \
|
||||
__SOURCES__
|
10
adm/templates/template.mamx
Normal file
10
adm/templates/template.mamx
Normal file
@@ -0,0 +1,10 @@
|
||||
# Makefile.am for executable __XQTNAM__
|
||||
srcdir = @srcdir@
|
||||
|
||||
VPATH = @srcdir@ : \
|
||||
@top_srcdir@/src/__XQTNAM__
|
||||
|
||||
INCLUDES = $(CSF_OPT_INCLUDES) __EXTERNINC__ \
|
||||
-I@top_srcdir@/inc \
|
||||
-I@top_srcdir@/src/__XQTNAM__
|
||||
|
@@ -117,8 +117,7 @@ The following table enumerates the full list of environment variables used at co
|
||||
| INSTALL_TBB | Boolean flag | Indicates whether TBB binaries should be installed into the installation directory |
|
||||
| INSTALL_VTK | Boolean flag | Indicates whether VTK binaries should be installed into the installation directory |
|
||||
| INSTALL_TCL | Boolean flag | Indicates whether TCL binaries should be installed into the installation directory |
|
||||
| INSTALL_OCCT_TEST_CASES | Boolean flag | Indicates whether non-regression OCCT test scripts should be installed into the installation directory |
|
||||
| INSTALL_OCCT_SAMPLES | Boolean flag | Indicates whether OCCT samples should be installed into the installation directory |
|
||||
| INSTALL_OCCT_SAMPLES | Boolean flag | Indicates whether non-regression OCCT test scripts should be installed into the installation directory |
|
||||
| INSTALL_DOC_OcctOverview | Boolean flag | Indicates whether OCCT overview documentation should be installed into the installation directory |
|
||||
|
||||
**Note:** In those CMake options defining paths only the forward slashes ("/") are acceptable.
|
||||
|
@@ -385,52 +385,3 @@ TCollection_Array1OfReal aValues = ...;
|
||||
std::stable_sort (aValues->begin(), aValues->end());
|
||||
~~~~~
|
||||
|
||||
@subsection upgrade_occt700_2dlayers New implementation of 2d-layers
|
||||
|
||||
In latest OCCT version API that provided old implementation of 2d-layers was removed. Classes Aspect_Clayer2d, OpenGl_GrahpicDriver_Layer, Visual3d_Layer, Visual3d_LayerItem, V3d_LayerMgr, V3d_LayerMgrPointer were deleted.
|
||||
|
||||
Now 2d-layers are implemented through Z-layers. In order to create a 2d-object it is necessary to follow several steps:
|
||||
1. Create an AIS interactive object
|
||||
2. Set a Z-layer for it to determine in which layer this object will be displayed (layer system provides order of displaying objects, ones in the lower layer will be displayed behind the others in the higher layer)
|
||||
3. Set transform persistence (flag Graphic3d_TMF_2d or Graphic3d_TMF_2d_IsTopDown and a gp_Pnt point, where X and Y are used to set the coordinates’ origin in 2d space of the view and Z coordinate defines the gap from border of view window, except center position)
|
||||
|
||||
One more feature of new 2d-layers imlementation is a ColorScale based on a new class AIS_ColorScale. Old implementation of ColorScale as a global property of V3d_View has been removed with associated methods V3d_View::ColorScaleDisplay(), V3d_View::ColorScaleErase(), V3d_View::ColorScaleIsDisplayed(), V3d_View::ColorScale() and classes V3d_ColorScale, V3d_ColorScaleLayerItem, Aspect_ColorScale.
|
||||
|
||||
New interactive object AIS_ColorScale provides the same configuration API as previously Aspect_ColorScale and V3d_ColorScale. It should be used in the following way to display a 2D presentation of ColorScale:
|
||||
|
||||
~~~~~
|
||||
Handle(AIS_ColorScale) aCS = new AIS_ColorScale();
|
||||
// configuring
|
||||
aCS->SetHeight (0.95);
|
||||
aCS->SetRange (0.0, 10.0);
|
||||
aCS->SetNumberOfIntervals (10);
|
||||
// displaying
|
||||
aCS->SetZLayer (Graphic3d_ZLayerId_TopOSD);
|
||||
aCS->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0));
|
||||
aCS->SetToUpdate();
|
||||
theContextAIS->Display (aCS);
|
||||
~~~~~
|
||||
|
||||
To see how 2d objects are realized in OCCT you can call draw commands vcolorscale, vlayerline or vdrawtext (with -2d option). Draw command vcolorscale now requires a name of ColorScale object as an argument. To display this object use command vdisplay. Example:
|
||||
|
||||
~~~~~
|
||||
pload VISUALIZATION
|
||||
vinit
|
||||
vcolorscale cs –demo
|
||||
pload MODELING
|
||||
box b 100 100 100
|
||||
vdisplay b
|
||||
vsetdispmode 1
|
||||
vfit
|
||||
vlayerline 0 300 300 300 10
|
||||
vdrawtext t "2D-TEXT" -2d -pos 0 150 0 -color red
|
||||
~~~~~
|
||||
|
||||
Here is a small example in c++ how to display a custom AIS object in 2d:
|
||||
~~~~~
|
||||
Handle(AIS_InteractiveContext) aContext = ...; //get AIS context
|
||||
Handle(AIS_InteractiveObject) anObj =...; //create an AIS object
|
||||
anObj->SetZLayer(Graphic3d_ZLayerId_TopOSD); //display object in overlay
|
||||
anObj->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0)); //set 2d flag, coordinate origin is set to down-left corner
|
||||
aContext->Display (anObj); //display the object
|
||||
~~~~~
|
||||
|
@@ -33,7 +33,7 @@ source "${aScriptPath}/custom.sh"
|
||||
|
||||
if [ -e "${aScriptPath}/env.sh" ]; then source "${aScriptPath}/env.sh"; fi
|
||||
|
||||
tclsh "${aScriptPath}/adm/start.tcl" genproj -path="${aScriptPath}" -target=${aTarget} $anOpt2 $anOpt3 $anOpt4 $anOpt5
|
||||
tclsh "${aScriptPath}/adm/genproj.tcl" -path="${aScriptPath}" -target=${aTarget} $anOpt2 $anOpt3 $anOpt4 $anOpt5
|
||||
|
||||
export PATH="$anOldPath"
|
||||
export LD_LIBRARY_PATH="$anOldLd"
|
||||
|
@@ -96,7 +96,7 @@ thrusections -N thread 1 0 tw1 tw2
|
||||
puts "Putting together and writing \"Open CASCADE\"..."
|
||||
|
||||
# define text
|
||||
text2brep text2d OpenCASCADE -font Times-Roman -height 8 -aspect bold -composite off
|
||||
text2brep text2d OpenCASCADE Times-Roman 8 bold composite=0
|
||||
prism text text2d 0 0 2
|
||||
trotate text 0 0 0 0 1 0 90
|
||||
ttranslate text 24.75 -2 65
|
||||
|
@@ -77,10 +77,10 @@ set font "Arial Unicode MS"
|
||||
#text2brep title $text "Arial Unicode MS" 1.7 x=10 y=24 z=4.51
|
||||
# alternative variant to work-around issue #25852
|
||||
set text "i\u20dd\u20dd11\nINTEL\u20dd CORE\u2122 i7-4790\nSR1QF 3.60GHZ\nMALAY\nL411B540 \u20dd"
|
||||
text2brep title0 $text -font $font -height 1.7 -pos 10 24 4.51 -valign topfirstline
|
||||
text2brep title1 " M C" -font $font -height 0.77 -pos 10 24.2 4.51
|
||||
text2brep title2 "R" -font $font -height 0.77 -pos 15.3 21.9 4.51
|
||||
text2brep title3 "e4" -font $font -height 0.7 -pos 18.6 15.1 4.51
|
||||
text2brep title0 $text $font 1.7 x=10 y=24 z=4.51
|
||||
text2brep title1 " M C" $font 0.77 x=10 y=24.2 z=4.51
|
||||
text2brep title2 "R" $font 0.77 x=15.3 y=21.9 z=4.51
|
||||
text2brep title3 "e4" $font 0.7 x=18.6 y=15.1 z=4.51
|
||||
compound title0 title1 title2 title3 title
|
||||
|
||||
puts "Adding contact pads..."
|
||||
|
@@ -27,7 +27,7 @@ bcommon body b e
|
||||
bcut body body c
|
||||
bcommon core cx e
|
||||
|
||||
text2brep text "CAD Assistant" -font Times -height 10
|
||||
text2brep text "CAD Assistant" Times 10
|
||||
ttranslate text 10 -4 10
|
||||
prism tr text 0 0 -1
|
||||
bfuse body body tr
|
||||
|
@@ -107,13 +107,13 @@ polyline t9 154 -80 0 154 -60 0
|
||||
compound frame t1 t2 t3 t4 t5 t6 t7 t8 t9 lines
|
||||
|
||||
# add text
|
||||
text2brep sample "SAMPLE" -font Arial -height 10 -pos 90 -55 0 -aspect bolditalic
|
||||
text2brep occ "Open CASCADE" -font Times -height 6 -pos 125 -95 0
|
||||
text2brep name "Snowflake" -font Courier -height 7 -pos 65 -75 0 -aspect italic
|
||||
text2brep material "Ice" -font Courier -height 7 -pos 75 -95 0 -aspect italic
|
||||
text2brep sheets "Sheets 1" -font Courier -height 3.5 -pos 145 -83 0 -aspect italic
|
||||
text2brep scale "Scale\n\n1:100" -font Courier -height 3.5 -pos 157 -63 0 -aspect italic -valign topfirstline
|
||||
text2brep mass "Mass\n\n1 mg" -font Courier -height 3.5 -pos 140 -63 0 -aspect italic -valign topfirstline
|
||||
text2brep sample "SAMPLE" Arial 10 x=90 y=-55 bolditalic
|
||||
text2brep occ "Open CASCADE" Times 6 x=125 y=-95
|
||||
text2brep name "Snowflake" Courier 7 x=65 y=-75 italic
|
||||
text2brep material "Ice" Courier 7 x=75 y=-95 italic
|
||||
text2brep sheets "Sheets 1" Courier 3.5 x=145 y=-83 italic
|
||||
text2brep scale "Scale\n\n1:100" Courier 3.5 x=157 y=-63 italic
|
||||
text2brep mass "Mass\n\n1 mg" Courier 3.5 x=140 y=-63 italic
|
||||
eval compound [explode sample w] sample
|
||||
eval compound [explode occ w] occ
|
||||
eval compound [explode name w] name
|
||||
|
@@ -597,14 +597,9 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
|
||||
|
||||
Quantity_Length anArrowLength = aDimensionAspect->ArrowAspect()->Length();
|
||||
|
||||
TCollection_ExtendedString aLabelString = GetTextLabel();
|
||||
|
||||
// Text sizes
|
||||
Standard_Real aLabelWidth = 0.0;
|
||||
Standard_Real aLabelHeight = 0.0;
|
||||
Standard_Real aSymbolWidth = 0.0;
|
||||
Standard_Real aSymbolHeight = 0.0;
|
||||
getLabelSizes (aLabelString, aLabelWidth, aLabelHeight, aSymbolWidth, aSymbolHeight);
|
||||
// prepare label string and compute its geometrical width
|
||||
Standard_Real aLabelWidth;
|
||||
TCollection_ExtendedString aLabelString = GetValueString (aLabelWidth);
|
||||
|
||||
// add margins to label width
|
||||
if (aDimensionAspect->IsText3d())
|
||||
@@ -1164,15 +1159,8 @@ const gp_Pnt AIS_AngleDimension::GetTextPosition() const
|
||||
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
|
||||
|
||||
// Prepare label string and compute its geometrical width
|
||||
TCollection_ExtendedString aLabelString = GetTextLabel();
|
||||
|
||||
// Text sizes
|
||||
Standard_Real aLabelWidth = 0.0;
|
||||
Standard_Real aLabelHeight = 0.0;
|
||||
Standard_Real aSymbolWidth = 0.0;
|
||||
Standard_Real aSymbolHeight = 0.0;
|
||||
getLabelSizes (aLabelString, aLabelWidth, aLabelHeight, aSymbolWidth, aSymbolHeight);
|
||||
|
||||
Standard_Real aLabelWidth;
|
||||
TCollection_ExtendedString aLabelString = GetValueString (aLabelWidth);
|
||||
|
||||
gp_Pnt aFirstAttach = myCenterPoint.Translated (gp_Vec(myCenterPoint, myFirstPoint).Normalized() * GetFlyout());
|
||||
gp_Pnt aSecondAttach = myCenterPoint.Translated (gp_Vec(myCenterPoint, mySecondPoint).Normalized() * GetFlyout());
|
||||
@@ -1351,15 +1339,8 @@ void AIS_AngleDimension::FitTextAlignment (const Prs3d_DimensionTextHorizontalPo
|
||||
Quantity_Length anArrowLength = aDimensionAspect->ArrowAspect()->Length();
|
||||
|
||||
// Prepare label string and compute its geometrical width
|
||||
TCollection_ExtendedString aLabelString = GetTextLabel();
|
||||
|
||||
// Text sizes
|
||||
Standard_Real aLabelWidth = 0.0;
|
||||
Standard_Real aLabelHeight = 0.0;
|
||||
Standard_Real aSymbolWidth = 0.0;
|
||||
Standard_Real aSymbolHeight = 0.0;
|
||||
getLabelSizes (aLabelString, aLabelWidth, aLabelHeight, aSymbolWidth, aSymbolHeight);
|
||||
|
||||
Standard_Real aLabelWidth;
|
||||
TCollection_ExtendedString aLabelString = GetValueString (aLabelWidth);
|
||||
|
||||
// add margins to label width
|
||||
if (aDimensionAspect->IsText3d())
|
||||
|
@@ -35,11 +35,10 @@ namespace
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_DiameterDimension::AIS_DiameterDimension (const gp_Circ& theCircle,
|
||||
const Standard_Real theParameter)
|
||||
AIS_DiameterDimension::AIS_DiameterDimension (const gp_Circ& theCircle)
|
||||
: AIS_Dimension (AIS_KOD_DIAMETER)
|
||||
{
|
||||
SetMeasuredGeometry (theCircle, theParameter);
|
||||
SetMeasuredGeometry (theCircle);
|
||||
SetSpecialSymbol (THE_DIAMETER_SYMBOL);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetFlyout (0.0);
|
||||
@@ -106,8 +105,7 @@ gp_Pnt AIS_DiameterDimension::AnchorPoint()
|
||||
//function : SetMeasuredGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_DiameterDimension::SetMeasuredGeometry (const gp_Circ& theCircle,
|
||||
const Standard_Real theParameter)
|
||||
void AIS_DiameterDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
|
||||
{
|
||||
myCircle = theCircle;
|
||||
myGeometryType = GeometryType_Edge;
|
||||
@@ -122,7 +120,7 @@ void AIS_DiameterDimension::SetMeasuredGeometry (const gp_Circ& theCircle,
|
||||
else if (!myIsPlaneCustom)
|
||||
{
|
||||
ComputePlane();
|
||||
myAnchorPoint = ElCLib::Value (theParameter, myCircle);
|
||||
myAnchorPoint = ElCLib::Value (0.0, myCircle);
|
||||
}
|
||||
|
||||
SetToUpdate();
|
||||
@@ -294,7 +292,7 @@ void AIS_DiameterDimension::Compute (const Handle(PrsMgr_PresentationManager3d)&
|
||||
gp_Pnt aSecondPnt (gp::Origin());
|
||||
ComputeSidePoints (myCircle, aFirstPnt, aSecondPnt);
|
||||
|
||||
DrawLinearDimension (thePresentation, theMode, aFirstPnt, aSecondPnt, Standard_False, myToDrawDimensionLine);
|
||||
DrawLinearDimension (thePresentation, theMode, aFirstPnt, aSecondPnt);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -59,9 +59,7 @@ public:
|
||||
|
||||
//! Construct diameter dimension for the circle.
|
||||
//! @param theCircle [in] the circle to measure.
|
||||
//! @param theParameter [in] the value of parameter for parametric representation of the input circle
|
||||
//! that defines the point where the dimension is to be attached.
|
||||
Standard_EXPORT AIS_DiameterDimension (const gp_Circ& theCircle, const Standard_Real theParameter = 0.0);
|
||||
Standard_EXPORT AIS_DiameterDimension (const gp_Circ& theCircle);
|
||||
|
||||
//! Construct diameter dimension for the circle and orient it correspondingly
|
||||
//! to the passed plane.
|
||||
@@ -108,9 +106,7 @@ public:
|
||||
//! The dimension will become invalid if the diameter of the circle
|
||||
//! is less than Precision::Confusion().
|
||||
//! @param theCircle [in] the circle to measure.
|
||||
//! @param theParameter [in] the value of parameter for parametric representation of the input circle
|
||||
//! that defines the point where the dimension is to be attached.
|
||||
Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle, const Standard_Real theParameter = 0);
|
||||
Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle);
|
||||
|
||||
//! Measure diameter on the passed shape, if applicable.
|
||||
//! The dimension will become invalid if the passed shape is not
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -196,12 +196,10 @@ protected:
|
||||
LabelPosition_HCenter = 0x04,
|
||||
LabelPosition_HMask = LabelPosition_Left | LabelPosition_Right | LabelPosition_HCenter,
|
||||
|
||||
LabelPosition_Above = 0x0010,
|
||||
LabelPosition_FirstLine = 0x0020,
|
||||
LabelPosition_Below = 0x0040,
|
||||
LabelPosition_LastLine = 0x0080,
|
||||
LabelPosition_VCenter = 0x0100,
|
||||
LabelPosition_VMask = LabelPosition_Above | LabelPosition_Below | LabelPosition_VCenter | LabelPosition_FirstLine | LabelPosition_LastLine
|
||||
LabelPosition_Above = 0x10,
|
||||
LabelPosition_Below = 0x20,
|
||||
LabelPosition_VCenter = 0x40,
|
||||
LabelPosition_VMask = LabelPosition_Above | LabelPosition_Below | LabelPosition_VCenter
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -227,7 +225,10 @@ public:
|
||||
//! compute it on its own in model space coordinates.
|
||||
//! @return the dimension value (in model units) which is used
|
||||
//! during display of the presentation.
|
||||
Standard_EXPORT Standard_Real GetValue() const;
|
||||
Standard_Real GetValue() const
|
||||
{
|
||||
return myIsValueCustom ? myCustomValue : ComputeValue();
|
||||
}
|
||||
|
||||
//! Sets user-defined dimension value.
|
||||
//! The user-defined dimension value is specified in model space,
|
||||
@@ -235,14 +236,6 @@ public:
|
||||
//! @param theValue [in] the user-defined value to display.
|
||||
Standard_EXPORT void SetCustomValue (const Standard_Real theValue);
|
||||
|
||||
//! Sets multiline text for dimension label.
|
||||
//! @param theValue [in] multiline string of Unicode symbols.
|
||||
//! Can be used along with spectial symbol (like radius and diameter symbol)
|
||||
Standard_EXPORT void SetTextLabel (const TCollection_ExtendedString& theValue);
|
||||
|
||||
//! @return the text for text label.
|
||||
Standard_EXPORT TCollection_ExtendedString GetTextLabel() const;
|
||||
|
||||
//! Get the dimension plane in which the 2D dimension presentation is computed.
|
||||
//! By default, if plane is not defined by user, it is computed automatically
|
||||
//! after dimension geometry is computed.
|
||||
@@ -383,26 +376,6 @@ public:
|
||||
return myIsGeometryValid && CheckPlane (GetPlane());
|
||||
}
|
||||
|
||||
//! @return state that shows if the radius inner segment
|
||||
//! is to be displayed.
|
||||
Standard_EXPORT const Standard_Boolean ToDrawDimensionLine() const;
|
||||
|
||||
//! Sets the flag that defines whether the dimenion line segment is displayed
|
||||
//! @warning Dimension line won't be displayed only if arrows and label are moved
|
||||
//! outside on dimension line extensions
|
||||
Standard_EXPORT void SetToDrawDimensionLine (const Standard_Boolean theToDrawInnerSegment);
|
||||
|
||||
Standard_EXPORT void SetToAlignText (const Standard_Boolean theToAlign,
|
||||
const gp_Dir& theAlignmentDir = gp_Dir (1.0, 0.0, 0.0));
|
||||
|
||||
Standard_EXPORT const Standard_Boolean IsTextAligned() const;
|
||||
|
||||
Standard_EXPORT const gp_Dir& TextAlignmentDir() const;
|
||||
|
||||
Standard_EXPORT void SetLeaderSegment (const Standard_Real theLength);
|
||||
|
||||
Standard_EXPORT void UnsetLeaderSegment();
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(AIS_Dimension, AIS_InteractiveObject)
|
||||
@@ -411,9 +384,10 @@ protected:
|
||||
|
||||
Standard_EXPORT Standard_Real ValueToDisplayUnits() const;
|
||||
|
||||
Standard_EXPORT void getLabelSizes (const TCollection_ExtendedString& theLabel,
|
||||
Standard_Real& theWidth, Standard_Real& theHeight,
|
||||
Standard_Real& theSymbolWidth, Standard_Real& theSymbolHeight) const;
|
||||
//! Get formatted value string and its model space width.
|
||||
//! @param theWidth [out] the model space with of the string.
|
||||
//! @return formatted dimension value string.
|
||||
Standard_EXPORT TCollection_ExtendedString GetValueString (Standard_Real& theWidth) const;
|
||||
|
||||
//! Performs drawing of 2d or 3d arrows on the working plane
|
||||
//! @param theLocation [in] the location of the arrow tip.
|
||||
@@ -461,15 +435,11 @@ protected:
|
||||
//! @param theFirstPoint [in] the first attach point of linear dimension.
|
||||
//! @param theSecondPoint [in] the second attach point of linear dimension.
|
||||
//! @param theIsOneSide [in] specifies whether the dimension has only one flyout line.
|
||||
//! @param theToDrawDimensionLine [in] specifies whether the dimension line is to be displayed.
|
||||
//! @warning Dimension line won't be displayed only if arrows and label are moved
|
||||
//! outside on dimension line extensions
|
||||
Standard_EXPORT void DrawLinearDimension (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode,
|
||||
const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theSecondPoint,
|
||||
const Standard_Boolean theIsOneSide = Standard_False,
|
||||
const Standard_Boolean theToDrawDimensionLine = Standard_True);
|
||||
const Standard_Boolean theIsOneSide = Standard_False);
|
||||
|
||||
//! Compute selection sensitives for linear dimension flyout lines (length, diameter, radius).
|
||||
//! Please note that this method uses base dimension properties: working plane and flyout length.
|
||||
@@ -681,57 +651,29 @@ protected: //! @name Selection geometry
|
||||
|
||||
Standard_Real mySelToleranceForText2d; //!< Sensitive point tolerance for 2d text selection.
|
||||
|
||||
protected:
|
||||
protected: //! @name Value properties
|
||||
|
||||
enum TypeOfLabel
|
||||
{
|
||||
TOL_Computed = 0, //< is default
|
||||
TOL_Value = 1,
|
||||
TOL_Text
|
||||
};
|
||||
|
||||
protected: //! @name Label properties
|
||||
|
||||
TypeOfLabel myTypeOfLabel;
|
||||
|
||||
Standard_Real myCustomValue; //!< Value of the dimension (computed or user-defined).
|
||||
TCollection_ExtendedString myLabel; //!< Label text. Sets the user defined multiline text
|
||||
Standard_Real myCustomValue; //!< Value of the dimension (computed or user-defined).
|
||||
Standard_Boolean myIsValueCustom; //!< Is user-defined value.
|
||||
|
||||
protected: //! @name Fixed text position properties
|
||||
|
||||
gp_Pnt myFixedTextPosition; //!< Stores text position fixed by user.
|
||||
Standard_Boolean myIsTextPositionFixed; //!< Is the text label position fixed by user.
|
||||
gp_Pnt myFixedTextPosition; //!< Stores text position fixed by user.
|
||||
Standard_Boolean myIsTextPositionFixed; //!< Is the text label position fixed by user.
|
||||
|
||||
protected: //! @name Units properties
|
||||
|
||||
Standard_ExtCharacter mySpecialSymbol; //!< Special symbol.
|
||||
AIS_DisplaySpecialSymbol myDisplaySpecialSymbol; //!< Special symbol display options.
|
||||
|
||||
protected:
|
||||
|
||||
//! Shows if the dimension line is to be drawn
|
||||
//! It is used only if the text is placed on the one of the dimension line extensions.
|
||||
//! By default it is TRUE
|
||||
//! @warning Dimension line won't be displayed only if arrows and label are moved
|
||||
//! outside on dimension line extensions
|
||||
Standard_Boolean myToDrawDimensionLine;
|
||||
|
||||
protected: //! @name Geometrical properties
|
||||
|
||||
GeometryType myGeometryType; //!< defines type of shapes on which the dimension is to be built.
|
||||
|
||||
gp_Pln myPlane; //!< Plane where dimension will be built (computed or user defined).
|
||||
Standard_Boolean myIsPlaneCustom; //!< Is plane defined by user (otherwise it will be computed automatically).
|
||||
Standard_Real myFlyout; //!< Flyout distance.
|
||||
|
||||
//! Shows if the text label is aligned to user-defined direction myTextDir
|
||||
//! Otherwise it is alligned to the dimension line extension direction
|
||||
//! @warning Only for text placed outside of the dimension line
|
||||
Standard_Boolean myIsTextAligned;
|
||||
gp_Dir myTextDir; //!< Alignment direction for the text
|
||||
Standard_Real myLeaderSegmentLength; //!< Length of leader line segment aligned with text to myTextDir direction
|
||||
|
||||
Standard_Boolean myIsGeometryValid; //!< Is dimension geometry properly defined.
|
||||
gp_Pln myPlane; //!< Plane where dimension will be built (computed or user defined).
|
||||
Standard_Boolean myIsPlaneCustom; //!< Is plane defined by user (otherwise it will be computed automatically).
|
||||
Standard_Real myFlyout; //!< Flyout distance.
|
||||
Standard_Boolean myIsGeometryValid; //!< Is dimension geometry properly defined.
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -523,7 +523,7 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
||||
if (aStatus->IsHilighted())
|
||||
{
|
||||
const Standard_Integer aHiMod = theIObj->HasHilightMode() ? theIObj->HilightMode() : theDispMode;
|
||||
myMainPM->Color (theIObj, aStatus->HilightColor(), aHiMod);
|
||||
myMainPM->Highlight (theIObj, aHiMod);
|
||||
}
|
||||
if (theSelectionMode != -1)
|
||||
{
|
||||
@@ -534,8 +534,6 @@ void AIS_InteractiveContext::Display (const Handle(AIS_InteractiveObject)& theIO
|
||||
}
|
||||
if (!mgrSelector->IsActivated (theIObj, theSelectionMode))
|
||||
{
|
||||
if (!aStatus->IsSModeIn (theSelectionMode))
|
||||
aStatus->AddSelectionMode (theSelectionMode);
|
||||
mgrSelector->Activate (theIObj, theSelectionMode, myMainSel);
|
||||
}
|
||||
}
|
||||
|
@@ -245,10 +245,16 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
|
||||
myLastPicked.Nullify();
|
||||
}
|
||||
|
||||
if (toUpdateViewer
|
||||
&& theToRedrawOnUpdate)
|
||||
if (toUpdateViewer)
|
||||
{
|
||||
theView->Viewer()->Update();
|
||||
if (theToRedrawOnUpdate)
|
||||
{
|
||||
theView->Viewer()->Update();
|
||||
}
|
||||
else
|
||||
{
|
||||
theView->Viewer()->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
mylastmoveview = theView;
|
||||
@@ -408,7 +414,10 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdate
|
||||
anOwner->State (0);
|
||||
if (anOwner == anObject->GlobalSelOwner())
|
||||
{
|
||||
myObjects.ChangeFind (anObject)->SetHilightStatus (Standard_False);
|
||||
Handle(AIS_GlobalStatus) aStatus = myObjects (anObject);
|
||||
aStatus->SetHilightStatus (Standard_False);
|
||||
aStatus->SetHilightColor (Quantity_NOC_WHITE);
|
||||
anObject->State (0);
|
||||
}
|
||||
if (!anOwner->IsAutoHilight())
|
||||
{
|
||||
@@ -753,9 +762,7 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
|
||||
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||
if (anOwner == anObj->GlobalSelOwner())
|
||||
{
|
||||
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObj);
|
||||
aState->SetHilightStatus (Standard_True);
|
||||
aState->SetHilightColor (mySelectionColor);
|
||||
anObj->State (1);
|
||||
}
|
||||
anOwner->State (1);
|
||||
if (!anOwner->IsAutoHilight())
|
||||
@@ -816,7 +823,7 @@ void AIS_InteractiveContext::UnhilightSelected (const Standard_Boolean theToUpda
|
||||
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||
if (anOwner == anObj->GlobalSelOwner())
|
||||
{
|
||||
myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
|
||||
anObj->State (0);
|
||||
}
|
||||
anOwner->State (0);
|
||||
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HasHilightMode() : 0;
|
||||
@@ -854,7 +861,7 @@ void AIS_InteractiveContext::ClearSelected (const Standard_Boolean theToUpdateVi
|
||||
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||
if (anOwner == anObj->GlobalSelOwner())
|
||||
{
|
||||
myObjects.ChangeFind (anObj)->SetHilightStatus (Standard_False);
|
||||
anObj->State (0);
|
||||
}
|
||||
anOwner->State (0);
|
||||
if (!anOwner->IsAutoHilight())
|
||||
@@ -916,7 +923,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
if (theObject->HasSelection (0))
|
||||
return;
|
||||
|
||||
if (NbSelected() == 1 && myObjects (theObject)->IsHilighted())
|
||||
if (NbSelected() == 1 && theObject->State() == 1)
|
||||
{
|
||||
Quantity_NameOfColor aHiCol;
|
||||
Standard_Boolean hasHiCol = Standard_False;
|
||||
@@ -943,10 +950,7 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||
Unhilight (aSelectable, Standard_False);
|
||||
anOwner->State (0);
|
||||
if (anOwner == aSelectable->GlobalSelOwner())
|
||||
{
|
||||
myObjects.ChangeFind (aSelectable)->SetHilightStatus (Standard_False);
|
||||
}
|
||||
aSelectable->State (0);
|
||||
}
|
||||
|
||||
// added to avoid untimely viewer update...
|
||||
@@ -957,13 +961,8 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
Handle(SelectMgr_EntityOwner) anOwner =
|
||||
Handle(SelectMgr_EntityOwner)::DownCast (aSel->Sensitive()->BaseSensitive()->OwnerId());
|
||||
AIS_Selection::ClearAndSelect (anOwner);
|
||||
theObject->State (1);
|
||||
anOwner->State (1);
|
||||
if (anOwner == theObject->GlobalSelOwner())
|
||||
{
|
||||
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (theObject);
|
||||
aState->SetHilightStatus (Standard_True);
|
||||
aState->SetHilightColor (mySelectionColor);
|
||||
}
|
||||
Quantity_NameOfColor aHiCol;
|
||||
Standard_Boolean hasHiCol = Standard_False;
|
||||
if (IsHilighted (theObject, hasHiCol, aHiCol))
|
||||
@@ -1035,10 +1034,6 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
|
||||
anObjToClear.Add (anInteractive);
|
||||
}
|
||||
anOwner->State (0);
|
||||
if (theOwner == anObject->GlobalSelOwner())
|
||||
{
|
||||
myObjects.ChangeFind (anObject)->SetHilightStatus (Standard_False);
|
||||
}
|
||||
}
|
||||
while (!anObjToClear.IsEmpty())
|
||||
{
|
||||
@@ -1055,13 +1050,6 @@ void AIS_InteractiveContext::SetSelected (const Handle(SelectMgr_EntityOwner)& t
|
||||
highlightSelected (theOwner, mySelectionColor);
|
||||
}
|
||||
|
||||
if (theOwner == anObject->GlobalSelOwner())
|
||||
{
|
||||
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind (anObject);
|
||||
aState->SetHilightStatus (Standard_True);
|
||||
aState->SetHilightColor (mySelectionColor);
|
||||
}
|
||||
|
||||
if (theToUpdateViewer)
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
@@ -1142,7 +1130,9 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
const Handle(AIS_InteractiveObject) anObj =
|
||||
Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||
const Standard_Boolean isGlobal = anObj->GlobalSelOwner() == theOwner;
|
||||
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
|
||||
if (isGlobal)
|
||||
anObj->State (aState);
|
||||
const Handle(AIS_GlobalStatus)& aStatus = myObjects (anObj);
|
||||
const Standard_Integer aHiMode = anObj->HasHilightMode() ? anObj->HilightMode() : 0;
|
||||
if (aState == 1)
|
||||
{
|
||||
@@ -1194,7 +1184,7 @@ Standard_Boolean AIS_InteractiveContext::IsSelected (const Handle(AIS_Interactiv
|
||||
if (!theObj->HasSelection (aGlobalSelMode) || !isGlobalModeActivated)
|
||||
return Standard_False;
|
||||
|
||||
return myObjects (theObj)->IsHilighted();
|
||||
return theObj->State() == 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -188,11 +188,8 @@ void AIS_LengthDimension::SetMeasuredShapes (const TopoDS_Shape& theFirstShape,
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_LengthDimension::CheckPlane (const gp_Pln& thePlane) const
|
||||
{
|
||||
Standard_Boolean anIsFaultyNormal =
|
||||
thePlane.Axis().Direction().IsParallel(gce_MakeDir (myFirstPoint, mySecondPoint), Precision::Angular());
|
||||
|
||||
if ((!thePlane.Contains (myFirstPoint, Precision::Confusion()) && !thePlane.Contains (mySecondPoint, Precision::Confusion()))
|
||||
|| anIsFaultyNormal)
|
||||
if (!thePlane.Contains (myFirstPoint, Precision::Confusion()) &&
|
||||
!thePlane.Contains (mySecondPoint, Precision::Confusion()))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -31,25 +31,15 @@ namespace
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::init()
|
||||
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle)
|
||||
: AIS_Dimension (AIS_KOD_RADIUS)
|
||||
{
|
||||
SetMeasuredGeometry (theCircle);
|
||||
SetSpecialSymbol (THE_RADIUS_SYMBOL);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetFlyout (0.0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
|
||||
const Standard_Real theParameter)
|
||||
: AIS_Dimension (AIS_KOD_RADIUS)
|
||||
{
|
||||
init();
|
||||
SetMeasuredGeometry (theCircle, theParameter);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
@@ -58,8 +48,10 @@ AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAttachPoint)
|
||||
: AIS_Dimension (AIS_KOD_RADIUS)
|
||||
{
|
||||
init();
|
||||
SetMeasuredGeometry (theCircle, theAttachPoint);
|
||||
SetSpecialSymbol (THE_RADIUS_SYMBOL);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetFlyout (0.0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -69,21 +61,22 @@ AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
|
||||
AIS_RadiusDimension::AIS_RadiusDimension (const TopoDS_Shape& theShape)
|
||||
: AIS_Dimension (AIS_KOD_RADIUS)
|
||||
{
|
||||
init();
|
||||
SetMeasuredGeometry (theShape);
|
||||
SetSpecialSymbol (THE_RADIUS_SYMBOL);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetFlyout (0.0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMeasuredGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle,
|
||||
const Standard_Real theParameter)
|
||||
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
|
||||
{
|
||||
myCircle = theCircle;
|
||||
myGeometryType = GeometryType_Edge;
|
||||
myShape = BRepLib_MakeEdge (theCircle);
|
||||
myAnchorPoint = ElCLib::Value (theParameter, myCircle);
|
||||
myAnchorPoint = ElCLib::Value (0, myCircle);
|
||||
myIsGeometryValid = IsValidCircle (myCircle);
|
||||
|
||||
if (myIsGeometryValid)
|
||||
@@ -135,33 +128,6 @@ void AIS_RadiusDimension::SetMeasuredGeometry (const TopoDS_Shape& theShape)
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Circle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const gp_Circ& AIS_RadiusDimension::Circle() const
|
||||
{
|
||||
return myCircle;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AnchorPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const gp_Pnt& AIS_RadiusDimension::AnchorPoint() const
|
||||
{
|
||||
return myAnchorPoint;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Shape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopoDS_Shape& AIS_RadiusDimension::Shape() const
|
||||
{
|
||||
return myShape;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckPlane
|
||||
//purpose :
|
||||
@@ -262,7 +228,7 @@ void AIS_RadiusDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /
|
||||
return;
|
||||
}
|
||||
|
||||
DrawLinearDimension (thePresentation, theMode, myAnchorPoint, myCircle.Location(), Standard_True, myToDrawDimensionLine);
|
||||
DrawLinearDimension (thePresentation, theMode, myAnchorPoint, myCircle.Location(), Standard_True);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -39,21 +39,13 @@ DEFINE_STANDARD_HANDLE (AIS_RadiusDimension,AIS_Dimension)
|
||||
//! In case if the dimension is built on the arbitrary shape,
|
||||
//! it can be considered as invalid if the shape does not contain
|
||||
//! circle geometry.
|
||||
//! Use IsValid() method to check that created dimension is valid.
|
||||
class AIS_RadiusDimension : public AIS_Dimension
|
||||
{
|
||||
protected:
|
||||
|
||||
//! Setting of default construction parameters
|
||||
void init();
|
||||
|
||||
public:
|
||||
|
||||
//! Create radius dimension for the circle geometry.
|
||||
//! @param theCircle [in] the circle to measure.
|
||||
//! @param theParameter [in] the value of parameter for parametric representation of the input circle
|
||||
//! that defines the point where the dimension is to be attached.
|
||||
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle, const Standard_Real theParameter = 0);
|
||||
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle);
|
||||
|
||||
//! Create radius dimension for the circle geometry and define its
|
||||
//! orientation by location of the first point on that circle.
|
||||
@@ -70,13 +62,22 @@ public:
|
||||
public:
|
||||
|
||||
//! @return measured geometry circle.
|
||||
Standard_EXPORT const gp_Circ& Circle() const;
|
||||
const gp_Circ& Circle() const
|
||||
{
|
||||
return myCircle;
|
||||
}
|
||||
|
||||
//! @return anchor point on circle for radius dimension.
|
||||
Standard_EXPORT const gp_Pnt& AnchorPoint() const;
|
||||
const gp_Pnt& AnchorPoint() const
|
||||
{
|
||||
return myAnchorPoint;
|
||||
}
|
||||
|
||||
//! @return the measured shape.
|
||||
Standard_EXPORT const TopoDS_Shape& Shape() const;
|
||||
const TopoDS_Shape& Shape() const
|
||||
{
|
||||
return myShape;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -84,9 +85,7 @@ public:
|
||||
//! The dimension will become invalid if the radius of the circle
|
||||
//! is less than Precision::Confusion().
|
||||
//! @param theCircle [in] the circle to measure.
|
||||
//! @param theParameter [in] the value of parameter for parametric representation of the input circle
|
||||
//! that defines the point where the dimension is to be attached.
|
||||
Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle, const Standard_Real theParameter = 0);
|
||||
Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle);
|
||||
|
||||
//! Measure radius of the circle and orient the dimension so
|
||||
//! the dimension lines attaches to anchor point on the circle.
|
||||
@@ -123,16 +122,16 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT virtual void ComputePlane() Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual void ComputePlane();
|
||||
|
||||
//! Checks if anchor point and the center of the circle are on the plane.
|
||||
Standard_EXPORT virtual Standard_Boolean CheckPlane (const gp_Pln& thePlane) const Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Standard_Boolean CheckPlane (const gp_Pln& thePlane) const;
|
||||
|
||||
Standard_EXPORT virtual Standard_Real ComputeValue() const Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Standard_Real ComputeValue() const;
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0) Standard_OVERRIDE;
|
||||
const Standard_Integer theMode = 0);
|
||||
|
||||
protected:
|
||||
|
||||
|
28
src/Aspect/Aspect_CLayer2d.hxx
Normal file
28
src/Aspect/Aspect_CLayer2d.hxx
Normal file
@@ -0,0 +1,28 @@
|
||||
// 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.
|
||||
|
||||
/*============================================================================*/
|
||||
/*==== Titre: Aspect_CLayer2d.hxx */
|
||||
/*==== Role : The header file of primitive type "CLayer2d" from Aspect */
|
||||
/*==== */
|
||||
/*==== Implementation: This is a primitive type implemented with typedef */
|
||||
/*============================================================================*/
|
||||
// Defines the C structure <alayer>
|
||||
|
||||
#ifndef _Aspect_CLayer2d_HeaderFile
|
||||
#define _Aspect_CLayer2d_HeaderFile
|
||||
|
||||
#include <InterfaceGraphic_Aspect.hxx>
|
||||
typedef CALL_DEF_LAYER Aspect_CLayer2d;
|
||||
|
||||
#endif /*Aspect_CLayer2d_HeaderFile*/
|
@@ -12,6 +12,7 @@ Aspect_Background.hxx
|
||||
Aspect_BadAccess.hxx
|
||||
Aspect_CircularGrid.cxx
|
||||
Aspect_CircularGrid.hxx
|
||||
Aspect_CLayer2d.hxx
|
||||
Aspect_Convert.hxx
|
||||
Aspect_Display.hxx
|
||||
Aspect_DisplayConnection.cxx
|
||||
|
@@ -743,8 +743,7 @@ Standard_Integer NbWaysOut(const BOPAlgo_ListOfEdgeInfo& aLEInfo)
|
||||
GeomAbs_CurveType aType;
|
||||
Geom2dAdaptor_Curve aGAC2D(aC2D);
|
||||
aType=aGAC2D.GetType();
|
||||
if (aType==GeomAbs_BSplineCurve ||
|
||||
aType==GeomAbs_BezierCurve) {
|
||||
if (aType==GeomAbs_BSplineCurve || aType==GeomAbs_BezierCurve) {
|
||||
dt=1.1*dt;
|
||||
}
|
||||
if (fabs (aTV-aFirst) < fabs(aTV - aLast)) {
|
||||
@@ -754,25 +753,10 @@ Standard_Integer NbWaysOut(const BOPAlgo_ListOfEdgeInfo& aLEInfo)
|
||||
aTV1=aTV - dt;
|
||||
}
|
||||
//
|
||||
if (aType==GeomAbs_Circle) {
|
||||
Standard_Real aTM;
|
||||
TopAbs_Orientation aOrE;
|
||||
gp_Pnt2d aPM;
|
||||
//
|
||||
aTM=0.5*(aTV1+aTV);
|
||||
//
|
||||
aGAC2D.D1(aTM, aPM, aV2D);
|
||||
aOrE=anEdge.Orientation();
|
||||
if (aOrE==TopAbs_REVERSED) {
|
||||
aV2D.Reverse();
|
||||
}
|
||||
}
|
||||
else {
|
||||
aGAC2D.D0 (aTV1, aPV1);
|
||||
aGAC2D.D0 (aTV, aPV);
|
||||
//
|
||||
aV2D = bIsIN ? gp_Vec2d(aPV1, aPV) : gp_Vec2d(aPV, aPV1);
|
||||
}
|
||||
aGAC2D.D0 (aTV1, aPV1);
|
||||
aGAC2D.D0 (aTV, aPV);
|
||||
//
|
||||
aV2D = bIsIN ? gp_Vec2d(aPV1, aPV) : gp_Vec2d(aPV, aPV1);
|
||||
//
|
||||
gp_Dir2d aDir2D(aV2D);
|
||||
anAngle=Angle(aDir2D);
|
||||
|
@@ -26,14 +26,12 @@
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
|
||||
namespace {
|
||||
|
||||
//! Tool class implementing necessary functionality for copying geometry
|
||||
class BRepBuilderAPI_Copy_Modification : public BRepTools_Modification
|
||||
{
|
||||
public:
|
||||
BRepBuilderAPI_Copy_Modification (const Standard_Boolean copyGeom,
|
||||
const Standard_Boolean copyMesh)
|
||||
const Standard_Boolean copyMesh = Standard_False)
|
||||
: myCopyGeom(copyGeom),
|
||||
myCopyMesh(copyMesh)
|
||||
{
|
||||
@@ -68,8 +66,7 @@ public:
|
||||
if (T.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
if (myCopyGeom)
|
||||
T = T->Copy();
|
||||
T = T->Copy();
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
@@ -146,7 +143,6 @@ private:
|
||||
|
||||
DEFINE_STANDARD_HANDLE(BRepBuilderAPI_Copy_Modification, BRepTools_Modification)
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepBuilderAPI_Copy
|
||||
@@ -155,7 +151,7 @@ DEFINE_STANDARD_HANDLE(BRepBuilderAPI_Copy_Modification, BRepTools_Modification)
|
||||
|
||||
BRepBuilderAPI_Copy::BRepBuilderAPI_Copy ()
|
||||
{
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(Standard_True, Standard_False);
|
||||
myModification = new BRepBuilderAPI_Copy_Modification(Standard_True);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -22,9 +22,10 @@
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <BRepBuilderAPI_ModifyShape.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
class TopoDS_Shape;
|
||||
|
||||
|
||||
//! Duplication of a shape.
|
||||
//! A Copy object provides a framework for:
|
||||
//! - defining the construction of a duplicate shape,
|
||||
@@ -35,6 +36,7 @@ class BRepBuilderAPI_Copy : public BRepBuilderAPI_ModifyShape
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Constructs an empty copy framework. Use the function
|
||||
//! Perform to copy shapes.
|
||||
@@ -42,22 +44,39 @@ public:
|
||||
|
||||
//! Constructs a copy framework and copies the shape S.
|
||||
//! Use the function Shape to access the result.
|
||||
//! If copyMesh is True, triangulation contained in original shape will be
|
||||
//! copied along with geometry (by default, triangulation gets lost).
|
||||
//! If copyGeom is False, only topological objects will be copied, while
|
||||
//! geometry and triangulation will be shared with original shape.
|
||||
//! If copyGeom is False, only topological objects will be copied, while
|
||||
//! geometry will be shared with original shape.
|
||||
//! Note: the constructed framework can be reused to copy
|
||||
//! other shapes: just specify them with the function Perform.
|
||||
Standard_EXPORT BRepBuilderAPI_Copy(const TopoDS_Shape& S, const Standard_Boolean copyGeom = Standard_True, const Standard_Boolean copyMesh = Standard_False);
|
||||
|
||||
//! Copies the shape S.
|
||||
//! Use the function Shape to access the result.
|
||||
//! If copyMesh is True, triangulation contained in original shape will be
|
||||
//! copied along with geometry (by default, triangulation gets lost).
|
||||
//! If copyGeom is False, only topological objects will be copied, while
|
||||
//! geometry and triangulation will be shared with original shape.
|
||||
//! If copyGeom is False, only topological objects will be copied, while
|
||||
//! geometry will be shared with original shape.
|
||||
Standard_EXPORT void Perform (const TopoDS_Shape& S, const Standard_Boolean copyGeom = Standard_True, const Standard_Boolean copyMesh = Standard_False);
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BRepBuilderAPI_Copy_HeaderFile
|
||||
|
@@ -284,7 +284,7 @@ void BRepBuilderAPI_FastSewing::Perform(void)
|
||||
Standard_Real aRange = Compute3DRange();
|
||||
Handle(NCollection_IncAllocator) anAlloc = new NCollection_IncAllocator;
|
||||
NCollection_CellFilter<NodeInspector>
|
||||
aCells(Max(myTolerance, aRange/IntegerLast()), anAlloc);
|
||||
aCells(NodeInspector::Dimension, Max(myTolerance, aRange/IntegerLast()), anAlloc);
|
||||
|
||||
for(Standard_Integer i = myFaceVec.Lower(); i <= myFaceVec.Upper(); i++)
|
||||
{
|
||||
|
@@ -2778,7 +2778,7 @@ static Standard_Boolean GlueVertices(TopTools_IndexedDataMapOfShapeShape& aVerte
|
||||
Standard_Integer i, nbVertices = aVertexNode.Extent();
|
||||
// Create map of node -> vertices
|
||||
TopTools_IndexedDataMapOfShapeListOfShape NodeVertices;
|
||||
BRepBuilderAPI_CellFilter aFilter (Tolerance);
|
||||
BRepBuilderAPI_CellFilter aFilter (BRepBuilderAPI_VertexInspector::Dimension, Tolerance);
|
||||
BRepBuilderAPI_VertexInspector anInspector (Tolerance);
|
||||
for (i = 1; i <= nbVertices; i++) {
|
||||
TopoDS_Shape vertex = aVertexNode.FindKey(i);
|
||||
|
@@ -222,8 +222,6 @@ static void MakeOffset
|
||||
const GeomAbs_JoinType theJoinType,
|
||||
const TopoDS_Vertex * Ends);
|
||||
|
||||
Standard_Boolean CheckSmallParamOnEdge(const TopoDS_Edge& anEdge);
|
||||
|
||||
//=======================================================================
|
||||
//function : KPartCircle
|
||||
//purpose :
|
||||
@@ -1381,8 +1379,6 @@ void BRepFill_OffsetWire::MakeWires()
|
||||
TopExp::Vertices (E,V1,V2);
|
||||
if (V1.IsSame(V2) && IsSmallClosedEdge(E, V1))
|
||||
continue; //remove small closed edges
|
||||
if (!CheckSmallParamOnEdge(E))
|
||||
continue;
|
||||
if (!MVE.Contains(V1)) {
|
||||
TopTools_ListOfShape empty;
|
||||
MVE.Add(V1,empty);
|
||||
@@ -2760,18 +2756,3 @@ static void QuasiFleche(const Adaptor3d_Curve& C,
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean CheckSmallParamOnEdge(const TopoDS_Edge& anEdge)
|
||||
{
|
||||
const BRep_ListOfCurveRepresentation& aList = ((Handle(BRep_TEdge)::DownCast(anEdge.TShape()))->Curves());
|
||||
if (!aList.IsEmpty())
|
||||
{
|
||||
Handle( BRep_CurveRepresentation ) CRep = ((Handle(BRep_TEdge)::DownCast(anEdge.TShape()))->Curves()).First();
|
||||
Standard_Real f = (Handle(BRep_GCurve)::DownCast(CRep))->First();
|
||||
Standard_Real l = (Handle(BRep_GCurve)::DownCast(CRep))->Last();
|
||||
if (Abs (l - f) < Precision::PConfusion())
|
||||
return Standard_False;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -50,7 +50,7 @@ BRepMesh_CircleTool::BRepMesh_CircleTool(
|
||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||
: myTolerance (Precision::PConfusion() * Precision::PConfusion()),
|
||||
myAllocator (theAllocator),
|
||||
myCellFilter(10.0, theAllocator),
|
||||
myCellFilter(BRepMesh_CircleInspector::Dimension, 10, theAllocator),
|
||||
mySelector (myTolerance, 64, theAllocator)
|
||||
{
|
||||
}
|
||||
@@ -64,7 +64,7 @@ BRepMesh_CircleTool::BRepMesh_CircleTool(
|
||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||
: myTolerance (Precision::PConfusion() * Precision::PConfusion()),
|
||||
myAllocator (theAllocator),
|
||||
myCellFilter(10.0, theAllocator),
|
||||
myCellFilter(BRepMesh_CircleInspector::Dimension, 10, theAllocator),
|
||||
mySelector (myTolerance, Max(theReservedSize, 64), theAllocator)
|
||||
{
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ BRepMesh_VertexTool::BRepMesh_VertexTool(
|
||||
const Standard_Integer theReservedSize,
|
||||
const Handle(NCollection_IncAllocator)& theAllocator)
|
||||
: myAllocator (theAllocator),
|
||||
myCellFilter(0., myAllocator),
|
||||
myCellFilter(BRepMesh_VertexInspector::Dimension, 0., myAllocator),
|
||||
mySelector (Max(theReservedSize, 64),myAllocator)
|
||||
{
|
||||
const Standard_Real aTol = Precision::Confusion();
|
||||
|
@@ -21,11 +21,11 @@
|
||||
enum BRepOffset_Error
|
||||
{
|
||||
BRepOffset_NoError,
|
||||
BRepOffset_UnknownError,
|
||||
BRepOffset_BadNormalsOnGeometry,
|
||||
BRepOffset_C0Geometry,
|
||||
BRepOffset_NullOffset,
|
||||
BRepOffset_NotConnectedShell
|
||||
BRepOffset_OffsetSurfaceFailed,
|
||||
BRepOffset_UnCorrectClosingFace,
|
||||
BRepOffset_ExtentFaceFailed,
|
||||
BRepOffset_RadiusEqualOffset,
|
||||
BRepOffset_UnknownError
|
||||
};
|
||||
|
||||
#endif // _BRepOffset_Error_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -76,7 +76,7 @@ public:
|
||||
|
||||
Standard_EXPORT const TopoDS_Shape& Shape() const;
|
||||
|
||||
//! returns information about offset state.
|
||||
//! returns information if IsDone() = FALSE.
|
||||
Standard_EXPORT BRepOffset_Error Error() const;
|
||||
|
||||
//! Returns <Image> containing links between initials
|
||||
@@ -93,18 +93,6 @@ public:
|
||||
//! Returns the list of closing faces stores by AddFace
|
||||
Standard_EXPORT const TopTools_IndexedMapOfShape& ClosingFaces() const;
|
||||
|
||||
//! Makes pre analysis of possibility offset perform. Use method Error() to get more information.
|
||||
//! Finds first error. List of checks:
|
||||
//! 1) Check for existence object with non-null offset.
|
||||
//! 2) Check for connectivity in offset shell.
|
||||
//! 3) Check continuity of input surfaces.
|
||||
//! 4) Check for normals existence on grid.
|
||||
//! @return True if possible make computations and false otherwise.
|
||||
Standard_EXPORT Standard_Boolean CheckInputData();
|
||||
|
||||
//! Return bad shape, which obtained in CheckInputData.
|
||||
Standard_EXPORT const TopoDS_Shape& GetBadShape() const;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -173,8 +161,6 @@ private:
|
||||
Standard_Boolean myDone;
|
||||
BRepOffset_Error myError;
|
||||
BRepOffset_MakeLoops myMakeLoops;
|
||||
Standard_Boolean myIsPerformSewing; // Handle bad walls in thicksolid mode.
|
||||
TopoDS_Shape myBadShape;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -340,48 +340,7 @@ static Standard_Integer CONTROL(Draw_Interpretor& theCommands,
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : reportOffsetState
|
||||
//purpose : Print state of offset operation by error code.
|
||||
//=======================================================================
|
||||
static void reportOffsetState(Draw_Interpretor& theCommands,
|
||||
const BRepOffset_Error theErrorCode)
|
||||
{
|
||||
switch(theErrorCode)
|
||||
{
|
||||
case BRepOffset_NoError:
|
||||
{
|
||||
theCommands << "OK. Offset performed succesfully.";
|
||||
break;
|
||||
}
|
||||
case BRepOffset_BadNormalsOnGeometry:
|
||||
{
|
||||
theCommands << "ERROR. Degenerated normal on input data.";
|
||||
break;
|
||||
}
|
||||
case BRepOffset_C0Geometry:
|
||||
{
|
||||
theCommands << "ERROR. C0 continuity of input data.";
|
||||
break;
|
||||
}
|
||||
case BRepOffset_NullOffset:
|
||||
{
|
||||
theCommands << "ERROR. Null offset of all faces.";
|
||||
break;
|
||||
}
|
||||
case BRepOffset_NotConnectedShell:
|
||||
{
|
||||
theCommands << "ERROR. Incorrect set of faces to remove, the remaining shell is not connected.";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
theCommands << "ERROR. offsetperform operation not done.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PRW
|
||||
@@ -842,9 +801,13 @@ static Standard_Integer SPLS(Draw_Interpretor& ,
|
||||
//function : thickshell
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer thickshell(Draw_Interpretor& theCommands,
|
||||
Standard_Integer n, const char** a)
|
||||
|
||||
Standard_Integer thickshell(Draw_Interpretor& ,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
|
||||
//OSD_Chronometer Clock;
|
||||
|
||||
if ( n < 4) return 1;
|
||||
TopoDS_Shape S = DBRep::Get(a[2]);
|
||||
if (S.IsNull()) return 1;
|
||||
@@ -853,13 +816,13 @@ Standard_Integer thickshell(Draw_Interpretor& theCommands,
|
||||
|
||||
GeomAbs_JoinType JT= GeomAbs_Arc;
|
||||
if (n > 4)
|
||||
{
|
||||
if (!strcmp(a[4],"i"))
|
||||
JT = GeomAbs_Intersection;
|
||||
if (!strcmp(a[4],"t"))
|
||||
JT = GeomAbs_Tangent;
|
||||
}
|
||||
|
||||
{
|
||||
if (!strcmp(a[4],"i"))
|
||||
JT = GeomAbs_Intersection;
|
||||
if (!strcmp(a[4],"t"))
|
||||
JT = GeomAbs_Tangent;
|
||||
}
|
||||
|
||||
Standard_Boolean Inter = Standard_False; //Standard_True;
|
||||
Standard_Real Tol = Precision::Confusion();
|
||||
if (n > 5)
|
||||
@@ -868,12 +831,15 @@ Standard_Integer thickshell(Draw_Interpretor& theCommands,
|
||||
BRepOffset_MakeOffset B;
|
||||
B.Initialize(S,Of,Tol,BRepOffset_Skin,Inter,0,JT, Standard_True);
|
||||
|
||||
B.MakeOffsetShape();
|
||||
// Clock.Start();
|
||||
|
||||
const BRepOffset_Error aRetCode = B.Error();
|
||||
reportOffsetState(theCommands, aRetCode);
|
||||
B.MakeOffsetShape();
|
||||
//B.MakeThickSolid ();
|
||||
|
||||
// Clock.Show();
|
||||
|
||||
DBRep::Set(a[1],B.Shape());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -882,9 +848,12 @@ Standard_Integer thickshell(Draw_Interpretor& theCommands,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer offsetshape(Draw_Interpretor& theCommands,
|
||||
Standard_Integer n, const char** a)
|
||||
Standard_Integer offsetshape(Draw_Interpretor& ,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
|
||||
//OSD_Chronometer Clock;
|
||||
|
||||
if ( n < 4) return 1;
|
||||
TopoDS_Shape S = DBRep::Get(a[2]);
|
||||
if (S.IsNull()) return 1;
|
||||
@@ -892,8 +861,7 @@ Standard_Integer offsetshape(Draw_Interpretor& theCommands,
|
||||
Standard_Real Of = Draw::Atof(a[3]);
|
||||
Standard_Boolean Inter = (!strcmp(a[0],"offsetcompshape"));
|
||||
GeomAbs_JoinType JT= GeomAbs_Arc;
|
||||
if (!strcmp(a[0],"offsetinter"))
|
||||
{
|
||||
if (!strcmp(a[0],"offsetinter")) {
|
||||
JT = GeomAbs_Intersection;
|
||||
Inter = Standard_True;
|
||||
}
|
||||
@@ -901,11 +869,9 @@ Standard_Integer offsetshape(Draw_Interpretor& theCommands,
|
||||
BRepOffset_MakeOffset B;
|
||||
Standard_Integer IB = 4;
|
||||
Standard_Real Tol = Precision::Confusion();
|
||||
if (n > 4)
|
||||
{
|
||||
if (n > 4) {
|
||||
TopoDS_Shape SF = DBRep::Get(a[4],TopAbs_FACE);
|
||||
if (SF.IsNull())
|
||||
{
|
||||
if (SF.IsNull()) {
|
||||
IB = 5;
|
||||
Tol = Draw::Atof(a[4]);
|
||||
}
|
||||
@@ -916,21 +882,19 @@ Standard_Integer offsetshape(Draw_Interpretor& theCommands,
|
||||
//----------------------------------------
|
||||
Standard_Boolean YaBouchon = Standard_False;
|
||||
|
||||
for (Standard_Integer i = IB ; i < n; i++)
|
||||
{
|
||||
for (Standard_Integer i = IB ; i < n; i++) {
|
||||
TopoDS_Shape SF = DBRep::Get(a[i],TopAbs_FACE);
|
||||
if (!SF.IsNull())
|
||||
{
|
||||
if (!SF.IsNull()) {
|
||||
YaBouchon = Standard_True;
|
||||
B.AddFace(TopoDS::Face(SF));
|
||||
}
|
||||
}
|
||||
|
||||
// Clock.Start();
|
||||
|
||||
if (!YaBouchon) B.MakeOffsetShape();
|
||||
else B.MakeThickSolid ();
|
||||
|
||||
const BRepOffset_Error aRetCode = B.Error();
|
||||
reportOffsetState(theCommands, aRetCode);
|
||||
// Clock.Show();
|
||||
|
||||
DBRep::Set(a[1],B.Shape());
|
||||
|
||||
@@ -1067,8 +1031,8 @@ Standard_Integer offsetperform(Draw_Interpretor& theCommands,
|
||||
}
|
||||
else
|
||||
{
|
||||
const BRepOffset_Error aRetCode = TheOffset.Error();
|
||||
reportOffsetState(theCommands, aRetCode);
|
||||
theCommands << "ERROR. offsetperform operation not done.";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@@ -144,7 +144,7 @@ public:
|
||||
//! Is node a leaf (outer)?
|
||||
Standard_Boolean IsOuter (const Standard_Integer theNodeIndex) const
|
||||
{
|
||||
return BVH::Array<Standard_Integer, 4>::Value (myNodeInfoBuffer, theNodeIndex).x() != 0;
|
||||
return BVH::Array<Standard_Integer, 4>::Value (myNodeInfoBuffer, theNodeIndex).x() > 0;
|
||||
}
|
||||
|
||||
//! Sets node type to 'outer'.
|
||||
|
@@ -262,7 +262,9 @@ bool D3DHost_Workspace::d3dSwap()
|
||||
// function : Redraw
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void D3DHost_Workspace::Redraw (const Graphic3d_CView& theCView)
|
||||
void D3DHost_Workspace::Redraw (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer)
|
||||
{
|
||||
if (!Activate()
|
||||
|| myD3dDevice == NULL)
|
||||
@@ -272,7 +274,7 @@ void D3DHost_Workspace::Redraw (const Graphic3d_CView& theCView)
|
||||
|
||||
myToFlipOutput = Standard_True;
|
||||
myD3dWglFbo->LockSurface (myGlContext);
|
||||
OpenGl_Workspace::Redraw (theCView);
|
||||
OpenGl_Workspace::Redraw (theCView, theCUnderLayer, theCOverLayer);
|
||||
myD3dWglFbo->UnlockSurface (myGlContext);
|
||||
myToFlipOutput = Standard_False;
|
||||
if (myGlContext->caps->buffersNoSwap)
|
||||
@@ -296,13 +298,15 @@ void D3DHost_Workspace::Redraw (const Graphic3d_CView& theCView)
|
||||
// function : RedrawImmediate
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void D3DHost_Workspace::RedrawImmediate (const Graphic3d_CView& theCView)
|
||||
void D3DHost_Workspace::RedrawImmediate (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer)
|
||||
{
|
||||
if (!myTransientDrawToFront
|
||||
|| !myBackBufferRestored
|
||||
|| (myGlContext->caps->buffersNoSwap && !myMainSceneFbos[0]->IsValid()))
|
||||
{
|
||||
Redraw (theCView);
|
||||
Redraw (theCView, theCUnderLayer, theCOverLayer);
|
||||
return;
|
||||
}
|
||||
else if (!Activate()
|
||||
@@ -313,7 +317,7 @@ void D3DHost_Workspace::RedrawImmediate (const Graphic3d_CView& theCView)
|
||||
|
||||
myToFlipOutput = Standard_True;
|
||||
myD3dWglFbo->LockSurface (myGlContext);
|
||||
OpenGl_Workspace::RedrawImmediate (theCView);
|
||||
OpenGl_Workspace::RedrawImmediate (theCView, theCUnderLayer, theCOverLayer);
|
||||
myD3dWglFbo->UnlockSurface (myGlContext);
|
||||
myToFlipOutput = Standard_False;
|
||||
if (myGlContext->caps->buffersNoSwap)
|
||||
|
@@ -41,10 +41,14 @@ public:
|
||||
Standard_EXPORT virtual void Resize (const CALL_DEF_WINDOW& theCWindow) Standard_OVERRIDE;
|
||||
|
||||
//! Redraw the all content.
|
||||
Standard_EXPORT virtual void Redraw (const Graphic3d_CView& theCView) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual void Redraw (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer) Standard_OVERRIDE;
|
||||
|
||||
//! Redraw only immediate layer.
|
||||
Standard_EXPORT virtual void RedrawImmediate (const Graphic3d_CView& theCView) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual void RedrawImmediate (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer) Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -4,4 +4,4 @@ set (TOOLKIT_MODULES
|
||||
DRAWEXE
|
||||
)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
include(${OCCT_SOURCE_DIR}/adm/cmake/occt_toolkit.cmake)
|
||||
|
@@ -120,7 +120,7 @@ void Extrema_GExtPC::Perform(const ThePoint& P)
|
||||
|
||||
Standard_Integer anIdx;
|
||||
|
||||
// Find first and last used knot.
|
||||
// Find first and last used knot
|
||||
Standard_Integer aFirstUsedKnot = aFirstIdx,
|
||||
aLastUsedKnot = aLastIdx;
|
||||
for(anIdx = aFirstIdx; anIdx <= aLastIdx; anIdx++)
|
||||
@@ -141,16 +141,6 @@ void Extrema_GExtPC::Perform(const ThePoint& P)
|
||||
break;
|
||||
}
|
||||
|
||||
if (aFirstUsedKnot == aLastUsedKnot)
|
||||
{
|
||||
// Degenerated case:
|
||||
// Some bounds lies out of curve param space.
|
||||
// In this case build one interval with [myuinf, myusup].
|
||||
// Parameters of these indexes will be redefined.
|
||||
aFirstUsedKnot = aFirstIdx;
|
||||
aLastUsedKnot = aFirstIdx + 1;
|
||||
}
|
||||
|
||||
mysample = (TheCurveTool::BSpline(aCurve))->Degree() + 1;
|
||||
|
||||
// Fill sample points.
|
||||
|
@@ -210,7 +210,7 @@ void Extrema_GenExtCC::Perform()
|
||||
anIntervals2.Upper() - anIntervals2.Lower())
|
||||
* Precision::PConfusion() / (2.0 * Sqrt(2.0));
|
||||
Extrema_CCPointsInspector anInspector(Precision::PConfusion());
|
||||
NCollection_CellFilter<Extrema_CCPointsInspector> aFilter(aCellSize);
|
||||
NCollection_CellFilter<Extrema_CCPointsInspector> aFilter(Extrema_CCPointsInspector::Dimension, aCellSize);
|
||||
NCollection_Vector<gp_XY> aPnts;
|
||||
|
||||
Standard_Integer i,j,k;
|
||||
|
@@ -4,4 +4,4 @@ set (TOOLKIT_MODULES
|
||||
FWOSDriver
|
||||
)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
include(${OCCT_SOURCE_DIR}/adm/cmake/occt_toolkit.cmake)
|
||||
|
@@ -1,7 +1,5 @@
|
||||
Font_BRepFont.cxx
|
||||
Font_BRepFont.hxx
|
||||
Font_BRepTextBuilder.cxx
|
||||
Font_BRepTextBuilder.hxx
|
||||
Font_FontAspect.hxx
|
||||
Font_FontMgr.cxx
|
||||
Font_FontMgr.hxx
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <BRepLib_MakeEdge.hxx>
|
||||
#include <Font_TextFormatter.hxx>
|
||||
#include <GCE2d_MakeSegment.hxx>
|
||||
#include <GC_MakeSegment.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
@@ -465,37 +464,56 @@ Standard_Boolean Font_BRepFont::renderGlyph (const Standard_Utf32Char theChar,
|
||||
return !theShape.IsNull();
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================
|
||||
// function : BoundingBox
|
||||
// function : RenderText
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Font_FTFont::Rect Font_BRepFont::BoundingBox (const NCollection_String& theString,
|
||||
const Graphic3d_HorizontalTextAlignment theHAlign,
|
||||
const Graphic3d_VerticalTextAlignment theVAlign)
|
||||
TopoDS_Shape Font_BRepFont::RenderText (const NCollection_String& theString)
|
||||
{
|
||||
Rect aBox;
|
||||
aBox.Left = 0.0f;
|
||||
aBox.Right = 0.0f;
|
||||
aBox.Bottom = 0.0f;
|
||||
aBox.Top = static_cast<float> (Ascender());
|
||||
if (theString.IsEmpty())
|
||||
{
|
||||
return TopoDS_Shape();
|
||||
}
|
||||
|
||||
// Initialize text formatter
|
||||
Font_TextFormatter aFormatter;
|
||||
aFormatter.Reset();
|
||||
aFormatter.SetupAlignment (theHAlign, theVAlign);
|
||||
aFormatter.Append (theString, *(reinterpret_cast<Font_FTFont*> (this)));
|
||||
aFormatter.Format();
|
||||
gp_Trsf aTrsf;
|
||||
gp_XYZ aPen;
|
||||
Standard_Integer aLine = 0;
|
||||
TopoDS_Shape aGlyphShape;
|
||||
TopoDS_Compound aResult;
|
||||
myBuilder.MakeCompound (aResult);
|
||||
Standard_Mutex::Sentry aSentry (myMutex);
|
||||
for (NCollection_Utf8Iter anIter = theString.Iterator(); *anIter != 0;)
|
||||
{
|
||||
const Standard_Utf32Char aCharCurr = *anIter;
|
||||
const Standard_Utf32Char aCharNext = *++anIter;
|
||||
if (aCharCurr == '\x0D' // CR (carriage return)
|
||||
|| aCharCurr == '\a' // BEL (alarm)
|
||||
|| aCharCurr == '\f' // FF (form feed) NP (new page)
|
||||
|| aCharCurr == '\b' // BS (backspace)
|
||||
|| aCharCurr == '\v') // VT (vertical tab)
|
||||
{
|
||||
continue; // skip unsupported carriage control codes
|
||||
}
|
||||
else if (aCharCurr == ' ' || aCharCurr == '\t')
|
||||
{
|
||||
aPen.SetX (aPen.X() + AdvanceX (aCharCurr, aCharNext));
|
||||
continue;
|
||||
}
|
||||
else if (aCharCurr == '\n')
|
||||
{
|
||||
++aLine;
|
||||
aPen.SetX (0.0);
|
||||
aPen.SetY (-Standard_Real(aLine) * LineSpacing());
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get bounding box
|
||||
aFormatter.BndBox (aBox);
|
||||
|
||||
// Apply BRepFont scale to box limits
|
||||
Standard_Real aScaleUnits = Scale();
|
||||
aBox.Left = aBox.Left * aScaleUnits;
|
||||
aBox.Top = aBox.Top * aScaleUnits;
|
||||
aBox.Right = aBox.Right * aScaleUnits;
|
||||
aBox.Bottom = aBox.Bottom * aScaleUnits;
|
||||
|
||||
return aBox;
|
||||
}
|
||||
if (renderGlyph (aCharCurr, aGlyphShape))
|
||||
{
|
||||
aTrsf.SetTranslation (gp_Vec (aPen));
|
||||
aGlyphShape.Move (aTrsf);
|
||||
myBuilder.Add (aResult, aGlyphShape);
|
||||
}
|
||||
aPen.SetX (aPen.X() + AdvanceX (aCharCurr, aCharNext));
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
|
@@ -18,7 +18,6 @@
|
||||
#include <Adaptor3d_CurveOnSurface.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <Font_FTFont.hxx>
|
||||
#include <Font_TextFormatter.hxx>
|
||||
#include <Geom2dAdaptor_HCurve.hxx>
|
||||
#include <Geom2dConvert_CompCurveToBSplineCurve.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
@@ -96,11 +95,26 @@ public:
|
||||
//! Notice that altering this flag clears currently accumulated cache!
|
||||
Standard_EXPORT void SetCompositeCurveMode (const Standard_Boolean theToConcatenate);
|
||||
|
||||
//! Compute bounding rectangle of resultant BRep text shape from input string
|
||||
//! @return bounding rectangle
|
||||
Standard_EXPORT Font_FTFont::Rect BoundingBox (const NCollection_String& theString,
|
||||
const Graphic3d_HorizontalTextAlignment theHAlign = Graphic3d_HTA_LEFT,
|
||||
const Graphic3d_VerticalTextAlignment theVAlign = Graphic3d_VTA_BOTTOM);
|
||||
public:
|
||||
|
||||
//! Render text as BRep shape.
|
||||
//! @param theString text in UTF-8 encoding
|
||||
//! @return result shape within XOY plane and start position (0,0,0) on the baseline
|
||||
Standard_EXPORT TopoDS_Shape RenderText (const NCollection_String& theString);
|
||||
|
||||
//! Render text as BRep shape.
|
||||
//! @param theString text in UTF-8 encoding
|
||||
//! @param thePenLoc start position and orientation on the baseline
|
||||
//! @return result shape with pen transformation applied as shape location
|
||||
TopoDS_Shape RenderText (const NCollection_String& theString,
|
||||
const gp_Ax3& thePenLoc)
|
||||
{
|
||||
TopoDS_Shape aResult = RenderText (theString);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTransformation (thePenLoc, gp_Ax3 (gp::XOY()));
|
||||
aResult.Move (aTrsf);
|
||||
return aResult;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -158,20 +172,6 @@ public:
|
||||
return myScaleUnits * Standard_Real(Font_FTFont::AdvanceY (theUChar, theUCharNext));
|
||||
}
|
||||
|
||||
//! Returns scaling factor for current font size.
|
||||
Standard_Real Scale() const
|
||||
{
|
||||
return myScaleUnits;
|
||||
}
|
||||
|
||||
//! Returns mutex.
|
||||
Standard_Mutex& Mutex()
|
||||
{
|
||||
return myMutex;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
//! Render single glyph as TopoDS_Shape. This method does not lock the mutex.
|
||||
@@ -205,7 +205,7 @@ protected: //! @name Protected fields
|
||||
Handle(Geom_Surface) mySurface; //!< surface to place glyphs on to
|
||||
Standard_Real myPrecision; //!< algorithm precision
|
||||
Standard_Real myScaleUnits; //!< scale font rendering units into model units
|
||||
Standard_Boolean myIsCompositeCurve; //!< flag to merge C1 curves of each contour into single C0 curve, OFF by default
|
||||
Standard_Boolean myIsCompositeCurve; //!< flag to merge C1 curves of each contour into single C0 curve, ON by default
|
||||
|
||||
protected: //! @name Shared temporary variables for glyph construction
|
||||
|
||||
|
@@ -1,89 +0,0 @@
|
||||
// Created on: 2015-08-10
|
||||
// Created by: Ilya SEVRIKOV
|
||||
// Copyright (c) 2013-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Font_BRepTextBuilder.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// Function : Perfrom
|
||||
// Purpose :
|
||||
// =======================================================================
|
||||
TopoDS_Shape Font_BRepTextBuilder::Perform (Font_BRepFont& theFont,
|
||||
const Font_TextFormatter& theFormatter,
|
||||
const gp_Ax3& thePenLoc)
|
||||
{
|
||||
gp_Trsf aTrsf;
|
||||
gp_XYZ aPen;
|
||||
TopoDS_Shape aGlyphShape;
|
||||
TopoDS_Compound aResult;
|
||||
Standard_Mutex::Sentry aSentry (theFont.Mutex());
|
||||
|
||||
myBuilder.MakeCompound (aResult);
|
||||
|
||||
Standard_Integer aSymbolCounter = 0;
|
||||
Standard_Real aScaleUnits = theFont.Scale();
|
||||
for (NCollection_Utf8Iter anIter = theFormatter.String().Iterator(); *anIter != 0; ++anIter)
|
||||
{
|
||||
const Standard_Utf32Char aCharCurr = *anIter;
|
||||
if (aCharCurr == '\x0D' // CR (carriage return)
|
||||
|| aCharCurr == '\a' // BEL (alarm)
|
||||
|| aCharCurr == '\f' // FF (form feed) NP (new page)
|
||||
|| aCharCurr == '\b' // BS (backspace)
|
||||
|| aCharCurr == '\v' // VT (vertical tab)
|
||||
|| aCharCurr == ' '
|
||||
|| aCharCurr == '\t'
|
||||
|| aCharCurr == '\n')
|
||||
{
|
||||
continue; // skip unsupported carriage control codes
|
||||
}
|
||||
|
||||
const NCollection_Vec2<Standard_ShortReal>& aCorner = theFormatter.TopLeft (aSymbolCounter);
|
||||
aPen.SetCoord (aCorner.x() * aScaleUnits, aCorner.y() * aScaleUnits, 0.0);
|
||||
aGlyphShape = theFont.RenderGlyph (aCharCurr);
|
||||
if (!aGlyphShape.IsNull())
|
||||
{
|
||||
aTrsf.SetTranslation (gp_Vec (aPen));
|
||||
aGlyphShape.Move (aTrsf);
|
||||
myBuilder.Add (aResult, aGlyphShape);
|
||||
}
|
||||
|
||||
++aSymbolCounter;
|
||||
}
|
||||
|
||||
aTrsf.SetTransformation (thePenLoc, gp_Ax3 (gp::XOY()));
|
||||
aResult.Move (aTrsf);
|
||||
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// Function : Perform
|
||||
// Purpose :
|
||||
// =======================================================================
|
||||
TopoDS_Shape Font_BRepTextBuilder::Perform (Font_BRepFont& theFont,
|
||||
const NCollection_String& theString,
|
||||
const gp_Ax3& thePenLoc,
|
||||
const Graphic3d_HorizontalTextAlignment theHAlign,
|
||||
const Graphic3d_VerticalTextAlignment theVAlign)
|
||||
{
|
||||
Font_TextFormatter aFormatter;
|
||||
|
||||
aFormatter.Reset();
|
||||
aFormatter.SetupAlignment (theHAlign, theVAlign);
|
||||
|
||||
aFormatter.Append (theString, *(reinterpret_cast<Font_FTFont*> (&theFont)));
|
||||
aFormatter.Format();
|
||||
|
||||
return Perform (theFont, aFormatter, thePenLoc);
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
// Created on: 2015-08-10
|
||||
// Created by: Ilya SEVRIKOV
|
||||
// Copyright (c) 2013-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef Font_BRepTextBuilder_Header
|
||||
#define Font_BRepTextBuilder_Header
|
||||
|
||||
#include <Font_BRepFont.hxx>
|
||||
#include <Font_TextFormatter.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
|
||||
//! Represents class for applying text formatting.
|
||||
class Font_BRepTextBuilder
|
||||
{
|
||||
public:
|
||||
//! Render text as BRep shape.
|
||||
//! @param theString text in UTF-8 encoding
|
||||
//! @param thePenLoc start position and orientation on the baseline
|
||||
//! @param theFormatter formatter which defines alignment for the text
|
||||
//! @return result shape with pen transformation applied as shape location
|
||||
Standard_EXPORT TopoDS_Shape Perform (Font_BRepFont& theFont,
|
||||
const Font_TextFormatter& theFormatter,
|
||||
const gp_Ax3& thePenLoc = gp_Ax3());
|
||||
//! Render text as BRep shape.
|
||||
//! @param theString text in UTF-8 encoding
|
||||
//! @param thePenLoc start position and orientation on the baseline
|
||||
//! @param theHAlign horizontal alignment of the text
|
||||
//! @param theVAlign vertical alignment of the text
|
||||
//! @return result shape with pen transformation applied as shape location
|
||||
Standard_EXPORT TopoDS_Shape Perform (Font_BRepFont& theFont,
|
||||
const NCollection_String& theString,
|
||||
const gp_Ax3& thePenLoc = gp_Ax3(),
|
||||
const Graphic3d_HorizontalTextAlignment theHAlign = Graphic3d_HTA_LEFT,
|
||||
const Graphic3d_VerticalTextAlignment theVAlign = Graphic3d_VTA_BOTTOM);
|
||||
|
||||
protected:
|
||||
BRep_Builder myBuilder;
|
||||
};
|
||||
|
||||
#endif // Font_BRepTextBuilder_Header
|
@@ -203,14 +203,9 @@ static Handle(Font_SystemFont) checkFont (const Handle(Font_FTLibrary)& theFTLib
|
||||
anAspect = Font_FA_Bold;
|
||||
}
|
||||
|
||||
Handle(Font_SystemFont) aResult;
|
||||
if (aFontFace->family_name != NULL // skip broken fonts (error in FreeType?)
|
||||
&& FT_Select_Charmap (aFontFace, ft_encoding_unicode) == 0) // Font_FTFont supports only UNICODE fonts
|
||||
{
|
||||
Handle(TCollection_HAsciiString) aFontName = new TCollection_HAsciiString (aFontFace->family_name);
|
||||
Handle(TCollection_HAsciiString) aFontPath = new TCollection_HAsciiString (theFontPath);
|
||||
aResult = new Font_SystemFont (aFontName, anAspect, aFontPath);
|
||||
}
|
||||
Handle(TCollection_HAsciiString) aFontName = new TCollection_HAsciiString (aFontFace->family_name);
|
||||
Handle(TCollection_HAsciiString) aFontPath = new TCollection_HAsciiString (theFontPath);
|
||||
Handle(Font_SystemFont) aResult = new Font_SystemFont (aFontName, anAspect, aFontPath);
|
||||
|
||||
FT_Done_Face (aFontFace);
|
||||
|
||||
|
@@ -298,18 +298,11 @@ void Font_TextFormatter::Format()
|
||||
if (myAlignY == Graphic3d_VTA_BOTTOM)
|
||||
{
|
||||
myBndTop = -myLineSpacing - myPenCurrLine;
|
||||
moveY (myCorners, myBndTop, 0, myRectsNb - 1);
|
||||
}
|
||||
else if (myAlignY == Graphic3d_VTA_CENTER)
|
||||
{
|
||||
myBndTop = 0.5f * (myLineSpacing * Standard_ShortReal(myLinesNb));
|
||||
}
|
||||
else if (myAlignY == Graphic3d_VTA_TOPFIRSTLINE)
|
||||
{
|
||||
myBndTop = myAscender;
|
||||
}
|
||||
|
||||
if (myAlignY != Graphic3d_VTA_TOP)
|
||||
{
|
||||
moveY (myCorners, myBndTop, 0, myRectsNb - 1);
|
||||
}
|
||||
}
|
||||
|
@@ -50,12 +50,11 @@ namespace
|
||||
// relative z-range tolerance compatible with for floating point.
|
||||
static Standard_Real zEpsilon (const Standard_Real theValue)
|
||||
{
|
||||
Standard_Real anAbsValue = Abs (theValue);
|
||||
if (anAbsValue <= (double)FLT_MIN)
|
||||
if (theValue == 0)
|
||||
{
|
||||
return FLT_MIN;
|
||||
return FLT_EPSILON;
|
||||
}
|
||||
Standard_Real aLogRadix = Log10 (anAbsValue) / Log10 (FLT_RADIX);
|
||||
Standard_Real aLogRadix = Log10 (Abs (theValue)) / Log10 (FLT_RADIX);
|
||||
Standard_Real aExp = Floor (aLogRadix);
|
||||
return FLT_EPSILON * Pow (FLT_RADIX, aExp);
|
||||
};
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include <Aspect_GradientFillMethod.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Aspect_FillMethod.hxx>
|
||||
#include <Aspect_CLayer2d.hxx>
|
||||
#include <Standard_Size.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
@@ -119,10 +120,10 @@ public:
|
||||
Standard_EXPORT virtual void RatioWindow (const Graphic3d_CView& ACView) = 0;
|
||||
|
||||
//! Redraw content of the view
|
||||
Standard_EXPORT virtual void Redraw (const Graphic3d_CView& theCView, const Standard_Integer theX = 0, const Standard_Integer theY = 0, const Standard_Integer theWidth = 0, const Standard_Integer theHeight = 0) = 0;
|
||||
Standard_EXPORT virtual void Redraw (const Graphic3d_CView& theCView, const Aspect_CLayer2d& theCUnderLayer, const Aspect_CLayer2d& theCOverLayer, const Standard_Integer theX = 0, const Standard_Integer theY = 0, const Standard_Integer theWidth = 0, const Standard_Integer theHeight = 0) = 0;
|
||||
|
||||
//! Redraw layer of immediate presentations
|
||||
Standard_EXPORT virtual void RedrawImmediate (const Graphic3d_CView& theCView) = 0;
|
||||
Standard_EXPORT virtual void RedrawImmediate (const Graphic3d_CView& theCView, const Aspect_CLayer2d& theCUnderLayer, const Aspect_CLayer2d& theCOverLayer) = 0;
|
||||
|
||||
//! Invalidates content of the view but does not redraw it
|
||||
Standard_EXPORT virtual void Invalidate (const Graphic3d_CView& theCView) = 0;
|
||||
@@ -194,6 +195,68 @@ public:
|
||||
//! @return previous mode.
|
||||
Standard_EXPORT virtual Standard_Boolean SetImmediateModeDrawToFront (const Graphic3d_CView& theCView, const Standard_Boolean theDrawToFrontBuffer) = 0;
|
||||
|
||||
//! call_togl_layer2d
|
||||
Standard_EXPORT virtual void Layer (Aspect_CLayer2d& ACLayer) = 0;
|
||||
|
||||
//! call_togl_removelayer2d
|
||||
Standard_EXPORT virtual void RemoveLayer (const Aspect_CLayer2d& ACLayer) = 0;
|
||||
|
||||
//! call_togl_begin_layer2d
|
||||
Standard_EXPORT virtual void BeginLayer (const Aspect_CLayer2d& ACLayer) = 0;
|
||||
|
||||
//! call_togl_begin_polygon2d
|
||||
Standard_EXPORT virtual void BeginPolygon2d() = 0;
|
||||
|
||||
//! call_togl_begin_polyline2d
|
||||
Standard_EXPORT virtual void BeginPolyline2d() = 0;
|
||||
|
||||
//! call_togl_clear_layer2d
|
||||
Standard_EXPORT virtual void ClearLayer (const Aspect_CLayer2d& ACLayer) = 0;
|
||||
|
||||
//! call_togl_draw2d
|
||||
Standard_EXPORT virtual void Draw (const Standard_ShortReal X, const Standard_ShortReal Y) = 0;
|
||||
|
||||
//! call_togl_edge2d
|
||||
Standard_EXPORT virtual void Edge (const Standard_ShortReal X, const Standard_ShortReal Y) = 0;
|
||||
|
||||
//! call_togl_end_layer2d
|
||||
Standard_EXPORT virtual void EndLayer() = 0;
|
||||
|
||||
//! call_togl_end_polygon2d
|
||||
Standard_EXPORT virtual void EndPolygon2d() = 0;
|
||||
|
||||
//! call_togl_end_polyline2d
|
||||
Standard_EXPORT virtual void EndPolyline2d() = 0;
|
||||
|
||||
//! call_togl_move2d
|
||||
Standard_EXPORT virtual void Move (const Standard_ShortReal X, const Standard_ShortReal Y) = 0;
|
||||
|
||||
//! call_togl_rectangle2d
|
||||
Standard_EXPORT virtual void Rectangle (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Width, const Standard_ShortReal Height) = 0;
|
||||
|
||||
//! call_togl_set_color
|
||||
Standard_EXPORT virtual void SetColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) = 0;
|
||||
|
||||
//! call_togl_set_transparency
|
||||
Standard_EXPORT virtual void SetTransparency (const Standard_ShortReal ATransparency) = 0;
|
||||
|
||||
//! call_togl_unset_transparency
|
||||
Standard_EXPORT virtual void UnsetTransparency() = 0;
|
||||
|
||||
//! call_togl_set_line_attributes
|
||||
Standard_EXPORT virtual void SetLineAttributes (const Standard_Integer Type, const Standard_ShortReal Width) = 0;
|
||||
|
||||
//! Set text attributes for under-/overlayer.
|
||||
//! <Font> argument defines the name of the font to be used,
|
||||
//! <Type> argument defines the display type of the text,
|
||||
//! <R> <G> <B> values define the color of decal or subtitle background.
|
||||
//! To set the color of the text you can use the SetColor method.
|
||||
Standard_EXPORT virtual void SetTextAttributes (const Standard_CString Font, const Standard_Integer Type, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) = 0;
|
||||
|
||||
//! call_togl_text2d
|
||||
//! If AHeight < 0 default text height is used by driver (DefaultTextHeight method)
|
||||
Standard_EXPORT virtual void Text (const Standard_CString AText, const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal AHeight) = 0;
|
||||
|
||||
Standard_EXPORT virtual Standard_ShortReal DefaultTextHeight() const = 0;
|
||||
|
||||
//! call_togl_textsize2d
|
||||
@@ -241,13 +304,13 @@ public:
|
||||
//! Returns Standard_True if the data is passed to the printer, otherwise
|
||||
//! Standard_False if the print operation failed due to the printer errors,
|
||||
//! or insufficient system memory available.
|
||||
Standard_EXPORT virtual Standard_Boolean Print (const Graphic3d_CView& ACView, const Aspect_Handle hPrnDC, const Standard_Boolean showBackground, const Standard_CString filename, const Aspect_PrintAlgo printAlgorithm = Aspect_PA_STRETCH, const Standard_Real theScaleFactor = 1.0) const = 0;
|
||||
Standard_EXPORT virtual Standard_Boolean Print (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Aspect_Handle hPrnDC, const Standard_Boolean showBackground, const Standard_CString filename, const Aspect_PrintAlgo printAlgorithm = Aspect_PA_STRETCH, const Standard_Real theScaleFactor = 1.0) const = 0;
|
||||
|
||||
|
||||
//! Export scene into the one of the Vector graphics formats (SVG, PS, PDF...).
|
||||
//! In contrast to Bitmaps, Vector graphics is scalable (so you may got quality benefits on printing to laser printer).
|
||||
//! Notice however that results may differ a lot and do not contain some elements.
|
||||
Standard_EXPORT virtual Standard_Boolean Export (const Standard_CString theFileName, const Graphic3d_ExportFormat theFormat, const Graphic3d_SortType theSortType, const Standard_Integer theWidth, const Standard_Integer theHeight, const Graphic3d_CView& theView, const Standard_Real thePrecision = 0.005, const Standard_Address theProgressBarFunc = NULL, const Standard_Address theProgressObject = NULL) = 0;
|
||||
Standard_EXPORT virtual Standard_Boolean Export (const Standard_CString theFileName, const Graphic3d_ExportFormat theFormat, const Graphic3d_SortType theSortType, const Standard_Integer theWidth, const Standard_Integer theHeight, const Graphic3d_CView& theView, const Aspect_CLayer2d& theLayerUnder, const Aspect_CLayer2d& theLayerOver, const Standard_Real thePrecision = 0.005, const Standard_Address theProgressBarFunc = NULL, const Standard_Address theProgressObject = NULL) = 0;
|
||||
|
||||
|
||||
//! Marks BVH tree and the set of BVH primitives of correspondent priority list with id theLayerId as outdated.
|
||||
|
@@ -21,10 +21,9 @@
|
||||
//! relative to its anchor.
|
||||
enum Graphic3d_VerticalTextAlignment
|
||||
{
|
||||
Graphic3d_VTA_BOTTOM, //!< The anchor lies on the last line of the text.
|
||||
Graphic3d_VTA_CENTER, //!< The anchor lies on the center of the text (not bounding box).
|
||||
Graphic3d_VTA_TOP, //!< The anchor lies on the line preceding to the first line of the text.
|
||||
Graphic3d_VTA_TOPFIRSTLINE //!< The anchor lies on the first line of the text.
|
||||
Graphic3d_VTA_BOTTOM,
|
||||
Graphic3d_VTA_CENTER,
|
||||
Graphic3d_VTA_TOP
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_VerticalTextAlignment_HeaderFile
|
||||
|
@@ -70,13 +70,13 @@ int igesread (char* nomfic, int lesect[6], int modefnes)
|
||||
for(;;) {
|
||||
numl ++;
|
||||
i = iges_lire(lefic,&numsec,ligne,modefnes);
|
||||
if (i <= 0 || i < i0) {
|
||||
if (i <= 0) {
|
||||
if (i == 0) break;
|
||||
/* Sending of message : Syntax error */
|
||||
{
|
||||
str[1] = '\0';
|
||||
str[0] = sects[i0];
|
||||
IGESFile_Check2 (0,"XSTEP_18",numl,str); /* //gka 15 Sep 98: str instead of sects[i0]); */
|
||||
str[1] = '\0';
|
||||
str[0] = sects[i0];
|
||||
IGESFile_Check2 (0,"XSTEP_18",numl,str); /* //gka 15 Sep 98: str instead of sects[i0]); */
|
||||
}
|
||||
|
||||
if (i0 == 0) return -1;
|
||||
@@ -98,21 +98,21 @@ int igesread (char* nomfic, int lesect[6], int modefnes)
|
||||
if (i == 2) { /* Header (Global sect) */
|
||||
iges_setglobal();
|
||||
for (;;) {
|
||||
if (lesect[i] == 1) { /* Separation specifique */
|
||||
int n0 = 0;
|
||||
if (ligne[0] != ',') { c_separ = ligne[2]; n0 = 3; }
|
||||
if (ligne[n0+1] != c_separ) { c_fin = ligne[n0+3]; }
|
||||
}
|
||||
iges_param(&Pstat,ligne,c_separ,c_fin,72);
|
||||
if (Pstat != 2) break;
|
||||
if (lesect[i] == 1) { /* Separation specifique */
|
||||
int n0 = 0;
|
||||
if (ligne[0] != ',') { c_separ = ligne[2]; n0 = 3; }
|
||||
if (ligne[n0+1] != c_separ) { c_fin = ligne[n0+3]; }
|
||||
}
|
||||
iges_param(&Pstat,ligne,c_separ,c_fin,72);
|
||||
if (Pstat != 2) break;
|
||||
}
|
||||
}
|
||||
if (i == 3) iges_Dsect(&Dstat,numsec,ligne); /* Directory (Dsect) */
|
||||
if (i == 4) { /* Parametres (Psect) */
|
||||
iges_Psect(numsec,ligne);
|
||||
for (;;) {
|
||||
iges_param(&Pstat,ligne,c_separ,c_fin,64);
|
||||
if (Pstat != 2) break;
|
||||
iges_param(&Pstat,ligne,c_separ,c_fin,64);
|
||||
if (Pstat != 2) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -67,7 +67,10 @@ int iges_lire (FILE* lefic, int *numsec, char ligne[100], int modefnes)
|
||||
while ( fgets ( ligne, 2, lefic ) && ( ligne[0] == '\r' || ligne[0] == '\n' ) )
|
||||
{
|
||||
}
|
||||
fgets(&ligne[1],80,lefic);
|
||||
|
||||
|
||||
fgets(&ligne[1],80,lefic);
|
||||
/* fgets(ligne,81,lefic); */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,66 +96,42 @@ int iges_lire (FILE* lefic, int *numsec, char ligne[100], int modefnes)
|
||||
iges_fautrelire = 0;
|
||||
if (ligne[0] == '\0' || ligne[0] == '\n' || ligne[0] == '\r')
|
||||
return iges_lire(lefic,numsec,ligne,modefnes); /* 0 */
|
||||
|
||||
if (!sscanf(&ligne[73],"%d",&result) == 0) {
|
||||
*numsec = result;
|
||||
if (sscanf(&ligne[73],"%d",&result) == 0)
|
||||
return -1;
|
||||
/* { printf("Erreur, ligne n0.%d :\n%s\n",*numl,ligne); return (*numsec > 0 ? -1 : -2); } */
|
||||
*numsec = result;
|
||||
typesec = ligne[72];
|
||||
switch (typesec) {
|
||||
case 'S' : ligne[72] = '\0'; return (1);
|
||||
case 'G' : ligne[72] = '\0'; return (2);
|
||||
case 'D' : ligne[72] = '\0'; return (3);
|
||||
case 'P' : ligne[72] = '\0'; return (4);
|
||||
case 'T' : ligne[72] = '\0'; return (5);
|
||||
default :; /* printf("Ligne incorrecte, ignoree n0.%d :\n%s\n",*numl,ligne); */
|
||||
}
|
||||
/* the column 72 is empty, try to check the neghbour*/
|
||||
if(strlen(ligne)==80
|
||||
&& (ligne[79]=='\n' || ligne[79]=='\r') && (ligne[0]<='9' && ligne[0]>='0')) {
|
||||
/*check if the case of losted .*/
|
||||
int index;
|
||||
for(index = 1; ligne[index]<='9' && ligne[index]>='0'; index++);
|
||||
if (ligne[index]=='D' || ligne[index]=='d') {
|
||||
for(index = 79; index > 0; index--)
|
||||
ligne[index] = ligne[index-1];
|
||||
ligne[0]='.';
|
||||
}
|
||||
|
||||
typesec = ligne[72];
|
||||
switch (typesec) {
|
||||
case 'S' : ligne[72] = '\0'; return (1);
|
||||
case 'G' : ligne[72] = '\0'; return (2);
|
||||
case 'D' : ligne[72] = '\0'; return (3);
|
||||
case 'P' : ligne[72] = '\0'; return (4);
|
||||
case 'T' : ligne[72] = '\0'; return (5);
|
||||
default :;
|
||||
}
|
||||
/* the column 72 is empty, try to check the neighbour*/
|
||||
if(strlen(ligne)==80
|
||||
&& (ligne[79]=='\n' || ligne[79]=='\r') && (ligne[0]<='9' && ligne[0]>='0')) {
|
||||
/*check if the case of losted .*/
|
||||
int index;
|
||||
for(index = 1; ligne[index]<='9' && ligne[index]>='0'; index++);
|
||||
if (ligne[index]=='D' || ligne[index]=='d') {
|
||||
for(index = 79; index > 0; index--)
|
||||
ligne[index] = ligne[index-1];
|
||||
ligne[0]='.';
|
||||
}
|
||||
typesec = ligne[72];
|
||||
switch (typesec) {
|
||||
case 'S' : ligne[72] = '\0'; return (1);
|
||||
case 'G' : ligne[72] = '\0'; return (2);
|
||||
case 'D' : ligne[72] = '\0'; return (3);
|
||||
case 'P' : ligne[72] = '\0'; return (4);
|
||||
case 'T' : ligne[72] = '\0'; return (5);
|
||||
default :;
|
||||
}
|
||||
case 'S' : ligne[72] = '\0'; return (1);
|
||||
case 'G' : ligne[72] = '\0'; return (2);
|
||||
case 'D' : ligne[72] = '\0'; return (3);
|
||||
case 'P' : ligne[72] = '\0'; return (4);
|
||||
case 'T' : ligne[72] = '\0'; return (5);
|
||||
default :; /* printf("Ligne incorrecte, ignoree n0.%d :\n%s\n",*numl,ligne); */
|
||||
}
|
||||
}
|
||||
|
||||
// the line is not conform to standard, try to read it (if there are some missing spaces)
|
||||
// find the number end
|
||||
i = (int)strlen(ligne);
|
||||
while ((ligne[i] == '\0' || ligne[i] == '\n' || ligne[i] == '\r' || ligne[i] == ' ') && i > 0)
|
||||
i--;
|
||||
if (i != (int)strlen(ligne))
|
||||
ligne[i + 1] = '\0';
|
||||
// find the number start
|
||||
while (ligne[i] >= '0' && ligne[i] <= '9' && i > 0)
|
||||
i--;
|
||||
if (sscanf(&ligne[i + 1],"%d",&result) == 0)
|
||||
return -1;
|
||||
*numsec = result;
|
||||
// find type of line
|
||||
while (ligne[i] == ' ' && i > 0)
|
||||
i--;
|
||||
typesec = ligne[i];
|
||||
switch (typesec) {
|
||||
case 'S' : ligne[i] = '\0'; return (1);
|
||||
case 'G' : ligne[i] = '\0'; return (2);
|
||||
case 'D' : ligne[i] = '\0'; return (3);
|
||||
case 'P' : ligne[i] = '\0'; return (4);
|
||||
case 'T' : ligne[i] = '\0'; return (5);
|
||||
default :; /* printf("Ligne incorrecte, ignoree n0.%d :\n%s\n",*numl,ligne); */
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include <BRepFill.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <BRepLib_MakeFace.hxx>
|
||||
#include <BRepOffset_MakeOffset.hxx>
|
||||
#include <BRepPrimAPI_MakePrism.hxx>
|
||||
#include <BRepPrimAPI_MakeRevol.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
|
@@ -89,7 +89,7 @@ void IntPolyh_Intersection::Perform() {
|
||||
isAdvDone = PerformAdv(aPMaillageFF,aPMaillageFR,aPMaillageRF,aPMaillageRR,nbCouplesAdv);
|
||||
|
||||
// advanced interference found
|
||||
if(isAdvDone && nbCouplesAdv > 0) {
|
||||
if(isAdvDone && nbCouplesAdv > 10) {
|
||||
aPMaillageFF->StartPointsChain(TSectionLines,TTangentZones);
|
||||
aPMaillageFR->StartPointsChain(TSectionLines,TTangentZones);
|
||||
aPMaillageRF->StartPointsChain(TSectionLines,TTangentZones);
|
||||
|
@@ -87,7 +87,7 @@ void IntPolyh_Intersection::Perform(const TColStd_Array1OfReal& Upars1,
|
||||
aPMaillageRR,nbCouplesAdv);
|
||||
|
||||
// advanced interference found
|
||||
if(isAdvDone && nbCouplesAdv > 0) {
|
||||
if(isAdvDone && nbCouplesAdv > 10) {
|
||||
aPMaillageFF->StartPointsChain(TSectionLines,TTangentZones);
|
||||
aPMaillageFR->StartPointsChain(TSectionLines,TTangentZones);
|
||||
aPMaillageRF->StartPointsChain(TSectionLines,TTangentZones);
|
||||
@@ -171,7 +171,7 @@ Standard_Boolean IntPolyh_Intersection::PerformMaillage(const Standard_Boolean i
|
||||
(FinTTC >= theMaillageS->GetArrayOfTriangles(1).NbTriangles() ||
|
||||
FinTTC >= theMaillageS->GetArrayOfTriangles(2).NbTriangles()) ) {
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
*/
|
||||
//IFV test for parallel surf
|
||||
if(FinTTC > 200) {
|
||||
@@ -250,7 +250,7 @@ Standard_Boolean IntPolyh_Intersection::PerformMaillage(const TColStd_Array1OfRe
|
||||
(FinTTC >= theMaillageS->GetArrayOfTriangles(1).NbTriangles() ||
|
||||
FinTTC >= theMaillageS->GetArrayOfTriangles(2).NbTriangles()) ) {
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
*/
|
||||
//IFV test for parallel surf
|
||||
if(FinTTC > 200) {
|
||||
|
@@ -129,7 +129,6 @@ public:
|
||||
//! By default cell size is 0, which is invalid; thus if default
|
||||
//! constructor is used, the tool must be initialized later with
|
||||
//! appropriate cell size by call to Reset()
|
||||
//! Constructor when dimension count is unknown at compilation time.
|
||||
NCollection_CellFilter (const Standard_Integer theDim,
|
||||
const Standard_Real theCellSize = 0,
|
||||
const Handle(NCollection_IncAllocator)& theAlloc = 0)
|
||||
@@ -139,15 +138,6 @@ public:
|
||||
Reset (theCellSize, theAlloc);
|
||||
}
|
||||
|
||||
//! Constructor when dimenstion count is known at compilation time.
|
||||
NCollection_CellFilter (const Standard_Real theCellSize = 0,
|
||||
const Handle(NCollection_IncAllocator)& theAlloc = 0)
|
||||
: myCellSize(0, Inspector::Dimension - 1)
|
||||
{
|
||||
myDim = Inspector::Dimension;
|
||||
Reset (theCellSize, theAlloc);
|
||||
}
|
||||
|
||||
//! Clear the data structures, set new cell size and allocator
|
||||
void Reset (Standard_Real theCellSize,
|
||||
const Handle(NCollection_IncAllocator)& theAlloc=0)
|
||||
|
@@ -117,6 +117,7 @@ OpenGl_GraphicDriver_4.cxx
|
||||
OpenGl_GraphicDriver_7.cxx
|
||||
OpenGl_GraphicDriver_713.cxx
|
||||
OpenGl_GraphicDriver_Export.cxx
|
||||
OpenGl_GraphicDriver_Layer.cxx
|
||||
OpenGl_IndexBuffer.cxx
|
||||
OpenGl_IndexBuffer.hxx
|
||||
OpenGl_Layer.cxx
|
||||
|
@@ -61,7 +61,8 @@ OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnectio
|
||||
myMapOfView (1, NCollection_BaseAllocator::CommonBaseAllocator()),
|
||||
myMapOfWS (1, NCollection_BaseAllocator::CommonBaseAllocator()),
|
||||
myMapOfStructure (1, NCollection_BaseAllocator::CommonBaseAllocator()),
|
||||
myUserDrawCallback (NULL)
|
||||
myUserDrawCallback (NULL),
|
||||
myTempText (new OpenGl_Text())
|
||||
{
|
||||
#if !defined(_WIN32) && !defined(__ANDROID__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||
if (myDisplayConnection.IsNull())
|
||||
@@ -136,6 +137,7 @@ void OpenGl_GraphicDriver::ReleaseContext()
|
||||
OpenGl_Structure* aStruct = aStructIt.ChangeValue();
|
||||
aStruct->ReleaseGlResources (aCtxShared);
|
||||
}
|
||||
myTempText->Release (aCtxShared.operator->());
|
||||
myDeviceLostFlag = myDeviceLostFlag || !myMapOfStructure.IsEmpty();
|
||||
|
||||
for (NCollection_Map<Handle(OpenGl_Workspace)>::Iterator aWindowIter (myMapOfWS);
|
||||
@@ -416,6 +418,8 @@ Standard_Boolean OpenGl_GraphicDriver::SetImmediateModeDrawToFront (const Graphi
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_GraphicDriver::Print (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer,
|
||||
const Aspect_Handle thePrintDC,
|
||||
const Standard_Boolean theToShowBackground,
|
||||
const Standard_CString theFilename,
|
||||
@@ -434,6 +438,8 @@ Standard_Boolean OpenGl_GraphicDriver::Print (const Graphic3d_CView& theCView,
|
||||
#ifdef _WIN32
|
||||
isPrinted = aCView->WS->Print (myPrintContext,
|
||||
theCView,
|
||||
theCUnderLayer,
|
||||
theCOverLayer,
|
||||
thePrintDC,
|
||||
theToShowBackground,
|
||||
theFilename,
|
||||
@@ -620,44 +626,3 @@ void OpenGl_GraphicDriver::SetBuffersNoSwap (const Standard_Boolean theIsNoSwap)
|
||||
{
|
||||
myCaps->buffersNoSwap = theIsNoSwap;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : TextSize
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_GraphicDriver::TextSize (const Standard_CString theText,
|
||||
const Standard_ShortReal theHeight,
|
||||
Standard_ShortReal& theWidth,
|
||||
Standard_ShortReal& theAscent,
|
||||
Standard_ShortReal& theDescent) const
|
||||
{
|
||||
const Handle(OpenGl_Context)& aCtx = GetSharedContext();
|
||||
if (aCtx.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_ShortReal aHeight = (theHeight < 2.0f) ? DefaultTextHeight() : theHeight;
|
||||
OpenGl_TextParam aTextParam;
|
||||
aTextParam.Height = (int )aHeight;
|
||||
OpenGl_AspectText aTextAspect;
|
||||
CALL_DEF_CONTEXTTEXT aDefaultContextText =
|
||||
{
|
||||
1, //IsDef
|
||||
1, //IsSet
|
||||
"Courier", //Font
|
||||
0.3F, //Space
|
||||
1.F, //Expan
|
||||
{ 1.F, 1.F, 1.F }, //Color
|
||||
(int)Aspect_TOST_NORMAL, //Style
|
||||
(int)Aspect_TODT_NORMAL, //DisplayType
|
||||
{ 1.F, 1.F, 1.F }, //ColorSubTitle
|
||||
0, //TextZoomable
|
||||
0.F, //TextAngle
|
||||
(int)Font_FA_Regular //TextFontAspect
|
||||
};
|
||||
aTextAspect.SetAspect(aDefaultContextText);
|
||||
TCollection_ExtendedString anExtText = theText;
|
||||
NCollection_String aText = (Standard_Utf16Char* )anExtText.ToExtString();
|
||||
OpenGl_Text::StringSize (aCtx, aText, aTextAspect, aTextParam, theWidth, theAscent, theDescent);
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Aspect_GradientFillMethod.hxx>
|
||||
#include <Aspect_FillMethod.hxx>
|
||||
#include <Aspect_CLayer2d.hxx>
|
||||
#include <Aspect_TypeOfTriedronPosition.hxx>
|
||||
#include <Aspect_TypeOfTriedronEcho.hxx>
|
||||
#include <Aspect_Handle.hxx>
|
||||
@@ -145,11 +146,15 @@ public:
|
||||
Standard_EXPORT void DepthCueing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
|
||||
Standard_EXPORT void RatioWindow (const Graphic3d_CView& ACView);
|
||||
Standard_EXPORT void Redraw (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer,
|
||||
const Standard_Integer theX = 0,
|
||||
const Standard_Integer theY = 0,
|
||||
const Standard_Integer theWidth = 0,
|
||||
const Standard_Integer theHeight = 0);
|
||||
Standard_EXPORT void RedrawImmediate (const Graphic3d_CView& theCView);
|
||||
Standard_EXPORT void RedrawImmediate (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer);
|
||||
Standard_EXPORT void Invalidate (const Graphic3d_CView& theCView);
|
||||
Standard_EXPORT Standard_Boolean IsInvalidated (const Graphic3d_CView& theCView) const;
|
||||
Standard_EXPORT void RemoveView (const Graphic3d_CView& ACView);
|
||||
@@ -191,6 +196,35 @@ public:
|
||||
Standard_EXPORT void GraduatedTrihedronMinMaxValues (const Graphic3d_CView& theView,
|
||||
const Graphic3d_Vec3 theMin, const Graphic3d_Vec3 theMax);
|
||||
|
||||
Standard_EXPORT void Layer (Aspect_CLayer2d& ACLayer);
|
||||
Standard_EXPORT void RemoveLayer (const Aspect_CLayer2d& ACLayer);
|
||||
Standard_EXPORT void BeginLayer (const Aspect_CLayer2d& ACLayer);
|
||||
Standard_EXPORT void BeginPolygon2d ();
|
||||
Standard_EXPORT void BeginPolyline2d ();
|
||||
Standard_EXPORT void ClearLayer (const Aspect_CLayer2d& ACLayer);
|
||||
Standard_EXPORT void Draw (const Standard_ShortReal X,const Standard_ShortReal Y);
|
||||
Standard_EXPORT void Edge (const Standard_ShortReal X,const Standard_ShortReal Y);
|
||||
Standard_EXPORT void EndLayer ();
|
||||
Standard_EXPORT void EndPolygon2d ();
|
||||
Standard_EXPORT void EndPolyline2d ();
|
||||
Standard_EXPORT void Move (const Standard_ShortReal X,const Standard_ShortReal Y);
|
||||
Standard_EXPORT void Rectangle (const Standard_ShortReal X,const Standard_ShortReal Y,const Standard_ShortReal Width,const Standard_ShortReal Height);
|
||||
Standard_EXPORT void SetColor (const Standard_ShortReal R,const Standard_ShortReal G,const Standard_ShortReal B);
|
||||
Standard_EXPORT void SetTransparency (const Standard_ShortReal ATransparency);
|
||||
Standard_EXPORT void UnsetTransparency ();
|
||||
Standard_EXPORT void SetLineAttributes (const Standard_Integer Type,const Standard_ShortReal Width);
|
||||
|
||||
//! Set text attributes for under-/overlayer.
|
||||
//! @param theFontName the name of the font to be used
|
||||
//! @param theType the display type of the text
|
||||
//! theR theG theB values define the color of decal or subtitle background
|
||||
//! To set the color of the text you can use the SetColor method.
|
||||
Standard_EXPORT void SetTextAttributes (const Standard_CString theFontName,
|
||||
const Standard_Integer theType,
|
||||
const Standard_ShortReal theR,
|
||||
const Standard_ShortReal theG,
|
||||
const Standard_ShortReal theB);
|
||||
Standard_EXPORT void Text (const Standard_CString AText,const Standard_ShortReal X,const Standard_ShortReal Y,const Standard_ShortReal AHeight);
|
||||
Standard_EXPORT void TextSize (const Standard_CString AText,const Standard_ShortReal AHeight,Standard_ShortReal& AWidth,Standard_ShortReal& AnAscent,Standard_ShortReal& ADescent) const;
|
||||
Standard_EXPORT void SetBackFacingModel (const Graphic3d_CView& aView);
|
||||
|
||||
@@ -205,6 +239,8 @@ public:
|
||||
//! All this errors are indicated by the message boxes (on level of OpenGl_GraphicDriver).
|
||||
//! Warning: This function can reuse FBO assigned to the view, please take it into account if you use it for your purposes.
|
||||
Standard_EXPORT Standard_Boolean Print (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer,
|
||||
const Aspect_Handle thePrinterDC,
|
||||
const Standard_Boolean theToShowBackground,
|
||||
const Standard_CString theFileName,
|
||||
@@ -238,7 +274,7 @@ public:
|
||||
|
||||
Standard_EXPORT void FBOChangeViewport(const Graphic3d_CView& view,Graphic3d_PtrFrameBuffer& fboPtr,const Standard_Integer width,const Standard_Integer height);
|
||||
|
||||
Standard_EXPORT Standard_Boolean Export(const Standard_CString theFileName,const Graphic3d_ExportFormat theFormat,const Graphic3d_SortType theSortType,const Standard_Integer theWidth,const Standard_Integer theHeight,const Graphic3d_CView& theView,const Standard_Real thePrecision = 0.005,const Standard_Address theProgressBarFunc = NULL,const Standard_Address theProgressObject = NULL);
|
||||
Standard_EXPORT Standard_Boolean Export(const Standard_CString theFileName,const Graphic3d_ExportFormat theFormat,const Graphic3d_SortType theSortType,const Standard_Integer theWidth,const Standard_Integer theHeight,const Graphic3d_CView& theView,const Aspect_CLayer2d& theLayerUnder,const Aspect_CLayer2d& theLayerOver,const Standard_Real thePrecision = 0.005,const Standard_Address theProgressBarFunc = NULL,const Standard_Address theProgressObject = NULL);
|
||||
|
||||
//! Add a new top-level z layer with ID theLayerId for the view. Z layers allow drawing structures in higher layers in foreground of structures in lower layers.
|
||||
//! To add a structure to desired layer on display it is necessary to set the layer index for the structure.
|
||||
@@ -340,6 +376,7 @@ protected:
|
||||
NCollection_DataMap<Standard_Integer, OpenGl_Structure*> myMapOfStructure;
|
||||
mutable Handle(OpenGl_PrinterContext) myPrintContext;
|
||||
OpenGl_UserDrawCallback_t myUserDrawCallback;
|
||||
OpenGl_Text* myTempText; //!< variable for compatibility (drawing text in layers)
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -96,6 +96,8 @@ void OpenGl_GraphicDriver::RatioWindow (const Graphic3d_CView& theCView)
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::Redraw (const Graphic3d_CView& ACView,
|
||||
const Aspect_CLayer2d& ACUnderLayer,
|
||||
const Aspect_CLayer2d& ACOverLayer,
|
||||
const Standard_Integer /*x*/,
|
||||
const Standard_Integer /*y*/,
|
||||
const Standard_Integer /*width*/,
|
||||
@@ -121,16 +123,18 @@ void OpenGl_GraphicDriver::Redraw (const Graphic3d_CView& ACView,
|
||||
else
|
||||
aCView->WS->RedrawArea(ACView, ACUnderLayer, ACOverLayer, x, y, width, height);*/
|
||||
// Always do full redraw
|
||||
aCView->WS->Redraw(ACView);
|
||||
aCView->WS->Redraw(ACView, ACUnderLayer, ACOverLayer);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::RedrawImmediate (const Graphic3d_CView& theCView)
|
||||
void OpenGl_GraphicDriver::RedrawImmediate (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer)
|
||||
{
|
||||
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
|
||||
if (aCView != NULL)
|
||||
{
|
||||
aCView->WS->RedrawImmediate (theCView);
|
||||
aCView->WS->RedrawImmediate (theCView, theCUnderLayer, theCOverLayer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,6 +464,7 @@ void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& theCView)
|
||||
OpenGl_Structure* aStruct = aStructIt.ChangeValue();
|
||||
aStruct->ReleaseGlResources (aCtx);
|
||||
}
|
||||
myTempText->Release (aCtx.operator->());
|
||||
myDeviceLostFlag = !myMapOfStructure.IsEmpty();
|
||||
}
|
||||
|
||||
|
@@ -32,6 +32,8 @@ Standard_Boolean OpenGl_GraphicDriver::Export (const Standard_CString theFileNam
|
||||
const Standard_Integer theWidth,
|
||||
const Standard_Integer theHeight,
|
||||
const Graphic3d_CView& theView,
|
||||
const Aspect_CLayer2d& theLayerUnder,
|
||||
const Aspect_CLayer2d& theLayerOver,
|
||||
const Standard_Real /*thePrecision*/,
|
||||
const Standard_Address /*theProgressBarFunc*/,
|
||||
const Standard_Address /*theProgressObject*/)
|
||||
@@ -112,7 +114,7 @@ Standard_Boolean OpenGl_GraphicDriver::Export (const Standard_CString theFileNam
|
||||
fclose (aFileH);
|
||||
break;
|
||||
}
|
||||
Redraw (theView);
|
||||
Redraw (theView, theLayerUnder, theLayerOver);
|
||||
|
||||
anErrCode = gl2psEndPage();
|
||||
if (aFileH != NULL)
|
||||
@@ -132,6 +134,8 @@ Standard_Boolean OpenGl_GraphicDriver::Export (const Standard_CString /*theFileN
|
||||
const Standard_Integer /*theWidth*/,
|
||||
const Standard_Integer /*theHeight*/,
|
||||
const Graphic3d_CView& /*theView*/,
|
||||
const Aspect_CLayer2d& /*theLayerUnder*/,
|
||||
const Aspect_CLayer2d& /*theLayerOver*/,
|
||||
const Standard_Real /*thePrecision*/,
|
||||
const Standard_Address /*theProgressBarFunc*/,
|
||||
const Standard_Address /*theProgressObject*/)
|
||||
|
343
src/OpenGl/OpenGl_GraphicDriver_Layer.cxx
Normal file
343
src/OpenGl/OpenGl_GraphicDriver_Layer.cxx
Normal file
@@ -0,0 +1,343 @@
|
||||
// Created on: 2011-10-20
|
||||
// Created by: Sergey ZERCHANINOV
|
||||
// Copyright (c) 2011-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <OpenGl_GlCore11.hxx>
|
||||
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
|
||||
#include <Font_FontAspect.hxx>
|
||||
|
||||
#include <OpenGl_AspectText.hxx>
|
||||
#include <OpenGl_Text.hxx>
|
||||
#include <OpenGl_TextParam.hxx>
|
||||
#include <OpenGl_LineAttributes.hxx>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
struct OpenGl_LAYER_PROP
|
||||
{
|
||||
int ListId;
|
||||
|
||||
TEL_COLOUR Color;
|
||||
int NbPoints;
|
||||
int LineType;
|
||||
float LineWidth;
|
||||
OpenGl_AspectText AspectText;
|
||||
OpenGl_TextParam TextParam;
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
namespace
|
||||
{
|
||||
static const TEL_COLOUR myDefaultColor = {{ 1.F, 1.F, 1.F, 1.F }};
|
||||
static const CALL_DEF_CONTEXTTEXT myDefaultContextText =
|
||||
{
|
||||
1, //IsDef
|
||||
1, //IsSet
|
||||
"Courier", //Font
|
||||
0.3F, //Space
|
||||
1.F, //Expan
|
||||
{ 1.F, 1.F, 1.F }, //Color
|
||||
(int)Aspect_TOST_NORMAL, //Style
|
||||
(int)Aspect_TODT_NORMAL, //DisplayType
|
||||
{ 1.F, 1.F, 1.F }, //ColorSubTitle
|
||||
0, //TextZoomable
|
||||
0.F, //TextAngle
|
||||
(int)Font_FA_Regular //TextFontAspect
|
||||
};
|
||||
|
||||
static Standard_Boolean TheLayerIsOpen = Standard_False;
|
||||
static OpenGl_LAYER_PROP TheLayerProp;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void InitLayerProp (const int theListId)
|
||||
{
|
||||
TheLayerProp.ListId = theListId;
|
||||
|
||||
if (theListId)
|
||||
{
|
||||
TheLayerProp.Color = myDefaultColor;
|
||||
TheLayerProp.NbPoints = 0;
|
||||
TheLayerProp.LineType = -1;
|
||||
TheLayerProp.LineWidth = -1.F;
|
||||
|
||||
TheLayerProp.AspectText.SetAspect (myDefaultContextText);
|
||||
|
||||
TheLayerProp.TextParam.HAlign = Graphic3d_HTA_LEFT;
|
||||
TheLayerProp.TextParam.VAlign = Graphic3d_VTA_BOTTOM;
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void OpenGl_GraphicDriver::Layer (Aspect_CLayer2d& ACLayer)
|
||||
{
|
||||
ACLayer.ptrLayer = new CALL_DEF_PTRLAYER();
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
ACLayer.ptrLayer->listIndex = glGenLists(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void OpenGl_GraphicDriver::RemoveLayer (const Aspect_CLayer2d& ACLayer)
|
||||
{
|
||||
if (!ACLayer.ptrLayer) return;
|
||||
if (!ACLayer.ptrLayer->listIndex) return;
|
||||
if (TheLayerProp.ListId == ACLayer.ptrLayer->listIndex)
|
||||
EndLayer();
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glDeleteLists (ACLayer.ptrLayer->listIndex, 1);
|
||||
#endif
|
||||
ACLayer.ptrLayer->listIndex = 0;
|
||||
//szvgl: memory leak here?
|
||||
//free ( ACLayer.ptrLayer );
|
||||
//ACLayer.ptrLayer = NULL;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void OpenGl_GraphicDriver::BeginLayer (const Aspect_CLayer2d& ACLayer)
|
||||
{
|
||||
call_def_ptrLayer ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer;
|
||||
if (!ptrLayer) return;
|
||||
|
||||
InitLayerProp (ptrLayer->listIndex);
|
||||
if (!TheLayerProp.ListId) return;
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glNewList (TheLayerProp.ListId, GL_COMPILE);
|
||||
#endif
|
||||
TheLayerIsOpen = Standard_True;
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::BeginPolygon2d ()
|
||||
{
|
||||
if (!TheLayerProp.ListId) return;
|
||||
TheLayerProp.NbPoints = 0;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glBegin (GL_POLYGON);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::BeginPolyline2d ()
|
||||
{
|
||||
if (!TheLayerProp.ListId) return;
|
||||
TheLayerProp.NbPoints = 0;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glBegin (GL_LINE_STRIP);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::ClearLayer (const Aspect_CLayer2d& ACLayer)
|
||||
{
|
||||
if (!ACLayer.ptrLayer) return;
|
||||
|
||||
InitLayerProp (ACLayer.ptrLayer->listIndex);
|
||||
if (!TheLayerProp.ListId) return;
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glNewList (TheLayerProp.ListId, GL_COMPILE);
|
||||
glEndList ();
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::Draw (const Standard_ShortReal X, const Standard_ShortReal Y)
|
||||
{
|
||||
if (!TheLayerProp.ListId) return;
|
||||
TheLayerProp.NbPoints++;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glVertex3f (X, Y, 0.F);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::Edge (const Standard_ShortReal X, const Standard_ShortReal Y)
|
||||
{
|
||||
if (!TheLayerProp.ListId) return;
|
||||
TheLayerProp.NbPoints++;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glVertex3f (X, Y, 0.F);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::EndLayer ()
|
||||
{
|
||||
if (!TheLayerProp.ListId) return;
|
||||
if (TheLayerIsOpen)
|
||||
{
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glEndList();
|
||||
#endif
|
||||
TheLayerIsOpen = Standard_False;
|
||||
}
|
||||
TheLayerProp.ListId = 0;
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::EndPolygon2d ()
|
||||
{
|
||||
if (!TheLayerProp.ListId) return;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glEnd ();
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::EndPolyline2d ()
|
||||
{
|
||||
if (!TheLayerProp.ListId) return;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glEnd ();
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::Move (const Standard_ShortReal X, const Standard_ShortReal Y)
|
||||
{
|
||||
if (!TheLayerProp.ListId) return;
|
||||
if (TheLayerProp.NbPoints)
|
||||
{
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glEnd ();
|
||||
glBegin (GL_LINE_STRIP);
|
||||
#endif
|
||||
TheLayerProp.NbPoints = 0;
|
||||
}
|
||||
TheLayerProp.NbPoints++;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glVertex3f (X, Y, 0.F);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::Rectangle (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Width, const Standard_ShortReal Height)
|
||||
{
|
||||
if (!TheLayerProp.ListId) return;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glRectf (X, Y, X + Width, Y + Height);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::SetColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B)
|
||||
{
|
||||
if (!TheLayerProp.ListId) return;
|
||||
TheLayerProp.Color.rgb[0] = R;
|
||||
TheLayerProp.Color.rgb[1] = G;
|
||||
TheLayerProp.Color.rgb[2] = B;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glColor3fv (TheLayerProp.Color.rgb);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::SetTransparency (const Standard_ShortReal ATransparency)
|
||||
{
|
||||
if (!TheLayerProp.ListId) return;
|
||||
TheLayerProp.Color.rgb[3] = ATransparency;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glEnable (GL_BLEND);
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor4fv (TheLayerProp.Color.rgb);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::UnsetTransparency ()
|
||||
{
|
||||
if (!TheLayerProp.ListId) return;
|
||||
TheLayerProp.Color.rgb[3] = 1.F;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
glDisable (GL_BLEND);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::SetLineAttributes (const Standard_Integer theType,
|
||||
const Standard_ShortReal theWidth)
|
||||
{
|
||||
const Handle(OpenGl_Context)& aCtx = GetSharedContext();
|
||||
if (!TheLayerProp.ListId
|
||||
|| aCtx.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (TheLayerProp.LineType != theType)
|
||||
{
|
||||
TheLayerProp.LineType = theType;
|
||||
aCtx->SetTypeOfLine ((Aspect_TypeOfLine) theType);
|
||||
}
|
||||
if (TheLayerProp.LineWidth != theWidth)
|
||||
{
|
||||
TheLayerProp.LineWidth = theWidth;
|
||||
aCtx->SetLineWidth (theWidth);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::SetTextAttributes (const Standard_CString theFont,
|
||||
const Standard_Integer theType,
|
||||
const Standard_ShortReal theR,
|
||||
const Standard_ShortReal theG,
|
||||
const Standard_ShortReal theB)
|
||||
{
|
||||
if (!TheLayerProp.ListId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TheLayerProp.AspectText.ChangeFontName() = theFont;
|
||||
TheLayerProp.AspectText.SetDisplayType ((Aspect_TypeOfDisplayText )theType);
|
||||
TEL_COLOUR& aSubColor = TheLayerProp.AspectText.ChangeSubtitleColor();
|
||||
aSubColor.rgb[0] = (float )theR;
|
||||
aSubColor.rgb[1] = (float )theG;
|
||||
aSubColor.rgb[2] = (float )theB;
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::Text (const Standard_CString theText,
|
||||
const Standard_ShortReal theX,
|
||||
const Standard_ShortReal theY,
|
||||
const Standard_ShortReal theHeight)
|
||||
{
|
||||
const Handle(OpenGl_Context)& aCtx = GetSharedContext();
|
||||
if (!TheLayerProp.ListId || aCtx.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_ShortReal aHeight = (theHeight < 2.0f) ? DefaultTextHeight() : theHeight;
|
||||
TheLayerProp.TextParam.Height = (int )aHeight;
|
||||
TheLayerProp.AspectText.ChangeColor() = TheLayerProp.Color;
|
||||
|
||||
myTempText->Init (aCtx, TCollection_ExtendedString (theText), OpenGl_Vec2 (theX, theY), TheLayerProp.TextParam);
|
||||
myTempText->Render (myPrintContext, aCtx, TheLayerProp.AspectText);
|
||||
//myTempText->Release (aCtx);
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::TextSize (const Standard_CString theText,
|
||||
const Standard_ShortReal theHeight,
|
||||
Standard_ShortReal& theWidth,
|
||||
Standard_ShortReal& theAscent,
|
||||
Standard_ShortReal& theDescent) const
|
||||
{
|
||||
const Handle(OpenGl_Context)& aCtx = GetSharedContext();
|
||||
if (!TheLayerProp.ListId || aCtx.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_ShortReal aHeight = (theHeight < 2.0f) ? DefaultTextHeight() : theHeight;
|
||||
TheLayerProp.TextParam.Height = (int )aHeight;
|
||||
|
||||
TCollection_ExtendedString anExtText = theText;
|
||||
NCollection_String aText = (Standard_Utf16Char* )anExtText.ToExtString();
|
||||
OpenGl_Text::StringSize (aCtx, aText, TheLayerProp.AspectText, TheLayerProp.TextParam, theWidth, theAscent, theDescent);
|
||||
}
|
@@ -236,7 +236,7 @@ struct OpenGL_BVHParallelBuilder
|
||||
Standard_Boolean OpenGl_RaytraceGeometry::ProcessAcceleration()
|
||||
{
|
||||
#ifdef RAY_TRACE_PRINT_INFO
|
||||
OSD_Timer aTimer;
|
||||
OSD_Timer aTimer;
|
||||
#endif
|
||||
|
||||
MarkDirty(); // force BVH rebuilding
|
||||
@@ -261,18 +261,6 @@ Standard_Boolean OpenGl_RaytraceGeometry::ProcessAcceleration()
|
||||
Standard_ASSERT_RETURN (!aTriangleSet->BVH().IsNull(),
|
||||
"Error! Failed to update bottom-level BVH of OpenGL element", Standard_False);
|
||||
|
||||
NCollection_Handle<BVH_Tree<Standard_ShortReal, 3> > aBVH = aTriangleSet->BVH();
|
||||
|
||||
// correct data array of bottom-level BVH to set special flag for outer
|
||||
// nodes in order to distinguish them from outer nodes of top-level BVH
|
||||
for (Standard_Integer aNodeIdx = 0; aNodeIdx < aBVH->Length(); ++aNodeIdx)
|
||||
{
|
||||
if (aBVH->IsOuter (aNodeIdx))
|
||||
{
|
||||
aBVH->NodeInfoBuffer()[aNodeIdx].x() = -1;
|
||||
}
|
||||
}
|
||||
|
||||
myBottomLevelTreeDepth = Max (myBottomLevelTreeDepth, aTriangleSet->BVH()->Depth());
|
||||
}
|
||||
|
||||
@@ -487,23 +475,13 @@ Standard_Boolean OpenGl_RaytraceGeometry::UpdateTextureHandles (const Handle(Ope
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
if (myTextureSampler.IsNull())
|
||||
{
|
||||
myTextureSampler = new OpenGl_Sampler();
|
||||
myTextureSampler->Init (*theContext.operator->());
|
||||
myTextureSampler->SetParameter (*theContext.operator->(), GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
myTextureSampler->SetParameter (*theContext.operator->(), GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
myTextureSampler->SetParameter (*theContext.operator->(), GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
myTextureSampler->SetParameter (*theContext.operator->(), GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
}
|
||||
|
||||
myTextureHandles.clear();
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
for (Standard_Integer anIdx = 0; anIdx < myTextures.Size(); ++anIdx)
|
||||
{
|
||||
const GLuint64 aHandle = theContext->arbTexBindless->glGetTextureSamplerHandleARB (
|
||||
myTextures.Value (anIdx)->TextureId(), myTextureSampler->SamplerID());
|
||||
const GLuint64 aHandle = theContext->arbTexBindless->glGetTextureHandleARB (
|
||||
myTextures.Value (anIdx)->TextureId());
|
||||
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
|
@@ -22,7 +22,6 @@
|
||||
#include <NCollection_StdAllocator.hxx>
|
||||
#include <OpenGl_TextureBufferArb.hxx>
|
||||
#include <OpenGl_Texture.hxx>
|
||||
#include <OpenGl_Sampler.hxx>
|
||||
|
||||
class OpenGl_Element;
|
||||
struct OpenGl_ElementNode;
|
||||
@@ -332,16 +331,6 @@ public: //! @name methods related to texture management
|
||||
return !myTextures.IsEmpty();
|
||||
}
|
||||
|
||||
//! Releases OpenGL resources.
|
||||
void ReleaseResources (const Handle(OpenGl_Context)& theContext)
|
||||
{
|
||||
if (!myTextureSampler.IsNull())
|
||||
{
|
||||
myTextureSampler->Release (theContext.operator->());
|
||||
myTextureSampler.Nullify();
|
||||
}
|
||||
}
|
||||
|
||||
public: //! @name auxiliary methods
|
||||
|
||||
//! Returns depth of high-level scene BVH from last build.
|
||||
@@ -359,7 +348,6 @@ public: //! @name auxiliary methods
|
||||
protected:
|
||||
|
||||
NCollection_Vector<Handle(OpenGl_Texture)> myTextures; //!< Array of texture maps shared between rendered objects
|
||||
Handle(OpenGl_Sampler) myTextureSampler; //!< Sampler object providing fixed sampling params for texures
|
||||
std::vector<GLuint64> myTextureHandles; //!< Array of unique 64-bit texture handles obtained from OpenGL
|
||||
Standard_Integer myHighLevelTreeDepth; //!< Depth of high-level scene BVH from last build
|
||||
Standard_Integer myBottomLevelTreeDepth; //!< Maximum depth of bottom-level scene BVHs from last build
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include <OpenGl_ShaderManager.hxx>
|
||||
#include <OpenGl_ArbTexBindless.hxx>
|
||||
|
||||
#include <OpenGl_GlCore32.hxx>
|
||||
|
||||
OpenGl_VariableSetterSelector OpenGl_ShaderProgram::mySetterSelector = OpenGl_VariableSetterSelector();
|
||||
|
||||
@@ -792,30 +791,30 @@ Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)&
|
||||
|
||||
// =======================================================================
|
||||
// function : SetUniform
|
||||
// purpose :
|
||||
// purpose : Specifies the value of the 64-bit unsigned uniform variable
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)& theCtx,
|
||||
const GLchar* theName,
|
||||
const OpenGl_Vec2u& theValue)
|
||||
GLuint64 theValue)
|
||||
{
|
||||
return SetUniform (theCtx, GetUniformLocation (theCtx, theName), theValue);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetUniform
|
||||
// purpose :
|
||||
// purpose : Specifies the value of the 64-bit unsigned uniform variable
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)& theCtx,
|
||||
GLint theLocation,
|
||||
const OpenGl_Vec2u& theValue)
|
||||
GLuint64 theValue)
|
||||
{
|
||||
if (theCtx->core32 == NULL || myProgramID == NO_PROGRAM || theLocation == INVALID_LOCATION)
|
||||
if (theCtx->arbTexBindless == NULL || myProgramID == NO_PROGRAM || theLocation == INVALID_LOCATION)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
theCtx->core32->glUniform2uiv (theLocation, 1, theValue.GetData());
|
||||
theCtx->arbTexBindless->glUniformHandleui64ARB (theLocation, theValue);
|
||||
#endif
|
||||
|
||||
return Standard_True;
|
||||
@@ -823,32 +822,32 @@ Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)&
|
||||
|
||||
// =======================================================================
|
||||
// function : SetUniform
|
||||
// purpose :
|
||||
// purpose : Specifies the value of the 64-bit unsigned uniform array
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)& theCtx,
|
||||
const GLchar* theName,
|
||||
const GLsizei theCount,
|
||||
const OpenGl_Vec2u* theValue)
|
||||
const GLuint64* theValue)
|
||||
{
|
||||
return SetUniform (theCtx, GetUniformLocation (theCtx, theName), theCount, theValue);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetUniform
|
||||
// purpose :
|
||||
// purpose : Specifies the value of the 64-bit unsigned uniform array
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_ShaderProgram::SetUniform (const Handle(OpenGl_Context)& theCtx,
|
||||
GLint theLocation,
|
||||
const GLsizei theCount,
|
||||
const OpenGl_Vec2u* theValue)
|
||||
const GLuint64* theValue)
|
||||
{
|
||||
if (theCtx->core32 == NULL || myProgramID == NO_PROGRAM || theLocation == INVALID_LOCATION)
|
||||
if (theCtx->arbTexBindless == NULL || myProgramID == NO_PROGRAM || theLocation == INVALID_LOCATION)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
theCtx->core32->glUniform2uiv (theLocation, theCount, theValue->GetData());
|
||||
theCtx->arbTexBindless->glUniformHandleui64vARB (theLocation, theCount, theValue);
|
||||
#endif
|
||||
|
||||
return Standard_True;
|
||||
|
@@ -365,27 +365,27 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
//! Specifies the value of the unsigned integer uniform 2D vector (uvec2).
|
||||
//! Specifies the value of the 64-bit unsigned integer uniform variable.
|
||||
Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
|
||||
const GLchar* theName,
|
||||
const OpenGl_Vec2u& theValue);
|
||||
GLuint64 theValue);
|
||||
|
||||
//! Specifies the value of the unsigned integer uniform 2D vector (uvec2).
|
||||
//! Specifies the value of the 64-bit unsigned integer uniform variable.
|
||||
Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
|
||||
GLint theLocation,
|
||||
const OpenGl_Vec2u& theValue);
|
||||
GLuint64 theValue);
|
||||
|
||||
//! Specifies the value of the uvec2 uniform array
|
||||
//! Specifies the value of the 64-bit unsigned integer uniform array.
|
||||
Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
|
||||
const GLchar* theName,
|
||||
const GLsizei theCount,
|
||||
const OpenGl_Vec2u* theValue);
|
||||
const GLuint64* theValue);
|
||||
|
||||
//! Specifies the value of the uvec2 uniform array
|
||||
//! Specifies the value of the 64-bit unsigned integer uniform array.
|
||||
Standard_EXPORT Standard_Boolean SetUniform (const Handle(OpenGl_Context)& theCtx,
|
||||
GLint theLocation,
|
||||
const GLsizei theCount,
|
||||
const OpenGl_Vec2u* theValue);
|
||||
const GLuint64* theValue);
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <Aspect_FillMethod.hxx>
|
||||
#include <Aspect_GradientFillMethod.hxx>
|
||||
#include <Aspect_TypeOfTriedronPosition.hxx>
|
||||
#include <Aspect_CLayer2d.hxx>
|
||||
|
||||
#include <InterfaceGraphic_Graphic3d.hxx>
|
||||
#include <InterfaceGraphic_Visual3d.hxx>
|
||||
@@ -159,6 +160,8 @@ class OpenGl_View : public MMgt_TShared
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
Graphic3d_Camera::Projection theProjection,
|
||||
const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer,
|
||||
const Standard_Boolean theToDrawImmediate);
|
||||
|
||||
void DrawBackground (const Handle(OpenGl_Workspace)& theWorkspace);
|
||||
@@ -196,6 +199,11 @@ protected:
|
||||
const Graphic3d_CView& theCView,
|
||||
const Standard_Boolean theToDrawImmediate);
|
||||
|
||||
void RedrawLayer2d (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||
const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCLayer);
|
||||
|
||||
void RedrawTrihedron (const Handle(OpenGl_Workspace) &theWorkspace);
|
||||
|
||||
//! Redraw contents of model scene: clipping planes,
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Image_AlienPixMap.hxx>
|
||||
#include <Visual3d_Layer.hxx>
|
||||
|
||||
#include <NCollection_Mat4.hxx>
|
||||
|
||||
@@ -172,14 +173,12 @@ void OpenGl_View::DrawBackground (const Handle(OpenGl_Workspace)& theWorkspace)
|
||||
aCtx->core11fwd->glDisable (GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
aCtx->ProjectionState.Push();
|
||||
aCtx->WorldViewState.Push();
|
||||
aCtx->ModelWorldState.Push();
|
||||
aCtx->ProjectionState.SetIdentity();
|
||||
aCtx->ProjectionState.Push();
|
||||
aCtx->WorldViewState.SetIdentity();
|
||||
aCtx->ModelWorldState.SetIdentity();
|
||||
aCtx->ProjectionState.SetIdentity();
|
||||
aCtx->ApplyProjectionMatrix();
|
||||
aCtx->ApplyModelViewMatrix();
|
||||
aCtx->ApplyWorldViewMatrix();
|
||||
|
||||
// Drawing background gradient if:
|
||||
// - gradient fill type is not Aspect_GFM_NONE and
|
||||
@@ -235,11 +234,10 @@ void OpenGl_View::DrawBackground (const Handle(OpenGl_Workspace)& theWorkspace)
|
||||
theWorkspace->SetAspectFace (anOldAspectFace);
|
||||
}
|
||||
|
||||
aCtx->ModelWorldState.Pop();
|
||||
aCtx->WorldViewState.Pop();
|
||||
aCtx->ProjectionState.Pop();
|
||||
aCtx->ApplyProjectionMatrix();
|
||||
aCtx->ApplyModelViewMatrix();
|
||||
aCtx->ApplyWorldViewMatrix();
|
||||
|
||||
if (wasUsedZBuffer)
|
||||
{
|
||||
@@ -256,6 +254,8 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||
OpenGl_FrameBuffer* theOutputFBO,
|
||||
Graphic3d_Camera::Projection theProjection,
|
||||
const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer,
|
||||
const Standard_Boolean theToDrawImmediate)
|
||||
{
|
||||
// ==================================
|
||||
@@ -322,7 +322,15 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||
#endif
|
||||
|
||||
// =================================
|
||||
// Step 3: Redraw main plane
|
||||
// Step 3: Draw underlayer
|
||||
// =================================
|
||||
if (!theToDrawImmediate)
|
||||
{
|
||||
RedrawLayer2d (thePrintContext, theWorkspace, theCView, theCUnderLayer);
|
||||
}
|
||||
|
||||
// =================================
|
||||
// Step 4: Redraw main plane
|
||||
// =================================
|
||||
|
||||
// Setup face culling
|
||||
@@ -424,7 +432,7 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||
RedrawScene (thePrintContext, theWorkspace, theOutputFBO, theCView, theToDrawImmediate);
|
||||
|
||||
// ===============================
|
||||
// Step 4: Trihedron
|
||||
// Step 5: Trihedron
|
||||
// ===============================
|
||||
|
||||
// Resetting GL parameters according to the default aspects
|
||||
@@ -464,8 +472,21 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||
}
|
||||
}
|
||||
|
||||
// ===============================
|
||||
// Step 6: Redraw overlay
|
||||
// ===============================
|
||||
if (!theToDrawImmediate)
|
||||
{
|
||||
const int aMode = 0;
|
||||
theWorkspace->DisplayCallback (theCView, (aMode | OCC_PRE_OVERLAY));
|
||||
|
||||
RedrawLayer2d (thePrintContext, theWorkspace, theCView, theCOverLayer);
|
||||
|
||||
theWorkspace->DisplayCallback (theCView, aMode);
|
||||
}
|
||||
|
||||
// ==============================================================
|
||||
// Step 5: Keep shader manager informed about last View
|
||||
// Step 7: Keep shader manager informed about last View
|
||||
// ==============================================================
|
||||
|
||||
if (!aManager.IsNull())
|
||||
@@ -626,6 +647,150 @@ void OpenGl_View::RenderStructs (const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
//call_togl_redraw_layer2d
|
||||
void OpenGl_View::RedrawLayer2d (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||
const Handle(OpenGl_Workspace)& theWorkspace,
|
||||
const Graphic3d_CView& /*ACView*/,
|
||||
const Aspect_CLayer2d& ACLayer)
|
||||
{
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
if (&ACLayer == NULL
|
||||
|| ACLayer.ptrLayer == NULL
|
||||
|| ACLayer.ptrLayer->listIndex == 0) return;
|
||||
|
||||
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
|
||||
if (aContext->core11 == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GLsizei dispWidth = (GLsizei )ACLayer.viewport[0];
|
||||
GLsizei dispHeight = (GLsizei )ACLayer.viewport[1];
|
||||
|
||||
aContext->WorldViewState.Push();
|
||||
aContext->ProjectionState.Push();
|
||||
|
||||
aContext->WorldViewState.SetIdentity();
|
||||
aContext->ProjectionState.SetIdentity();
|
||||
|
||||
aContext->ApplyWorldViewMatrix();
|
||||
aContext->ApplyProjectionMatrix();
|
||||
|
||||
if (!ACLayer.sizeDependent)
|
||||
aContext->core11fwd->glViewport (0, 0, dispWidth, dispHeight);
|
||||
|
||||
float left = ACLayer.ortho[0];
|
||||
float right = ACLayer.ortho[1];
|
||||
float bottom = ACLayer.ortho[2];
|
||||
float top = ACLayer.ortho[3];
|
||||
|
||||
int attach = ACLayer.attach;
|
||||
|
||||
const float ratio = !ACLayer.sizeDependent
|
||||
? float(dispWidth) / float(dispHeight)
|
||||
: float(theWorkspace->Width()) / float(theWorkspace->Height());
|
||||
|
||||
float delta;
|
||||
if (ratio >= 1.0) {
|
||||
delta = (float )((top - bottom)/2.0);
|
||||
switch (attach) {
|
||||
case 0: /* Aspect_TOC_BOTTOM_LEFT */
|
||||
top = bottom + 2*delta/ratio;
|
||||
break;
|
||||
case 1: /* Aspect_TOC_BOTTOM_RIGHT */
|
||||
top = bottom + 2*delta/ratio;
|
||||
break;
|
||||
case 2: /* Aspect_TOC_TOP_LEFT */
|
||||
bottom = top - 2*delta/ratio;
|
||||
break;
|
||||
case 3: /* Aspect_TOC_TOP_RIGHT */
|
||||
bottom = top - 2*delta/ratio;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
delta = (float )((right - left)/2.0);
|
||||
switch (attach) {
|
||||
case 0: /* Aspect_TOC_BOTTOM_LEFT */
|
||||
right = left + 2*delta*ratio;
|
||||
break;
|
||||
case 1: /* Aspect_TOC_BOTTOM_RIGHT */
|
||||
left = right - 2*delta*ratio;
|
||||
break;
|
||||
case 2: /* Aspect_TOC_TOP_LEFT */
|
||||
right = left + 2*delta*ratio;
|
||||
break;
|
||||
case 3: /* Aspect_TOC_TOP_RIGHT */
|
||||
left = right - 2*delta*ratio;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// Check printer context that exists only for print operation
|
||||
if (!thePrintContext.IsNull())
|
||||
{
|
||||
// additional transformation matrix could be applied to
|
||||
// render only those parts of viewport that will be
|
||||
// passed to a printer as a current "frame" to provide
|
||||
// tiling; scaling of graphics by matrix helps render a
|
||||
// part of a view (frame) in same viewport, but with higher
|
||||
// resolution
|
||||
|
||||
// set printing scale/tiling transformation
|
||||
aContext->ProjectionState.SetCurrent (thePrintContext->ProjTransformation());
|
||||
aContext->ApplyProjectionMatrix();
|
||||
|
||||
// printing operation also assumes other viewport dimension
|
||||
// to comply with transformation matrix or graphics scaling
|
||||
// factors for tiling for layer redraw
|
||||
GLsizei anViewportX = 0;
|
||||
GLsizei anViewportY = 0;
|
||||
thePrintContext->GetLayerViewport (anViewportX, anViewportY);
|
||||
if (anViewportX != 0 && anViewportY != 0)
|
||||
aContext->core11fwd->glViewport (0, 0, anViewportX, anViewportY);
|
||||
}
|
||||
#endif
|
||||
|
||||
glOrtho (left, right, bottom, top, -1.0, 1.0);
|
||||
|
||||
glPushAttrib (
|
||||
GL_LIGHTING_BIT | GL_LINE_BIT | GL_POLYGON_BIT |
|
||||
GL_DEPTH_BUFFER_BIT | GL_CURRENT_BIT | GL_TEXTURE_BIT );
|
||||
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
glDisable (GL_TEXTURE_1D);
|
||||
glDisable (GL_TEXTURE_2D);
|
||||
glDisable (GL_LIGHTING);
|
||||
|
||||
// TODO: Obsolete code, the display list is always empty now, to be removed
|
||||
glCallList (ACLayer.ptrLayer->listIndex);
|
||||
|
||||
//calling dynamic render of LayerItems
|
||||
if ( ACLayer.ptrLayer->layerData )
|
||||
{
|
||||
InitLayerProp (ACLayer.ptrLayer->listIndex);
|
||||
((Visual3d_Layer*)ACLayer.ptrLayer->layerData)->RenderLayerItems();
|
||||
InitLayerProp (0);
|
||||
}
|
||||
|
||||
glPopAttrib ();
|
||||
|
||||
aContext->WorldViewState.Pop();
|
||||
aContext->ProjectionState.Pop();
|
||||
|
||||
aContext->ApplyProjectionMatrix();
|
||||
aContext->ApplyWorldViewMatrix();
|
||||
|
||||
if (!ACLayer.sizeDependent)
|
||||
aContext->core11fwd->glViewport (0, 0, theWorkspace->Width(), theWorkspace->Height());
|
||||
|
||||
glFlush ();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
void OpenGl_View::RedrawTrihedron (const Handle(OpenGl_Workspace) &theWorkspace)
|
||||
{
|
||||
// display global trihedron
|
||||
@@ -921,10 +1086,7 @@ void OpenGl_View::RedrawScene (const Handle(OpenGl_PrinterContext)& thePrintCont
|
||||
|
||||
case Visual3d_TOD_ENVIRONMENT:
|
||||
theWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
|
||||
if (theCView.RenderParams.Method != Graphic3d_RM_RAYTRACING)
|
||||
{
|
||||
theWorkspace->EnableTexture (myTextureEnv);
|
||||
}
|
||||
theWorkspace->EnableTexture (myTextureEnv);
|
||||
// Render the view
|
||||
RenderStructs (theWorkspace, theReadDrawFbo, theCView, theToDrawImmediate);
|
||||
theWorkspace->DisableTexture();
|
||||
@@ -941,10 +1103,7 @@ void OpenGl_View::RedrawScene (const Handle(OpenGl_PrinterContext)& thePrintCont
|
||||
if (theWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED)
|
||||
{
|
||||
theWorkspace->NamedStatus |= OPENGL_NS_2NDPASSDO;
|
||||
if (theCView.RenderParams.Method != Graphic3d_RM_RAYTRACING)
|
||||
{
|
||||
theWorkspace->EnableTexture (myTextureEnv);
|
||||
}
|
||||
theWorkspace->EnableTexture (myTextureEnv);
|
||||
|
||||
// Remember OpenGl properties
|
||||
GLint aSaveBlendDst = GL_ONE_MINUS_SRC_ALPHA, aSaveBlendSrc = GL_SRC_ALPHA;
|
||||
|
@@ -1216,7 +1216,8 @@ Handle(OpenGl_ShaderProgram) OpenGl_View::initProgram (const Handle(OpenGl_Conte
|
||||
}
|
||||
else if (theGlContext->caps->glslWarnings)
|
||||
{
|
||||
aProgram->FetchInfoLog (theGlContext, aLinkLog);
|
||||
myRaytraceProgram->FetchInfoLog (theGlContext, aLinkLog);
|
||||
|
||||
if (!aLinkLog.IsEmpty() && !aLinkLog.IsEqual ("No errors.\n"))
|
||||
{
|
||||
const TCollection_ExtendedString aMessage = TCollection_ExtendedString (
|
||||
@@ -1657,8 +1658,6 @@ void OpenGl_View::releaseRaytraceResources (const Handle(OpenGl_Context)& theGlC
|
||||
nullifyResource (theGlContext, myRaytraceLightSrcTexture);
|
||||
nullifyResource (theGlContext, myRaytraceMaterialTexture);
|
||||
|
||||
myRaytraceGeometry.ReleaseResources (theGlContext);
|
||||
|
||||
if (myRaytraceScreenQuad.IsValid())
|
||||
myRaytraceScreenQuad.Release (theGlContext.operator->());
|
||||
}
|
||||
@@ -2258,10 +2257,8 @@ Standard_Boolean OpenGl_View::setUniformState (const Graphic3d_CView& the
|
||||
// Set array of 64-bit texture handles
|
||||
if (theGlContext->arbTexBindless != NULL && myRaytraceGeometry.HasTextures())
|
||||
{
|
||||
const std::vector<GLuint64>& aTextures = myRaytraceGeometry.TextureHandles();
|
||||
|
||||
theProgram->SetUniform (theGlContext, myUniformLocations[theProgramId][OpenGl_RT_uTexSamplersArray],
|
||||
static_cast<GLsizei> (aTextures.size()), (OpenGl_Vec2u* )&aTextures.front());
|
||||
static_cast<GLsizei> (myRaytraceGeometry.TextureHandles().size()), &myRaytraceGeometry.TextureHandles()[0]);
|
||||
}
|
||||
|
||||
// Set background colors (only gradient background supported)
|
||||
@@ -2399,11 +2396,6 @@ Standard_Boolean OpenGl_View::runRaytraceShaders (const Graphic3d_CView&
|
||||
|
||||
if (myRaytraceParameters.GlobalIllumination)
|
||||
{
|
||||
if (myAccumFrames == 0)
|
||||
{
|
||||
myRNG.SetSeed();
|
||||
}
|
||||
|
||||
// Set frame accumulation weight
|
||||
myRaytraceProgram->SetUniform (theGlContext,
|
||||
myUniformLocations[0][OpenGl_RT_uSampleWeight], 1.f / (myAccumFrames + 1));
|
||||
|
@@ -1002,7 +1002,9 @@ void OpenGl_Workspace::drawStereoPair (const Graphic3d_CView& theCView)
|
||||
// function : Redraw
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView)
|
||||
void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer)
|
||||
{
|
||||
if (!Activate())
|
||||
{
|
||||
@@ -1126,13 +1128,14 @@ void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView)
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
myGlContext->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_LEFT : GL_BACK);
|
||||
#endif
|
||||
redraw1 (theCView, aMainFbos[0], Graphic3d_Camera::Projection_MonoLeftEye);
|
||||
redraw1 (theCView, theCUnderLayer, theCOverLayer,
|
||||
aMainFbos[0], Graphic3d_Camera::Projection_MonoLeftEye);
|
||||
myBackBufferRestored = Standard_True;
|
||||
myIsImmediateDrawn = Standard_False;
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
myGlContext->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_LEFT : GL_BACK);
|
||||
#endif
|
||||
if (!redrawImmediate (theCView, aMainFbos[0], aProjectType, anImmFbos[0]))
|
||||
if (!redrawImmediate (theCView, theCOverLayer, theCUnderLayer, aMainFbos[0], aProjectType, anImmFbos[0]))
|
||||
{
|
||||
toSwap = false;
|
||||
}
|
||||
@@ -1145,10 +1148,11 @@ void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView)
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
myGlContext->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_RIGHT : GL_BACK);
|
||||
#endif
|
||||
redraw1 (theCView, aMainFbos[1], Graphic3d_Camera::Projection_MonoRightEye);
|
||||
redraw1 (theCView, theCUnderLayer, theCOverLayer,
|
||||
aMainFbos[1], Graphic3d_Camera::Projection_MonoRightEye);
|
||||
myBackBufferRestored = Standard_True;
|
||||
myIsImmediateDrawn = Standard_False;
|
||||
if (!redrawImmediate (theCView, aMainFbos[1], aProjectType, anImmFbos[1]))
|
||||
if (!redrawImmediate (theCView, theCOverLayer, theCUnderLayer, aMainFbos[1], aProjectType, anImmFbos[1]))
|
||||
{
|
||||
toSwap = false;
|
||||
}
|
||||
@@ -1175,10 +1179,11 @@ void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView)
|
||||
myGlContext->SetReadDrawBuffer (GL_BACK);
|
||||
}
|
||||
#endif
|
||||
redraw1 (theCView, aMainFbo != NULL ? aMainFbo : aFrameBuffer, aProjectType);
|
||||
redraw1 (theCView, theCUnderLayer, theCOverLayer,
|
||||
aMainFbo != NULL ? aMainFbo : aFrameBuffer, aProjectType);
|
||||
myBackBufferRestored = Standard_True;
|
||||
myIsImmediateDrawn = Standard_False;
|
||||
if (!redrawImmediate (theCView, aMainFbo, aProjectType, anImmFbo))
|
||||
if (!redrawImmediate (theCView, theCOverLayer, theCUnderLayer, aMainFbo, aProjectType, anImmFbo))
|
||||
{
|
||||
toSwap = false;
|
||||
}
|
||||
@@ -1234,6 +1239,8 @@ void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView)
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Workspace::redraw1 (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
const Graphic3d_Camera::Projection theProjection)
|
||||
{
|
||||
@@ -1281,7 +1288,7 @@ void OpenGl_Workspace::redraw1 (const Graphic3d_CView& theCView,
|
||||
glClear (toClear);
|
||||
|
||||
Handle(OpenGl_Workspace) aWS (this);
|
||||
myView->Render (myPrintContext, aWS, theReadDrawFbo, theProjection, theCView, Standard_False);
|
||||
myView->Render (myPrintContext, aWS, theReadDrawFbo, theProjection, theCView, theCUnderLayer, theCOverLayer, Standard_False);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -1370,13 +1377,15 @@ void OpenGl_Workspace::DisplayCallback (const Graphic3d_CView& theCView,
|
||||
// function : RedrawImmediate
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Workspace::RedrawImmediate (const Graphic3d_CView& theCView)
|
||||
void OpenGl_Workspace::RedrawImmediate (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer)
|
||||
{
|
||||
if (!myTransientDrawToFront
|
||||
|| !myBackBufferRestored
|
||||
|| (myGlContext->caps->buffersNoSwap && !myMainSceneFbos[0]->IsValid()))
|
||||
{
|
||||
Redraw (theCView);
|
||||
Redraw (theCView, theCUnderLayer, theCOverLayer);
|
||||
return;
|
||||
}
|
||||
else if (!Activate())
|
||||
@@ -1434,7 +1443,7 @@ void OpenGl_Workspace::RedrawImmediate (const Graphic3d_CView& theCView)
|
||||
myGlContext->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_LEFT : GL_BACK);
|
||||
}
|
||||
#endif
|
||||
toSwap = redrawImmediate (theCView,
|
||||
toSwap = redrawImmediate (theCView, theCUnderLayer, theCOverLayer,
|
||||
aMainFbos[0],
|
||||
Graphic3d_Camera::Projection_MonoLeftEye,
|
||||
anImmFbos[0],
|
||||
@@ -1456,7 +1465,7 @@ void OpenGl_Workspace::RedrawImmediate (const Graphic3d_CView& theCView)
|
||||
myGlContext->SetReadDrawBuffer (aStereoMode == Graphic3d_StereoMode_QuadBuffer ? GL_BACK_RIGHT : GL_BACK);
|
||||
}
|
||||
#endif
|
||||
toSwap = redrawImmediate (theCView,
|
||||
toSwap = redrawImmediate (theCView, theCUnderLayer, theCOverLayer,
|
||||
aMainFbos[1],
|
||||
Graphic3d_Camera::Projection_MonoRightEye,
|
||||
anImmFbos[1],
|
||||
@@ -1481,7 +1490,7 @@ void OpenGl_Workspace::RedrawImmediate (const Graphic3d_CView& theCView)
|
||||
myGlContext->SetReadDrawBuffer (GL_BACK);
|
||||
}
|
||||
#endif
|
||||
toSwap = redrawImmediate (theCView,
|
||||
toSwap = redrawImmediate (theCView, theCUnderLayer, theCOverLayer,
|
||||
aMainFbo,
|
||||
aProjectType,
|
||||
anImmFbo,
|
||||
@@ -1512,6 +1521,8 @@ void OpenGl_Workspace::RedrawImmediate (const Graphic3d_CView& theCView)
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool OpenGl_Workspace::redrawImmediate (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer,
|
||||
OpenGl_FrameBuffer* theReadFbo,
|
||||
const Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theDrawFbo,
|
||||
@@ -1571,7 +1582,7 @@ bool OpenGl_Workspace::redrawImmediate (const Graphic3d_CView& theCView,
|
||||
#endif
|
||||
|
||||
myView->Render (myPrintContext, aWS, theDrawFbo, theProjection,
|
||||
theCView, Standard_True);
|
||||
theCView, theCUnderLayer, theCOverLayer, Standard_True);
|
||||
|
||||
return !toCopyBackToFront;
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include <Graphic3d_PtrFrameBuffer.hxx>
|
||||
#include <Graphic3d_BufferType.hxx>
|
||||
|
||||
#include <Aspect_CLayer2d.hxx>
|
||||
#include <Aspect_Handle.hxx>
|
||||
#include <Aspect_PrintAlgo.hxx>
|
||||
#include <Aspect_PolygonOffsetMode.hxx>
|
||||
@@ -155,10 +156,14 @@ public:
|
||||
Standard_Integer ActiveViewId() const { return myViewId; }
|
||||
|
||||
//! Redraw the window.
|
||||
Standard_EXPORT virtual void Redraw (const Graphic3d_CView& theCView);
|
||||
Standard_EXPORT virtual void Redraw (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer);
|
||||
|
||||
Standard_Boolean SetImmediateModeDrawToFront (const Standard_Boolean theDrawToFrontBuffer);
|
||||
Standard_EXPORT virtual void RedrawImmediate (const Graphic3d_CView& theCView);
|
||||
Standard_EXPORT virtual void RedrawImmediate (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer);
|
||||
|
||||
//! Mark cached view content invalid (e.g. complete view redraw should be performed on next frame).
|
||||
void Invalidate() { myBackBufferRestored = Standard_False; }
|
||||
@@ -170,6 +175,8 @@ public:
|
||||
//! System-specific and currently only Win platform implemented.
|
||||
Standard_Boolean Print (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||
const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer,
|
||||
const Aspect_Handle theHPrintDC,
|
||||
const Standard_Boolean theToShowBackground,
|
||||
const Standard_CString theFileName,
|
||||
@@ -300,6 +307,8 @@ protected:
|
||||
Standard_EXPORT virtual Standard_Boolean Activate();
|
||||
|
||||
void redraw1 (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer,
|
||||
OpenGl_FrameBuffer* theReadDrawFbo,
|
||||
const Graphic3d_Camera::Projection theProjection);
|
||||
|
||||
@@ -318,6 +327,8 @@ protected:
|
||||
//!
|
||||
//! @return false if immediate structures has been rendered directly into FrontBuffer and Buffer Swap should not be called.
|
||||
bool redrawImmediate (const Graphic3d_CView& theCView,
|
||||
const Aspect_CLayer2d& theCUnderLayer,
|
||||
const Aspect_CLayer2d& theCOverLayer,
|
||||
OpenGl_FrameBuffer* theReadFbo,
|
||||
const Graphic3d_Camera::Projection theProjection,
|
||||
OpenGl_FrameBuffer* theDrawFbo,
|
||||
|
@@ -274,6 +274,8 @@ static void initBufferTiling (Standard_Integer& theFrameWidth,
|
||||
Standard_Boolean OpenGl_Workspace::Print
|
||||
(const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||
const Graphic3d_CView& ACView,
|
||||
const Aspect_CLayer2d& ACUnderLayer,
|
||||
const Aspect_CLayer2d& ACOverLayer,
|
||||
const Aspect_Handle hPrintDC,// const Aspect_Drawable hPrintDC,
|
||||
const Standard_Boolean showBackground,
|
||||
const Standard_CString filename,
|
||||
@@ -568,13 +570,13 @@ Standard_Boolean OpenGl_Workspace::Print
|
||||
{
|
||||
myPrintContext->SetScale ((GLfloat )aFrameWidth /viewWidth,
|
||||
(GLfloat )aFrameHeight/viewHeight);
|
||||
redraw1 (ACView, aFrameBuffer, aProjectType);
|
||||
redraw1 (ACView, ACUnderLayer, ACOverLayer, aFrameBuffer, aProjectType);
|
||||
if (!myTransientDrawToFront)
|
||||
{
|
||||
// render to FBO only if allowed to render to back buffer
|
||||
myBackBufferRestored = Standard_True;
|
||||
myIsImmediateDrawn = Standard_False;
|
||||
redrawImmediate (ACView, NULL, aProjectType, aFrameBuffer);
|
||||
redrawImmediate (ACView, ACUnderLayer, ACOverLayer, NULL, aProjectType, aFrameBuffer);
|
||||
myBackBufferRestored = Standard_False;
|
||||
myIsImmediateDrawn = Standard_False;
|
||||
}
|
||||
@@ -682,13 +684,13 @@ Standard_Boolean OpenGl_Workspace::Print
|
||||
aFrameHeight;
|
||||
|
||||
// draw to the offscreen buffer and capture the result
|
||||
redraw1 (ACView, aFrameBuffer, aProjectType);
|
||||
redraw1 (ACView, ACUnderLayer, ACOverLayer, aFrameBuffer, aProjectType);
|
||||
if (!myTransientDrawToFront)
|
||||
{
|
||||
// render to FBO only if forces to render to back buffer
|
||||
myBackBufferRestored = Standard_True;
|
||||
myIsImmediateDrawn = Standard_False;
|
||||
redrawImmediate (ACView, NULL, aProjectType, aFrameBuffer);
|
||||
redrawImmediate (ACView, ACUnderLayer, ACOverLayer, NULL, aProjectType, aFrameBuffer);
|
||||
myBackBufferRestored = Standard_False;
|
||||
myIsImmediateDrawn = Standard_False;
|
||||
}
|
||||
|
@@ -25,9 +25,7 @@
|
||||
enum Prs3d_DimensionTextVerticalPosition
|
||||
{
|
||||
Prs3d_DTVP_Above,
|
||||
Prs3d_DTVP_FirstLine,
|
||||
Prs3d_DTVP_Below,
|
||||
Prs3d_DTVP_LastLine,
|
||||
Prs3d_DTVP_Center
|
||||
};
|
||||
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfTransient.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <Visual3d_Layer.hxx>
|
||||
#include <Visual3d_View.hxx>
|
||||
#include <Visual3d_ViewManager.hxx>
|
||||
|
||||
|
@@ -391,7 +391,7 @@ Handle(StlMesh_Mesh) RWStl::ReadBinary (const OSD_Path& thePath,
|
||||
ReadMesh->AddDomain ();
|
||||
|
||||
// Filter unique vertices to share the nodes of the mesh.
|
||||
BRepBuilderAPI_CellFilter uniqueVertices(Precision::Confusion());
|
||||
BRepBuilderAPI_CellFilter uniqueVertices(BRepBuilderAPI_VertexInspector::Dimension, Precision::Confusion());
|
||||
BRepBuilderAPI_VertexInspector inspector(Precision::Confusion());
|
||||
|
||||
for (ifacet=1; ifacet<=NBFACET; ++ifacet) {
|
||||
@@ -480,7 +480,7 @@ Handle(StlMesh_Mesh) RWStl::ReadAscii (const OSD_Path& thePath,
|
||||
ReadMesh->AddDomain();
|
||||
|
||||
// Filter unique vertices to share the nodes of the mesh.
|
||||
BRepBuilderAPI_CellFilter uniqueVertices(Precision::Confusion());
|
||||
BRepBuilderAPI_CellFilter uniqueVertices(BRepBuilderAPI_VertexInspector::Dimension, Precision::Confusion());
|
||||
BRepBuilderAPI_VertexInspector inspector(Precision::Confusion());
|
||||
|
||||
// main reading
|
||||
|
@@ -32,18 +32,13 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <errno.h>
|
||||
#define END 0
|
||||
#define EMPTY 1
|
||||
#define COMMENT 2
|
||||
#define RESOURCE 3
|
||||
#define ERROR -1
|
||||
|
||||
//! Auxiliary enumeration for function WhatKindOfLine().
|
||||
enum Resource_KindOfLine
|
||||
{
|
||||
Resource_KOL_End,
|
||||
Resource_KOL_Empty,
|
||||
Resource_KOL_Comment,
|
||||
Resource_KOL_Resource,
|
||||
Resource_KOL_Error
|
||||
};
|
||||
|
||||
static Resource_KindOfLine WhatKindOfLine(OSD_File& aFile,
|
||||
static Standard_Integer WhatKindOfLine(OSD_File& aFile,
|
||||
TCollection_AsciiString& aToken1,
|
||||
TCollection_AsciiString& aToken2);
|
||||
|
||||
@@ -109,7 +104,7 @@ Resource_Manager::Resource_Manager(const Standard_CString aName,
|
||||
void Resource_Manager::Load(TCollection_AsciiString& aPath,
|
||||
Resource_DataMapOfAsciiStringAsciiString& aMap)
|
||||
{
|
||||
Resource_KindOfLine aKind;
|
||||
Standard_Integer Kind;
|
||||
TCollection_AsciiString Token1, Token2;
|
||||
TCollection_AsciiString Directory, Name;
|
||||
TCollection_AsciiString FileName;
|
||||
@@ -122,17 +117,16 @@ void Resource_Manager::Load(TCollection_AsciiString& aPath,
|
||||
return;
|
||||
}
|
||||
Standard_Integer LineNumber = 1;
|
||||
while ((aKind = WhatKindOfLine(File, Token1, Token2)) != Resource_KOL_End) {
|
||||
switch (aKind) {
|
||||
case Resource_KOL_End:
|
||||
case Resource_KOL_Comment:
|
||||
case Resource_KOL_Empty:
|
||||
while ((Kind = WhatKindOfLine(File, Token1, Token2)) != END) {
|
||||
switch (Kind) {
|
||||
case COMMENT :
|
||||
case EMPTY :
|
||||
break ;
|
||||
case Resource_KOL_Resource:
|
||||
case RESOURCE :
|
||||
if (!aMap.Bind(Token1,Token2))
|
||||
aMap(Token1) = Token2;
|
||||
break;
|
||||
case Resource_KOL_Error:
|
||||
case ERROR :
|
||||
if (myVerbose)
|
||||
cout << "Resource Manager: Syntax error at line "
|
||||
<< LineNumber << " in file : " << FileName << endl;
|
||||
@@ -146,7 +140,7 @@ void Resource_Manager::Load(TCollection_AsciiString& aPath,
|
||||
<< " file \"" << FileName << "\" loaded" << endl;
|
||||
}
|
||||
|
||||
static Resource_KindOfLine WhatKindOfLine(OSD_File& aFile,
|
||||
static Standard_Integer WhatKindOfLine(OSD_File& aFile,
|
||||
TCollection_AsciiString& aToken1,
|
||||
TCollection_AsciiString& aToken2)
|
||||
{
|
||||
@@ -155,18 +149,18 @@ static Resource_KindOfLine WhatKindOfLine(OSD_File& aFile,
|
||||
TCollection_AsciiString Line ;
|
||||
|
||||
if (!GetLine(aFile,Line))
|
||||
return Resource_KOL_End;
|
||||
return END;
|
||||
|
||||
if (Line.Value(1) == '!')
|
||||
return Resource_KOL_Comment;
|
||||
return COMMENT;
|
||||
|
||||
Pos1 = Line.FirstLocationNotInSet(WhiteSpace, 1, Line.Length());
|
||||
if (Line.Value(Pos1) == '\n')
|
||||
return Resource_KOL_Empty;
|
||||
return EMPTY;
|
||||
|
||||
Pos2 = Line.Location(1,':',Pos1,Line.Length());
|
||||
if (!Pos2 || Pos1 == Pos2)
|
||||
return Resource_KOL_Error;
|
||||
return ERROR;
|
||||
|
||||
for (Pos = Pos2-1; Line.Value(Pos) == '\t' || Line.Value(Pos) == ' ' ; Pos--);
|
||||
aToken1 = Line.SubString(Pos1, Pos);
|
||||
@@ -194,7 +188,7 @@ static Resource_KindOfLine WhatKindOfLine(OSD_File& aFile,
|
||||
}
|
||||
if (Debug)
|
||||
cout << "'\t Value = '" << aToken2 << "'" << endl << flush;
|
||||
return Resource_KOL_Resource;
|
||||
return RESOURCE;
|
||||
}
|
||||
|
||||
// Retourne 0 (EOF) ou une ligne toujours terminee par <NL>.
|
||||
|
@@ -1035,9 +1035,9 @@ TDF_Label STEPCAFControl_Reader::FindInstance (const Handle(StepRepr_NextAssembl
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Reader::ReadNames (const Handle(XSControl_WorkSession) &WS,
|
||||
Handle(TDocStd_Document)& Doc,
|
||||
const STEPCAFControl_DataMapOfPDExternFile &PDFileMap,
|
||||
const XCAFDoc_DataMapOfShapeLabel &ShapeLabelMap) const
|
||||
Handle(TDocStd_Document)& Doc,
|
||||
const STEPCAFControl_DataMapOfPDExternFile &PDFileMap,
|
||||
const XCAFDoc_DataMapOfShapeLabel &ShapeLabelMap) const
|
||||
{
|
||||
// get starting data
|
||||
Handle(Interface_InterfaceModel) Model = WS->Model();
|
||||
@@ -1060,7 +1060,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadNames (const Handle(XSControl_WorkSe
|
||||
if ( enti->DynamicType() == tNAUO ) {
|
||||
L.Nullify();
|
||||
Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO =
|
||||
Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(enti);
|
||||
Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(enti);
|
||||
if(NAUO.IsNull()) continue;
|
||||
Interface_EntityIterator subs = WS->Graph().Sharings(NAUO);
|
||||
for (subs.Start(); subs.More(); subs.Next()) {
|
||||
@@ -1086,17 +1086,12 @@ Standard_Boolean STEPCAFControl_Reader::ReadNames (const Handle(XSControl_WorkSe
|
||||
if ( enti->DynamicType() == tPD ) {
|
||||
L.Nullify();
|
||||
Handle(StepBasic_ProductDefinition) PD =
|
||||
Handle(StepBasic_ProductDefinition)::DownCast(enti);
|
||||
Handle(StepBasic_ProductDefinition)::DownCast(enti);
|
||||
if(PD.IsNull()) continue;
|
||||
Handle(StepBasic_Product) Prod = (!PD->Formation().IsNull() ? PD->Formation()->OfProduct() : NULL);
|
||||
if (Prod.IsNull())
|
||||
name = new TCollection_HAsciiString;
|
||||
else if (!Prod->Name().IsNull() && Prod->Name()->UsefullLength() > 0)
|
||||
name = Prod->Name();
|
||||
else if (!Prod->Id().IsNull())
|
||||
name = Prod->Id();
|
||||
else
|
||||
name = new TCollection_HAsciiString;
|
||||
Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct();
|
||||
if(!Prod->Name().IsNull() && Prod->Name()->UsefullLength()>0) name = Prod->Name();
|
||||
else if (!Prod->Id().IsNull()) name = Prod->Id();
|
||||
else name = new TCollection_HAsciiString;
|
||||
L = GetLabelFromPD ( PD, STool, TP, PDFileMap, ShapeLabelMap );
|
||||
if ( L.IsNull() ) continue;
|
||||
TCollection_ExtendedString str ( name->String() );
|
||||
|
@@ -175,7 +175,7 @@ Select3D_SensitiveCircle::Select3D_SensitiveCircle (const Handle(SelectBasics_En
|
||||
Select3D_SensitiveCircle::Select3D_SensitiveCircle(const Handle(SelectBasics_EntityOwner)& theOwnerId,
|
||||
const Handle(TColgp_HArray1OfPnt)& thePnts3d,
|
||||
const Standard_Boolean theIsFilled)
|
||||
: Select3D_SensitivePoly (theOwnerId, thePnts3d, (Standard_Boolean )!theIsFilled),
|
||||
: Select3D_SensitivePoly (theOwnerId, thePnts3d, !theIsFilled),
|
||||
myStart (0),
|
||||
myEnd (0)
|
||||
{
|
||||
|
@@ -687,7 +687,7 @@ vec4 PathTrace (in SRay theRay, in vec3 theInverse)
|
||||
dot (aTrsfRow2, aTexCoord));
|
||||
|
||||
vec3 aTexColor = textureLod (
|
||||
sampler2D (uTextureSamplers[int (aMaterial.Kd.w)]), aTexCoord.st, 0.f).rgb;
|
||||
uTextureSamplers[int (aMaterial.Kd.w)], aTexCoord.st, 0.f).rgb;
|
||||
|
||||
aMaterial.Kd.rgb *= aTexColor;
|
||||
}
|
||||
|
@@ -89,7 +89,7 @@ uniform float uSceneEpsilon;
|
||||
|
||||
#ifdef USE_TEXTURES
|
||||
//! Unique 64-bit handles of OpenGL textures.
|
||||
uniform uvec2 uTextureSamplers[MAX_TEX_NUMBER];
|
||||
uniform sampler2D uTextureSamplers[MAX_TEX_NUMBER];
|
||||
#endif
|
||||
|
||||
//! Top color of gradient background.
|
||||
@@ -201,9 +201,9 @@ vec3 MatrixColMultiplyPnt (in vec3 v,
|
||||
in vec4 m2,
|
||||
in vec4 m3)
|
||||
{
|
||||
return vec3 (m0.x * v.x + m1.x * v.y + m2.x * v.z + m3.x,
|
||||
m0.y * v.x + m1.y * v.y + m2.y * v.z + m3.y,
|
||||
m0.z * v.x + m1.z * v.y + m2.z * v.z + m3.z);
|
||||
return vec3 (m0[0] * v.x + m1[0] * v.y + m2[0] * v.z + m3[0],
|
||||
m0[1] * v.x + m1[1] * v.y + m2[1] * v.z + m3[1],
|
||||
m0[2] * v.x + m1[2] * v.y + m2[2] * v.z + m3[2]);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -213,11 +213,12 @@ vec3 MatrixColMultiplyPnt (in vec3 v,
|
||||
vec3 MatrixColMultiplyDir (in vec3 v,
|
||||
in vec4 m0,
|
||||
in vec4 m1,
|
||||
in vec4 m2)
|
||||
in vec4 m2,
|
||||
in vec4 m3)
|
||||
{
|
||||
return vec3 (m0.x * v.x + m1.x * v.y + m2.x * v.z,
|
||||
m0.y * v.x + m1.y * v.y + m2.y * v.z,
|
||||
m0.z * v.x + m1.z * v.y + m2.z * v.z);
|
||||
return vec3 (m0[0] * v.x + m1[0] * v.y + m2[0] * v.z,
|
||||
m0[1] * v.x + m1[1] * v.y + m2[1] * v.z,
|
||||
m0[2] * v.x + m1[2] * v.y + m2[2] * v.z);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -352,53 +353,21 @@ float IntersectTriangle (in SRay theRay,
|
||||
//! Global stack shared between traversal functions.
|
||||
int Stack[STACK_SIZE];
|
||||
|
||||
#define MATERIAL_AMBN(index) (18 * index + 0)
|
||||
#define MATERIAL_DIFF(index) (18 * index + 1)
|
||||
#define MATERIAL_SPEC(index) (18 * index + 2)
|
||||
#define MATERIAL_EMIS(index) (18 * index + 3)
|
||||
#define MATERIAL_REFL(index) (18 * index + 4)
|
||||
#define MATERIAL_REFR(index) (18 * index + 5)
|
||||
#define MATERIAL_TRAN(index) (18 * index + 6)
|
||||
#define MATERIAL_TRS1(index) (18 * index + 7)
|
||||
#define MATERIAL_TRS2(index) (18 * index + 8)
|
||||
#define MATERIAL_TRS3(index) (18 * index + 9)
|
||||
|
||||
struct SSubTree
|
||||
{
|
||||
//! Transformed ray.
|
||||
SRay TrsfRay;
|
||||
|
||||
//! Inversed ray direction.
|
||||
vec3 Inverse;
|
||||
|
||||
//! Parameters of sub-root node.
|
||||
ivec4 SubData;
|
||||
};
|
||||
|
||||
#define TRS_OFFSET(treelet) treelet.SubData.x
|
||||
#define BVH_OFFSET(treelet) treelet.SubData.y
|
||||
#define VRT_OFFSET(treelet) treelet.SubData.z
|
||||
#define TRG_OFFSET(treelet) treelet.SubData.w
|
||||
|
||||
#define EMPTY_ROOT ivec4(0)
|
||||
|
||||
// =======================================================================
|
||||
// function : SceneNearestHit
|
||||
// purpose : Finds intersection with nearest scene triangle
|
||||
// function : ObjectNearestHit
|
||||
// purpose : Finds intersection with nearest object triangle
|
||||
// =======================================================================
|
||||
ivec4 SceneNearestHit (in SRay theRay, in vec3 theInverse, inout SIntersect theHit, out int theTrsfId)
|
||||
ivec4 ObjectNearestHit (in int theBVHOffset, in int theVrtOffset, in int theTrgOffset,
|
||||
in SRay theRay, in vec3 theInverse, inout SIntersect theHit, in int theSentinel)
|
||||
{
|
||||
int aHead = theSentinel; // stack pointer
|
||||
int aNode = theBVHOffset; // node to visit
|
||||
|
||||
ivec4 aTriIndex = INALID_HIT;
|
||||
|
||||
int aNode = 0; // node to traverse
|
||||
int aHead = -1; // pointer of stack
|
||||
int aStop = -1; // BVH level switch
|
||||
|
||||
SSubTree aSubTree = SSubTree (theRay, theInverse, EMPTY_ROOT);
|
||||
|
||||
for (bool toContinue = true; toContinue;)
|
||||
{
|
||||
ivec4 aData = texelFetch (uSceneNodeInfoTexture, aNode);
|
||||
ivec3 aData = texelFetch (uSceneNodeInfoTexture, aNode).xyz;
|
||||
|
||||
if (aData.x == 0) // if inner node
|
||||
{
|
||||
@@ -406,22 +375,22 @@ ivec4 SceneNearestHit (in SRay theRay, in vec3 theInverse, inout SIntersect theH
|
||||
float aTimeLft;
|
||||
float aTimeRgh;
|
||||
|
||||
aData.y += BVH_OFFSET (aSubTree);
|
||||
aData.z += BVH_OFFSET (aSubTree);
|
||||
aData.y += theBVHOffset;
|
||||
aData.z += theBVHOffset;
|
||||
|
||||
vec3 aNodeMinLft = texelFetch (uSceneMinPointTexture, aData.y).xyz;
|
||||
vec3 aNodeMinRgh = texelFetch (uSceneMinPointTexture, aData.z).xyz;
|
||||
vec3 aNodeMaxLft = texelFetch (uSceneMaxPointTexture, aData.y).xyz;
|
||||
vec3 aNodeMaxRgh = texelFetch (uSceneMaxPointTexture, aData.z).xyz;
|
||||
|
||||
vec3 aTime0 = (aNodeMinLft - aSubTree.TrsfRay.Origin) * aSubTree.Inverse;
|
||||
vec3 aTime1 = (aNodeMaxLft - aSubTree.TrsfRay.Origin) * aSubTree.Inverse;
|
||||
vec3 aTime0 = (aNodeMinLft - theRay.Origin) * theInverse;
|
||||
vec3 aTime1 = (aNodeMaxLft - theRay.Origin) * theInverse;
|
||||
|
||||
vec3 aTimeMax = max (aTime0, aTime1);
|
||||
vec3 aTimeMin = min (aTime0, aTime1);
|
||||
|
||||
aTime0 = (aNodeMinRgh - aSubTree.TrsfRay.Origin) * aSubTree.Inverse;
|
||||
aTime1 = (aNodeMaxRgh - aSubTree.TrsfRay.Origin) * aSubTree.Inverse;
|
||||
aTime0 = (aNodeMinRgh - theRay.Origin) * theInverse;
|
||||
aTime1 = (aNodeMaxRgh - theRay.Origin) * theInverse;
|
||||
|
||||
aTimeOut = min (aTimeMax.x, min (aTimeMax.y, aTimeMax.z));
|
||||
aTimeLft = max (aTimeMin.x, max (aTimeMin.y, aTimeMin.z));
|
||||
@@ -436,107 +405,88 @@ ivec4 SceneNearestHit (in SRay theRay, in vec3 theInverse, inout SIntersect theH
|
||||
|
||||
int aHitRgh = int(aTimeRgh <= aTimeOut) & int(aTimeOut >= 0.0f) & int(aTimeRgh <= theHit.Time);
|
||||
|
||||
aNode = (aHitLft != 0) ? aData.y : aData.z;
|
||||
|
||||
if (aHitLft + aHitRgh == 2) // hit both children
|
||||
if (bool(aHitLft & aHitRgh))
|
||||
{
|
||||
aNode = (aTimeLft < aTimeRgh) ? aData.y : aData.z;
|
||||
|
||||
Stack[++aHead] = (aTimeLft < aTimeRgh) ? aData.z : aData.y;
|
||||
}
|
||||
else if (aHitLft == aHitRgh) // no hit
|
||||
else
|
||||
{
|
||||
toContinue = (aHead >= 0);
|
||||
|
||||
if (aHead == aStop) // go to top-level BVH
|
||||
if (bool(aHitLft | aHitRgh))
|
||||
{
|
||||
aStop = -1; aSubTree = SSubTree (theRay, theInverse, EMPTY_ROOT);
|
||||
aNode = bool(aHitLft) ? aData.y : aData.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
toContinue = (aHead != theSentinel);
|
||||
|
||||
aNode = Stack[abs (aHead)]; --aHead;
|
||||
if (toContinue)
|
||||
aNode = Stack[aHead--];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aData.x < 0) // leaf node (containg triangles)
|
||||
else // if leaf node
|
||||
{
|
||||
vec3 aNormal;
|
||||
vec2 aParams;
|
||||
|
||||
for (int anIdx = aData.y; anIdx <= aData.z; ++anIdx)
|
||||
{
|
||||
ivec4 aTriangle = texelFetch (uGeometryTriangTexture, anIdx + TRG_OFFSET (aSubTree));
|
||||
ivec4 aTriangle = texelFetch (uGeometryTriangTexture, anIdx + theTrgOffset);
|
||||
|
||||
vec3 aPoint0 = texelFetch (uGeometryVertexTexture, aTriangle.x += VRT_OFFSET (aSubTree)).xyz;
|
||||
vec3 aPoint1 = texelFetch (uGeometryVertexTexture, aTriangle.y += VRT_OFFSET (aSubTree)).xyz;
|
||||
vec3 aPoint2 = texelFetch (uGeometryVertexTexture, aTriangle.z += VRT_OFFSET (aSubTree)).xyz;
|
||||
vec3 aPoint0 = texelFetch (uGeometryVertexTexture, aTriangle.x += theVrtOffset).xyz;
|
||||
vec3 aPoint1 = texelFetch (uGeometryVertexTexture, aTriangle.y += theVrtOffset).xyz;
|
||||
vec3 aPoint2 = texelFetch (uGeometryVertexTexture, aTriangle.z += theVrtOffset).xyz;
|
||||
|
||||
float aTime = IntersectTriangle (aSubTree.TrsfRay,
|
||||
aPoint0, aPoint1, aPoint2, aParams, aNormal);
|
||||
float aTime = IntersectTriangle (theRay,
|
||||
aPoint0,
|
||||
aPoint1,
|
||||
aPoint2,
|
||||
aParams,
|
||||
aNormal);
|
||||
|
||||
if (aTime < theHit.Time)
|
||||
{
|
||||
aTriIndex = aTriangle;
|
||||
|
||||
theTrsfId = TRS_OFFSET (aSubTree);
|
||||
|
||||
theHit = SIntersect (aTime, aParams, aNormal);
|
||||
}
|
||||
}
|
||||
|
||||
toContinue = (aHead >= 0);
|
||||
toContinue = (aHead != theSentinel);
|
||||
|
||||
if (aHead == aStop) // go to top-level BVH
|
||||
{
|
||||
aStop = -1; aSubTree = SSubTree (theRay, theInverse, EMPTY_ROOT);
|
||||
}
|
||||
|
||||
aNode = Stack[abs (aHead)]; --aHead;
|
||||
}
|
||||
else if (aData.x > 0) // switch node
|
||||
{
|
||||
aSubTree.SubData = ivec4 (4 * aData.x - 4, aData.yzw); // store BVH sub-root
|
||||
|
||||
vec4 aInvTransf0 = texelFetch (uSceneTransformTexture, TRS_OFFSET (aSubTree) + 0);
|
||||
vec4 aInvTransf1 = texelFetch (uSceneTransformTexture, TRS_OFFSET (aSubTree) + 1);
|
||||
vec4 aInvTransf2 = texelFetch (uSceneTransformTexture, TRS_OFFSET (aSubTree) + 2);
|
||||
vec4 aInvTransf3 = texelFetch (uSceneTransformTexture, TRS_OFFSET (aSubTree) + 3);
|
||||
|
||||
aSubTree.TrsfRay.Direct = MatrixColMultiplyDir (theRay.Direct,
|
||||
aInvTransf0,
|
||||
aInvTransf1,
|
||||
aInvTransf2);
|
||||
|
||||
aSubTree.Inverse = mix (-UNIT, UNIT, step (ZERO, aSubTree.TrsfRay.Direct)) /
|
||||
max (abs (aSubTree.TrsfRay.Direct), SMALL);
|
||||
|
||||
aSubTree.TrsfRay.Origin = MatrixColMultiplyPnt (theRay.Origin,
|
||||
aInvTransf0,
|
||||
aInvTransf1,
|
||||
aInvTransf2,
|
||||
aInvTransf3);
|
||||
|
||||
aNode = BVH_OFFSET (aSubTree); // go to sub-root node
|
||||
|
||||
aStop = aHead; // store current stack pointer
|
||||
if (toContinue)
|
||||
aNode = Stack[aHead--];
|
||||
}
|
||||
}
|
||||
|
||||
return aTriIndex;
|
||||
}
|
||||
|
||||
#define MATERIAL_AMBN(index) (18 * index + 0)
|
||||
#define MATERIAL_DIFF(index) (18 * index + 1)
|
||||
#define MATERIAL_SPEC(index) (18 * index + 2)
|
||||
#define MATERIAL_EMIS(index) (18 * index + 3)
|
||||
#define MATERIAL_REFL(index) (18 * index + 4)
|
||||
#define MATERIAL_REFR(index) (18 * index + 5)
|
||||
#define MATERIAL_TRAN(index) (18 * index + 6)
|
||||
#define MATERIAL_TRS1(index) (18 * index + 7)
|
||||
#define MATERIAL_TRS2(index) (18 * index + 8)
|
||||
#define MATERIAL_TRS3(index) (18 * index + 9)
|
||||
|
||||
// =======================================================================
|
||||
// function : SceneAnyHit
|
||||
// purpose : Finds intersection with any scene triangle
|
||||
// function : ObjectAnyHit
|
||||
// purpose : Finds intersection with any object triangle
|
||||
// =======================================================================
|
||||
float SceneAnyHit (in SRay theRay, in vec3 theInverse, in float theDistance)
|
||||
float ObjectAnyHit (in int theBVHOffset, in int theVrtOffset, in int theTrgOffset,
|
||||
in SRay theRay, in vec3 theInverse, in float theDistance, in int theSentinel)
|
||||
{
|
||||
int aHead = theSentinel; // stack pointer
|
||||
int aNode = theBVHOffset; // node to visit
|
||||
|
||||
float aFactor = 1.f;
|
||||
|
||||
int aNode = 0; // node to traverse
|
||||
int aHead = -1; // pointer of stack
|
||||
int aStop = -1; // BVH level switch
|
||||
|
||||
SSubTree aSubTree = SSubTree (theRay, theInverse, EMPTY_ROOT);
|
||||
|
||||
for (bool toContinue = true; toContinue;)
|
||||
{
|
||||
ivec4 aData = texelFetch (uSceneNodeInfoTexture, aNode);
|
||||
@@ -547,22 +497,22 @@ float SceneAnyHit (in SRay theRay, in vec3 theInverse, in float theDistance)
|
||||
float aTimeLft;
|
||||
float aTimeRgh;
|
||||
|
||||
aData.y += BVH_OFFSET (aSubTree);
|
||||
aData.z += BVH_OFFSET (aSubTree);
|
||||
aData.y += theBVHOffset;
|
||||
aData.z += theBVHOffset;
|
||||
|
||||
vec3 aNodeMinLft = texelFetch (uSceneMinPointTexture, aData.y).xyz;
|
||||
vec3 aNodeMinRgh = texelFetch (uSceneMinPointTexture, aData.z).xyz;
|
||||
vec3 aNodeMaxLft = texelFetch (uSceneMaxPointTexture, aData.y).xyz;
|
||||
vec3 aNodeMinRgh = texelFetch (uSceneMinPointTexture, aData.z).xyz;
|
||||
vec3 aNodeMaxRgh = texelFetch (uSceneMaxPointTexture, aData.z).xyz;
|
||||
|
||||
vec3 aTime0 = (aNodeMinLft - aSubTree.TrsfRay.Origin) * aSubTree.Inverse;
|
||||
vec3 aTime1 = (aNodeMaxLft - aSubTree.TrsfRay.Origin) * aSubTree.Inverse;
|
||||
vec3 aTime0 = (aNodeMinLft - theRay.Origin) * theInverse;
|
||||
vec3 aTime1 = (aNodeMaxLft - theRay.Origin) * theInverse;
|
||||
|
||||
vec3 aTimeMax = max (aTime0, aTime1);
|
||||
vec3 aTimeMin = min (aTime0, aTime1);
|
||||
|
||||
aTime0 = (aNodeMinRgh - aSubTree.TrsfRay.Origin) * aSubTree.Inverse;
|
||||
aTime1 = (aNodeMaxRgh - aSubTree.TrsfRay.Origin) * aSubTree.Inverse;
|
||||
aTime0 = (aNodeMinRgh - theRay.Origin) * theInverse;
|
||||
aTime1 = (aNodeMaxRgh - theRay.Origin) * theInverse;
|
||||
|
||||
aTimeOut = min (aTimeMax.x, min (aTimeMax.y, aTimeMax.z));
|
||||
aTimeLft = max (aTimeMin.x, max (aTimeMin.y, aTimeMin.z));
|
||||
@@ -577,41 +527,46 @@ float SceneAnyHit (in SRay theRay, in vec3 theInverse, in float theDistance)
|
||||
|
||||
int aHitRgh = int(aTimeRgh <= aTimeOut) & int(aTimeOut >= 0.0f) & int(aTimeRgh <= theDistance);
|
||||
|
||||
aNode = (aHitLft != 0) ? aData.y : aData.z;
|
||||
|
||||
if (aHitLft + aHitRgh == 2) // hit both children
|
||||
if (bool(aHitLft & aHitRgh))
|
||||
{
|
||||
aNode = (aTimeLft < aTimeRgh) ? aData.y : aData.z;
|
||||
|
||||
Stack[++aHead] = (aTimeLft < aTimeRgh) ? aData.z : aData.y;
|
||||
}
|
||||
else if (aHitLft == aHitRgh) // no hit
|
||||
else
|
||||
{
|
||||
toContinue = (aHead >= 0);
|
||||
|
||||
if (aHead == aStop) // go to top-level BVH
|
||||
if (bool(aHitLft | aHitRgh))
|
||||
{
|
||||
aStop = -1; aSubTree = SSubTree (theRay, theInverse, EMPTY_ROOT);
|
||||
aNode = bool(aHitLft) ? aData.y : aData.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
toContinue = (aHead != theSentinel);
|
||||
|
||||
aNode = Stack[abs (aHead)]; --aHead;
|
||||
if (toContinue)
|
||||
aNode = Stack[aHead--];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aData.x < 0) // leaf node
|
||||
else // if leaf node
|
||||
{
|
||||
vec3 aNormal;
|
||||
vec2 aParams;
|
||||
|
||||
for (int anIdx = aData.y; anIdx <= aData.z; ++anIdx)
|
||||
{
|
||||
ivec4 aTriangle = texelFetch (uGeometryTriangTexture, anIdx + TRG_OFFSET (aSubTree));
|
||||
ivec4 aTriangle = texelFetch (uGeometryTriangTexture, anIdx + theTrgOffset);
|
||||
|
||||
vec3 aPoint0 = texelFetch (uGeometryVertexTexture, aTriangle.x += VRT_OFFSET (aSubTree)).xyz;
|
||||
vec3 aPoint1 = texelFetch (uGeometryVertexTexture, aTriangle.y += VRT_OFFSET (aSubTree)).xyz;
|
||||
vec3 aPoint2 = texelFetch (uGeometryVertexTexture, aTriangle.z += VRT_OFFSET (aSubTree)).xyz;
|
||||
vec3 aPoint0 = texelFetch (uGeometryVertexTexture, aTriangle.x + theVrtOffset).xyz;
|
||||
vec3 aPoint1 = texelFetch (uGeometryVertexTexture, aTriangle.y + theVrtOffset).xyz;
|
||||
vec3 aPoint2 = texelFetch (uGeometryVertexTexture, aTriangle.z + theVrtOffset).xyz;
|
||||
|
||||
float aTime = IntersectTriangle (aSubTree.TrsfRay,
|
||||
aPoint0, aPoint1, aPoint2, aParams, aNormal);
|
||||
float aTime = IntersectTriangle (theRay,
|
||||
aPoint0,
|
||||
aPoint1,
|
||||
aPoint2,
|
||||
aParams,
|
||||
aNormal);
|
||||
|
||||
#ifdef TRANSPARENT_SHADOWS
|
||||
if (aTime < theDistance)
|
||||
@@ -626,40 +581,238 @@ float SceneAnyHit (in SRay theRay, in vec3 theInverse, in float theDistance)
|
||||
#endif
|
||||
}
|
||||
|
||||
toContinue = (aHead >= 0) && (aFactor > 0.1f);
|
||||
toContinue = (aHead != theSentinel) && (aFactor > 0.1f);
|
||||
|
||||
if (aHead == aStop) // go to top-level BVH
|
||||
if (toContinue)
|
||||
aNode = Stack[aHead--];
|
||||
}
|
||||
}
|
||||
|
||||
return aFactor;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SceneNearestHit
|
||||
// purpose : Finds intersection with nearest scene triangle
|
||||
// =======================================================================
|
||||
ivec4 SceneNearestHit (in SRay theRay, in vec3 theInverse, inout SIntersect theHit, out int theTrsfId)
|
||||
{
|
||||
int aHead = -1; // stack pointer
|
||||
int aNode = 0; // node to visit
|
||||
|
||||
ivec4 aHitObject = INALID_HIT;
|
||||
|
||||
for (bool toContinue = true; toContinue;)
|
||||
{
|
||||
ivec4 aData = texelFetch (uSceneNodeInfoTexture, aNode);
|
||||
|
||||
if (aData.x != 0) // if leaf node
|
||||
{
|
||||
vec3 aNodeMin = texelFetch (uSceneMinPointTexture, aNode).xyz;
|
||||
vec3 aNodeMax = texelFetch (uSceneMaxPointTexture, aNode).xyz;
|
||||
|
||||
vec3 aTime0 = (aNodeMin - theRay.Origin) * theInverse;
|
||||
vec3 aTime1 = (aNodeMax - theRay.Origin) * theInverse;
|
||||
|
||||
vec3 aTimes = min (aTime0, aTime1);
|
||||
|
||||
if (max (aTimes.x, max (aTimes.y, aTimes.z)) < theHit.Time)
|
||||
{
|
||||
aStop = -1; aSubTree = SSubTree (theRay, theInverse, EMPTY_ROOT);
|
||||
// fetch object transformation
|
||||
int aTrsfId = (aData.x - 1) * 4;
|
||||
|
||||
vec4 aInvTransf0 = texelFetch (uSceneTransformTexture, aTrsfId + 0);
|
||||
vec4 aInvTransf1 = texelFetch (uSceneTransformTexture, aTrsfId + 1);
|
||||
vec4 aInvTransf2 = texelFetch (uSceneTransformTexture, aTrsfId + 2);
|
||||
vec4 aInvTransf3 = texelFetch (uSceneTransformTexture, aTrsfId + 3);
|
||||
|
||||
SRay aTrsfRay = SRay (
|
||||
MatrixColMultiplyPnt (theRay.Origin, aInvTransf0, aInvTransf1, aInvTransf2, aInvTransf3),
|
||||
MatrixColMultiplyDir (theRay.Direct, aInvTransf0, aInvTransf1, aInvTransf2, aInvTransf3));
|
||||
|
||||
vec3 aTrsfInverse = 1.0f / max (abs (aTrsfRay.Direct), SMALL);
|
||||
|
||||
aTrsfInverse = mix (-aTrsfInverse, aTrsfInverse, step (ZERO, aTrsfRay.Direct));
|
||||
|
||||
ivec4 aTriIndex = ObjectNearestHit (
|
||||
aData.y, aData.z, aData.w, aTrsfRay, aTrsfInverse, theHit, aHead);
|
||||
|
||||
if (aTriIndex.x != -1)
|
||||
{
|
||||
aHitObject = ivec4 (aTriIndex.x, // vertex 0
|
||||
aTriIndex.y, // vertex 1
|
||||
aTriIndex.z, // vertex 2
|
||||
aTriIndex.w); // material
|
||||
|
||||
theTrsfId = aTrsfId;
|
||||
}
|
||||
}
|
||||
|
||||
aNode = Stack[abs (aHead)]; --aHead;
|
||||
toContinue = aHead >= 0;
|
||||
|
||||
if (toContinue)
|
||||
aNode = Stack[aHead--];
|
||||
}
|
||||
else if (aData.x > 0) // switch node
|
||||
else // if inner node
|
||||
{
|
||||
aSubTree.SubData = ivec4 (4 * aData.x - 4, aData.yzw); // store BVH sub-root
|
||||
float aTimeOut;
|
||||
float aTimeLft;
|
||||
float aTimeRgh;
|
||||
|
||||
vec4 aInvTransf0 = texelFetch (uSceneTransformTexture, TRS_OFFSET (aSubTree) + 0);
|
||||
vec4 aInvTransf1 = texelFetch (uSceneTransformTexture, TRS_OFFSET (aSubTree) + 1);
|
||||
vec4 aInvTransf2 = texelFetch (uSceneTransformTexture, TRS_OFFSET (aSubTree) + 2);
|
||||
vec4 aInvTransf3 = texelFetch (uSceneTransformTexture, TRS_OFFSET (aSubTree) + 3);
|
||||
vec3 aNodeMinLft = texelFetch (uSceneMinPointTexture, aData.y).xyz;
|
||||
vec3 aNodeMaxLft = texelFetch (uSceneMaxPointTexture, aData.y).xyz;
|
||||
vec3 aNodeMinRgh = texelFetch (uSceneMinPointTexture, aData.z).xyz;
|
||||
vec3 aNodeMaxRgh = texelFetch (uSceneMaxPointTexture, aData.z).xyz;
|
||||
|
||||
aSubTree.TrsfRay.Direct = MatrixColMultiplyDir (theRay.Direct,
|
||||
aInvTransf0,
|
||||
aInvTransf1,
|
||||
aInvTransf2);
|
||||
vec3 aTime0 = (aNodeMinLft - theRay.Origin) * theInverse;
|
||||
vec3 aTime1 = (aNodeMaxLft - theRay.Origin) * theInverse;
|
||||
|
||||
aSubTree.TrsfRay.Origin = MatrixColMultiplyPnt (theRay.Origin,
|
||||
aInvTransf0,
|
||||
aInvTransf1,
|
||||
aInvTransf2,
|
||||
aInvTransf3);
|
||||
vec3 aTimeMax = max (aTime0, aTime1);
|
||||
vec3 aTimeMin = min (aTime0, aTime1);
|
||||
|
||||
aSubTree.Inverse = mix (-UNIT, UNIT, step (ZERO, aSubTree.TrsfRay.Direct)) / max (abs (aSubTree.TrsfRay.Direct), SMALL);
|
||||
aTimeOut = min (aTimeMax.x, min (aTimeMax.y, aTimeMax.z));
|
||||
aTimeLft = max (aTimeMin.x, max (aTimeMin.y, aTimeMin.z));
|
||||
|
||||
aNode = BVH_OFFSET (aSubTree); // go to sub-root node
|
||||
int aHitLft = int(aTimeLft <= aTimeOut) & int(aTimeOut >= 0.0f) & int(aTimeLft <= theHit.Time);
|
||||
|
||||
aStop = aHead; // store current stack pointer
|
||||
aTime0 = (aNodeMinRgh - theRay.Origin) * theInverse;
|
||||
aTime1 = (aNodeMaxRgh - theRay.Origin) * theInverse;
|
||||
|
||||
aTimeMax = max (aTime0, aTime1);
|
||||
aTimeMin = min (aTime0, aTime1);
|
||||
|
||||
aTimeOut = min (aTimeMax.x, min (aTimeMax.y, aTimeMax.z));
|
||||
aTimeRgh = max (aTimeMin.x, max (aTimeMin.y, aTimeMin.z));
|
||||
|
||||
int aHitRgh = int(aTimeRgh <= aTimeOut) & int(aTimeOut >= 0.0f) & int(aTimeRgh <= theHit.Time);
|
||||
|
||||
if (bool(aHitLft & aHitRgh))
|
||||
{
|
||||
aNode = (aTimeLft < aTimeRgh) ? aData.y : aData.z;
|
||||
|
||||
Stack[++aHead] = (aTimeLft < aTimeRgh) ? aData.z : aData.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bool(aHitLft | aHitRgh))
|
||||
{
|
||||
aNode = bool(aHitLft) ? aData.y : aData.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
toContinue = aHead >= 0;
|
||||
|
||||
if (toContinue)
|
||||
aNode = Stack[aHead--];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return aHitObject;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SceneAnyHit
|
||||
// purpose : Finds intersection with any scene triangle
|
||||
// =======================================================================
|
||||
float SceneAnyHit (in SRay theRay, in vec3 theInverse, in float theDistance)
|
||||
{
|
||||
int aHead = -1; // stack pointer
|
||||
int aNode = 0; // node to visit
|
||||
|
||||
float aFactor = 1.f;
|
||||
|
||||
for (bool toContinue = true; toContinue;)
|
||||
{
|
||||
ivec4 aData = texelFetch (uSceneNodeInfoTexture, aNode);
|
||||
|
||||
if (aData.x != 0) // if leaf node
|
||||
{
|
||||
// fetch object transformation
|
||||
int aTrsfId = (aData.x - 1) * 4;
|
||||
|
||||
vec4 aInvTransf0 = texelFetch (uSceneTransformTexture, aTrsfId + 0);
|
||||
vec4 aInvTransf1 = texelFetch (uSceneTransformTexture, aTrsfId + 1);
|
||||
vec4 aInvTransf2 = texelFetch (uSceneTransformTexture, aTrsfId + 2);
|
||||
vec4 aInvTransf3 = texelFetch (uSceneTransformTexture, aTrsfId + 3);
|
||||
|
||||
SRay aTrsfRay = SRay (
|
||||
MatrixColMultiplyPnt (theRay.Origin, aInvTransf0, aInvTransf1, aInvTransf2, aInvTransf3),
|
||||
MatrixColMultiplyDir (theRay.Direct, aInvTransf0, aInvTransf1, aInvTransf2, aInvTransf3));
|
||||
|
||||
vec3 aTrsfInverse = 1.0f / max (abs (aTrsfRay.Direct), SMALL);
|
||||
|
||||
aTrsfInverse = mix (-aTrsfInverse, aTrsfInverse, step (ZERO, aTrsfRay.Direct));
|
||||
|
||||
#ifdef TRANSPARENT_SHADOWS
|
||||
aFactor *= ObjectAnyHit (
|
||||
aData.y, aData.z, aData.w, aTrsfRay, aTrsfInverse, theDistance, aHead);
|
||||
|
||||
toContinue = aHead >= 0 && aFactor >= 0.1f;
|
||||
#else
|
||||
aFactor = ObjectAnyHit (
|
||||
aData.y, aData.z, aData.w, aTrsfRay, aTrsfInverse, theDistance, aHead);
|
||||
|
||||
toContinue = aHead >= 0 && aFactor != 0.0f;
|
||||
#endif
|
||||
|
||||
if (toContinue)
|
||||
aNode = Stack[aHead--];
|
||||
}
|
||||
else // if inner node
|
||||
{
|
||||
float aTimeOut;
|
||||
float aTimeLft;
|
||||
float aTimeRgh;
|
||||
|
||||
vec3 aNodeMinLft = texelFetch (uSceneMinPointTexture, aData.y).xyz;
|
||||
vec3 aNodeMaxLft = texelFetch (uSceneMaxPointTexture, aData.y).xyz;
|
||||
vec3 aNodeMinRgh = texelFetch (uSceneMinPointTexture, aData.z).xyz;
|
||||
vec3 aNodeMaxRgh = texelFetch (uSceneMaxPointTexture, aData.z).xyz;
|
||||
|
||||
vec3 aTime0 = (aNodeMinLft - theRay.Origin) * theInverse;
|
||||
vec3 aTime1 = (aNodeMaxLft - theRay.Origin) * theInverse;
|
||||
|
||||
vec3 aTimeMax = max (aTime0, aTime1);
|
||||
vec3 aTimeMin = min (aTime0, aTime1);
|
||||
|
||||
aTimeOut = min (aTimeMax.x, min (aTimeMax.y, aTimeMax.z));
|
||||
aTimeLft = max (aTimeMin.x, max (aTimeMin.y, aTimeMin.z));
|
||||
|
||||
int aHitLft = int(aTimeLft <= aTimeOut) & int(aTimeOut >= 0.0f) & int(aTimeLft <= theDistance);
|
||||
|
||||
aTime0 = (aNodeMinRgh - theRay.Origin) * theInverse;
|
||||
aTime1 = (aNodeMaxRgh - theRay.Origin) * theInverse;
|
||||
|
||||
aTimeMax = max (aTime0, aTime1);
|
||||
aTimeMin = min (aTime0, aTime1);
|
||||
|
||||
aTimeOut = min (aTimeMax.x, min (aTimeMax.y, aTimeMax.z));
|
||||
aTimeRgh = max (aTimeMin.x, max (aTimeMin.y, aTimeMin.z));
|
||||
|
||||
int aHitRgh = int(aTimeRgh <= aTimeOut) & int(aTimeOut >= 0.0f) & int(aTimeRgh <= theDistance);
|
||||
|
||||
if (bool(aHitLft & aHitRgh))
|
||||
{
|
||||
aNode = (aTimeLft < aTimeRgh) ? aData.y : aData.z;
|
||||
|
||||
Stack[++aHead] = (aTimeLft < aTimeRgh) ? aData.z : aData.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bool(aHitLft | aHitRgh))
|
||||
{
|
||||
aNode = bool(aHitLft) ? aData.y : aData.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
toContinue = aHead >= 0;
|
||||
|
||||
if (toContinue)
|
||||
aNode = Stack[aHead--];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,7 +1013,7 @@ vec4 Radiance (in SRay theRay, in vec3 theInverse)
|
||||
dot (aTrsfRow2, aTexCoord));
|
||||
|
||||
vec3 aTexColor = textureLod (
|
||||
sampler2D (uTextureSamplers[int(aDiffuse.w)]), aTexCoord.st, 0.f).rgb;
|
||||
uTextureSamplers[int(aDiffuse.w)], aTexCoord.st, 0.f).rgb;
|
||||
|
||||
aDiffuse.rgb *= aTexColor;
|
||||
aAmbient.rgb *= aTexColor;
|
||||
|
@@ -132,7 +132,7 @@ public:
|
||||
//! If the standard projector fails, internal one is used.
|
||||
Standard_EXPORT Standard_Boolean PerformAdvanced (Handle(Geom_Curve)& c3d, const Standard_Real First, const Standard_Real Last, Handle(Geom2d_Curve)& c2d);
|
||||
|
||||
|
||||
Standard_EXPORT Standard_Boolean ApproxPCurve (const Standard_Integer nbrPnt, const TColgp_Array1OfPnt& points, const TColStd_Array1OfReal& params, TColgp_Array1OfPnt2d& points2d, Handle(Geom2d_Curve)& c2d);
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTI(ShapeConstruct_ProjectCurveOnSurface,MMgt_TShared)
|
||||
@@ -164,8 +164,6 @@ private:
|
||||
|
||||
Standard_EXPORT Handle(Geom2d_Curve) ProjectAnalytic (const Handle(Geom_Curve)& c3d) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean ApproxPCurve (const Standard_Integer nbrPnt, const TColgp_Array1OfPnt& points, const TColStd_Array1OfReal& params, TColgp_Array1OfPnt2d& points2d, Handle(Geom2d_Curve)& c2d);
|
||||
|
||||
Standard_EXPORT Handle(Geom2d_Curve) InterpolatePCurve (const Standard_Integer nbrPnt, Handle(TColgp_HArray1OfPnt2d)& points2d, Handle(TColStd_HArray1OfReal)& params, const Handle(Geom_Curve)& orig) const;
|
||||
|
||||
Standard_EXPORT Handle(Geom2d_Curve) ApproximatePCurve (const Standard_Integer nbrPnt, Handle(TColgp_HArray1OfPnt2d)& points2d, Handle(TColStd_HArray1OfReal)& params, const Handle(Geom_Curve)& orig) const;
|
||||
|
@@ -614,48 +614,24 @@ static Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& aChain, Topo
|
||||
Handle(Geom_Circle) Cir = Handle(Geom_Circle)::DownCast(c3d);
|
||||
|
||||
TopoDS_Vertex V1 = sae.FirstVertex(FE);
|
||||
gp_Pnt PV1 = BRep_Tool::Pnt(V1);
|
||||
TopoDS_Vertex V2 = sae.LastVertex(TopoDS::Edge(aChain.Last()));
|
||||
gp_Pnt PV2 = BRep_Tool::Pnt(V2);
|
||||
TopoDS_Vertex VM = sae.LastVertex(FE);
|
||||
gp_Pnt PVM = BRep_Tool::Pnt(VM);
|
||||
GC_MakeCircle MC (PV1,PVM,PV2);
|
||||
TopoDS_Edge E;
|
||||
if (V1.IsSame(V2)) {
|
||||
if (!MC.IsDone() || MC.Value().IsNull()) {
|
||||
// jfa for Mantis issue 0020228
|
||||
if (PV1.Distance(PV2) > Precision::Confusion())
|
||||
return Standard_False;
|
||||
// closed chain
|
||||
BRepAdaptor_Curve adef(FE);
|
||||
Handle(Geom_Circle) Cir1;
|
||||
double FP, LP;
|
||||
if ( FE.Orientation() == TopAbs_FORWARD)
|
||||
{
|
||||
FP = adef.FirstParameter();
|
||||
LP = adef.LastParameter();
|
||||
}
|
||||
else
|
||||
{
|
||||
FP = adef.LastParameter();
|
||||
LP = adef.FirstParameter();
|
||||
}
|
||||
if (Abs(FP) < Precision::PConfusion())
|
||||
{
|
||||
B.MakeEdge (E,Cir, Precision::Confusion());
|
||||
B.Add(E,V1);
|
||||
B.Add(E,V2);
|
||||
E.Orientation(FE.Orientation());
|
||||
}
|
||||
else
|
||||
{
|
||||
GC_MakeCircle MC1 (adef.Value(FP), adef.Value((FP + LP) * 0.5), adef.Value(LP));
|
||||
if (MC1.IsDone())
|
||||
Cir1 = MC1.Value();
|
||||
else
|
||||
return Standard_False;
|
||||
B.MakeEdge (E, Cir1, Precision::Confusion());
|
||||
B.Add(E,V1);
|
||||
B.Add(E,V2);
|
||||
}
|
||||
B.MakeEdge (E,Cir,Precision::Confusion());
|
||||
B.Add(E,V1);
|
||||
B.Add(E,V2);
|
||||
E.Orientation(FE.Orientation());
|
||||
}
|
||||
else {
|
||||
gp_Pnt PV1 = BRep_Tool::Pnt(V1);
|
||||
gp_Pnt PV2 = BRep_Tool::Pnt(V2);
|
||||
TopoDS_Vertex VM = sae.LastVertex(FE);
|
||||
gp_Pnt PVM = BRep_Tool::Pnt(VM);
|
||||
GC_MakeCircle MC (PV1,PVM,PV2);
|
||||
Handle(Geom_Circle) C = MC.Value();
|
||||
gp_Pnt P0 = C->Location();
|
||||
gp_Dir D1(gp_Vec(P0,PV1));
|
||||
|
@@ -26,6 +26,8 @@ StdPrs_ToolPoint.hxx
|
||||
StdPrs_ToolRFace.cxx
|
||||
StdPrs_ToolRFace.hxx
|
||||
StdPrs_ToolTriangulatedShape.cxx
|
||||
StdPrs_ToolTriangulatedShape.cxx
|
||||
StdPrs_ToolTriangulatedShape.hxx
|
||||
StdPrs_ToolTriangulatedShape.hxx
|
||||
StdPrs_ToolVertex.cxx
|
||||
StdPrs_ToolVertex.hxx
|
||||
@@ -38,6 +40,7 @@ StdPrs_WFDeflectionSurface.hxx
|
||||
StdPrs_WFPoleSurface.cxx
|
||||
StdPrs_WFPoleSurface.hxx
|
||||
StdPrs_WFRestrictedFace.cxx
|
||||
StdPrs_WFRestrictedFace.cxx
|
||||
StdPrs_WFRestrictedFace.hxx
|
||||
StdPrs_WFShape.cxx
|
||||
StdPrs_WFShape.hxx
|
||||
|
@@ -69,8 +69,6 @@ Handle(StepShape_Vertex) StepShape_OrientedEdge::EdgeStart() const
|
||||
{
|
||||
// WARNING : the field is redefined.
|
||||
// method body is not yet automaticly wrote
|
||||
if (edgeElement.IsNull())
|
||||
return NULL;
|
||||
if (Orientation()) {
|
||||
return edgeElement->EdgeStart();
|
||||
}
|
||||
@@ -90,8 +88,7 @@ Handle(StepShape_Vertex) StepShape_OrientedEdge::EdgeEnd() const
|
||||
{
|
||||
// WARNING : the field is redefined.
|
||||
// method body is not yet automaticly wrote
|
||||
if (edgeElement.IsNull())
|
||||
return NULL;
|
||||
|
||||
if (Orientation()) {
|
||||
return edgeElement->EdgeEnd();
|
||||
}
|
||||
|
@@ -77,8 +77,6 @@
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <StepGeom_RectangularTrimmedSurface.hxx>
|
||||
#include <StepGeom_ToroidalSurface.hxx>
|
||||
|
||||
//#3 rln 16/02/98
|
||||
//#include <GeomAdaptor_Curve.hxx>
|
||||
@@ -115,18 +113,6 @@ StepToTopoDS_TranslateFace::StepToTopoDS_TranslateFace
|
||||
// Purpose : Init with a FaceSurface and a Tool
|
||||
// ============================================================================
|
||||
|
||||
static inline Standard_Boolean isReversed(const Handle(StepGeom_Surface)& theStepSurf)
|
||||
{
|
||||
Handle(StepGeom_ToroidalSurface) aStepTorSur;
|
||||
if(theStepSurf->IsKind(STANDARD_TYPE(StepGeom_RectangularTrimmedSurface)))
|
||||
return isReversed(Handle(StepGeom_RectangularTrimmedSurface)::DownCast(theStepSurf)->BasisSurface());
|
||||
|
||||
else
|
||||
aStepTorSur = Handle(StepGeom_ToroidalSurface)::DownCast(theStepSurf);
|
||||
|
||||
return (!aStepTorSur.IsNull() && aStepTorSur->MajorRadius() < 0 ? Standard_True : Standard_False);
|
||||
}
|
||||
|
||||
void StepToTopoDS_TranslateFace::Init
|
||||
(const Handle(StepShape_FaceSurface)& FS, StepToTopoDS_Tool& aTool, StepToTopoDS_NMTool& NMTool)
|
||||
{
|
||||
@@ -198,12 +184,8 @@ void StepToTopoDS_TranslateFace::Init
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean sameSenseFace = FS->SameSense();
|
||||
Standard_Boolean sameSense = FS->SameSense();
|
||||
|
||||
//fix for bug 0026376 Solid Works wrote face based on toroidal surface having negative major radius
|
||||
//seems that such case is interpreted by "Solid Works" and "ProE" as face having reversed orientation.
|
||||
Standard_Boolean sameSense = (isReversed(StepSurf) ? !sameSenseFace : sameSenseFace);
|
||||
|
||||
// -- Statistics --
|
||||
aTool.AddContinuity (GeomSurf);
|
||||
|
||||
|
@@ -9,4 +9,4 @@ set (TOOLKIT_MODULES
|
||||
BOPTools
|
||||
)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
include(${OCCT_SOURCE_DIR}/adm/cmake/occt_toolkit.cmake)
|
||||
|
@@ -11,4 +11,4 @@ set (TOOLKIT_MODULES
|
||||
BinTools
|
||||
)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
include(${OCCT_SOURCE_DIR}/adm/cmake/occt_toolkit.cmake)
|
||||
|
@@ -7,4 +7,4 @@ set (TOOLKIT_MODULES
|
||||
BinMNaming
|
||||
)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
include(${OCCT_SOURCE_DIR}/adm/cmake/occt_toolkit.cmake)
|
||||
|
@@ -9,4 +9,4 @@ set (TOOLKIT_MODULES
|
||||
BinLDrivers
|
||||
)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
include(${OCCT_SOURCE_DIR}/adm/cmake/occt_toolkit.cmake)
|
||||
|
@@ -4,4 +4,4 @@ set (TOOLKIT_MODULES
|
||||
BinTObjDrivers
|
||||
)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
include(${OCCT_SOURCE_DIR}/adm/cmake/occt_toolkit.cmake)
|
||||
|
@@ -5,4 +5,4 @@ set (TOOLKIT_MODULES
|
||||
BinMXCAFDoc
|
||||
)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
include(${OCCT_SOURCE_DIR}/adm/cmake/occt_toolkit.cmake)
|
||||
|
@@ -10,4 +10,4 @@ set (TOOLKIT_MODULES
|
||||
BRepProj
|
||||
)
|
||||
|
||||
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
|
||||
include(${OCCT_SOURCE_DIR}/adm/cmake/occt_toolkit.cmake)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user