Compare commits
104 Commits
OpenSceneG
...
OpenSceneG
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a827840baf | ||
|
|
35f3876797 | ||
|
|
2e0472ba7e | ||
|
|
36e47d31bd | ||
|
|
994ea4d203 | ||
|
|
54ac72a126 | ||
|
|
6559295768 | ||
|
|
9b41f260d9 | ||
|
|
7a442801cd | ||
|
|
f3c615631b | ||
|
|
62cd8850e2 | ||
|
|
14e7bc5a17 | ||
|
|
5ac3a982ae | ||
|
|
a90a9a0a15 | ||
|
|
995e849e8a | ||
|
|
ddb72691bc | ||
|
|
817d92b703 | ||
|
|
8fb5ba4a3f | ||
|
|
3ef5d2b331 | ||
|
|
c64b94da2e | ||
|
|
19cf8b46c3 | ||
|
|
2568d1ac79 | ||
|
|
84ee98d9c4 | ||
|
|
49921bf300 | ||
|
|
b063f510c1 | ||
|
|
396cfca1ae | ||
|
|
aebc71a113 | ||
|
|
d8896f4bcb | ||
|
|
b2b6ee952b | ||
|
|
fbe4e1cf2f | ||
|
|
2b9c501e18 | ||
|
|
3930621edc | ||
|
|
9305485a11 | ||
|
|
9e75926338 | ||
|
|
d969516595 | ||
|
|
457d12d9b2 | ||
|
|
61c7ee76c5 | ||
|
|
605821e655 | ||
|
|
d1ff16614c | ||
|
|
8551f25da0 | ||
|
|
315031fa3b | ||
|
|
f4fe1e5cec | ||
|
|
7e8665308d | ||
|
|
c50b699992 | ||
|
|
cd5740e98f | ||
|
|
023bfb8bbb | ||
|
|
c5ff9e63df | ||
|
|
e5e5ea6239 | ||
|
|
9ae47b921b | ||
|
|
994b066329 | ||
|
|
ad82aea2e3 | ||
|
|
5f2a3ef76f | ||
|
|
2e7a7d786a | ||
|
|
67523373a9 | ||
|
|
f38fa9e9c3 | ||
|
|
99b2fffa7c | ||
|
|
3fbf24759f | ||
|
|
d215b255c4 | ||
|
|
51fee80224 | ||
|
|
fefabb6c2b | ||
|
|
27e3f57da2 | ||
|
|
56835cf821 | ||
|
|
445596e59c | ||
|
|
c0ea4c6310 | ||
|
|
ddea94b41c | ||
|
|
5f1e33fcb3 | ||
|
|
46e17699b3 | ||
|
|
38807c4bb8 | ||
|
|
987521ba9c | ||
|
|
6776cc2c63 | ||
|
|
3fe2e5a9e0 | ||
|
|
0d94d8e5a6 | ||
|
|
c8e283cfe9 | ||
|
|
b1314c0fb8 | ||
|
|
a86b90ca4a | ||
|
|
bc3372fda0 | ||
|
|
6477397b95 | ||
|
|
8f6eff9de5 | ||
|
|
c4e7a07367 | ||
|
|
23b7c4d47d | ||
|
|
a9900712a4 | ||
|
|
6774f77779 | ||
|
|
5516f86f9e | ||
|
|
a9546da368 | ||
|
|
415925b024 | ||
|
|
30aae63c3b | ||
|
|
694b1c3d32 | ||
|
|
a2436fa8b5 | ||
|
|
64d9b51f91 | ||
|
|
a3b507bb01 | ||
|
|
cbac09902d | ||
|
|
515a0bbe65 | ||
|
|
0c142215b9 | ||
|
|
dcc6dce8e3 | ||
|
|
7b3d1dff25 | ||
|
|
842b334803 | ||
|
|
8f5695eafb | ||
|
|
0a704161fe | ||
|
|
149c04b0df | ||
|
|
92abaca210 | ||
|
|
0e5bb43841 | ||
|
|
b3808ef89c | ||
|
|
99847c3ef2 | ||
|
|
0a6bea870c |
@@ -3,13 +3,13 @@
|
||||
#
|
||||
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
|
||||
SET(OPENSCENEGRAPH_MINOR_VERSION 6)
|
||||
SET(OPENSCENEGRAPH_PATCH_VERSION 4)
|
||||
SET(OPENSCENEGRAPH_SOVERSION 160)
|
||||
SET(OPENSCENEGRAPH_PATCH_VERSION 5)
|
||||
SET(OPENSCENEGRAPH_SOVERSION 161)
|
||||
|
||||
|
||||
# set to 0 when not a release candidate, non zero means that any generated
|
||||
# git tags will be treated as release candidates of given number
|
||||
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 9)
|
||||
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 0)
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
@@ -73,18 +73,19 @@ ELSEIF(APPLE)
|
||||
SET (IPHONE_ENABLE_BITCODE "NO" CACHE STRING "IOS Enable Bitcode")
|
||||
|
||||
# seamless toggle between device and simulator
|
||||
SET(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")
|
||||
SET(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator" CACHE STRING "Xcode effective platforms for iOS")
|
||||
|
||||
# set deployment target to min version
|
||||
SET(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${IPHONE_VERSION_MIN}" CACHE STRING "Deployment target for iOS" FORCE)
|
||||
SET(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${IPHONE_VERSION_MIN}" CACHE STRING "Xcode deployment target for iOS")
|
||||
|
||||
# Set standard architectures
|
||||
SET(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)")
|
||||
SET(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)" CACHE STRING "Build architectures for iOS")
|
||||
|
||||
ELSE()
|
||||
# OSX >= 10.5 uses Cocoa windowing system, otherwise Carbon
|
||||
IF(OSG_OSX_VERSION VERSION_LESS 10.5)
|
||||
SET(OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type for graphics window creation; options: Carbon, Cocoa, X11 or None.")
|
||||
SET(OSG_WINDOWING_SYSTEM_CARBON ON INTERNAL "use Carbon (apple; 32 bit only)")
|
||||
ELSE()
|
||||
SET(OSG_WINDOWING_SYSTEM "Cocoa" CACHE STRING "Windowing system type for graphics window creation; options: Carbon, Cocoa, X11 or None.")
|
||||
ENDIF()
|
||||
|
||||
@@ -25,17 +25,22 @@ ELSEIF(MSVC10)
|
||||
SET(FBX_LIBDIR "vs2010")
|
||||
ELSEIF(MSVC11)
|
||||
SET(FBX_LIBDIR "vs2012")
|
||||
ELSEIF(MSVC12 OR MSVC_VERSION==1800)
|
||||
ELSEIF(MSVC_VERSION EQUAL 1800)
|
||||
SET(FBX_LIBDIR "vs2013")
|
||||
ELSEIF(MSVC14 OR MSVC_VERSION>1900)
|
||||
ELSEIF(MSVC_VERSION EQUAL 1900)
|
||||
SET(FBX_LIBDIR "vs2015")
|
||||
ELSEIF(MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1920)
|
||||
SET(FBX_LIBDIR "vs2017")
|
||||
ELSEIF(MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1930)
|
||||
# SET(FBX_LIBDIR "vs2019") # FBX doesn't have this yet as of version 2020.0.1
|
||||
SET(FBX_LIBDIR "vs2017") # Binary compatible with vs2019
|
||||
ENDIF()
|
||||
|
||||
IF(APPLE)
|
||||
# do nothing
|
||||
ELSEIF(CMAKE_CL_64)
|
||||
SET(FBX_LIBDIR ${FBX_LIBDIR}/x64)
|
||||
ELSEIF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
ELSEIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(FBX_LIBDIR ${FBX_LIBDIR}/x64)
|
||||
ELSE()
|
||||
SET(FBX_LIBDIR ${FBX_LIBDIR}/x86)
|
||||
@@ -53,6 +58,10 @@ ELSE()
|
||||
SET(FBX_LIBNAME "libfbxsdk")
|
||||
ELSE()
|
||||
SET(FBX_LIBNAME "libfbxsdk-md")
|
||||
IF(WIN32)
|
||||
SET(FBX_XML2_LIBNAME "libxml2-md")
|
||||
SET(FBX_ZLIB_LIBNAME "zlib-md")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
@@ -60,19 +69,41 @@ SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
|
||||
|
||||
SET( FBX_SEARCH_PATHS
|
||||
$ENV{FBX_DIR}
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2020.0.1"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2020.0.1"
|
||||
"/Applications/Autodesk/FBX SDK/2020.0.1"
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2020.0"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2020.0"
|
||||
"/Applications/Autodesk/FBX SDK/2020.0"
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2019.5"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2019.5"
|
||||
"/Applications/Autodesk/FBX SDK/2019.5"
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2019.2"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2019.2"
|
||||
"/Applications/Autodesk/FBX SDK/2019.2"
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2019.0"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2019.0"
|
||||
"/Applications/Autodesk/FBX\ SDK/2019.0"
|
||||
"/Applications/Autodesk/FBX SDK/2019.0"
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2018.1.1"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2018.1.1"
|
||||
"/Applications/Autodesk/FBX\ SDK/2018.0"
|
||||
"/Applications/Autodesk/FBX SDK/2018.1.1"
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2018.0"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2018.0"
|
||||
"/Applications/Autodesk/FBX SDK/2018.0"
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2017.1"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2017.1"
|
||||
"/Applications/Autodesk/FBX SDK/2017.1"
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2017.0"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2017.0"
|
||||
"/Applications/Autodesk/FBX SDK/2017.0"
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2016.1.2"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2016.1.2"
|
||||
"/Applications/Autodesk/FBX/FBX SDK/2016.1.2"
|
||||
/Applications/Autodesk/FBXSDK201612
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2016.1.1"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2016.1.1"
|
||||
"/Applications/Autodesk/FBX/FBX SDK/2016.1.1"
|
||||
/Applications/Autodesk/FBXSDK201611
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2015.1"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2015.1"
|
||||
"/Applications/Autodesk/FBX/FBX SDK/2015.1"
|
||||
@@ -101,6 +132,21 @@ FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME_DEBUG}
|
||||
PATHS ${FBX_SEARCH_PATHS}
|
||||
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
|
||||
|
||||
IF(WIN32)
|
||||
FIND_LIBRARY( FBX_XML2_LIBRARY ${FBX_XML2_LIBNAME}
|
||||
PATHS ${FBX_SEARCH_PATHS}
|
||||
PATH_SUFFIXES "lib/${FBX_LIBDIR}/release" "lib/${FBX_LIBDIR}")
|
||||
FIND_LIBRARY( FBX_ZLIB_LIBRARY ${FBX_ZLIB_LIBNAME}
|
||||
PATHS ${FBX_SEARCH_PATHS}
|
||||
PATH_SUFFIXES "lib/${FBX_LIBDIR}/release" "lib/${FBX_LIBDIR}")
|
||||
FIND_LIBRARY( FBX_XML2_LIBRARY_DEBUG ${FBX_XML2_LIBNAME}
|
||||
PATHS ${FBX_SEARCH_PATHS}
|
||||
PATH_SUFFIXES "lib/${FBX_LIBDIR}/debug")
|
||||
FIND_LIBRARY( FBX_ZLIB_LIBRARY_DEBUG ${FBX_ZLIB_LIBNAME}
|
||||
PATHS ${FBX_SEARCH_PATHS}
|
||||
PATH_SUFFIXES "lib/${FBX_LIBDIR}/debug")
|
||||
ENDIF()
|
||||
|
||||
IF(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR)
|
||||
SET(FBX_FOUND "YES")
|
||||
ELSE()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
#[[=======================================================================.rst:
|
||||
FindFontconfig
|
||||
--------------
|
||||
|
||||
@@ -29,9 +28,7 @@ This will define the following variables in your project:
|
||||
``FONTCONFIG_COMPILE_OPTIONS``
|
||||
this should be passed to target_compile_options(), if the
|
||||
target is not used for linking
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
=======================================================================]]
|
||||
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
|
||||
@@ -101,5 +101,8 @@ if(LIBLAS_LIBRARY AND LIBLAS_INCLUDE_DIR)
|
||||
if(Boost_FOUND)
|
||||
set(LIBLAS_LIBRARIES ${LIBLAS_LIBRARY} )
|
||||
set(LIBLAS_FOUND "YES")
|
||||
if(WIN32)
|
||||
link_directories(${Boost_LIBRARY_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# correspond to the ./configure --prefix=$OPENCASCADE_DIR
|
||||
# used in building OPENCASCADE.
|
||||
|
||||
FIND_PATH(OPENCASCADE_INCLUDE_DIR BRepMesh.hxx
|
||||
FIND_PATH(OPENCASCADE_INCLUDE_DIR Standard_Version.hxx
|
||||
PATHS
|
||||
${OPENCASCADE_DIR}
|
||||
$ENV{OPENCASCADE_DIR}
|
||||
@@ -98,6 +98,7 @@ FIND_OPENCASCADE_LIBRARY(OPENCASCADE_TKXml TKXml)
|
||||
FIND_OPENCASCADE_LIBRARY(OPENCASCADE_TKXmlTObj TKXmlTObj)
|
||||
FIND_OPENCASCADE_LIBRARY(OPENCASCADE_TKXmlXCAF TKXmlXCAF)
|
||||
FIND_OPENCASCADE_LIBRARY(OPENCASCADE_TKXSBase TKXSBase)
|
||||
FIND_OPENCASCADE_LIBRARY(OPENCASCADE_TKXCAF TKXCAF)
|
||||
|
||||
set (OPENCASCADE_LIBRARY_TYPE_DESCR
|
||||
"Specifies the type of library to be used. 'Shared' libraries
|
||||
|
||||
@@ -34,6 +34,9 @@ INSTALL(
|
||||
|
||||
IF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||
GET_TARGET_PROPERTY(PREFIX ${LIB_NAME} PREFIX)
|
||||
IF("${PREFIX}" STREQUAL PREFIX-NOTFOUND) # Fix for PREFIX-NOTFOUND left in file names
|
||||
SET(PREFIX "")
|
||||
ENDIF()
|
||||
INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS RelWithDebInfo)
|
||||
INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS Debug)
|
||||
ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||
|
||||
527
ChangeLog
527
ChangeLog
@@ -1,3 +1,530 @@
|
||||
Fri, 31 Jan 2020 11:02:47 +0000
|
||||
Author : Robert Osfield
|
||||
Updates for 3.6.5 release
|
||||
|
||||
Fri, 31 Jan 2020 10:37:25 +0000
|
||||
Author : Robert Osfield
|
||||
Added mutex lock to avoid threading issues when glyphs are added to a Font from multiple threads
|
||||
|
||||
Thu, 30 Jan 2020 19:25:50 +0000
|
||||
Author : Robert Osfield
|
||||
Updates for 3.6.5-rc3
|
||||
|
||||
Thu, 30 Jan 2020 16:30:41 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #911 from LaurensVoerman/FbxSdkFixFix for older versions of fbxsdk without xml or zlib libraries,
|
||||
|
||||
Thu, 30 Jan 2020 16:21:32 +0000
|
||||
Author : Robert Osfield
|
||||
Added explicit clean up removeView
|
||||
|
||||
Thu, 30 Jan 2020 16:32:42 +0100
|
||||
Author : Laurens Voerman
|
||||
Fix for older versions of fbxsdk without xml or zlib libraries, fix cmake multiconfig generators (msvc) with irrelevant CMAKE_BUILD_TYPE.
|
||||
|
||||
Mon, 27 Jan 2020 10:11:23 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #907 from DeadParrot/OpenSceneGraph-3.6FBX plugin updates / PREFIX-NOTFOUND work-around
|
||||
|
||||
Sun, 26 Jan 2020 14:28:56 -0500
|
||||
Author : Stuart Mentzer
|
||||
FBX plugin updates / PREFIX-NOTFOUND work-around
|
||||
|
||||
Tue, 21 Jan 2020 10:11:30 +0000
|
||||
Author : Robert Osfield
|
||||
Updater rc number for 3.6.5-rc2, and CHangeLog
|
||||
|
||||
Tue, 21 Jan 2020 09:43:08 +0000
|
||||
Author : Robert Osfield
|
||||
Removed stray space
|
||||
|
||||
Tue, 21 Jan 2020 09:32:57 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #902 from mp3butcher/oqn3.6 OQN API convergence
|
||||
|
||||
Tue, 21 Jan 2020 09:16:51 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #903 from dedowsdi/renderstageAdd getPreRenderList, getPostRenderList to RenderStage.
|
||||
|
||||
Fri, 17 Jan 2020 18:47:49 +0800
|
||||
Author : dedowsdi
|
||||
Add getPreRenderList getPostRenderList to RenderStage.
|
||||
|
||||
Fri, 23 Aug 2019 09:59:54 +0200
|
||||
Author : Daniel Trstenjak
|
||||
OcclusionQueryNode: make all usages of 'updateDefaultQueryGeometry' thread safe
|
||||
|
||||
Fri, 23 Aug 2019 09:46:02 +0200
|
||||
Author : Daniel Trstenjak
|
||||
OcclusionQueryNode: fix resetting to default query geometryWhen the query geometry gets reset to its default then its
|
||||
vertices have to be updated by the bounding box dimensions of
|
||||
the current children of the OcclusionQueryNode.
|
||||
|
||||
|
||||
Wed, 14 Aug 2019 11:27:40 +0200
|
||||
Author : Daniel Trstenjak
|
||||
OcclusionQueryNode: fix use case of user defined query geometryThe user defined query geometry handling has been broken in several ways.
|
||||
|
||||
The previous way of defining a query geometry was using the non const
|
||||
`getQueryGeometry` method and overriding its members. But then
|
||||
`OcclusionQueryNode` wasn't aware of the geometry change and couldn't
|
||||
internally handle it correctly.
|
||||
|
||||
The `computeBound` method never considered a user defined query geometry and
|
||||
always just overrode the vertices of the geometry.
|
||||
|
||||
The member `_validQueryGeometry` wasn't correctly set.
|
||||
|
||||
This change should fix all this issues by introducing a small backward
|
||||
compatibility break. The non const `getQueryGeometry` method is removed
|
||||
forcing the user to use the `setQueryGeometry` method. But then `OcclusionQueryNode`
|
||||
is aware of the user defined query geometry and can handle it correctly.
|
||||
|
||||
|
||||
Tue, 29 Jan 2019 14:40:16 +0100
|
||||
Author : Daniel Trstenjak
|
||||
OcclusionQueryNode: reset the test result of the invalid geometryThere're cases that the occlusion test result has been retrieved
|
||||
after the query geometry has been changed, it's the result of the
|
||||
geometry before the change.
|
||||
|
||||
|
||||
Tue, 29 Jan 2019 11:37:28 +0100
|
||||
Author : Daniel Trstenjak
|
||||
OcclusionQueryNode: ensure a valid query geometryIf the query geometry is invalid then don't do any occlusion queries and
|
||||
never traverse the subgraphs.
|
||||
|
||||
|
||||
Fri, 25 Jan 2019 15:02:45 +0100
|
||||
Author : Daniel Trstenjak
|
||||
OcclusionQueryNode: ensure a consistent value for '_passed'
|
||||
|
||||
Sat, 26 Jan 2019 16:33:23 +0000
|
||||
Author : Robert Osfield
|
||||
Introduced a QueryGeometry::getQueryResult(const osg::Camera*) method as a more informative replacedment for QueryGeometry::getNumPixels().
|
||||
|
||||
Mon, 20 Jan 2020 10:37:12 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #900 from dedowsdi/fix_particle_rotationFix particle rotation.
|
||||
|
||||
Fri, 17 Jan 2020 11:18:30 +0800
|
||||
Author : dedowsdi
|
||||
Fix particle rotation.
|
||||
|
||||
Fri, 17 Jan 2020 09:28:09 +0000
|
||||
Author : Robert Osfield
|
||||
Updated ChangeLog
|
||||
|
||||
Fri, 17 Jan 2020 09:07:58 +0000
|
||||
Author : Robert Osfield
|
||||
Moved setting of isftream locale to Model::readOBJ(..) and Model::readMTL(..).
|
||||
|
||||
Fri, 17 Jan 2020 08:54:52 +0000
|
||||
Author : Robert Osfield
|
||||
Added explict setting of local to classic to avoid local platform settings affecting parsing
|
||||
|
||||
Tue, 14 Jan 2020 16:32:29 +0000
|
||||
Author : Robert Osfield
|
||||
Updated README.md for 3.6.5-rc1
|
||||
|
||||
Tue, 14 Jan 2020 16:30:14 +0000
|
||||
Author : Robert Osfield
|
||||
Updated ChangeLog and set rc candidate 1 for 3.6.5-rc1
|
||||
|
||||
Tue, 14 Jan 2020 16:29:07 +0000
|
||||
Author : Robert Osfield
|
||||
Fixed warnings
|
||||
|
||||
Tue, 14 Jan 2020 14:57:15 +0000
|
||||
Author : Robert Osfield
|
||||
Fixed build warning due to auto_ptr<>
|
||||
|
||||
Tue, 14 Jan 2020 14:42:01 +0000
|
||||
Author : Robert Osfield
|
||||
Fixed workaround for invalid indices
|
||||
|
||||
Mon, 13 Jan 2020 14:14:48 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #895 from openscenegraph/CurrentThreadIdAdded commment explaining that OpenThreads::Thread::CurrentThread() r…
|
||||
|
||||
Mon, 13 Jan 2020 14:12:54 +0000
|
||||
Author : Robert Osfield
|
||||
Added commment explaining that OpenThreads::Thread::CurrentThread() return NULL on non OpenThreads thread.
|
||||
|
||||
Mon, 13 Jan 2020 13:41:37 +0000
|
||||
Author : Robert Osfield
|
||||
Added support for using CurrentCodePage functionality with osgText::String To the DXF plugin added Option string support for using CurrentCodePage|WidePage, UTF8, UTF16, UTF32 and FontFile=filename
|
||||
|
||||
Mon, 13 Jan 2020 09:58:47 +0000
|
||||
Author : Robert Osfield
|
||||
Added encoding and font setting to dxfText as a first step towards making these user controllable to enble handling of non default settings
|
||||
|
||||
Sat, 11 Jan 2020 14:39:46 +0000
|
||||
Author : Robert Osfield
|
||||
Added creation of image directories when required
|
||||
|
||||
Fri, 10 Jan 2020 10:12:13 +0000
|
||||
Author : Robert Osfield
|
||||
Fixed handling of _autoScaleTransitionWidthRatio<=0.0
|
||||
|
||||
Tue, 7 Jan 2020 11:12:18 +0000
|
||||
Author : Robert Osfield
|
||||
Implemented TextBase::compileGLObjects() with handling of VAO/VBOs to address bugs associated with VAO usage of Text.
|
||||
|
||||
Mon, 6 Jan 2020 18:39:51 +0000
|
||||
Author : Robert Osfield
|
||||
Added Thread::CurrentThreadId() method to wrap up thread id functionality in a more platform appropriate way.
|
||||
|
||||
Mon, 6 Jan 2020 10:27:18 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #887 from limbolily/patch-1Fix navagation error about Android GLES2 example.
|
||||
|
||||
Mon, 6 Jan 2020 14:48:34 +0800
|
||||
Author : limbolily
|
||||
Fix navagation error about Android GLES2 example.Android GLES2 example use event queue without initializing window rectangle with graphics context,that produce navigation error.
|
||||
|
||||
Mon, 23 Dec 2019 14:20:26 +0100
|
||||
Author : Michael Danilov
|
||||
Fix #877 "Shift key stuck if both shifts switch keymap"Adapted the patch from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=687332
|
||||
|
||||
|
||||
Mon, 23 Dec 2019 14:53:17 +0000
|
||||
Author : Robert Osfield
|
||||
Adopted CMake's FindDCMTK.cmake variables
|
||||
|
||||
Sun, 22 Dec 2019 12:29:47 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #874 from blobfish/occt7.4Occt7.4
|
||||
|
||||
Thu, 19 Dec 2019 11:46:05 -0500
|
||||
Author : blobfish
|
||||
Plugins: OpenCasCade: Adding 'std' prefix where needed. See Following.Prior to 7.4, occt had a 'using namespace std' in a header file that
|
||||
was polluting dependent projects. They have since fixed it and so these
|
||||
changes are required.
|
||||
|
||||
|
||||
Thu, 19 Dec 2019 10:16:09 -0500
|
||||
Author : blobfish
|
||||
Plugins: Cmake: OpenCasCade: Changing header used for include directory search. See Following.BRepMesh.hxx is gone in occt 7.4. Now searching for Standard_Version.hxx, which should be more consistent.
|
||||
|
||||
|
||||
Wed, 18 Dec 2019 14:25:07 +0000
|
||||
Author : Robert Osfield
|
||||
Added classic locale setting to avoid local setting of locale affecting the GLSL code generated.
|
||||
|
||||
Mon, 16 Dec 2019 17:10:39 +0000
|
||||
Author : Robert Osfield
|
||||
Updated ChangeLog
|
||||
|
||||
Mon, 16 Dec 2019 16:51:16 +0000
|
||||
Author : Robert Osfield
|
||||
Added automatically removal from the OjbectCache when a object or it's subgraph contain Texture that no longer have an osg::Image.
|
||||
|
||||
Mon, 16 Dec 2019 11:54:12 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #871 from LaurensVoerman/commit_tgaFixfix debug compile error for ReaderWriterTGA
|
||||
|
||||
Mon, 16 Dec 2019 11:02:41 +0100
|
||||
Author : Laurens Voerman
|
||||
fix debug compile error for ReaderWriterTGA
|
||||
|
||||
Mon, 16 Dec 2019 09:40:30 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #870 from eligovision/OpenSceneGraph-3.6_glext_fixGLExtensions's isPBOSupported and isVAOSupported flags fixed
|
||||
|
||||
Mon, 16 Dec 2019 09:40:00 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #869 from eligovision/OpenSceneGraph-3.6_glextAdded FBO GL extensions (useful for mobile VR etc.)
|
||||
|
||||
Fri, 13 Dec 2019 19:40:11 +0300
|
||||
Author : konstantin.matveyev
|
||||
GLExtensions's isPBOSupported and isVAOSupported flags fixed for GLES2+GLES3 configuration
|
||||
|
||||
Fri, 13 Dec 2019 19:42:30 +0300
|
||||
Author : konstantin.matveyev
|
||||
GLExtensions's isInvalidateFramebufferSupported flag improved
|
||||
|
||||
Tue, 26 Nov 2019 17:17:38 +0800
|
||||
Author : PntAndCnt
|
||||
Fontconfig should be external library.Add Fontconfig to TARGET_LIBRARIES cause osg3::osgText target looking for
|
||||
openscegraph-Fontconfig-import-targets.cmake, which doesn't exists.
|
||||
|
||||
|
||||
Sun, 13 Oct 2019 20:24:36 +0800
|
||||
Author : PntAndCnt
|
||||
Fix a typo and invisible 3dtext in examples/osgtext.Second text alignment is wrong when "--alignment" specified.
|
||||
|
||||
3D text radius is too small, only SCREEN_COORDS can be seen.
|
||||
|
||||
Text position should multiply radius.
|
||||
|
||||
|
||||
Tue, 3 Sep 2019 16:11:14 +0800
|
||||
Author : Kent
|
||||
Mered fix for internalFormat
|
||||
|
||||
Thu, 12 Dec 2019 18:41:23 +0300
|
||||
Author : valid-ptr
|
||||
glInvalidateFramebuffer added to GLExtensions
|
||||
|
||||
Thu, 31 Oct 2019 18:59:04 +0300
|
||||
Author : konstantin.matveyev
|
||||
glFramebufferTexture2DMultisample added to GLExtensions
|
||||
|
||||
Tue, 10 Dec 2019 15:08:25 +0300
|
||||
Author : Dmitry Marakasov
|
||||
Add FreeBSD-specific code bits for pthread_setaffinity_np support
|
||||
|
||||
Thu, 12 Dec 2019 13:25:44 +0000
|
||||
Author : Robert Osfield
|
||||
Fix linking with Xinerama
|
||||
|
||||
Thu, 12 Dec 2019 13:09:33 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #861 from aluaces/default-ffmpegSet ffmpeg as the default plugin for video files.
|
||||
|
||||
Fri, 22 Nov 2019 21:07:36 +0100
|
||||
Author : elsid
|
||||
Fix clang 8 & libc++ build errorsReplace operators for implicit type conversion by explicit data() method to
|
||||
access implementation pointer and subscript operator to access element by
|
||||
index just like in std::vector.
|
||||
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:455:22: error: use of overloaded operator '==' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'long')
|
||||
if (colormap == NULL)
|
||||
~~~~~~~~ ^ ~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:525:16: error: use of overloaded operator '==' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'long')
|
||||
if (buffer == NULL || linebuf == NULL)
|
||||
~~~~~~ ^ ~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:525:35: error: use of overloaded operator '==' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'long')
|
||||
if (buffer == NULL || linebuf == NULL)
|
||||
~~~~~~~ ^ ~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:548:30: error: use of overloaded operator '==' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'long')
|
||||
if (formattedMap == NULL)
|
||||
~~~~~~~~~~~~ ^ ~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:574:40: error: use of overloaded operator '[]' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'int')
|
||||
index = linebuf[x];
|
||||
~~~~~~~^~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:577:50: error: use of overloaded operator '+' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'int')
|
||||
index = getInt16(linebuf + x * 2);
|
||||
~~~~~~~ ^ ~~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:580:50: error: use of overloaded operator '+' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'int')
|
||||
index = getInt24(linebuf + x * 3);
|
||||
~~~~~~~ ^ ~~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:583:50: error: use of overloaded operator '+' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'int')
|
||||
index = getInt32(linebuf + x * 4);
|
||||
~~~~~~~ ^ ~~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:592:72: error: use of overloaded operator '+' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'int')
|
||||
(dest + adjustedX * format)[i] = (formattedMap + index * format)[i];
|
||||
~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:626:30: error: use of overloaded operator '==' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'long')
|
||||
if (formattedMap == NULL)
|
||||
~~~~~~~~~~~~ ^ ~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:642:21: error: use of overloaded operator '==' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'long')
|
||||
if (buf == NULL)
|
||||
~~~ ^ ~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:664:44: error: use of overloaded operator '[]' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'int')
|
||||
index = linebuf[x];
|
||||
~~~~~~~^~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:667:54: error: use of overloaded operator '+' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'int')
|
||||
index = getInt16(linebuf + x * 2);
|
||||
~~~~~~~ ^ ~~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:670:54: error: use of overloaded operator '+' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'int')
|
||||
index = getInt24(linebuf + x * 3);
|
||||
~~~~~~~ ^ ~~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:673:54: error: use of overloaded operator '+' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'int')
|
||||
index = getInt32(linebuf + x * 4);
|
||||
~~~~~~~ ^ ~~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:688:76: error: use of overloaded operator '+' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'int')
|
||||
(dest + adjustedX * format)[i] = (formattedMap + index * format)[i];
|
||||
~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
|
||||
src/osgPlugins/tga/ReaderWriterTGA.cpp:708:21: error: use of overloaded operator '==' is ambiguous (with operand types 'SafeArray<unsigned char>' and 'long')
|
||||
if (buf == NULL)
|
||||
~~~ ^ ~~~~
|
||||
17 errors generated.
|
||||
|
||||
|
||||
Thu, 12 Dec 2019 10:55:35 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Fixed indentation, replacing tabs with spaces
|
||||
|
||||
Mon, 4 Nov 2019 05:37:37 +0100
|
||||
Author : Tim Moore
|
||||
Fix bug in matrix transpose() and transpose3x3The diagonal elements were not copied from the source matrix.
|
||||
|
||||
|
||||
Fri, 1 Nov 2019 09:26:28 -0700
|
||||
Author : flashk
|
||||
Support reading RGB float DDS imagesThe DDS plugin is not able to load floating point RGB images saved out by itself. There doesn't appear to be a fourcc code for RGB float/half-float data, so I added the appropriate entries to the RGBFormat table so the images can be loaded properly.
|
||||
|
||||
Thu, 12 Dec 2019 10:08:32 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #851 from LaurensVoerman/submitCpSubImgfix copySubImage crash on compressed files
|
||||
|
||||
Wed, 25 Sep 2019 12:16:51 -0500
|
||||
Author : DCFennell
|
||||
GL_CLAMP_VERTEX_COLOR and GL_CLAMP_FRAGMENT_COLOR deprecated in GL core profile according to OpenGL 4.5 specification.
|
||||
|
||||
Mon, 23 Sep 2019 15:05:54 +0200
|
||||
Author : Johannes Pabst
|
||||
Fix: LuaCallbackObject could form circular references to LuaScriptEngine that prevented its destruction. Destruction of LuaScriptEngine now disarms all callbacks into Lua.
|
||||
|
||||
Fri, 13 Sep 2019 12:50:29 +0200
|
||||
Author : Riccardo Corsi
|
||||
Fbx Plugin: added plugin option to set the target axis system. Default left to OpenGL.
|
||||
|
||||
Thu, 12 Sep 2019 13:54:28 -0700
|
||||
Author : grdowns
|
||||
Add vcpkg installation instructions
|
||||
|
||||
Wed, 11 Dec 2019 17:51:02 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #837 from LaurensVoerman/carbonFixfix apple carbon reference
|
||||
|
||||
Wed, 11 Dec 2019 17:07:27 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #833 from cj-mcdonald/osga-fixUpdate ReaderWriterOSGA.cpp
|
||||
|
||||
Fri, 30 Aug 2019 16:48:25 +0200
|
||||
Author : Guilhem Saurel
|
||||
fix dae readme
|
||||
|
||||
Wed, 11 Dec 2019 16:58:50 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #828 from eligovision/OpenSceneGraph-3.6_ios_build_fixFix build iOS: when using Toolchain or building with Makefiles (not X…
|
||||
|
||||
Wed, 11 Dec 2019 16:47:44 +0000
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #822 from mp3butcher/patch-32optimize indexed color DDS conversion
|
||||
|
||||
Wed, 4 Dec 2019 22:10:46 +0100
|
||||
Author : Alberto Luaces
|
||||
Set ffmpeg as the default plugin for video files.As xine is not used anymore, there is no plugin in charge of loading
|
||||
video files, and osgmovie and other programs are not able to open
|
||||
them.
|
||||
|
||||
If ffmpeg is present, it is registered for opening video files.
|
||||
|
||||
|
||||
Fri, 1 Nov 2019 16:42:50 +0100
|
||||
Author : Laurens Voerman
|
||||
fix copySubImage crash on compressed files
|
||||
|
||||
Wed, 11 Sep 2019 10:22:16 +0200
|
||||
Author : Laurens Voerman
|
||||
fix apple carbon reference
|
||||
|
||||
Mon, 2 Sep 2019 17:43:38 +0100
|
||||
Author : Colin McDonald
|
||||
Update ReaderWriterOSGA.cppFix typo in osga archives which stops node files working
|
||||
|
||||
Fri, 23 Aug 2019 18:31:22 +0300
|
||||
Author : Konstantin S. Matveyev
|
||||
Fix build iOS: when using Toolchain or building with Makefiles (not Xcode)
|
||||
|
||||
Sun, 18 Aug 2019 17:56:51 +0200
|
||||
Author : Julien Valentin
|
||||
use memcpy instead of union
|
||||
|
||||
Sat, 17 Aug 2019 22:05:38 +0200
|
||||
Author : Julien Valentin
|
||||
optimize conversion with a union
|
||||
|
||||
Thu, 22 Aug 2019 14:49:43 +0100
|
||||
Author : Robert Osfield
|
||||
Removed exlict keyword to address build problems with VS older than 2015.
|
||||
|
||||
Sun, 18 Aug 2019 20:14:17 +0200
|
||||
Author : Remo E
|
||||
Debugging: Hint to debug LoadLibrary issuesThis helps to debug loading dynamic libraries in an environment without implemented "dlopen". For example emscripten with static compiled OSG.
|
||||
|
||||
Sat, 17 Aug 2019 20:04:38 +0100
|
||||
Author : Robert Osfield
|
||||
Merge branch 'OpenSceneGraph-3.6' of https://github.com/openscenegraph/OpenSceneGraph into OpenSceneGraph-3.6
|
||||
|
||||
Sat, 17 Aug 2019 20:04:30 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #820 from Capostrophic/ddsDDS plugin: add support for DDPF_PALETTEINDEXED8 pixel format reading
|
||||
|
||||
Fri, 16 Aug 2019 13:52:56 +0200
|
||||
Author : Björn Blissing
|
||||
Fixed spelling error in warning message
|
||||
|
||||
Sat, 17 Aug 2019 15:11:49 +0300
|
||||
Author : capostrophic
|
||||
Fix memory leaks
|
||||
|
||||
Sat, 17 Aug 2019 01:43:47 +0300
|
||||
Author : capostrophic
|
||||
Add support for DDPF_PALETTEINDEXED8 pixel format reading
|
||||
|
||||
Fri, 16 Aug 2019 10:27:28 +0100
|
||||
Author : Robert Osfield
|
||||
Added TKXCAF to find package list
|
||||
|
||||
Thu, 15 Aug 2019 20:21:15 +0200
|
||||
Author : Julien Valentin
|
||||
remove return of local pointer
|
||||
|
||||
Fri, 16 Aug 2019 09:35:00 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #818 from mp3butcher/patch-31fix comment block CMake syntax
|
||||
|
||||
Thu, 15 Aug 2019 20:46:52 +0200
|
||||
Author : Julien Valentin
|
||||
fix cmake block comment syntax
|
||||
|
||||
Thu, 15 Aug 2019 20:27:05 +0200
|
||||
Author : Julien Valentin
|
||||
remove unproperly parsed CMake commenthttps://github.com/openscenegraph/OpenSceneGraph/issues/812
|
||||
|
||||
Wed, 7 Aug 2019 10:56:59 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #808 from 640kb/OpenSceneGraph-3.6las plugin: fix linking against static boost library under windows
|
||||
|
||||
Wed, 7 Aug 2019 09:49:16 +0200
|
||||
Author : Daniel Wendt
|
||||
las plugin: fix linking against static boost library under windowsSigned-off-by: Daniel Wendt <daniel.wendt@linux.com>
|
||||
|
||||
|
||||
Wed, 31 Jul 2019 14:11:59 +0100
|
||||
Author : Robert Osfield
|
||||
Added a _fontFallback to TextBase to cache any fallback font (usually DefaultFont) that is used when the Textbase::_font is null.
|
||||
|
||||
Mon, 29 Jul 2019 13:01:00 +0100
|
||||
Author : Robert Osfield
|
||||
Replaced GL_QUADS usage with GL_TRIANGLE_STRIP
|
||||
|
||||
Mon, 29 Jul 2019 12:29:25 +0100
|
||||
Author : Robert Osfield
|
||||
Refactored the mesh setup to use GL_TRIANGLE_STIP instead of GL_QUADS
|
||||
|
||||
Mon, 29 Jul 2019 09:59:57 +0100
|
||||
Author : Robert Osfield
|
||||
Updated version to 3.6.5
|
||||
|
||||
Mon, 29 Jul 2019 08:57:56 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #804 from eligovision/OpenSceneGraph-3.6_GLQUADS[*] ParticleSystem: Use GL_TRIANGLES instead if GL_QUADS when GL{1,2}…
|
||||
|
||||
Fri, 26 Jul 2019 21:14:45 +0300
|
||||
Author : Konstantin S. Matveyev
|
||||
[*] ParticleSystem: Use GL_TRIANGLES instead if GL_QUADS when GL{1,2} or GLES1 are unavailable
|
||||
|
||||
Fri, 26 Jul 2019 12:54:16 +0100
|
||||
Author : OpenSceneGraph git repository
|
||||
Merge pull request #802 from eligovision/OpenSceneGraph-3.6_osgtext_fcOSG_TEXT_USE_FONTCONFIG cmake option added: Set to ON to enable attem…
|
||||
|
||||
Fri, 26 Jul 2019 14:40:47 +0300
|
||||
Author : konstantin.matveyev
|
||||
OSG_TEXT_USE_FONTCONFIG additional check needed
|
||||
|
||||
Fri, 26 Jul 2019 14:09:36 +0300
|
||||
Author : konstantin.matveyev
|
||||
OSG_TEXT_USE_FONTCONFIG cmake option added: Set to ON to enable attempt to use FontConfig in osgText; Disabled by default for iOS and Android
|
||||
|
||||
Thu, 25 Jul 2019 15:10:36 +0100
|
||||
Author : Robert Osfield
|
||||
UPdated for 3.6.3-rc9
|
||||
|
||||
Thu, 25 Jul 2019 14:58:17 +0100
|
||||
Author : Robert Osfield
|
||||
Changed the #extension enable
|
||||
|
||||
@@ -25,12 +25,17 @@ If details below are not sufficient then head over to the openscenegraph.org to
|
||||
|
||||
Robert Osfield.
|
||||
Project Lead.
|
||||
25th July 2019.
|
||||
31th January 2020.
|
||||
|
||||
---
|
||||
|
||||
## Section 1. How to build OpenSceneGraph
|
||||
|
||||
If you are using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager you can download and install OpenSceneGraph from source with CMake integration using a single command:
|
||||
```
|
||||
vcpkg install osg
|
||||
```
|
||||
|
||||
The OpenSceneGraph uses the CMake build system to generate a platform-specific build environment. CMake reads the `CMakeLists.txt` files that you'll find throughout the OpenSceneGraph directories, checks for installed dependencies and then generates files for the selected build system.
|
||||
|
||||
If you don't already have CMake installed on your system you can grab it from http://www.cmake.org, use version 2.8.0 or later. Details on the OpenSceneGraph's CMake build can be found at:
|
||||
|
||||
@@ -103,7 +103,9 @@ void OsgMainApp::initOsgWindow(int x,int y,int width,int height){
|
||||
osg::notify(osg::ALWAYS)<<"Testing"<<std::endl;
|
||||
|
||||
_viewer = new osgViewer::Viewer();
|
||||
_viewer->setUpViewerAsEmbeddedInWindow(x, y, width, height);
|
||||
osgViewer::GraphicsWindowEmbedded* window = _viewer->setUpViewerAsEmbeddedInWindow(x, y, width, height);
|
||||
_viewer->getEventQueue()->setGraphicsContext(window);
|
||||
_viewer->getEventQueue()->syncWindowRectangleWithGraphicsContext();
|
||||
_viewer->setThreadingModel(osgViewer::ViewerBase::SingleThreaded);
|
||||
|
||||
_root = new osg::Group();
|
||||
|
||||
@@ -440,7 +440,7 @@ osg::Group* create3DText(const osg::Vec3& center,float radius)
|
||||
text5->setFont("fonts/times.ttf");
|
||||
//text5->setCharacterSize(characterSize);
|
||||
text5->setCharacterSize(32.0f); // medium
|
||||
text5->setPosition(center - osg::Vec3(0.0, 0.0, 0.2));
|
||||
text5->setPosition(center - osg::Vec3(0.0, 0.0, 0.2) * radius);
|
||||
text5->setAxisAlignment(osgText::Text::SCREEN);
|
||||
text5->setCharacterSizeMode(osgText::Text::SCREEN_COORDS);
|
||||
text5->setDrawMode(osgText::Text::TEXT | osgText::Text::BOUNDINGBOX);
|
||||
@@ -451,7 +451,7 @@ osg::Group* create3DText(const osg::Vec3& center,float radius)
|
||||
text6->setColor(characterSizeModeColor);
|
||||
text6->setFont("fonts/times.ttf");
|
||||
text6->setCharacterSize(characterSize);
|
||||
text6->setPosition(center - osg::Vec3(0.0, 0.0, 0.4));
|
||||
text6->setPosition(center - osg::Vec3(0.0, 0.0, 0.4) * radius);
|
||||
text6->setAxisAlignment(osgText::Text::SCREEN);
|
||||
text6->setCharacterSizeMode(osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
|
||||
text6->setText("CharacterSizeMode OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT");
|
||||
@@ -461,7 +461,7 @@ osg::Group* create3DText(const osg::Vec3& center,float radius)
|
||||
text7->setColor(characterSizeModeColor);
|
||||
text7->setFont("fonts/times.ttf");
|
||||
text7->setCharacterSize(characterSize);
|
||||
text7->setPosition(center - osg::Vec3(0.0, 0.0, 0.6));
|
||||
text7->setPosition(center - osg::Vec3(0.0, 0.0, 0.6) * radius);
|
||||
text7->setAxisAlignment(osgText::Text::SCREEN);
|
||||
text7->setCharacterSizeMode(osgText::Text::OBJECT_COORDS);
|
||||
text7->setText("CharacterSizeMode OBJECT_COORDS (default)");
|
||||
@@ -692,7 +692,7 @@ int main(int argc, char** argv)
|
||||
text->setFont("fonts/times.ttf");
|
||||
text->setAxisAlignment(osgText::Text::XZ_PLANE);
|
||||
text->setText("Alingment\nAfter:");
|
||||
text->setAlignment(osgText::Text::RIGHT_TOP);
|
||||
text->setAlignment(osgText::Text::LEFT_TOP);
|
||||
group->addChild(text);
|
||||
}
|
||||
|
||||
@@ -754,7 +754,7 @@ int main(int argc, char** argv)
|
||||
{
|
||||
// prepare scene.
|
||||
osg::Vec3 center(0.0f,0.0f,0.0f);
|
||||
float radius = 1.0f;
|
||||
float radius = 100.0f;
|
||||
|
||||
// make sure the root node is group so we can add extra nodes to it.
|
||||
osg::Group* group = new osg::Group;
|
||||
|
||||
@@ -109,10 +109,15 @@ public:
|
||||
|
||||
|
||||
/**
|
||||
* Return a pointer to the current running thread
|
||||
* Return a pointer to the current running thread, returns NULL for a non OpenThreads thread.
|
||||
*/
|
||||
static Thread *CurrentThread();
|
||||
|
||||
/**
|
||||
* Return the id of the current thread
|
||||
*/
|
||||
static size_t CurrentThreadId();
|
||||
|
||||
|
||||
/**
|
||||
* Initialize Threading in a program. This method must be called before
|
||||
@@ -147,7 +152,7 @@ public:
|
||||
*
|
||||
* @return a unique thread identifier
|
||||
*/
|
||||
int getThreadId();
|
||||
size_t getThreadId();
|
||||
|
||||
/**
|
||||
* Get the thread's process id. This is the pthread_t or pid_t value
|
||||
|
||||
@@ -656,6 +656,9 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
// FrameBuferObject
|
||||
bool isFrameBufferObjectSupported;
|
||||
bool isPackedDepthStencilSupported;
|
||||
bool isMultisampledRenderToTextureSupported;
|
||||
bool isInvalidateFramebufferSupported;
|
||||
|
||||
bool isRenderbufferMultisampleSupported() const { return glRenderbufferStorageMultisample != 0; }
|
||||
bool isRenderbufferMultisampleCoverageSupported() const { return glRenderbufferStorageMultisampleCoverageNV != 0; }
|
||||
|
||||
@@ -672,6 +675,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
|
||||
void (GL_APIENTRY * glFramebufferTexture1D) (GLenum, GLenum, GLenum, GLuint, GLint);
|
||||
void (GL_APIENTRY * glFramebufferTexture2D) (GLenum, GLenum, GLenum, GLuint, GLint);
|
||||
void (GL_APIENTRY * glFramebufferTexture2DMultisample) (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
|
||||
void (GL_APIENTRY * glFramebufferTexture3D) (GLenum, GLenum, GLenum, GLuint, GLint, GLint);
|
||||
void (GL_APIENTRY * glFramebufferTexture) (GLenum, GLenum, GLint, GLint);
|
||||
void (GL_APIENTRY * glFramebufferTextureLayer) (GLenum, GLenum, GLuint, GLint, GLint);
|
||||
@@ -680,6 +684,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
|
||||
void (GL_APIENTRY * glGenerateMipmap) (GLenum);
|
||||
void (GL_APIENTRY * glBlitFramebuffer) (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
|
||||
void (GL_APIENTRY * glInvalidateFramebuffer) (GLenum, GLsizei, const GLenum*); // GL_ARB_invalidate_subdata or GL 4.3 or GLES 3
|
||||
void (GL_APIENTRY * glGetRenderbufferParameteriv) (GLenum, GLenum, GLint*);
|
||||
|
||||
//ARB_framebuffer_no_attachments
|
||||
|
||||
@@ -390,7 +390,7 @@ class OSG_EXPORT GraphicsContext : public Object
|
||||
bool releaseContext();
|
||||
|
||||
/** Return true if the current thread has this OpenGL graphics context.*/
|
||||
inline bool isCurrent() const { return _threadOfLastMakeCurrent == OpenThreads::Thread::CurrentThread(); }
|
||||
inline bool isCurrent() const { return _threadOfLastMakeCurrent == OpenThreads::Thread::CurrentThreadId(); }
|
||||
|
||||
/** Bind the graphics context to associated texture.*/
|
||||
inline void bindPBufferToTexture(GLenum buffer) { bindPBufferToTextureImplementation(buffer); }
|
||||
@@ -547,7 +547,7 @@ class OSG_EXPORT GraphicsContext : public Object
|
||||
Vec4 _clearColor;
|
||||
GLbitfield _clearMask;
|
||||
|
||||
OpenThreads::Thread* _threadOfLastMakeCurrent;
|
||||
size_t _threadOfLastMakeCurrent;
|
||||
|
||||
OpenThreads::Mutex _operationsMutex;
|
||||
osg::ref_ptr<osg::RefBlock> _operationsBlock;
|
||||
|
||||
@@ -82,9 +82,9 @@ public:
|
||||
};
|
||||
|
||||
/** return a QueryResult for specified Camera, where the QueryResult.valid is true when query results are available, and in which case the QueryResult.numPixels provides the num of pixels in the query result.*/
|
||||
QueryResult getQueryResult( const osg::Camera* cam );
|
||||
QueryResult getQueryResult( const osg::Camera* cam ) const;
|
||||
|
||||
unsigned int getNumPixels( const osg::Camera* cam );
|
||||
unsigned int getNumPixels( const osg::Camera* cam ) const;
|
||||
|
||||
virtual void releaseGLObjects( osg::State* state = 0 ) const;
|
||||
|
||||
@@ -158,8 +158,11 @@ public:
|
||||
osg::StateSet* getQueryStateSet();
|
||||
const osg::StateSet* getQueryStateSet() const;
|
||||
|
||||
// Get the QueryGeometry object used for occlusion query. Returns 0 if no QueryGeometry is created.
|
||||
osg::QueryGeometry* getQueryGeometry();
|
||||
// Set and get the QueryGeometry object used for the occlusion query.
|
||||
// By default an axis aligned box is used as the query geometry.
|
||||
// Resetting to the default query geometry is done by setting it to 0.
|
||||
// Returns 0 if no QueryGeometry is created.
|
||||
void setQueryGeometry( osg::QueryGeometry* geom );
|
||||
const osg::QueryGeometry* getQueryGeometry() const;
|
||||
|
||||
// Set and get the StateSet used by the OcclusionQueryNode
|
||||
@@ -189,17 +192,30 @@ public:
|
||||
static void discardDeletedQueryObjects( unsigned int contextID );
|
||||
|
||||
protected:
|
||||
enum QueryGeometryState {
|
||||
INVALID,
|
||||
VALID,
|
||||
USER_DEFINED
|
||||
};
|
||||
|
||||
virtual ~OcclusionQueryNode();
|
||||
|
||||
virtual void createSupportNodes();
|
||||
|
||||
bool isQueryGeometryValid() const { return _queryGeometryState != INVALID; }
|
||||
|
||||
void setQueryGeometryInternal( osg::QueryGeometry* queryGeom,
|
||||
osg::Geometry* debugQueryGeom,
|
||||
QueryGeometryState state );
|
||||
|
||||
void updateDefaultQueryGeometry();
|
||||
|
||||
osg::ref_ptr< osg::Geode > _queryGeode;
|
||||
osg::ref_ptr< osg::Geode > _debugGeode;
|
||||
|
||||
bool _enabled;
|
||||
|
||||
// If the box of the query geometry is valid.
|
||||
mutable bool _validQueryGeometry;
|
||||
mutable QueryGeometryState _queryGeometryState;
|
||||
|
||||
// Tracks the last frame number that we performed a query.
|
||||
// User can set how many times (See setQueryFrameCount).
|
||||
|
||||
@@ -66,7 +66,6 @@ class MakeString
|
||||
inline operator std::string () const { return sstream.str(); }
|
||||
|
||||
inline std::string str() const { return sstream.str(); }
|
||||
inline const char* c_str() const { return sstream.str().c_str(); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -60,7 +60,8 @@ class OSGTEXT_EXPORT String : public VectorUInt
|
||||
ENCODING_UTF32, /// 32-bit signature
|
||||
ENCODING_UTF32_BE, /// 32-bit big-endian
|
||||
ENCODING_UTF32_LE, /// 32-bit little-endian
|
||||
ENCODING_SIGNATURE /// detect encoding from signature
|
||||
ENCODING_SIGNATURE, /// detect encoding from signature
|
||||
ENCODING_CURRENT_CODE_PAGE /// Use Windows Current Code Page ecoding
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -265,7 +265,6 @@ protected:
|
||||
virtual osg::StateSet* createStateSet();
|
||||
|
||||
Font* getActiveFont();
|
||||
const Font* getActiveFont() const;
|
||||
|
||||
String::iterator computeLastCharacterOnLine(osg::Vec2& cursor, String::iterator first,String::iterator last);
|
||||
|
||||
|
||||
@@ -312,6 +312,7 @@ protected:
|
||||
// members which have public access.
|
||||
osg::Vec4 _color;
|
||||
osg::ref_ptr<Font> _font;
|
||||
osg::ref_ptr<Font> _fontFallback;
|
||||
osg::ref_ptr<Style> _style;
|
||||
FontResolution _fontSize;
|
||||
float _characterHeight;
|
||||
|
||||
@@ -38,6 +38,8 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::pair< int , osg::ref_ptr<RenderStage> > RenderStageOrderPair;
|
||||
typedef std::list< RenderStageOrderPair > RenderStageList;
|
||||
|
||||
RenderStage();
|
||||
RenderStage(SortMode mode);
|
||||
@@ -236,6 +238,12 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
|
||||
void addPostRenderStage(RenderStage* rs, int order = 0);
|
||||
|
||||
const RenderStageList& getPreRenderList() const { return _preRenderList; }
|
||||
RenderStageList& getPreRenderList() { return _preRenderList; }
|
||||
|
||||
const RenderStageList& getPostRenderList() const { return _postRenderList; }
|
||||
RenderStageList& getPostRenderList() { return _postRenderList; }
|
||||
|
||||
/** Extract stats for current draw list. */
|
||||
bool getStats(Statistics& stats) const;
|
||||
|
||||
@@ -266,8 +274,6 @@ protected:
|
||||
|
||||
virtual ~RenderStage();
|
||||
|
||||
typedef std::pair< int , osg::ref_ptr<RenderStage> > RenderStageOrderPair;
|
||||
typedef std::list< RenderStageOrderPair > RenderStageList;
|
||||
typedef std::vector< osg::ref_ptr<osg::Camera> > Cameras;
|
||||
|
||||
bool _stageDrawnThisFrame;
|
||||
|
||||
@@ -286,7 +286,11 @@ struct GraphicsWindowFunctionProxy
|
||||
#if defined(_WIN32)
|
||||
#define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Win32)
|
||||
#elif defined(__APPLE__)
|
||||
#if defined(OSG_WINDOWING_SYSTEM_CARBON)
|
||||
#define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Carbon)
|
||||
#else
|
||||
#define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Cocoa)
|
||||
#endif
|
||||
#else
|
||||
#define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(X11)
|
||||
#endif
|
||||
|
||||
@@ -80,8 +80,15 @@ ELSE()
|
||||
# double check that pthread_setaffinity_np is available as FreeBSD header doesn't contain required function
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <pthread.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <pthread_np.h>
|
||||
#endif
|
||||
int main() {
|
||||
#ifdef __FreeBSD__
|
||||
cpuset_t cpumask;
|
||||
#else
|
||||
cpu_set_t cpumask;
|
||||
#endif
|
||||
CPU_ZERO( &cpumask );
|
||||
CPU_SET( 0, &cpumask );
|
||||
pthread_setaffinity_np( pthread_self(), sizeof(cpumask), &cpumask);
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#if defined(HAVE_PTHREAD_SETAFFINITY_NP) && defined(__FreeBSD__)
|
||||
#include <pthread_np.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
|
||||
#if defined __linux__ || defined __sun || defined __APPLE__ || ANDROID
|
||||
@@ -45,6 +48,11 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__ANDROID__)
|
||||
# include <unistd.h>
|
||||
# include <sys/syscall.h>
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#ifndef PAGE_SIZE
|
||||
#define PAGE_SIZE 0x400
|
||||
@@ -65,11 +73,6 @@ using namespace OpenThreads;
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Initialize the static unique ids.
|
||||
//
|
||||
int PThreadPrivateData::nextId = 0;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Initialize thread master priority level
|
||||
//
|
||||
@@ -113,7 +116,11 @@ namespace OpenThreads
|
||||
static void setAffinity(const Affinity& affinity)
|
||||
{
|
||||
//std::cout<<"setProcessAffinity : "<< affinity.activeCPUs.size() <<std::endl;
|
||||
#if defined(__FreeBSD__)
|
||||
cpuset_t cpumask;
|
||||
#else
|
||||
cpu_set_t cpumask;
|
||||
#endif
|
||||
CPU_ZERO( &cpumask );
|
||||
unsigned int numprocessors = OpenThreads::GetNumberOfProcessors();
|
||||
if (affinity)
|
||||
@@ -177,8 +184,7 @@ private:
|
||||
|
||||
Thread *thread = static_cast<Thread *>(data);
|
||||
|
||||
PThreadPrivateData *pd =
|
||||
static_cast<PThreadPrivateData *>(thread->_prvData);
|
||||
PThreadPrivateData *pd = static_cast<PThreadPrivateData *>(thread->_prvData);
|
||||
|
||||
// set up processor affinity
|
||||
setAffinity( pd->affinity );
|
||||
@@ -205,6 +211,8 @@ private:
|
||||
|
||||
#endif // ] ALLOW_PRIORITY_SCHEDULING
|
||||
|
||||
pd->uniqueId = Thread::CurrentThreadId();
|
||||
|
||||
pd->setRunning(true);
|
||||
|
||||
// release the thread that created this thread.
|
||||
@@ -456,6 +464,25 @@ Thread *Thread::CurrentThread()
|
||||
|
||||
}
|
||||
|
||||
size_t Thread::CurrentThreadId()
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
return (size_t)::syscall(SYS_thread_selfid);
|
||||
#elif defined(__ANDROID__)
|
||||
return (size_t)gettid();
|
||||
#elif defined(__linux__)
|
||||
return (size_t)::syscall(SYS_gettid);
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
long tid;
|
||||
syscall(SYS_thr_self, &tid);
|
||||
return (size_t)tid;
|
||||
#else
|
||||
return (size_t)pthread_self();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Description: Initialize Threading
|
||||
@@ -521,7 +548,7 @@ void Thread::Init()
|
||||
//
|
||||
// Use: public
|
||||
//
|
||||
int Thread::getThreadId()
|
||||
size_t Thread::getThreadId()
|
||||
{
|
||||
|
||||
PThreadPrivateData *pd = static_cast<PThreadPrivateData *> (_prvData);
|
||||
|
||||
@@ -49,8 +49,7 @@ private:
|
||||
setRunning(false);
|
||||
isCanceled = false;
|
||||
tid = 0;
|
||||
uniqueId = nextId;
|
||||
nextId++;
|
||||
uniqueId = 0;
|
||||
threadPriority = Thread::THREAD_PRIORITY_DEFAULT;
|
||||
threadPolicy = Thread::THREAD_SCHEDULE_DEFAULT;
|
||||
};
|
||||
@@ -78,12 +77,10 @@ private:
|
||||
|
||||
pthread_t tid;
|
||||
|
||||
volatile int uniqueId;
|
||||
size_t uniqueId;
|
||||
|
||||
Affinity affinity;
|
||||
|
||||
static int nextId;
|
||||
|
||||
static pthread_key_t s_tls_key;
|
||||
|
||||
};
|
||||
|
||||
@@ -103,6 +103,8 @@ namespace OpenThreads {
|
||||
|
||||
pd->isRunning = true;
|
||||
|
||||
pd->uniqueId = Thread::CurrentThreadId();
|
||||
|
||||
// release the thread that created this thread.
|
||||
pd->threadStartedBlock.release();
|
||||
|
||||
@@ -210,6 +212,11 @@ Thread* Thread::CurrentThread()
|
||||
return (Thread* )TlsGetValue(ID);
|
||||
}
|
||||
|
||||
size_t Thread::CurrentThreadId()
|
||||
{
|
||||
return (size_t)::GetCurrentThreadId();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Description: Set the concurrency level (no-op)
|
||||
@@ -300,7 +307,7 @@ void Thread::Init() {
|
||||
//
|
||||
// Use: public
|
||||
//
|
||||
int Thread::getThreadId() {
|
||||
size_t Thread::getThreadId() {
|
||||
Win32ThreadPrivateData *pd = static_cast<Win32ThreadPrivateData *> (_prvData);
|
||||
return pd->uniqueId;
|
||||
}
|
||||
@@ -352,7 +359,7 @@ int Thread::start() {
|
||||
pd->tid.set( (void*)_beginthreadex(NULL,static_cast<unsigned>(pd->stackSize),ThreadPrivateActions::StartThread,static_cast<void *>(this),CREATE_SUSPENDED,&ID));
|
||||
ResumeThread(pd->tid.get());
|
||||
|
||||
pd->uniqueId = (int)ID;
|
||||
pd->uniqueId = (size_t)ID;
|
||||
|
||||
if(!pd->tid) {
|
||||
return -1;
|
||||
@@ -442,9 +449,9 @@ int Thread::testCancel()
|
||||
if(pd->cancelMode == 2)
|
||||
return 0;
|
||||
|
||||
DWORD curr = GetCurrentThreadId();
|
||||
size_t curr = Thread::CurrentThreadId();
|
||||
|
||||
if( pd->uniqueId != (int)curr )
|
||||
if( pd->uniqueId != curr )
|
||||
return -1;
|
||||
|
||||
// pd->isRunning = false;
|
||||
|
||||
@@ -54,7 +54,7 @@ private:
|
||||
|
||||
HandleHolder tid;
|
||||
|
||||
int uniqueId;
|
||||
size_t uniqueId;
|
||||
|
||||
Affinity affinity;
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ osg::Matrixd AutoTransform::computeMatrix(const osg::NodeVisitor* nv) const
|
||||
{
|
||||
double size = 1.0/cs->pixelSize(getPosition(),0.48f);
|
||||
|
||||
//if (_autoScaleTransitionWidthRatio>0.0)
|
||||
if (_autoScaleTransitionWidthRatio>0.0)
|
||||
{
|
||||
if (_minimumScale>0.0)
|
||||
{
|
||||
@@ -185,6 +185,18 @@ osg::Matrixd AutoTransform::computeMatrix(const osg::NodeVisitor* nv) const
|
||||
else if (size>m) size = a + b*size + c*(size*size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_minimumScale>0.0 && size<_minimumScale)
|
||||
{
|
||||
size = _minimumScale;
|
||||
}
|
||||
|
||||
if (_maximumScale<DBL_MAX && size>_maximumScale)
|
||||
{
|
||||
size = _maximumScale;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO setScale(size);
|
||||
scale.set(size, size, size);
|
||||
|
||||
@@ -49,7 +49,9 @@ void ClampColor::apply(State& state) const
|
||||
return;
|
||||
}
|
||||
|
||||
#if !defined(OSG_GL3_AVAILABLE)
|
||||
extensions->glClampColor(GL_CLAMP_VERTEX_COLOR, _clampVertexColor);
|
||||
extensions->glClampColor(GL_CLAMP_FRAGMENT_COLOR, _clampFragmentColor);
|
||||
#endif
|
||||
extensions->glClampColor(GL_CLAMP_READ_COLOR, _clampReadColor);
|
||||
}
|
||||
|
||||
@@ -36,5 +36,6 @@
|
||||
#cmakedefine OSG_PROVIDE_READFILE
|
||||
#cmakedefine OSG_USE_DEPRECATED_API
|
||||
#cmakedefine OSG_ENVVAR_SUPPORTED
|
||||
#cmakedefine OSG_WINDOWING_SYSTEM_CARBON
|
||||
|
||||
#endif
|
||||
|
||||
@@ -721,9 +721,9 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
setGLExtensionFuncPtr(glTexBuffer, "glTexBuffer","glTexBufferARB" , validContext);
|
||||
|
||||
isVBOSupported = validContext && (OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID,"GL_ARB_vertex_buffer_object"));
|
||||
isPBOSupported = validContext && (OSG_GLES3_FEATURES || OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID,"GL_ARB_pixel_buffer_object"));
|
||||
isPBOSupported = validContext && ((OSG_GLES3_FEATURES && glVersion >= 3.0) || OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID,"GL_ARB_pixel_buffer_object"));
|
||||
isTBOSupported = validContext && osg::isGLExtensionSupported(contextID,"GL_ARB_texture_buffer_object");
|
||||
isVAOSupported = validContext && (OSG_GLES3_FEATURES || OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID, "GL_ARB_vertex_array_object", "GL_OES_vertex_array_object"));
|
||||
isVAOSupported = validContext && ((OSG_GLES3_FEATURES && glVersion >= 3.0) || OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID, "GL_ARB_vertex_array_object", "GL_OES_vertex_array_object"));
|
||||
isTransformFeedbackSupported = validContext && osg::isGLExtensionSupported(contextID, "GL_ARB_transform_feedback2");
|
||||
isBufferObjectSupported = isVBOSupported || isPBOSupported;
|
||||
|
||||
@@ -1077,6 +1077,9 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
|
||||
|
||||
// FrameBufferObject
|
||||
isMultisampledRenderToTextureSupported = validContext && isGLExtensionSupported(contextID, "GL_EXT_multisampled_render_to_texture");
|
||||
isInvalidateFramebufferSupported = validContext && (isGLExtensionSupported(contextID, "GL_ARB_invalidate_subdata") || (OSG_GLES3_FEATURES && glVersion >= 3.0) || glVersion >= 4.3);
|
||||
|
||||
setGLExtensionFuncPtr(glBindRenderbuffer, "glBindRenderbuffer", "glBindRenderbufferEXT", "glBindRenderbufferOES", validContext);
|
||||
setGLExtensionFuncPtr(glDeleteRenderbuffers, "glDeleteRenderbuffers", "glDeleteRenderbuffersEXT", "glDeleteRenderbuffersOES", validContext);
|
||||
setGLExtensionFuncPtr(glGenRenderbuffers, "glGenRenderbuffers", "glGenRenderbuffersEXT", "glGenRenderbuffersOES", validContext);
|
||||
@@ -1090,6 +1093,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
|
||||
setGLExtensionFuncPtr(glFramebufferTexture1D, "glFramebufferTexture1D", "glFramebufferTexture1DEXT", "glFramebufferTexture1DOES", validContext);
|
||||
setGLExtensionFuncPtr(glFramebufferTexture2D, "glFramebufferTexture2D", "glFramebufferTexture2DEXT", "glFramebufferTexture2DOES", validContext);
|
||||
setGLExtensionFuncPtr(glFramebufferTexture2DMultisample, "glFramebufferTexture2DMultisample", "glFramebufferTexture2DMultisampleEXT", validContext);
|
||||
setGLExtensionFuncPtr(glFramebufferTexture3D, "glFramebufferTexture3D", "glFramebufferTexture3DEXT", "glFramebufferTexture3DOES", validContext);
|
||||
setGLExtensionFuncPtr(glFramebufferTexture, "glFramebufferTexture", "glFramebufferTextureEXT", "glFramebufferTextureOES", validContext);
|
||||
setGLExtensionFuncPtr(glFramebufferTextureLayer, "glFramebufferTextureLayer", "glFramebufferTextureLayerEXT", "glFramebufferTextureLayerOES", validContext);
|
||||
@@ -1105,6 +1109,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
|
||||
setGLExtensionFuncPtr(glGenerateMipmap, "glGenerateMipmap", "glGenerateMipmapEXT", "glGenerateMipmapOES", validContext);
|
||||
setGLExtensionFuncPtr(glBlitFramebuffer, "glBlitFramebuffer", "glBlitFramebufferEXT", "glBlitFramebufferOES", validContext);
|
||||
setGLExtensionFuncPtr(glInvalidateFramebuffer, "glInvalidateFramebuffer", "glInvalidateFramebufferEXT", validContext);
|
||||
setGLExtensionFuncPtr(glGetRenderbufferParameteriv, "glGetRenderbufferParameteriv", "glGetRenderbufferParameterivEXT", "glGetRenderbufferParameterivOES", validContext);
|
||||
|
||||
|
||||
|
||||
@@ -526,7 +526,7 @@ void GraphicsContext::close(bool callCloseImplementation)
|
||||
|
||||
bool GraphicsContext::makeCurrent()
|
||||
{
|
||||
_threadOfLastMakeCurrent = OpenThreads::Thread::CurrentThread();
|
||||
_threadOfLastMakeCurrent = OpenThreads::Thread::CurrentThreadId();
|
||||
|
||||
bool result = makeCurrentImplementation();
|
||||
|
||||
@@ -546,7 +546,7 @@ bool GraphicsContext::makeContextCurrent(GraphicsContext* readContext)
|
||||
|
||||
if (result)
|
||||
{
|
||||
_threadOfLastMakeCurrent = OpenThreads::Thread::CurrentThread();
|
||||
_threadOfLastMakeCurrent = OpenThreads::Thread::CurrentThreadId();
|
||||
|
||||
// initialize extension process, not only initializes on first
|
||||
// call, will be a non-op on subsequent calls.
|
||||
@@ -560,7 +560,7 @@ bool GraphicsContext::releaseContext()
|
||||
{
|
||||
bool result = releaseContextImplementation();
|
||||
|
||||
_threadOfLastMakeCurrent = (OpenThreads::Thread*)(-1);
|
||||
_threadOfLastMakeCurrent = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -573,7 +573,7 @@ void GraphicsContext::swapBuffers()
|
||||
clear();
|
||||
}
|
||||
else if (_graphicsThread.valid() &&
|
||||
_threadOfLastMakeCurrent == _graphicsThread.get())
|
||||
_threadOfLastMakeCurrent == _graphicsThread->getThreadId())
|
||||
{
|
||||
_graphicsThread->add(new SwapBuffersOperation);
|
||||
}
|
||||
|
||||
@@ -1696,11 +1696,11 @@ void Image::copySubImage(int s_offset, int t_offset, int r_offset, const osg::Im
|
||||
}
|
||||
unsigned int rowWidthInBlocks = (_s + footprint.x() - 1) / footprint.x();
|
||||
unsigned int blockSize = computeBlockSize(_pixelFormat, 0);
|
||||
data_destination = _data + blockSize * (rowWidthInBlocks * t_offset + (s_offset / footprint.x()));
|
||||
data_destination = _data + blockSize * (rowWidthInBlocks * (t_offset / footprint.y()) + (s_offset / footprint.x()));
|
||||
unsigned int copy_width = (osg::minimum(source->s(), _s - s_offset) + footprint.x() - 1) / footprint.x();
|
||||
unsigned int copy_height = (osg::minimum(source->t(), _t - t_offset) + footprint.y() - 1) / footprint.y();
|
||||
unsigned int dstRowStep = blockSize * rowWidthInBlocks;
|
||||
unsigned int srcRowStep = blockSize * (source->_s + footprint.x() - 1) / footprint.x();
|
||||
unsigned int srcRowStep = blockSize * ((source->_s + footprint.x() - 1) / footprint.x());
|
||||
const unsigned char* data_source = source->data(0, 0, 0);
|
||||
for (unsigned int row = 0; row < copy_height; row += 1) { //copy blocks in a row, footprint.y() rows at a time
|
||||
memcpy(data_destination, data_source, copy_width * blockSize);
|
||||
|
||||
@@ -747,18 +747,22 @@ bool Matrix_implementation::transpose(const Matrix_implementation&mat){
|
||||
Matrix_implementation tm(mat);
|
||||
return transpose(tm);
|
||||
}
|
||||
_mat[0][0]=mat._mat[0][0];
|
||||
_mat[0][1]=mat._mat[1][0];
|
||||
_mat[0][2]=mat._mat[2][0];
|
||||
_mat[0][3]=mat._mat[3][0];
|
||||
_mat[1][0]=mat._mat[0][1];
|
||||
_mat[1][1]=mat._mat[1][1];
|
||||
_mat[1][2]=mat._mat[2][1];
|
||||
_mat[1][3]=mat._mat[3][1];
|
||||
_mat[2][0]=mat._mat[0][2];
|
||||
_mat[2][1]=mat._mat[1][2];
|
||||
_mat[2][2]=mat._mat[2][2];
|
||||
_mat[2][3]=mat._mat[3][2];
|
||||
_mat[3][0]=mat._mat[0][3];
|
||||
_mat[3][1]=mat._mat[1][3];
|
||||
_mat[3][2]=mat._mat[2][3];
|
||||
_mat[3][3]=mat._mat[3][3];
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -767,12 +771,15 @@ bool Matrix_implementation::transpose3x3(const Matrix_implementation&mat){
|
||||
Matrix_implementation tm(mat);
|
||||
return transpose3x3(tm);
|
||||
}
|
||||
_mat[0][0]=mat._mat[0][0];
|
||||
_mat[0][1]=mat._mat[1][0];
|
||||
_mat[0][2]=mat._mat[2][0];
|
||||
_mat[1][0]=mat._mat[0][1];
|
||||
_mat[1][1]=mat._mat[1][1];
|
||||
_mat[1][2]=mat._mat[2][1];
|
||||
_mat[2][0]=mat._mat[0][2];
|
||||
_mat[2][1]=mat._mat[1][2];
|
||||
_mat[2][2]=mat._mat[2][2];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,36 @@
|
||||
namespace osg
|
||||
{
|
||||
|
||||
QueryGeometry* createDefaultQueryGeometry( const std::string& name )
|
||||
{
|
||||
GLushort indices[] = { 0, 1, 2, 3, 4, 5, 6, 7,
|
||||
0, 3, 6, 5, 2, 1, 4, 7,
|
||||
5, 4, 1, 0, 2, 7, 6, 3 };
|
||||
|
||||
ref_ptr<QueryGeometry> geom = new QueryGeometry( name );
|
||||
geom->setDataVariance( Object::DYNAMIC );
|
||||
geom->addPrimitiveSet( new DrawElementsUShort( PrimitiveSet::QUADS, 24, indices ) );
|
||||
|
||||
return geom.release();
|
||||
}
|
||||
|
||||
Geometry* createDefaultDebugQueryGeometry()
|
||||
{
|
||||
GLushort indices[] = { 0, 1, 2, 3, 4, 5, 6, 7,
|
||||
0, 3, 6, 5, 2, 1, 4, 7,
|
||||
5, 4, 1, 0, 2, 7, 6, 3 };
|
||||
|
||||
ref_ptr<Vec4Array> ca = new Vec4Array;
|
||||
ca->push_back( Vec4( 1.f, 1.f, 1.f, 1.f ) );
|
||||
|
||||
ref_ptr<Geometry> geom = new Geometry;
|
||||
geom->setDataVariance( Object::DYNAMIC );
|
||||
geom->setColorArray( ca.get(), Array::BIND_OVERALL );
|
||||
geom->addPrimitiveSet( new DrawElementsUShort( PrimitiveSet::QUADS, 24, indices ) );
|
||||
|
||||
return geom.release();
|
||||
}
|
||||
|
||||
// Create and return a StateSet appropriate for performing an occlusion
|
||||
// query test (disable lighting, texture mapping, etc). Probably some
|
||||
// room for improvement here. Could disable shaders, for example.
|
||||
@@ -364,7 +394,7 @@ QueryGeometry::drawImplementation( osg::RenderInfo& renderInfo ) const
|
||||
|
||||
}
|
||||
|
||||
QueryGeometry::QueryResult QueryGeometry::getQueryResult( const osg::Camera* cam )
|
||||
QueryGeometry::QueryResult QueryGeometry::getQueryResult( const osg::Camera* cam ) const
|
||||
{
|
||||
osg::ref_ptr<osg::TestResult> tr;
|
||||
{
|
||||
@@ -380,7 +410,7 @@ QueryGeometry::QueryResult QueryGeometry::getQueryResult( const osg::Camera* cam
|
||||
}
|
||||
|
||||
unsigned int
|
||||
QueryGeometry::getNumPixels( const osg::Camera* cam )
|
||||
QueryGeometry::getNumPixels( const osg::Camera* cam ) const
|
||||
{
|
||||
return getQueryResult(cam).numPixels;
|
||||
}
|
||||
@@ -442,7 +472,7 @@ QueryGeometry::discardDeletedQueryObjects( unsigned int contextID )
|
||||
|
||||
OcclusionQueryNode::OcclusionQueryNode()
|
||||
: _enabled( true ),
|
||||
_validQueryGeometry( false ),
|
||||
_queryGeometryState( INVALID ),
|
||||
_passed(false),
|
||||
_visThreshold( 500 ),
|
||||
_queryFrameCount( 5 ),
|
||||
@@ -460,7 +490,7 @@ OcclusionQueryNode::~OcclusionQueryNode()
|
||||
|
||||
OcclusionQueryNode::OcclusionQueryNode( const OcclusionQueryNode& oqn, const CopyOp& copyop )
|
||||
: Group( oqn, copyop ),
|
||||
_validQueryGeometry( false ),
|
||||
_queryGeometryState( INVALID ),
|
||||
_passed( false )
|
||||
{
|
||||
_enabled = oqn._enabled;
|
||||
@@ -485,7 +515,7 @@ bool OcclusionQueryNode::getPassed( const Camera* camera, NodeVisitor& nv )
|
||||
|
||||
QueryGeometry* qg = static_cast< QueryGeometry* >( _queryGeode->getDrawable( 0 ) );
|
||||
|
||||
if ( !_validQueryGeometry )
|
||||
if ( !isQueryGeometryValid() )
|
||||
{
|
||||
// There're cases that the occlusion test result has been retrieved
|
||||
// after the query geometry has been changed, it's the result of the
|
||||
@@ -556,7 +586,7 @@ bool OcclusionQueryNode::getPassed( const Camera* camera, NodeVisitor& nv )
|
||||
|
||||
void OcclusionQueryNode::traverseQuery( const Camera* camera, NodeVisitor& nv )
|
||||
{
|
||||
if (!_validQueryGeometry || ! _enabled)
|
||||
if (!isQueryGeometryValid() || !_enabled)
|
||||
return;
|
||||
|
||||
bool issueQuery;
|
||||
@@ -590,42 +620,13 @@ BoundingSphere OcclusionQueryNode::computeBound() const
|
||||
// an application thread or by a non-osgViewer application.
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock( _computeBoundMutex ) ;
|
||||
|
||||
// This is the logical place to put this code, but the method is const. Cast
|
||||
// away constness to compute the bounding box and modify the query geometry.
|
||||
osg::OcclusionQueryNode* nonConstThis = const_cast<osg::OcclusionQueryNode*>( this );
|
||||
|
||||
|
||||
ComputeBoundsVisitor cbv;
|
||||
nonConstThis->accept( cbv );
|
||||
BoundingBox bb = cbv.getBoundingBox();
|
||||
const bool bbValid = bb.valid();
|
||||
_validQueryGeometry = bbValid;
|
||||
|
||||
osg::ref_ptr<Vec3Array> v = new Vec3Array;
|
||||
v->resize( 8 );
|
||||
|
||||
// Having (0,0,0) as vertices for the case of the invalid query geometry
|
||||
// still isn't quite the right thing. But the query geometry is public
|
||||
// accessible and therefore a user might expect eight vertices, so
|
||||
// it seems safer to keep eight vertices in the geometry.
|
||||
|
||||
if (bbValid)
|
||||
if (_queryGeometryState != USER_DEFINED)
|
||||
{
|
||||
(*v)[0] = Vec3( bb._min.x(), bb._min.y(), bb._min.z() );
|
||||
(*v)[1] = Vec3( bb._max.x(), bb._min.y(), bb._min.z() );
|
||||
(*v)[2] = Vec3( bb._max.x(), bb._min.y(), bb._max.z() );
|
||||
(*v)[3] = Vec3( bb._min.x(), bb._min.y(), bb._max.z() );
|
||||
(*v)[4] = Vec3( bb._max.x(), bb._max.y(), bb._min.z() );
|
||||
(*v)[5] = Vec3( bb._min.x(), bb._max.y(), bb._min.z() );
|
||||
(*v)[6] = Vec3( bb._min.x(), bb._max.y(), bb._max.z() );
|
||||
(*v)[7] = Vec3( bb._max.x(), bb._max.y(), bb._max.z() );
|
||||
// This is the logical place to put this code, but the method is const. Cast
|
||||
// away constness to compute the bounding box and modify the query geometry.
|
||||
osg::OcclusionQueryNode* nonConstThis = const_cast<osg::OcclusionQueryNode*>( this );
|
||||
nonConstThis->updateDefaultQueryGeometry();
|
||||
}
|
||||
|
||||
Geometry* geom = static_cast< Geometry* >( nonConstThis->_queryGeode->getDrawable( 0 ) );
|
||||
geom->setVertexArray( v.get() );
|
||||
|
||||
geom = static_cast< osg::Geometry* >( nonConstThis->_debugGeode->getDrawable( 0 ) );
|
||||
geom->setVertexArray( v.get() );
|
||||
}
|
||||
|
||||
return Group::computeBound();
|
||||
@@ -723,21 +724,12 @@ bool OcclusionQueryNode::getPassed() const
|
||||
|
||||
void OcclusionQueryNode::createSupportNodes()
|
||||
{
|
||||
GLushort indices[] = { 0, 1, 2, 3, 4, 5, 6, 7,
|
||||
0, 3, 6, 5, 2, 1, 4, 7,
|
||||
5, 4, 1, 0, 2, 7, 6, 3 };
|
||||
|
||||
{
|
||||
// Add the test geometry Geode
|
||||
_queryGeode = new Geode;
|
||||
_queryGeode->setName( "OQTest" );
|
||||
_queryGeode->setDataVariance( Object::DYNAMIC );
|
||||
|
||||
ref_ptr< QueryGeometry > geom = new QueryGeometry( getName() );
|
||||
geom->setDataVariance( Object::DYNAMIC );
|
||||
geom->addPrimitiveSet( new DrawElementsUShort( PrimitiveSet::QUADS, 24, indices ) );
|
||||
|
||||
_queryGeode->addDrawable( geom.get() );
|
||||
_queryGeode->addDrawable( createDefaultQueryGeometry( getName() ) );
|
||||
}
|
||||
|
||||
{
|
||||
@@ -746,17 +738,7 @@ void OcclusionQueryNode::createSupportNodes()
|
||||
_debugGeode = new Geode;
|
||||
_debugGeode->setName( "Debug" );
|
||||
_debugGeode->setDataVariance( Object::DYNAMIC );
|
||||
|
||||
ref_ptr<Geometry> geom = new Geometry;
|
||||
geom->setDataVariance( Object::DYNAMIC );
|
||||
|
||||
ref_ptr<Vec4Array> ca = new Vec4Array;
|
||||
ca->push_back( Vec4( 1.f, 1.f, 1.f, 1.f ) );
|
||||
geom->setColorArray( ca.get(), Array::BIND_OVERALL );
|
||||
|
||||
geom->addPrimitiveSet( new DrawElementsUShort( PrimitiveSet::QUADS, 24, indices ) );
|
||||
|
||||
_debugGeode->addDrawable( geom.get() );
|
||||
_debugGeode->addDrawable( createDefaultDebugQueryGeometry() );
|
||||
}
|
||||
|
||||
// Creste state sets. Note that the osgOQ visitors (which place OQNs throughout
|
||||
@@ -767,6 +749,69 @@ void OcclusionQueryNode::createSupportNodes()
|
||||
}
|
||||
|
||||
|
||||
void OcclusionQueryNode::setQueryGeometryInternal( QueryGeometry* queryGeom,
|
||||
Geometry* debugQueryGeom,
|
||||
QueryGeometryState state )
|
||||
{
|
||||
if (!queryGeom || !debugQueryGeom)
|
||||
{
|
||||
OSG_FATAL << "osgOQ: OcclusionQueryNode: No QueryGeometry." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
_queryGeometryState = state;
|
||||
|
||||
_queryGeode->removeDrawables(0, _queryGeode->getNumDrawables());
|
||||
_queryGeode->addDrawable(queryGeom);
|
||||
|
||||
_debugGeode->removeDrawables(0, _debugGeode->getNumDrawables());
|
||||
_debugGeode->addDrawable(debugQueryGeom);
|
||||
}
|
||||
|
||||
|
||||
void OcclusionQueryNode::updateDefaultQueryGeometry()
|
||||
{
|
||||
if (_queryGeometryState == USER_DEFINED)
|
||||
{
|
||||
OSG_FATAL << "osgOQ: OcclusionQueryNode: Unexpected QueryGeometryState=USER_DEFINED." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
ComputeBoundsVisitor cbv;
|
||||
accept( cbv );
|
||||
|
||||
BoundingBox bb = cbv.getBoundingBox();
|
||||
const bool bbValid = bb.valid();
|
||||
_queryGeometryState = bbValid ? VALID : INVALID;
|
||||
|
||||
osg::ref_ptr<Vec3Array> v = new Vec3Array;
|
||||
v->resize( 8 );
|
||||
|
||||
// Having (0,0,0) as vertices for the case of the invalid query geometry
|
||||
// still isn't quite the right thing. But the query geometry is public
|
||||
// accessible and therefore a user might expect eight vertices, so
|
||||
// it seems safer to keep eight vertices in the geometry.
|
||||
|
||||
if (bbValid)
|
||||
{
|
||||
(*v)[0] = Vec3( bb._min.x(), bb._min.y(), bb._min.z() );
|
||||
(*v)[1] = Vec3( bb._max.x(), bb._min.y(), bb._min.z() );
|
||||
(*v)[2] = Vec3( bb._max.x(), bb._min.y(), bb._max.z() );
|
||||
(*v)[3] = Vec3( bb._min.x(), bb._min.y(), bb._max.z() );
|
||||
(*v)[4] = Vec3( bb._max.x(), bb._max.y(), bb._min.z() );
|
||||
(*v)[5] = Vec3( bb._min.x(), bb._max.y(), bb._min.z() );
|
||||
(*v)[6] = Vec3( bb._min.x(), bb._max.y(), bb._max.z() );
|
||||
(*v)[7] = Vec3( bb._max.x(), bb._max.y(), bb._max.z() );
|
||||
}
|
||||
|
||||
Geometry* geom = static_cast< Geometry* >( _queryGeode->getDrawable( 0 ) );
|
||||
geom->setVertexArray( v.get() );
|
||||
|
||||
geom = static_cast< osg::Geometry* >( _debugGeode->getDrawable( 0 ) );
|
||||
geom->setVertexArray( v.get() );
|
||||
}
|
||||
|
||||
|
||||
void OcclusionQueryNode::releaseGLObjects( State* state ) const
|
||||
{
|
||||
if (_queryGeode.valid()) _queryGeode->releaseGLObjects(state);
|
||||
@@ -787,14 +832,22 @@ void OcclusionQueryNode::discardDeletedQueryObjects( unsigned int contextID )
|
||||
QueryGeometry::discardDeletedQueryObjects( contextID );
|
||||
}
|
||||
|
||||
osg::QueryGeometry* OcclusionQueryNode::getQueryGeometry()
|
||||
void OcclusionQueryNode::setQueryGeometry( QueryGeometry* geom )
|
||||
{
|
||||
if (_queryGeode && _queryGeode->getDrawable( 0 ))
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock( _computeBoundMutex ) ;
|
||||
|
||||
if (geom)
|
||||
{
|
||||
QueryGeometry* qg = static_cast< QueryGeometry* >( _queryGeode->getDrawable( 0 ) );
|
||||
return qg;
|
||||
setQueryGeometryInternal( geom, geom, USER_DEFINED );
|
||||
}
|
||||
else
|
||||
{
|
||||
setQueryGeometryInternal( createDefaultQueryGeometry( getName() ),
|
||||
createDefaultDebugQueryGeometry(),
|
||||
INVALID);
|
||||
|
||||
updateDefaultQueryGeometry();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const osg::QueryGeometry* OcclusionQueryNode::getQueryGeometry() const
|
||||
|
||||
@@ -147,8 +147,8 @@ IF(AV_FOUNDATION_FOUND)
|
||||
ADD_DEFINITIONS(-DUSE_AV_FOUNDATION)
|
||||
ENDIF()
|
||||
|
||||
IF(XINE_FOUND)
|
||||
ADD_DEFINITIONS(-DUSE_XINE)
|
||||
IF(FFMPEG_FOUND)
|
||||
ADD_DEFINITIONS(-DUSE_FFMPEG)
|
||||
ENDIF()
|
||||
|
||||
IF(INVENTOR_FOUND)
|
||||
|
||||
@@ -77,6 +77,8 @@ DynamicLibrary* DynamicLibrary::loadLibrary(const std::string& libraryName)
|
||||
|
||||
HANDLE handle = NULL;
|
||||
|
||||
OSG_DEBUG << "DynamicLibrary::try to load library \"" << libraryName << "\"" << std::endl;
|
||||
|
||||
std::string fullLibraryName = osgDB::findLibraryFile(libraryName);
|
||||
if (!fullLibraryName.empty()) handle = getLibraryHandle( fullLibraryName ); // try the lib we have found
|
||||
else handle = getLibraryHandle( libraryName ); // haven't found a lib ourselves, see if the OS can find it simply from the library name.
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include <osg/Texture>
|
||||
#include <osgDB/ObjectCache>
|
||||
#include <osgDB/Options>
|
||||
|
||||
@@ -188,15 +189,95 @@ void ObjectCache::clear()
|
||||
_objectCache.clear();
|
||||
}
|
||||
|
||||
namespace ObjectCacheUtils
|
||||
{
|
||||
|
||||
struct ContainsUnreffedTextures : public osg::NodeVisitor
|
||||
{
|
||||
ContainsUnreffedTextures() :
|
||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
|
||||
foundUnreffedTexture(false)
|
||||
{}
|
||||
|
||||
bool foundUnreffedTexture;
|
||||
|
||||
bool check(const osg::Texture* texture)
|
||||
{
|
||||
if (!texture) return false;
|
||||
|
||||
unsigned int numImages = 0;
|
||||
for(unsigned int i=0; i<texture->getNumImages(); ++i)
|
||||
{
|
||||
if (texture->getImage(i)) ++numImages;
|
||||
}
|
||||
|
||||
return numImages==0;
|
||||
}
|
||||
|
||||
bool check(const osg::StateSet* stateset)
|
||||
{
|
||||
for(unsigned int i=0; i<stateset->getNumTextureAttributeLists(); ++i)
|
||||
{
|
||||
const osg::StateAttribute* sa = stateset->getTextureAttribute(i, osg::StateAttribute::TEXTURE);
|
||||
if (sa && check(sa->asTexture())) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool check(osg::Object* object)
|
||||
{
|
||||
if (object->asStateAttribute()) return check(dynamic_cast<const osg::Texture*>(object));
|
||||
if (object->asStateSet()) return check(object->asStateSet());
|
||||
if (!object->asNode()) return false;
|
||||
|
||||
foundUnreffedTexture = false;
|
||||
|
||||
object->asNode()->accept(*this);
|
||||
|
||||
return foundUnreffedTexture;
|
||||
}
|
||||
|
||||
void apply(osg::Node& node)
|
||||
{
|
||||
if (node.getStateSet())
|
||||
{
|
||||
if (check(node.getStateSet()))
|
||||
{
|
||||
foundUnreffedTexture = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
traverse(node);
|
||||
}
|
||||
};
|
||||
|
||||
} // ObjectCacheUtils
|
||||
|
||||
void ObjectCache::releaseGLObjects(osg::State* state)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_objectCacheMutex);
|
||||
|
||||
ObjectCacheUtils::ContainsUnreffedTextures cut;
|
||||
|
||||
for(ObjectCacheMap::iterator itr = _objectCache.begin();
|
||||
itr != _objectCache.end();
|
||||
++itr)
|
||||
)
|
||||
{
|
||||
ObjectCacheMap::iterator curr_itr = itr;
|
||||
|
||||
// get object and advance iterator to next item
|
||||
osg::Object* object = itr->second.first.get();
|
||||
|
||||
bool needToRemoveEntry = cut.check(itr->second.first.get());
|
||||
|
||||
object->releaseGLObjects(state);
|
||||
|
||||
++itr;
|
||||
|
||||
if (needToRemoveEntry)
|
||||
{
|
||||
_objectCache.erase(curr_itr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,6 +495,12 @@ void OutputStream::writeImage( const osg::Image* img )
|
||||
imageFileName = "image.dds";
|
||||
}
|
||||
|
||||
std::string imagePath = osgDB::getFilePath(imageFileName);
|
||||
if (!imagePath.empty() && !osgDB::fileExists(imagePath))
|
||||
{
|
||||
osgDB::makeDirectory(imagePath);
|
||||
}
|
||||
|
||||
bool result = osgDB::writeImageFile( *img, imageFileName );
|
||||
OSG_NOTICE << "OutputStream::writeImage(): Write image data to external file " << imageFileName << std::endl;
|
||||
if ( !result )
|
||||
|
||||
@@ -380,16 +380,16 @@ Registry::Registry()
|
||||
addFileExtensionAlias("tif", "tiff");
|
||||
|
||||
// really need to decide this at runtime...
|
||||
#if defined(USE_XINE)
|
||||
#if defined(USE_FFMPEG)
|
||||
|
||||
addFileExtensionAlias("mov", "xine");
|
||||
addFileExtensionAlias("mpg", "xine");
|
||||
addFileExtensionAlias("ogv", "xine");
|
||||
addFileExtensionAlias("mpv", "xine");
|
||||
addFileExtensionAlias("dv", "xine");
|
||||
addFileExtensionAlias("avi", "xine");
|
||||
addFileExtensionAlias("wmv", "xine");
|
||||
addFileExtensionAlias("flv", "xine");
|
||||
addFileExtensionAlias("mov", "ffmpeg");
|
||||
addFileExtensionAlias("mpg", "ffmpeg");
|
||||
addFileExtensionAlias("ogv", "ffmpeg");
|
||||
addFileExtensionAlias("mpv", "ffmpeg");
|
||||
addFileExtensionAlias("dv", "ffmpeg");
|
||||
addFileExtensionAlias("avi", "ffmpeg");
|
||||
addFileExtensionAlias("wmv", "ffmpeg");
|
||||
addFileExtensionAlias("flv", "ffmpeg");
|
||||
#endif
|
||||
|
||||
// support QuickTime for Windows
|
||||
|
||||
@@ -357,7 +357,7 @@ osgGA::GUIEventAdapter* EventQueue::mouseButtonRelease(float x, float y, unsigne
|
||||
|
||||
osgGA::GUIEventAdapter* EventQueue::keyPress(int key, double time, int unmodifiedKey)
|
||||
{
|
||||
switch(key)
|
||||
switch(unmodifiedKey)
|
||||
{
|
||||
case(GUIEventAdapter::KEY_Shift_L): _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_LEFT_SHIFT | _accumulateEventState->getModKeyMask()); break;
|
||||
case(GUIEventAdapter::KEY_Shift_R): _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_RIGHT_SHIFT | _accumulateEventState->getModKeyMask()); break;
|
||||
@@ -403,7 +403,7 @@ osgGA::GUIEventAdapter* EventQueue::keyPress(int key, double time, int unmodifie
|
||||
|
||||
osgGA::GUIEventAdapter* EventQueue::keyRelease(int key, double time, int unmodifiedKey)
|
||||
{
|
||||
switch(key)
|
||||
switch(unmodifiedKey)
|
||||
{
|
||||
case(GUIEventAdapter::KEY_Shift_L): _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_LEFT_SHIFT & _accumulateEventState->getModKeyMask()); break;
|
||||
case(GUIEventAdapter::KEY_Shift_R): _accumulateEventState->setModKeyMask(~GUIEventAdapter::MODKEY_RIGHT_SHIFT & _accumulateEventState->getModKeyMask()); break;
|
||||
|
||||
@@ -343,16 +343,16 @@ void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo
|
||||
|
||||
if (_alignment==BILLBOARD)
|
||||
{
|
||||
xAxis = osg::Matrix::transform3x3(R,scaled_aligned_xAxis);
|
||||
xAxis = osg::Matrix::transform3x3(scaled_aligned_xAxis, R);
|
||||
xAxis = osg::Matrix::transform3x3(modelview,xAxis);
|
||||
|
||||
yAxis = osg::Matrix::transform3x3(R,scaled_aligned_yAxis);
|
||||
yAxis = osg::Matrix::transform3x3(scaled_aligned_yAxis, R);
|
||||
yAxis = osg::Matrix::transform3x3(modelview,yAxis);
|
||||
}
|
||||
else
|
||||
{
|
||||
xAxis = osg::Matrix::transform3x3(R, scaled_aligned_xAxis);
|
||||
yAxis = osg::Matrix::transform3x3(R, scaled_aligned_yAxis);
|
||||
xAxis = osg::Matrix::transform3x3(scaled_aligned_xAxis, R);
|
||||
yAxis = osg::Matrix::transform3x3(scaled_aligned_yAxis, R);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo
|
||||
texcoords.push_back(t1);
|
||||
texcoords.push_back(t2);
|
||||
|
||||
#if !defined(OSG_GLES2_AVAILABLE)
|
||||
#if defined(OSG_GL1_AVAILABLE) || defined(OSG_GL2_AVAILABLE) || defined(OSG_GLES1_AVAILABLE)
|
||||
const unsigned int count = 4;
|
||||
const GLenum mode = GL_QUADS;
|
||||
|
||||
@@ -419,7 +419,7 @@ void osgParticle::ParticleSystem::drawImplementation(osg::RenderInfo& renderInfo
|
||||
vertices.push_back(c3);
|
||||
texcoords.push_back(t3);
|
||||
#else
|
||||
// No GL_QUADS mode on GLES2 and upper
|
||||
// No GL_QUADS mode on OpenGL 3 and upper / GLES2 and upper
|
||||
const unsigned int count = 6;
|
||||
const GLenum mode = GL_TRIANGLES;
|
||||
|
||||
|
||||
@@ -1537,15 +1537,14 @@ convertShader(osg::Shader::Type osgShaderType,
|
||||
return true;
|
||||
|
||||
// Create shader
|
||||
osg::ref_ptr<osg::Shader> osgShader = new osg::Shader(osgShaderType);
|
||||
osg::ref_ptr<osg::Shader> osgShader;
|
||||
if (ivShader->sourceType.getValue() == SoShaderObject::FILENAME)
|
||||
osgShader->loadShaderSourceFromFile(ivShader->sourceProgram.getValue().getString());
|
||||
osgShader = osgDB::readRefShaderFile(osgShaderType, ivShader->sourceProgram.getValue().getString());
|
||||
else
|
||||
if (ivShader->sourceType.getValue() == SoShaderObject::GLSL_PROGRAM)
|
||||
osgShader->setShaderSource(ivShader->sourceProgram.getValue().getString());
|
||||
osgShader = new osg::Shader(osgShaderType, ivShader->sourceProgram.getValue().getString());
|
||||
else {
|
||||
OSG_WARN << NOTIFY_HEADER << "Can not convert "
|
||||
<< "shader. Unsupported shader language." << std::endl;
|
||||
OSG_WARN << NOTIFY_HEADER << "Can not convert shader. Unsupported shader language." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace deprecated_osg {
|
||||
if (array->getBinding() == static_cast<osg::Array::Binding>(ab)) return; \
|
||||
array->setBinding(static_cast<osg::Array::Binding>(ab));\
|
||||
if (ab==3 /*osg::Geometry::BIND_PER_PRIMITIVE*/) _containsDeprecatedData = true; \
|
||||
dirtyDisplayList();
|
||||
dirtyGLObjects();
|
||||
|
||||
|
||||
#define GET_BINDING(array) (array!=0 ? static_cast<AttributeBinding>(array->getBinding()) : BIND_OFF)
|
||||
|
||||
@@ -292,7 +292,7 @@ osg::ref_ptr<osg::Geode> ReaderWritterOpenCASCADE::OCCTKReader::igesToOSGGeode(c
|
||||
/// transfer data from reader to doc
|
||||
if(!reader.Transfer(doc))
|
||||
{
|
||||
cout << "Cannot read any relevant data from the STEP file" << endl;
|
||||
std::cout << "Cannot read any relevant data from the STEP file" << std::endl;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -309,7 +309,7 @@ osg::ref_ptr<osg::Geode> ReaderWritterOpenCASCADE::OCCTKReader::igesToOSGGeode(c
|
||||
/// transfer data from reader to doc
|
||||
if(!reader.Transfer(doc))
|
||||
{
|
||||
cout << "Cannot read any relevant data from the IGES file" << endl;
|
||||
std::cout << "Cannot read any relevant data from the IGES file" << std::endl;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -327,7 +327,7 @@ osg::ref_ptr<osg::Geode> ReaderWritterOpenCASCADE::OCCTKReader::igesToOSGGeode(c
|
||||
|
||||
if(freeShapes.Length() == 0)
|
||||
{
|
||||
std::cout << "No Shapes found" << endl;
|
||||
std::cout << "No Shapes found" << std::endl;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -165,7 +165,7 @@ class ReaderWriterCURL : public osgDB::ReaderWriter
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_threadCurlMapMutex);
|
||||
|
||||
osg::ref_ptr<EasyCurl>& ec = _threadCurlMap[OpenThreads::Thread::CurrentThread()];
|
||||
osg::ref_ptr<EasyCurl>& ec = _threadCurlMap[OpenThreads::Thread::CurrentThreadId()];
|
||||
if (!ec) ec = new EasyCurl;
|
||||
|
||||
return *ec;
|
||||
@@ -176,7 +176,7 @@ class ReaderWriterCURL : public osgDB::ReaderWriter
|
||||
protected:
|
||||
void getConnectionOptions(const osgDB::ReaderWriter::Options *options, std::string& proxyAddress, long& connectTimeout, long& timeout, long& sslVerifyPeer) const;
|
||||
|
||||
typedef std::map< OpenThreads::Thread*, osg::ref_ptr<EasyCurl> > ThreadCurlMap;
|
||||
typedef std::map< size_t, osg::ref_ptr<EasyCurl> > ThreadCurlMap;
|
||||
|
||||
mutable OpenThreads::Mutex _threadCurlMapMutex;
|
||||
mutable ThreadCurlMap _threadCurlMap;
|
||||
|
||||
@@ -33,15 +33,16 @@ BUILD DEPENDENCIES
|
||||
- iconv
|
||||
|
||||
A standard "ccmake ." while in the root of the OSG source will expose
|
||||
two CMake variables: COLLADA_INCLUDE_DIR and COLLADA_LIBRARY. Using
|
||||
these two variables correctly can be a bit tricky (especially as
|
||||
the "right" and "wrong" ways to use Collada are hard to define), but
|
||||
I will briefly explain them below.
|
||||
two CMake variables: COLLADA_INCLUDE_DIR and COLLADA_DYNAMIC_LIBRARY (or
|
||||
COLLADA_STATIC_LIBRARY). Using these two variables correctly can be a bit
|
||||
tricky (especially as the "right" and "wrong" ways to use Collada are hard to
|
||||
define), but I will briefly explain them below.
|
||||
|
||||
COLLADA_INCLUDE_DIR: This variable wants the path where it can
|
||||
find the COLLADA headers. On most systems this will be something
|
||||
like /usr/include or /usr/include/collada.
|
||||
|
||||
COLLADA_LIBRARY: This variable is asking for the FULL PATH to the
|
||||
file libcollada_dom.a. As long as it can find this file, the
|
||||
OSG Collada ReaderWriter should build just fine.
|
||||
COLLADA_DYNAMIC_LIBRARY (or COLLADA_STATIC_LIBRARY): This variable is asking
|
||||
for the FULL PATH to the file libcollada_dom.so (or libcollada_dom.a). As
|
||||
long as it can find this file, the OSG Collada ReaderWriter should build
|
||||
just fine.
|
||||
|
||||
@@ -222,6 +222,7 @@ struct DXT1TexelsBlock
|
||||
//
|
||||
#define DDPF_ALPHAPIXELS 0x00000001l
|
||||
#define DDPF_FOURCC 0x00000004l // Compressed formats
|
||||
#define DDPF_PALETTEINDEXED8 0x00000020l
|
||||
#define DDPF_RGB 0x00000040l // Uncompressed formats
|
||||
#define DDPF_ALPHA 0x00000002l
|
||||
#define DDPF_COMPRESSED 0x00000080l
|
||||
@@ -853,6 +854,10 @@ osg::Image* ReadDDSFile(std::istream& _istream, bool flipDDSRead)
|
||||
GL_RGBA, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV },
|
||||
{ "G16R16", 32, 0x0000ffff, 0xffff0000, 0x00000000, 0x00000000,
|
||||
GL_RGB, UNSUPPORTED, GL_UNSIGNED_SHORT },
|
||||
{ "B16G16R16", 48, 0x0000ff, 0x00ff00, 0xff0000, 0x000000,
|
||||
GL_RGB16F_ARB , GL_RGB , GL_HALF_FLOAT },
|
||||
{ "B32G32R32", 96, 0x0000ff, 0x00ff00, 0xff0000, 0x000000,
|
||||
GL_RGB32F_ARB , GL_RGB , GL_FLOAT },
|
||||
};
|
||||
|
||||
bool found = false;
|
||||
@@ -944,6 +949,12 @@ osg::Image* ReadDDSFile(std::istream& _istream, bool flipDDSRead)
|
||||
internalFormat = GL_ALPHA;
|
||||
pixelFormat = GL_ALPHA;
|
||||
}
|
||||
else if (ddsd.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)
|
||||
{
|
||||
OSG_INFO << "ReadDDSFile info : format = PALETTEINDEXED8" << std::endl;
|
||||
// The indexed data needs to first be loaded as a single-component image.
|
||||
pixelFormat = GL_RED;
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_WARN << "ReadDDSFile warning: unhandled pixel format (ddsd.ddpfPixelFormat.dwFlags"
|
||||
@@ -982,7 +993,18 @@ osg::Image* ReadDDSFile(std::istream& _istream, bool flipDDSRead)
|
||||
}
|
||||
}
|
||||
|
||||
OSG_INFO<<"ReadDDS, dataType = 0x"<<std::hex<<dataType<<std::endl;
|
||||
OSG_INFO<<"ReadDDS, dataType = 0x"<<std::hex<<dataType<<std::endl;
|
||||
|
||||
unsigned char palette [1024];
|
||||
|
||||
if (ddsd.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)
|
||||
{
|
||||
if (!_istream.read((char*)palette, 1024))
|
||||
{
|
||||
OSG_WARN << "ReadDDSFile warning: couldn't read palette" << std::endl;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char* imageData = new unsigned char [sizeWithMipmaps];
|
||||
if(!imageData)
|
||||
@@ -1010,7 +1032,27 @@ osg::Image* ReadDDSFile(std::istream& _istream, bool flipDDSRead)
|
||||
// this memory will not be used but it will not cause leak in worst meaning of this word.
|
||||
}
|
||||
|
||||
osgImage->setImage(s,t,r, internalFormat, pixelFormat, dataType, imageData, osg::Image::USE_NEW_DELETE, packing);
|
||||
if (ddsd.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)
|
||||
{
|
||||
// Now we need to substitute the indexed image data with full RGBA image data.
|
||||
unsigned char * convertedData = new unsigned char [sizeWithMipmaps * 4];
|
||||
unsigned char * pconvertedData = convertedData;
|
||||
for (unsigned int i = 0; i < sizeWithMipmaps; i++)
|
||||
{
|
||||
memcpy(pconvertedData, &palette[ imageData[i] * 4], sizeof(unsigned char) * 4 );
|
||||
pconvertedData += 4;
|
||||
}
|
||||
delete [] imageData;
|
||||
for (unsigned int i = 0; i < mipmap_offsets.size(); i++)
|
||||
mipmap_offsets[i] *= 4;
|
||||
internalFormat = GL_RGBA;
|
||||
pixelFormat = GL_RGBA;
|
||||
osgImage->setImage(s,t,r, internalFormat, pixelFormat, dataType, convertedData, osg::Image::USE_NEW_DELETE, packing);
|
||||
}
|
||||
else
|
||||
{
|
||||
osgImage->setImage(s,t,r, internalFormat, pixelFormat, dataType, imageData, osg::Image::USE_NEW_DELETE, packing);
|
||||
}
|
||||
|
||||
if (mipmap_offsets.size()>0) osgImage->setMipmapLevels(mipmap_offsets);
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
IF (DCMTK_FOUND)
|
||||
|
||||
# note, we have to include a '/' in front of the directory string to prevent a CMake bug from ignoring the directory
|
||||
INCLUDE_DIRECTORIES(${DCMTK_ROOT_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${DCMTK_INCLUDE_DIRS})
|
||||
|
||||
SET(TARGET_SRC ReaderWriterDICOM.cpp )
|
||||
|
||||
LINK_LIBRARIES(${DCMTK_LIBRARIES} ${ZLIB_LIBRARIES})
|
||||
LINK_LIBRARIES(${DCMTK_LIBRARIES})
|
||||
|
||||
ADD_DEFINITIONS(-DUSE_DCMTK)
|
||||
|
||||
|
||||
@@ -845,163 +845,160 @@ class ReaderWriterDICOM : public osgDB::ReaderWriter
|
||||
{
|
||||
FileInfo& fileInfo = ditr->second;
|
||||
|
||||
std::auto_ptr<DicomImage> dcmImage(new DicomImage(fileInfo.filename.c_str()));
|
||||
if (dcmImage.get())
|
||||
DicomImage dcmImage(fileInfo.filename.c_str());
|
||||
if (dcmImage.getStatus()==EIS_Normal)
|
||||
{
|
||||
if (dcmImage->getStatus()==EIS_Normal)
|
||||
|
||||
EP_Representation curr_pixelRep;
|
||||
int curr_numPlanes;
|
||||
GLenum curr_pixelFormat;
|
||||
GLenum curr_dataType;
|
||||
unsigned int curr_pixelSize;
|
||||
|
||||
// get the pixel data
|
||||
const DiPixel* pixelData = dcmImage.getInterData();
|
||||
if(!pixelData)
|
||||
{
|
||||
warning()<<"Error: no data in DicomImage object."<<std::endl;
|
||||
return ReadResult::ERROR_IN_READING_FILE;
|
||||
}
|
||||
|
||||
EP_Representation curr_pixelRep;
|
||||
int curr_numPlanes;
|
||||
GLenum curr_pixelFormat;
|
||||
GLenum curr_dataType;
|
||||
unsigned int curr_pixelSize;
|
||||
// create the new image
|
||||
convertPixelTypes(pixelData,
|
||||
curr_pixelRep, curr_numPlanes,
|
||||
curr_dataType, curr_pixelFormat, curr_pixelSize);
|
||||
|
||||
// get the pixel data
|
||||
const DiPixel* pixelData = dcmImage->getInterData();
|
||||
if(!pixelData)
|
||||
{
|
||||
warning()<<"Error: no data in DicomImage object."<<std::endl;
|
||||
return ReadResult::ERROR_IN_READING_FILE;
|
||||
}
|
||||
// dcmImage.getFrameCount()
|
||||
|
||||
// create the new image
|
||||
convertPixelTypes(pixelData,
|
||||
curr_pixelRep, curr_numPlanes,
|
||||
curr_dataType, curr_pixelFormat, curr_pixelSize);
|
||||
osg::ref_ptr<osg::Image> imageAdapter = new osg::Image;
|
||||
|
||||
// dcmImage->getFrameCount()
|
||||
if (dcmImage.isMonochrome())
|
||||
{
|
||||
imageAdapter->setImage(dcmImage.getWidth(), dcmImage.getHeight(), dcmImage.getFrameCount(),
|
||||
curr_pixelFormat,
|
||||
curr_pixelFormat,
|
||||
curr_dataType,
|
||||
(unsigned char*)(pixelData->getData()),
|
||||
osg::Image::NO_DELETE);
|
||||
|
||||
osg::ref_ptr<osg::Image> imageAdapter = new osg::Image;
|
||||
|
||||
if (dcmImage->isMonochrome())
|
||||
{
|
||||
imageAdapter->setImage(dcmImage->getWidth(), dcmImage->getHeight(), dcmImage->getFrameCount(),
|
||||
curr_pixelFormat,
|
||||
curr_pixelFormat,
|
||||
curr_dataType,
|
||||
(unsigned char*)(pixelData->getData()),
|
||||
osg::Image::NO_DELETE);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
imageAdapter->allocateImage(dcmImage->getWidth(), dcmImage->getHeight(), dcmImage->getFrameCount(),
|
||||
curr_pixelFormat, curr_dataType);
|
||||
|
||||
void* data = imageAdapter->data(0,0,0);
|
||||
unsigned long size = dcmImage->createWindowsDIB( data,
|
||||
imageAdapter->getTotalDataSize(),
|
||||
0,
|
||||
imageAdapter->getPixelSizeInBits(),
|
||||
0,
|
||||
0);
|
||||
|
||||
if (size==0)
|
||||
{
|
||||
info()<<" dcmImage->createWindowsDIB() failed to create required imagery."<<std::endl;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!image)
|
||||
{
|
||||
pixelRep = curr_pixelRep;
|
||||
numPlanes = curr_numPlanes;
|
||||
dataType = curr_dataType;
|
||||
pixelFormat = curr_pixelFormat;
|
||||
pixelSize = curr_pixelSize;
|
||||
|
||||
osg::RefMatrix* matrix = details->getMatrix();
|
||||
|
||||
(*matrix)(0,0) = fileInfo.dirX.x();
|
||||
(*matrix)(1,0) = fileInfo.dirX.y();
|
||||
(*matrix)(2,0) = fileInfo.dirX.z();
|
||||
|
||||
(*matrix)(0,1) = fileInfo.dirY.x();
|
||||
(*matrix)(1,1) = fileInfo.dirY.y();
|
||||
(*matrix)(2,1) = fileInfo.dirY.z();
|
||||
|
||||
(*matrix)(0,2) = fileInfo.dirZ.x();
|
||||
(*matrix)(1,2) = fileInfo.dirZ.y();
|
||||
(*matrix)(2,2) = fileInfo.dirZ.z();
|
||||
|
||||
matrix->preMultScale(osg::Vec3d(
|
||||
fileInfo.pixelSize_x * dcmImage->getWidth(),
|
||||
fileInfo.pixelSize_y * dcmImage->getHeight(),
|
||||
averageThickness * totalNumSlices));
|
||||
|
||||
(*matrix)(3,0) = fileInfo.position.x();
|
||||
(*matrix)(3,1) = fileInfo.position.y();
|
||||
(*matrix)(3,2) = fileInfo.position.z();
|
||||
|
||||
(*matrix)(3,3) = 1.0;
|
||||
|
||||
// note from Robert Osfield, testing various dicom files I have found that the rescaleIntercept
|
||||
// for CT data doesn't look to be applicable as an straight value offset, so we'll ignore for now.
|
||||
// details->setTexelOffset(fileInfo.rescaleIntercept);
|
||||
double s = fileInfo.rescaleSlope;
|
||||
switch(dataType)
|
||||
{
|
||||
case(GL_BYTE): s *= 128.0; break;
|
||||
case(GL_UNSIGNED_BYTE): s *= 255.0; break;
|
||||
case(GL_SHORT): s *= 32768.0; break;
|
||||
case(GL_UNSIGNED_SHORT): s *= 65535.0; break;
|
||||
case(GL_INT): s *= 2147483648.0; break;
|
||||
case(GL_UNSIGNED_INT): s *= 4294967295.0; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
details->setTexelScale(osg::Vec4(s,s,s,s));
|
||||
|
||||
image = new osg::Image;
|
||||
image->setUserData(details.get());
|
||||
image->setFileName(fileName.c_str());
|
||||
image->allocateImage(dcmImage->getWidth(), dcmImage->getHeight(), totalNumSlices,
|
||||
pixelFormat, dataType);
|
||||
|
||||
|
||||
//matrix->preMult(osg::Matrix::scale(double(image->s()), double(image->t()), double(image->r())));
|
||||
|
||||
info()<<"Image dimensions = "<<image->s()<<", "<<image->t()<<", "<<image->r()<<" pixelFormat=0x"<<std::hex<<pixelFormat<<" dataType=0x"<<std::hex<<dataType<<std::dec<<std::endl;
|
||||
}
|
||||
else if (pixelData->getPlanes()>numPlanes ||
|
||||
pixelData->getRepresentation()>pixelRep)
|
||||
{
|
||||
info()<<"Need to reallocated "<<image->s()<<", "<<image->t()<<", "<<image->r()<<std::endl;
|
||||
|
||||
// record the previous image settings to use when we copy back the content.
|
||||
osg::ref_ptr<osg::Image> previous_image = image;
|
||||
|
||||
// create the new image
|
||||
convertPixelTypes(pixelData,
|
||||
pixelRep, numPlanes,
|
||||
dataType, pixelFormat, pixelSize);
|
||||
|
||||
image = new osg::Image;
|
||||
image->setUserData(previous_image->getUserData());
|
||||
image->setFileName(fileName.c_str());
|
||||
image->allocateImage(dcmImage->getWidth(), dcmImage->getHeight(), totalNumSlices,
|
||||
pixelFormat, dataType);
|
||||
osg::copyImage(previous_image.get(), 0,0,0, previous_image->s(), previous_image->t(), imageNum,
|
||||
image.get(), 0, 0, 0,
|
||||
false);
|
||||
}
|
||||
|
||||
info()<<"copyImage(, fileInfo.distance"<<fileInfo.distance<<", imageNum="<<imageNum<<std::endl;
|
||||
|
||||
osg::copyImage(imageAdapter.get(), 0,0,0, imageAdapter->s(), imageAdapter->t(), imageAdapter->r(),
|
||||
image.get(), 0, 0, imageNum,
|
||||
false);
|
||||
|
||||
imageNum += dcmImage->getFrameCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
warning()<<"Error in reading dicom file "<<fileInfo.filename<<", error = "<<DicomImage::getString(dcmImage->getStatus())<<std::endl;
|
||||
info()<<" dcmImage->getPhotometricInterpretation()="<<DicomImage::getString(dcmImage->getPhotometricInterpretation())<<std::endl;
|
||||
info()<<" dcmImage->width="<<dcmImage->getWidth()<<", height="<<dcmImage->getHeight()<<" FrameCount="<< dcmImage->getFrameCount()<<std::endl;
|
||||
imageAdapter->allocateImage(dcmImage.getWidth(), dcmImage.getHeight(), dcmImage.getFrameCount(),
|
||||
curr_pixelFormat, curr_dataType);
|
||||
|
||||
void* data = imageAdapter->data(0,0,0);
|
||||
unsigned long size = dcmImage.createWindowsDIB( data,
|
||||
imageAdapter->getTotalDataSize(),
|
||||
0,
|
||||
imageAdapter->getPixelSizeInBits(),
|
||||
0,
|
||||
0);
|
||||
|
||||
if (size==0)
|
||||
{
|
||||
info()<<" dcmImage.createWindowsDIB() failed to create required imagery."<<std::endl;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!image)
|
||||
{
|
||||
pixelRep = curr_pixelRep;
|
||||
numPlanes = curr_numPlanes;
|
||||
dataType = curr_dataType;
|
||||
pixelFormat = curr_pixelFormat;
|
||||
pixelSize = curr_pixelSize;
|
||||
|
||||
osg::RefMatrix* matrix = details->getMatrix();
|
||||
|
||||
(*matrix)(0,0) = fileInfo.dirX.x();
|
||||
(*matrix)(1,0) = fileInfo.dirX.y();
|
||||
(*matrix)(2,0) = fileInfo.dirX.z();
|
||||
|
||||
(*matrix)(0,1) = fileInfo.dirY.x();
|
||||
(*matrix)(1,1) = fileInfo.dirY.y();
|
||||
(*matrix)(2,1) = fileInfo.dirY.z();
|
||||
|
||||
(*matrix)(0,2) = fileInfo.dirZ.x();
|
||||
(*matrix)(1,2) = fileInfo.dirZ.y();
|
||||
(*matrix)(2,2) = fileInfo.dirZ.z();
|
||||
|
||||
matrix->preMultScale(osg::Vec3d(
|
||||
fileInfo.pixelSize_x * dcmImage.getWidth(),
|
||||
fileInfo.pixelSize_y * dcmImage.getHeight(),
|
||||
averageThickness * totalNumSlices));
|
||||
|
||||
(*matrix)(3,0) = fileInfo.position.x();
|
||||
(*matrix)(3,1) = fileInfo.position.y();
|
||||
(*matrix)(3,2) = fileInfo.position.z();
|
||||
|
||||
(*matrix)(3,3) = 1.0;
|
||||
|
||||
// note from Robert Osfield, testing various dicom files I have found that the rescaleIntercept
|
||||
// for CT data doesn't look to be applicable as an straight value offset, so we'll ignore for now.
|
||||
// details->setTexelOffset(fileInfo.rescaleIntercept);
|
||||
double s = fileInfo.rescaleSlope;
|
||||
switch(dataType)
|
||||
{
|
||||
case(GL_BYTE): s *= 128.0; break;
|
||||
case(GL_UNSIGNED_BYTE): s *= 255.0; break;
|
||||
case(GL_SHORT): s *= 32768.0; break;
|
||||
case(GL_UNSIGNED_SHORT): s *= 65535.0; break;
|
||||
case(GL_INT): s *= 2147483648.0; break;
|
||||
case(GL_UNSIGNED_INT): s *= 4294967295.0; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
details->setTexelScale(osg::Vec4(s,s,s,s));
|
||||
|
||||
image = new osg::Image;
|
||||
image->setUserData(details.get());
|
||||
image->setFileName(fileName.c_str());
|
||||
image->allocateImage(dcmImage.getWidth(), dcmImage.getHeight(), totalNumSlices,
|
||||
pixelFormat, dataType);
|
||||
|
||||
|
||||
//matrix->preMult(osg::Matrix::scale(double(image->s()), double(image->t()), double(image->r())));
|
||||
|
||||
info()<<"Image dimensions = "<<image->s()<<", "<<image->t()<<", "<<image->r()<<" pixelFormat=0x"<<std::hex<<pixelFormat<<" dataType=0x"<<std::hex<<dataType<<std::dec<<std::endl;
|
||||
}
|
||||
else if (pixelData->getPlanes()>numPlanes ||
|
||||
pixelData->getRepresentation()>pixelRep)
|
||||
{
|
||||
info()<<"Need to reallocated "<<image->s()<<", "<<image->t()<<", "<<image->r()<<std::endl;
|
||||
|
||||
// record the previous image settings to use when we copy back the content.
|
||||
osg::ref_ptr<osg::Image> previous_image = image;
|
||||
|
||||
// create the new image
|
||||
convertPixelTypes(pixelData,
|
||||
pixelRep, numPlanes,
|
||||
dataType, pixelFormat, pixelSize);
|
||||
|
||||
image = new osg::Image;
|
||||
image->setUserData(previous_image->getUserData());
|
||||
image->setFileName(fileName.c_str());
|
||||
image->allocateImage(dcmImage.getWidth(), dcmImage.getHeight(), totalNumSlices,
|
||||
pixelFormat, dataType);
|
||||
osg::copyImage(previous_image.get(), 0,0,0, previous_image->s(), previous_image->t(), imageNum,
|
||||
image.get(), 0, 0, 0,
|
||||
false);
|
||||
}
|
||||
|
||||
info()<<"copyImage(, fileInfo.distance"<<fileInfo.distance<<", imageNum="<<imageNum<<std::endl;
|
||||
|
||||
osg::copyImage(imageAdapter.get(), 0,0,0, imageAdapter->s(), imageAdapter->t(), imageAdapter->r(),
|
||||
image.get(), 0, 0, imageNum,
|
||||
false);
|
||||
|
||||
imageNum += dcmImage.getFrameCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
warning()<<"Error in reading dicom file "<<fileInfo.filename<<", error = "<<DicomImage::getString(dcmImage.getStatus())<<std::endl;
|
||||
info()<<" dcmImage.getPhotometricInterpretation()="<<DicomImage::getString(dcmImage.getPhotometricInterpretation())<<std::endl;
|
||||
info()<<" dcmImage.width="<<dcmImage.getWidth()<<", height="<<dcmImage.getHeight()<<" FrameCount="<< dcmImage.getFrameCount()<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,13 @@ public:
|
||||
ReaderWriterdxf()
|
||||
{
|
||||
supportsExtension("dxf","Autodesk DXF format");
|
||||
|
||||
supportsOption("UTF8", "Assuming UTF8 encoding of dxf text");
|
||||
supportsOption("UTF16", "Assuming UTF16 encoding of dxf text");
|
||||
supportsOption("UTF32", "Assuming UTF32 encoding of dxf text");
|
||||
supportsOption("SIGNATURE", "Detrmine encoding of dxf text from it's signative");
|
||||
supportsOption("WideChar | CurrentCodePage", "Detrmine encoding of dxf text using CurrentCodePage (Windows only.)");
|
||||
supportsOption("FontFile=<fontfile>", "Set the font file for dxf text");
|
||||
}
|
||||
|
||||
virtual const char* className() const { return "Autodesk DXF Reader/Writer"; }
|
||||
@@ -143,6 +150,68 @@ ReaderWriterdxf::readNode(const std::string& filename, const osgDB::ReaderWriter
|
||||
dxfEntity::getRegistryEntity("ARC")->setAccuracy(true,maxError,improveAccuracyOnly);
|
||||
dxfEntity::getRegistryEntity("CIRCLE")->setAccuracy(true,maxError,improveAccuracyOnly);
|
||||
} // accuracy options exists
|
||||
|
||||
{
|
||||
std::istringstream iss(options->getOptionString());
|
||||
std::string opt;
|
||||
while (iss >> opt)
|
||||
{
|
||||
// split opt into pre= and post=
|
||||
std::string pre_equals;
|
||||
std::string post_equals;
|
||||
|
||||
size_t found = opt.find("=");
|
||||
if (found != std::string::npos)
|
||||
{
|
||||
pre_equals = opt.substr(0, found);
|
||||
post_equals = opt.substr(found + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
pre_equals = opt;
|
||||
}
|
||||
|
||||
if (pre_equals == "FontFile")
|
||||
{
|
||||
std::string fontFile = post_equals.c_str();
|
||||
if (!fontFile.empty())
|
||||
{
|
||||
dynamic_cast<dxfText*>(dxfEntity::getRegistryEntity("TEXT"))->font = fontFile;
|
||||
|
||||
OSG_INFO<<"ReaderWriteDXF : Set fontFile to "<<fontFile<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_NOTICE << "Warning: invalid FontFile value: " << post_equals << std::endl;
|
||||
}
|
||||
}
|
||||
else if (pre_equals=="UTF8")
|
||||
{
|
||||
dynamic_cast<dxfText*>(dxfEntity::getRegistryEntity("TEXT"))->encoding = osgText::String::ENCODING_UTF8;
|
||||
OSG_INFO<<"ReaderWriteDXF : Set encoding to osgText::String::ENCODING_UTF8"<<std::endl;
|
||||
}
|
||||
else if (pre_equals=="UTF16")
|
||||
{
|
||||
dynamic_cast<dxfText*>(dxfEntity::getRegistryEntity("TEXT"))->encoding = osgText::String::ENCODING_UTF16;
|
||||
OSG_INFO<<"ReaderWriteDXF : Set encoding to osgText::String::ENCODING_UTF16"<<std::endl;
|
||||
}
|
||||
else if (pre_equals=="UTF32")
|
||||
{
|
||||
dynamic_cast<dxfText*>(dxfEntity::getRegistryEntity("TEXT"))->encoding = osgText::String::ENCODING_UTF32;
|
||||
OSG_INFO<<"ReaderWriteDXF : Set encoding to osgText::String::ENCODING_UTF32"<<std::endl;
|
||||
}
|
||||
else if (pre_equals=="SIGNATURE")
|
||||
{
|
||||
dynamic_cast<dxfText*>(dxfEntity::getRegistryEntity("TEXT"))->encoding = osgText::String::ENCODING_SIGNATURE;
|
||||
OSG_INFO<<"ReaderWriteDXF : Set encoding to osgText::String::ENCODING_SIGNATURE"<<std::endl;
|
||||
}
|
||||
else if (pre_equals=="WideChar" || pre_equals=="CurrentCodePage")
|
||||
{
|
||||
dynamic_cast<dxfText*>(dxfEntity::getRegistryEntity("TEXT"))->encoding = osgText::String::ENCODING_CURRENT_CODE_PAGE;
|
||||
OSG_INFO<<"ReaderWriteDXF : Set encoding to osgText::String::ENCODING_CURRENT_CODE_PAGE"<<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // options exist
|
||||
|
||||
|
||||
|
||||
@@ -910,10 +910,9 @@ dxfText::drawScene(scene* sc)
|
||||
sc->ocs(m);
|
||||
|
||||
ref_ptr<osgText::Text> _text = new osgText::Text;
|
||||
_text->setText(_string);
|
||||
|
||||
_text->setText(_string, encoding);
|
||||
_text->setCharacterSize( _height, 1.0/_xscale );
|
||||
_text->setFont("arial.ttf");
|
||||
_text->setFont(font);
|
||||
|
||||
Quat qr( DegreesToRadians(_rotation), Z_AXIS );
|
||||
|
||||
|
||||
@@ -293,6 +293,8 @@ class dxfText : public dxfBasicEntity
|
||||
{
|
||||
public:
|
||||
dxfText() :
|
||||
encoding(osgText::String::ENCODING_ASCII),
|
||||
font("arial.ttf"),
|
||||
_string(""),
|
||||
_point1(0,0,0),
|
||||
_point2(0,0,0),
|
||||
@@ -305,11 +307,22 @@ public:
|
||||
_vjustify(0) {}
|
||||
|
||||
virtual ~dxfText() {}
|
||||
virtual dxfBasicEntity* create() { return new dxfText; }
|
||||
virtual dxfBasicEntity* create()
|
||||
{
|
||||
dxfText* text = new dxfText;
|
||||
text->encoding = encoding;
|
||||
text->font = font;
|
||||
return text;
|
||||
}
|
||||
|
||||
virtual const char* name() { return "TEXT"; }
|
||||
virtual void assign(dxfFile* dxf, codeValue& cv);
|
||||
virtual void drawScene(scene* sc);
|
||||
|
||||
// application settings
|
||||
osgText::String::Encoding encoding;
|
||||
std::string font;
|
||||
|
||||
protected:
|
||||
std::string _string; // 1
|
||||
osg::Vec3d _point1; // 10,20,30
|
||||
|
||||
@@ -33,6 +33,7 @@ ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
|
||||
ENDIF()
|
||||
|
||||
SET(TARGET_LIBRARIES_VARS FBX_LIBRARY)
|
||||
IF(WIN32)
|
||||
OPTION(FBX_SHARED OFF)
|
||||
IF(FBX_SHARED)
|
||||
@@ -48,8 +49,13 @@ IF(APPLE)
|
||||
SET(TARGET_EXTERNAL_LIBRARIES iconv ${SYS_CONFIG_LIBRARY})
|
||||
ENDIF(APPLE)
|
||||
|
||||
SET(TARGET_LIBRARIES_VARS FBX_LIBRARY)
|
||||
SET(TARGET_ADDED_LIBRARIES osgAnimation)
|
||||
IF(FBX_XML2_LIBRARY)
|
||||
SET(TARGET_LIBRARIES_VARS ${TARGET_LIBRARIES_VARS} FBX_XML2_LIBRARY)
|
||||
ENDIF(FBX_XML2_LIBRARY)
|
||||
IF(FBX_ZLIB_LIBRARY)
|
||||
SET(TARGET_LIBRARIES_VARS ${TARGET_LIBRARIES_VARS} FBX_ZLIB_LIBRARY)
|
||||
ENDIF(FBX_ZLIB_LIBRARY)
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgAnimation)
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(fbx)
|
||||
|
||||
@@ -572,7 +572,34 @@ osgDB::ReaderWriter::WriteResult ReaderWriterFBX::writeNode(
|
||||
}
|
||||
|
||||
FbxExporter* lExporter = FbxExporter::Create(pSdkManager, "");
|
||||
pScene->GetGlobalSettings().SetAxisSystem(FbxAxisSystem::eOpenGL);
|
||||
|
||||
// default axis system is openGL
|
||||
FbxAxisSystem::EPreDefinedAxisSystem axisSystem = FbxAxisSystem::eOpenGL;
|
||||
|
||||
// check options
|
||||
if (options)
|
||||
{
|
||||
std::string axisOption = options->getPluginStringData("FBX-AxisSystem");
|
||||
if (!axisOption.empty())
|
||||
{
|
||||
if (axisOption == "MayaZUp")
|
||||
axisSystem = FbxAxisSystem::eMayaZUp;
|
||||
else if (axisOption == "MayaYUp")
|
||||
axisSystem = FbxAxisSystem::eMayaYUp;
|
||||
else if (axisOption == "Max")
|
||||
axisSystem = FbxAxisSystem::eMax;
|
||||
else if (axisOption == "MotionBuilder")
|
||||
axisSystem = FbxAxisSystem::eMotionBuilder;
|
||||
else if (axisOption == "OpenGL")
|
||||
axisSystem = FbxAxisSystem::eOpenGL;
|
||||
else if (axisOption == "DirectX")
|
||||
axisSystem = FbxAxisSystem::eDirectX;
|
||||
else if (axisOption == "Lightwave")
|
||||
axisSystem = FbxAxisSystem::eLightwave;
|
||||
}
|
||||
}
|
||||
|
||||
pScene->GetGlobalSettings().SetAxisSystem(axisSystem);
|
||||
|
||||
// Ensure the directory exists or else the FBX SDK will fail
|
||||
if (!osgDB::makeDirectoryForFile(filename)) {
|
||||
|
||||
@@ -140,6 +140,9 @@ public:
|
||||
virtual ReadResult readImage(const std::string & filename, const osgDB::ReaderWriter::Options* options) const
|
||||
{
|
||||
const std::string ext = osgDB::getLowerCaseFileExtension(filename);
|
||||
const std::string pro = osgDB::getServerProtocol(filename);
|
||||
if (!acceptsExtension(ext) && !acceptsProtocol(pro)) return ReadResult::FILE_NOT_HANDLED;
|
||||
|
||||
if (ext=="ffmpeg") return readImage(osgDB::getNameLessExtension(filename),options);
|
||||
|
||||
osg::ref_ptr<osgFFmpeg::FFmpegParameters> parameters(new osgFFmpeg::FFmpegParameters);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "LuaScriptEngine.h"
|
||||
|
||||
#include <osg/io_utils>
|
||||
#include <osg/observer_ptr>
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/WriteFile>
|
||||
|
||||
@@ -32,32 +33,42 @@ public:
|
||||
|
||||
virtual bool run(osg::Object* object, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
|
||||
{
|
||||
int topBeforeCall = lua_gettop(_lse->getLuaState());
|
||||
if (!_lse)
|
||||
{
|
||||
OSG_NOTICE << "Warning: Ignoring call to Lua by an expired callback" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// a strong reference is necessary as the lua call might trigger deletion of the LuaScriptEngine object
|
||||
// avoid overhead by observer_ptr<>::lock as a race on run/destruction never is valid
|
||||
osg::ref_ptr<const LuaScriptEngine> lse(_lse.get());
|
||||
|
||||
lua_rawgeti(_lse->getLuaState(), LUA_REGISTRYINDEX, _ref);
|
||||
int topBeforeCall = lua_gettop(lse->getLuaState());
|
||||
|
||||
lua_rawgeti(lse->getLuaState(), LUA_REGISTRYINDEX, _ref);
|
||||
|
||||
int numInputs = 1;
|
||||
_lse->pushParameter(object);
|
||||
lse->pushParameter(object);
|
||||
|
||||
for(osg::Parameters::iterator itr = inputParameters.begin();
|
||||
itr != inputParameters.end();
|
||||
++itr)
|
||||
{
|
||||
_lse->pushParameter(itr->get());
|
||||
lse->pushParameter(itr->get());
|
||||
++numInputs;
|
||||
}
|
||||
|
||||
if (lua_pcall(_lse->getLuaState(), numInputs, LUA_MULTRET,0)!=0)
|
||||
if (lua_pcall(lse->getLuaState(), numInputs, LUA_MULTRET,0)!=0)
|
||||
{
|
||||
OSG_NOTICE<<"Lua error : "<<lua_tostring(_lse->getLuaState(), -1)<<std::endl;
|
||||
OSG_NOTICE<<"Lua error : "<<lua_tostring(lse->getLuaState(), -1)<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
int topAfterCall = lua_gettop(_lse->getLuaState());
|
||||
int topAfterCall = lua_gettop(lse->getLuaState());
|
||||
int numReturns = topAfterCall-topBeforeCall;
|
||||
for(int i=1; i<=numReturns; ++i)
|
||||
{
|
||||
outputParameters.insert(outputParameters.begin(), _lse->popParameterObject());
|
||||
outputParameters.insert(outputParameters.begin(), lse->popParameterObject());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -66,7 +77,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
osg::ref_ptr<const LuaScriptEngine> _lse;
|
||||
osg::observer_ptr<const LuaScriptEngine> _lse;
|
||||
int _ref;
|
||||
};
|
||||
|
||||
|
||||
@@ -446,8 +446,16 @@ OBJWriterNodeVisitor::OBJMaterial::OBJMaterial(osg::Material* mat, osg::Texture*
|
||||
if ((img) && (!img->getFileName().empty()))
|
||||
{
|
||||
image = img->getFileName();
|
||||
if(outputTextureFiles)
|
||||
if (outputTextureFiles)
|
||||
{
|
||||
std::string imagePath = osgDB::getFilePath(image);
|
||||
if (!imagePath.empty() && !osgDB::fileExists(imagePath))
|
||||
{
|
||||
osgDB::makeDirectory(imagePath);
|
||||
}
|
||||
|
||||
osgDB::writeImageFile(*img, image, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,7 +536,7 @@ void OBJWriterNodeVisitor::processStateSet(osg::StateSet* ss)
|
||||
|
||||
if (mat || tex)
|
||||
{
|
||||
_materialMap.insert(std::make_pair(osg::ref_ptr<osg::StateSet>(ss), OBJMaterial(mat, tex, _outputTextureFiles, _options)));
|
||||
_materialMap.insert(std::make_pair(osg::ref_ptr<osg::StateSet>(ss), OBJMaterial(mat, tex, _outputTextureFiles, _options.get())));
|
||||
_fout << "usemtl " << _materialMap[ss].name << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -948,11 +948,9 @@ osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& fil
|
||||
std::string fileName = osgDB::findDataFile( file, options );
|
||||
if (fileName.empty()) return ReadResult::FILE_NOT_FOUND;
|
||||
|
||||
|
||||
osgDB::ifstream fin(fileName.c_str());
|
||||
if (fin)
|
||||
{
|
||||
|
||||
// code for setting up the database path so that internally referenced file are searched for on relative paths.
|
||||
osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options;
|
||||
local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName));
|
||||
@@ -974,8 +972,6 @@ osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(std::istream& fin, con
|
||||
{
|
||||
if (fin)
|
||||
{
|
||||
fin.imbue(std::locale::classic());
|
||||
|
||||
obj::Model model;
|
||||
model.readOBJ(fin, options);
|
||||
|
||||
|
||||
@@ -225,6 +225,8 @@ bool Model::readMTL(std::istream& fin)
|
||||
{
|
||||
OSG_INFO<<"Reading MTL file"<<std::endl;
|
||||
|
||||
fin.imbue(std::locale::classic());
|
||||
|
||||
const int LINE_SIZE = 4096;
|
||||
char line[LINE_SIZE];
|
||||
float r = 1.0f, g = 1.0f, b = 1.0f, a = 1.0f;
|
||||
@@ -567,6 +569,8 @@ bool Model::readOBJ(std::istream& fin, const osgDB::ReaderWriter::Options* optio
|
||||
{
|
||||
OSG_INFO<<"Reading OBJ file"<<std::endl;
|
||||
|
||||
fin.imbue(std::locale::classic());
|
||||
|
||||
const int LINE_SIZE = 4096;
|
||||
char line[LINE_SIZE];
|
||||
float x = 0.0f, y = 0.0f, z = 0.0f, w = 0.0f;
|
||||
@@ -668,28 +672,22 @@ bool Model::readOBJ(std::istream& fin, const osgDB::ReaderWriter::Options* optio
|
||||
|
||||
if (sscanf(ptr, "%d/%d/%d", &vi, &ti, &ni) == 3)
|
||||
{
|
||||
// OSG_NOTICE<<" vi="<<vi<<"/ti="<<ti<<"/ni="<<ni<<std::endl;
|
||||
element->vertexIndices.push_back(remapVertexIndex(vi));
|
||||
element->normalIndices.push_back(remapNormalIndex(ni));
|
||||
element->texCoordIndices.push_back(remapTexCoordIndex(ti));
|
||||
if (normals.size() > 0 && remapNormalIndex(ni) < static_cast<int>(normals.size())) element->normalIndices.push_back(remapNormalIndex(ni));
|
||||
if (texcoords.size() > 0 && remapTexCoordIndex(ti) < static_cast<int>(texcoords.size())) element->texCoordIndices.push_back(remapTexCoordIndex(ti));
|
||||
}
|
||||
else if (sscanf(ptr, "%d//%d", &vi, &ni) == 2)
|
||||
{
|
||||
// OSG_NOTICE<<" vi="<<vi<<"//ni="<<ni<<std::endl;
|
||||
element->vertexIndices.push_back(remapVertexIndex(vi));
|
||||
if (remapNormalIndex(ni) < static_cast<int>(normals.size()))
|
||||
element->normalIndices.push_back(remapNormalIndex(ni));
|
||||
if (normals.size() > 0 && remapNormalIndex(ni) < static_cast<int>(normals.size())) element->normalIndices.push_back(remapNormalIndex(ni));
|
||||
}
|
||||
else if (sscanf(ptr, "%d/%d", &vi, &ti) == 2)
|
||||
{
|
||||
// OSG_NOTICE<<" vi="<<vi<<"/ti="<<ti<<std::endl;
|
||||
element->vertexIndices.push_back(remapVertexIndex(vi));
|
||||
if (remapTexCoordIndex(ti) < static_cast<int>(texcoords.size()))
|
||||
element->texCoordIndices.push_back(remapTexCoordIndex(ti));
|
||||
if (texcoords.size() > 0 && remapTexCoordIndex(ti) < static_cast<int>(texcoords.size())) element->texCoordIndices.push_back(remapTexCoordIndex(ti));
|
||||
}
|
||||
else if (sscanf(ptr, "%d", &vi) == 1)
|
||||
{
|
||||
// OSG_NOTICE<<" vi="<<vi<<std::endl;
|
||||
element->vertexIndices.push_back(remapVertexIndex(vi));
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ public:
|
||||
|
||||
local_options->setDatabasePath(file);
|
||||
|
||||
ReadResult result_2;
|
||||
switch (type) {
|
||||
default:
|
||||
case READ_OBJECT:
|
||||
@@ -112,7 +111,7 @@ public:
|
||||
|
||||
virtual ReadResult readNode(const std::string& file, const Options* options) const
|
||||
{
|
||||
return readMasterFile(READ_IMAGE, file, options);
|
||||
return readMasterFile(READ_NODE, file, options);
|
||||
}
|
||||
|
||||
virtual ReadResult readShader(const std::string& file, const Options* options) const
|
||||
|
||||
@@ -322,10 +322,13 @@ struct SafeArray
|
||||
impl = new T[size];
|
||||
}
|
||||
|
||||
operator T*() { return impl; }
|
||||
const T& operator[](std::size_t i) const { return impl[i]; }
|
||||
|
||||
template<typename U>
|
||||
explicit operator U() { return (U)impl; }
|
||||
T& operator[](std::size_t i) { return impl[i]; }
|
||||
|
||||
const T* data() const { return impl; }
|
||||
|
||||
T* data() { return impl; }
|
||||
|
||||
private:
|
||||
T* impl;
|
||||
@@ -452,12 +455,12 @@ int *numComponents_ret)
|
||||
colormapLen = getInt16(&header[5]);
|
||||
colormapDepth = (header[7] + 7) >> 3;
|
||||
colormap.reinitialise(colormapLen*colormapDepth);
|
||||
if (colormap == NULL)
|
||||
if (colormap.data() == NULL)
|
||||
{
|
||||
tgaerror = ERR_MEM;
|
||||
return NULL;
|
||||
}
|
||||
fin.read((char*)colormap, colormapLen*colormapDepth);
|
||||
fin.read(reinterpret_cast<char*>(colormap.data()), colormapLen*colormapDepth);
|
||||
|
||||
if (colormapDepth == 2) /* 16 bits */
|
||||
{
|
||||
@@ -518,11 +521,11 @@ int *numComponents_ret)
|
||||
rleRemaining = 0;
|
||||
rleEntrySize = depth;
|
||||
SafeArray<unsigned char> buffer(width*height*format);
|
||||
dest = buffer;
|
||||
dest = buffer.data();
|
||||
bpr = format * width;
|
||||
SafeArray<unsigned char> linebuf(width * depth);
|
||||
|
||||
if (buffer == NULL || linebuf == NULL)
|
||||
if (buffer.data() == NULL || linebuf.data() == NULL)
|
||||
{
|
||||
tgaerror = ERR_MEM;
|
||||
return NULL;
|
||||
@@ -545,20 +548,20 @@ int *numComponents_ret)
|
||||
return NULL;
|
||||
}
|
||||
SafeArray<unsigned char> formattedMap(colormapLen * format);
|
||||
if (formattedMap == NULL)
|
||||
if (formattedMap.data() == NULL)
|
||||
{
|
||||
tgaerror = ERR_MEM;
|
||||
return NULL;
|
||||
}
|
||||
for (int i = 0; i < colormapLen; i++)
|
||||
{
|
||||
convert_data(colormap, formattedMap, i, colormapDepth, format);
|
||||
convert_data(colormap.data(), formattedMap.data(), i, colormapDepth, format);
|
||||
}
|
||||
|
||||
int x, y;
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
fin.read((char*)linebuf, width*depth);
|
||||
fin.read(reinterpret_cast<char*>(linebuf.data()), width*depth);
|
||||
if (fin.gcount() != (std::streamsize) (width*depth))
|
||||
{
|
||||
tgaerror = ERR_READ;
|
||||
@@ -574,13 +577,13 @@ int *numComponents_ret)
|
||||
index = linebuf[x];
|
||||
break;
|
||||
case 2:
|
||||
index = getInt16(linebuf + x * 2);
|
||||
index = getInt16(linebuf.data() + x * 2);
|
||||
break;
|
||||
case 3:
|
||||
index = getInt24(linebuf + x * 3);
|
||||
index = getInt24(linebuf.data() + x * 3);
|
||||
break;
|
||||
case 4:
|
||||
index = getInt32(linebuf + x * 4);
|
||||
index = getInt32(linebuf.data() + x * 4);
|
||||
break;
|
||||
default:
|
||||
tgaerror = ERR_UNSUPPORTED;
|
||||
@@ -589,7 +592,7 @@ int *numComponents_ret)
|
||||
|
||||
int adjustedX = bLeftToRight ? x : (width - 1) - x;
|
||||
for (int i = 0; i < format; i++)
|
||||
(dest + adjustedX * format)[i] = (formattedMap + index * format)[i];
|
||||
(dest + adjustedX * format)[i] = formattedMap[index * format + i];
|
||||
}
|
||||
dest += lineoffset;
|
||||
}
|
||||
@@ -601,7 +604,7 @@ int *numComponents_ret)
|
||||
int x, y;
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
fin.read((char*)linebuf,width*depth);
|
||||
fin.read(reinterpret_cast<char*>(linebuf.data()), width*depth);
|
||||
if (fin.gcount() != (std::streamsize) (width*depth))
|
||||
{
|
||||
tgaerror = ERR_READ;
|
||||
@@ -609,7 +612,7 @@ int *numComponents_ret)
|
||||
}
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
convert_data(linebuf, dest, bLeftToRight ? x : (width-1) - x, depth, format);
|
||||
convert_data(linebuf.data(), dest, bLeftToRight ? x : (width-1) - x, depth, format);
|
||||
}
|
||||
dest += lineoffset;
|
||||
}
|
||||
@@ -623,14 +626,14 @@ int *numComponents_ret)
|
||||
return NULL;
|
||||
}
|
||||
SafeArray<unsigned char> formattedMap(colormapLen * format);
|
||||
if (formattedMap == NULL)
|
||||
if (formattedMap.data() == NULL)
|
||||
{
|
||||
tgaerror = ERR_MEM;
|
||||
return NULL;
|
||||
}
|
||||
for (int i = 0; i < colormapLen; i++)
|
||||
{
|
||||
convert_data(colormap, formattedMap, i, colormapDepth, format);
|
||||
convert_data(colormap.data(), formattedMap.data(), i, colormapDepth, format);
|
||||
}
|
||||
|
||||
int size, x, y;
|
||||
@@ -639,21 +642,21 @@ int *numComponents_ret)
|
||||
size = (int)(endOfImage - pos);
|
||||
|
||||
SafeArray<unsigned char> buf(size);
|
||||
if (buf == NULL)
|
||||
if (buf.data() == NULL)
|
||||
{
|
||||
tgaerror = ERR_MEM;
|
||||
return NULL;
|
||||
}
|
||||
unsigned char* src = buf;
|
||||
unsigned char* src = buf.data();
|
||||
|
||||
fin.read((char*)buf, size);
|
||||
fin.read(reinterpret_cast<char*>(buf.data()), size);
|
||||
if (fin.gcount() == (std::streamsize)size)
|
||||
{
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
rle_decode(&src, linebuf, width*depth, &rleRemaining,
|
||||
rle_decode(&src, linebuf.data(), width*depth, &rleRemaining,
|
||||
&rleIsCompressed, rleCurrent, rleEntrySize);
|
||||
assert(src <= buf + size);
|
||||
assert(src <= buf.data() + size);
|
||||
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
@@ -664,13 +667,13 @@ int *numComponents_ret)
|
||||
index = linebuf[x];
|
||||
break;
|
||||
case 2:
|
||||
index = getInt16(linebuf + x * 2);
|
||||
index = getInt16(linebuf.data() + x * 2);
|
||||
break;
|
||||
case 3:
|
||||
index = getInt24(linebuf + x * 3);
|
||||
index = getInt24(linebuf.data() + x * 3);
|
||||
break;
|
||||
case 4:
|
||||
index = getInt32(linebuf + x * 4);
|
||||
index = getInt32(linebuf.data() + x * 4);
|
||||
break;
|
||||
default:
|
||||
tgaerror = ERR_UNSUPPORTED;
|
||||
@@ -685,7 +688,7 @@ int *numComponents_ret)
|
||||
|
||||
int adjustedX = bLeftToRight ? x : (width - 1) - x;
|
||||
for (int i = 0; i < format; i++)
|
||||
(dest + adjustedX * format)[i] = (formattedMap + index * format)[i];
|
||||
(dest + adjustedX * format)[i] = formattedMap[index * format + i];
|
||||
}
|
||||
dest += lineoffset;
|
||||
}
|
||||
@@ -705,24 +708,24 @@ int *numComponents_ret)
|
||||
|
||||
size = (int)(endOfImage - pos);
|
||||
SafeArray<unsigned char> buf(size);
|
||||
if (buf == NULL)
|
||||
if (buf.data() == NULL)
|
||||
{
|
||||
tgaerror = ERR_MEM;
|
||||
return NULL;
|
||||
}
|
||||
unsigned char* src = buf;
|
||||
unsigned char* src = buf.data();
|
||||
|
||||
fin.read((char*)buf,size);
|
||||
fin.read(reinterpret_cast<char*>(buf.data()), size);
|
||||
if (fin.gcount() == (std::streamsize) size)
|
||||
{
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
rle_decode(&src, linebuf, width*depth, &rleRemaining,
|
||||
rle_decode(&src, linebuf.data(), width*depth, &rleRemaining,
|
||||
&rleIsCompressed, rleCurrent, rleEntrySize);
|
||||
assert(src <= buf + size);
|
||||
assert(src <= buf.data() + size);
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
convert_data(linebuf, dest, bLeftToRight ? x : (width-1) - x, depth, format);
|
||||
convert_data(linebuf.data(), dest, bLeftToRight ? x : (width-1) - x, depth, format);
|
||||
}
|
||||
dest += lineoffset;
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ tiff_error(const char*, const char* fmt, va_list ap)
|
||||
{
|
||||
// values are (const char* module, const char* fmt, va_list list)
|
||||
/* FIXME: store error message ? */
|
||||
OSG_WARN << "TIFF rader: " << doFormat(fmt, ap) << std::endl;
|
||||
OSG_WARN << "TIFF reader: " << doFormat(fmt, ap) << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ tiff_warn(const char*, const char* fmt, va_list ap)
|
||||
{
|
||||
// values are (const char* module, const char* fmt, va_list list)
|
||||
/* FIXME: notify? */
|
||||
OSG_NOTICE << "TIFF rader: " << doFormat(fmt, ap) << std::endl;
|
||||
OSG_NOTICE << "TIFF reader: " << doFormat(fmt, ap) << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -809,8 +809,6 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter
|
||||
int t = height_ret;
|
||||
int r = 1;
|
||||
|
||||
int internalFormat = numComponents_ret;
|
||||
|
||||
unsigned int pixelFormat =
|
||||
numComponents_ret == 1 ? GL_LUMINANCE :
|
||||
numComponents_ret == 2 ? GL_LUMINANCE_ALPHA :
|
||||
@@ -823,6 +821,42 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter
|
||||
bitspersample_ret == 16 ? GL_UNSIGNED_SHORT :
|
||||
bitspersample_ret == 32 ? GL_FLOAT : (GLenum)-1;
|
||||
|
||||
int internalFormat = 0;
|
||||
switch (pixelFormat) {
|
||||
case GL_LUMINANCE: {
|
||||
switch (dataType) {
|
||||
case GL_UNSIGNED_BYTE: internalFormat = GL_LUMINANCE8; break;
|
||||
case GL_UNSIGNED_SHORT: internalFormat = GL_LUMINANCE16; break;
|
||||
case GL_FLOAT : internalFormat = GL_LUMINANCE32F_ARB; break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GL_LUMINANCE_ALPHA: {
|
||||
switch (dataType) {
|
||||
case GL_UNSIGNED_BYTE: internalFormat = GL_LUMINANCE_ALPHA8UI_EXT; break;
|
||||
case GL_UNSIGNED_SHORT: internalFormat = GL_LUMINANCE_ALPHA16UI_EXT; break;
|
||||
case GL_FLOAT: internalFormat = GL_LUMINANCE_ALPHA32F_ARB; break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GL_RGB: {
|
||||
switch (dataType) {
|
||||
case GL_UNSIGNED_BYTE: internalFormat = GL_RGB8; break;
|
||||
case GL_UNSIGNED_SHORT: internalFormat = GL_RGB16; break;
|
||||
case GL_FLOAT: internalFormat = GL_RGB32F_ARB; break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GL_RGBA : {
|
||||
switch (dataType) {
|
||||
case GL_UNSIGNED_BYTE: internalFormat = GL_RGBA8; break;
|
||||
case GL_UNSIGNED_SHORT: internalFormat = GL_RGBA16; break;
|
||||
case GL_FLOAT: internalFormat = GL_RGBA32F_ARB; break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
osg::Image* pOsgImage = new osg::Image;
|
||||
pOsgImage->setImage(s,t,r,
|
||||
internalFormat,
|
||||
|
||||
@@ -672,7 +672,7 @@ const ZipArchive::PerThreadData&
|
||||
ZipArchive::getDataNoLock() const
|
||||
{
|
||||
// get/create data for the currently running thread:
|
||||
OpenThreads::Thread* current = OpenThreads::Thread::CurrentThread();
|
||||
size_t current = OpenThreads::Thread::CurrentThreadId();
|
||||
|
||||
PerThreadDataMap::const_iterator i = _perThreadData.find( current );
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ class ZipArchive : public osgDB::Archive
|
||||
HZIP _zipHandle;
|
||||
};
|
||||
|
||||
typedef std::map<OpenThreads::Thread*, PerThreadData> PerThreadDataMap;
|
||||
typedef std::map<size_t, PerThreadData> PerThreadDataMap;
|
||||
PerThreadDataMap _perThreadData;
|
||||
|
||||
const PerThreadData& getData() const;
|
||||
|
||||
@@ -52,7 +52,7 @@ SET(TARGET_LIBRARIES
|
||||
|
||||
if(OSG_TEXT_USE_FONTCONFIG AND Fontconfig_FOUND)
|
||||
MESSAGE(STATUS "osgText will be linked with FontConfig library")
|
||||
list(APPEND TARGET_LIBRARIES Fontconfig::Fontconfig)
|
||||
LIST(APPEND TARGET_EXTERNAL_LIBRARIES Fontconfig::Fontconfig)
|
||||
ADD_DEFINITIONS(-DWITH_FONTCONFIG)
|
||||
else()
|
||||
MESSAGE(STATUS "osgText will not be linked with FontConfig library")
|
||||
|
||||
@@ -492,6 +492,8 @@ void Font::addGlyph(const FontResolution& fontRes, unsigned int charcode, Glyph*
|
||||
|
||||
void Font::assignGlyphToGlyphTexture(Glyph* glyph, ShaderTechnique shaderTechnique)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_glyphMapMutex);
|
||||
|
||||
int posX=0,posY=0;
|
||||
|
||||
GlyphTexture* glyphTexture = 0;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <osg/Notify>
|
||||
#include <osg/Math>
|
||||
|
||||
#include <osgDB/ConvertUTF>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
using namespace osgText;
|
||||
@@ -275,8 +277,14 @@ void String::set(const wchar_t* text)
|
||||
}
|
||||
}
|
||||
|
||||
void String::set(const std::string& text,Encoding encoding)
|
||||
void String::set(const std::string& text, Encoding encoding)
|
||||
{
|
||||
if (encoding==ENCODING_CURRENT_CODE_PAGE)
|
||||
{
|
||||
set(osgDB::convertStringFromCurrentCodePageToUTF8(text), ENCODING_UTF8);
|
||||
return;
|
||||
}
|
||||
|
||||
clear();
|
||||
|
||||
look_ahead_iterator itr(text);
|
||||
|
||||
@@ -102,6 +102,7 @@ osg::StateSet* Text::createStateSet()
|
||||
Font::StateSets& statesets = activeFont->getCachedStateSets();
|
||||
|
||||
std::stringstream ss;
|
||||
ss.imbue(std::locale::classic());
|
||||
ss<<std::fixed<<std::setprecision(3);
|
||||
|
||||
osg::StateSet::DefineList defineList;
|
||||
@@ -249,12 +250,11 @@ osg::StateSet* Text::createStateSet()
|
||||
|
||||
Font* Text::getActiveFont()
|
||||
{
|
||||
return _font.valid() ? _font.get() : Font::getDefaultFont().get();
|
||||
}
|
||||
if (_font.valid()) return _font.get();
|
||||
|
||||
const Font* Text::getActiveFont() const
|
||||
{
|
||||
return _font.valid() ? _font.get() : Font::getDefaultFont().get();
|
||||
if (!_fontFallback) _fontFallback = Font::getDefaultFont();
|
||||
|
||||
return _fontFallback.get();
|
||||
}
|
||||
|
||||
String::iterator Text::computeLastCharacterOnLine(osg::Vec2& cursor, String::iterator first,String::iterator last)
|
||||
|
||||
@@ -139,7 +139,34 @@ osg::VertexArrayState* TextBase::createVertexArrayStateImplementation(osg::Rende
|
||||
|
||||
void TextBase::compileGLObjects(osg::RenderInfo& renderInfo) const
|
||||
{
|
||||
Drawable::compileGLObjects(renderInfo);
|
||||
State& state = *renderInfo.getState();
|
||||
if (renderInfo.getState()->useVertexBufferObject(_supportsVertexBufferObjects && _useVertexBufferObjects))
|
||||
{
|
||||
unsigned int contextID = state.getContextID();
|
||||
GLExtensions* extensions = state.get<GLExtensions>();
|
||||
if (state.useVertexArrayObject(_useVertexArrayObject))
|
||||
{
|
||||
VertexArrayState* vas = 0;
|
||||
|
||||
_vertexArrayStateList[contextID] = vas = createVertexArrayState(renderInfo);
|
||||
|
||||
State::SetCurrentVertexArrayStateProxy setVASProxy(state, vas);
|
||||
|
||||
state.bindVertexArrayObject(vas);
|
||||
|
||||
drawImplementation(renderInfo);
|
||||
|
||||
state.unbindVertexArrayObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
drawImplementation(renderInfo);
|
||||
}
|
||||
|
||||
// unbind the BufferObjects
|
||||
extensions->glBindBuffer(GL_ARRAY_BUFFER_ARB,0);
|
||||
extensions->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,0);
|
||||
}
|
||||
}
|
||||
|
||||
void TextBase::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
|
||||
@@ -210,7 +210,7 @@ ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "X11")
|
||||
IF(OSGVIEWER_USE_XINERAMA)
|
||||
ADD_DEFINITIONS(-DOSGVIEWER_USE_XINERAMA)
|
||||
SET(LIB_PRIVATE_HEADERS ${LIB_PRIVATE_HEADERS} ${XINERAMA_INCLUDE_DIRS} )
|
||||
SET(LIB_EXTRA_LIBS -lXinerama ${LIB_EXTRA_LIBS})
|
||||
SET(LIB_EXTRA_LIBS ${X11_Xinerama_LIB} ${LIB_EXTRA_LIBS})
|
||||
ENDIF()
|
||||
|
||||
# X11 on Apple requires X11 library plus OpenGL linking hack on Leopard
|
||||
|
||||
@@ -226,8 +226,45 @@ void CompositeViewer::removeView(osgViewer::View* view)
|
||||
bool threadsWereRunning = _threadsRunning;
|
||||
if (threadsWereRunning) stopThreading();
|
||||
|
||||
view->_viewerBase = 0;
|
||||
// clean up any attached contexts that are solely attached to this view
|
||||
typedef std::map<osg::GraphicsContext*, int> ContextMap;
|
||||
ContextMap contexts;
|
||||
|
||||
if (view->getCamera()->getGraphicsContext())
|
||||
{
|
||||
view->getCamera()->releaseGLObjects(view->getCamera()->getGraphicsContext()->getState());
|
||||
contexts[view->getCamera()->getGraphicsContext()]++;
|
||||
}
|
||||
for(unsigned int i=0; i<view->getNumSlaves(); ++i)
|
||||
{
|
||||
if (view->getSlave(i)._camera->getGraphicsContext())
|
||||
{
|
||||
view->getSlave(i)._camera->releaseGLObjects(view->getSlave(i)._camera->getGraphicsContext()->getState());
|
||||
contexts[view->getSlave(i)._camera->getGraphicsContext()]++;
|
||||
}
|
||||
}
|
||||
|
||||
for(ContextMap::iterator citr = contexts.begin();
|
||||
citr != contexts.end();
|
||||
++citr)
|
||||
{
|
||||
osg::GraphicsContext* gc = citr->first;
|
||||
if (citr->second == gc->referenceCount())
|
||||
{
|
||||
if (_cleanUpOperation.valid())
|
||||
{
|
||||
gc->makeCurrent();
|
||||
|
||||
(*_cleanUpOperation)(gc);
|
||||
|
||||
gc->releaseContext();
|
||||
}
|
||||
|
||||
gc->close();
|
||||
}
|
||||
}
|
||||
|
||||
view->_viewerBase = 0;
|
||||
_views.erase(itr);
|
||||
|
||||
if (threadsWereRunning) startThreading();
|
||||
|
||||
@@ -279,7 +279,7 @@ Display* GraphicsWindowX11::getDisplayToUse() const
|
||||
return _display;
|
||||
}
|
||||
|
||||
if (OpenThreads::Thread::CurrentThread()==_threadOfLastMakeCurrent)
|
||||
if (OpenThreads::Thread::CurrentThreadId()==_threadOfLastMakeCurrent)
|
||||
{
|
||||
return _display;
|
||||
}
|
||||
|
||||
@@ -171,20 +171,21 @@ void WoWVxDisplay::configure(osgViewer::View& view) const
|
||||
osg::Vec3Array* vertices = new osg::Vec3Array;
|
||||
vertices->push_back(osg::Vec3(0,height,0));
|
||||
vertices->push_back(osg::Vec3(0,0,0));
|
||||
vertices->push_back(osg::Vec3(width,0,0));
|
||||
vertices->push_back(osg::Vec3(width,height,0));
|
||||
vertices->push_back(osg::Vec3(width,0,0));
|
||||
geom->setVertexArray(vertices);
|
||||
|
||||
osg::Vec2Array* tex = new osg::Vec2Array;
|
||||
tex->push_back(osg::Vec2(0,1));
|
||||
tex->push_back(osg::Vec2(0,0));
|
||||
tex->push_back(osg::Vec2(1,0));
|
||||
tex->push_back(osg::Vec2(1,1));
|
||||
tex->push_back(osg::Vec2(1,0));
|
||||
geom->setTexCoordArray(0,tex);
|
||||
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(GL_TRIANGLE_STRIP,0,4));
|
||||
geode->addDrawable(geom);
|
||||
|
||||
|
||||
// new we need to add the textures to the quad, and setting up the shader.
|
||||
osg::StateSet* stateset = geode->getOrCreateStateSet();
|
||||
stateset->setTextureAttributeAndModes(0, textureHeader,osg::StateAttribute::ON);
|
||||
|
||||
@@ -422,62 +422,43 @@ void MultipassTechnique::init()
|
||||
{
|
||||
osg::Geometry* geom = new osg::Geometry;
|
||||
|
||||
osg::Vec3Array* coords = new osg::Vec3Array(8);
|
||||
(*coords)[0] = osg::Vec3d(0.0,0.0,0.0);
|
||||
(*coords)[1] = osg::Vec3d(1.0,0.0,0.0);
|
||||
(*coords)[2] = osg::Vec3d(1.0,1.0,0.0);
|
||||
(*coords)[3] = osg::Vec3d(0.0,1.0,0.0);
|
||||
(*coords)[4] = osg::Vec3d(0.0,0.0,1.0);
|
||||
(*coords)[5] = osg::Vec3d(1.0,0.0,1.0);
|
||||
(*coords)[6] = osg::Vec3d(1.0,1.0,1.0);
|
||||
(*coords)[7] = osg::Vec3d(0.0,1.0,1.0);
|
||||
geom->setVertexArray(coords);
|
||||
|
||||
osg::Vec4Array* colours = new osg::Vec4Array(1);
|
||||
(*colours)[0].set(1.0f,1.0f,1.0,1.0f);
|
||||
geom->setColorArray(colours, osg::Array::BIND_OVERALL);
|
||||
|
||||
osg::DrawElementsUShort* drawElements = new osg::DrawElementsUShort(GL_QUADS);
|
||||
// bottom
|
||||
// triangle strip of cube based on : http://www.cs.umd.edu/gvil/papers/av_ts.pdf
|
||||
osg::Vec3Array* coords = new osg::Vec3Array(8);
|
||||
(*coords)[0] = osg::Vec3d(0.0,1.0,1.0); // Back-top-left
|
||||
(*coords)[1] = osg::Vec3d(1.0,1.0,1.0); // Back-top-right
|
||||
(*coords)[2] = osg::Vec3d(0.0,0.0,1.0); // Front-top-left
|
||||
(*coords)[3] = osg::Vec3d(1.0,0.0,1.0); // Front-top-right
|
||||
(*coords)[4] = osg::Vec3d(0.0,1.0,0.0); // Back-bottom-left
|
||||
(*coords)[5] = osg::Vec3d(1.0,1.0,0.0); // Back-bottom-right
|
||||
(*coords)[6] = osg::Vec3d(1.0,0.0,0.0); // Front-bottom-right
|
||||
(*coords)[7] = osg::Vec3d(0.0,0.0,0.0); // Front-bottom-left
|
||||
geom->setVertexArray(coords);
|
||||
|
||||
osg::DrawElementsUShort* drawElements = new osg::DrawElementsUShort(GL_TRIANGLE_STRIP);
|
||||
|
||||
drawElements->push_back(3);
|
||||
drawElements->push_back(2);
|
||||
drawElements->push_back(1);
|
||||
drawElements->push_back(0);
|
||||
|
||||
// bottom
|
||||
drawElements->push_back(7);//7623
|
||||
drawElements->push_back(6);
|
||||
drawElements->push_back(2);
|
||||
drawElements->push_back(3);
|
||||
|
||||
// left
|
||||
drawElements->push_back(4);//4730
|
||||
drawElements->push_back(7);
|
||||
drawElements->push_back(3);
|
||||
drawElements->push_back(0);
|
||||
|
||||
// right
|
||||
drawElements->push_back(1);//1265
|
||||
drawElements->push_back(2);
|
||||
drawElements->push_back(6);
|
||||
drawElements->push_back(5);
|
||||
|
||||
// front
|
||||
drawElements->push_back(5);//5401
|
||||
drawElements->push_back(4);
|
||||
drawElements->push_back(2);
|
||||
drawElements->push_back(0);
|
||||
drawElements->push_back(1);
|
||||
|
||||
// top
|
||||
drawElements->push_back(4);//4567
|
||||
drawElements->push_back(5);
|
||||
drawElements->push_back(3);
|
||||
drawElements->push_back(1);
|
||||
drawElements->push_back(6);
|
||||
drawElements->push_back(7);
|
||||
drawElements->push_back(5);
|
||||
drawElements->push_back(4);
|
||||
drawElements->push_back(1);
|
||||
drawElements->push_back(0);
|
||||
|
||||
geom->addPrimitiveSet(drawElements);
|
||||
|
||||
geode->addDrawable(geom);
|
||||
|
||||
}
|
||||
|
||||
_transform = new osg::MatrixTransform;
|
||||
|
||||
@@ -425,62 +425,46 @@ void RayTracedTechnique::init()
|
||||
{
|
||||
osg::Geometry* geom = new osg::Geometry;
|
||||
|
||||
osg::Vec3Array* coords = new osg::Vec3Array(8);
|
||||
(*coords)[0] = osg::Vec3d(0.0,0.0,0.0);
|
||||
(*coords)[1] = osg::Vec3d(1.0,0.0,0.0);
|
||||
(*coords)[2] = osg::Vec3d(1.0,1.0,0.0);
|
||||
(*coords)[3] = osg::Vec3d(0.0,1.0,0.0);
|
||||
(*coords)[4] = osg::Vec3d(0.0,0.0,1.0);
|
||||
(*coords)[5] = osg::Vec3d(1.0,0.0,1.0);
|
||||
(*coords)[6] = osg::Vec3d(1.0,1.0,1.0);
|
||||
(*coords)[7] = osg::Vec3d(0.0,1.0,1.0);
|
||||
geom->setVertexArray(coords);
|
||||
|
||||
osg::Vec4Array* colours = new osg::Vec4Array(1);
|
||||
(*colours)[0].set(1.0f,1.0f,1.0,1.0f);
|
||||
geom->setColorArray(colours, osg::Array::BIND_OVERALL);
|
||||
|
||||
osg::DrawElementsUShort* drawElements = new osg::DrawElementsUShort(GL_QUADS);
|
||||
// bottom
|
||||
drawElements->push_back(0);
|
||||
drawElements->push_back(1);
|
||||
drawElements->push_back(2);
|
||||
drawElements->push_back(3);
|
||||
// triangle strip of cube based on : http://www.cs.umd.edu/gvil/papers/av_ts.pdf
|
||||
osg::Vec3Array* coords = new osg::Vec3Array(8);
|
||||
(*coords)[0] = osg::Vec3d(1.0,1.0,1.0); // Back-top-right
|
||||
(*coords)[1] = osg::Vec3d(0.0,1.0,1.0); // Back-top-left
|
||||
(*coords)[2] = osg::Vec3d(1.0,0.0,1.0); // Front-top-right
|
||||
(*coords)[3] = osg::Vec3d(0.0,0.0,1.0); // Front-top-left
|
||||
(*coords)[4] = osg::Vec3d(1.0,1.0,0.0); // Back-bottom-right
|
||||
(*coords)[5] = osg::Vec3d(0.0,1.0,0.0); // Back-bottom-left
|
||||
(*coords)[6] = osg::Vec3d(0.0,0.0,0.0); // Front-bottom-left
|
||||
(*coords)[7] = osg::Vec3d(1.0,0.0,0.0); // Front-bottom-right
|
||||
geom->setVertexArray(coords);
|
||||
|
||||
OSG_NOTICE<<"New RayTracedTechnique"<<std::endl;
|
||||
|
||||
osg::DrawElementsUShort* drawElements = new osg::DrawElementsUShort(GL_TRIANGLE_STRIP);
|
||||
|
||||
// bottom
|
||||
drawElements->push_back(3);
|
||||
drawElements->push_back(2);
|
||||
drawElements->push_back(6);
|
||||
drawElements->push_back(7);
|
||||
|
||||
// left
|
||||
drawElements->push_back(0);
|
||||
drawElements->push_back(3);
|
||||
drawElements->push_back(7);
|
||||
drawElements->push_back(4);
|
||||
|
||||
// right
|
||||
drawElements->push_back(5);
|
||||
drawElements->push_back(6);
|
||||
drawElements->push_back(2);
|
||||
drawElements->push_back(1);
|
||||
|
||||
// front
|
||||
drawElements->push_back(1);
|
||||
drawElements->push_back(0);
|
||||
drawElements->push_back(4);
|
||||
drawElements->push_back(5);
|
||||
|
||||
// top
|
||||
drawElements->push_back(7);
|
||||
drawElements->push_back(3);
|
||||
drawElements->push_back(1);
|
||||
drawElements->push_back(6);
|
||||
drawElements->push_back(5);
|
||||
drawElements->push_back(4);
|
||||
drawElements->push_back(1);
|
||||
drawElements->push_back(0);
|
||||
|
||||
geom->addPrimitiveSet(drawElements);
|
||||
|
||||
geode->addDrawable(geom);
|
||||
|
||||
}
|
||||
|
||||
if (cpv._sampleDensityWhenMovingProperty.valid())
|
||||
|
||||
Reference in New Issue
Block a user