Compare commits
108 Commits
OpenSceneG
...
OpenSceneG
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
925270d909 | ||
|
|
dd1745896a | ||
|
|
6c1cbb1f48 | ||
|
|
5a939746cc | ||
|
|
606a32685e | ||
|
|
06558a5dda | ||
|
|
7505cb4603 | ||
|
|
8b20f0adef | ||
|
|
fee977ac90 | ||
|
|
62dbe7b85e | ||
|
|
ecaca716e9 | ||
|
|
df21f59779 | ||
|
|
e28f789ffa | ||
|
|
b7fa2d7914 | ||
|
|
51924943e2 | ||
|
|
969c1821be | ||
|
|
2695f29be0 | ||
|
|
78cb12b531 | ||
|
|
beb9bc3cf2 | ||
|
|
d11e84178f | ||
|
|
b14eecb3c7 | ||
|
|
9fb010fadd | ||
|
|
8a15f23c15 | ||
|
|
e260dfb582 | ||
|
|
b728587fab | ||
|
|
f29af50b76 | ||
|
|
8b2e02b71d | ||
|
|
5faae0e52e | ||
|
|
5d51e5bf2a | ||
|
|
159c0271b7 | ||
|
|
94d5211f43 | ||
|
|
219adb7419 | ||
|
|
b101b4b4d2 | ||
|
|
b8862d0420 | ||
|
|
8a0114a46a | ||
|
|
199035ae51 | ||
|
|
23b4345517 | ||
|
|
b5b0bed7c3 | ||
|
|
a531f2bd13 | ||
|
|
f36e9f2a4a | ||
|
|
b7c186f6d3 | ||
|
|
927d2f0f10 | ||
|
|
644251db98 | ||
|
|
295bfffc17 | ||
|
|
b4663ded94 | ||
|
|
44d3da02a9 | ||
|
|
4093860c32 | ||
|
|
0161b8ab46 | ||
|
|
417f78ac5e | ||
|
|
8195b9c8e7 | ||
|
|
5ca6759a1f | ||
|
|
9c7cde1db4 | ||
|
|
aed9fd74f6 | ||
|
|
39a78e075f | ||
|
|
b4eb001d14 | ||
|
|
6cd699e55f | ||
|
|
4b0bed8161 | ||
|
|
ddbed23537 | ||
|
|
a13f8cf4b4 | ||
|
|
fab1431e59 | ||
|
|
073cfab166 | ||
|
|
bf279a59fa | ||
|
|
4ad410969e | ||
|
|
f50d32547d | ||
|
|
8406442a96 | ||
|
|
7994bfa767 | ||
|
|
b8982224c3 | ||
|
|
8178b51956 | ||
|
|
a7a7c0de8b | ||
|
|
2ade061ced | ||
|
|
0415b7df84 | ||
|
|
43724f004e | ||
|
|
300ba7aa02 | ||
|
|
97a4094d76 | ||
|
|
6b95718d65 | ||
|
|
47ab799168 | ||
|
|
c3108697de | ||
|
|
ba70c7d543 | ||
|
|
855212548d | ||
|
|
47207248d4 | ||
|
|
e1e6e07de3 | ||
|
|
508cf89f9c | ||
|
|
f29ecc10a8 | ||
|
|
46505f66d3 | ||
|
|
fb63c5b0a5 | ||
|
|
2b64d30fca | ||
|
|
e0b288fe37 | ||
|
|
91cfc02700 | ||
|
|
b29fb0b870 | ||
|
|
6ca2487362 | ||
|
|
197fc401b4 | ||
|
|
16cd192562 | ||
|
|
2f043345c9 | ||
|
|
24fc34a440 | ||
|
|
decf339b74 | ||
|
|
889325b496 | ||
|
|
126623645f | ||
|
|
6c908e9081 | ||
|
|
e4373b0143 | ||
|
|
16a5e019c5 | ||
|
|
597441ca33 | ||
|
|
864b087b1f | ||
|
|
75d03de844 | ||
|
|
1bd75f464a | ||
|
|
d501def836 | ||
|
|
cdbec116fa | ||
|
|
68c5e6e6ca | ||
|
|
638069f93b |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -89,6 +89,7 @@ PlatformSpecifics/Windows/*.rc
|
||||
|
||||
# Visual Studio - Cache/Options Directory
|
||||
.vs/
|
||||
.vscode/*
|
||||
|
||||
#osx xcode
|
||||
DerivedData/
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
|
||||
SET(OPENSCENEGRAPH_MINOR_VERSION 6)
|
||||
SET(OPENSCENEGRAPH_PATCH_VERSION 5)
|
||||
SET(OPENSCENEGRAPH_SOVERSION 161)
|
||||
SET(OPENSCENEGRAPH_SOVERSION 162)
|
||||
|
||||
|
||||
# set to 0 when not a release candidate, non zero means that any generated
|
||||
@@ -30,6 +30,9 @@ if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0017 NEW)
|
||||
endif()
|
||||
|
||||
# INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.
|
||||
# Allows passing -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
|
||||
cmake_policy(SET CMP0069 NEW)
|
||||
endif()
|
||||
|
||||
IF(APPLE)
|
||||
@@ -85,7 +88,7 @@ ELSEIF(APPLE)
|
||||
# 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)")
|
||||
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()
|
||||
@@ -118,6 +121,9 @@ ELSE()
|
||||
SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for graphics window creation; options: X11 or None.")
|
||||
ENDIF()
|
||||
|
||||
IF(OSG_WINDOWING_SYSTEM STREQUAL "None")
|
||||
SET(OSG_WINDOWING_SYSTEM_NONE ON INTERNAL "No windowing system")
|
||||
ENDIF()
|
||||
|
||||
SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
|
||||
|
||||
@@ -353,7 +359,9 @@ IF(WIN32 AND NOT ANDROID)
|
||||
OPTION(MSVC_DISABLE_CHECKED_ITERATORS "Set to ON to disable Visual C++ checked iterators. If you do this you must ensure that every other project in your solution and all dependencies are compiled with _SECURE_SCL=0." OFF)
|
||||
MARK_AS_ADVANCED(MSVC_DISABLE_CHECKED_ITERATORS)
|
||||
IF(MSVC_DISABLE_CHECKED_ITERATORS)
|
||||
ADD_DEFINITIONS(-D_ITERATOR_DEBUG_LEVEL=0) # this supercedes _SECURE_SCL and _HAS_ITERATOR_DEBUGGING in VS2010 and forward
|
||||
ADD_DEFINITIONS(-D_SECURE_SCL=0)
|
||||
ADD_DEFINITIONS(-D_HAS_ITERATOR_DEBUGGING=0)
|
||||
ENDIF(MSVC_DISABLE_CHECKED_ITERATORS)
|
||||
|
||||
OPTION(MSVC_USE_DEFAULT_STACK_SIZE "Set to ON to use the default Visual C++ stack size. CMake forces a high stack size by default, which can cause problems for applications with large number of threads." OFF)
|
||||
@@ -723,7 +731,9 @@ OPTION(BUILD_OSG_PLUGINS "Build OSG Plugins - Disable for compile testing exampl
|
||||
mark_as_advanced(BUILD_OSG_PLUGINS)
|
||||
################################################################################
|
||||
# 3rd Party Dependency Stuff
|
||||
IF(WIN32 AND NOT ANDROID)
|
||||
OPTION(OSG_FIND_3RD_PARTY_DEPS "Enable to search for Android or Windows dependencies in ./3rdparty" ON)
|
||||
|
||||
IF(WIN32 AND NOT ANDROID AND OSG_FIND_3RD_PARTY_DEPS)
|
||||
INCLUDE(Find3rdPartyDependencies)
|
||||
ENDIF()
|
||||
|
||||
@@ -734,7 +744,7 @@ OPTION(OSG_USE_LOCAL_LUA_SOURCE "Enable to use local Lua source when building th
|
||||
# you can use the following style of command line option when invoking Cmake (here illustrating ignoring PythonLibs) :
|
||||
# cmake -DCMAKE_DISABLE_FIND_PACKAGE_PythonLibs=1 .
|
||||
#
|
||||
IF(ANDROID)
|
||||
IF(ANDROID AND OSG_FIND_3RD_PARTY_DEPS)
|
||||
ANDROID_3RD_PARTY()
|
||||
ELSE()
|
||||
# Common to all platforms except android:
|
||||
@@ -811,7 +821,7 @@ ENDIF(BUILD_OSG_EXAMPLES AND NOT ANDROID)
|
||||
|
||||
# Image readers/writers depend on 3rd party libraries except for OS X which
|
||||
# can use Quicktime.
|
||||
IF(NOT ANDROID)
|
||||
IF(NOT (ANDROID AND OSG_FIND_3RD_PARTY_DEPS))
|
||||
IF(NOT APPLE)
|
||||
FIND_PACKAGE(GIFLIB)
|
||||
FIND_PACKAGE(JPEG)
|
||||
|
||||
@@ -15,8 +15,20 @@ FIND_PATH(ASIO_INCLUDE_DIR
|
||||
|
||||
SET(ASIO_FOUND "NO")
|
||||
IF(ASIO_INCLUDE_DIR)
|
||||
FIND_PACKAGE( Boost 1.37 )
|
||||
IF(Boost_FOUND)
|
||||
SET(ASIO_FOUND "YES")
|
||||
ENDIF()
|
||||
|
||||
set(ASIO_VERSION_H ${ASIO_INCLUDE_DIR}/asio/version.hpp)
|
||||
file(STRINGS ${ASIO_VERSION_H} AsioVersionLine REGEX "^#define ASIO_VERSION ")
|
||||
string(REGEX MATCHALL "[0-9]+" AsioHeaderVersionMatches "${AsioVersionLine}")
|
||||
list(GET AsioHeaderVersionMatches 0 AsioHeaderVersion)
|
||||
|
||||
# check version is less than 1.14.0 otherwise API changes break build
|
||||
if (${AsioHeaderVersion} LESS "101400")
|
||||
FIND_PACKAGE( Boost 1.37 )
|
||||
IF(Boost_FOUND)
|
||||
SET(ASIO_FOUND "YES")
|
||||
ENDIF()
|
||||
else()
|
||||
message("ASIO not compatible")
|
||||
endif()
|
||||
|
||||
ENDIF()
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
#[[=======================================================================.rst:
|
||||
FindFontconfig
|
||||
--------------
|
||||
|
||||
Find Fontconfig headers and library.
|
||||
|
||||
Imported Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
``Fontconfig::Fontconfig``
|
||||
The Fontconfig library, if found.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This will define the following variables in your project:
|
||||
|
||||
``FONTCONFIG_FOUND``
|
||||
true if (the requested version of) Fontconfig is available.
|
||||
``FONTCONFIG_VERSION``
|
||||
the version of Fontconfig.
|
||||
``FONTCONFIG_LIBRARIES``
|
||||
the libraries to link against to use Fontconfig.
|
||||
``FONTCONFIG_INCLUDE_DIRS``
|
||||
where to find the Fontconfig headers.
|
||||
``FONTCONFIG_COMPILE_OPTIONS``
|
||||
this should be passed to target_compile_options(), if the
|
||||
target is not used for linking
|
||||
=======================================================================]]
|
||||
# FindFontconfig
|
||||
# --------------
|
||||
#
|
||||
# Find Fontconfig headers and library.
|
||||
#
|
||||
# Imported Targets
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# ``Fontconfig::Fontconfig``
|
||||
# The Fontconfig library, if found.
|
||||
#
|
||||
# Result Variables
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# This will define the following variables in your project:
|
||||
#
|
||||
# ``FONTCONFIG_FOUND``
|
||||
# true if (the requested version of) Fontconfig is available.
|
||||
# ``FONTCONFIG_VERSION``
|
||||
# the version of Fontconfig.
|
||||
# ``FONTCONFIG_LIBRARIES``
|
||||
# the libraries to link against to use Fontconfig.
|
||||
# ``FONTCONFIG_INCLUDE_DIRS``
|
||||
# where to find the Fontconfig headers.
|
||||
# ``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
|
||||
|
||||
@@ -34,11 +34,17 @@ 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)
|
||||
IF("${PREFIX}" STREQUAL PREFIX-NOTFOUND) # Fix for PREFIX-NOTFOUND left in file names
|
||||
SET(PREFIX "")
|
||||
ENDIF()
|
||||
IF ( ${CMAKE_GENERATOR} STREQUAL "Ninja" )
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}${LIB_NAME}${CMAKE_RELEASE_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS Release)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}${LIB_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS RelWithDebInfo)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}${LIB_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS Debug)
|
||||
ELSE ( ${CMAKE_GENERATOR} STREQUAL "Ninja" )
|
||||
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 ( ${CMAKE_GENERATOR} STREQUAL "Ninja" )
|
||||
ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||
|
||||
IF(NOT OSG_COMPILE_FRAMEWORKS)
|
||||
|
||||
@@ -342,15 +342,20 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
||||
ENDIF()
|
||||
SETUP_LINK_LIBRARIES()
|
||||
|
||||
#the installation path are differentiated for win32 that install in bib versus other architecture that install in lib${LIB_POSTFIX}/${OSG_PLUGINS}
|
||||
#the installation path are differentiated for win32 that install in bin versus other architecture that install in lib${LIB_POSTFIX}/${OSG_PLUGINS}
|
||||
IF(WIN32)
|
||||
INSTALL(TARGETS ${TARGET_TARGETNAME}
|
||||
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
|
||||
ARCHIVE DESTINATION lib/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
|
||||
LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
|
||||
IF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||
INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS RelWithDebInfo)
|
||||
INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS Debug)
|
||||
IF( ${CMAKE_GENERATOR} STREQUAL "Ninja" )
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_TARGETNAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS RelWithDebInfo)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_TARGETNAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS Debug)
|
||||
ELSE( ${CMAKE_GENERATOR} STREQUAL "Ninja" )
|
||||
INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS RelWithDebInfo)
|
||||
INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS Debug)
|
||||
ENDIF( ${CMAKE_GENERATOR} STREQUAL "Ninja" )
|
||||
ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||
ELSE(WIN32)
|
||||
INSTALL(TARGETS ${TARGET_TARGETNAME}
|
||||
@@ -458,8 +463,8 @@ MACRO(SETUP_APPLICATION APPLICATION_NAME)
|
||||
ELSE(APPLE)
|
||||
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin COMPONENT openscenegraph )
|
||||
IF(MSVC)
|
||||
INSTALL(FILES ${CMAKE_BINARY_DIR}/bin/${TARGET_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION bin COMPONENT openscenegraph CONFIGURATIONS RelWithDebInfo)
|
||||
INSTALL(FILES ${CMAKE_BINARY_DIR}/bin/${TARGET_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION bin COMPONENT openscenegraph CONFIGURATIONS Debug)
|
||||
INSTALL(FILES ${OUTPUT_BINDIR}/${TARGET_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION bin COMPONENT openscenegraph CONFIGURATIONS RelWithDebInfo)
|
||||
INSTALL(FILES ${OUTPUT_BINDIR}/${TARGET_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION bin COMPONENT openscenegraph CONFIGURATIONS Debug)
|
||||
ENDIF(MSVC)
|
||||
ENDIF(APPLE)
|
||||
|
||||
@@ -491,8 +496,8 @@ MACRO(SETUP_EXAMPLE EXAMPLE_NAME)
|
||||
ELSE(APPLE)
|
||||
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples )
|
||||
IF(MSVC)
|
||||
INSTALL(FILES ${CMAKE_BINARY_DIR}/bin/${TARGET_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples CONFIGURATIONS RelWithDebInfo)
|
||||
INSTALL(FILES ${CMAKE_BINARY_DIR}/bin/${TARGET_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples CONFIGURATIONS Debug)
|
||||
INSTALL(FILES ${OUTPUT_BINDIR}/${TARGET_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples CONFIGURATIONS RelWithDebInfo)
|
||||
INSTALL(FILES ${OUTPUT_BINDIR}/${TARGET_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples CONFIGURATIONS Debug)
|
||||
ENDIF(MSVC)
|
||||
ENDIF(APPLE)
|
||||
|
||||
|
||||
14
README.md
14
README.md
@@ -7,13 +7,13 @@
|
||||
|
||||
Welcome to the OpenSceneGraph (OSG).
|
||||
|
||||
For up-to-date information on the project, in-depth details on how to compile and run libraries and examples, see the documentation on the OpenSceneGraph website:
|
||||
For information on the project, in-depth details on how to compile and run libraries and examples, see the documentation on the OpenSceneGraph website:
|
||||
|
||||
http://www.openscenegraph.org/index.php/documentation
|
||||
http://www.openscenegraph.org/index.php/documentation
|
||||
|
||||
For support subscribe to our public mailing list or forum, details at:
|
||||
For support please use the github OpenSceneGraph Discussions forum:
|
||||
|
||||
http://www.openscenegraph.org/index.php/support
|
||||
https://github.com/openscenegraph/OpenSceneGraph/discussions
|
||||
|
||||
For the impatient, we've included quick build instructions below, these are are broken down is three parts:
|
||||
|
||||
@@ -40,7 +40,7 @@ The OpenSceneGraph uses the CMake build system to generate a platform-specific b
|
||||
|
||||
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:
|
||||
|
||||
http://www.openscenegraph.org/projects/osg/wiki/Build/CMake
|
||||
http://www.openscenegraph.org/projects/osg/wiki/Build/CMake
|
||||
|
||||
Under Unix-like systems (i.e. Linux, IRIX, Solaris, Free-BSD, HP-UX, AIX, macOS) use the `cmake` or `ccmake` command-line utils. Note that `cmake .` defaults to building Release to ensure that you get the best performance from your final libraries/applications.
|
||||
|
||||
@@ -59,13 +59,13 @@ Alternatively, you can create an out-of-source build directory and run cmake or
|
||||
|
||||
Under Windows use the GUI tool CMakeSetup to build your VisualStudio files. The following page on our wiki dedicated to the CMake build system should help guide you through the process:
|
||||
|
||||
http://www.openscenegraph.org/index.php/documentation/platform-specifics/windows
|
||||
http://www.openscenegraph.org/index.php/documentation/platform-specifics/windows
|
||||
|
||||
Under macOS you can either use the CMake build system above, or use the Xcode projects that you will find in the OpenSceneGraph/Xcode directory. See release notes on macOS CMake build below.
|
||||
|
||||
For further details on compilation, installation and platform-specific information read "Getting Started" guide:
|
||||
|
||||
http://www.openscenegraph.org/index.php/documentation/10-getting-started
|
||||
http://www.openscenegraph.org/index.php/documentation/10-getting-started
|
||||
|
||||
|
||||
## Section 2. Release notes on macOS build, by Eric Sokolowski et al.
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if !defined (WIN32) || defined(__CYGWIN__)
|
||||
#if !defined (_WIN32) || defined(__CYGWIN__)
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -51,7 +51,7 @@
|
||||
#elif defined (__APPLE__)
|
||||
#include <unistd.h>
|
||||
#include <sys/sockio.h>
|
||||
#elif defined (WIN32)
|
||||
#elif defined (_WIN32)
|
||||
#include <winsock.h>
|
||||
#include <stdio.h>
|
||||
#elif defined (__hpux)
|
||||
@@ -63,7 +63,7 @@
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
@@ -265,7 +265,7 @@ Receiver::Receiver( void )
|
||||
|
||||
Receiver::~Receiver( void )
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
closesocket( _so);
|
||||
#else
|
||||
close( _so );
|
||||
@@ -274,7 +274,7 @@ Receiver::~Receiver( void )
|
||||
|
||||
bool Receiver::init( void )
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
WORD version = MAKEWORD(1,1);
|
||||
WSADATA wsaData;
|
||||
// First, we start up Winsock
|
||||
@@ -295,7 +295,7 @@ bool Receiver::init( void )
|
||||
|
||||
int result = 0;
|
||||
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
// const BOOL on = TRUE;
|
||||
// setsockopt( _so, SOL_SOCKET, SO_REUSEADDR, (const char*) &on, sizeof(int));
|
||||
#else
|
||||
@@ -305,14 +305,14 @@ bool Receiver::init( void )
|
||||
|
||||
if (result)
|
||||
{
|
||||
OSG_NOTICE<<"Warning: Reciever::init() setsockopt(..) failed, errno="<<errno<<std::endl;
|
||||
OSG_NOTICE<<"Warning: Receiver::init() setsockopt(..) failed, errno="<<errno<<std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// struct sockaddr_in saddr;
|
||||
saddr.sin_family = AF_INET;
|
||||
saddr.sin_port = htons( _port );
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
saddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
#else
|
||||
saddr.sin_addr.s_addr = 0;
|
||||
@@ -366,7 +366,7 @@ void Receiver::sync( void )
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
// saddr.sin_port = htons( _port );
|
||||
int result = recvfrom( _so, (char *)_buffer, _buffer_size, 0, (sockaddr*)&saddr, &size );
|
||||
// recvfrom(sock_Receive, szMessage, 256, 0, (sockaddr*)&addr_Cli, &clilen)
|
||||
@@ -419,7 +419,7 @@ Broadcaster::Broadcaster( void )
|
||||
|
||||
Broadcaster::~Broadcaster( void )
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
closesocket( _so);
|
||||
#else
|
||||
close( _so );
|
||||
@@ -428,7 +428,7 @@ Broadcaster::~Broadcaster( void )
|
||||
|
||||
bool Broadcaster::init( void )
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
WORD version = MAKEWORD(1,1);
|
||||
WSADATA wsaData;
|
||||
// First, we start up Winsock
|
||||
@@ -446,7 +446,7 @@ bool Broadcaster::init( void )
|
||||
perror( "Socket" );
|
||||
return false;
|
||||
}
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
const BOOL on = TRUE;
|
||||
#else
|
||||
int on = 1;
|
||||
@@ -454,7 +454,7 @@ bool Broadcaster::init( void )
|
||||
|
||||
int result = 0;
|
||||
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
result = setsockopt( _so, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, sizeof(int));
|
||||
#else
|
||||
result = setsockopt( _so, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
|
||||
@@ -466,24 +466,24 @@ bool Broadcaster::init( void )
|
||||
saddr.sin_port = htons( _port );
|
||||
if( _address == 0 )
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
result = setsockopt( _so, SOL_SOCKET, SO_BROADCAST, (const char *) &on, sizeof(int));
|
||||
#else
|
||||
result = setsockopt( _so, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
|
||||
#endif
|
||||
if (result) return false;
|
||||
|
||||
#if !defined (WIN32) || defined(__CYGWIN__)
|
||||
#if !defined (_WIN32) || defined(__CYGWIN__)
|
||||
struct ifreq ifr;
|
||||
#endif
|
||||
#if defined (__linux) || defined(__CYGWIN__)
|
||||
strcpy( ifr.ifr_name, "eth0" );
|
||||
#elif defined(__sun)
|
||||
strcpy( ifr.ifr_name, "hme0" );
|
||||
#elif !defined (WIN32)
|
||||
#elif !defined (_WIN32)
|
||||
strcpy( ifr.ifr_name, "ef0" );
|
||||
#endif
|
||||
#if defined (WIN32) // get the server address
|
||||
#if defined (_WIN32) // get the server address
|
||||
saddr.sin_addr.s_addr = htonl(INADDR_BROADCAST);
|
||||
}
|
||||
#else
|
||||
@@ -543,7 +543,7 @@ void Broadcaster::sync( void )
|
||||
}
|
||||
|
||||
int result = 0;
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
unsigned int size = sizeof( SOCKADDR_IN );
|
||||
result = sendto( _so, (const char *)_buffer, _buffer_size, 0, (struct sockaddr *)&saddr, size );
|
||||
// int err = WSAGetLastError ();
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||
#include <netinet/in.h>
|
||||
#else
|
||||
#include "winsock.h"
|
||||
@@ -51,7 +51,7 @@ class Receiver
|
||||
bool init( void );
|
||||
|
||||
private :
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
SOCKET _so;
|
||||
SOCKADDR_IN saddr;
|
||||
#else
|
||||
@@ -94,7 +94,7 @@ class Broadcaster
|
||||
bool init( void );
|
||||
|
||||
private :
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
SOCKET _so;
|
||||
#else
|
||||
int _so;
|
||||
@@ -103,7 +103,7 @@ class Broadcaster
|
||||
short _port;
|
||||
void *_buffer;
|
||||
unsigned int _buffer_size;
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
SOCKADDR_IN saddr;
|
||||
#else
|
||||
struct sockaddr_in saddr;
|
||||
|
||||
@@ -508,7 +508,7 @@ int main( int argc, char **argv )
|
||||
|
||||
viewer.addEventHandler( new osgViewer::WindowSizeHandler() );
|
||||
|
||||
// neeed to address.
|
||||
// need to address.
|
||||
// viewer.getScene()->getUpdateVisitor()->setTraversalMode(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN);
|
||||
|
||||
|
||||
@@ -558,7 +558,7 @@ int main( int argc, char **argv )
|
||||
while (arguments.read("--loop")) loopPresentation = true;
|
||||
|
||||
{
|
||||
// set update hte default traversal mode settings for update visitor
|
||||
// set update the default traversal mode settings for update visitor
|
||||
// default to osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN.
|
||||
osg::NodeVisitor::TraversalMode updateTraversalMode = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN; // viewer.getUpdateVisitor()->getTraversalMode();
|
||||
|
||||
@@ -690,7 +690,7 @@ int main( int argc, char **argv )
|
||||
// any option left unread are converted into errors to write out later.
|
||||
//arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have ocured when parsing the program aguments.
|
||||
// report any errors if they have ocured when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(osg::notify(osg::INFO));
|
||||
|
||||
@@ -312,7 +312,7 @@ int main( int argc, char **argv )
|
||||
osg::CoordinateSystemNode* csn = findTopMostNodeOfType<osg::CoordinateSystemNode>(loadedModel.get());
|
||||
if(!csn) return 1;
|
||||
|
||||
// Compute eye point in world coordiantes
|
||||
// Compute eye point in world coordinates
|
||||
osg::Vec3d eye;
|
||||
csn->getEllipsoidModel()->convertLatLongHeightToXYZ(lat, lon, alt, eye.x(), eye.y(), eye.z());
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ int main( int argc, char **argv )
|
||||
// use an ArgumentParser object to manage the program arguments.
|
||||
osg::ArgumentParser arguments(&argc,argv);
|
||||
|
||||
// set the osgDB::Registy read file callback to catch all requests for reading files.
|
||||
// set the osgDB::Registry read file callback to catch all requests for reading files.
|
||||
osgDB::Registry::instance()->setReadFileCallback(new MyReadFileCallback());
|
||||
|
||||
// initialize the viewer.
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <iostream>
|
||||
|
||||
#if !defined (WIN32) || defined(__CYGWIN__)
|
||||
#if !defined (_WIN32) || defined(__CYGWIN__)
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -54,7 +54,7 @@
|
||||
#elif defined (__APPLE__)
|
||||
#include <unistd.h>
|
||||
#include <sys/sockio.h>
|
||||
#elif defined (WIN32)
|
||||
#elif defined (_WIN32)
|
||||
#include <winsock.h>
|
||||
#include <stdio.h>
|
||||
#elif defined (__hpux)
|
||||
@@ -73,7 +73,7 @@ Broadcaster::Broadcaster( void )
|
||||
_ifr_name = "eth0";
|
||||
#elif defined(__sun)
|
||||
_ifr_name = "hme0";
|
||||
#elif !defined (WIN32)
|
||||
#elif !defined (_WIN32)
|
||||
_ifr_name = "ef0";
|
||||
#endif
|
||||
_port = 0;
|
||||
@@ -84,7 +84,7 @@ Broadcaster::Broadcaster( void )
|
||||
|
||||
Broadcaster::~Broadcaster( void )
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
closesocket( _so);
|
||||
#else
|
||||
close( _so );
|
||||
@@ -93,7 +93,7 @@ Broadcaster::~Broadcaster( void )
|
||||
|
||||
bool Broadcaster::init( void )
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
WORD version = MAKEWORD(1,1);
|
||||
WSADATA wsaData;
|
||||
// First, we start up Winsock
|
||||
@@ -111,13 +111,13 @@ bool Broadcaster::init( void )
|
||||
perror( "Socket" );
|
||||
return false;
|
||||
}
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
const BOOL on = TRUE;
|
||||
#else
|
||||
int on = 1;
|
||||
#endif
|
||||
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
setsockopt( _so, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, sizeof(int));
|
||||
#else
|
||||
setsockopt( _so, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
|
||||
@@ -127,17 +127,17 @@ bool Broadcaster::init( void )
|
||||
saddr.sin_port = htons( _port );
|
||||
if( _address == 0 )
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
setsockopt( _so, SOL_SOCKET, SO_BROADCAST, (const char *) &on, sizeof(int));
|
||||
#else
|
||||
setsockopt( _so, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
|
||||
#endif
|
||||
|
||||
#if !defined (WIN32) || defined(__CYGWIN__)
|
||||
#if !defined (_WIN32) || defined(__CYGWIN__)
|
||||
struct ifreq ifr;
|
||||
strcpy( ifr.ifr_name, _ifr_name.c_str());
|
||||
#endif
|
||||
#if defined (WIN32) // get the server address
|
||||
#if defined (_WIN32) // get the server address
|
||||
saddr.sin_addr.s_addr = htonl(INADDR_BROADCAST);
|
||||
}
|
||||
#else
|
||||
@@ -202,7 +202,7 @@ void Broadcaster::sync( void )
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
unsigned int size = sizeof( SOCKADDR_IN );
|
||||
sendto( _so, (const char *)_buffer, _buffer_size, 0, (struct sockaddr *)&saddr, size );
|
||||
int err = WSAGetLastError ();
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
// Class definition for broadcasting a buffer to a LAN
|
||||
//
|
||||
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
@@ -65,7 +65,7 @@ class Broadcaster
|
||||
|
||||
std::string _ifr_name;
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
SOCKET _so;
|
||||
#else
|
||||
int _so;
|
||||
@@ -74,7 +74,7 @@ class Broadcaster
|
||||
short _port;
|
||||
void *_buffer;
|
||||
unsigned int _buffer_size;
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
SOCKADDR_IN saddr;
|
||||
#else
|
||||
struct sockaddr_in saddr;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
@@ -46,7 +46,7 @@ Receiver::Receiver( void )
|
||||
|
||||
Receiver::~Receiver( void )
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
closesocket( _so);
|
||||
#else
|
||||
close( _so );
|
||||
@@ -55,7 +55,7 @@ Receiver::~Receiver( void )
|
||||
|
||||
bool Receiver::init( void )
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
WORD version = MAKEWORD(1,1);
|
||||
WSADATA wsaData;
|
||||
// First, we start up Winsock
|
||||
@@ -73,7 +73,7 @@ bool Receiver::init( void )
|
||||
perror( "Socket" );
|
||||
return false;
|
||||
}
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
// const BOOL on = TRUE;
|
||||
// setsockopt( _so, SOL_SOCKET, SO_REUSEADDR, (const char*) &on, sizeof(int));
|
||||
#else
|
||||
@@ -84,7 +84,7 @@ bool Receiver::init( void )
|
||||
// struct sockaddr_in saddr;
|
||||
saddr.sin_family = AF_INET;
|
||||
saddr.sin_port = htons( _port );
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
saddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
#else
|
||||
saddr.sin_addr.s_addr = 0;
|
||||
@@ -137,7 +137,7 @@ unsigned int Receiver::sync( void )
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
// saddr.sin_port = htons( _port );
|
||||
recvfrom( _so, (char *)_buffer, _buffer_size, 0, (sockaddr*)&saddr, &size );
|
||||
// recvfrom(sock_Receive, szMessage, 256, 0, (sockaddr*)&addr_Cli, &clilen)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
// Class definition for the recipient of a broadcasted message
|
||||
//
|
||||
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,7 @@ class Receiver
|
||||
bool init( void );
|
||||
|
||||
private :
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#if defined (_WIN32) && !defined(__CYGWIN__)
|
||||
SOCKET _so;
|
||||
SOCKADDR_IN saddr;
|
||||
#else
|
||||
|
||||
@@ -211,7 +211,7 @@ int main( int argc, char **argv )
|
||||
|
||||
// ------------- Start of copy specific code -------------------------------------------------------
|
||||
|
||||
// do a deep copy, using MyCopyOp to reveal whats going on under the hood,
|
||||
// do a deep copy, using MyCopyOp to reveal what's going on under the hood,
|
||||
// in your own code you'd typically just use the basic osg::CopyOp something like
|
||||
osg::ref_ptr<osg::Node> mycopy = dynamic_cast<osg::Node*>(rootnode->clone(osg::CopyOp::DEEP_COPY_ALL));
|
||||
std::cout << "Doing a deep copy of scene graph"<<std::endl;
|
||||
|
||||
@@ -128,7 +128,7 @@ int main( int argc, char **argv )
|
||||
osg::ArgumentParser arguments(&argc,argv);
|
||||
|
||||
// construct the viewer.
|
||||
osgViewer::Viewer viewer;
|
||||
osgViewer::Viewer viewer(arguments);
|
||||
|
||||
// add the state manipulator
|
||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||
|
||||
@@ -138,9 +138,7 @@ void getPossibleConfigs(GraphicsContext* gc, BufferConfigList& colorConfigs,
|
||||
return;
|
||||
if (ext->isMultisampleSupported)
|
||||
glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples);
|
||||
// isMultisampleCoverageSupported
|
||||
if (isGLExtensionSupported(contextID,
|
||||
"GL_NV_framebuffer_multisample_coverage"))
|
||||
if (ext->isRenderbufferMultisampleCoverageSupported())
|
||||
{
|
||||
glGetIntegerv(GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV,
|
||||
&coverageSampleConfigs);
|
||||
|
||||
@@ -77,7 +77,7 @@ int main( int argc, char **argv )
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-o <filename>","Base output filename of the images, recommended to use something like Images/image.png");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--cs <filename>","Load pre-generated configuration file for run.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--ouput-cs <filename>","Output configuration file with settings provided on commandline.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-p <filename>","Use specificied camera path file to control camera position.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-p <filename>","Use specified camera path file to control camera position.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--offscreen","Use an pbuffer to render the images offscreen.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--screen","Use an window to render the images.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--width <width>","Window/output image width.");
|
||||
|
||||
@@ -148,7 +148,7 @@ osg::Node* createScene()
|
||||
|
||||
// create a Vec3Array and add to it all my coordinates.
|
||||
// Like all the *Array variants (see include/osg/Array) , Vec3Array is derived from both osg::Array
|
||||
// and std::vector<>. osg::Array's are reference counted and hence sharable,
|
||||
// and std::vector<>. osg::Array's are reference counted and hence shareable,
|
||||
// which std::vector<> provides all the convenience, flexibility and robustness
|
||||
// of the most popular of all STL containers.
|
||||
osg::Vec3Array* vertices = new osg::Vec3Array;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
// disable the double to float errors.
|
||||
#pragma warning( disable : 4305 )
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
// disable the double to float errors.
|
||||
#pragma warning( disable : 4305 )
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
// disable the double to float errors.
|
||||
#pragma warning( disable : 4305 )
|
||||
#endif
|
||||
|
||||
@@ -64,7 +64,7 @@ void KeyboardModel::keyChange(int key, int virtualKey, int value)
|
||||
{
|
||||
osg::notify(osg::INFO) << "key value change, code="<<std::hex << key << "\t value="<< value << std::dec << std::endl;
|
||||
|
||||
// toggle the keys graphical representation on or off via osg::Swithc
|
||||
// toggle the keys graphical representation on or off via osg::Switch
|
||||
KeyModelMap::iterator itr = _keyModelMap.find(virtualKey);
|
||||
if (itr!=_keyModelMap.end())
|
||||
{
|
||||
|
||||
@@ -71,11 +71,11 @@ public:
|
||||
bool _addToModel;
|
||||
};
|
||||
|
||||
class DeleteSelectedNodesVisitor : public osg::NodeVisitor
|
||||
class SelectedNodesVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
DeleteSelectedNodesVisitor():
|
||||
SelectedNodesVisitor():
|
||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
|
||||
{
|
||||
}
|
||||
@@ -110,6 +110,23 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Node> createSelectedNodeSubgraph()
|
||||
{
|
||||
if (_selectedNodes.empty()) return osg::ref_ptr<osg::Node>();
|
||||
|
||||
if (_selectedNodes.size()==1) return _selectedNodes[0];
|
||||
|
||||
// note code doesn't yet handle selected nodes being nested within transforms.
|
||||
osg::ref_ptr<osg::Group> group;
|
||||
for(SelectedNodes::iterator itr = _selectedNodes.begin();
|
||||
itr != _selectedNodes.end();
|
||||
++itr)
|
||||
{
|
||||
group->addChild(*itr);
|
||||
}
|
||||
return group;
|
||||
}
|
||||
|
||||
typedef std::vector< osg::ref_ptr<osgFX::Scribe> > SelectedNodes;
|
||||
SelectedNodes _selectedNodes;
|
||||
|
||||
@@ -150,6 +167,18 @@ public:
|
||||
osg::notify(osg::NOTICE)<<"Saved model to file 'saved_model.osgt'"<<std::endl;
|
||||
osgDB::writeNodeFile(*(viewer->getSceneData()), "saved_model.osgt");
|
||||
}
|
||||
else if (ea.getKey()=='s')
|
||||
{
|
||||
SelectedNodesVisitor snv;
|
||||
viewer->getSceneData()->accept(snv);
|
||||
osg::ref_ptr<osg::Node> selected = snv.createSelectedNodeSubgraph();
|
||||
|
||||
if (selected)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Saved selected to file 'saved_selected.osgt'"<<std::endl;
|
||||
osgDB::writeNodeFile(*(viewer->getSceneData()), "saved_selected.osgt");
|
||||
}
|
||||
}
|
||||
else if (ea.getKey()=='p')
|
||||
{
|
||||
_usePolytopeIntersector = !_usePolytopeIntersector;
|
||||
@@ -167,7 +196,7 @@ public:
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Using window coordinates for picking"<<std::endl;
|
||||
} else {
|
||||
osg::notify(osg::NOTICE)<<"Using projection coordiates for picking"<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"Using projection coordinates for picking"<<std::endl;
|
||||
}
|
||||
}
|
||||
else if (ea.getKey()=='a')
|
||||
@@ -177,7 +206,7 @@ public:
|
||||
else if (ea.getKey()==osgGA::GUIEventAdapter::KEY_Delete || ea.getKey()==osgGA::GUIEventAdapter::KEY_BackSpace)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Delete"<<std::endl;
|
||||
DeleteSelectedNodesVisitor dsnv;
|
||||
SelectedNodesVisitor dsnv;
|
||||
viewer->getSceneData()->accept(dsnv);
|
||||
dsnv.pruneSelectedNodes();
|
||||
}
|
||||
@@ -401,7 +430,7 @@ public:
|
||||
|
||||
if (cmtsv._group->getNumChildren()>0)
|
||||
{
|
||||
std::cout<<"Writing selected compoents to 'selected_model.osgt'"<<std::endl;
|
||||
std::cout<<"Writing selected components to 'selected_model.osgt'"<<std::endl;
|
||||
osgDB::writeNodeFile(*cmtsv._group, "selected_model.osgt");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ int main(int argc, char** argv)
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--shader","Use shaders to post process the video.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--interactive","Use camera manipulator to allow movement around movie.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--flip","Flip the movie so top becomes bottom.");
|
||||
#if defined(WIN32) || defined(__APPLE__)
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--devices","Print the Video input capability via QuickTime and exit.");
|
||||
#endif
|
||||
|
||||
@@ -433,7 +433,7 @@ int main(int argc, char** argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(WIN32) || defined(__APPLE__)
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
// if user requests devices video capability.
|
||||
if (arguments.read("-devices") || arguments.read("--devices"))
|
||||
{
|
||||
|
||||
@@ -175,7 +175,7 @@ int main( int argc, char** argv )
|
||||
// A floating error of delta-time should be explained here:
|
||||
// The particles emitter, program and updater all use a 'dt' to compute the time value in every frame.
|
||||
// Because the 'dt' is a double value, it is not suitable to keep three copies of it separately, which
|
||||
// is the previous implementation. The small error makes some opeartors unable to work correctly, e.g.
|
||||
// is the previous implementation. The small error makes some operators unable to work correctly, e.g.
|
||||
// the BounceOperator.
|
||||
// Now we make use of the getDeltaTime() of ParticleSystem to maintain and dispatch the delta time. But..
|
||||
// it is not the best solution so far, since there are still very few particles acting unexpectedly.
|
||||
|
||||
@@ -76,7 +76,7 @@ void computeViewMatrixOnEarth( osg::Camera* camera, osg::Node* scene,
|
||||
osg::CoordinateSystemNode* csn = findTopMostNodeOfType<osg::CoordinateSystemNode>(scene);
|
||||
if ( !csn ) return;
|
||||
|
||||
// Compute eye point in world coordiantes
|
||||
// Compute eye point in world coordinates
|
||||
osg::Vec3d eye;
|
||||
csn->getEllipsoidModel()->convertLatLongHeightToXYZ(
|
||||
latLongHeight.x(), latLongHeight.y(), latLongHeight.z(), eye.x(), eye.y(), eye.z() );
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
//
|
||||
// A simple demo demonstrating planar reflections using multiple renderings
|
||||
// of a subgraph, overriding of state attribures and use of the stencil buffer.
|
||||
// of a subgraph, overriding of state attributes and use of the stencil buffer.
|
||||
//
|
||||
// The multipass system implemented here is a variation of Mark Kilgard's
|
||||
// paper "Improving Shadows and Reflections via the Stencil Buffer" which
|
||||
|
||||
@@ -99,19 +99,19 @@ class WindowCaptureCallback : public osg::Camera::DrawCallback
|
||||
switch(_mode)
|
||||
{
|
||||
case(READ_PIXELS):
|
||||
osg::notify(osg::NOTICE)<<"Reading window usig glReadPixels, with out PixelBufferObject."<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"Reading window using glReadPixels, with out PixelBufferObject."<<std::endl;
|
||||
break;
|
||||
case(SINGLE_PBO):
|
||||
osg::notify(osg::NOTICE)<<"Reading window usig glReadPixels, with a single PixelBufferObject."<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"Reading window using glReadPixels, with a single PixelBufferObject."<<std::endl;
|
||||
_pboBuffer.push_back(0);
|
||||
break;
|
||||
case(DOUBLE_PBO):
|
||||
osg::notify(osg::NOTICE)<<"Reading window usig glReadPixels, with a double buffer PixelBufferObject."<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"Reading window using glReadPixels, with a double buffer PixelBufferObject."<<std::endl;
|
||||
_pboBuffer.push_back(0);
|
||||
_pboBuffer.push_back(0);
|
||||
break;
|
||||
case(TRIPLE_PBO):
|
||||
osg::notify(osg::NOTICE)<<"Reading window usig glReadPixels, with a triple buffer PixelBufferObject."<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"Reading window using glReadPixels, with a triple buffer PixelBufferObject."<<std::endl;
|
||||
_pboBuffer.push_back(0);
|
||||
_pboBuffer.push_back(0);
|
||||
_pboBuffer.push_back(0);
|
||||
|
||||
@@ -69,7 +69,7 @@ osg::Node* createTextGroup(const char** text)
|
||||
// loop through all children
|
||||
seq->setInterval(osg::Sequence::LOOP, 0,-1);
|
||||
|
||||
// real-time playback, repeat indefinitively
|
||||
// real-time playback, repeat indefinitely
|
||||
seq->setDuration(1.0f, -1);
|
||||
|
||||
// must be started explicitly
|
||||
@@ -157,7 +157,7 @@ osg::Sequence* createSequence(osg::ArgumentParser& arguments)
|
||||
// loop through all children
|
||||
seq->setInterval(osg::Sequence::LOOP, 0,-1);
|
||||
|
||||
// real-time playback, repeat indefinitively
|
||||
// real-time playback, repeat indefinitely
|
||||
seq->setDuration(1.0f, -1);
|
||||
|
||||
seq->setMode(osg::Sequence::START);
|
||||
@@ -244,7 +244,7 @@ int main( int argc, char **argv )
|
||||
"- is subclassed from osg::Switch",
|
||||
"- assigns a display duration to each child",
|
||||
"- can loop or swing through an interval of it's children",
|
||||
"- can repeat the interval a number of times or indefinitively",
|
||||
"- can repeat the interval a number of times or indefinitely",
|
||||
"- press 's' to start/pause/resume",
|
||||
"- press 'l' to toggle loop/swing mode",
|
||||
NULL
|
||||
|
||||
@@ -99,7 +99,7 @@ osg::Node* createOldShaderCompositionScene(osg::ArgumentParser& arguments)
|
||||
group->addChild(pat);
|
||||
}
|
||||
|
||||
// resuse the first ShaderAttribute's type and ShaderComponent, just use new uniform
|
||||
// reuse the first ShaderAttribute's type and ShaderComponent, just use new uniform
|
||||
{
|
||||
osg::PositionAttitudeTransform* pat = new osg::PositionAttitudeTransform;
|
||||
pat->setPosition(position);
|
||||
@@ -119,7 +119,7 @@ osg::Node* createOldShaderCompositionScene(osg::ArgumentParser& arguments)
|
||||
}
|
||||
|
||||
|
||||
// resuse the first ShaderAttribute's type and ShaderComponent, just use new uniform
|
||||
// reuse the first ShaderAttribute's type and ShaderComponent, just use new uniform
|
||||
{
|
||||
osg::PositionAttitudeTransform* pat = new osg::PositionAttitudeTransform;
|
||||
pat->setPosition(position);
|
||||
|
||||
@@ -314,7 +314,7 @@ int main(int, char **)
|
||||
|
||||
osg::ref_ptr<TestSupportOperation> testSupportOperation = new TestSupportOperation;
|
||||
#if 0
|
||||
// temporily commenting out as its causing the viewer to crash... no clue yet to why
|
||||
// temporarily commenting out as its causing the viewer to crash... no clue yet to why
|
||||
viewer.setRealizeOperation(testSupportOperation.get());
|
||||
#endif
|
||||
// create the windows and run the threads.
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
// disable the double to float errors.
|
||||
#pragma warning( disable : 4305 )
|
||||
#endif
|
||||
|
||||
@@ -158,7 +158,7 @@ If you have an external project that will depend on OSG built for OpenGL 3.x,
|
||||
you'll need to ensure your external project also uses the compiler include
|
||||
directives to find <GL3/gl3.h>.
|
||||
|
||||
To berify your application is using a pure OpenGL 3.x context, set
|
||||
To verify your application is using a pure OpenGL 3.x context, set
|
||||
OSG_NOTIFY_LEVEL=INFO in the environment and check the console output. Context
|
||||
creation displays output such as the following:
|
||||
GL3: Attempting to create OpenGL3 context.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Disable unavoidable warning messages:
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#pragma warning(disable : 4103 4114 4201 4237 4251 4275 4290 4503 4335 4786)
|
||||
|
||||
#endif // WIN32
|
||||
#endif // _WIN32
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
|
||||
@@ -470,7 +470,7 @@ osg::Geometry *makePols (void) {
|
||||
gtess->setStateSet( stateset );
|
||||
|
||||
int nstart=0;
|
||||
// the contours accepoted are polygons; quads & tris. Trifans can bve added later.
|
||||
// the contours accepted are polygons; quads & tris. Trifans can be added later.
|
||||
gtess->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,nstart,12));nstart+=12;
|
||||
gtess->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,nstart,12));nstart+=12;
|
||||
gtess->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,nstart,16));nstart+=16;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* A demonstration of Tessellation Shaders in OpenScenegraph.
|
||||
*
|
||||
* Instructions:
|
||||
* Press plus to increase tesselation and minus to decrease it.
|
||||
* Press right arrow to increase inner tesselation and left arrow to decrease it.
|
||||
* Press up arrow to increase outer tesselation and down arrow to decrease it.
|
||||
* Press plus to increase tessellation and minus to decrease it.
|
||||
* Press right arrow to increase inner tessellation and left arrow to decrease it.
|
||||
* Press up arrow to increase outer tessellation and down arrow to decrease it.
|
||||
*
|
||||
* Original code by Philip Rideout
|
||||
* Adapted to OpenScenegraph by John Kaniarz
|
||||
|
||||
@@ -683,7 +683,7 @@ int main(int argc, char** argv)
|
||||
text->setFont("fonts/times.ttf");
|
||||
text->setAxisAlignment(osgText::Text::XZ_PLANE);
|
||||
text->setAlignment(osgText::Text::RIGHT_TOP);
|
||||
text->setText("Alingment\nBefore:");
|
||||
text->setText("Alignment\nBefore:");
|
||||
group->addChild(text);
|
||||
}
|
||||
|
||||
@@ -691,7 +691,7 @@ int main(int argc, char** argv)
|
||||
osg::ref_ptr<osgText::Text> text = new osgText::Text;
|
||||
text->setFont("fonts/times.ttf");
|
||||
text->setAxisAlignment(osgText::Text::XZ_PLANE);
|
||||
text->setText("Alingment\nAfter:");
|
||||
text->setText("Alignment\nAfter:");
|
||||
text->setAlignment(osgText::Text::LEFT_TOP);
|
||||
group->addChild(text);
|
||||
}
|
||||
|
||||
@@ -543,7 +543,7 @@ public:
|
||||
// now assign the appropriate portion data from the originalImage
|
||||
subImage->setImage(originalImage->s()/2, originalImage->t()/2, originalImage->r(), // half the width and height
|
||||
originalImage->getInternalTextureFormat(), // same internal texture format
|
||||
originalImage->getPixelFormat(),originalImage->getDataType(), // same pixel foramt and data type
|
||||
originalImage->getPixelFormat(),originalImage->getDataType(), // same pixel format and data type
|
||||
originalImage->data(originalImage->s()/4,originalImage->t()/4), // offset the start point to 1/4 into the image
|
||||
osg::Image::NO_DELETE, // don't attempt to delete the image data, leave this to the originalImage
|
||||
originalImage->getPacking(), // use the same packing
|
||||
|
||||
@@ -124,7 +124,7 @@ int main(int argc, char** argv)
|
||||
|
||||
if (arguments.argc()<=1)
|
||||
{
|
||||
std::cout<<"Please supply an image filename on the commnand line."<<std::endl;
|
||||
std::cout<<"Please supply an image filename on the command line."<<std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ std::ostream& TestContext::tout(TraceLevel tl) const
|
||||
TestContext::TraceStream::TraceStream(std::ostream& o, TraceLevel tl):
|
||||
_traceLevel(tl),
|
||||
_outputStreamPtr(&o),
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
_nullStream("nul")
|
||||
#else
|
||||
_nullStream("/dev/null")
|
||||
|
||||
@@ -215,7 +215,7 @@ void testGetQuatFromMatrix(const osg::Vec3d& scale)
|
||||
double yaw2stop = 360.0;
|
||||
double yaw2step = 20.0;
|
||||
#else
|
||||
// focussed range
|
||||
// focused range
|
||||
double rol1start = 0.0;
|
||||
double rol1stop = 0.0;
|
||||
double rol1step = 0.1;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#endif
|
||||
|
||||
// For wxCURSOR_BLANK below, but isn't used a.t.m.
|
||||
//#ifdef WIN32
|
||||
//#ifdef _WIN32
|
||||
//#include "wx/msw/wx.rc"
|
||||
//#endif
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <OpenThreads/Config>
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
#define OPENTHREAD_EXPORT_DIRECTIVE
|
||||
#else
|
||||
#if defined( OT_LIBRARY_STATIC )
|
||||
|
||||
@@ -63,6 +63,13 @@ class BoundingSphereImpl
|
||||
* otherwise. */
|
||||
inline bool valid() const { return _radius>=0.0; }
|
||||
|
||||
inline BoundingSphereImpl& operator = (const BoundingSphereImpl& rhs)
|
||||
{
|
||||
_center = rhs._center;
|
||||
_radius = rhs._radius;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool operator == (const BoundingSphereImpl& rhs) const { return _center==rhs._center && _radius==rhs._radius; }
|
||||
inline bool operator != (const BoundingSphereImpl& rhs) const { return _center!=rhs._center || _radius!=rhs._radius; }
|
||||
|
||||
|
||||
@@ -121,6 +121,32 @@ class OSG_EXPORT Callback : public virtual Object {
|
||||
}
|
||||
}
|
||||
|
||||
/** Convenience method to find a nested callback by type. */
|
||||
template <typename T>
|
||||
static T* findNestedCallback(osg::Callback* callback)
|
||||
{
|
||||
if (!callback)
|
||||
return NULL;
|
||||
|
||||
if (T* cb = dynamic_cast<T*>(callback))
|
||||
return cb;
|
||||
|
||||
return findNestedCallback<T>(callback->getNestedCallback());
|
||||
}
|
||||
|
||||
/** Convenience method to find a nested callback by type. */
|
||||
template <typename T>
|
||||
static const T* findNestedCallback(const osg::Callback* callback)
|
||||
{
|
||||
if (!callback)
|
||||
return NULL;
|
||||
|
||||
if (const T* cb = dynamic_cast<const T*>(callback))
|
||||
return cb;
|
||||
|
||||
return findNestedCallback<T>(callback->getNestedCallback());
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~Callback() {}
|
||||
|
||||
@@ -149,6 +149,15 @@ class VertexAttribAlias
|
||||
_osgName(osgName),
|
||||
_declaration(declaration) {}
|
||||
|
||||
VertexAttribAlias& operator = (const VertexAttribAlias& rhs)
|
||||
{
|
||||
_location = rhs._location;
|
||||
_glName = rhs._glName;
|
||||
_osgName = rhs._osgName;
|
||||
_declaration = rhs._declaration;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLuint _location;
|
||||
std::string _glName;
|
||||
std::string _osgName;
|
||||
@@ -521,6 +530,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
bool isTextureCompressionETC2Supported;
|
||||
bool isTextureCompressionRGTCSupported;
|
||||
bool isTextureCompressionPVRTCSupported;
|
||||
bool isTextureCompressionASTCSupported;
|
||||
bool isTextureMirroredRepeatSupported;
|
||||
bool isTextureEdgeClampSupported;
|
||||
bool isTextureBorderClampSupported;
|
||||
@@ -530,6 +540,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
|
||||
bool isShadowSupported;
|
||||
bool isShadowAmbientSupported;
|
||||
bool isTextureMaxLevelSupported;
|
||||
bool isTextureLODBiasSupported;
|
||||
GLint maxTextureSize;
|
||||
bool isClientStorageSupported;
|
||||
bool isTextureIntegerEXTSupported;
|
||||
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
void notify(osg::NotifySeverity severity, const char *message);
|
||||
};
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
|
||||
/** Redirects notification stream to windows debugger with use of
|
||||
* OuputDebugString functions.
|
||||
|
||||
@@ -53,6 +53,14 @@ class OSG_EXPORT Quat
|
||||
_v[3]=w;
|
||||
}
|
||||
|
||||
inline Quat( const Quat& rhs )
|
||||
{
|
||||
_v[0]=rhs._v[0];
|
||||
_v[1]=rhs._v[1];
|
||||
_v[2]=rhs._v[2];
|
||||
_v[3]=rhs._v[3];
|
||||
}
|
||||
|
||||
inline Quat( const Vec4f& v )
|
||||
{
|
||||
_v[0]=v.x();
|
||||
|
||||
@@ -1328,12 +1328,12 @@ class OSG_EXPORT State : public Referenced
|
||||
inline void popModeList(ModeMap& modeMap,const StateSet::ModeList& modeList);
|
||||
inline void popAttributeList(AttributeMap& attributeMap,const StateSet::AttributeList& attributeList);
|
||||
inline void popUniformList(UniformMap& uniformMap,const StateSet::UniformList& uniformList);
|
||||
inline void popDefineList(DefineMap& uniformMap,const StateSet::DefineList& defineList);
|
||||
inline void popDefineList(DefineMap& defineMap,const StateSet::DefineList& defineList);
|
||||
|
||||
inline void applyModeList(ModeMap& modeMap,const StateSet::ModeList& modeList);
|
||||
inline void applyAttributeList(AttributeMap& attributeMap,const StateSet::AttributeList& attributeList);
|
||||
inline void applyUniformList(UniformMap& uniformMap,const StateSet::UniformList& uniformList);
|
||||
inline void applyDefineList(DefineMap& uniformMap,const StateSet::DefineList& defineList);
|
||||
inline void applyDefineList(DefineMap& defineMap,const StateSet::DefineList& defineList);
|
||||
|
||||
inline void applyModeMap(ModeMap& modeMap);
|
||||
inline void applyAttributeMap(AttributeMap& attributeMap);
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
unsigned int pos=first;
|
||||
for(GLsizei i=3;i<count;i+=2,pos+=2)
|
||||
{
|
||||
this->operator()(pos,pos+1,pos+2,pos+3);
|
||||
this->operator()(pos,pos+1,pos+3,pos+2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public:
|
||||
IndexPointer iptr = indices;
|
||||
for(GLsizei i=3;i<count;i+=2,iptr+=2)
|
||||
{
|
||||
this->operator()(*(iptr),*(iptr+1),*(iptr+2),*(iptr+3));
|
||||
this->operator()(*(iptr),*(iptr+1),*(iptr+3),*(iptr+2));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -283,7 +283,7 @@ public:
|
||||
IndexPointer iptr = indices;
|
||||
for(GLsizei i=3;i<count;i+=2,iptr+=2)
|
||||
{
|
||||
this->operator()(*(iptr),*(iptr+1),*(iptr+2),*(iptr+3));
|
||||
this->operator()(*(iptr),*(iptr+1),*(iptr+3),*(iptr+2));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -378,7 +378,7 @@ public:
|
||||
IndexPointer iptr = indices;
|
||||
for(GLsizei i=3;i<count;i+=2,iptr+=2)
|
||||
{
|
||||
this->operator()(*(iptr),*(iptr+1),*(iptr+2),*(iptr+3));
|
||||
this->operator()(*(iptr),*(iptr+1),*(iptr+3),*(iptr+2));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -62,6 +62,10 @@
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
||||
#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
|
||||
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
|
||||
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
|
||||
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_texture_compression_rgtc
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
typedef unsigned __int64 Timer_t;
|
||||
#else
|
||||
typedef unsigned long long Timer_t;
|
||||
|
||||
@@ -36,6 +36,9 @@ class ref_ptr
|
||||
ref_ptr() : _ptr(0) {}
|
||||
ref_ptr(T* ptr) : _ptr(ptr) { if (_ptr) _ptr->ref(); }
|
||||
ref_ptr(const ref_ptr& rp) : _ptr(rp._ptr) { if (_ptr) _ptr->ref(); }
|
||||
#if __cplusplus >= 201103L
|
||||
ref_ptr(ref_ptr&& rp) noexcept : _ptr(rp._ptr) { rp._ptr = 0; }
|
||||
#endif
|
||||
template<class Other> ref_ptr(const ref_ptr<Other>& rp) : _ptr(rp._ptr) { if (_ptr) _ptr->ref(); }
|
||||
ref_ptr(observer_ptr<T>& optr) : _ptr(0) { optr.lock(*this); }
|
||||
~ref_ptr() { if (_ptr) _ptr->unref(); _ptr = 0; }
|
||||
@@ -52,6 +55,17 @@ class ref_ptr
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template<class Other> ref_ptr& operator = (ref_ptr<Other>&& rp)
|
||||
{
|
||||
if (_ptr == rp._ptr) return *this;
|
||||
if (_ptr != nullptr) _ptr->unref();
|
||||
_ptr = rp._ptr;
|
||||
rp._ptr = nullptr;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline ref_ptr& operator = (T* ptr)
|
||||
{
|
||||
if (_ptr==ptr) return *this;
|
||||
|
||||
@@ -105,12 +105,12 @@ namespace osgAnimation
|
||||
// 2. build deduplicated list of keyframes
|
||||
unsigned int cumul = 0;
|
||||
VectorType deduplicated;
|
||||
for(std::vector<unsigned int>::iterator iterator = intervalSizes.begin() ; iterator != intervalSizes.end() ; ++ iterator) {
|
||||
for(std::vector<unsigned int>::iterator it = intervalSizes.begin() ; it != intervalSizes.end() ; ++ it) {
|
||||
deduplicated.push_back((*this)[cumul]);
|
||||
if(*iterator > 1) {
|
||||
deduplicated.push_back((*this)[cumul + (*iterator) - 1]);
|
||||
if(*it > 1) {
|
||||
deduplicated.push_back((*this)[cumul + (*it) - 1]);
|
||||
}
|
||||
cumul += *iterator;
|
||||
cumul += *it;
|
||||
}
|
||||
|
||||
unsigned int count = size() - deduplicated.size();
|
||||
|
||||
@@ -40,6 +40,7 @@ class ReaderWriterInfo : public osg::Referenced
|
||||
ReaderWriter::FormatDescriptionMap protocols;
|
||||
ReaderWriter::FormatDescriptionMap extensions;
|
||||
ReaderWriter::FormatDescriptionMap options;
|
||||
ReaderWriter::FormatDescriptionMap environment;
|
||||
ReaderWriter::Features features;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -63,6 +63,9 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
|
||||
/** Return which list of file extensions supported by ReaderWriter. */
|
||||
virtual const FormatDescriptionMap& supportedOptions() const { return _supportedOptions; }
|
||||
|
||||
/** Return which list of file environment variables supported by ReaderWriter. */
|
||||
virtual const FormatDescriptionMap& supportedEnvironment() const { return _supportedEnvironment; }
|
||||
|
||||
/** Return true if ReaderWriter accepts specified file extension.*/
|
||||
virtual bool acceptsExtension(const std::string& /*extension*/) const;
|
||||
|
||||
@@ -282,11 +285,15 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
|
||||
* Please note, this should usually only be used internally by subclasses of ReaderWriter. */
|
||||
void supportsOption(const std::string& opt, const std::string& description);
|
||||
|
||||
/** Specify env string as a supported environment string. */
|
||||
void supportsEnvironment(const std::string& opt, const std::string& description);
|
||||
|
||||
protected:
|
||||
|
||||
FormatDescriptionMap _supportedProtocols;
|
||||
FormatDescriptionMap _supportedExtensions;
|
||||
FormatDescriptionMap _supportedOptions;
|
||||
FormatDescriptionMap _supportedEnvironment;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ namespace osgDB {
|
||||
The RegisterReaderWriterProxy can be used to automatically
|
||||
register at runtime a reader/writer with the Registry.
|
||||
*/
|
||||
class OSGDB_EXPORT Registry : public osg::Referenced
|
||||
class OSGDB_EXPORT Registry : osg::depends_on<OpenThreads::Mutex*, osg::Referenced::getGlobalReferencedMutex>,
|
||||
public osg::Referenced
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -283,7 +283,9 @@ struct GraphicsWindowFunctionProxy
|
||||
extern "C" void graphicswindow_##ext(void); \
|
||||
static osgViewer::GraphicsWindowFunctionProxy graphicswindowproxy_##ext(graphicswindow_##ext);
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(OSG_WINDOWING_SYSTEM_NONE)
|
||||
#define USE_GRAPHICSWINDOW()
|
||||
#elif defined(_WIN32)
|
||||
#define USE_GRAPHICSWINDOW() USE_GRAPICSWINDOW_IMPLEMENTATION(Win32)
|
||||
#elif defined(__APPLE__)
|
||||
#if defined(OSG_WINDOWING_SYSTEM_CARBON)
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
Widget (const std::string& = "", point_type = 0.0f, point_type = 0.0f);
|
||||
Widget (const Widget&, const osg::CopyOp&);
|
||||
|
||||
META_Object (osgWidget, Widget);
|
||||
META_Node (osgWidget, Widget);
|
||||
|
||||
virtual ~Widget() {
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ private:
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Print information related to thread schduling parameters.
|
||||
// Print information related to thread scheduling parameters.
|
||||
//
|
||||
static void PrintThreadSchedulingInfo(Thread *thread) {
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ int Condition::wait(Mutex *mutex, unsigned long int ms) {
|
||||
static_cast<PThreadMutexPrivateData *>(mutex->_prvData);
|
||||
|
||||
|
||||
// wait time is now in ms milliseconds, so need to convert to seconds and nanoseconds for timespec strucuture.
|
||||
// wait time is now in ms milliseconds, so need to convert to seconds and nanoseconds for timespec structure.
|
||||
unsigned int sec = ms / 1000;
|
||||
unsigned int nsec = (ms % 1000) * 1000000;
|
||||
|
||||
|
||||
@@ -43,11 +43,13 @@ IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
||||
HANDLE_MSVC_DLL(ot ${OPENTHREADS_SOVERSION})
|
||||
ENDIF()
|
||||
|
||||
SET(INSTALL_BINDIR bin)
|
||||
|
||||
INSTALL(
|
||||
TARGETS OpenThreads
|
||||
ARCHIVE DESTINATION lib COMPONENT libopenthreads-dev
|
||||
LIBRARY DESTINATION lib COMPONENT libopenthreads
|
||||
RUNTIME DESTINATION bin COMPONENT libopenthreads
|
||||
RUNTIME DESTINATION ${INSTALL_BINDIR} COMPONENT libopenthreads
|
||||
)
|
||||
INSTALL(
|
||||
FILES ${OpenThreads_PUBLIC_HEADERS}
|
||||
@@ -55,4 +57,19 @@ INSTALL(
|
||||
COMPONENT libopenthreads-dev
|
||||
)
|
||||
|
||||
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()
|
||||
IF( ${CMAKE_GENERATOR} STREQUAL "Ninja" )
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}${LIB_NAME}${CMAKE_RELEASE_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenthreads CONFIGURATIONS Release)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}${LIB_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenthreads CONFIGURATIONS RelWithDebInfo)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PREFIX}${LIB_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenthreads CONFIGURATIONS Debug)
|
||||
ELSE( ${CMAKE_GENERATOR} STREQUAL "Ninja" )
|
||||
INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenthreads CONFIGURATIONS RelWithDebInfo)
|
||||
INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenthreads CONFIGURATIONS Debug)
|
||||
ENDIF( ${CMAKE_GENERATOR} STREQUAL "Ninja" )
|
||||
ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||
|
||||
#commented out# INCLUDE(ModuleInstall OPTIONAL)
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace OpenThreads {
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Print information related to thread schduling parameters.
|
||||
// Print information related to thread scheduling parameters.
|
||||
//
|
||||
static void PrintThreadSchedulingInfo(Thread *thread) {
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ void ApplicationUsage::getFormattedString(std::string& str, const UsageMap& um,u
|
||||
std::string::size_type slashn_pos = explanation.find('\n',pos);
|
||||
|
||||
unsigned int extraSkip = 0;
|
||||
bool concatinated = false;
|
||||
bool concatenated = false;
|
||||
if (slashn_pos!=std::string::npos)
|
||||
{
|
||||
if (slashn_pos<pos+width)
|
||||
@@ -227,13 +227,13 @@ void ApplicationUsage::getFormattedString(std::string& str, const UsageMap& um,u
|
||||
// word must be longer than a whole line so will need
|
||||
// to concatenate it.
|
||||
width = explanationWidth-1;
|
||||
concatinated = true;
|
||||
concatenated = true;
|
||||
}
|
||||
}
|
||||
|
||||
line.replace(explanationPos+offset,explanationWidth, explanation, pos, width);
|
||||
|
||||
if (concatinated) { str += line; str += "-\n"; }
|
||||
if (concatenated) { str += line; str += "-\n"; }
|
||||
else { str += line; str += "\n"; }
|
||||
|
||||
// move to the next line of output.
|
||||
|
||||
@@ -198,7 +198,7 @@ ArgumentParser::ArgumentParser(int* argc,char **argv):
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
// Remove linefeed from last argument if it exist
|
||||
char* lastline = argc==0 ? 0 : _argv[*argc-1];
|
||||
if (lastline)
|
||||
|
||||
@@ -815,7 +815,7 @@ void GLBufferObjectSet::remove(GLBufferObject* to)
|
||||
}
|
||||
else
|
||||
{
|
||||
// 'to' was tail so assing tail to the previous in list
|
||||
// 'to' was tail so assign tail to the previous in list
|
||||
_tail = to->_previous;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,5 +37,6 @@
|
||||
#cmakedefine OSG_USE_DEPRECATED_API
|
||||
#cmakedefine OSG_ENVVAR_SUPPORTED
|
||||
#cmakedefine OSG_WINDOWING_SYSTEM_CARBON
|
||||
#cmakedefine OSG_WINDOWING_SYSTEM_NONE
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,16 +22,16 @@
|
||||
#include <algorithm>
|
||||
#include <string.h>
|
||||
|
||||
using namespace osg;
|
||||
using namespace std;
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#include<windows.h>
|
||||
extern "C" { OSG_EXPORT DWORD NvOptimusEnablement=0x00000001; }
|
||||
#else
|
||||
extern "C" { int NvOptimusEnablement=0x00000001; }
|
||||
#endif
|
||||
|
||||
using namespace osg;
|
||||
using namespace std;
|
||||
|
||||
void DisplaySettings::setNvOptimusEnablement(int value)
|
||||
{
|
||||
NvOptimusEnablement = value;
|
||||
@@ -120,7 +120,7 @@ void DisplaySettings::setDisplaySettings(const DisplaySettings& vs)
|
||||
|
||||
_vertexBufferHint = vs._vertexBufferHint;
|
||||
|
||||
setShaderHint(_shaderHint);
|
||||
setShaderHint(vs._shaderHint);
|
||||
|
||||
_keystoneHint = vs._keystoneHint;
|
||||
_keystoneFileNames = vs._keystoneFileNames;
|
||||
@@ -719,7 +719,7 @@ void DisplaySettings::readEnvironmentalVariables()
|
||||
|
||||
if (getEnvVar("OSG_KEYSTONE_FILES", value))
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
char delimitor = ';';
|
||||
#else
|
||||
char delimitor = ':';
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#define OSG_GL_CONTEXT_VERSION "@OSG_GL_CONTEXT_VERSION@"
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
|
||||
// Required for compatibility with glext.h style function definitions of
|
||||
// OpenGL extensions, such as in src/osg/Point.cpp.
|
||||
@@ -50,7 +50,7 @@
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
#else // WIN32
|
||||
#else // _WIN32
|
||||
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
#define _WCHAR_T_DEFINED
|
||||
#endif
|
||||
|
||||
#endif // WIN32
|
||||
#endif // _WIN32
|
||||
|
||||
#if defined(OSG_GL3_AVAILABLE)
|
||||
#define GL3_PROTOTYPES 1
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
|
||||
#if defined(WIN32)
|
||||
#if defined(_WIN32)
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif // WIN32_LEAN_AND_MEAN
|
||||
@@ -174,7 +174,7 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex
|
||||
if (*startOfWord!=0) extensionSet.insert(std::string(startOfWord));
|
||||
}
|
||||
|
||||
#if defined(WIN32) && (defined(OSG_GL1_AVAILABLE) || defined(OSG_GL2_AVAILABLE) || defined(OSG_GL3_AVAILABLE))
|
||||
#if defined(_WIN32) && (defined(OSG_GL1_AVAILABLE) || defined(OSG_GL2_AVAILABLE) || defined(OSG_GL3_AVAILABLE))
|
||||
|
||||
// add WGL extensions to the list
|
||||
|
||||
@@ -340,7 +340,7 @@ OSG_INIT_SINGLETON_PROXY(GLExtensionDisableStringInitializationProxy, osg::getGL
|
||||
#endif
|
||||
return dlsym(handle, funcName);
|
||||
|
||||
#elif defined(WIN32)
|
||||
#elif defined(_WIN32)
|
||||
|
||||
#if defined(OSG_GLES2_AVAILABLE)
|
||||
static HMODULE hmodule = GetModuleHandle(TEXT("libGLESv2.dll"));
|
||||
@@ -746,7 +746,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
isOcclusionQuerySupported = validContext && osg::isGLExtensionSupported(contextID, "GL_NV_occlusion_query");
|
||||
isARBOcclusionQuerySupported = validContext && (OSG_GL3_FEATURES || osg::isGLExtensionSupported(contextID, "GL_ARB_occlusion_query"));
|
||||
|
||||
isTimerQuerySupported = validContext && osg::isGLExtensionSupported(contextID, "GL_EXT_timer_query");
|
||||
isTimerQuerySupported = validContext && (osg::isGLExtensionSupported(contextID, "GL_EXT_timer_query") || osg::isGLExtensionSupported(contextID, "GL_EXT_disjoint_timer_query"));
|
||||
isARBTimerQuerySupported = validContext && osg::isGLExtensionSupported(contextID, "GL_ARB_timer_query");
|
||||
|
||||
|
||||
@@ -781,19 +781,19 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
setGLExtensionFuncPtr(glGetOcclusionQueryiv, "glGetOcclusionQueryiv","glGetOcclusionQueryivNV", validContext);
|
||||
setGLExtensionFuncPtr(glGetOcclusionQueryuiv, "glGetOcclusionQueryuiv","glGetOcclusionQueryuivNV", validContext);
|
||||
|
||||
setGLExtensionFuncPtr(glGenQueries, "glGenQueries", "glGenQueriesARB", validContext);
|
||||
setGLExtensionFuncPtr(glDeleteQueries, "glDeleteQueries", "glDeleteQueriesARB", validContext);
|
||||
setGLExtensionFuncPtr(glIsQuery, "glIsQuery", "glIsQueryARB", validContext);
|
||||
setGLExtensionFuncPtr(glBeginQuery, "glBeginQuery", "glBeginQueryARB", validContext);
|
||||
setGLExtensionFuncPtr(glEndQuery, "glEndQuery", "glEndQueryARB", validContext);
|
||||
setGLExtensionFuncPtr(glGenQueries, "glGenQueries", "glGenQueriesARB", "glGenQueriesEXT", validContext);
|
||||
setGLExtensionFuncPtr(glDeleteQueries, "glDeleteQueries", "glDeleteQueriesARB", "glDeleteQueriesEXT", validContext);
|
||||
setGLExtensionFuncPtr(glIsQuery, "glIsQuery", "glIsQueryARB", "glIsQueryEXT", validContext);
|
||||
setGLExtensionFuncPtr(glBeginQuery, "glBeginQuery", "glBeginQueryARB", "glBeginQueryEXT", validContext);
|
||||
setGLExtensionFuncPtr(glEndQuery, "glEndQuery", "glEndQueryARB", "glEndQueryEXT", validContext);
|
||||
setGLExtensionFuncPtr(glBeginQueryIndexed, "glBeginQueryIndexed", "glBeginQueryIndexedARB", validContext);
|
||||
setGLExtensionFuncPtr(glEndQueryIndexed, "glEndQueryIndexed", "glEndQueryIndexedARB", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryiv, "glGetQueryiv", "glGetQueryivARB", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryObjectiv, "glGetQueryObjectiv","glGetQueryObjectivARB", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryObjectuiv, "glGetQueryObjectuiv","glGetQueryObjectuivARB", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryObjectui64v, "glGetQueryObjectui64v","glGetQueryObjectui64vEXT", validContext);
|
||||
setGLExtensionFuncPtr(glQueryCounter, "glQueryCounter", validContext);
|
||||
setGLExtensionFuncPtr(glGetInteger64v, "glGetInteger64v", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryiv, "glGetQueryiv", "glGetQueryivARB", "glGetQueryivEXT", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryObjectiv, "glGetQueryObjectiv","glGetQueryObjectivARB", "glGetQueryObjectivEXT", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryObjectuiv, "glGetQueryObjectuiv","glGetQueryObjectuivARB", "glGetQueryObjectuivEXT", validContext);
|
||||
setGLExtensionFuncPtr(glGetQueryObjectui64v, "glGetQueryObjectui64v","glGetQueryObjectui64vEXT", "glGetQueryObjectui64vEXT", validContext);
|
||||
setGLExtensionFuncPtr(glQueryCounter, "glQueryCounter", "glQueryCounterEXT", validContext);
|
||||
setGLExtensionFuncPtr(glGetInteger64v, "glGetInteger64v", "glGetInteger64vEXT", validContext);
|
||||
|
||||
|
||||
// SampleMaski functionality
|
||||
@@ -850,13 +850,26 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
isTextureFilterAnisotropicSupported = validContext && isGLExtensionSupported(contextID,"GL_EXT_texture_filter_anisotropic");
|
||||
isTextureSwizzleSupported = validContext && isGLExtensionSupported(contextID,"GL_ARB_texture_swizzle");
|
||||
isTextureCompressionARBSupported = validContext && (builtInSupport || isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_compression", 1.3f));
|
||||
isTextureCompressionS3TCSupported = validContext && (isGLExtensionSupported(contextID,"GL_EXT_texture_compression_s3tc") || isGLExtensionSupported(contextID, "GL_S3_s3tc"));
|
||||
isTextureCompressionPVRTC2BPPSupported = validContext && isGLExtensionSupported(contextID,"GL_IMG_texture_compression_pvrtc");
|
||||
isTextureCompressionS3TCSupported = validContext && (isGLExtensionSupported(contextID,"GL_EXT_texture_compression_s3tc") ||
|
||||
isGLExtensionSupported(contextID, "GL_S3_s3tc") ||
|
||||
isGLExtensionSupported(contextID, "WEBGL_compressed_texture_s3tc") ||
|
||||
isGLExtensionSupported(contextID, "MOZ_WEBGL_compressed_texture_s3tc") ||
|
||||
isGLExtensionSupported(contextID, "WEBKIT_WEBGL_compressed_texture_s3tc") ||
|
||||
isGLExtensionSupported(contextID, "WEBGL_compressed_texture_s3tc_srgb") /* TODO: separate flag */);
|
||||
isTextureCompressionPVRTC2BPPSupported = validContext && (isGLExtensionSupported(contextID,"GL_IMG_texture_compression_pvrtc") ||
|
||||
isGLExtensionSupported(contextID, "WEBGL_compressed_texture_pvrtc"));
|
||||
isTextureCompressionPVRTC4BPPSupported = isTextureCompressionPVRTC2BPPSupported;//covered by same extension
|
||||
isTextureCompressionETCSupported = validContext && isGLExtensionSupported(contextID,"GL_OES_compressed_ETC1_RGB8_texture");
|
||||
isTextureCompressionETC2Supported = validContext && isGLExtensionSupported(contextID,"GL_ARB_ES3_compatibility");
|
||||
isTextureCompressionETCSupported = validContext && (isGLExtensionSupported(contextID, "GL_OES_compressed_ETC1_RGB8_texture") ||
|
||||
isGLExtensionSupported(contextID, "WEBGL_compressed_texture_etc1"));
|
||||
isTextureCompressionETC2Supported = validContext && (isGLExtensionSupported(contextID,"GL_ARB_ES3_compatibility") ||
|
||||
isGLExtensionSupported(contextID, "WEBGL_compressed_texture_etc"));
|
||||
isTextureCompressionRGTCSupported = validContext && isGLExtensionSupported(contextID,"GL_EXT_texture_compression_rgtc");
|
||||
isTextureCompressionPVRTCSupported = validContext && isGLExtensionSupported(contextID,"GL_IMG_texture_compression_pvrtc");
|
||||
isTextureCompressionPVRTCSupported = isTextureCompressionPVRTC2BPPSupported;//covered by same extension
|
||||
|
||||
isTextureCompressionASTCSupported = validContext && (isGLExtensionSupported(contextID, "GL_KHR_texture_compression_astc_hdr") ||
|
||||
isGLExtensionSupported(contextID, "GL_KHR_texture_compression_astc_ldr") ||
|
||||
isGLExtensionSupported(contextID, "GL_OES_texture_compression_astc") ||
|
||||
isGLExtensionSupported(contextID, "WEBGL_compressed_texture_astc"));
|
||||
|
||||
isTextureMirroredRepeatSupported = validContext &&
|
||||
(builtInSupport ||
|
||||
@@ -898,18 +911,22 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
{
|
||||
maxTextureSize = osg_max_size;
|
||||
}
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
isTextureMaxLevelSupported = (glVersion >= 3.0f); // WebGL 2.0 (OpenGL ES 3.0)
|
||||
isTextureLODBiasSupported = (glVersion >= 3.0f) || isGLExtensionSupported(contextID, "GL_EXT_texture_lod_bias");
|
||||
#else
|
||||
isTextureMaxLevelSupported = (glVersion >= 1.2f);
|
||||
isTextureLODBiasSupported = (glVersion >= 1.2f) || isGLExtensionSupported(contextID, "GL_EXT_texture_lod_bias");
|
||||
#endif
|
||||
|
||||
isTextureStorageEnabled = validContext && ((glVersion >= 4.2f) || isGLExtensionSupported(contextID, "GL_ARB_texture_storage"));
|
||||
|
||||
if (isTextureStorageEnabled)
|
||||
{
|
||||
std::string value;
|
||||
if (getEnvVar("OSG_GL_TEXTURE_STORAGE", value))
|
||||
{
|
||||
if (value=="OFF" || value=="DISABLE") isTextureStorageEnabled = false;
|
||||
else isTextureStorageEnabled = true;
|
||||
}
|
||||
if (getEnvVar("OSG_GL_TEXTURE_STORAGE", value) && (value == "OFF" || value == "DISABLE"))
|
||||
isTextureStorageEnabled = false;
|
||||
}
|
||||
|
||||
setGLExtensionFuncPtr(glTexStorage1D,"glTexStorage1D","glTexStorage1DARB", validContext);
|
||||
@@ -918,8 +935,8 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
setGLExtensionFuncPtr(glTextureStorage2D,"glTextureStorage2D","glTextureStorage2DARB", validContext);
|
||||
setGLExtensionFuncPtr(glTexStorage3D, "glTexStorage3D","glTexStorage3DEXT", validContext);
|
||||
setGLExtensionFuncPtr(glTextureStorage3D, "glTextureStorage3D","glTextureStorage3DEXT", validContext);
|
||||
setGLExtensionFuncPtr(glTexStorage2DMultisample, "glTextureStorage2DMultisample","glTextureStorage2DMultisampleEXT", validContext);
|
||||
setGLExtensionFuncPtr(glTexStorage3DMultisample, "glTextureStorage3DMultisample","glTextureStorage3DMultisampleEXT", validContext);
|
||||
setGLExtensionFuncPtr(glTexStorage2DMultisample, "glTexStorage2DMultisample", validContext);
|
||||
setGLExtensionFuncPtr(glTexStorage3DMultisample, "glTexStorage3DMultisample", validContext);
|
||||
setGLExtensionFuncPtr(glTextureView, "glTextureView","glTextureViewEXT", validContext);
|
||||
|
||||
setGLExtensionFuncPtr(glCompressedTexImage2D,"glCompressedTexImage2D","glCompressedTexImage2DARB", validContext);
|
||||
@@ -1085,7 +1102,10 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
|
||||
setGLExtensionFuncPtr(glGenRenderbuffers, "glGenRenderbuffers", "glGenRenderbuffersEXT", "glGenRenderbuffersOES", validContext);
|
||||
setGLExtensionFuncPtr(glRenderbufferStorage, "glRenderbufferStorage", "glRenderbufferStorageEXT", "glRenderbufferStorageOES", validContext);
|
||||
setGLExtensionFuncPtr(glRenderbufferStorageMultisample, "glRenderbufferStorageMultisample", "glRenderbufferStorageMultisampleEXT", "glRenderbufferStorageMultisampleOES", validContext);
|
||||
setGLExtensionFuncPtr(glRenderbufferStorageMultisampleCoverageNV, "glRenderbufferStorageMultisampleCoverageNV", validContext);
|
||||
if (isGLExtensionSupported(contextID, "GL_NV_framebuffer_multisample_coverage"))
|
||||
setGLExtensionFuncPtr(glRenderbufferStorageMultisampleCoverageNV, "glRenderbufferStorageMultisampleCoverageNV", validContext);
|
||||
else
|
||||
glRenderbufferStorageMultisampleCoverageNV = NULL;
|
||||
setGLExtensionFuncPtr(glBindFramebuffer, "glBindFramebuffer", "glBindFramebufferEXT", "glBindFramebufferOES", validContext);
|
||||
setGLExtensionFuncPtr(glDeleteFramebuffers, "glDeleteFramebuffers", "glDeleteFramebuffersEXT", "glDeleteFramebuffersOES", validContext);
|
||||
setGLExtensionFuncPtr(glGenFramebuffers, "glGenFramebuffers", "glGenFramebuffersEXT", "glGenFramebuffersOES", validContext);
|
||||
|
||||
@@ -169,7 +169,7 @@ bool Group::removeChildren(unsigned int pos,unsigned int numChildrenToRemove)
|
||||
if (endOfRemoveRange>_children.size())
|
||||
{
|
||||
OSG_DEBUG<<"Warning: Group::removeChild(i,numChildrenToRemove) has been passed an excessive number"<<std::endl;
|
||||
OSG_DEBUG<<" of chilren to remove, trimming just to end of child list."<<std::endl;
|
||||
OSG_DEBUG<<" of children to remove, trimming just to end of child list."<<std::endl;
|
||||
endOfRemoveRange=_children.size();
|
||||
}
|
||||
|
||||
|
||||
@@ -537,9 +537,12 @@ unsigned int Image::computeNumComponents(GLenum pixelFormat)
|
||||
switch(pixelFormat)
|
||||
{
|
||||
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): return 3;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): return 4;
|
||||
case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): return 3;
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): return 4;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): return 4;
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): return 4;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): return 4;
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT): return 4;
|
||||
case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): return 1;
|
||||
case(GL_COMPRESSED_RED_RGTC1_EXT): return 1;
|
||||
case(GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT): return 2;
|
||||
@@ -719,9 +722,13 @@ unsigned int Image::computePixelSizeInBits(GLenum format,GLenum type)
|
||||
switch(format)
|
||||
{
|
||||
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): return 4;
|
||||
case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT): return 4;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): return 4;
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT): return 4;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): return 8;
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT): return 8;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): return 8;
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT): return 8;
|
||||
case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): return 4;
|
||||
case(GL_COMPRESSED_RED_RGTC1_EXT): return 4;
|
||||
case(GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT): return 8;
|
||||
@@ -749,7 +756,7 @@ unsigned int Image::computePixelSizeInBits(GLenum format,GLenum type)
|
||||
// which raises the question of how to actually query for these sizes...
|
||||
// will need to revisit this issue, for now just report an error.
|
||||
// this is possible a bit of mute point though as since the ARB compressed formats
|
||||
// aren't yet used for storing images to disk, so its likely that users wont have
|
||||
// aren't yet used for storing images to disk, so its likely that users won't have
|
||||
// osg::Image's for pixel formats set the ARB compressed formats, just using these
|
||||
// compressed formats as internal texture modes. This is very much speculation though
|
||||
// if get the below error then its time to revist this issue :-)
|
||||
@@ -942,10 +949,14 @@ unsigned int Image::computeBlockSize(GLenum pixelFormat, GLenum packing)
|
||||
switch(pixelFormat)
|
||||
{
|
||||
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
|
||||
return osg::maximum(8u,packing); // block size of 8
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT):
|
||||
return osg::maximum(8u, packing); // block size of 8
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT):
|
||||
case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG):
|
||||
case(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG):
|
||||
case(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG):
|
||||
@@ -1095,9 +1106,13 @@ bool Image::isCompressed() const
|
||||
case(GL_COMPRESSED_RGBA_ARB):
|
||||
case(GL_COMPRESSED_RGB_ARB):
|
||||
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT):
|
||||
case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT):
|
||||
case(GL_COMPRESSED_RED_RGTC1_EXT):
|
||||
case(GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT):
|
||||
@@ -2013,10 +2028,14 @@ bool Image::isImageTranslucent() const
|
||||
case(GL_BGR):
|
||||
return false;
|
||||
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT):
|
||||
return false;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT):
|
||||
return dxtc_tool::isCompressedImageTranslucent(_s, _t, _pixelFormat, _data);
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -241,7 +241,7 @@ void osg::StandardNotifyHandler::notify(osg::NotifySeverity severity, const char
|
||||
fputs(message, stdout);
|
||||
}
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
@@ -98,7 +98,7 @@ void PagedLOD::setDatabasePath(const std::string& path)
|
||||
|
||||
/*
|
||||
// make sure the last character is the appropriate slash
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
if (lastCharacter==unixSlash)
|
||||
{
|
||||
lastCharacter = winSlash;
|
||||
|
||||
@@ -78,7 +78,7 @@ void DrawElementsIndirectUInt::draw(State& state, bool /*useVertexBufferObjects*
|
||||
|
||||
state.get<GLExtensions>()-> glDrawElementsIndirect(mode, GL_UNSIGNED_INT,
|
||||
(const GLvoid *)(dibo->getOffset(_indirectCommandArray->getBufferIndex()) //command array address
|
||||
+_firstCommand* _indirectCommandArray->getElementSize())// runtime offset computaion can be sizeof(*_indirectCommandArray->begin())
|
||||
+_firstCommand* _indirectCommandArray->getElementSize())// runtime offset computation can be sizeof(*_indirectCommandArray->begin())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -780,7 +780,7 @@ void Shader::_parseShaderDefines(const std::string& str, ShaderDefines& defines)
|
||||
std::string::size_type start_of_parameter = 0;
|
||||
do
|
||||
{
|
||||
// skip spaces, tabs, commans
|
||||
// skip spaces, tabs, commands
|
||||
start_of_parameter = find_first(str, NoneOf(" \t,"), start_of_parameter);
|
||||
if (start_of_parameter==std::string::npos) break;
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ osg::Program* ShaderComposer::getOrCreateProgram(const ShaderComponents& shaderC
|
||||
computeShaders.push_back(shader);
|
||||
break;
|
||||
case(Shader::UNDEFINED):
|
||||
OSG_WARN<<"Warning: ShaderCompose::getOrCreateProgam(ShaderComponts) encounterd invalid Shader::Type."<<std::endl;
|
||||
OSG_WARN<<"Warning: ShaderCompose::getOrCreateProgam(ShaderComponts) encountered invalid Shader::Type."<<std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ State::State():
|
||||
_shaderComposer = new ShaderComposer;
|
||||
_currentShaderCompositionProgram = 0L;
|
||||
|
||||
_drawBuffer = GL_INVALID_ENUM; // avoid the lazy state mechanism from ignoreing the first call to State::glDrawBuffer() to make sure it's always passed to OpenGL
|
||||
_readBuffer = GL_INVALID_ENUM; // avoid the lazy state mechanism from ignoreing the first call to State::glReadBuffer() to make sure it's always passed to OpenGL
|
||||
_drawBuffer = GL_INVALID_ENUM; // avoid the lazy state mechanism from ignoring the first call to State::glDrawBuffer() to make sure it's always passed to OpenGL
|
||||
_readBuffer = GL_INVALID_ENUM; // avoid the lazy state mechanism from ignoring the first call to State::glReadBuffer() to make sure it's always passed to OpenGL
|
||||
|
||||
_identity = new osg::RefMatrix(); // default RefMatrix constructs to identity.
|
||||
_initialViewMatrix = _identity;
|
||||
@@ -713,19 +713,19 @@ void State::apply(const StateSet* dstate)
|
||||
|
||||
applyAttributeList(_attributeMap,dstate->getAttributeList());
|
||||
|
||||
if ((_lastAppliedProgramObject!=0) && (previousLastAppliedProgramObject==_lastAppliedProgramObject) && _defineMap.changed)
|
||||
// Checking if there is no program on the stack or the program is not applied from the AttributeStack (StateSet core mechanism)
|
||||
if (_shaderCompositionEnabled && (_lastAppliedProgramObject == 0 ||
|
||||
(_lastAppliedProgramObject->getProgram() != getLastAppliedAttribute(osg::StateAttribute::PROGRAM))))
|
||||
{
|
||||
// OSG_NOTICE<<"State::apply(StateSet*) Program already applied ("<<(previousLastAppliedProgramObject==_lastAppliedProgramObject)<<") and _defineMap.changed= "<<_defineMap.changed<<std::endl;
|
||||
_lastAppliedProgramObject->getProgram()->apply(*this);
|
||||
// No program has been applied by the StateSet stack so assume shader composition is required
|
||||
applyShaderComposition();
|
||||
}
|
||||
|
||||
if (_shaderCompositionEnabled)
|
||||
if (_lastAppliedProgramObject != 0 && previousLastAppliedProgramObject == _lastAppliedProgramObject && _defineMap.changed)
|
||||
{
|
||||
if (previousLastAppliedProgramObject == _lastAppliedProgramObject || _lastAppliedProgramObject==0)
|
||||
{
|
||||
// No program has been applied by the StateSet stack so assume shader composition is required
|
||||
applyShaderComposition();
|
||||
}
|
||||
// Pragma(tic) mechanism must be applied after ShaderComposer
|
||||
// OSG_NOTICE<<"State::apply(StateSet*) Program already applied ("<<(previousLastAppliedProgramObject==_lastAppliedProgramObject)<<") and _defineMap.changed= "<<_defineMap.changed<<std::endl;
|
||||
_lastAppliedProgramObject->getProgram()->apply(*this);
|
||||
}
|
||||
|
||||
if (dstate->getUniformList().empty())
|
||||
@@ -784,17 +784,19 @@ void State::apply()
|
||||
// go through all active StateAttribute's, applying where appropriate.
|
||||
applyAttributeMap(_attributeMap);
|
||||
|
||||
|
||||
if ((_lastAppliedProgramObject!=0) && (previousLastAppliedProgramObject==_lastAppliedProgramObject) && _defineMap.changed)
|
||||
// Checking if there is no program on the stack or the program is not applied from the AttributeStack (StateSet core mechanism)
|
||||
if (_shaderCompositionEnabled && (_lastAppliedProgramObject == 0 ||
|
||||
(_lastAppliedProgramObject->getProgram() != getLastAppliedAttribute(osg::StateAttribute::PROGRAM))))
|
||||
{
|
||||
//OSG_NOTICE<<"State::apply() Program already applied ("<<(previousLastAppliedProgramObject==_lastAppliedProgramObject)<<") and _defineMap.changed= "<<_defineMap.changed<<std::endl;
|
||||
if (_lastAppliedProgramObject) _lastAppliedProgramObject->getProgram()->apply(*this);
|
||||
// No program has been applied by the StateSet stack so assume shader composition is required
|
||||
applyShaderComposition();
|
||||
}
|
||||
|
||||
|
||||
if (_shaderCompositionEnabled)
|
||||
if ((_lastAppliedProgramObject != 0) && (previousLastAppliedProgramObject == _lastAppliedProgramObject) && _defineMap.changed)
|
||||
{
|
||||
applyShaderComposition();
|
||||
// Pragma(tic) mechanism must be applied after ShaderComposer
|
||||
//OSG_NOTICE<<"State::apply() Program already applied ("<<(previousLastAppliedProgramObject==_lastAppliedProgramObject)<<") and _defineMap.changed= "<<_defineMap.changed<<std::endl;
|
||||
_lastAppliedProgramObject->getProgram()->apply(*this);
|
||||
}
|
||||
|
||||
if (_currentShaderCompositionUniformList.empty()) applyUniformMap(_uniformMap);
|
||||
@@ -811,7 +813,7 @@ void State::applyShaderComposition()
|
||||
{
|
||||
// if (isNotifyEnabled(osg::INFO)) print(notify(osg::INFO));
|
||||
|
||||
// build lits of current ShaderComponents
|
||||
// build list of current ShaderComponents
|
||||
ShaderComponents shaderComponents;
|
||||
|
||||
// OSG_NOTICE<<"State::applyShaderComposition() : _attributeMap.size()=="<<_attributeMap.size()<<std::endl;
|
||||
@@ -835,7 +837,8 @@ void State::applyShaderComposition()
|
||||
if (_currentShaderCompositionProgram)
|
||||
{
|
||||
Program::PerContextProgram* pcp = _currentShaderCompositionProgram->getPCP(*this);
|
||||
if (_lastAppliedProgramObject != pcp) applyAttribute(_currentShaderCompositionProgram);
|
||||
if (_lastAppliedProgramObject != pcp)
|
||||
_currentShaderCompositionProgram->apply(*this); // NOTE: AttributeStack should not be changed by ShaderComposer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,30 +176,60 @@ InternalPixelRelations sizedDepthAndStencilInternalFormats[] = {
|
||||
};
|
||||
|
||||
InternalPixelRelations compressedInternalFormats[] = {
|
||||
// , { GL_COMPRESSED_RED , GL_RED , GL_COMPRESSED_RED }
|
||||
// , { GL_COMPRESSED_RG , GL_RG , GL_COMPRESSED_RG }
|
||||
{ GL_COMPRESSED_RGB , GL_RGB , GL_COMPRESSED_RGB }
|
||||
, { GL_COMPRESSED_RGBA , GL_RGBA , GL_COMPRESSED_RGBA }
|
||||
, { GL_COMPRESSED_SRGB , GL_RGB , GL_COMPRESSED_SRGB }
|
||||
, { GL_COMPRESSED_SRGB_ALPHA , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA }
|
||||
, { GL_COMPRESSED_RED_RGTC1_EXT , GL_RED , GL_COMPRESSED_RED_RGTC1_EXT }
|
||||
, { GL_COMPRESSED_SIGNED_RED_RGTC1_EXT , GL_RED , GL_COMPRESSED_SIGNED_RED_RGTC1_EXT }
|
||||
// , { GL_COMPRESSED_RG_RGTC2 , GL_RG , GL_COMPRESSED_RG_RGTC2 }
|
||||
// , { GL_COMPRESSED_SIGNED_RG_RGTC2 , GL_RG , GL_COMPRESSED_SIGNED_RG_RGTC2 }
|
||||
// , { GL_COMPRESSED_RGBA_BPTC_UNORM , GL_RGBA , GL_COMPRESSED_RGBA_BPTC_UNORM }
|
||||
// , { GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM }
|
||||
// , { GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT , GL_RGB , GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT }
|
||||
// , { GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT , GL_RGB , GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT }
|
||||
// , { GL_COMPRESSED_RED , GL_RED , GL_COMPRESSED_RED }
|
||||
// , { GL_COMPRESSED_RG , GL_RG , GL_COMPRESSED_RG }
|
||||
{ GL_COMPRESSED_RGB , GL_RGB , GL_COMPRESSED_RGB }
|
||||
, { GL_COMPRESSED_RGBA , GL_RGBA , GL_COMPRESSED_RGBA }
|
||||
, { GL_COMPRESSED_SRGB , GL_RGB , GL_COMPRESSED_SRGB }
|
||||
, { GL_COMPRESSED_SRGB_ALPHA , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA }
|
||||
, { GL_COMPRESSED_RED_RGTC1_EXT , GL_RED , GL_COMPRESSED_RED_RGTC1_EXT }
|
||||
, { GL_COMPRESSED_SIGNED_RED_RGTC1_EXT , GL_RED , GL_COMPRESSED_SIGNED_RED_RGTC1_EXT }
|
||||
// , { GL_COMPRESSED_RG_RGTC2 , GL_RG , GL_COMPRESSED_RG_RGTC2 }
|
||||
// , { GL_COMPRESSED_SIGNED_RG_RGTC2 , GL_RG , GL_COMPRESSED_SIGNED_RG_RGTC2 }
|
||||
// , { GL_COMPRESSED_RGBA_BPTC_UNORM , GL_RGBA , GL_COMPRESSED_RGBA_BPTC_UNORM }
|
||||
// , { GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM }
|
||||
// , { GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT , GL_RGB , GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT }
|
||||
// , { GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT , GL_RGB , GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT }
|
||||
|
||||
, { GL_COMPRESSED_RGB_S3TC_DXT1_EXT , GL_RGB , GL_COMPRESSED_RGB_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_RGBA_S3TC_DXT1_EXT , GL_RGBA , GL_COMPRESSED_RGBA_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_RGBA_S3TC_DXT3_EXT , GL_RGBA , GL_COMPRESSED_RGBA_S3TC_DXT3_EXT }
|
||||
, { GL_COMPRESSED_RGBA_S3TC_DXT5_EXT , GL_RGBA , GL_COMPRESSED_RGBA_S3TC_DXT5_EXT }
|
||||
, { GL_COMPRESSED_RGB_S3TC_DXT1_EXT , GL_RGB , GL_COMPRESSED_RGB_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_RGBA_S3TC_DXT1_EXT , GL_RGBA , GL_COMPRESSED_RGBA_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_RGBA_S3TC_DXT3_EXT , GL_RGBA , GL_COMPRESSED_RGBA_S3TC_DXT3_EXT }
|
||||
, { GL_COMPRESSED_RGBA_S3TC_DXT5_EXT , GL_RGBA , GL_COMPRESSED_RGBA_S3TC_DXT5_EXT }
|
||||
|
||||
// , { GL_COMPRESSED_SRGB_S3TC_DXT1_EXT , GL_RGB , GL_COMPRESSED_SRGB_S3TC_DXT1_EXT }
|
||||
// , { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT }
|
||||
// , { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT }
|
||||
// , { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT }
|
||||
, { GL_COMPRESSED_SRGB_S3TC_DXT1_EXT , GL_RGB , GL_COMPRESSED_SRGB_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT }
|
||||
, { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT }
|
||||
, { GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT , GL_RGBA , GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT }
|
||||
|
||||
, { GL_COMPRESSED_RGBA_ASTC_4x4_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_4x4_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_5x4_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_5x4_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_5x5_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_5x5_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_6x5_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_6x5_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_6x6_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_6x6_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_8x5_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_8x5_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_8x6_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_8x6_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_8x8_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_8x8_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_10x5_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_10x5_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_10x6_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_10x6_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_10x8_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_10x8_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_10x10_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_10x10_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_12x10_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_12x10_KHR }
|
||||
, { GL_COMPRESSED_RGBA_ASTC_12x12_KHR , GL_RGBA , GL_COMPRESSED_RGBA_ASTC_12x12_KHR }
|
||||
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR }
|
||||
, { GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR , GL_RGBA , GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR }
|
||||
};
|
||||
|
||||
bool isSizedInternalFormat(GLint internalFormat)
|
||||
@@ -289,53 +319,109 @@ void Texture::TextureProfile::computeSize()
|
||||
|
||||
switch(_internalFormat)
|
||||
{
|
||||
case(1): numBitsPerTexel = 8; break;
|
||||
case(GL_ALPHA): numBitsPerTexel = 8; break;
|
||||
case(GL_LUMINANCE): numBitsPerTexel = 8; break;
|
||||
case(GL_INTENSITY): numBitsPerTexel = 8; break;
|
||||
case 1:
|
||||
case GL_ALPHA:
|
||||
case GL_LUMINANCE:
|
||||
case GL_INTENSITY:
|
||||
case GL_RED:
|
||||
numBitsPerTexel = 8;
|
||||
break;
|
||||
|
||||
case(GL_LUMINANCE_ALPHA): numBitsPerTexel = 16; break;
|
||||
case(2): numBitsPerTexel = 16; break;
|
||||
case 2:
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
case GL_RG:
|
||||
numBitsPerTexel = 16;
|
||||
break;
|
||||
|
||||
case(GL_RGB): numBitsPerTexel = 24; break;
|
||||
case(GL_BGR): numBitsPerTexel = 24; break;
|
||||
case(3): numBitsPerTexel = 24; break;
|
||||
case 3:
|
||||
case GL_RGB:
|
||||
case GL_BGR:
|
||||
numBitsPerTexel = 24;
|
||||
break;
|
||||
|
||||
case(GL_RGBA): numBitsPerTexel = 32; break;
|
||||
case(4): numBitsPerTexel = 32; break;
|
||||
case 4:
|
||||
case GL_RGBA:
|
||||
case GL_BGRA:
|
||||
numBitsPerTexel = 32;
|
||||
break;
|
||||
|
||||
case(GL_COMPRESSED_ALPHA_ARB): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_INTENSITY_ARB): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_LUMINANCE_ALPHA_ARB): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_ALPHA_ARB: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_INTENSITY_ARB: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: numBitsPerTexel = 4; break;
|
||||
|
||||
case(GL_COMPRESSED_RGB_ARB): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_RGB_ARB: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: numBitsPerTexel = 8; break;
|
||||
|
||||
case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_RED_RGTC1_EXT): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_RED_GREEN_RGTC2_EXT): numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RED_RGTC1_EXT: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_RED_GREEN_RGTC2_EXT: numBitsPerTexel = 8; break;
|
||||
|
||||
case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG): numBitsPerTexel = 2; break;
|
||||
case(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG): numBitsPerTexel = 2; break;
|
||||
case(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG): numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: numBitsPerTexel = 2; break;
|
||||
case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: numBitsPerTexel = 2; break;
|
||||
case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: numBitsPerTexel = 4; break;
|
||||
|
||||
case(GL_ETC1_RGB8_OES): numBitsPerTexel = 4; break;
|
||||
case GL_ETC1_RGB8_OES: numBitsPerTexel = 4; break;
|
||||
|
||||
case(GL_COMPRESSED_RGB8_ETC2): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_SRGB8_ETC2): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_RGBA8_ETC2_EAC): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_R11_EAC): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_SIGNED_R11_EAC): numBitsPerTexel = 4; break;
|
||||
case(GL_COMPRESSED_RG11_EAC): numBitsPerTexel = 8; break;
|
||||
case(GL_COMPRESSED_SIGNED_RG11_EAC): numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_RGB8_ETC2: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_SRGB8_ETC2: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_RGBA8_ETC2_EAC: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_R11_EAC: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_SIGNED_R11_EAC: numBitsPerTexel = 4; break;
|
||||
case GL_COMPRESSED_RG11_EAC: numBitsPerTexel = 8; break;
|
||||
case GL_COMPRESSED_SIGNED_RG11_EAC: numBitsPerTexel = 8; break;
|
||||
|
||||
// ASTC
|
||||
case GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
|
||||
case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
|
||||
{
|
||||
_size = 0;
|
||||
for (int i = 0; i < std::max(_numMipmapLevels, 1); ++i)
|
||||
{
|
||||
GLint blockSize;
|
||||
GLint size;
|
||||
getCompressedSize(_internalFormat, _width/(1 << i), _height/(1 << i), _depth, blockSize, size);
|
||||
_size += size;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_size = (unsigned int)(ceil(double(_width * _height * _depth * numBitsPerTexel)/8.0));
|
||||
@@ -921,7 +1007,7 @@ void TextureObjectSet::remove(Texture::TextureObject* to)
|
||||
}
|
||||
else
|
||||
{
|
||||
// 'to' was tail so assing tail to the previous in list
|
||||
// 'to' was tail so assign tail to the previous in list
|
||||
_tail = to->_previous;
|
||||
}
|
||||
|
||||
@@ -1782,37 +1868,67 @@ bool Texture::isCompressedInternalFormat() const
|
||||
|
||||
bool Texture::isCompressedInternalFormat(GLint internalFormat)
|
||||
{
|
||||
switch(internalFormat)
|
||||
switch (internalFormat)
|
||||
{
|
||||
case(GL_COMPRESSED_ALPHA_ARB):
|
||||
case(GL_COMPRESSED_INTENSITY_ARB):
|
||||
case(GL_COMPRESSED_LUMINANCE_ALPHA_ARB):
|
||||
case(GL_COMPRESSED_LUMINANCE_ARB):
|
||||
case(GL_COMPRESSED_RGBA_ARB):
|
||||
case(GL_COMPRESSED_RGB_ARB):
|
||||
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
|
||||
case(GL_COMPRESSED_SIGNED_RED_RGTC1_EXT):
|
||||
case(GL_COMPRESSED_RED_RGTC1_EXT):
|
||||
case(GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT):
|
||||
case(GL_COMPRESSED_RED_GREEN_RGTC2_EXT):
|
||||
case(GL_ETC1_RGB8_OES):
|
||||
case(GL_COMPRESSED_RGB8_ETC2):
|
||||
case(GL_COMPRESSED_SRGB8_ETC2):
|
||||
case(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2):
|
||||
case(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2):
|
||||
case(GL_COMPRESSED_RGBA8_ETC2_EAC):
|
||||
case(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC):
|
||||
case(GL_COMPRESSED_R11_EAC):
|
||||
case(GL_COMPRESSED_SIGNED_R11_EAC):
|
||||
case(GL_COMPRESSED_RG11_EAC):
|
||||
case(GL_COMPRESSED_SIGNED_RG11_EAC):
|
||||
case(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG):
|
||||
case(GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG):
|
||||
case(GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG):
|
||||
case(GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG):
|
||||
case (GL_COMPRESSED_ALPHA_ARB):
|
||||
case (GL_COMPRESSED_INTENSITY_ARB):
|
||||
case (GL_COMPRESSED_LUMINANCE_ALPHA_ARB):
|
||||
case (GL_COMPRESSED_LUMINANCE_ARB):
|
||||
case (GL_COMPRESSED_RGBA_ARB):
|
||||
case (GL_COMPRESSED_RGB_ARB):
|
||||
case (GL_COMPRESSED_RGB_S3TC_DXT1_EXT):
|
||||
case (GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
|
||||
case (GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
|
||||
case (GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT):
|
||||
case (GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
|
||||
case (GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT):
|
||||
case (GL_COMPRESSED_SIGNED_RED_RGTC1_EXT):
|
||||
case (GL_COMPRESSED_RED_RGTC1_EXT):
|
||||
case (GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT):
|
||||
case (GL_COMPRESSED_RED_GREEN_RGTC2_EXT):
|
||||
case (GL_ETC1_RGB8_OES):
|
||||
case (GL_COMPRESSED_RGB8_ETC2):
|
||||
case (GL_COMPRESSED_SRGB8_ETC2):
|
||||
case (GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2):
|
||||
case (GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2):
|
||||
case (GL_COMPRESSED_RGBA8_ETC2_EAC):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC):
|
||||
case (GL_COMPRESSED_R11_EAC):
|
||||
case (GL_COMPRESSED_SIGNED_R11_EAC):
|
||||
case (GL_COMPRESSED_RG11_EAC):
|
||||
case (GL_COMPRESSED_SIGNED_RG11_EAC):
|
||||
case (GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG):
|
||||
case (GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG):
|
||||
case (GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG):
|
||||
case (GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_4x4_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_5x4_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_5x5_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_6x5_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_6x6_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_8x5_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_8x6_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_8x8_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_10x5_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_10x6_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_10x8_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_10x10_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_12x10_KHR):
|
||||
case (GL_COMPRESSED_RGBA_ASTC_12x12_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR):
|
||||
case (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -1856,7 +1972,7 @@ void Texture::getCompressedSize(GLenum internalFormat, GLint width, GLint height
|
||||
|
||||
size = widthBlocks * heightBlocks * ((blockSize * bpp) / 8);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG || internalFormat == GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG)
|
||||
{
|
||||
blockSize = 4 * 4; // Pixel by pixel block size for 4bpp
|
||||
@@ -1873,6 +1989,91 @@ void Texture::getCompressedSize(GLenum internalFormat, GLint width, GLint height
|
||||
size = widthBlocks * heightBlocks * ((blockSize * bpp) / 8);
|
||||
return;
|
||||
}
|
||||
// ASTC compression (block size is always equal to 16)
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_4x4_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/4.0)*ceil(height/4.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_5x4_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/5.0)*ceil(height/4.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_5x5_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/5.0)*ceil(height/5.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_6x5_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/6.0)*ceil(height/5.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_6x6_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/6.0)*ceil(height/6.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_8x5_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/8.0)*ceil(height/5.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_8x6_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/8.0)*ceil(height/6.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_8x8_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/8.0)*ceil(height/8.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_10x5_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/10.0)*ceil(height/5.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_10x6_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/10.0)*ceil(height/6.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_10x8_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/10.0)*ceil(height/8.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_10x10_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/10.0)*ceil(height/10.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_12x10_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/12.0)*ceil(height/10.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else if (internalFormat == GL_COMPRESSED_RGBA_ASTC_12x12_KHR || internalFormat == GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR)
|
||||
{
|
||||
blockSize = 16;
|
||||
size = ceil(width/12.0)*ceil(height/12.0)*blockSize;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
OSG_WARN<<"Texture::getCompressedSize(...) : cannot compute correct size of compressed format ("<<internalFormat<<") returning 0."<<std::endl;
|
||||
@@ -2026,7 +2227,8 @@ void Texture::applyTexParameters(GLenum target, State& state) const
|
||||
glTexParameterf(target, GL_TEXTURE_MAX_LOD, _maxlod);
|
||||
}
|
||||
|
||||
glTexParameterf(target, GL_TEXTURE_LOD_BIAS, _lodbias);
|
||||
if (extensions->isTextureLODBiasSupported)
|
||||
glTexParameterf(target, GL_TEXTURE_LOD_BIAS, _lodbias);
|
||||
|
||||
getTextureParameterDirty(state.getContextID()) = false;
|
||||
|
||||
@@ -2151,6 +2353,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
|
||||
switch(_internalFormat)
|
||||
{
|
||||
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG:
|
||||
case GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
|
||||
case GL_ETC1_RGB8_OES:
|
||||
@@ -2158,8 +2361,11 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
|
||||
case(GL_COMPRESSED_SRGB8_ETC2):
|
||||
case GL_COMPRESSED_RGB: _internalFormat = GL_RGB; break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
|
||||
case GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:
|
||||
case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
|
||||
case(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2):
|
||||
|
||||
@@ -194,7 +194,7 @@ void Texture1D::apply(State& state) const
|
||||
|
||||
textureObject->setAllocated(_numMipmapLevels,_internalFormat,_textureWidth,1,1,0);
|
||||
|
||||
// in theory the following line is redundent, but in practice
|
||||
// in theory the following line is redundant, but in practice
|
||||
// have found that the first frame drawn doesn't apply the textures
|
||||
// unless a second bind is called?!!
|
||||
// perhaps it is the first glBind which is not required...
|
||||
@@ -238,13 +238,15 @@ void Texture1D::apply(State& state) const
|
||||
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_1D, _numMipmapLevels, texStorageSizedInternalFormat, _textureWidth, 1, 1, 0);
|
||||
textureObject->bind();
|
||||
applyTexParameters(GL_TEXTURE_1D, state);
|
||||
|
||||
extensions->glTexStorage1D( GL_TEXTURE_1D, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth);
|
||||
if(!textureObject->_allocated)
|
||||
{
|
||||
extensions->glTexStorage1D( GL_TEXTURE_1D, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GLenum internalFormat = _sourceFormat ? _sourceFormat : _internalFormat;
|
||||
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_1D, _numMipmapLevels, internalFormat, _textureWidth, 1, 1, 0);
|
||||
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_1D, _numMipmapLevels, internalFormat, _textureWidth, 1, 1, _borderWidth);
|
||||
textureObject->bind();
|
||||
applyTexParameters(GL_TEXTURE_1D, state);
|
||||
|
||||
@@ -260,6 +262,8 @@ void Texture1D::apply(State& state) const
|
||||
_readPBuffer->bindPBufferToTexture(GL_FRONT);
|
||||
}
|
||||
|
||||
textureObject->setAllocated(_numMipmapLevels, texStorageSizedInternalFormat!=0? texStorageSizedInternalFormat: _internalFormat, _textureWidth, 1, 1, _borderWidth);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -233,7 +233,7 @@ void Texture2D::apply(State& state) const
|
||||
|
||||
textureObject->setAllocated(_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,1,_borderWidth);
|
||||
|
||||
// in theory the following line is redundent, but in practice
|
||||
// in theory the following line is redundant, but in practice
|
||||
// have found that the first frame drawn doesn't apply the textures
|
||||
// unless a second bind is called?!!
|
||||
// perhaps it is the first glBind which is not required...
|
||||
@@ -288,7 +288,7 @@ void Texture2D::apply(State& state) const
|
||||
non_const_this->_image = NULL;
|
||||
}
|
||||
|
||||
// in theory the following line is redundent, but in practice
|
||||
// in theory the following line is redundant, but in practice
|
||||
// have found that the first frame drawn doesn't apply the textures
|
||||
// unless a second bind is called?!!
|
||||
// perhaps it is the first glBind which is not required...
|
||||
@@ -306,8 +306,11 @@ void Texture2D::apply(State& state) const
|
||||
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_2D, _numMipmapLevels, texStorageSizedInternalFormat, _textureWidth, _textureHeight, 1, _borderWidth);
|
||||
textureObject->bind();
|
||||
applyTexParameters(GL_TEXTURE_2D, state);
|
||||
extensions->glTexStorage2D( GL_TEXTURE_2D, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat,
|
||||
_textureWidth, _textureHeight);
|
||||
if(!textureObject->_allocated)
|
||||
{
|
||||
extensions->glTexStorage2D( GL_TEXTURE_2D, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat,
|
||||
_textureWidth, _textureHeight);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -327,6 +330,7 @@ void Texture2D::apply(State& state) const
|
||||
_readPBuffer->bindPBufferToTexture(GL_FRONT);
|
||||
}
|
||||
|
||||
textureObject->setAllocated(_numMipmapLevels, texStorageSizedInternalFormat!=0? texStorageSizedInternalFormat: _internalFormat, _textureWidth, _textureHeight, 1, _borderWidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -353,7 +353,7 @@ void Texture2DArray::apply(State& state) const
|
||||
applyTexParameters(GL_TEXTURE_2D_ARRAY, state);
|
||||
|
||||
// First we need to allocate the texture memory
|
||||
if(texStorageSizedInternalFormat!=0)
|
||||
if(texStorageSizedInternalFormat!=0 && !textureObject->_allocated)
|
||||
{
|
||||
extensions->glTexStorage3D(GL_TEXTURE_2D_ARRAY, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth, _textureHeight, textureDepth);
|
||||
}
|
||||
@@ -400,11 +400,8 @@ void Texture2DArray::apply(State& state) const
|
||||
osg::Image* image = itr->get();
|
||||
if (image)
|
||||
{
|
||||
if (getModifiedCount(n,contextID) != image->getModifiedCount())
|
||||
{
|
||||
getModifiedCount(n,contextID) = image->getModifiedCount();
|
||||
applyTexImage2DArray_subload(state, image, n, _textureWidth, _textureHeight, image->r(), _internalFormat, _numMipmapLevels);
|
||||
}
|
||||
getModifiedCount(n,contextID) = image->getModifiedCount();
|
||||
applyTexImage2DArray_subload(state, image, n, _textureWidth, _textureHeight, image->r(), _internalFormat, _numMipmapLevels);
|
||||
n += image->r();
|
||||
}
|
||||
}
|
||||
@@ -452,7 +449,7 @@ void Texture2DArray::apply(State& state) const
|
||||
|
||||
applyTexParameters(GL_TEXTURE_2D_ARRAY,state);
|
||||
|
||||
if (texStorageSizedInternalFormat!=0)
|
||||
if (texStorageSizedInternalFormat!=0 && !textureObject->_allocated)
|
||||
{
|
||||
extensions->glTexStorage3D( GL_TEXTURE_2D_ARRAY, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth, _textureHeight, _textureDepth);
|
||||
}
|
||||
@@ -463,6 +460,8 @@ void Texture2DArray::apply(State& state) const
|
||||
_sourceFormat ? _sourceFormat : _internalFormat,
|
||||
_sourceType ? _sourceType : GL_UNSIGNED_BYTE,
|
||||
0);
|
||||
|
||||
textureObject->setAllocated(_numMipmapLevels, texStorageSizedInternalFormat!=0 ? texStorageSizedInternalFormat :_internalFormat, _textureWidth, _textureHeight, _textureDepth, 0);
|
||||
}
|
||||
|
||||
// nothing before, so just unbind the texture target
|
||||
|
||||
@@ -108,8 +108,10 @@ void Texture2DMultisample::apply(State& state) const
|
||||
{
|
||||
textureObject = generateAndAssignTextureObject(contextID, getTextureTarget(), 1, texStorageSizedInternalFormat, _textureWidth, _textureHeight, 1, 0);
|
||||
textureObject->bind();
|
||||
|
||||
extensions->glTexStorage2DMultisample( GL_TEXTURE_2D_MULTISAMPLE, _numSamples, texStorageSizedInternalFormat, _textureWidth, _textureHeight, _fixedsamplelocations);
|
||||
if(!textureObject->_allocated)
|
||||
{
|
||||
extensions->glTexStorage2DMultisample( GL_TEXTURE_2D_MULTISAMPLE, _numSamples, texStorageSizedInternalFormat, _textureWidth, _textureHeight, _fixedsamplelocations);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -123,6 +125,7 @@ void Texture2DMultisample::apply(State& state) const
|
||||
_textureHeight,
|
||||
_fixedsamplelocations );
|
||||
}
|
||||
textureObject->setAllocated(1, texStorageSizedInternalFormat!=0? texStorageSizedInternalFormat: _internalFormat, _textureWidth, _textureHeight, 1, _borderWidth);
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
@@ -276,7 +276,7 @@ void Texture3D::apply(State& state) const
|
||||
|
||||
textureObject->setAllocated(_numMipmapLevels,_internalFormat,_textureWidth,_textureHeight,_textureDepth,0);
|
||||
|
||||
// in theory the following line is redundent, but in practice
|
||||
// in theory the following line is redundant, but in practice
|
||||
// have found that the first frame drawn doesn't apply the textures
|
||||
// unless a second bind is called?!!
|
||||
// perhaps it is the first glBind which is not required...
|
||||
@@ -322,8 +322,10 @@ void Texture3D::apply(State& state) const
|
||||
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_3D, _numMipmapLevels, texStorageSizedInternalFormat, _textureWidth, _textureHeight, _textureDepth,0);
|
||||
textureObject->bind();
|
||||
applyTexParameters(GL_TEXTURE_3D, state);
|
||||
|
||||
extensions->glTexStorage3D( GL_TEXTURE_3D, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth, _textureHeight, _textureDepth);
|
||||
if(!textureObject->_allocated)
|
||||
{
|
||||
extensions->glTexStorage3D( GL_TEXTURE_3D, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth, _textureHeight, _textureDepth);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -345,6 +347,7 @@ void Texture3D::apply(State& state) const
|
||||
_readPBuffer->bindPBufferToTexture(GL_FRONT);
|
||||
}
|
||||
|
||||
textureObject->setAllocated(_numMipmapLevels, texStorageSizedInternalFormat!=0? texStorageSizedInternalFormat : _internalFormat, _textureWidth, _textureHeight, _textureDepth, _borderWidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -271,7 +271,7 @@ void TextureCubeMap::apply(State& state) const
|
||||
|
||||
_subloadCallback->load(*this,state);
|
||||
|
||||
// in theory the following line is redundent, but in practice
|
||||
// in theory the following line is redundant, but in practice
|
||||
// have found that the first frame drawn doesn't apply the textures
|
||||
// unless a second bind is called?!!
|
||||
// perhaps it is the first glBind which is not required...
|
||||
@@ -353,7 +353,10 @@ void TextureCubeMap::apply(State& state) const
|
||||
|
||||
if(texStorageSizedInternalFormat!=0)
|
||||
{
|
||||
extensions->glTexStorage2D(GL_TEXTURE_CUBE_MAP, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth, _textureHeight);
|
||||
if(!textureObject->_allocated)
|
||||
{
|
||||
extensions->glTexStorage2D(GL_TEXTURE_CUBE_MAP, osg::maximum(_numMipmapLevels,1), texStorageSizedInternalFormat, _textureWidth, _textureHeight);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
@@ -367,6 +370,7 @@ void TextureCubeMap::apply(State& state) const
|
||||
0);
|
||||
}
|
||||
|
||||
textureObject->setAllocated(_numMipmapLevels, texStorageSizedInternalFormat!=0? texStorageSizedInternalFormat : _internalFormat, _textureWidth, _textureHeight, 1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -281,8 +281,10 @@ void TextureRectangle::apply(State& state) const
|
||||
textureObject = generateAndAssignTextureObject(contextID, GL_TEXTURE_RECTANGLE, 0, texStorageSizedInternalFormat, _textureWidth, _textureHeight, 1, 0);
|
||||
textureObject->bind();
|
||||
applyTexParameters(GL_TEXTURE_RECTANGLE, state);
|
||||
|
||||
extensions->glTexStorage2D( GL_TEXTURE_RECTANGLE, 1, texStorageSizedInternalFormat, _textureWidth, _textureHeight);
|
||||
if(!textureObject->_allocated)
|
||||
{
|
||||
extensions->glTexStorage2D( GL_TEXTURE_RECTANGLE, 1, texStorageSizedInternalFormat, _textureWidth, _textureHeight);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -303,6 +305,7 @@ void TextureRectangle::apply(State& state) const
|
||||
_readPBuffer->bindPBufferToTexture(GL_FRONT);
|
||||
}
|
||||
|
||||
textureObject->setAllocated(0, texStorageSizedInternalFormat!=0? texStorageSizedInternalFormat : _internalFormat, _textureWidth, _textureHeight, 1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
using namespace osg;
|
||||
|
||||
// follows are the constructors of the Timer class, once version
|
||||
// for each OS combination. The order is WIN32, FreeBSD, Linux, IRIX,
|
||||
// for each OS combination. The order is _WIN32, FreeBSD, Linux, IRIX,
|
||||
// and the rest of the world.
|
||||
//
|
||||
// all the rest of the timer methods are implemented within the header.
|
||||
@@ -32,7 +32,7 @@ Timer* Timer::instance()
|
||||
return &s_timer;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
@@ -191,9 +191,11 @@ bool isCompressedImageTranslucent(size_t width, size_t height, GLenum format, vo
|
||||
switch(format)
|
||||
{
|
||||
case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT):
|
||||
return false;
|
||||
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT):
|
||||
{
|
||||
const DXT1TexelsBlock *texelsBlock = reinterpret_cast<const DXT1TexelsBlock*>(imageData);
|
||||
|
||||
@@ -230,6 +232,7 @@ bool isCompressedImageTranslucent(size_t width, size_t height, GLenum format, vo
|
||||
}
|
||||
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT):
|
||||
{
|
||||
const DXT3TexelsBlock *texelsBlock = reinterpret_cast<const DXT3TexelsBlock*>(imageData);
|
||||
// Only do the check on the first mipmap level, and stop when we see the first alpha texel
|
||||
@@ -246,6 +249,7 @@ bool isCompressedImageTranslucent(size_t width, size_t height, GLenum format, vo
|
||||
return false;
|
||||
}
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT):
|
||||
{
|
||||
const DXT5TexelsBlock *texelsBlock = reinterpret_cast<const DXT5TexelsBlock*>(imageData);
|
||||
// Only do the check on the first mipmap level, and stop when we see the first alpha texel
|
||||
|
||||
@@ -158,6 +158,10 @@ inline bool isDXTC(GLenum pixelFormat)
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT):
|
||||
case(GL_COMPRESSED_SRGB_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT):
|
||||
case(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -178,18 +182,19 @@ inline dxtc_pixels::dxtc_pixels(size_t Width, size_t Height, GLenum Format, void
|
||||
m_Width(Width), m_Height(Height), m_Format(Format), m_pPixels(pPixels) { }
|
||||
|
||||
|
||||
inline bool dxtc_pixels::DXT1() const {
|
||||
return ((m_Format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) || (m_Format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT));
|
||||
}
|
||||
|
||||
|
||||
inline bool dxtc_pixels::DXT3() const {
|
||||
return (m_Format == GL_COMPRESSED_RGBA_S3TC_DXT3_EXT);
|
||||
}
|
||||
|
||||
|
||||
inline bool dxtc_pixels::DXT5() const {
|
||||
return (m_Format == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT);
|
||||
inline bool dxtc_pixels::DXT1() const {
|
||||
return ((m_Format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) || (m_Format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT)
|
||||
|| (m_Format == GL_COMPRESSED_SRGB_S3TC_DXT1_EXT) || (m_Format == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT));
|
||||
}
|
||||
|
||||
|
||||
inline bool dxtc_pixels::DXT3() const {
|
||||
return ((m_Format == GL_COMPRESSED_RGBA_S3TC_DXT3_EXT) || (m_Format == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT));
|
||||
}
|
||||
|
||||
|
||||
inline bool dxtc_pixels::DXT5() const {
|
||||
return ((m_Format == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) || (m_Format == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ osg::gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value )
|
||||
tess->windingRule = windingRule;
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
case GLU_TESS_BOUNDARY_ONLY:
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
@@ -39,7 +39,7 @@ std::string convertStringFromUTF8toCurrentCodePage(const char* s){return convert
|
||||
|
||||
std::string convertUTF16toUTF8(const wchar_t* source, unsigned sourceLength)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
if (sourceLength == 0)
|
||||
{
|
||||
return std::string();
|
||||
@@ -71,7 +71,7 @@ std::string convertUTF16toUTF8(const wchar_t* source, unsigned sourceLength)
|
||||
|
||||
std::wstring convertUTF8toUTF16(const char* source, unsigned sourceLength)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
if (sourceLength == 0)
|
||||
{
|
||||
return std::wstring();
|
||||
@@ -103,7 +103,7 @@ std::wstring convertUTF8toUTF16(const char* source, unsigned sourceLength)
|
||||
|
||||
std::string convertStringFromCurrentCodePageToUTF8(const char* source, unsigned sourceLength)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
if (sourceLength == 0)
|
||||
{
|
||||
return std::string();
|
||||
@@ -132,7 +132,7 @@ std::string convertStringFromCurrentCodePageToUTF8(const char* source, unsigned
|
||||
|
||||
std::string convertStringFromUTF8toCurrentCodePage(const char* source, unsigned sourceLength)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
if (sourceLength == 0)
|
||||
{
|
||||
return std::string();
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
@@ -1646,7 +1646,12 @@ void DatabasePager::addLoadedDataToSceneGraph(const osg::FrameStamp &frameStamp)
|
||||
osg::ProxyNode* proxyNode = dynamic_cast<osg::ProxyNode*>(group.get());
|
||||
if (proxyNode)
|
||||
{
|
||||
proxyNode->getDatabaseRequest(proxyNode->getNumChildren()) = 0;
|
||||
for (unsigned int i = 0; i < proxyNode->getNumFileNames(); ++i) {
|
||||
if (proxyNode->getDatabaseRequest(i) == databaseRequest) {
|
||||
proxyNode->getDatabaseRequest(i) = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#include <io.h>
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
@@ -59,7 +59,7 @@ DynamicLibrary::~DynamicLibrary()
|
||||
if (_handle)
|
||||
{
|
||||
OSG_INFO<<"Closing DynamicLibrary "<<_name<<std::endl;
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
FreeLibrary((HMODULE)_handle);
|
||||
#elif defined(__APPLE__) && defined(APPLE_PRE_10_3)
|
||||
NSUnLinkModule(static_cast<NSModule>(_handle), FALSE);
|
||||
@@ -95,7 +95,7 @@ DynamicLibrary::HANDLE DynamicLibrary::getLibraryHandle( const std::string& libr
|
||||
{
|
||||
HANDLE handle = NULL;
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#ifdef OSG_USE_UTF8_FILENAME
|
||||
handle = LoadLibraryW( convertUTF8toUTF16(libraryName).c_str() );
|
||||
#else
|
||||
@@ -150,7 +150,7 @@ DynamicLibrary::HANDLE DynamicLibrary::getLibraryHandle( const std::string& libr
|
||||
DynamicLibrary::PROC_ADDRESS DynamicLibrary::getProcAddress(const std::string& procName)
|
||||
{
|
||||
if (_handle==NULL) return NULL;
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
return osg::convertPointerType<DynamicLibrary::PROC_ADDRESS, FARPROC>( GetProcAddress( (HMODULE)_handle, procName.c_str() ) );
|
||||
#elif defined(__APPLE__) && defined(APPLE_PRE_10_3)
|
||||
std::string temp("_");
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
#include <osgDB/FileNameUtils>
|
||||
#include <osgDB/FileUtils>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(__sgi)
|
||||
#include <ctype.h>
|
||||
#elif defined(__GNUC__) || !defined(WIN32) || defined(__MWERKS__)
|
||||
#elif defined(__GNUC__) || !defined(_WIN32) || defined(__MWERKS__)
|
||||
#include <cctype>
|
||||
using std::tolower;
|
||||
#endif
|
||||
@@ -98,7 +98,7 @@ std::string osgDB::convertFileNameToUnixStyle(const std::string& fileName)
|
||||
|
||||
char osgDB::getNativePathSeparator()
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
return WINDOWS_PATH_SEPARATOR;
|
||||
#else
|
||||
return UNIX_PATH_SEPARATOR;
|
||||
@@ -107,7 +107,7 @@ char osgDB::getNativePathSeparator()
|
||||
|
||||
bool osgDB::isFileNameNativeStyle(const std::string& fileName)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
return fileName.find(UNIX_PATH_SEPARATOR) == std::string::npos; // return true if no unix style slash exist
|
||||
#else
|
||||
return fileName.find(WINDOWS_PATH_SEPARATOR) == std::string::npos; // return true if no windows style backslash exist
|
||||
@@ -116,7 +116,7 @@ bool osgDB::isFileNameNativeStyle(const std::string& fileName)
|
||||
|
||||
std::string osgDB::convertFileNameToNativeStyle(const std::string& fileName)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
return convertFileNameToWindowsStyle(fileName);
|
||||
#else
|
||||
return convertFileNameToUnixStyle(fileName);
|
||||
@@ -261,7 +261,7 @@ std::string osgDB::getServerFileName(const std::string& filename)
|
||||
|
||||
std::string osgDB::concatPaths(const std::string& left, const std::string& right)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
const char delimiterNative = WINDOWS_PATH_SEPARATOR;
|
||||
const char delimiterForeign = UNIX_PATH_SEPARATOR;
|
||||
#else
|
||||
@@ -291,7 +291,7 @@ std::string osgDB::concatPaths(const std::string& left, const std::string& right
|
||||
|
||||
std::string osgDB::getRealPath(const std::string& path)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
|
||||
#ifdef OSG_USE_UTF8_FILENAME
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ typedef char TCHAR;
|
||||
// the mac version will change soon to reflect the path scheme under osx, but
|
||||
// for now, the above include is commented out, and the below code takes precedence.
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#include <io.h>
|
||||
#define WINBASE_DECLARE_GET_MODULE_HANDLE_EX
|
||||
#include <windows.h>
|
||||
@@ -204,7 +204,7 @@ bool osgDB::makeDirectory( const std::string &path )
|
||||
{
|
||||
std::string dir = paths.top();
|
||||
|
||||
#if defined(WIN32)
|
||||
#if defined(_WIN32)
|
||||
//catch drive name
|
||||
if (dir.size() == 2 && dir.c_str()[1] == ':') {
|
||||
paths.pop();
|
||||
@@ -274,17 +274,17 @@ bool osgDB::setCurrentWorkingDirectory( const std::string &newCurrentWorkingDire
|
||||
|
||||
void osgDB::convertStringPathIntoFilePathList(const std::string& paths,FilePathList& filepath)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
char delimitor = ';';
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
char delimiter = ';';
|
||||
#else
|
||||
char delimitor = ':';
|
||||
char delimiter = ':';
|
||||
#endif
|
||||
|
||||
if (!paths.empty())
|
||||
{
|
||||
std::string::size_type start = 0;
|
||||
std::string::size_type end;
|
||||
while ((end = paths.find_first_of(delimitor,start))!=std::string::npos)
|
||||
while ((end = paths.find_first_of(delimiter,start))!=std::string::npos)
|
||||
{
|
||||
filepath.push_back(std::string(paths,start,end-start));
|
||||
start = end+1;
|
||||
@@ -342,7 +342,7 @@ std::string osgDB::findFileInPath(const std::string& filename, const FilePathLis
|
||||
OSG_DEBUG << "itr='" <<*itr<< "'\n";
|
||||
std::string path = itr->empty() ? filename : concatPaths(*itr, filename);
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
// if combined file path exceeds MAX_PATH then ignore as it's not a legal path otherwise subsequent IO calls with this path may result in undefined behavior
|
||||
if (path.length()>MAX_PATH) continue;
|
||||
#endif
|
||||
@@ -355,7 +355,7 @@ std::string osgDB::findFileInPath(const std::string& filename, const FilePathLis
|
||||
OSG_DEBUG << "FindFileInPath() : USING " << path << "\n";
|
||||
return path;
|
||||
}
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
// windows already case insensitive so no need to retry..
|
||||
else if (caseSensitivity==CASE_INSENSITIVE)
|
||||
{
|
||||
@@ -395,7 +395,7 @@ std::string osgDB::findFileInDirectory(const std::string& fileName,const std::st
|
||||
std::string realFileName = fileName;
|
||||
|
||||
// Skip case-insensitive recursion if on Windows
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
bool win32 = true;
|
||||
#else
|
||||
bool win32 = false;
|
||||
@@ -535,7 +535,7 @@ static void appendInstallationLibraryFilePaths(osgDB::FilePathList& filepath)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
|
||||
@@ -763,7 +763,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths)
|
||||
convertStringPathIntoFilePathList("/usr/bin/:/usr/local/bin/",filepath);
|
||||
}
|
||||
|
||||
#elif defined(WIN32)
|
||||
#elif defined(_WIN32)
|
||||
|
||||
void osgDB::appendPlatformSpecificLibraryFilePaths(FilePathList& filepath)
|
||||
{
|
||||
@@ -988,7 +988,7 @@ bool osgDB::containsCurrentWorkingDirectoryReference(const FilePathList& paths)
|
||||
// The Carbon version is noticeably longer.
|
||||
// Unfortunately, the Cocoa version requires -lobjc to be
|
||||
// linked in when creating an executable.
|
||||
// Rumor is that this will be done autmatically in gcc 3.5/Tiger,
|
||||
// Rumor is that this will be done automatically in gcc 3.5/Tiger,
|
||||
// but for now, this will cause a lot of headaches for people
|
||||
// who aren't familiar with this concept, so the Carbon version
|
||||
// is preferable.
|
||||
|
||||
@@ -576,7 +576,7 @@ void OutputStream::writeImage( const osg::Image* img )
|
||||
std::string encodedData;
|
||||
e.encode((char*)img_itr.data(), img_itr.size(), encodedData);
|
||||
// Each set of data is written into a separate string so we can
|
||||
// distiguish between main data and all mipmap levels, so writing
|
||||
// distinguish between main data and all mipmap levels, so writing
|
||||
// mipmap size is not required for ASCII mode.
|
||||
writeWrappedString(encodedData);
|
||||
}
|
||||
@@ -781,7 +781,7 @@ void OutputStream::start( OutputIterator* outIterator, OutputStream::WriteType t
|
||||
}
|
||||
|
||||
// From SOVERSION 98, start to support binary begin/end brackets so we can easily ignore
|
||||
// errors and unsupport classes, enabling the attribute bit
|
||||
// errors and unsupported classes, enabling the attribute bit
|
||||
if ( _useRobustBinaryFormat )
|
||||
{
|
||||
outIterator->setSupportBinaryBrackets( true );
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user