Compare commits

..

1 Commits

Author SHA1 Message Date
Robert Osfield
2f780df47b Release OpenSceneGraph-3.2.1
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/tags/OpenSceneGraph-3.2.1@14364 16af8721-9629-0410-8352-f15c8da7e697
2014-07-04 16:55:34 +00:00
70 changed files with 469 additions and 1741 deletions

View File

@@ -1,6 +1,6 @@
OpenSceneGraph Library 3.2.2 OpenSceneGraph Library 3.2.1
529 Contributors: 519 Contributors:
Firstname Surname Firstname Surname
----------------- -----------------
@@ -15,8 +15,8 @@ Wang Rui
Jean-S<>bastien Guay Jean-S<>bastien Guay
Ulrich Hertlein Ulrich Hertlein
Mike Weiblen Mike Weiblen
Sukender
Eric Wing Eric Wing
Sukender
Cedric Pinson Cedric Pinson
Brede Johansen Brede Johansen
Bob Kuehne Bob Kuehne
@@ -30,18 +30,18 @@ Colin McDonald
Trajce Nikolov Trajce Nikolov
Tim Moore Tim Moore
Martin Lavery Martin Lavery
Tree Tree
Luigi Calori Luigi Calori
Mike Wittman Mike Wittman
Jason Beverage Jason Beverage
Chris Hanson Chris Hanson
Roland Smeenk Roland Smeenk
Roger James Roger James
Mattias Helsing
Jeremy Moles Jeremy Moles
Jan Peciva Jan Peciva
Alberto Luaces Mattias Helsing
J.P. Delport J.P. Delport
Alberto Luaces
Magnus Kessler Magnus Kessler
David Fries David Fries
Andy Skinner Andy Skinner
@@ -58,11 +58,10 @@ Art Tevs
Philip Lowman Philip Lowman
Per Fahlberg Per Fahlberg
Norman Vine Norman Vine
Lionel Lagarde
Terry Welsh Terry Welsh
Serge Lages Serge Lages
Romano Jos<6F> Magacho da Silva Romano Jos<6F> Magacho da Silva
Pjotr Svetachov Lionel Lagarde
Chris Denham Chris Denham
Alberto Farre Alberto Farre
Torben Dannhauer Torben Dannhauer
@@ -73,6 +72,7 @@ Andr
Adrian Egli Adrian Egli
Ruben Lopez Ruben Lopez
Randall Hopper Randall Hopper
Pjotr Svetachov
Jan Ciger Jan Ciger
Glenn Waldron Glenn Waldron
Gideon May Gideon May
@@ -91,7 +91,6 @@ Mike Connell
Melchior Franz Melchior Franz
Johannes Baeuerle Johannes Baeuerle
Thomas Hogarth Thomas Hogarth
Sebastian Messerschmidt
Rafa Gaitan Rafa Gaitan
Neil Hughes Neil Hughes
Martin Beckett Martin Beckett
@@ -106,6 +105,7 @@ Boris Bralo
Yefei He Yefei He
Sondra Iverson Sondra Iverson
Simon Julier Simon Julier
Sebastian Messerschmidt
Rune Schmidt Jensen Rune Schmidt Jensen
Rainer Oder Rainer Oder
Nico Kruithof Nico Kruithof
@@ -129,7 +129,6 @@ Joseph Steel
Jordi Torres Jordi Torres
John Shue John Shue
Brad Colbert Brad Colbert
Bj<EFBFBD>rn Blissing
Alexander Sinditskiy Alexander Sinditskiy
Vivek Rajan Vivek Rajan
Uwe Woessner Uwe Woessner
@@ -138,7 +137,6 @@ Thom DeCarlo
Tatsuhiro Nishioka Tatsuhiro Nishioka
Tanguy Fautr<74> Tanguy Fautr<74>
Sean Spicer Sean Spicer
Ryan Kawicki
Richard Schmidt Richard Schmidt
Peter Hrenka Peter Hrenka
Paul de Repentigny Paul de Repentigny
@@ -147,7 +145,6 @@ Neil Salter
Mihai Radu Mihai Radu
Michael Hartman Michael Hartman
Martins Innus Martins Innus
Marc Helbling
Maciej Krol Maciej Krol
Lilin Xiong Lilin Xiong
Leandro Motta Barros Leandro Motta Barros
@@ -156,15 +153,16 @@ Hartwig Wiesmann
Donn Mielcarek Donn Mielcarek
Corbin Holtz Corbin Holtz
Blasius Czink Blasius Czink
Bj<EFBFBD>rn Blissing
Alexander Irion Alexander Irion
Toshiyuki Takahei Toshiyuki Takahei
Sebastien Grignard Sebastien Grignard
Ryan Kawicki
Rudolf Wiedemann Rudolf Wiedemann
Robert Milharcic Robert Milharcic
Maria Ten Maria Ten
Liang Aibin Liang Aibin
Kristofer Tingdahl Kristofer Tingdahl
Konstantin Matveyev
Katharina Plugge Katharina Plugge
John Vidar Larring John Vidar Larring
John Kelso John Kelso
@@ -231,7 +229,7 @@ Yuzhong Shen
Wee See Wee See
Warren Macchi Warren Macchi
Vincent Bourdier Vincent Bourdier
Terrex Terrex
Tassilo Glander Tassilo Glander
Sylvain Marie Sylvain Marie
Steve Lunsford Steve Lunsford
@@ -247,7 +245,6 @@ Perry Miller
Pawel Ksiezopolski Pawel Ksiezopolski
Paul Palumbo Paul Palumbo
Paul Obermeier Paul Obermeier
Patrick Neary
Nguyen Van Truong Nguyen Van Truong
Nathan Cournia Nathan Cournia
Morten Haukness Morten Haukness
@@ -266,9 +263,9 @@ Marius Heise
Marcin Hajder Marcin Hajder
Marcel Pursche Marcel Pursche
Lilith Bryant Lilith Bryant
Konstantin Matveyev
Kevin Moiule Kevin Moiule
Keith Steffen Keith Steffen
Julien Valentin
Julen Garcia Julen Garcia
Joseph Winston Joseph Winston
John Aughey John Aughey
@@ -276,8 +273,6 @@ Johannes Scholz
Joachim Pouderoux Joachim Pouderoux
Jean-Christophe Lombardo Jean-Christophe Lombardo
Javier Taibo Javier Taibo
Jannik Heller
Jan Klimke
James Moliere James Moliere
Jaap Glas Jaap Glas
Igor Kravtchenko Igor Kravtchenko
@@ -296,7 +291,7 @@ Eric Buehler
Eduardo Poyart Eduardo Poyart
Edgar Ellis Edgar Ellis
Dimi Christopoulos Dimi Christopoulos
Diane Delall<EFBFBD>e Diane Delallée
David Longest David Longest
David Ergo David Ergo
Daniel Trstenjak Daniel Trstenjak
@@ -304,7 +299,6 @@ Craig Bosma
Claus Scheiblauer Claus Scheiblauer
Christophe Loustaunau Christophe Loustaunau
Christian Ruzicka Christian Ruzicka
Bradley Baker Searles
Brad Anderegg Brad Anderegg
Bj<EFBFBD>rn Hein Bj<EFBFBD>rn Hein
Aric Aumann Aric Aumann
@@ -333,7 +327,6 @@ Tomas Hnilica
Todd Furlong Todd Furlong
Tobias Ottenweller Tobias Ottenweller
Tino Schwarze Tino Schwarze
Tim George
Thorsten Brehm Thorsten Brehm
Thomas Weidner Thomas Weidner
Tan Dunning Tan Dunning
@@ -391,14 +384,13 @@ Nicolas Brodu
Nick Black Nick Black
Mojtaba Fathi Mojtaba Fathi
Mirko Viviani Mirko Viviani
Mikkel Gj<EFBFBD>l Mikkel Gjøl
Mike Krus Mike Krus
Mike Garrity Mike Garrity
Miha Rav<EFBFBD>elj Miha Ravsel
Michael Schanne Michael Schanne
Michael Polak Michael Polak
Michael Morrison Michael Morrison
Michael Mc Donnell
Michael Logan Michael Logan
Michael Kapelko Michael Kapelko
Michael Bach Jensen Michael Bach Jensen
@@ -419,6 +411,7 @@ Marius Kintel
Mario Guimaraes Mario Guimaraes
Marco Sciabica Marco Sciabica
Marco Lehmann Marco Lehmann
Marc Helbling
Maik Keller Maik Keller
Lukas Diduch Lukas Diduch
Louis Hamilton Louis Hamilton
@@ -450,6 +443,7 @@ Jeroen den Dekker
Jay Zuckerman Jay Zuckerman
Jason Howlett Jason Howlett
Jason Ballenger Jason Ballenger
Jan Klimke
James Turner James Turner
James Killian James Killian
James Athey James Athey
@@ -492,9 +486,7 @@ Daniel Stien
Dan Minor Dan Minor
C<EFBFBD>sar L. B. Silveira C<EFBFBD>sar L. B. Silveira
Cyril Brulebois Cyril Brulebois
Cl<EFBFBD>ment B<>sch
Clay Fowler Clay Fowler
Claus Steuer
Chuck Sembroski Chuck Sembroski
Christopher Blaesius Christopher Blaesius
Christopher Baker Christopher Baker
@@ -516,7 +508,6 @@ Benjamin Wasty
Ben van Basten Ben van Basten
Bart Gallet Bart Gallet
Axel Volley Axel Volley
Arjun Ramamurthy
Anthousis Andreadis Anthousis Andreadis
Anish Thomas Anish Thomas
Andy Preece Andy Preece
@@ -531,5 +522,4 @@ Alan Purvis
Alan Ott Alan Ott
Alan Harris Alan Harris
Adrien Grandemange Adrien Grandemange
Adrian Clark
Adam Richard Adam Richard

View File

@@ -22,30 +22,25 @@ if(COMMAND cmake_policy)
# tell CMake to prefer CMake's own CMake modules when available # tell CMake to prefer CMake's own CMake modules when available
# only available from cmake-2.8.4 # only available from cmake-2.8.4
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3)
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 8) OR
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3))
cmake_policy(SET CMP0017 NEW) cmake_policy(SET CMP0017 NEW)
endif() endif()
# cmake-2.6.1 introduces policy cmp0008 decide how to treat full path libraries that do not appear to be valid library file names # cmake-2.6.1 introduces policy cmp0008 decide how to treat full path libraries that do not appear to be valid library file names
# quote from cvslog "Such libraries worked by accident in the VS IDE and Xcode generators in CMake 2.4 and below." # quote from cvslog "Such libraries worked by accident in the VS IDE and Xcode generators in CMake 2.4 and below."
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 6) OR
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6 AND ${CMAKE_PATCH_VERSION} GREATER 0))
cmake_policy(SET CMP0008 OLD) cmake_policy(SET CMP0008 OLD)
endif() endif()
# disable autolinking to qtmain as we have our own main() functions (new in Qt 5.1) # disable autolinking to qtmain as we have our own main() functions (new in Qt 5.1)
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR if((${CMAKE_MAJOR_VERSION} EQUAL 2 OR ${CMAKE_MAJOR_VERSION} GREATER 2) AND
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 8) OR (${CMAKE_MINOR_VERSION} EQUAL 8 OR ${CMAKE_MINOR_VERSION} GREATER 8) AND
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 10)) ${CMAKE_PATCH_VERSION} GREATER 10)
cmake_policy(SET CMP0020 OLD) cmake_policy(SET CMP0020 OLD)
endif() endif()
# nicer version check - but needs at least CMake 2.6.2? Worth upgrading the requirements? # nicer version check - but needs at least CMake 2.6.2? Worth upgrading the requirements?
#if("${CMAKE_VERSION}" VERSION_GREATER 2.8.10) #if("${CMAKE_VERSION}" VERSION_GREATER 2.8.10)
# or even easier (available in cmake-2.6)
#if(POLICY CMPxyzw)
endif() endif()
@@ -53,7 +48,7 @@ PROJECT(OpenSceneGraph)
SET(OPENSCENEGRAPH_MAJOR_VERSION 3) SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
SET(OPENSCENEGRAPH_MINOR_VERSION 2) SET(OPENSCENEGRAPH_MINOR_VERSION 2)
SET(OPENSCENEGRAPH_PATCH_VERSION 2) SET(OPENSCENEGRAPH_PATCH_VERSION 1)
SET(OPENSCENEGRAPH_SOVERSION 100) SET(OPENSCENEGRAPH_SOVERSION 100)
# set to 0 when not a release candidate, non zero means that any generated # set to 0 when not a release candidate, non zero means that any generated
@@ -85,13 +80,6 @@ SET(OpenThreads_SOURCE_DIR ${OpenSceneGraph_SOURCE_DIR})
# Maybe this can be used override existing behavior if needed? # Maybe this can be used override existing behavior if needed?
SET(CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}") SET(CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
# Change the default build type to Release
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
## Option to enable Android build using AndroidNDK ## Option to enable Android build using AndroidNDK
OPTION(OSG_BUILD_PLATFORM_ANDROID OFF) OPTION(OSG_BUILD_PLATFORM_ANDROID OFF)
IF(OSG_BUILD_PLATFORM_ANDROID) IF(OSG_BUILD_PLATFORM_ANDROID)
@@ -246,12 +234,8 @@ IF(APPLE)
EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion" EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion"
OUTPUT_VARIABLE OSG_OSX_SDK_NAME OUTPUT_VARIABLE OSG_OSX_SDK_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REPLACE "." ";" MACOS_VERSION_LIST ${OSG_OSX_SDK_NAME}) STRING(SUBSTRING "${OSG_OSX_SDK_NAME}" 0 4 OSG_OSX_SDK_NAME)
LIST(GET MACOS_VERSION_LIST 0 MACOS_VERSION_MAJOR) SET(OSG_OSX_SDK_NAME "macosx${OSG_OSX_SDK_NAME}")
LIST(GET MACOS_VERSION_LIST 1 MACOS_VERSION_MINOR)
LIST(GET MACOS_VERSION_LIST 2 MACOS_VERSION_PATCH)
SET(OSG_OSX_SDK_NAME "macosx${MACOS_VERSION_MAJOR}.${MACOS_VERSION_MINOR}")
# Trying to get CMake to generate an XCode IPhone project, current efforts are to get iphoneos sdk 3.1 working # Trying to get CMake to generate an XCode IPhone project, current efforts are to get iphoneos sdk 3.1 working
# Added option which needs manually setting to select the IPhone SDK for building. We can only have one of the below # Added option which needs manually setting to select the IPhone SDK for building. We can only have one of the below
@@ -527,12 +511,6 @@ IF(WIN32 AND NOT ANDROID)
INCLUDE(Find3rdPartyDependencies) INCLUDE(Find3rdPartyDependencies)
ENDIF() ENDIF()
#
# If you want to prevent CMake from picking up on any of the following optional 3rd Party dependencies in CMake 2.8 onwards
# 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)
ANDROID_3RD_PARTY() ANDROID_3RD_PARTY()
ELSE() ELSE()
@@ -618,13 +596,6 @@ IF(OSG_USE_QT AND NOT ANDROID)
#If we have found Qt5, let's try to top off by getting the webkit as well #If we have found Qt5, let's try to top off by getting the webkit as well
IF ( Qt5Widgets_FOUND ) IF ( Qt5Widgets_FOUND )
FIND_PACKAGE(Qt5WebKitWidgets QUIET) FIND_PACKAGE(Qt5WebKitWidgets QUIET)
IF(COMMAND cmake_policy)
IF(${CMAKE_MAJOR_VERSION} GREATER 2)
# Qt5 qt5_use_modules usage was causing "Policy CMP0043 is not set: Ignore COMPILE_DEFINITIONS_<Config> properties." warnings
cmake_policy(SET CMP0043 NEW)
ENDIF()
ENDIF()
ENDIF() ENDIF()
ENDIF() ENDIF()
@@ -947,7 +918,7 @@ IF(APPLE AND NOT ANDROID)
# FORCE is used because the options are not reflected in the UI otherwise. # FORCE is used because the options are not reflected in the UI otherwise.
# Seems like a good place to add version specific compiler flags too. # Seems like a good place to add version specific compiler flags too.
IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE) IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10") IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9")
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE) SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
# 64 Bit Works, i386,ppc is not supported any more # 64 Bit Works, i386,ppc is not supported any more
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" FORCE) SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" FORCE)

View File

@@ -143,15 +143,6 @@ ELSE()
NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC) NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1) SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
ENDIF() ENDIF()
# MinGW can set both WIN32_INTERLOCKED and GCC_BUILTINS to true which results in compliation errors
IF (_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
# In this case we prefer the GCC_BUILTINS
SET(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS 1)
SET(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED 0)
ENDIF()
ENDIF() ENDIF()
ENDIF() ENDIF()

View File

@@ -30,7 +30,7 @@ ELSE()
# AVFoundation exists since 10.7, but only 10.8 has all features necessary for OSG # AVFoundation exists since 10.7, but only 10.8 has all features necessary for OSG
# so check the SDK-setting # so check the SDK-setting
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10") IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9")
# nothing special here ;-) # nothing special here ;-)
ELSE() ELSE()
MESSAGE("AVFoundation disabled for SDK < 10.8") MESSAGE("AVFoundation disabled for SDK < 10.8")

View File

@@ -18,10 +18,8 @@ ELSEIF(MSVC90)
SET(FBX_LIBDIR "vs2008") SET(FBX_LIBDIR "vs2008")
ELSEIF(MSVC10) ELSEIF(MSVC10)
SET(FBX_LIBDIR "vs2010") SET(FBX_LIBDIR "vs2010")
ELSEIF(MSVC11) ELSEIF(MSVC11 OR MSVC_VERSION>1700)
SET(FBX_LIBDIR "vs2012") SET(FBX_LIBDIR "vs2012")
ELSEIF(MSVC12 OR MSVC_VERSION>1800)
SET(FBX_LIBDIR "vs2013")
ENDIF() ENDIF()
IF(APPLE) IF(APPLE)
@@ -34,8 +32,6 @@ ELSE()
SET(FBX_LIBDIR ${FBX_LIBDIR}/x86) SET(FBX_LIBDIR ${FBX_LIBDIR}/x86)
ENDIF() ENDIF()
#try to use 2015.1 or 2014.2 version
IF(APPLE) IF(APPLE)
SET(FBX_LIBNAME "libfbxsdk") SET(FBX_LIBNAME "libfbxsdk")
ELSEIF(CMAKE_COMPILER_IS_GNUCXX) ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
@@ -48,15 +44,10 @@ SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
SET( FBX_SEARCH_PATHS SET( FBX_SEARCH_PATHS
$ENV{FBX_DIR} $ENV{FBX_DIR}
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2015.1" "$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.1"
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2015.1" "$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.1"
/Applications/Autodesk/FBXSDK20151
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.2"
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.2"
/Applications/Autodesk/FBXSDK20142
/Applications/Autodesk/FBXSDK20141 /Applications/Autodesk/FBXSDK20141
) )
#I think the last line in the search path is an old typo, but let's search for 2014.1 anyway - LV
# search for headers & debug/release libraries # search for headers & debug/release libraries
FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h" FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
@@ -83,21 +74,21 @@ ELSE()
ENDIF() ENDIF()
IF(NOT FBX_FOUND) IF(NOT FBX_FOUND)
#try to use 2014.1 version #try to use 2013.3 version
IF(APPLE) IF(APPLE)
SET(FBX_LIBNAME "fbxsdk-2014.1") SET(FBX_LIBNAME "fbxsdk-2013.3-static")
ELSEIF(CMAKE_COMPILER_IS_GNUCXX) ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
SET(FBX_LIBNAME "fbxsdk-2014.1") SET(FBX_LIBNAME "fbxsdk-2013.3-static")
ELSE() ELSE()
SET(FBX_LIBNAME "fbxsdk-2014.1") SET(FBX_LIBNAME "fbxsdk-2013.3-md")
ENDIF() ENDIF()
SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d) SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
SET( FBX_SEARCH_PATHS SET( FBX_SEARCH_PATHS
$ENV{FBX_DIR} $ENV{FBX_DIR}
$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.1 $ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2013.3
$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.1 $ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2013.3
/Applications/Autodesk/FBXSDK20141 /Applications/Autodesk/FBXSDK20141
) )
@@ -119,41 +110,3 @@ IF(NOT FBX_FOUND)
ENDIF() ENDIF()
ENDIF() ENDIF()
IF(NOT FBX_FOUND)
#try to use 2013.3 version
IF(APPLE)
SET(FBX_LIBNAME "fbxsdk-2013.3-static")
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
SET(FBX_LIBNAME "fbxsdk-2013.3-static")
ELSE()
SET(FBX_LIBNAME "fbxsdk-2013.3-md")
ENDIF()
SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
SET( FBX_SEARCH_PATHS
$ENV{FBX_DIR}
$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2013.3
$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2013.3
/Applications/Autodesk/FBXSDK20133
)
# search for headers & debug/release libraries
FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
PATHS ${FBX_SEARCH_PATHS}
PATH_SUFFIXES "include")
FIND_LIBRARY( FBX_LIBRARY ${FBX_LIBNAME}
PATHS ${FBX_SEARCH_PATHS}
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME_DEBUG}
PATHS ${FBX_SEARCH_PATHS}
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
IF(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR)
SET(FBX_FOUND "YES")
ELSE()
SET(FBX_FOUND "NO")
ENDIF()
ENDIF()

View File

@@ -63,8 +63,8 @@ ELSE()
ENDIF() ENDIF()
ENDIF() ENDIF()
# Disable quicktime for >= 10.7, as it's officially deprecated # Disable quicktime for >= 10.7, as it's officially deprecated
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10") IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9")
MESSAGE("disabling quicktime because it's not supported by the selected SDK ${OSG_OSX_SDK_NAME}") MESSAGE("disabling quicktime because it's not supported by the selected SDK ${OSG_OSX_SDK_NAME}")
SET(QUICKTIME_FOUND "NO") SET(QUICKTIME_FOUND "NO")
ENDIF() ENDIF()

760
ChangeLog
View File

@@ -1,763 +1,3 @@
2015-08-04 10:11 robert
* CMakeLists.txt: Upated rc number to 4
2015-08-04 09:35 robert
* include/osg/GL: Build fix for Mingw
2015-07-23 14:42 robert
* include/osgViewer/ViewerBase: From Pjotr Svetachov, buid fixes
for VS2015.
2015-07-21 14:22 robert
* src/osgPlugins/OpenFlight/PaletteRecords.cpp: Added check for
validity of OpenFlight shininess value.
2015-07-21 13:42 robert
* include/osg/BoundsChecking: Fixed typo
2015-07-19 09:51 robert
* src/osgPlugins/tiff/ReaderWriterTIFF.cpp: Reinstated the
TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
2015-07-17 09:15 robert
* CMakeLists.txt: Updated release candidate nubmer
2015-07-17 09:03 robert
* AUTHORS.txt, ChangeLog: Updated ChangeLog and AURHORS
2015-07-17 08:35 robert
* AUTHORS.txt, ChangeLog: Updated ChangeLog and AUTHORS file
2015-07-17 08:17 robert
* CMakeLists.txt: Added cmake_policy setting for cmake-3.x to avoid
warning with Qt usage.
2015-07-17 08:13 robert
* src/osgPlugins/tiff/ReaderWriterTIFF.cpp: From Patrick Neary, "To
the tiff plugin, add the capability to write tiff images with
unsigned short data"
2015-07-16 19:19 robert
* src/osg/Image.cpp: From Patrick Neary, "Added some lesser used
tokens that we use from GL_ARB_texture_rg to
computeFormatDataType(), and computeNumComponents() in
src/osg/Image.cpp"
2015-06-30 08:38 robert
* src/osgPlugins/ogr/ReaderWriterOGR.cpp: Build fix for GLDAL>=2.0
2015-06-19 09:54 robert
* src/osgUtil/RenderStage.cpp: From Jannik Heller, fix to
clearReferencesToDependentCameras().
2015-06-12 08:04 robert
* src/osgText/TextBase.cpp: From Farshid Lashkari, "I've modified
some setter methods of TextBase to avoid unnecessary calls to
computeGlyphRepresentation() if the value has not changed."
2015-06-10 10:02 robert
* src/osgGA/NodeTrackerManipulator.cpp: Philippe Renon, "Fixed
potential divide by zero in NodeTrackerManipulator : The divide
by zero happens when throwing a NodeTrackerManipulator.
The infinite result trickles down and later causes NaN in
culling.
The fix was to use getThrowScale() as done everywhere else."
2015-06-07 11:13 robert
* src/osgViewer/CompositeViewer.cpp, src/osgViewer/Viewer.cpp:
Fixed setReferenceTime() bug where a * eather than the correct /
was being used. Bug and fix suggested Benjamin Richter.
2015-05-21 14:11 robert
* src/osgText/Text3D.cpp: Fixed memory error associated with
reading over the end of container due to an unbounded while loop.
2015-05-05 11:04 robert
* CMakeLists.txt: Changed the CMP0020 check to > 2.8.10
2015-04-20 10:43 robert
* src/osgViewer/GraphicsWindowX11.cpp: Merged correction to
coordinates from svn/trunk
2015-04-20 10:42 robert
* applications/osgversion/Contributors.cpp: Updated contributor
fixes
2015-04-20 09:38 robert
* src/osg/State.cpp: Moved uniform substitution to infront of
vertex attribute substituion to make sure gl_Vertex usage is
replaced when required.
2015-04-01 09:37 robert
* src/osg/Image.cpp: From Lionel Largarde, "fix for the
Image::computeNumberOfMipmapLevels method. The method did use the
float version of the log function and the / operator.
It works for most of the input sizes, but fails for 8192,
32768...
For 8192, the method returns 13 instead of 14."
2015-03-17 09:10 robert
* src/osgWrappers/serializers/osg/LibraryWrapper.cpp: Removed
unimplemented ComputeBoundingBoxCallback and
ComputeBoundingSphereCallback
2015-03-17 08:26 robert
* src/osgWrappers/serializers/osg/LibraryWrapper.cpp: Added missing
references for static build
2015-03-16 10:30 robert
* src/osgAnimation/Animation.cpp: From Konstantin Matveyev, "Last
update in the osgAnimation::Animation ONCE mode bug fix"
2015-03-13 08:13 robert
* src/osgWrappers/serializers/osg/LibraryWrapper.cpp: Reverted
merged from svn/trunk.
2015-03-13 08:12 robert
* src/osgWrappers/serializers/osg/LibraryWrapper.cpp: From
Konstantin Matveyev, "Small fix for OSG 3.3.6.119 in the
attachment.
One line added in osg/LibraryWrapper.cpp
USE_SERIALIZER_WRAPPER(Callback)
"
2015-03-12 15:12 robert
* CMakeModules/FindFBX.cmake: From Laurens Voerman, "attached is a
zip with a modified version of:
OpenSceneGraph\CMakeModules\FindFBX.cmake
This version can find fbx sdk 2015.1 and will prefer it over
older versions.
Tested with Visual Studio Express 2013 on 64bit windows 7"
2015-03-11 17:47 robert
* src/osgPlugins/exr/ReaderWriterEXR.cpp: Warning fixes
2015-03-11 17:37 robert
* src/osgPlugins/sdl/JoystickDevice.cpp: From Laurens Voerman, "The
current version will not compile with SDL version 2, error
OpenSceneGraph\src\osgPlugins\sdl\JoystickDevice.cpp(42): error
C2664: 'const char *SDL_JoystickName(SDL_Joystick *)' : cannot
convert argument 1 from 'int' to 'SDL_Joystick *'
due to changes in the SDL api.
Tested with Visual Studio Express 2013; SDL 2.0.1"
2015-03-05 18:00 robert
* CMakeLists.txt: Updated RC to 2.
2015-03-05 18:00 robert
* AUTHORS.txt, ChangeLog, applications/osgversion/Contributors.cpp:
Updated AUTHORS file for next release candidate
2015-03-03 12:56 robert
* src/osgUtil/Optimizer.cpp: Restructed the checks in the
CollectLowestTransformsVisitor::removeTransforms() to avoid
benign case being flagged as warning.
2015-03-03 12:00 robert
* src/osg/PolygonMode.cpp: Re-organized the #ifdef's to avoid usage
of glPolyginMode under GLES
2015-03-02 11:08 robert
* examples/osgtessellationshaders/osgtessellationshaders.cpp: From
Michael McDonnell, Merged enchancements to osgtesselationshader
example from OSG-svn/trunk to OSG-3.2 branch.
2015-03-01 11:08 robert
* src/osgGA/OrbitManipulator.cpp,
src/osgGA/StandardManipulator.cpp: From Jannik Heller, "I noticed
the rotation in the OrbitManipulator depends on the framerate. To
reproduce this issue, start the osganimate example, rotate the
model with the left mouse button, then let go of the mouse button
while still moving. You will notice that with V-Sync enabled, the
model rotates slower.
The OrbitManipulator calculates a scale to counteract the
framerate dependency, but it turns out this scale wasn't used for
the rotation yet."
2015-02-27 10:15 robert
* AUTHORS.txt, CMakeLists.txt, ChangeLog,
applications/osgversion/Contributors.cpp: Updated AUTHROS,
Controbitors and rc number in prep for the 3.2.2-rc1
2015-02-26 20:06 robert
* AUTHORS.txt, ChangeLog, applications/osgversion/Contributors.cpp:
Updated AUTHORS
2015-02-26 19:13 robert
* src/osg/Image.cpp: From Bradley Baker Searles, "We had someone
replace a DDS texture with a GL_RGB/GL_UNSIGNED_SHORT_5_6_6
image, which would trigger a crash in Image.cpp while flipping
the mipmap chain. The code was trying to flip the mipmaps using
the rowStep for the full-size image (we have "dds_flip" set in
the osgDB::ReaderWriter::Options in the osgDB::Registry)."
2015-02-26 18:07 robert
* src/osgPlugins/dds/ReaderWriterDDS.cpp: From Bradley Baker
Searles, "Small patch attached to handle DDS flip when s=4.
Currently it will omit flipping and generate a warning: "Vertical
flip was skipped. Image dimensions have to be multiple of 4."."
2015-02-26 14:16 robert
* src/osgPlugins/tiff/ReaderWriterTIFF.cpp: Fixed typo
2015-02-23 20:28 robert
* src/osg/TransferFunction.cpp: Fixed image allocation operations.
2015-02-23 11:07 robert
* src/osgViewer/StatsHandler.cpp: From Arjun Ramamurthy, fix for
StatsHandler when being used in multiple view/windows
2015-02-18 10:23 robert
* src/osgPlugins/dds/ReaderWriterDDS.cpp: From Sebastian
Messerschmidt,"Attached you find a version of the ReaderWriterDDS
with info outputs set to OSG_INFO instead of OSG_NOTICE. The old
version spams the console for each loaded DDS file."
2015-01-06 15:10 robert
* ChangeLog: Updated ChangeLog
2015-01-06 14:55 robert
* src/osgVolume/Property.cpp: From Julien Valentin, added missing
initializer
2015-01-06 14:41 robert
* src/osgWrappers/serializers/osgVolume/VolumeTechnique.cpp: From
Julien Valentin, typo fix
2014-12-22 10:35 robert
* CMakeLists.txt: Added comment about using
-DCMAKE_DISABLE_FINDPACKAGE_* command line.
2014-12-22 09:50 robert
* include/osg/ref_ptr: Added doxygen comment for
ref_ptr<>::release().
2014-12-18 15:59 robert
* CMakeLists.txt: From Mattias Helsing, "CMake have release 3.0 and
3.1 and we have some bad checks for cmake
major version when settings cmake policies in CMakeLists.txt.
This fixes it"
2014-12-18 11:37 robert
* applications/osgversion/Contributors.cpp: Updated AUTHORS
2014-12-18 09:20 robert
* PlatformSpecifics/Android/Application.mk.master.in: From Adrian
Clark, "Recently I tried compiling version 3.x of OpenSceneGraph
for Android, using a recent Android NDK, only to run into
problems with missing dependencies when trying to link my android
project against the generated libraries.
After some exploration, I found the problem is because the
APP_PLATFORM variable in Application.mk is set to a platform
number which is no longer compatible with the Android NDK by the
OSG CMake toolchain. This causes the Android to compile it using
the most recent Android platform libraries which (for reasons I
don't know) no longer provide functions which OSG relies (in
particular rand and stat64).
This bug affects the current SVN repos for OSG 3.3.1, OSG 3.3.0,
OSG 3.2.1 and OSG 3.2.0 (and possibly earlier).
I posted a longer discussion of what the problem is in this forum
thread:
http://forum.openscenegraph.org/viewtopic.php?p=62012#62012
But essentially the fix is to change one line in
OSG/PlatformSpecifics/Android/Application.mk.master.in from:
APP_PLATFORM := ${ANDROID_PLATFORM}
To
APP_PLATFORM := android-${ANDROID_PLATFORM}
The attached file will fix the bug in the 3.2.0 - 3.3.1 SVN repos
for OSG.
"
2014-12-10 11:30 robert
* src/osgPlugins/dae/daeRMaterials.cpp: From Farshid Lashkari, "The
Collada loader would crash while processing textures on certain
files. I've attached the fix."
2014-12-08 11:08 robert
* src/osgUtil/CullVisitor.cpp: Fixed memory leak in
RenderStageCache.
2014-11-26 17:07 robert
* applications/present3D/Cluster.h: Fixed warnigns
2014-11-26 17:07 robert
* applications/present3D/Cluster.cpp,
applications/present3D/Cluster.h: Removed redundent line endings
2014-11-26 16:29 robert
* src/osgPlugins/ffmpeg/CMakeLists.txt: Fixed deprecated warnings
2014-11-26 16:15 robert
* src/osgPlugins/pdf/CMakeLists.txt: Fixed warning
2014-11-26 16:07 robert
* examples/osgcluster/osgcluster.cpp: Fixed warnings
2014-11-26 16:06 robert
* examples/osgcluster/osgcluster.cpp: Removed redudent spaces
2014-11-26 16:02 robert
* src/osgPlugins/lwo/Object.cpp: Fixed warning
2014-11-24 15:24 robert
* CMakeLists.txt, CMakeModules/FindAVFoundation.cmake,
CMakeModules/FindQuickTime.cmake,
src/osgViewer/PixelBufferCocoa.mm: From Jan Klimke, "i noticed,
that there are a couple of additional flaws when building osg for
Mac OS X 10.10 Yosemite.
The mac os sdk version is recognized by the current CMAKE script
as 10.1 instead of 10.10 since it cuts the version string from
the 4th place. I introduced a more reliable version checking
based on splitting the returned version code into MAJOR MINOR and
PATCH parts and reassemble the OSG sdk version afterwards.
I replaced the existing CMake code against the following
(returning now version 10.10 as expected):
# Determine the canonical name of the selected Platform SDK
EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion"
OUTPUT_VARIABLE OSG_OSX_SDK_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REPLACE "." ";" MACOS_VERSION_LIST ${OSG_OSX_SDK_NAME})
LIST(GET MACOS_VERSION_LIST 0 MACOS_VERSION_MAJOR)
LIST(GET MACOS_VERSION_LIST 1 MACOS_VERSION_MINOR)
LIST(GET MACOS_VERSION_LIST 2 MACOS_VERSION_PATCH)
SET(OSG_OSX_SDK_NAME
"macosx${MACOS_VERSION_MAJOR}.${MACOS_VERSION_MINOR}")
Also i added the check for the new Version to some more find
scripts.
Additionally the nil object in Objective C now seems to be
equivalent with a null_ptr that cannot be passed as GLInt
anymore. So i switched this in the PixelBufferCocoa.mm to pass a
zero instead of nil.
"
2014-11-24 14:10 robert
* examples/osgsimplegl3/osgsimplegl3.cpp: Fixed handling of
viewer's Camera
2014-11-21 20:16 robert
* src/osgDB/CMakeLists.txt, src/osgDB/FileUtils.cpp: From Alberto
Luaces,"the current code uses the preprocessor for generating the
plugin path in
a way that when CMAKE_INSTALL_PREFIX contains something along the
lines
of
/usr/x86_64-linux-gnu/
it gets substituted as
/usr/x86_64-1-gnu/
that is, the string is preprocessed again, thereby making changes
to
anything that matches any defined symbol, as "linux" in this
example
(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763816).
Quoting that path directly in CMake scripts solves that problem.
"
2014-11-21 10:21 robert
* CMakeModules/CheckAtomicOps.cmake: From Björn Blissing, fix for
ambiguous defines in Atomic.cpp when compiling with MinGW and GCC
2014-11-21 09:28 robert
* applications/osgversion/Contributors.cpp: Copied Contributors
file from svn/trunk.
2014-11-20 17:37 robert
* include/osg/Texture: From Claus Steuer, "XCode 6, IOs 8.1 SDK
Compile fix : There are some undefined texture formats when
compiling osg for IOs 8.1 with XCode 6 and OpenGLES2 enabled."
2014-11-20 16:38 robert
* src/osgPlugins/obj/ReaderWriterOBJ.cpp: From Farshid Lashkari,
"The obj loader was overriding the existing database path list
with the file path of the model, instead of prepending the file
path to the path list. The latter seems to be more common
behavior for most of the existing loader plugins. Also, the local
options weren't actually being used when processing the scene
graph for textures. I've attached the fix for both issues."
2014-11-20 10:52 robert
* src/osgPlugins/Inventor/ConvertFromInventor.cpp: From Marc
Helbling, "here is a trivial fix in the Inventor plugin. In one
code path, the pointer validity is checked after dereferencing a
pointer that can be null (image->valid()) instead of calling
ref_ptr::valid (image.valid())."
2014-11-20 10:45 robert
* src/osgUtil/MeshOptimizers.cpp: From Marc Helbling, "I've come
across scenes that contains geometries with initialized but empty
vertex arrays and primitives and that would make some optimizers
crash.
The submission therefore only contains a test on the size of the
vertex array for the VertexCacheMissVisitor and the
VertexAccessOrderVisitor visitors."
2014-11-20 09:55 robert
* src/osgPlugins/3ds/ReaderWriter3DS.cpp: From Sukender, "Fix for
3DS reader, which may read wrong triangles. Actually, indices may
suffer a 'short int' overflow, in two places."
2014-11-20 09:41 robert
* src/osg/Texture2DArray.cpp: Fixed segfalt in Texture2DArray copy
constructor where it would apply images to an uninitialzed
vector.
2014-11-20 09:32 robert
* src/osgPlugins/fbx/fbxMaterialToOsgStateSet.cpp,
src/osgPlugins/fbx/fbxMaterialToOsgStateSet.h,
src/osgPlugins/fbx/fbxRMesh.cpp: From Marc Helbling, "patch
adding support for ambient material in the FBX plugin. It's a
straightfoward adaptation of the emissive support and has been
tested on a proprietary model."
2014-11-20 09:31 robert
* CMakeLists.txt: Added default setting of build type to Release
2014-11-20 09:21 robert
* src/osgPlugins/gif/ReaderWriterGIF.cpp: From Pjotr Svetachov, fix
for build breakage with giflib 5.0.
2014-11-19 17:31 robert
* applications/osgversion/Contributors.cpp: Fixed contributors
names
2014-11-19 17:31 robert
* src/osgPlugins/gif/ReaderWriterGIF.cpp: From Clement Boesch, "Fix
remaining bit of Giflib5 usage"
2014-11-19 11:37 robert
* src/osgWrappers/deprecated-dotosg/osg/ProxyNode.cpp: From Laurens
Voerman, "I found a new way to crach the osgviewer:
osgviewer "ProxyNode { FileNameList { cow.osgt } num_children 1
}".osgs
The proxy node reader wrongly assumes options to be non NULL.
fixed in attached zip:
src\osgWrappers\deprecated-dotosg\osg\ProxyNode.cpp
applies to both the 3.2 branch and svn trunk"
2014-11-04 16:29 robert
* src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp,
src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp: Build fixes for
ffmpeg LIBAVCODEC_VERSION_MAJOR >= 56
2014-08-19 09:27 robert
* src/osgPlugins/md2/ReaderWriterMD2.cpp: Fixed MD2 danglng pointer
crash.
2014-08-08 16:42 robert
* src/osgPlugins/txp/ReaderWriterTXP.cpp: From Ryan Kawicki, "There
is an issue where the model insets of a terrex terrain are being
removed during the loading process. The issue is described below.
- the issue here is that the plugin is removing group nodes if
that group node only has one child. becuase transforms are also
group nodes, there were cases when the transform would have only
one child under it and would cause it to remove the translation
portion. this would cause all the vertex data to be loaded around
the last matrix operation, which in our case was the origin
(0,0,0).
We work off of OSG 2.8.1 but see that this has not been addressed
on latest yet. Ive tested this against 2.8.1 and have cleanly
applied it to my local repository off of latest."
2014-08-08 16:34 robert
* src/osgUtil/RenderStage.cpp: From Tim George, "Currently there is
a problem with using a camera with a viewport with a non 0 offset
and also using an FBO. The problem is that only area made up of
the viewports width and height is drawn based on an offset of 0,0
instead of using the viewports offset.
It is caused by line 991 in RenderStage.cpp:
Code:
fbo_ext->glBlitFramebuffer(
0, 0, static_cast<GLint>(_viewport->width()),
static_cast<GLint>(_viewport->height()),
0, 0, static_cast<GLint>(_viewport->width()),
static_cast<GLint>(_viewport->height()),
blitMask, GL_NEAREST);
which is not taking into account the viewport x and y when
performing the blit. It probably should be:
Code:
fbo_ext->glBlitFramebuffer(
static_cast<GLint>(_viewport->x()),
static_cast<GLint>(_viewport->y()),
static_cast<GLint>(_viewport->width()) +
static_cast<GLint>(_viewport->x()),
static_cast<GLint>(_viewport->height()) +
static_cast<GLint>(_viewport->y()),
static_cast<GLint>(_viewport->x()),
static_cast<GLint>(_viewport->y()),
static_cast<GLint>(_viewport->width()) +
static_cast<GLint>(_viewport->x()),
static_cast<GLint>(_viewport->height()) +
static_cast<GLint>(_viewport->y()),
blitMask, GL_NEAREST);
"
Note from Robert Osfield, made small tweak to above on merge,
changing the width+x to x+width to make it read more naturally.
2014-08-08 16:09 robert
* src/osgUtil/MeshOptimizers.cpp: From Marc Helbling, "please find
a fix for the vertex pretransform visitor
(VertexAccessOrderVisitor).
The issue with current code is that arrays are collected *before*
duplicating shared arrays which leads to arrays that are
correctly duplicated but that are not reordered.
Also the submitted patch contains a small cleaning in
GeometryArrayGathrer as the _useDrawElements variable is not
used; it is only set in the GeometryArrayGathrer constructor and
VertexAccessOrderVisitor already checks that primitives have
indexed type."
2014-08-08 15:45 robert
* include/osg/Node: Applied fix to
Node::remove*Callback(NodeCallback*) inspired by fix from Glen
Waldron that was applied to svn/trunk.
2014-07-29 15:47 robert
* src/osgUtil/Optimizer.cpp: Added catch for NULL Transform
pointers getting into the _transformMap.
2014-07-22 16:35 robert
* include/osg/State, src/osg/State.cpp: Removed usage of
_appliedProgramObjectSet as it's no longer used by OSG
applications and was causing a threading crash.
2014-07-22 16:34 robert
* CMakeLists.txt, include/osg/Version: Updated version to 3.2.2
2014-07-21 13:45 robert
* src/osgText/Glyph.cpp: Added setting of glPixelStore before
glTexSubImage2D call.
2014-07-21 13:43 robert
* src/osgText/Glyph.cpp: I want to submit a bugfix for a crash
occurring in osgText/Glyph.cpp if
the scene tree contains (large) 2D textures from images with
STRIDE.
============================================================================
#0 0x00007fffe8ea4350 in __memmove_ssse3 () from /lib64/libc.so.6
#1 0x00007fffe52ced76 in ?? () from
/usr/lib64/libnvidia-glcore.so.310.44
#2 0x00007fffe52d8e86 in ?? () from
/usr/lib64/libnvidia-glcore.so.310.44
#3 0x00007fffe53dd8be in ?? () from
/usr/lib64/libnvidia-glcore.so.310.44
#4 0x00007fffe53c2643 in ?? () from
/usr/lib64/libnvidia-glcore.so.310.44
#5 0x00007fffe53c7fdd in ?? () from
/usr/lib64/libnvidia-glcore.so.310.44
#6 0x00007fffe53cbabf in ?? () from
/usr/lib64/libnvidia-glcore.so.310.44
#7 0x00007fffe53cc1fa in ?? () from
/usr/lib64/libnvidia-glcore.so.310.44
#8 0x00007ffff30092fd in osgText::GlyphTexture::apply
(this=0x1bb8cf0, state=
...)
at
/d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/src/osgText/Glyph.cpp:234
#9 0x00007ffff56c30b6 in osg::State::applyAttributeOnTexUnit
(this=0x125f180,
unit=0, attribute=0x1bb8cf0, as=...)
at
/d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/include/osg/State:1713
#10 0x00007ffff56c2f3f in osg::State::applyTextureAttribute
(this=0x125f180,
unit=0, attribute=0x1bb8cf0)
at
/d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/include/osg/State:411
#11 0x00007ffff30204da in osgText::Text::drawTextWithBackdrop
(this=0x1baed70,
state=..., colorMultiplier=...)
==============================================================================
The crash disappears if I either (1) disable the use of images
with stride
in the (public) osgGeo-library, or (2) add the following bugfix
to Glyph.cpp.
This combination gives me the confidence that I understand where
this problem
originates from, without trying to understand the full OpenGL
details.
===============================================================================
@@ -221,7 +223,12 @@
imageData[i] = 0;
}
+ glPixelStorei(GL_UNPACK_ALIGNMENT,1);
+ #if !defined(OSG_GLES1_AVAILABLE) &&
!defined(OSG_GLES2_AVAILABLE)
+ glPixelStorei(GL_UNPACK_ROW_LENGTH,getTextureWidth());
+ #endif
+
// allocate the texture memory.
glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA,
getTextureWidth(), getTextureHeight(), 0,
================================================================================
I have copied (and adapted) the added lines above from the same
source file,
where they were used in front of a similar call to
glTexSubImage2D(.) around
line 515."
2014-07-04 11:34 robert
* ChangeLog, README.txt: Updated ChangeLog and README for release
2014-07-04 11:29 robert 2014-07-04 11:29 robert
* CMakeLists.txt: Updated version number to 3.2.1 for release * CMakeLists.txt: Updated version number to 3.2.1 for release

View File

@@ -1,34 +1,6 @@
OSG News OSG News
======== ========
= OpenSceneGraph 3.2.2 maintance release provides a number of bug and build fixes over the 3.2.1 stable release
PERTHSHIRE, Scotland - 4th August 2015 - OpenSceneGraph Professional Services announces the release of OpenSceneGraph 3.2.2, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. OpenSceneGraph 3.2.2 is written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. OpenSceneGraph 3.2.2 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
=== Open-source development delivers industry-leading features and performance ===
The OpenSceneGraph 3.2.2 stable release is the culmination of 16 years of work by the open-source community that has grown up around the project. This point release is fully binary compatible with the 3.2.0 and 3.2.1 stable releases. The changes made are focused on addressing bugs and improving build support for latest compilers, OS updates and 3rd changes to Party Libraries.
=== Downloads and Licensing ===
OpenSceneGraph is open-source, so full source code is provided, and can be copied, modified and used free of charge for commercial and non-commercial use. Access to the source allows end users greater flexibility in how they develop, debug and deploy their applications. They gain productivity and freedom by being able to leverage the tool chain in accordance with their own release cycles. Downloads of binaries and source can be found in the [http://www.openscenegraph.org/index.php/download-section/stable-releases Downloads] section of the openscenegraph.org website.
OpenSceneGraph is released under the [http://www.openscenegraph.org/projects/osg/wiki/Legal OpenSceneGraph Public License], which is based on the Lesser GNU Public License (LGPL), permitting the software to be used free of charge across the full spectrum of commercial and open-source applications. Furthermore, it allows both static and dynamic linking of the OpenSceneGraph libraries without restricting the licensing of the user's software.
=== Professional support and services ===
OpenSceneGraph project is backed up with professional services by [http://www.openscenegraph.com OpenSceneGraph Professional Services], based in Scotland, and [http://www.alphapixel.com AlphaPixel] based in the USA, and a range of [wiki:Community/Contractors Contractors] from around the world. Services available include:
* Confidential Professional Support
* Bespoke development
* Consultancy
* Training
=== Community support and contributions ===
The diverse and growing community of over 5000 developers is centred around the public osg-users mailing list/forum, where members discuss how best to use OpenSceneGraph, provide mutual support, and coordinate development of new features and bug fixes. Members of this community come from many different countries with backgrounds ranging from some of the world's largest aerospace companies, game companies, and visual simulation specialists to university researchers, students and hobbyists.
The OpenSceneGraph project owes a great deal to the community for its development and support, in particular we wish to thank the [http://www.openscenegraph.org/index.php/about/197-contributors-to-openscenegraph-3-2-2 individuals] from around the world that have directly contributed to the development and refinement of the OpenSceneGraph code base.
= OpenSceneGraph 3.2.1 stable release provides a number of bug and build fixes to the 3.2.0 stable release = OpenSceneGraph 3.2.1 stable release provides a number of bug and build fixes to the 3.2.0 stable release
PERTHSHIRE, Scotland - 4th July 2014 - OpenSceneGraph Professional Services announces the release of OpenSceneGraph 3.2.1, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. OpenSceneGraph 3.2 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. OpenSceneGraph 3.2 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems. PERTHSHIRE, Scotland - 4th July 2014 - OpenSceneGraph Professional Services announces the release of OpenSceneGraph 3.2.1, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. OpenSceneGraph 3.2 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. OpenSceneGraph 3.2 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.

View File

@@ -4,7 +4,7 @@ APP_PROJECT_PATH := $(call my-dir)
APP_OPTIM := ${ANDROID_RELEASE_OPTIM} APP_OPTIM := ${ANDROID_RELEASE_OPTIM}
APP_PLATFORM := android-${ANDROID_PLATFORM} APP_PLATFORM := ${ANDROID_PLATFORM}
APP_STL := ${ANDROID_STL} APP_STL := ${ANDROID_STL}
APP_CPPFLAGS := -fexceptions -frtti APP_CPPFLAGS := -fexceptions -frtti
#APP_CPPFLAGS := -Os -mthumb-interwork -fno-short-enums #APP_CPPFLAGS := -Os -mthumb-interwork -fno-short-enums

View File

@@ -259,8 +259,7 @@ const char* invalidNames[] =
"VolumeTile", "VolumeTile",
"PushStackValueVisitor", "PushStackValueVisitor",
"RayIntersector", "RayIntersector",
"OpenSceneGraph-Data", "OpenSceneGraph-Data"
"Node"
}; };
@@ -353,7 +352,6 @@ TypoCorrection typoCorrections[] =
{"Krulthof", "Kruithof"}, {"Krulthof", "Kruithof"},
{"Lagrade", "Lagarde"}, {"Lagrade", "Lagarde"},
{"Largade", "Lagarde"}, {"Largade", "Lagarde"},
{"Largarde", "Lagarde"},
{"Larshkari", "Lashkari"}, {"Larshkari", "Lashkari"},
{"Lashakari", "Lashkari"}, {"Lashakari", "Lashkari"},
{"Lashari", "Lashkari"}, {"Lashari", "Lashkari"},
@@ -470,18 +468,7 @@ TypoCorrection typoCorrections[] =
{"Blessing","Blissing"}, {"Blessing","Blissing"},
{"Dannahuer","Dannhauer"}, {"Dannahuer","Dannhauer"},
{"Chebeav", "Chebaev"}, {"Chebeav", "Chebaev"},
{"Messershmidt","Messerschmidt"}, {"Messershmidt","Messerschmidt"}
{"Auelien","Aurelien"},
{"Aurélien","Aur<EFBFBD>lien"},
{"McDonnel","Mc Donnell"},
{"McDonnell","Mc Donnell"},
{"Delallée","Delall<EFBFBD>e"},
{"Gjøl","Gj<EFBFBD>l"},
{"Ravšelj","Rav<EFBFBD>elj"},
{"Ravsel", "Rav<EFBFBD>elj"},
{"Ravselj", "Rav<EFBFBD>elj"},
{"Janik", "Jannik"},
{"Viganò", "Vigan<EFBFBD>"}
}; };
@@ -589,8 +576,6 @@ NameCorrection nameCorrections[] =
"Melchior", "Franz"}, "Melchior", "Franz"},
{"Glen", "Waldon", {"Glen", "Waldon",
"Glenn", "Waldron"}, "Glenn", "Waldron"},
{"Glen", "Waldron",
"Glenn", "Waldron"},
{"Ralf", "Karn", {"Ralf", "Karn",
"Ralf", "Kern"}, "Ralf", "Kern"},
{"Donny", "Cipperly", {"Donny", "Cipperly",
@@ -652,17 +637,7 @@ NameCorrection nameCorrections[] =
{"Ricard", "Schmidt", {"Ricard", "Schmidt",
"Richard", "Schmidt"}, "Richard", "Schmidt"},
{"Matthias", "Helsing", {"Matthias", "Helsing",
"Mattias", "Helsing"}, "Mattias", "Helsing"}
{"Clement", "Boesch",
"Cl<EFBFBD>ment", "B<EFBFBD>sch"},
{"Lauren", "Voerman",
"Laurens", "Voerman"},
{"Pjotr", "Sventachov",
"Pjotr", "Svetachov"},
{"Bradley", "Baker",
"Bradley", "Baker Searles"},
{"PawelKsiezopolski", "",
"Pawel", "Ksiezopolski"}
}; };
@@ -994,9 +969,7 @@ void printContributors(const std::string& changeLog, bool printNumEntries)
cout << "-------------------------" << endl; cout << "-------------------------" << endl;
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr) for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
{ {
cout << sitr->first << "\t" << sitr->second.first; cout << sitr->first << "\t" << sitr->second.first << " " << sitr->second.second << endl;
if (!sitr->second.second.empty()) cout << " " << sitr->second.second;
cout << endl;
} }
} }
else else
@@ -1005,9 +978,7 @@ void printContributors(const std::string& changeLog, bool printNumEntries)
cout << "-----------------" << endl; cout << "-----------------" << endl;
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr) for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
{ {
cout << sitr->second.first; cout << sitr->second.first << " " << sitr->second.second << endl;
if (!sitr->second.second.empty()) cout << " " << sitr->second.second;
cout << endl;
} }
} }
} }

View File

@@ -1,12 +1,12 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield /* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
* *
* This software is open source and may be redistributed and/or modified under * This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0. * the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* include LICENSE.txt for more details. * include LICENSE.txt for more details.
*/ */
@@ -39,9 +39,9 @@
#elif defined(__sgi) #elif defined(__sgi)
#include <unistd.h> #include <unistd.h>
#include <net/soioctl.h> #include <net/soioctl.h>
#elif defined(__CYGWIN__) #elif defined(__CYGWIN__)
#include <unistd.h> #include <unistd.h>
#elif defined(__sun) #elif defined(__sun)
#include <unistd.h> #include <unistd.h>
#include <sys/sockio.h> #include <sys/sockio.h>
#elif defined (__APPLE__) #elif defined (__APPLE__)
@@ -249,7 +249,7 @@ void CameraPacket::writeEventQueue(osgViewer::Viewer& viewer)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// Reciever // Reciever
// //
Receiver::Receiver( void ) Receiver::Receiver( void )
{ {
@@ -338,7 +338,7 @@ void Receiver::sync( void )
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \ #if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \
defined(__DragonFly__) defined(__DragonFly__)
socklen_t socklen_t
#else #else
int int
#endif #endif
@@ -381,7 +381,7 @@ void Receiver::sync( void )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// Broadcaster // Broadcaster
// //
Broadcaster::Broadcaster( void ) Broadcaster::Broadcaster( void )
{ {

View File

@@ -1,12 +1,12 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield /* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
* *
* This software is open source and may be redistributed and/or modified under * This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0. * the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* include LICENSE.txt for more details. * include LICENSE.txt for more details.
*/ */
@@ -29,7 +29,7 @@
// //
// Class definition for the recipient of a broadcasted message // Class definition for the recipient of a broadcasted message
// //
class Receiver class Receiver
{ {
public : public :
@@ -68,7 +68,7 @@ class Receiver
// //
// Class definition for broadcasting a buffer to a LAN // Class definition for broadcasting a buffer to a LAN
// //
class Broadcaster class Broadcaster
{ {
public : public :
@@ -84,7 +84,7 @@ class Broadcaster
// Set a recipient host. If this is used, the Broadcaster // Set a recipient host. If this is used, the Broadcaster
// no longer broadcasts, but rather directs UDP packets at // no longer broadcasts, but rather directs UDP packets at
// host. // host.
void setHost( const char *hostname ); void setHost( const char *hostname );
// Sync broadcasts the buffer // Sync broadcasts the buffer
void sync( void ); void sync( void );
@@ -112,15 +112,15 @@ class Broadcaster
class CameraPacket { class CameraPacket {
public: public:
static const unsigned int MAX_NUM_EVENTS; static const unsigned int MAX_NUM_EVENTS;
static const unsigned int SWAP_BYTES_COMPARE; static const unsigned int SWAP_BYTES_COMPARE;
CameraPacket():_masterKilled(false) CameraPacket():_masterKilled(false)
{ {
_byte_order = SWAP_BYTES_COMPARE; _byte_order = SWAP_BYTES_COMPARE;
} }
void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp) void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp)
{ {
_matrix = matrix; _matrix = matrix;
@@ -129,20 +129,20 @@ class CameraPacket {
_frameStamp = *frameStamp; _frameStamp = *frameStamp;
} }
} }
void getModelView(osg::Matrix& matrix,float angle_offset=0.0f) void getModelView(osg::Matrix& matrix,float angle_offset=0.0f)
{ {
matrix = _matrix * osg::Matrix::rotate(osg::DegreesToRadians(angle_offset),0.0f,1.0f,0.0f); matrix = _matrix * osg::Matrix::rotate(osg::DegreesToRadians(angle_offset),0.0f,1.0f,0.0f);
} }
void readEventQueue(osgViewer::Viewer& viewer); void readEventQueue(osgViewer::Viewer& viewer);
void writeEventQueue(osgViewer::Viewer& viewer); void writeEventQueue(osgViewer::Viewer& viewer);
void setMasterKilled(const bool flag) { _masterKilled = flag; } void setMasterKilled(const bool flag) { _masterKilled = flag; }
const bool getMasterKilled() const { return _masterKilled; } const bool getMasterKilled() const { return _masterKilled; }
unsigned int _byte_order; unsigned int _byte_order;
bool _masterKilled; bool _masterKilled;
osg::Matrix _matrix; osg::Matrix _matrix;
@@ -150,11 +150,11 @@ class CameraPacket {
// note don't use a ref_ptr as used elsewhere for FrameStamp // note don't use a ref_ptr as used elsewhere for FrameStamp
// since we don't want to copy the pointer - but the memory. // since we don't want to copy the pointer - but the memory.
// FrameStamp doesn't have a private destructor to allow // FrameStamp doesn't have a private destructor to allow
// us to do this, even though its a reference counted object. // us to do this, even though its a reference counted object.
osg::FrameStamp _frameStamp; osg::FrameStamp _frameStamp;
osgGA::EventQueue::Events _events; osgGA::EventQueue::Events _events;
}; };
class DataConverter class DataConverter
@@ -186,22 +186,22 @@ class DataConverter
{ {
if (_currentPtr+1>=_endPtr) return; if (_currentPtr+1>=_endPtr) return;
*(_currentPtr++) = *(ptr); *(_currentPtr++) = *(ptr);
} }
inline void read1(char* ptr) inline void read1(char* ptr)
{ {
if (_currentPtr+1>=_endPtr) return; if (_currentPtr+1>=_endPtr) return;
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
inline void write2(char* ptr) inline void write2(char* ptr)
{ {
if (_currentPtr+2>=_endPtr) return; if (_currentPtr+2>=_endPtr) return;
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr); *(_currentPtr++) = *(ptr);
} }
inline void read2(char* ptr) inline void read2(char* ptr)
@@ -210,13 +210,13 @@ class DataConverter
if (_swapBytes) if (_swapBytes)
{ {
*(ptr+1) = *(_currentPtr++); *(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
else else
{ {
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
} }
@@ -224,10 +224,10 @@ class DataConverter
{ {
if (_currentPtr+4>=_endPtr) return; if (_currentPtr+4>=_endPtr) return;
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr); *(_currentPtr++) = *(ptr);
} }
inline void read4(char* ptr) inline void read4(char* ptr)
@@ -236,17 +236,17 @@ class DataConverter
if (_swapBytes) if (_swapBytes)
{ {
*(ptr+3) = *(_currentPtr++); *(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++); *(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++); *(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
else else
{ {
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
} }
@@ -254,15 +254,15 @@ class DataConverter
{ {
if (_currentPtr+8>=_endPtr) return; if (_currentPtr+8>=_endPtr) return;
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr); *(_currentPtr++) = *(ptr);
} }
inline void read8(char* ptr) inline void read8(char* ptr)
@@ -272,27 +272,27 @@ class DataConverter
if (_swapBytes) if (_swapBytes)
{ {
*(ptr+7) = *(_currentPtr++); *(ptr+7) = *(_currentPtr++);
*(ptr+6) = *(_currentPtr++); *(ptr+6) = *(_currentPtr++);
*(ptr+5) = *(_currentPtr++); *(ptr+5) = *(_currentPtr++);
*(ptr+4) = *(_currentPtr++); *(ptr+4) = *(_currentPtr++);
*(ptr+3) = *(_currentPtr++); *(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++); *(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++); *(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
else else
{ {
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
} }
@@ -305,14 +305,14 @@ class DataConverter
inline void writeFloat(float c) { write4((char*)&c); } inline void writeFloat(float c) { write4((char*)&c); }
inline void writeDouble(double c) { write8((char*)&c); } inline void writeDouble(double c) { write8((char*)&c); }
inline char readChar() { char c=0; read1(&c); return c; } inline char readChar() { char c; read1(&c); return c; }
inline unsigned char readUChar() { unsigned char c=0; read1((char*)&c); return c; } inline unsigned char readUChar() { unsigned char c; read1((char*)&c); return c; }
inline short readShort() { short c=0; read2((char*)&c); return c; } inline short readShort() { short c; read2((char*)&c); return c; }
inline unsigned short readUShort() { unsigned short c=0; read2((char*)&c); return c; } inline unsigned short readUShort() { unsigned short c; read2((char*)&c); return c; }
inline int readInt() { int c=0; read4((char*)&c); return c; } inline int readInt() { int c; read4((char*)&c); return c; }
inline unsigned int readUInt() { unsigned int c=0; read4((char*)&c); return c; } inline unsigned int readUInt() { unsigned int c; read4((char*)&c); return c; }
inline float readFloat() { float c=0.0f; read4((char*)&c); return c; } inline float readFloat() { float c; read4((char*)&c); return c; }
inline double readDouble() { double c=0.0; read8((char*)&c); return c; } inline double readDouble() { double c; read8((char*)&c); return c; }
void write(const osg::FrameStamp& fs); void write(const osg::FrameStamp& fs);
void read(osg::FrameStamp& fs); void read(osg::FrameStamp& fs);
@@ -322,13 +322,13 @@ class DataConverter
void write(const osgGA::GUIEventAdapter& event); void write(const osgGA::GUIEventAdapter& event);
void read(osgGA::GUIEventAdapter& event); void read(osgGA::GUIEventAdapter& event);
void write(CameraPacket& cameraPacket); void write(CameraPacket& cameraPacket);
void read(CameraPacket& cameraPacket); void read(CameraPacket& cameraPacket);
char* startPtr() { return _startPtr; } char* startPtr() { return _startPtr; }
unsigned int numBytes() { return _numBytes; } unsigned int numBytes() { return _numBytes; }
protected: protected:
char* _startPtr; char* _startPtr;
@@ -341,4 +341,4 @@ class DataConverter
#endif #endif

View File

@@ -48,13 +48,13 @@ const unsigned int MAX_NUM_EVENTS = 10;
const unsigned int SWAP_BYTES_COMPARE = 0x12345678; const unsigned int SWAP_BYTES_COMPARE = 0x12345678;
class CameraPacket { class CameraPacket {
public: public:
CameraPacket():_masterKilled(false) CameraPacket():_masterKilled(false)
{ {
_byte_order = SWAP_BYTES_COMPARE; _byte_order = SWAP_BYTES_COMPARE;
} }
void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp) void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp)
{ {
_matrix = matrix; _matrix = matrix;
@@ -63,20 +63,20 @@ class CameraPacket {
_frameStamp = *frameStamp; _frameStamp = *frameStamp;
} }
} }
void getModelView(osg::Matrix& matrix,float angle_offset=0.0f) void getModelView(osg::Matrix& matrix,float angle_offset=0.0f)
{ {
matrix = _matrix * osg::Matrix::rotate(osg::DegreesToRadians(angle_offset),0.0f,1.0f,0.0f); matrix = _matrix * osg::Matrix::rotate(osg::DegreesToRadians(angle_offset),0.0f,1.0f,0.0f);
} }
void readEventQueue(osgViewer::Viewer& viewer); void readEventQueue(osgViewer::Viewer& viewer);
void writeEventQueue(osgViewer::Viewer& viewer); void writeEventQueue(osgViewer::Viewer& viewer);
void setMasterKilled(const bool flag) { _masterKilled = flag; } void setMasterKilled(const bool flag) { _masterKilled = flag; }
const bool getMasterKilled() const { return _masterKilled; } const bool getMasterKilled() const { return _masterKilled; }
unsigned int _byte_order; unsigned int _byte_order;
bool _masterKilled; bool _masterKilled;
osg::Matrix _matrix; osg::Matrix _matrix;
@@ -84,11 +84,11 @@ class CameraPacket {
// note don't use a ref_ptr as used elsewhere for FrameStamp // note don't use a ref_ptr as used elsewhere for FrameStamp
// since we don't want to copy the pointer - but the memory. // since we don't want to copy the pointer - but the memory.
// FrameStamp doesn't have a private destructor to allow // FrameStamp doesn't have a private destructor to allow
// us to do this, even though its a reference counted object. // us to do this, even though its a reference counted object.
osg::FrameStamp _frameStamp; osg::FrameStamp _frameStamp;
osgGA::EventQueue::Events _events; osgGA::EventQueue::Events _events;
}; };
class DataConverter class DataConverter
@@ -112,7 +112,7 @@ class DataConverter
bool _swapBytes; bool _swapBytes;
char* _currentPtr; char* _currentPtr;
void reset() void reset()
{ {
_currentPtr = _startPtr; _currentPtr = _startPtr;
@@ -122,22 +122,22 @@ class DataConverter
{ {
if (_currentPtr+1>=_endPtr) return; if (_currentPtr+1>=_endPtr) return;
*(_currentPtr++) = *(ptr); *(_currentPtr++) = *(ptr);
} }
inline void read1(char* ptr) inline void read1(char* ptr)
{ {
if (_currentPtr+1>=_endPtr) return; if (_currentPtr+1>=_endPtr) return;
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
inline void write2(char* ptr) inline void write2(char* ptr)
{ {
if (_currentPtr+2>=_endPtr) return; if (_currentPtr+2>=_endPtr) return;
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr); *(_currentPtr++) = *(ptr);
} }
inline void read2(char* ptr) inline void read2(char* ptr)
@@ -146,13 +146,13 @@ class DataConverter
if (_swapBytes) if (_swapBytes)
{ {
*(ptr+1) = *(_currentPtr++); *(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
else else
{ {
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
} }
@@ -160,10 +160,10 @@ class DataConverter
{ {
if (_currentPtr+4>=_endPtr) return; if (_currentPtr+4>=_endPtr) return;
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr); *(_currentPtr++) = *(ptr);
} }
inline void read4(char* ptr) inline void read4(char* ptr)
@@ -172,17 +172,17 @@ class DataConverter
if (_swapBytes) if (_swapBytes)
{ {
*(ptr+3) = *(_currentPtr++); *(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++); *(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++); *(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
else else
{ {
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
} }
@@ -190,15 +190,15 @@ class DataConverter
{ {
if (_currentPtr+8>=_endPtr) return; if (_currentPtr+8>=_endPtr) return;
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr); *(_currentPtr++) = *(ptr);
} }
inline void read8(char* ptr) inline void read8(char* ptr)
@@ -208,27 +208,27 @@ class DataConverter
if (_swapBytes) if (_swapBytes)
{ {
*(ptr+7) = *(_currentPtr++); *(ptr+7) = *(_currentPtr++);
*(ptr+6) = *(_currentPtr++); *(ptr+6) = *(_currentPtr++);
*(ptr+5) = *(_currentPtr++); *(ptr+5) = *(_currentPtr++);
*(ptr+4) = *(_currentPtr++); *(ptr+4) = *(_currentPtr++);
*(ptr+3) = *(_currentPtr++); *(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++); *(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++); *(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
else else
{ {
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
} }
@@ -241,14 +241,14 @@ class DataConverter
inline void writeFloat(float c) { write4((char*)&c); } inline void writeFloat(float c) { write4((char*)&c); }
inline void writeDouble(double c) { write8((char*)&c); } inline void writeDouble(double c) { write8((char*)&c); }
inline char readChar() { char c=0; read1(&c); return c; } inline char readChar() { char c; read1(&c); return c; }
inline unsigned char readUChar() { unsigned char c=0; read1((char*)&c); return c; } inline unsigned char readUChar() { unsigned char c; read1((char*)&c); return c; }
inline short readShort() { short c=0; read2((char*)&c); return c; } inline short readShort() { short c; read2((char*)&c); return c; }
inline unsigned short readUShort() { unsigned short c=0; read2((char*)&c); return c; } inline unsigned short readUShort() { unsigned short c; read2((char*)&c); return c; }
inline int readInt() { int c=0; read4((char*)&c); return c; } inline int readInt() { int c; read4((char*)&c); return c; }
inline unsigned int readUInt() { unsigned int c=0; read4((char*)&c); return c; } inline unsigned int readUInt() { unsigned int c; read4((char*)&c); return c; }
inline float readFloat() { float c=0.0f; read4((char*)&c); return c; } inline float readFloat() { float c; read4((char*)&c); return c; }
inline double readDouble() { double c=0.0; read8((char*)&c); return c; } inline double readDouble() { double c; read8((char*)&c); return c; }
void write(const osg::FrameStamp& fs) void write(const osg::FrameStamp& fs)
{ {
@@ -361,16 +361,16 @@ class DataConverter
event.setModKeyMask(readUInt()); event.setModKeyMask(readUInt());
event.setTime(readDouble()); event.setTime(readDouble());
} }
void write(CameraPacket& cameraPacket) void write(CameraPacket& cameraPacket)
{ {
writeUInt(cameraPacket._byte_order); writeUInt(cameraPacket._byte_order);
writeUInt(cameraPacket._masterKilled); writeUInt(cameraPacket._masterKilled);
write(cameraPacket._matrix); write(cameraPacket._matrix);
write(cameraPacket._frameStamp); write(cameraPacket._frameStamp);
writeUInt(cameraPacket._events.size()); writeUInt(cameraPacket._events.size());
for(osgGA::EventQueue::Events::iterator itr = cameraPacket._events.begin(); for(osgGA::EventQueue::Events::iterator itr = cameraPacket._events.begin();
itr != cameraPacket._events.end(); itr != cameraPacket._events.end();
@@ -387,12 +387,12 @@ class DataConverter
{ {
_swapBytes = !_swapBytes; _swapBytes = !_swapBytes;
} }
cameraPacket._masterKilled = readUInt()!=0; cameraPacket._masterKilled = readUInt()!=0;
read(cameraPacket._matrix); read(cameraPacket._matrix);
read(cameraPacket._frameStamp); read(cameraPacket._frameStamp);
cameraPacket._events.clear(); cameraPacket._events.clear();
unsigned int numEvents = readUInt(); unsigned int numEvents = readUInt();
for(unsigned int i=0;i<numEvents;++i) for(unsigned int i=0;i<numEvents;++i)
@@ -409,7 +409,7 @@ void CameraPacket::readEventQueue(osgViewer::Viewer& viewer)
_events.clear(); _events.clear();
osgViewer::ViewerBase::Contexts contexts; osgViewer::ViewerBase::Contexts contexts;
viewer.getContexts(contexts); viewer.getContexts(contexts);
for(osgViewer::ViewerBase::Contexts::iterator citr =contexts.begin(); citr != contexts.end(); ++citr) for(osgViewer::ViewerBase::Contexts::iterator citr =contexts.begin(); citr != contexts.end(); ++citr)
{ {
@@ -423,7 +423,7 @@ void CameraPacket::readEventQueue(osgViewer::Viewer& viewer)
} }
_events.insert(_events.end(), gw_events.begin(), gw_events.end()); _events.insert(_events.end(), gw_events.begin(), gw_events.end());
} }
viewer.getEventQueue()->copyEvents(_events); viewer.getEventQueue()->copyEvents(_events);
osg::notify(osg::INFO)<<"written events = "<<_events.size()<<std::endl; osg::notify(osg::INFO)<<"written events = "<<_events.size()<<std::endl;
@@ -449,7 +449,7 @@ int main( int argc, char **argv )
{ {
// use an ArgumentParser object to manage the program arguments. // use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates how to approach implementation of clustering."); arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates how to approach implementation of clustering.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
@@ -459,7 +459,7 @@ int main( int argc, char **argv )
arguments.getApplicationUsage()->addCommandLineOption("-n <int>","Socket number to transmit packets"); arguments.getApplicationUsage()->addCommandLineOption("-n <int>","Socket number to transmit packets");
arguments.getApplicationUsage()->addCommandLineOption("-f <float>","Field of view of camera"); arguments.getApplicationUsage()->addCommandLineOption("-f <float>","Field of view of camera");
arguments.getApplicationUsage()->addCommandLineOption("-o <float>","Offset angle of camera"); arguments.getApplicationUsage()->addCommandLineOption("-o <float>","Offset angle of camera");
// construct the viewer. // construct the viewer.
osgViewer::Viewer viewer; osgViewer::Viewer viewer;
@@ -468,12 +468,12 @@ int main( int argc, char **argv )
ViewerMode viewerMode = STAND_ALONE; ViewerMode viewerMode = STAND_ALONE;
while (arguments.read("-m")) viewerMode = MASTER; while (arguments.read("-m")) viewerMode = MASTER;
while (arguments.read("-s")) viewerMode = SLAVE; while (arguments.read("-s")) viewerMode = SLAVE;
int socketNumber=8100; int socketNumber=8100;
while (arguments.read("-n",socketNumber)) ; while (arguments.read("-n",socketNumber)) ;
float camera_fov=-1.0f; float camera_fov=-1.0f;
while (arguments.read("-f",camera_fov)) while (arguments.read("-f",camera_fov))
{ {
} }
@@ -497,7 +497,7 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout); arguments.writeErrorMessages(std::cout);
return 1; return 1;
} }
if (arguments.argc()<=1) if (arguments.argc()<=1)
{ {
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
@@ -514,13 +514,13 @@ int main( int argc, char **argv )
{ {
double fovy, aspectRatio, zNear, zFar; double fovy, aspectRatio, zNear, zFar;
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar); viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
double original_fov = atan(tan(osg::DegreesToRadians(fovy)*0.5)*aspectRatio)*2.0; double original_fov = atan(tan(osg::DegreesToRadians(fovy)*0.5)*aspectRatio)*2.0;
std::cout << "setting lens perspective : original "<<original_fov<<" "<<fovy<<std::endl; std::cout << "setting lens perspective : original "<<original_fov<<" "<<fovy<<std::endl;
fovy = atan(tan(osg::DegreesToRadians(camera_fov)*0.5)/aspectRatio)*2.0; fovy = atan(tan(osg::DegreesToRadians(camera_fov)*0.5)/aspectRatio)*2.0;
viewer.getCamera()->setProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar); viewer.getCamera()->setProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar); viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
original_fov = atan(tan(osg::DegreesToRadians(fovy)*0.5)*aspectRatio)*2.0; original_fov = atan(tan(osg::DegreesToRadians(fovy)*0.5)*aspectRatio)*2.0;
std::cout << "setting lens perspective : new "<<original_fov<<" "<<fovy<<std::endl; std::cout << "setting lens perspective : new "<<original_fov<<" "<<fovy<<std::endl;
@@ -549,13 +549,13 @@ int main( int argc, char **argv )
rc.setPort(static_cast<short int>(socketNumber)); rc.setPort(static_cast<short int>(socketNumber));
bool masterKilled = false; bool masterKilled = false;
DataConverter scratchPad(1024); DataConverter scratchPad(1024);
while( !viewer.done() && !masterKilled ) while( !viewer.done() && !masterKilled )
{ {
osg::Timer_t startTick = osg::Timer::instance()->tick(); osg::Timer_t startTick = osg::Timer::instance()->tick();
viewer.advance(); viewer.advance();
// special handling for working as a cluster. // special handling for working as a cluster.
@@ -563,12 +563,12 @@ int main( int argc, char **argv )
{ {
case(MASTER): case(MASTER):
{ {
// take camera zero as the guide. // take camera zero as the guide.
osg::Matrix modelview(viewer.getCamera()->getViewMatrix()); osg::Matrix modelview(viewer.getCamera()->getViewMatrix());
cp->setPacket(modelview,viewer.getFrameStamp()); cp->setPacket(modelview,viewer.getFrameStamp());
cp->readEventQueue(viewer); cp->readEventQueue(viewer);
scratchPad.reset(); scratchPad.reset();
@@ -578,11 +578,11 @@ int main( int argc, char **argv )
scratchPad.read(*cp); scratchPad.read(*cp);
bc.setBuffer(scratchPad._startPtr, scratchPad._numBytes); bc.setBuffer(scratchPad._startPtr, scratchPad._numBytes);
std::cout << "bc.sync()"<<scratchPad._numBytes<<std::endl; std::cout << "bc.sync()"<<scratchPad._numBytes<<std::endl;
bc.sync(); bc.sync();
} }
break; break;
case(SLAVE): case(SLAVE):
@@ -591,13 +591,13 @@ int main( int argc, char **argv )
rc.setBuffer(scratchPad._startPtr, scratchPad._numBytes); rc.setBuffer(scratchPad._startPtr, scratchPad._numBytes);
rc.sync(); rc.sync();
scratchPad.reset(); scratchPad.reset();
scratchPad.read(*cp); scratchPad.read(*cp);
cp->writeEventQueue(viewer); cp->writeEventQueue(viewer);
if (cp->getMasterKilled()) if (cp->getMasterKilled())
{ {
std::cout << "Received master killed."<<std::endl; std::cout << "Received master killed."<<std::endl;
// break out of while (!done) loop since we've now want to shut down. // break out of while (!done) loop since we've now want to shut down.
@@ -609,9 +609,9 @@ int main( int argc, char **argv )
// no need to anything here, just a normal interactive viewer. // no need to anything here, just a normal interactive viewer.
break; break;
} }
osg::Timer_t endTick = osg::Timer::instance()->tick(); osg::Timer_t endTick = osg::Timer::instance()->tick();
osg::notify(osg::INFO)<<"Time to do cluster sync "<<osg::Timer::instance()->delta_m(startTick,endTick)<<std::endl; osg::notify(osg::INFO)<<"Time to do cluster sync "<<osg::Timer::instance()->delta_m(startTick,endTick)<<std::endl;
// update the scene by traversing it with the the update visitor which will // update the scene by traversing it with the the update visitor which will
@@ -623,14 +623,14 @@ int main( int argc, char **argv )
{ {
osg::Matrix modelview; osg::Matrix modelview;
cp->getModelView(modelview,camera_offset); cp->getModelView(modelview,camera_offset);
viewer.getCamera()->setViewMatrix(modelview); viewer.getCamera()->setViewMatrix(modelview);
} }
// fire off the cull and draw traversals of the scene. // fire off the cull and draw traversals of the scene.
if(!masterKilled) if(!masterKilled)
viewer.renderingTraversals(); viewer.renderingTraversals();
} }
// if we are master clean up by telling all slaves that we're going down. // if we are master clean up by telling all slaves that we're going down.
@@ -638,7 +638,7 @@ int main( int argc, char **argv )
{ {
// need to broadcast my death. // need to broadcast my death.
cp->setPacket(osg::Matrix::identity(),viewer.getFrameStamp()); cp->setPacket(osg::Matrix::identity(),viewer.getFrameStamp());
cp->setMasterKilled(true); cp->setMasterKilled(true);
scratchPad.reset(); scratchPad.reset();
scratchPad.write(*cp); scratchPad.write(*cp);

View File

@@ -20,7 +20,7 @@
void configureShaders( osg::StateSet* stateSet ) void configureShaders( osg::StateSet* stateSet )
{ {
const std::string vertexSource = const std::string vertexSource =
"#version 140 \n" "#version 140 \n"
" \n" " \n"
"uniform mat4 osg_ModelViewProjectionMatrix; \n" "uniform mat4 osg_ModelViewProjectionMatrix; \n"
@@ -41,7 +41,7 @@ void configureShaders( osg::StateSet* stateSet )
"} \n"; "} \n";
osg::Shader* vShader = new osg::Shader( osg::Shader::VERTEX, vertexSource ); osg::Shader* vShader = new osg::Shader( osg::Shader::VERTEX, vertexSource );
const std::string fragmentSource = const std::string fragmentSource =
"#version 140 \n" "#version 140 \n"
" \n" " \n"
"in vec4 color; \n" "in vec4 color; \n"
@@ -90,16 +90,16 @@ int main( int argc, char** argv )
return( 1 ); return( 1 );
} }
osgViewer::Viewer viewer;
// Create a Camera that uses the above OpenGL context. // Create a Camera that uses the above OpenGL context.
osg::Camera* cam = viewer.getCamera(); osg::Camera* cam = new osg::Camera;
cam->setGraphicsContext( gc.get() ); cam->setGraphicsContext( gc.get() );
// Must set perspective projection for fovy and aspect. // Must set perspective projection for fovy and aspect.
cam->setProjectionMatrix( osg::Matrix::perspective( 30., (double)width/(double)height, 1., 100. ) ); cam->setProjectionMatrix( osg::Matrix::perspective( 30., (double)width/(double)height, 1., 100. ) );
// Unlike OpenGL, OSG viewport does *not* default to window dimensions. // Unlike OpenGL, OSG viewport does *not* default to window dimensions.
cam->setViewport( new osg::Viewport( 0, 0, width, height ) ); cam->setViewport( new osg::Viewport( 0, 0, width, height ) );
osgViewer::Viewer viewer;
viewer.setCamera( cam );
viewer.setSceneData( root ); viewer.setSceneData( root );
// for non GL3/GL4 and non GLES2 platforms we need enable the osg_ uniforms that the shaders will use, // for non GL3/GL4 and non GLES2 platforms we need enable the osg_ uniforms that the shaders will use,
@@ -118,7 +118,7 @@ OSG currently support OpenGL 3.x on Windows. This comment block describes the
necessary configuration steps. necessary configuration steps.
Get the draft gl3.h header file from OpenGL.org and put it in a folder called Get the draft gl3.h header file from OpenGL.org and put it in a folder called
GL3 somewhere on your hard drive. OSG includes this header as <GL3/gl3.h>. Get <EFBFBD>GL3<EFBFBD> somewhere on your hard drive. OSG includes this header as <GL3/gl3.h>. Get
gl3.h from here: gl3.h from here:
http://www.opengl.org/registry/ http://www.opengl.org/registry/
@@ -128,7 +128,7 @@ several changes.
* Add the path to <GL3/gl3.h> to the CMake compiler flags, CMAKE_CXX_FLAGS and * Add the path to <GL3/gl3.h> to the CMake compiler flags, CMAKE_CXX_FLAGS and
CMAKE_CXX_FLAGS_DEBUG (for release and debug builds; others if you use other CMAKE_CXX_FLAGS_DEBUG (for release and debug builds; others if you use other
build configurations). The text to add should look something like this: build configurations). The text to add should look something like this:
/I C:\GLHeader /I <EFBFBD>C:\GLHeader<EFBFBD>
The folder GLHeader should contain a subfolder GL3, which in turn contains The folder GLHeader should contain a subfolder GL3, which in turn contains
gl3.h. gl3.h.

View File

@@ -1,13 +1,6 @@
/* A demonstration of Tessellation Shaders in OpenScenegraph. /* 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.
*
* Original code by Philip Rideout * Original code by Philip Rideout
* Adapted to OpenScenegraph by John Kaniarz * Adapted to OpenScenegraph by John Kaniarz
* Additional work by Michael Mc Donnell
*/ */
#include <osg/Program> #include <osg/Program>
@@ -120,8 +113,7 @@ static const char* fragSource = {
"}\n" "}\n"
}; };
osg::ref_ptr<osg::Geode> CreateIcosahedron(osg::Program *program) osg::ref_ptr<osg::Geode> CreateIcosahedron(osg::Program *program){
{
osg::Geode *geode=new osg::Geode(); osg::Geode *geode=new osg::Geode();
osg::Geometry *geometry = new osg::Geometry(); osg::Geometry *geometry = new osg::Geometry();
const unsigned int Faces[] = { const unsigned int Faces[] = {
@@ -171,16 +163,10 @@ osg::ref_ptr<osg::Geode> CreateIcosahedron(osg::Program *program)
geometry->setVertexArray(vertices); geometry->setVertexArray(vertices);
geometry->addPrimitiveSet(new osg::DrawElementsUInt(osg::PrimitiveSet::PATCHES,IndexCount,Faces)); geometry->addPrimitiveSet(new osg::DrawElementsUInt(osg::PrimitiveSet::PATCHES,IndexCount,Faces));
// Expand the bounding box, otherwise the geometry is clipped in front when tessellating.
osg::BoundingBox bbox(osg::Vec3(-1.0f, -1.9f, -1.0f), osg::Vec3(1.0f, 1.0f, 1.0f));
geometry->setInitialBound(bbox);
geode->addDrawable(geometry); geode->addDrawable(geometry);
return geode; return geode;
} }
osg::ref_ptr<osg::Program> createProgram(){
osg::ref_ptr<osg::Program> createProgram()
{
osg::Program *program = new osg::Program(); osg::Program *program = new osg::Program();
program->addShader(new osg::Shader(osg::Shader::VERTEX,vertSource)); program->addShader(new osg::Shader(osg::Shader::VERTEX,vertSource));
program->addShader(new osg::Shader(osg::Shader::TESSCONTROL,tessControlSource)); program->addShader(new osg::Shader(osg::Shader::TESSCONTROL,tessControlSource));
@@ -193,74 +179,38 @@ osg::ref_ptr<osg::Program> createProgram()
return program; return program;
} }
class KeyboardEventHandler : public osgGA::GUIEventHandler float tessInner=1.0f;
{ float tessOuter=1.0f;
public: osg::ref_ptr<osg::Uniform> tessInnerU = new osg::Uniform("TessLevelInner",tessInner);
KeyboardEventHandler(osg::ref_ptr<osg::Uniform> tessInnerU, osg::ref_ptr<osg::Uniform> tessOuterU): osg::ref_ptr<osg::Uniform> tessOuterU = new osg::Uniform("TessLevelOuter",tessOuter);
_tessInnerU(tessInnerU),
_tessOuterU(tessOuterU)
{
tessInnerU->get(_tessInner);
tessOuterU->get(_tessOuter);
}
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& gaa) class KeyboardEventHandler : public osgGA::GUIEventHandler {
{ public:
KeyboardEventHandler():osgGA::GUIEventHandler(){}
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& gaa){
if(ea.getEventType()==osgGA::GUIEventAdapter::KEYDOWN){ if(ea.getEventType()==osgGA::GUIEventAdapter::KEYDOWN){
switch (ea.getKey()){ switch (ea.getKey()){
case osgGA::GUIEventAdapter::KEY_Up: case osgGA::GUIEventAdapter::KEY_Up:
increaseOuterTesselation(); tessOuter++;
tessOuterU->set(tessOuter);
return true; return true;
case osgGA::GUIEventAdapter::KEY_Down: case osgGA::GUIEventAdapter::KEY_Down:
decreaseOuterTesselation(); tessOuter--;
tessOuter=std::max(1.0f,tessOuter);
tessOuterU->set(tessOuter);
return true; return true;
case osgGA::GUIEventAdapter::KEY_Left: case osgGA::GUIEventAdapter::KEY_Left:
decreaseInnerTesselation(); tessInner--;
tessInner=std::max(1.0f,tessInner);
tessInnerU->set(tessInner);
return true; return true;
case osgGA::GUIEventAdapter::KEY_Right: case osgGA::GUIEventAdapter::KEY_Right:
increaseInnerTesselation(); tessInner++;
return true; tessInnerU->set(tessInner);
case osgGA::GUIEventAdapter::KEY_Plus:
case osgGA::GUIEventAdapter::KEY_KP_Add:
increaseInnerTesselation();
increaseOuterTesselation();
return true;
case osgGA::GUIEventAdapter::KEY_Minus:
case osgGA::GUIEventAdapter::KEY_KP_Subtract:
decreaseInnerTesselation();
decreaseOuterTesselation();
return true; return true;
} }
} }
return osgGA::GUIEventHandler::handle(ea, gaa); return osgGA::GUIEventHandler::handle(ea,gaa);
}
private:
osg::ref_ptr<osg::Uniform> _tessInnerU;
osg::ref_ptr<osg::Uniform> _tessOuterU;
float _tessInner;
float _tessOuter;
void increaseInnerTesselation()
{
_tessInnerU->set(++_tessInner);
}
void decreaseInnerTesselation()
{
_tessInner = std::max(1.0f, _tessInner-1.0f);
_tessInnerU->set(_tessInner);
}
void increaseOuterTesselation()
{
_tessOuterU->set(++_tessOuter);
}
void decreaseOuterTesselation()
{
_tessOuter = std::max(1.0f, _tessOuter-1.0f);
_tessOuterU->set(_tessOuter);
} }
}; };
@@ -270,9 +220,6 @@ int main(int argc, char* argv[])
viewer.setUpViewInWindow(100,100,800,600); viewer.setUpViewInWindow(100,100,800,600);
osg::ref_ptr<osg::Program> program = createProgram(); osg::ref_ptr<osg::Program> program = createProgram();
osg::ref_ptr<osg::Geode> geode = CreateIcosahedron(program.get()); osg::ref_ptr<osg::Geode> geode = CreateIcosahedron(program.get());
osg::ref_ptr<osg::Uniform> tessInnerU = new osg::Uniform("TessLevelInner", 1.0f);
osg::ref_ptr<osg::Uniform> tessOuterU = new osg::Uniform("TessLevelOuter", 1.0f);
osg::StateSet *state; osg::StateSet *state;
state = geode->getOrCreateStateSet(); state = geode->getOrCreateStateSet();
state->addUniform(new osg::Uniform("AmbientMaterial",osg::Vec3(0.04f, 0.04f, 0.04f))); state->addUniform(new osg::Uniform("AmbientMaterial",osg::Vec3(0.04f, 0.04f, 0.04f)));
@@ -282,7 +229,7 @@ int main(int argc, char* argv[])
state->addUniform(tessOuterU.get()); state->addUniform(tessOuterU.get());
state->setAttribute(new osg::PatchParameter(3)); state->setAttribute(new osg::PatchParameter(3));
state->setAttribute(program.get()); state->setAttribute(program.get());
// switch on the uniforms that track the modelview and projection matrices // switch on the uniforms that track the modelview and projection matrices
osgViewer::Viewer::Windows windows; osgViewer::Viewer::Windows windows;
viewer.getWindows(windows); viewer.getWindows(windows);
@@ -294,8 +241,8 @@ int main(int argc, char* argv[])
s->setUseModelViewAndProjectionUniforms(true); s->setUseModelViewAndProjectionUniforms(true);
s->setUseVertexAttributeAliasing(true); s->setUseVertexAttributeAliasing(true);
} }
viewer.addEventHandler(new KeyboardEventHandler(tessInnerU, tessOuterU)); viewer.addEventHandler(new KeyboardEventHandler());
viewer.setSceneData(geode.get()); viewer.setSceneData(geode.get());
return viewer.run(); return viewer.run();
} }

View File

@@ -27,7 +27,7 @@ inline void clampGEQUAL(T& value,const T minValue,const char* valueName)
{ {
if (value<minValue) if (value<minValue)
{ {
notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is below permitted minimum, clamping to "<<minValue<<"."<< std::endl; notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is below permitted minimum, clampping to "<<minValue<<"."<< std::endl;
value = minValue; value = minValue;
} }
} }
@@ -40,7 +40,7 @@ inline void clampLEQUAL(T& value,const T maxValue,const char* valueName)
{ {
if (value>maxValue) if (value>maxValue)
{ {
notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is above permitted maximum, clamping to "<<maxValue<<"."<< std::endl; notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is above permitted maximum, clampping to "<<maxValue<<"."<< std::endl;
value = maxValue; value = maxValue;
} }
} }
@@ -55,13 +55,13 @@ inline void clampBetweenRange(T& value,const T minValue,const T maxValue,const c
{ {
if (value<minValue) if (value<minValue)
{ {
notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is below permitted minimum, clamping to "<<minValue<<"."<< std::endl; notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is below permitted minimum, clampping to "<<minValue<<"."<< std::endl;
value = minValue; value = minValue;
} }
else else
if (value>maxValue) if (value>maxValue)
{ {
notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is above permitted maximum, clamping to "<<maxValue<<"."<< std::endl; notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is above permitted maximum, clampping to "<<maxValue<<"."<< std::endl;
value = maxValue; value = maxValue;
} }
@@ -75,7 +75,7 @@ inline void clampArrayElementGEQUAL(A& value,unsigned int i,const T minValue,con
{ {
if (value[i]<minValue) if (value[i]<minValue)
{ {
notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is below permitted minimum, clamping to "<<minValue<<"."<< std::endl; notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is below permitted minimum, clampping to "<<minValue<<"."<< std::endl;
value[i] = minValue; value[i] = minValue;
} }
} }
@@ -88,7 +88,7 @@ inline void clampArrayElementLEQUAL(A& value,unsigned int i,const T maxValue,con
{ {
if (value[i]>maxValue) if (value[i]>maxValue)
{ {
notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is above permitted maximum, clamping to "<<maxValue<<"."<< std::endl; notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is above permitted maximum, clampping to "<<maxValue<<"."<< std::endl;
value = maxValue; value = maxValue;
} }
} }
@@ -103,13 +103,13 @@ inline void clampArrayElementBetweenRange(A& value,unsigned int i,const T minVal
{ {
if (value[i]<minValue) if (value[i]<minValue)
{ {
notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is below permitted minimum, clamping to "<<minValue<<"."<< std::endl; notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is below permitted minimum, clampping to "<<minValue<<"."<< std::endl;
value[i] = minValue; value[i] = minValue;
} }
else else
if (value[i]>maxValue) if (value[i]>maxValue)
{ {
notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is above permitted maximum, clamping to "<<maxValue<<"."<< std::endl; notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is above permitted maximum, clampping to "<<maxValue<<"."<< std::endl;
value[i] = maxValue; value[i] = maxValue;
} }

View File

@@ -96,7 +96,7 @@
#endif #endif
// XXX This is from Win32's <ctype.h> // XXX This is from Win32's <ctype.h>
#if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&(__GNUC__ >2)) #if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&((__GNUC__ == 3)||(__GNUC__ == 4)))
typedef unsigned short wchar_t; typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED #define _WCHAR_T_DEFINED
#endif #endif

View File

@@ -203,9 +203,8 @@ class OSG_EXPORT Node : public Object
if (nc != NULL && _updateCallback.valid()) { if (nc != NULL && _updateCallback.valid()) {
if (_updateCallback == nc) if (_updateCallback == nc)
{ {
ref_ptr<NodeCallback> new_nested_callback = nc->getNestedCallback(); setUpdateCallback(nc->getNestedCallback()); // replace the callback by the nested one
nc->setNestedCallback(0); nc->setNestedCallback(0);
setUpdateCallback(new_nested_callback.get());
} }
else _updateCallback->removeNestedCallback(nc); else _updateCallback->removeNestedCallback(nc);
} }
@@ -238,9 +237,8 @@ class OSG_EXPORT Node : public Object
if (nc != NULL && _eventCallback.valid()) { if (nc != NULL && _eventCallback.valid()) {
if (_eventCallback == nc) if (_eventCallback == nc)
{ {
ref_ptr<NodeCallback> new_nested_callback = nc->getNestedCallback(); setEventCallback(nc->getNestedCallback()); // replace the callback by the nested one
nc->setNestedCallback(0); nc->setNestedCallback(0);
setEventCallback(new_nested_callback.get()); // replace the callback by the nested one
} }
else _eventCallback->removeNestedCallback(nc); else _eventCallback->removeNestedCallback(nc);
} }
@@ -273,9 +271,8 @@ class OSG_EXPORT Node : public Object
if (nc != NULL && _cullCallback.valid()) { if (nc != NULL && _cullCallback.valid()) {
if (_cullCallback == nc) if (_cullCallback == nc)
{ {
ref_ptr<NodeCallback> new_nested_callback = nc->getNestedCallback(); setCullCallback(nc->getNestedCallback()); // replace the callback by the nested one
nc->setNestedCallback(0); nc->setNestedCallback(0);
setCullCallback(new_nested_callback.get()); // replace the callback by the nested one
} }
else _cullCallback->removeNestedCallback(nc); else _cullCallback->removeNestedCallback(nc);
} }

View File

@@ -1336,6 +1336,11 @@ class OSG_EXPORT State : public Referenced, public Observer
if (_lastAppliedProgramObject!=program) if (_lastAppliedProgramObject!=program)
{ {
_lastAppliedProgramObject = program; _lastAppliedProgramObject = program;
if (program && _appliedProgramObjectSet.count(program)==0)
{
_appliedProgramObjectSet.insert(program);
program->addObserver(this);
}
} }
} }
inline const Program::PerContextProgram* getLastAppliedProgramObject() const { return _lastAppliedProgramObject; } inline const Program::PerContextProgram* getLastAppliedProgramObject() const { return _lastAppliedProgramObject; }

View File

@@ -305,25 +305,6 @@
#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E #define GL_RGBA_INTEGER_MODE_EXT 0x8D9E
#endif #endif
#ifndef GL_VERSION_1_1
#define GL_R3_G3_B2 0x2A10
#define GL_RGB4 0x804F
#define GL_RGB5 0x8050
#define GL_RGB8 0x8051
#define GL_RGB10 0x8052
#define GL_RGB12 0x8053
#define GL_RGB16 0x8054
#define GL_RGBA2 0x8055
#define GL_RGBA4 0x8056
#define GL_RGB5_A1 0x8057
#define GL_RGBA8 0x8058
#define GL_RGB10_A2 0x8059
#define GL_RGBA12 0x805A
#define GL_RGBA16 0x805B
#define GL_BGR_EXT 0x80E0
#define GL_BGRA_EXT 0x80E1
#endif
#ifndef GL_ARB_texture_rg #ifndef GL_ARB_texture_rg
#define GL_RG 0x8227 #define GL_RG 0x8227
#define GL_RG_INTEGER 0x8228 #define GL_RG_INTEGER 0x8228

View File

@@ -20,7 +20,7 @@ extern "C" {
#define OPENSCENEGRAPH_MAJOR_VERSION 3 #define OPENSCENEGRAPH_MAJOR_VERSION 3
#define OPENSCENEGRAPH_MINOR_VERSION 2 #define OPENSCENEGRAPH_MINOR_VERSION 2
#define OPENSCENEGRAPH_PATCH_VERSION 2 #define OPENSCENEGRAPH_PATCH_VERSION 1
#define OPENSCENEGRAPH_SOVERSION 100 #define OPENSCENEGRAPH_SOVERSION 100
/* Convenience macro that can be used to decide whether a feature is present or not i.e. /* Convenience macro that can be used to decide whether a feature is present or not i.e.

View File

@@ -94,10 +94,6 @@ class ref_ptr
bool operator!() const { return _ptr==0; } // not required bool operator!() const { return _ptr==0; } // not required
bool valid() const { return _ptr!=0; } bool valid() const { return _ptr!=0; }
/** release the pointer from ownership by this ref_ptr<>, decrementing the objects refencedCount() via unref_nodelete() to prevent the Object
* object from being deleted even if the reference count goes to zero. Use when using a local ref_ptr<> to an Object that you want to return
* from a function/method via a C pointer, whilst preventing the normal ref_ptr<> destructor from cleaning up the object. When using release()
* you are implicitly expecting other code to take over managment of the object, otherwise a memory leak will result. */
T* release() { T* tmp=_ptr; if (_ptr) _ptr->unref_nodelete(); _ptr=0; return tmp; } T* release() { T* tmp=_ptr; if (_ptr) _ptr->unref_nodelete(); _ptr=0; return tmp; }
void swap(ref_ptr& rp) { T* tmp=_ptr; _ptr=rp._ptr; rp._ptr=tmp; } void swap(ref_ptr& rp) { T* tmp=_ptr; _ptr=rp._ptr; rp._ptr=tmp; }

View File

@@ -335,12 +335,6 @@ class OSGVIEWER_EXPORT ViewerBase : public virtual osg::Object
osg::ref_ptr<osgUtil::IncrementalCompileOperation> _incrementalCompileOperation; osg::ref_ptr<osgUtil::IncrementalCompileOperation> _incrementalCompileOperation;
osg::observer_ptr<osg::GraphicsContext> _currentContext; osg::observer_ptr<osg::GraphicsContext> _currentContext;
private:
// Define private copy constructor
// otherwsie VS2015 will construct it's own which will call the private copy operator from osg::Object resulting in an compile error.
ViewerBase& operator = (const ViewerBase&) { return *this; }
}; };
} }

View File

@@ -425,8 +425,6 @@ GLenum Image::computeFormatDataType(GLenum pixelFormat)
{ {
switch (pixelFormat) switch (pixelFormat)
{ {
case GL_R32F:
case GL_RG32F:
case GL_LUMINANCE32F_ARB: case GL_LUMINANCE32F_ARB:
case GL_LUMINANCE16F_ARB: case GL_LUMINANCE16F_ARB:
case GL_LUMINANCE_ALPHA32F_ARB: case GL_LUMINANCE_ALPHA32F_ARB:
@@ -468,8 +466,6 @@ GLenum Image::computeFormatDataType(GLenum pixelFormat)
case GL_RGBA: case GL_RGBA:
case GL_RGB: case GL_RGB:
case GL_RED:
case GL_RG:
case GL_LUMINANCE: case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
case GL_ALPHA: return GL_UNSIGNED_BYTE; case GL_ALPHA: return GL_UNSIGNED_BYTE;
@@ -519,9 +515,6 @@ unsigned int Image::computeNumComponents(GLenum pixelFormat)
case(GL_ALPHA32UI_EXT): return 1; case(GL_ALPHA32UI_EXT): return 1;
case(GL_ALPHA16F_ARB): return 1; case(GL_ALPHA16F_ARB): return 1;
case(GL_ALPHA32F_ARB): return 1; case(GL_ALPHA32F_ARB): return 1;
case(GL_R32F): return 1;
case(GL_RG): return 2;
case(GL_RG32F): return 2;
case(GL_RGB): return 3; case(GL_RGB): return 3;
case(GL_BGR): return 3; case(GL_BGR): return 3;
case(GL_RGB8I_EXT): return 3; case(GL_RGB8I_EXT): return 3;
@@ -806,11 +799,7 @@ int Image::computeNumberOfMipmapLevels(int s,int t, int r)
{ {
int w = maximum(s, t); int w = maximum(s, t);
w = maximum(w, r); w = maximum(w, r);
return 1 + static_cast<int>(floor(logf(w)/logf(2.0f)));
int n = 0;
while (w >>= 1)
++n;
return n+1;
} }
bool Image::isCompressed() const bool Image::isCompressed() const
@@ -1521,18 +1510,16 @@ void Image::flipVertical()
{ {
if (!dxtc_tool::VerticalFlip(s,t,_pixelFormat,_data+_mipmapData[i])) if (!dxtc_tool::VerticalFlip(s,t,_pixelFormat,_data+_mipmapData[i]))
{ {
OSG_NOTICE << "Notice Image::flipVertical(): Vertical flip did not succeed" << std::endl; OSG_NOTICE << "Notice Image::flipVertical(): Vertical flip do not succeed" << std::endl;
} }
} }
else else
{ {
// it's not a compressed image, so implement flip ourselves. // its not a compressed image, so implement flip oursleves.
unsigned int mipRowSize = computeRowWidthInBytes(s, _pixelFormat, _dataType, _packing);
unsigned int mipRowStep = mipRowSize;
unsigned char* top = _data+_mipmapData[i]; unsigned char* top = _data+_mipmapData[i];
unsigned char* bottom = top + (t-1)*mipRowStep; unsigned char* bottom = top + (t-1)*rowStep;
flipImageVertical(top, bottom, mipRowSize, mipRowStep); flipImageVertical(top, bottom, rowSize, rowStep);
} }
} }
} }

View File

@@ -68,22 +68,18 @@ PolygonMode::Mode PolygonMode::getMode(Face face) const
void PolygonMode::apply(State&) const void PolygonMode::apply(State&) const
{ {
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) #ifdef OSG_GL1_AVAILABLE
if (_modeFront==_modeBack) if (_modeFront==_modeBack)
{ {
glPolygonMode(GL_FRONT_AND_BACK,(GLenum)_modeFront); glPolygonMode(GL_FRONT_AND_BACK,(GLenum)_modeFront);
} }
else else
{ {
#ifdef OSG_GL1_AVAILABLE glPolygonMode(GL_FRONT,(GLenum)_modeFront);
glPolygonMode(GL_FRONT,(GLenum)_modeFront); glPolygonMode(GL_BACK,(GLenum)_modeBack);
glPolygonMode(GL_BACK,(GLenum)_modeBack);
#else
OSG_NOTICE << "Warning: PolygonMode::apply(State&) - only GL_FRONT_AND_BACK is supported." << std::endl;
#endif
} }
#else #else
OSG_NOTICE << "Warning: PolygonMode::apply(State&) - is not supported." << std::endl; OSG_NOTICE<<"Warning: PolygonMode::apply(State&) - not supported."<<std::endl;
#endif #endif
} }

View File

@@ -134,10 +134,25 @@ State::~State()
//_texCoordArrayList.clear(); //_texCoordArrayList.clear();
//_vertexAttribArrayList.clear(); //_vertexAttribArrayList.clear();
// OSG_NOTICE<<"State::~State()"<<this<<std::endl;
for(AppliedProgramObjectSet::iterator itr = _appliedProgramObjectSet.begin();
itr != _appliedProgramObjectSet.end();
++itr)
{
(*itr)->removeObserver(this);
}
} }
void State::objectDeleted(void* object) void State::objectDeleted(void* object)
{ {
const Program::PerContextProgram* ppcp = reinterpret_cast<const Program::PerContextProgram*>(object);
AppliedProgramObjectSet::iterator itr = _appliedProgramObjectSet.find(ppcp);
if (itr != _appliedProgramObjectSet.end())
{
// OSG_NOTICE<<"Removing _appliedProgramObjectSet entry "<<ppcp<<std::endl;
_appliedProgramObjectSet.erase(itr);
}
} }
void State::reset() void State::reset()
@@ -224,6 +239,17 @@ void State::reset()
_lastAppliedProgramObject = 0; _lastAppliedProgramObject = 0;
for(AppliedProgramObjectSet::iterator apitr=_appliedProgramObjectSet.begin();
apitr!=_appliedProgramObjectSet.end();
++apitr)
{
(*apitr)->resetAppliedUniforms();
(*apitr)->removeObserver(this);
}
_appliedProgramObjectSet.clear();
// what about uniforms??? need to clear them too... // what about uniforms??? need to clear them too...
// go through all active Unfirom's, setting to change to force update, // go through all active Unfirom's, setting to change to force update,
// the idea is to leave only the global defaults left. // the idea is to leave only the global defaults left.
@@ -1360,18 +1386,6 @@ bool State::convertVertexShaderSourceToOsgBuiltIns(std::string& source) const
declPos = 0; declPos = 0;
} }
if (_useModelViewAndProjectionUniforms)
{
// replace ftransform as it only works with built-ins
State_Utils::replace(source, "ftransform()", "gl_ModelViewProjectionMatrix * gl_Vertex");
// replace built in uniform
State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_ModelViewMatrix", "osg_ModelViewMatrix", "uniform mat4 ");
State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_ModelViewProjectionMatrix", "osg_ModelViewProjectionMatrix", "uniform mat4 ");
State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_ProjectionMatrix", "osg_ProjectionMatrix", "uniform mat4 ");
State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_NormalMatrix", "osg_NormalMatrix", "uniform mat3 ");
}
if (_useVertexAttributeAliasing) if (_useVertexAttributeAliasing)
{ {
State_Utils::replaceAndInsertDeclaration(source, declPos, _vertexAlias._glName, _vertexAlias._osgName, _vertexAlias._declaration); State_Utils::replaceAndInsertDeclaration(source, declPos, _vertexAlias._glName, _vertexAlias._osgName, _vertexAlias._declaration);
@@ -1386,6 +1400,18 @@ bool State::convertVertexShaderSourceToOsgBuiltIns(std::string& source) const
} }
} }
if (_useModelViewAndProjectionUniforms)
{
// replace ftransform as it only works with built-ins
State_Utils::replace(source, "ftransform()", "gl_ModelViewProjectionMatrix * gl_Vertex");
// replace built in uniform
State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_ModelViewMatrix", "osg_ModelViewMatrix", "uniform mat4 ");
State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_ModelViewProjectionMatrix", "osg_ModelViewProjectionMatrix", "uniform mat4 ");
State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_ProjectionMatrix", "osg_ProjectionMatrix", "uniform mat4 ");
State_Utils::replaceAndInsertDeclaration(source, declPos, "gl_NormalMatrix", "osg_NormalMatrix", "uniform mat3 ");
}
OSG_INFO<<"-------- Converted source "<<std::endl<<source<<std::endl<<"----------------"<<std::endl; OSG_INFO<<"-------- Converted source "<<std::endl<<source<<std::endl<<"----------------"<<std::endl;
return true; return true;
@@ -1690,6 +1716,15 @@ void State::print(std::ostream& fout) const
} }
fout<<"}"<<std::endl; fout<<"}"<<std::endl;
#if 0
TextureModeMapList _textureModeMapList;
TextureAttributeMapList _textureAttributeMapList;
AppliedProgramObjectSet _appliedProgramObjectSet;
const Program::PerContextProgram* _lastAppliedProgramObject;
#endif
fout<<"StateSetStack _stateSetStack {"<<std::endl; fout<<"StateSetStack _stateSetStack {"<<std::endl;
for(StateSetStack::const_iterator itr = _stateStateStack.begin(); for(StateSetStack::const_iterator itr = _stateStateStack.begin();
itr != _stateStateStack.end(); itr != _stateStateStack.end();

View File

@@ -32,16 +32,15 @@ Texture2DArray::Texture2DArray(const Texture2DArray& text,const CopyOp& copyop):
Texture(text,copyop), Texture(text,copyop),
_textureWidth(text._textureWidth), _textureWidth(text._textureWidth),
_textureHeight(text._textureHeight), _textureHeight(text._textureHeight),
_textureDepth(0), _textureDepth(text._textureDepth),
_numMipmapLevels(text._numMipmapLevels), _numMipmapLevels(text._numMipmapLevels),
_subloadCallback(text._subloadCallback) _subloadCallback(text._subloadCallback)
{ {
setTextureDepth(text._textureDepth);
// copy all images by iterating through all of them // copy all images by iterating through all of them
for (int i=0; i < text._textureDepth; i++) for (int i=0; i < text._textureDepth; i++)
{ {
setImage(i, copyop(text._images[i].get())); setImage(i, copyop(text._images[i].get()));
_modifiedCount.push_back(ImageModifiedCount());
} }
} }

View File

@@ -48,15 +48,14 @@ TransferFunction1D::TransferFunction1D(const TransferFunction1D& tf, const CopyO
TransferFunction(tf,copyop) TransferFunction(tf,copyop)
{ {
allocate(tf.getNumberImageCells()); allocate(tf.getNumberImageCells());
assign(tf._colorMap); assign(_colorMap);
} }
void TransferFunction1D::allocate(unsigned int numX) void TransferFunction1D::allocate(unsigned int numX)
{ {
_image = new osg::Image; _image = new osg::Image;
_image->allocateImage(numX,1,1,GL_RGBA, GL_FLOAT); _image->allocateImage(numX,1,1,GL_RGBA, GL_FLOAT);
if (!_colorMap.empty()) assign(_colorMap);
updateImage();
} }
void TransferFunction1D::clear(const osg::Vec4& color) void TransferFunction1D::clear(const osg::Vec4& color)
@@ -178,7 +177,7 @@ osg::Vec4 TransferFunction1D::getColor(float v) const
void TransferFunction1D::assign(const ColorMap& newColours) void TransferFunction1D::assign(const ColorMap& newColours)
{ {
if (&_colorMap != &newColours) _colorMap = newColours; _colorMap = newColours;
updateImage(); updateImage();
} }

View File

@@ -107,13 +107,7 @@ bool Animation::update (double time, int priority)
{ {
case ONCE: case ONCE:
if (t > _originalDuration) if (t > _originalDuration)
{
for (ChannelList::const_iterator chan = _channels.begin();
chan != _channels.end(); ++chan)
(*chan)->update(_originalDuration, _weight, priority);
return false; return false;
}
break; break;
case STAY: case STAY:
if (t > _originalDuration) if (t > _originalDuration)

View File

@@ -7,7 +7,7 @@ IF (DYNAMIC_OPENSCENEGRAPH)
IF(OSG_PLUGIN_SEARCH_INSTALL_DIR_FOR_PLUGINS) IF(OSG_PLUGIN_SEARCH_INSTALL_DIR_FOR_PLUGINS)
# Add a default plugin search path component # Add a default plugin search path component
ADD_DEFINITIONS(-DOSG_DEFAULT_LIBRARY_PATH=\"${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}/${OSG_PLUGINS}\") ADD_DEFINITIONS(-DOSG_DEFAULT_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}/${OSG_PLUGINS})
ENDIF() ENDIF()
# Set the library extension according to what configuration is being built. # Set the library extension according to what configuration is being built.

View File

@@ -505,7 +505,7 @@ static void appendInstallationLibraryFilePaths(osgDB::FilePathList& filepath)
#ifdef OSG_DEFAULT_LIBRARY_PATH #ifdef OSG_DEFAULT_LIBRARY_PATH
// Append the install prefix path to the library search path if configured // Append the install prefix path to the library search path if configured
filepath.push_back(OSG_DEFAULT_LIBRARY_PATH); filepath.push_back(ADDQUOTES(OSG_DEFAULT_LIBRARY_PATH));
#endif #endif
} }

View File

@@ -275,7 +275,7 @@ bool NodeTrackerManipulator::performMovementLeftMouseButton( const double eventT
} else } else
rotateTrackball( _ga_t0->getXnormalized(), _ga_t0->getYnormalized(), rotateTrackball( _ga_t0->getXnormalized(), _ga_t0->getYnormalized(),
_ga_t1->getXnormalized(), _ga_t1->getYnormalized(), _ga_t1->getXnormalized(), _ga_t1->getYnormalized(),
getThrowScale( eventTimeDelta ) ); _thrown ? float( _delta_frame_time / eventTimeDelta ) : 1.f );
return true; return true;
} }

View File

@@ -379,12 +379,12 @@ void OrbitManipulator::OrbitAnimationData::start( const osg::Vec3d& movement, co
Scale parameter is useful, for example, when manipulator is thrown. Scale parameter is useful, for example, when manipulator is thrown.
It scales the amount of rotation based, for example, on the current frame time.*/ It scales the amount of rotation based, for example, on the current frame time.*/
void OrbitManipulator::rotateTrackball( const float px0, const float py0, void OrbitManipulator::rotateTrackball( const float px0, const float py0,
const float px1, const float py1, const float scale ) const float px1, const float py1, const float /*scale*/ )
{ {
osg::Vec3d axis; osg::Vec3d axis;
float angle; float angle;
trackball( axis, angle, px0 + (px1-px0)*scale, py0 + (py1-py0)*scale, px0, py0 ); trackball( axis, angle, px1, py1, px0, py0 );
Quat new_rotate; Quat new_rotate;
new_rotate.makeRotate( angle, axis ); new_rotate.makeRotate( angle, axis );

View File

@@ -154,8 +154,6 @@ bool StandardManipulator::isAnimating() const
/// Finishes the animation by performing a step that moves it to its final position. /// Finishes the animation by performing a step that moves it to its final position.
void StandardManipulator::finishAnimation() void StandardManipulator::finishAnimation()
{ {
_thrown = false;
if( !isAnimating() ) if( !isAnimating() )
return; return;
@@ -588,12 +586,7 @@ void StandardManipulator::setAllowThrow( bool allowThrow )
events that started the animation.*/ events that started the animation.*/
float StandardManipulator::getThrowScale( const double eventTimeDelta ) const float StandardManipulator::getThrowScale( const double eventTimeDelta ) const
{ {
if( _thrown ) if( _thrown ) return float( _delta_frame_time / eventTimeDelta );
{
if (eventTimeDelta == 0.f)
return 0.f;
return float( _delta_frame_time / eventTimeDelta );
}
else return 1.f; else return 1.f;
} }

View File

@@ -31,7 +31,6 @@
#include <map> #include <map>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <limits>
#include <assert.h> #include <assert.h>
using namespace std; using namespace std;
@@ -239,7 +238,6 @@ ReaderWriter3DS::ReaderWriter3DS()
//supportsOption("OutputTextureFiles","Write out the texture images to file"); //supportsOption("OutputTextureFiles","Write out the texture images to file");
//supportsOption("flipTexture", "flip texture upside-down"); //supportsOption("flipTexture", "flip texture upside-down");
supportsOption("extended3dsFilePaths", "(Write option) Keeps long texture filenames (not 8.3) when exporting 3DS, but can lead to compatibility problems."); supportsOption("extended3dsFilePaths", "(Write option) Keeps long texture filenames (not 8.3) when exporting 3DS, but can lead to compatibility problems.");
supportsOption("preserveMaterialNames", "(Write option) Preserve original material names, up to 64 characters. This can lead to compatibility problems.");
supportsOption("noMatrixTransforms", "(Read option) Set the plugin to apply matrices into the mesh vertices (\"old behaviour\") instead of restoring them (\"new behaviour\"). You may use this option to avoid a few rounding errors."); supportsOption("noMatrixTransforms", "(Read option) Set the plugin to apply matrices into the mesh vertices (\"old behaviour\") instead of restoring them (\"new behaviour\"). You may use this option to avoid a few rounding errors.");
supportsOption("checkForEspilonIdentityMatrices", "(Read option) If not set, then consider \"almost identity\" matrices to be identity ones (in case of rounding errors)."); supportsOption("checkForEspilonIdentityMatrices", "(Read option) If not set, then consider \"almost identity\" matrices to be identity ones (in case of rounding errors).");
supportsOption("restoreMatrixTransformsNoMeshes", "(Read option) Makes an exception to the behaviour when 'noMatrixTransforms' is not set for mesh instances. When a mesh instance has a transform on it, the reader creates a MatrixTransform above the Geode. If you don't want the hierarchy to be modified, then you can use this option to merge the transform into vertices."); supportsOption("restoreMatrixTransformsNoMeshes", "(Read option) Makes an exception to the behaviour when 'noMatrixTransforms' is not set for mesh instances. When a mesh instance has a transform on it, the reader creates a MatrixTransform above the Geode. If you don't want the hierarchy to be modified, then you can use this option to merge the transform into vertices.");
@@ -865,7 +863,7 @@ struct RemappedFace
{ {
Lib3dsFace* face; // Original face definition. Lib3dsFace* face; // Original face definition.
osg::Vec3f normal; osg::Vec3f normal;
unsigned int index[3]; // Indices to OSG vertex/normal/texcoord arrays. unsigned short index[3]; // Indices to OSG vertex/normal/texcoord arrays.
}; };
struct VertexParams struct VertexParams
@@ -885,14 +883,6 @@ static bool isFaceValid(const Lib3dsMesh* mesh, const Lib3dsFace* face)
face->index[2] < mesh->nvertices; face->index[2] < mesh->nvertices;
} }
bool isNumber(float x)
{
// This looks like it should always be true,
// but it's false if x is a NaN.
return (x == x);
}
/* ChrisD: addVertex handles the averaging of normals and spltting of vertices /* ChrisD: addVertex handles the averaging of normals and spltting of vertices
required to implement normals for smoothing groups. When a shared required to implement normals for smoothing groups. When a shared
vertex is encountered when smoothing is required, normals are added vertex is encountered when smoothing is required, normals are added
@@ -905,7 +895,7 @@ bool isNumber(float x)
static void addVertex( static void addVertex(
const Lib3dsMesh* mesh, const Lib3dsMesh* mesh,
RemappedFace& remappedFace, RemappedFace& remappedFace,
unsigned int i, unsigned short int i,
osg::Geometry* geometry, osg::Geometry* geometry,
std::vector<int>& origToNewMapping, std::vector<int>& origToNewMapping,
std::vector<int>& splitVertexChain, std::vector<int>& splitVertexChain,
@@ -915,7 +905,7 @@ static void addVertex(
osg::Vec3Array* normals = (osg::Vec3Array*)geometry->getNormalArray(); osg::Vec3Array* normals = (osg::Vec3Array*)geometry->getNormalArray();
osg::Vec2Array* texCoords = (osg::Vec2Array*)geometry->getTexCoordArray(0); osg::Vec2Array* texCoords = (osg::Vec2Array*)geometry->getTexCoordArray(0);
unsigned int index = remappedFace.face->index[i]; unsigned short int index = remappedFace.face->index[i];
if (origToNewMapping[index] == -1) if (origToNewMapping[index] == -1)
{ {
int newIndex = vertices->size(); int newIndex = vertices->size();
@@ -936,10 +926,6 @@ static void addVertex(
osg::Vec2f texCoord(mesh->texcos[index][0], mesh->texcos[index][1]); osg::Vec2f texCoord(mesh->texcos[index][0], mesh->texcos[index][1]);
texCoord = componentMultiply(texCoord, params.scaleUV); texCoord = componentMultiply(texCoord, params.scaleUV);
texCoord += params.offsetUV; texCoord += params.offsetUV;
if (!isNumber(texCoord.x()) || !isNumber(texCoord.y())) {
OSG_WARN << "NaN found in texcoord" << std::endl;
texCoord.set(0,0);
}
texCoords->push_back(texCoord); texCoords->push_back(texCoord);
} }
@@ -1016,25 +1002,6 @@ static bool addFace(
} }
} }
template <typename Prim>
void fillTriangles(osg::Geometry & geom, const std::vector<RemappedFace> & remappedFaces, unsigned int numIndices) {
//if (m->nvertices < std::numeric_limits<unsigned short>::max()) {
osg::ref_ptr<Prim> elements( new Prim(osg::PrimitiveSet::TRIANGLES, numIndices) );
typename Prim::iterator index_itr( elements->begin() );
for (unsigned int i = 0; i < remappedFaces.size(); ++i)
{
const RemappedFace& remappedFace = remappedFaces[i];
if (remappedFace.face != NULL)
{
*(index_itr++) = remappedFace.index[0];
*(index_itr++) = remappedFace.index[1];
*(index_itr++) = remappedFace.index[2];
}
}
geom.addPrimitiveSet(elements.get());
}
/** /**
use matrix to pretransform geometry, or NULL to do nothing use matrix to pretransform geometry, or NULL to do nothing
*/ */
@@ -1091,27 +1058,21 @@ osg::Drawable* ReaderWriter3DS::ReaderObject::createDrawable(Lib3dsMesh *m,FaceL
unsigned int faceIndex = 0; unsigned int faceIndex = 0;
unsigned int faceCount = 0; unsigned int faceCount = 0;
unsigned int maxVertexIndex = 0;
for (FaceList::iterator itr = faceList.begin(); for (FaceList::iterator itr = faceList.begin();
itr != faceList.end(); itr != faceList.end();
++itr, ++faceIndex) ++itr, ++faceIndex)
{ {
osg::Vec3f normal(copyLib3dsVec3ToOsgVec3(normals[*itr])); osg::Vec3 normal = copyLib3dsVec3ToOsgVec3(normals[*itr]);
if (matrix) normal = osg::Matrix::transform3x3(normal, *(params.matrix)); if (matrix) normal = osg::Matrix::transform3x3(normal, *(params.matrix));
normal.normalize(); normal.normalize();
Lib3dsFace& face = m->faces[*itr]; Lib3dsFace& face = m->faces[*itr];
RemappedFace & rf = remappedFaces[faceIndex]; remappedFaces[faceIndex].face = &face;
rf.face = &face; remappedFaces[faceIndex].normal = normal;
rf.normal = normal; if (addFace(m, remappedFaces[faceIndex], geom, origToNewMapping, splitVertexChain, params))
if (addFace(m, rf, geom, origToNewMapping, splitVertexChain, params))
{ {
++faceCount; ++faceCount;
} }
// Get the highest index
maxVertexIndex = osg::maximum(maxVertexIndex, rf.index[0]);
maxVertexIndex = osg::maximum(maxVertexIndex, rf.index[1]);
maxVertexIndex = osg::maximum(maxVertexIndex, rf.index[2]);
} }
// 'Shrink to fit' all vertex arrays because potentially faceList refers to fewer vertices than the whole mesh. // 'Shrink to fit' all vertex arrays because potentially faceList refers to fewer vertices than the whole mesh.
@@ -1126,12 +1087,23 @@ osg::Drawable* ReaderWriter3DS::ReaderObject::createDrawable(Lib3dsMesh *m,FaceL
geom->setColorArray(osg_colors.get(), osg::Array::BIND_OVERALL); geom->setColorArray(osg_colors.get(), osg::Array::BIND_OVERALL);
// Create triangle primitives. // Create triangle primitives.
// Remapping may create additional vertices, thus creating indices over USHORT_MAX int numIndices = faceCount * 3;
if (maxVertexIndex < std::numeric_limits<unsigned short>::max()) { osg::ref_ptr<DrawElementsUShort> elements = new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLES, numIndices);
fillTriangles<DrawElementsUShort>(*geom, remappedFaces, faceCount * 3); DrawElementsUShort::iterator index_itr = elements->begin();
} else {
fillTriangles<DrawElementsUInt> (*geom, remappedFaces, faceCount * 3); for (unsigned int i = 0; i < remappedFaces.size(); ++i)
} {
RemappedFace& remappedFace = remappedFaces[i];
if (remappedFace.face != NULL)
{
*(index_itr++) = remappedFace.index[0];
*(index_itr++) = remappedFace.index[1];
*(index_itr++) = remappedFace.index[2];
}
}
geom->addPrimitiveSet(elements.get());
#if 0 #if 0
osgUtil::TriStripVisitor tsv; osgUtil::TriStripVisitor tsv;
tsv.stripify(*geom); tsv.stripify(*geom);
@@ -1205,7 +1177,7 @@ osg::Texture2D* ReaderWriter3DS::ReaderObject::createTexture(Lib3dsTextureMap *
osg_texture->setImage(osg_image.get()); osg_texture->setImage(osg_image.get());
osg_texture->setName(texture->name); osg_texture->setName(texture->name);
// does the texture support transparancy? // does the texture support transparancy?
transparency = ((texture->flags)&LIB3DS_TEXTURE_ALPHA_SOURCE)!=0; //transparency = ((texture->flags)&LIB3DS_TEXTURE_ALPHA_SOURCE)!=0;
// what is the wrap mode of the texture. // what is the wrap mode of the texture.
osg::Texture2D::WrapMode wm = ((texture->flags)&LIB3DS_TEXTURE_NO_TILE) ? osg::Texture2D::WrapMode wm = ((texture->flags)&LIB3DS_TEXTURE_NO_TILE) ?
@@ -1248,7 +1220,6 @@ ReaderWriter3DS::StateSetInfo ReaderWriter3DS::ReaderObject::createStateSet(Lib3
osg::Texture2D* texture1_map = createTexture(&(mat->texture1_map),"texture1_map",textureTransparency); osg::Texture2D* texture1_map = createTexture(&(mat->texture1_map),"texture1_map",textureTransparency);
if (texture1_map) if (texture1_map)
{ {
if(textureTransparency) transparency = true;
stateset->setTextureAttributeAndModes(unit, texture1_map, osg::StateAttribute::ON); stateset->setTextureAttributeAndModes(unit, texture1_map, osg::StateAttribute::ON);
double factor = mat->texture1_map.percent; double factor = mat->texture1_map.percent;
@@ -1329,7 +1300,7 @@ ReaderWriter3DS::StateSetInfo ReaderWriter3DS::ReaderObject::createStateSet(Lib3
if ((alpha < 1.0f) || transparency) if ((alpha < 1.0f) || transparency)
{ {
stateset->setAttributeAndModes(new osg::BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); //stateset->setAttributeAndModes(new osg::BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
stateset->setMode(GL_BLEND,osg::StateAttribute::ON); stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
} }

View File

@@ -1268,7 +1268,7 @@ SbBool SoVRMLImageTextureOsg::readInstance(SoInput *in, unsigned short flags)
if (url.getNum() && url[0].getLength()) if (url.getNum() && url[0].getLength())
{ {
osg::ref_ptr<osg::Image> image = loadImage(url[0].getString(), options); osg::ref_ptr<osg::Image> image = loadImage(url[0].getString(), options);
if (!image.valid()) if (!image->valid())
{ {
OSG_WARN << "Could not read texture file: " << url[0].getString() << std::endl; OSG_WARN << "Could not read texture file: " << url[0].getString() << std::endl;
this->setReadStatus(FALSE); this->setReadStatus(FALSE);

View File

@@ -220,15 +220,7 @@ protected:
material->setDiffuse (osg::Material::FRONT_AND_BACK,osg::Vec4(diffuse,alpha)); material->setDiffuse (osg::Material::FRONT_AND_BACK,osg::Vec4(diffuse,alpha));
material->setSpecular(osg::Material::FRONT_AND_BACK,osg::Vec4(specular,alpha)); material->setSpecular(osg::Material::FRONT_AND_BACK,osg::Vec4(specular,alpha));
material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(emissive,alpha)); material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(emissive,alpha));
material->setShininess(osg::Material::FRONT_AND_BACK,shininess);
if (shininess>=0.0f)
{
material->setShininess(osg::Material::FRONT_AND_BACK,shininess);
}
else
{
OSG_INFO<<"Warning: OpenFlight shininess value out of range: "<<shininess<<std::endl;
}
MaterialPool* mp = document.getOrCreateMaterialPool(); MaterialPool* mp = document.getOrCreateMaterialPool();
(*mp)[index] = material; (*mp)[index] = material;
@@ -274,15 +266,7 @@ protected:
material->setDiffuse (osg::Material::FRONT_AND_BACK,osg::Vec4(diffuse,alpha)); material->setDiffuse (osg::Material::FRONT_AND_BACK,osg::Vec4(diffuse,alpha));
material->setSpecular(osg::Material::FRONT_AND_BACK,osg::Vec4(specular,alpha)); material->setSpecular(osg::Material::FRONT_AND_BACK,osg::Vec4(specular,alpha));
material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(emissive,alpha)); material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(emissive,alpha));
material->setShininess(osg::Material::FRONT_AND_BACK,shininess);
if (shininess>=0.0f)
{
material->setShininess(osg::Material::FRONT_AND_BACK,shininess);
}
else
{
OSG_INFO<<"Warning: OpenFlight shininess value out of range: "<<shininess<<std::endl;
}
MaterialPool* mp = document.getOrCreateMaterialPool(); MaterialPool* mp = document.getOrCreateMaterialPool();
(*mp)[i] = material; (*mp)[i] = material;

View File

@@ -1047,7 +1047,7 @@ osg::Texture2D* daeReader::processTexture(
return NULL; return NULL;
} }
if (sampler->getSource() == NULL || sampler->getSource()->getValue() == NULL) if (sampler->getSource() == NULL )
{ {
OSG_WARN << "Could not locate source for sampler2D" << std::endl; OSG_WARN << "Could not locate source for sampler2D" << std::endl;
return NULL; return NULL;

View File

@@ -264,7 +264,7 @@ struct DXT1TexelsBlock
*/ */
#define FOURCC_DX10 (MAKEFOURCC('D','X','1','0')) #define FOURCC_DX10 (MAKEFOURCC('D','X','1','0'))
typedef enum OSG_DXGI_FORMAT { typedef enum OSG_DXGI_FORMAT {
OSG_DXGI_FORMAT_UNKNOWN = 0, OSG_DXGI_FORMAT_UNKNOWN = 0,
OSG_DXGI_FORMAT_R32G32B32A32_TYPELESS = 1, OSG_DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
OSG_DXGI_FORMAT_R32G32B32A32_FLOAT = 2, OSG_DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
@@ -384,7 +384,7 @@ typedef enum OSG_DXGI_FORMAT {
OSG_DXGI_FORMAT_FORCE_UINT = 0xffffffffUL OSG_DXGI_FORMAT_FORCE_UINT = 0xffffffffUL
} OSG_DXGI_FORMAT; } OSG_DXGI_FORMAT;
typedef enum OSG_D3D10_RESOURCE_DIMENSION { typedef enum OSG_D3D10_RESOURCE_DIMENSION {
OSG_D3D10_RESOURCE_DIMENSION_UNKNOWN = 0, OSG_D3D10_RESOURCE_DIMENSION_UNKNOWN = 0,
OSG_D3D10_RESOURCE_DIMENSION_BUFFER = 1, OSG_D3D10_RESOURCE_DIMENSION_BUFFER = 1,
OSG_D3D10_RESOURCE_DIMENSION_TEXTURE1D = 2, OSG_D3D10_RESOURCE_DIMENSION_TEXTURE1D = 2,
@@ -407,7 +407,7 @@ static unsigned int ComputeImageSizeInBytes( int width, int height, int depth,
if( width < 1 ) width = 1; if( width < 1 ) width = 1;
if( height < 1 ) height = 1; if( height < 1 ) height = 1;
if( depth < 1 ) depth = 1; if( depth < 1 ) depth = 1;
return osg::Image::computeImageSizeInBytes(width, height, depth, pixelFormat, pixelType, packing, slice_packing, image_packing); return osg::Image::computeImageSizeInBytes(width, height, depth, pixelFormat, pixelType, packing, slice_packing, image_packing);
} }
@@ -982,8 +982,6 @@ osg::Image* ReadDDSFile(std::istream& _istream, bool flipDDSRead)
} }
} }
OSG_INFO<<"ReadDDS, dataType = 0x"<<std::hex<<dataType<<std::endl;
unsigned char* imageData = new unsigned char [sizeWithMipmaps]; unsigned char* imageData = new unsigned char [sizeWithMipmaps];
if(!imageData) if(!imageData)
{ {
@@ -1016,9 +1014,8 @@ osg::Image* ReadDDSFile(std::istream& _istream, bool flipDDSRead)
if (flipDDSRead) { if (flipDDSRead) {
osgImage->setOrigin(osg::Image::BOTTOM_LEFT); osgImage->setOrigin(osg::Image::BOTTOM_LEFT);
if (!isDXTC || ((s>4 && s%4==0 && t>4 && t%4==0) || s<=4)) // Flip may crash (access violation) or fail for non %4 dimensions (except for s<4). Tested with revision trunk 2013-02-22. if (!isDXTC || ((s>4 && s%4==0 && t>4 && t%4==0) || s<4)) // Flip may crash (access violation) or fail for non %4 dimensions (except for s<4). Tested with revision trunk 2013-02-22.
{ {
OSG_INFO<<"Flipping dds on load"<<std::endl;
osgImage->flipVertical(); osgImage->flipVertical();
} }
else else
@@ -1064,9 +1061,7 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout, bool autoFlipDDSWri
unsigned int pixelSize = osg::Image::computePixelSizeInBits(pixelFormat, dataType); unsigned int pixelSize = osg::Image::computePixelSizeInBits(pixelFormat, dataType);
unsigned int imageSize = img->getTotalSizeInBytes(); unsigned int imageSize = img->getTotalSizeInBytes();
OSG_INFO<<"WriteDDS, dataType = 0x"<<std::hex<<dataType<<std::endl; // Check that theorical image size (computation taking into account DXTC blocks) is not bigger than actual image size.
// Check that theorical image size (computation taking into account DXTC blocks) is not bigger than actual image size.
// This may happen, for instance, if some operation tuncated the data buffer non block-aligned. Example: // This may happen, for instance, if some operation tuncated the data buffer non block-aligned. Example:
// - Read DXT1 image, size = 8x7. Actually, image data is 8x8 because it stores 4x4 blocks. // - Read DXT1 image, size = 8x7. Actually, image data is 8x8 because it stores 4x4 blocks.
// - Some hypothetical operation wrongly assumes the data buffer is 8x7 and truncates the buffer. This may even lead to access violations. // - Some hypothetical operation wrongly assumes the data buffer is 8x7 and truncates the buffer. This may even lead to access violations.
@@ -1276,12 +1271,10 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout, bool autoFlipDDSWri
osg::ref_ptr<const osg::Image> source; osg::ref_ptr<const osg::Image> source;
if (autoFlipDDSWrite && img->getOrigin() == osg::Image::BOTTOM_LEFT) if (autoFlipDDSWrite && img->getOrigin() == osg::Image::BOTTOM_LEFT)
{ {
OSG_INFO<<"Flipping dds image on write"<<std::endl;
osg::ref_ptr<osg::Image> copy( new osg::Image(*img,osg::CopyOp::DEEP_COPY_ALL) ); osg::ref_ptr<osg::Image> copy( new osg::Image(*img,osg::CopyOp::DEEP_COPY_ALL) );
const int s(copy->s()); const int s(copy->s());
const int t(copy->t()); const int t(copy->t());
if (!isDXTC || ((s>4 && s%4==0 && t>4 && t%4==0) || s<=4)) // Flip may crash (access violation) or fail for non %4 dimensions (except for s<4). Tested with revision trunk 2013-02-22. if (!isDXTC || ((s>4 && s%4==0 && t>4 && t%4==0) || s<4)) // Flip may crash (access violation) or fail for non %4 dimensions (except for s<4). Tested with revision trunk 2013-02-22.
{ {
copy->flipVertical(); copy->flipVertical();
} }
@@ -1290,7 +1283,7 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout, bool autoFlipDDSWri
OSG_WARN << "WriteDDSFile warning: Vertical flip was skipped. Image dimensions have to be multiple of 4." << std::endl; OSG_WARN << "WriteDDSFile warning: Vertical flip was skipped. Image dimensions have to be multiple of 4." << std::endl;
} }
source = copy; source = copy;
} }
else else
{ {
source = img; source = img;
@@ -1368,7 +1361,7 @@ public:
if (options) if (options)
{ {
std::istringstream iss(options->getOptionString()); std::istringstream iss(options->getOptionString());
std::string opt; std::string opt;
while (iss >> opt) while (iss >> opt)
{ {
if (opt == "dds_flip") dds_flip = true; if (opt == "dds_flip") dds_flip = true;

View File

@@ -24,7 +24,7 @@ using namespace Imath;
/**************************************************************************** /****************************************************************************
* *
* Follows is code written by FOI (www.foi.se) * Follows is code written by FOI (www.foi.se)
* it is a wrapper of openEXR(www.openexr.com) * it is a wraper of openEXR(www.openexr.com)
* to add suport of exr images into osg * to add suport of exr images into osg
* *
* Ported to a OSG-plugin, Ragnar Hammarqvist. * Ported to a OSG-plugin, Ragnar Hammarqvist.
@@ -92,7 +92,7 @@ unsigned char *exr_load(std::istream& fin,
unsigned char *buffer=NULL; // returned to sender & as read from the disk unsigned char *buffer=NULL; // returned to sender & as read from the disk
bool inputError = false; bool inputError = false;
Array2D<Rgba> pixels; Array2D<Rgba> pixels;
int width=0,height=0,numComponents; int width,height,numComponents;
try try
{ {
@@ -111,7 +111,6 @@ unsigned char *exr_load(std::istream& fin,
rgbafile.readPixels(dw.min.y, dw.max.y); rgbafile.readPixels(dw.min.y, dw.max.y);
} }
catch( char * str ) { catch( char * str ) {
OSG_WARN << "exr_load error : " << str << std::endl;
inputError = true; inputError = true;
} }
@@ -336,7 +335,6 @@ protected:
} }
catch( char * str ) catch( char * str )
{ {
OSG_WARN << "writeEXRStream error : " << str << std::endl;
writeOK = false; writeOK = false;
} }

View File

@@ -127,27 +127,6 @@ FbxMaterialToOsgStateSet::convert(const FbxSurfaceMaterial* pFbxMat)
} }
} }
// ambient map...
const FbxProperty lAmbientProperty = pFbxMat->FindProperty(FbxSurfaceMaterial::sAmbient);
if (lAmbientProperty.IsValid())
{
int lNbTex = lAmbientProperty.GetSrcObjectCount<FbxFileTexture>();
for (int lTextureIndex = 0; lTextureIndex < lNbTex; lTextureIndex++)
{
FbxFileTexture* lTexture = FbxCast<FbxFileTexture>(lAmbientProperty.GetSrcObject<FbxFileTexture>(lTextureIndex));
if (lTexture)
{
result.ambientTexture = fbxTextureToOsgTexture(lTexture);
result.ambientChannel = lTexture->UVSet.Get();
result.ambientScaleU = lTexture->GetScaleU();
result.ambientScaleV = lTexture->GetScaleV();
}
//For now only allow 1 texture
break;
}
}
if (pFbxLambert) if (pFbxLambert)
{ {
FbxDouble3 color = pFbxLambert->Diffuse.Get(); FbxDouble3 color = pFbxLambert->Diffuse.Get();

View File

@@ -22,8 +22,7 @@ struct StateSetContent
StateSetContent() StateSetContent()
: diffuseFactor(1.0), : diffuseFactor(1.0),
reflectionFactor(1.0), reflectionFactor(1.0),
emissiveFactor(1.0), emissiveFactor(1.0)
ambientFactor(1.0)
{ {
} }
@@ -34,7 +33,6 @@ struct StateSetContent
osg::ref_ptr<osg::Texture2D> opacityTexture; osg::ref_ptr<osg::Texture2D> opacityTexture;
osg::ref_ptr<osg::Texture2D> reflectionTexture; osg::ref_ptr<osg::Texture2D> reflectionTexture;
osg::ref_ptr<osg::Texture2D> emissiveTexture; osg::ref_ptr<osg::Texture2D> emissiveTexture;
osg::ref_ptr<osg::Texture2D> ambientTexture;
// more textures types here... // more textures types here...
// textures maps channels names... // textures maps channels names...
@@ -42,14 +40,12 @@ struct StateSetContent
std::string opacityChannel; std::string opacityChannel;
std::string reflectionChannel; std::string reflectionChannel;
std::string emissiveChannel; std::string emissiveChannel;
std::string ambientChannel;
// more channels names here... // more channels names here...
// combining factors... // combining factors...
double diffuseFactor; double diffuseFactor;
double reflectionFactor; double reflectionFactor;
double emissiveFactor; double emissiveFactor;
double ambientFactor;
// more combining factors here... // more combining factors here...
double diffuseScaleU; double diffuseScaleU;
@@ -58,8 +54,6 @@ struct StateSetContent
double opacityScaleV; double opacityScaleV;
double emissiveScaleU; double emissiveScaleU;
double emissiveScaleV; double emissiveScaleV;
double ambientScaleU;
double ambientScaleV;
// texture units (eventually used for each texture map)... // texture units (eventually used for each texture map)...
enum TextureUnit enum TextureUnit
@@ -67,8 +61,7 @@ struct StateSetContent
DIFFUSE_TEXTURE_UNIT = 0, DIFFUSE_TEXTURE_UNIT = 0,
OPACITY_TEXTURE_UNIT, OPACITY_TEXTURE_UNIT,
REFLECTION_TEXTURE_UNIT, REFLECTION_TEXTURE_UNIT,
EMISSIVE_TEXTURE_UNIT, EMISSIVE_TEXTURE_UNIT
AMBIENT_TEXTURE_UNIT
// more texture units here... // more texture units here...
}; };
}; };

View File

@@ -154,7 +154,6 @@ osg::Geometry* getGeometry(osg::Geode* pGeode, GeometryMap& geometryMap,
bool useDiffuseMap, bool useDiffuseMap,
bool useOpacityMap, bool useOpacityMap,
bool useEmissiveMap, bool useEmissiveMap,
bool useAmbientMap,
// more here... // more here...
bool bColor, bool bColor,
const osgDB::Options& options, const osgDB::Options& options,
@@ -189,8 +188,6 @@ osg::Geometry* getGeometry(osg::Geode* pGeode, GeometryMap& geometryMap,
pGeometry->setTexCoordArray(StateSetContent::OPACITY_TEXTURE_UNIT, createVec2Array((precision & osgDB::Options::DOUBLE_PRECISION_TEX_COORD) != 0), osg::Array::BIND_PER_VERTEX); pGeometry->setTexCoordArray(StateSetContent::OPACITY_TEXTURE_UNIT, createVec2Array((precision & osgDB::Options::DOUBLE_PRECISION_TEX_COORD) != 0), osg::Array::BIND_PER_VERTEX);
if (useEmissiveMap) if (useEmissiveMap)
pGeometry->setTexCoordArray(StateSetContent::EMISSIVE_TEXTURE_UNIT, createVec2Array((precision & osgDB::Options::DOUBLE_PRECISION_TEX_COORD) != 0), osg::Array::BIND_PER_VERTEX); pGeometry->setTexCoordArray(StateSetContent::EMISSIVE_TEXTURE_UNIT, createVec2Array((precision & osgDB::Options::DOUBLE_PRECISION_TEX_COORD) != 0), osg::Array::BIND_PER_VERTEX);
if (useAmbientMap)
pGeometry->setTexCoordArray(StateSetContent::AMBIENT_TEXTURE_UNIT, createVec2Array((precision & osgDB::Options::DOUBLE_PRECISION_TEX_COORD) != 0), osg::Array::BIND_PER_VERTEX);
// create more textures coordinates here... // create more textures coordinates here...
if (bColor) pGeometry->setColorArray(createVec4Array((precision & osgDB::Options::DOUBLE_PRECISION_COLOR) != 0), osg::Array::BIND_PER_VERTEX); if (bColor) pGeometry->setColorArray(createVec4Array((precision & osgDB::Options::DOUBLE_PRECISION_COLOR) != 0), osg::Array::BIND_PER_VERTEX);
@@ -304,22 +301,6 @@ osg::Geometry* getGeometry(osg::Geode* pGeode, GeometryMap& geometryMap,
stateSet->setTextureAttributeAndModes(StateSetContent::EMISSIVE_TEXTURE_UNIT, ssc.emissiveTexture.get()); stateSet->setTextureAttributeAndModes(StateSetContent::EMISSIVE_TEXTURE_UNIT, ssc.emissiveTexture.get());
} }
// ambient texture map
if (ssc.ambientTexture)
{
if (ssc.ambientScaleU != 1.0 || ssc.ambientScaleV != 1.0)
{
// set UV scaling...
osg::ref_ptr<osg::TexMat> texmat = new osg::TexMat();
osg::Matrix uvScaling;
uvScaling.makeScale(osg::Vec3(ssc.ambientScaleU, ssc.ambientScaleV, 1.0));
texmat->setMatrix(uvScaling);
stateSet->setTextureAttributeAndModes(StateSetContent::AMBIENT_TEXTURE_UNIT, texmat.get(), osg::StateAttribute::ON);
}
stateSet->setTextureAttributeAndModes(StateSetContent::AMBIENT_TEXTURE_UNIT, ssc.ambientTexture.get());
}
// add more texture maps here... // add more texture maps here...
if (transparent) if (transparent)
@@ -502,8 +483,6 @@ std::string getUVChannelForTextureMap(std::vector<StateSetContent>& stateSetList
return stateSetList[i].reflectionChannel; return stateSetList[i].reflectionChannel;
if (0 == strcmp(pName, FbxSurfaceMaterial::sEmissive)) if (0 == strcmp(pName, FbxSurfaceMaterial::sEmissive))
return stateSetList[i].emissiveChannel; return stateSetList[i].emissiveChannel;
if (0 == strcmp(pName, FbxSurfaceMaterial::sAmbient))
return stateSetList[i].ambientChannel;
// more here... // more here...
} }
@@ -557,7 +536,6 @@ void readMeshTriangle(const FbxMesh * fbxMesh, int i /*polygonIndex*/,
const FbxLayerElementUV* pFbxUVs_diffuse, const FbxLayerElementUV* pFbxUVs_diffuse,
const FbxLayerElementUV* pFbxUVs_opacity, const FbxLayerElementUV* pFbxUVs_opacity,
const FbxLayerElementUV* pFbxUVs_emissive, const FbxLayerElementUV* pFbxUVs_emissive,
const FbxLayerElementUV* pFbxUVs_ambient,
const FbxLayerElementVertexColor* pFbxColors, const FbxLayerElementVertexColor* pFbxColors,
osg::Geometry* pGeometry, osg::Geometry* pGeometry,
osg::Array* pVertices, osg::Array* pVertices,
@@ -565,7 +543,6 @@ void readMeshTriangle(const FbxMesh * fbxMesh, int i /*polygonIndex*/,
osg::Array* pTexCoords_diffuse, osg::Array* pTexCoords_diffuse,
osg::Array* pTexCoords_opacity, osg::Array* pTexCoords_opacity,
osg::Array* pTexCoords_emissive, osg::Array* pTexCoords_emissive,
osg::Array* pTexCoords_ambient,
osg::Array* pColors) osg::Array* pColors)
{ {
int v0 = fbxMesh->GetPolygonVertex(i, posInPoly0), int v0 = fbxMesh->GetPolygonVertex(i, posInPoly0),
@@ -617,12 +594,6 @@ void readMeshTriangle(const FbxMesh * fbxMesh, int i /*polygonIndex*/,
addVec2ArrayElement(*pTexCoords_emissive, getElement(pFbxUVs_emissive, fbxMesh, i, posInPoly1, meshVertex1)); addVec2ArrayElement(*pTexCoords_emissive, getElement(pFbxUVs_emissive, fbxMesh, i, posInPoly1, meshVertex1));
addVec2ArrayElement(*pTexCoords_emissive, getElement(pFbxUVs_emissive, fbxMesh, i, posInPoly2, meshVertex2)); addVec2ArrayElement(*pTexCoords_emissive, getElement(pFbxUVs_emissive, fbxMesh, i, posInPoly2, meshVertex2));
} }
if (pTexCoords_ambient && (pTexCoords_ambient != pTexCoords_opacity) && (pTexCoords_ambient != pTexCoords_diffuse) && (pTexCoords_ambient != pTexCoords_emissive))
{
addVec2ArrayElement(*pTexCoords_ambient, getElement(pFbxUVs_ambient, fbxMesh, i, posInPoly0, meshVertex0));
addVec2ArrayElement(*pTexCoords_ambient, getElement(pFbxUVs_ambient, fbxMesh, i, posInPoly1, meshVertex1));
addVec2ArrayElement(*pTexCoords_ambient, getElement(pFbxUVs_ambient, fbxMesh, i, posInPoly2, meshVertex2));
}
// add more texture maps here... // add more texture maps here...
if (pColors) if (pColors)
@@ -724,14 +695,12 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
std::string diffuseChannel = getUVChannelForTextureMap(stateSetList, FbxSurfaceMaterial::sDiffuse); std::string diffuseChannel = getUVChannelForTextureMap(stateSetList, FbxSurfaceMaterial::sDiffuse);
std::string opacityChannel = getUVChannelForTextureMap(stateSetList, FbxSurfaceMaterial::sTransparentColor); std::string opacityChannel = getUVChannelForTextureMap(stateSetList, FbxSurfaceMaterial::sTransparentColor);
std::string emissiveChannel = getUVChannelForTextureMap(stateSetList, FbxSurfaceMaterial::sEmissive); std::string emissiveChannel = getUVChannelForTextureMap(stateSetList, FbxSurfaceMaterial::sEmissive);
std::string ambientChannel = getUVChannelForTextureMap(stateSetList, FbxSurfaceMaterial::sAmbient);
// look for more UV elements here... // look for more UV elements here...
// UV elements... // UV elements...
const FbxLayerElementUV* pFbxUVs_diffuse = getUVElementForChannel(diffuseChannel, FbxLayerElement::eTextureDiffuse, fbxMesh); const FbxLayerElementUV* pFbxUVs_diffuse = getUVElementForChannel(diffuseChannel, FbxLayerElement::eTextureDiffuse, fbxMesh);
const FbxLayerElementUV* pFbxUVs_opacity = getUVElementForChannel(opacityChannel, FbxLayerElement::eTextureTransparency, fbxMesh); const FbxLayerElementUV* pFbxUVs_opacity = getUVElementForChannel(opacityChannel, FbxLayerElement::eTextureTransparency, fbxMesh);
const FbxLayerElementUV* pFbxUVs_emissive = getUVElementForChannel(emissiveChannel, FbxLayerElement::eTextureEmissive, fbxMesh); const FbxLayerElementUV* pFbxUVs_emissive = getUVElementForChannel(emissiveChannel, FbxLayerElement::eTextureEmissive, fbxMesh);
const FbxLayerElementUV* pFbxUVs_ambient = getUVElementForChannel(ambientChannel, FbxLayerElement::eTextureAmbient, fbxMesh);
// more UV elements here... // more UV elements here...
// check elements validity... // check elements validity...
@@ -741,7 +710,6 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
if (!layerElementValid(pFbxUVs_diffuse)) pFbxUVs_diffuse = 0; if (!layerElementValid(pFbxUVs_diffuse)) pFbxUVs_diffuse = 0;
if (!layerElementValid(pFbxUVs_opacity)) pFbxUVs_opacity = 0; if (!layerElementValid(pFbxUVs_opacity)) pFbxUVs_opacity = 0;
if (!layerElementValid(pFbxUVs_emissive)) pFbxUVs_emissive = 0; if (!layerElementValid(pFbxUVs_emissive)) pFbxUVs_emissive = 0;
if (!layerElementValid(pFbxUVs_ambient)) pFbxUVs_ambient = 0;
// more here... // more here...
int nPolys = fbxMesh->GetPolygonCount(); int nPolys = fbxMesh->GetPolygonCount();
@@ -782,7 +750,6 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
pFbxUVs_diffuse != 0, pFbxUVs_diffuse != 0,
pFbxUVs_opacity != 0, pFbxUVs_opacity != 0,
pFbxUVs_emissive != 0, pFbxUVs_emissive != 0,
pFbxUVs_ambient != 0,
// more UV elements here... // more UV elements here...
pFbxColors != 0, pFbxColors != 0,
options, options,
@@ -795,7 +762,6 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
osg::Array* pTexCoords_diffuse = pGeometry->getTexCoordArray(StateSetContent::DIFFUSE_TEXTURE_UNIT); osg::Array* pTexCoords_diffuse = pGeometry->getTexCoordArray(StateSetContent::DIFFUSE_TEXTURE_UNIT);
osg::Array* pTexCoords_opacity = pGeometry->getTexCoordArray(StateSetContent::OPACITY_TEXTURE_UNIT); osg::Array* pTexCoords_opacity = pGeometry->getTexCoordArray(StateSetContent::OPACITY_TEXTURE_UNIT);
osg::Array* pTexCoords_emissive = pGeometry->getTexCoordArray(StateSetContent::EMISSIVE_TEXTURE_UNIT); osg::Array* pTexCoords_emissive = pGeometry->getTexCoordArray(StateSetContent::EMISSIVE_TEXTURE_UNIT);
osg::Array* pTexCoords_ambient = pGeometry->getTexCoordArray(StateSetContent::AMBIENT_TEXTURE_UNIT);
// more texture coordinates here... // more texture coordinates here...
osg::Array* pColors = pGeometry->getColorArray(); osg::Array* pColors = pGeometry->getColorArray();
@@ -807,9 +773,9 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
0, 1, 2, 0, 1, 2,
nVertex, nVertex+1, nVertex+2, nVertex, nVertex+1, nVertex+2,
fbxToOsgVertMap, osgToFbxNormMap, fbxToOsgVertMap, osgToFbxNormMap,
pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxUVs_ambient, pFbxColors, pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxColors,
pGeometry, pGeometry,
pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pTexCoords_ambient, pColors); pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pColors);
nVertex += 3; nVertex += 3;
} }
else if (lPolygonSize == 4) else if (lPolygonSize == 4)
@@ -824,16 +790,16 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
0, 1, p02, 0, 1, p02,
nVertex, nVertex+1, nVertex+p02, nVertex, nVertex+1, nVertex+p02,
fbxToOsgVertMap, osgToFbxNormMap, fbxToOsgVertMap, osgToFbxNormMap,
pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxUVs_ambient, pFbxColors, pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxColors,
pGeometry, pGeometry,
pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pTexCoords_ambient, pColors); pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pColors);
readMeshTriangle(fbxMesh, i, readMeshTriangle(fbxMesh, i,
p10, 2, 3, p10, 2, 3,
nVertex+p10, nVertex+2, nVertex+3, nVertex+p10, nVertex+2, nVertex+3,
fbxToOsgVertMap, osgToFbxNormMap, fbxToOsgVertMap, osgToFbxNormMap,
pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxUVs_ambient, pFbxColors, pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxColors,
pGeometry, pGeometry,
pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pTexCoords_ambient, pColors); pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pColors);
nVertex += 4; nVertex += 4;
} }
else if (tessellatePolygons) else if (tessellatePolygons)
@@ -853,9 +819,9 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
0, j - 1, j, 0, j - 1, j,
nVertex0, nVertex - 1, nVertex, nVertex0, nVertex - 1, nVertex,
fbxToOsgVertMap, osgToFbxNormMap, fbxToOsgVertMap, osgToFbxNormMap,
pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxUVs_ambient, pFbxColors, pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxColors,
pGeometry, pGeometry,
pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pTexCoords_ambient, pColors); pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pColors);
} }
} }
} }
@@ -885,7 +851,6 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
osg::Array* pTexCoords_diffuse = pGeometry->getTexCoordArray(StateSetContent::DIFFUSE_TEXTURE_UNIT); osg::Array* pTexCoords_diffuse = pGeometry->getTexCoordArray(StateSetContent::DIFFUSE_TEXTURE_UNIT);
osg::Array* pTexCoords_opacity = pGeometry->getTexCoordArray(StateSetContent::OPACITY_TEXTURE_UNIT); osg::Array* pTexCoords_opacity = pGeometry->getTexCoordArray(StateSetContent::OPACITY_TEXTURE_UNIT);
osg::Array* pTexCoords_emissive = pGeometry->getTexCoordArray(StateSetContent::EMISSIVE_TEXTURE_UNIT); osg::Array* pTexCoords_emissive = pGeometry->getTexCoordArray(StateSetContent::EMISSIVE_TEXTURE_UNIT);
osg::Array* pTexCoords_ambient = pGeometry->getTexCoordArray(StateSetContent::AMBIENT_TEXTURE_UNIT);
osg::Array* pColors = pGeometry->getColorArray(); osg::Array* pColors = pGeometry->getColorArray();
// Index of the 1st vertex of the polygon in the geometry // Index of the 1st vertex of the polygon in the geometry
int osgVertex0 = pVertices->getNumElements(); int osgVertex0 = pVertices->getNumElements();
@@ -918,10 +883,6 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
{ {
addVec2ArrayElement(*pTexCoords_emissive, getElement(pFbxUVs_emissive, fbxMesh, i, j, nVertex)); addVec2ArrayElement(*pTexCoords_emissive, getElement(pFbxUVs_emissive, fbxMesh, i, j, nVertex));
} }
if (pTexCoords_ambient && (pTexCoords_ambient != pTexCoords_opacity) && (pTexCoords_ambient != pTexCoords_diffuse))
{
addVec2ArrayElement(*pTexCoords_ambient, getElement(pFbxUVs_ambient, fbxMesh, i, j, nVertex));
}
// add more texture maps here... // add more texture maps here...
if (pColors) if (pColors)

View File

@@ -21,7 +21,7 @@ ADD_DEFINITIONS(-D__STDC_CONSTANT_MACROS)
# MESSAGE("FFMPEG_LIBAVUTIL_INCLUDE_DIRS = " ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} ) # MESSAGE("FFMPEG_LIBAVUTIL_INCLUDE_DIRS = " ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} )
# MESSAGE("FFMPEG_LIBRARIES = " ${FFMPEG_LIBRARIES} ) # MESSAGE("FFMPEG_LIBRARIES = " ${FFMPEG_LIBRARIES} )
SET(TARGET_SRC SET(TARGET_SRC
FFmpegClocks.cpp FFmpegClocks.cpp
FFmpegDecoderAudio.cpp FFmpegDecoderAudio.cpp
FFmpegDecoder.cpp FFmpegDecoder.cpp
@@ -46,8 +46,9 @@ SET(TARGET_H
MessageQueue.hpp MessageQueue.hpp
) )
IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") # Remove -pedantic flag as it barfs on ffmoeg headers
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDIF() ENDIF()
#### end var setup ### #### end var setup ###

View File

@@ -14,9 +14,6 @@
#endif #endif
#if LIBAVCODEC_VERSION_MAJOR < 56
#define AV_CODEC_ID_NONE CODEC_ID_NONE
#endif
namespace osgFFmpeg { namespace osgFFmpeg {
@@ -24,54 +21,7 @@ static int decode_audio(AVCodecContext *avctx, int16_t *samples,
int *frame_size_ptr, int *frame_size_ptr,
const uint8_t *buf, int buf_size) const uint8_t *buf, int buf_size)
{ {
#if LIBAVCODEC_VERSION_MAJOR >= 56 #if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR==52 && LIBAVCODEC_VERSION_MINOR>=32)
AVFrame *frame = av_frame_alloc();
if (!frame) return AVERROR(ENOMEM);
AVPacket avpkt;
av_init_packet(&avpkt);
avpkt.data = const_cast<uint8_t *>(buf);
avpkt.size = buf_size;
int got_frame = 0;
int result = avcodec_decode_audio4(avctx, frame, &got_frame, &avpkt);
if (result>=0 && got_frame)
{
int ch, plane_size;
int planar = av_sample_fmt_is_planar(avctx->sample_fmt);
int data_size = av_samples_get_buffer_size(&plane_size, avctx->channels, frame->nb_samples, avctx->sample_fmt, 1);
if (*frame_size_ptr < data_size)
{
av_log(avctx, AV_LOG_ERROR, "output buffer size is too small for "
"the current frame (%d < %d)\n", *frame_size_ptr, data_size);
av_frame_free(&frame);
return AVERROR(EINVAL);
}
memcpy(samples, frame->extended_data[0], plane_size);
if (planar && avctx->channels > 1)
{
uint8_t *out = ((uint8_t *)samples) + plane_size;
for (ch = 1; ch < avctx->channels; ch++)
{
memcpy(out, frame->extended_data[ch], plane_size);
out += plane_size;
}
}
*frame_size_ptr = data_size;
}
else
{
*frame_size_ptr = 0;
}
av_frame_free(&frame);
return result;
#elif LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR==52 && LIBAVCODEC_VERSION_MINOR>=32)
// following code segment copied from ffmpeg's avcodec_decode_audio2() // following code segment copied from ffmpeg's avcodec_decode_audio2()
// implementation to avoid warnings about deprecated function usage. // implementation to avoid warnings about deprecated function usage.
@@ -127,10 +77,6 @@ void FFmpegDecoderAudio::open(AVStream * const stream)
m_frequency = m_context->sample_rate; m_frequency = m_context->sample_rate;
m_nb_channels = m_context->channels; m_nb_channels = m_context->channels;
OSG_NOTICE<<"FFmpegDecoderAudio::open(..), m_nb_channels="<<m_nb_channels<<", m_context->sample_fmt="<<m_context->sample_fmt<<std::endl;
switch (m_context->sample_fmt) switch (m_context->sample_fmt)
{ {
case AV_SAMPLE_FMT_NONE: case AV_SAMPLE_FMT_NONE:
@@ -154,7 +100,7 @@ void FFmpegDecoderAudio::open(AVStream * const stream)
} }
// Check stream sanity // Check stream sanity
if (m_context->codec_id == AV_CODEC_ID_NONE) if (m_context->codec_id == CODEC_ID_NONE)
throw std::runtime_error("invalid audio codec");; throw std::runtime_error("invalid audio codec");;
// Find the decoder for the audio stream // Find the decoder for the audio stream

View File

@@ -10,7 +10,7 @@ namespace osgFFmpeg {
// TODO - add support for using RGB or RGBA pixel format. // TODO - add support for using RGB or RGBA pixel format.
// Note from Jason Daly in a osg-submissions thread, "The pix_fmt field of AVCodecContext will indicate the pixel format of the decoded video" // Note from Jason Daly in a osg-submissions thread, "The pix_fmt field of AVCodecContext will indicate the pixel format of the decoded video"
FFmpegDecoderVideo::FFmpegDecoderVideo(PacketQueue & packets, FFmpegClocks & clocks) : FFmpegDecoderVideo::FFmpegDecoderVideo(PacketQueue & packets, FFmpegClocks & clocks) :
m_packets(packets), m_packets(packets),
@@ -74,11 +74,7 @@ void FFmpegDecoderVideo::open(AVStream * const stream)
m_alpha_channel = (m_context->pix_fmt == PIX_FMT_YUVA420P); m_alpha_channel = (m_context->pix_fmt == PIX_FMT_YUVA420P);
// Find out the framerate // Find out the framerate
#if LIBAVCODEC_VERSION_MAJOR >= 56
m_frame_rate = av_q2d(stream->avg_frame_rate);
#else
m_frame_rate = av_q2d(stream->r_frame_rate); m_frame_rate = av_q2d(stream->r_frame_rate);
#endif
// Find the decoder for the video stream // Find the decoder for the video stream
m_codec = avcodec_find_decoder(m_context->codec_id); m_codec = avcodec_find_decoder(m_context->codec_id);

View File

@@ -561,11 +561,7 @@ GifImageStream** obj)
*width_ret = giffile->SWidth; *width_ret = giffile->SWidth;
*height_ret = giffile->SHeight; *height_ret = giffile->SHeight;
*numComponents_ret = 4; *numComponents_ret = 4;
#if (GIFLIB_MAJOR >= 5&& !(GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0))
DGifCloseFile(giffile, &Error);
#else
DGifCloseFile(giffile); DGifCloseFile(giffile);
#endif
return buffer; return buffer;
} }

View File

@@ -18,7 +18,6 @@ using namespace lwosg;
namespace namespace
{ {
#if 0
bool triangle_is_clockwise(const osg::Vec3Array *points, int a, int b, int c) bool triangle_is_clockwise(const osg::Vec3Array *points, int a, int b, int c)
{ {
const osg::Vec3 &A = (*points)[a]; const osg::Vec3 &A = (*points)[a];
@@ -30,7 +29,6 @@ namespace
area2 += C.x() * A.y() - A.x() * C.y(); area2 += C.x() * A.y() - A.x() * C.y();
return area2 < 0; return area2 < 0;
} }
#endif
float cylindrical_angle(float x, float y) float cylindrical_angle(float x, float y)
{ {

View File

@@ -208,12 +208,12 @@ load_md2 (const char *filename, const osgDB::ReaderWriter::Options* options)
// read in the frame info into a vector // read in the frame info into a vector
const char *last_frame_name = NULL; const char *last_frame_name = NULL;
osg::ref_ptr<osg::Vec3Array> vertexCoords = NULL; osg::Vec3Array *vertexCoords = NULL;
osg::ref_ptr<osg::Vec2Array> texCoords = NULL; osg::Vec2Array *texCoords = NULL;
osg::ref_ptr<osg::UIntArray> vertexIndices = NULL; osg::UIntArray *vertexIndices = NULL;
osg::ref_ptr<osg::UIntArray> texIndices = NULL; osg::UIntArray *texIndices = NULL;
osg::ref_ptr<osg::Vec3Array> normalCoords = NULL; osg::Vec3Array *normalCoords = NULL;
osg::ref_ptr<osg::UIntArray> normalIndices = NULL; osg::UIntArray *normalIndices = NULL;
// load the texture skins // load the texture skins
@@ -375,24 +375,24 @@ load_md2 (const char *filename, const osgDB::ReaderWriter::Options* options)
} }
} }
osg::ref_ptr<deprecated_osg::Geometry> geom = new deprecated_osg::Geometry; deprecated_osg::Geometry *geom = new deprecated_osg::Geometry;
geom->setVertexArray (vertexCoords.get()); geom->setVertexArray (vertexCoords);
geom->setVertexIndices (vertexIndices.get()); geom->setVertexIndices (vertexIndices);
geom->setTexCoordArray (0, texCoords.get()); geom->setTexCoordArray (0, texCoords);
geom->setTexCoordIndices (0, texIndices.get()); geom->setTexCoordIndices (0, texIndices);
geom->setNormalArray (normalCoords.get()); geom->setNormalArray (normalCoords);
geom->setNormalIndices (normalIndices.get()); geom->setNormalIndices (normalIndices);
geom->setNormalBinding (deprecated_osg::Geometry::BIND_PER_VERTEX); geom->setNormalBinding (deprecated_osg::Geometry::BIND_PER_VERTEX);
geom->addPrimitiveSet (new osg::DrawArrays (osg::PrimitiveSet::TRIANGLES, 0, vertexIndices->size ())); geom->addPrimitiveSet (new osg::DrawArrays (osg::PrimitiveSet::TRIANGLES, 0, vertexIndices->size ()));
osg::ref_ptr<osg::Geode> geode = new osg::Geode; osg::Geode *geode = new osg::Geode;
geode->addDrawable (geom.get()); geode->addDrawable (geom);
current_sequence->addChild (geode.get()); current_sequence->addChild (geode);
current_sequence->setTime (sequence_frame, 0.2f); current_sequence->setTime (sequence_frame, 0.2f);
sequence_frame++; sequence_frame++;

View File

@@ -867,7 +867,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& fil
// code for setting up the database path so that internally referenced file are searched for on relative paths. // code for setting up the database path so that internally referenced file are searched for on relative paths.
osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options;
local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); local_opt->setDatabasePath(osgDB::getFilePath(fileName));
obj::Model model; obj::Model model;
model.setDatabasePath(osgDB::getFilePath(fileName.c_str())); model.setDatabasePath(osgDB::getFilePath(fileName.c_str()));
@@ -875,7 +875,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& fil
ObjOptionsStruct localOptions = parseOptions(options); ObjOptionsStruct localOptions = parseOptions(options);
osg::Node* node = convertModelToSceneGraph(model, localOptions, local_opt.get()); osg::Node* node = convertModelToSceneGraph(model, localOptions, options);
return node; return node;
} }

View File

@@ -134,20 +134,11 @@ public:
virtual ReadResult readFile(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const virtual ReadResult readFile(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
{ {
#if GDAL_VERSION_MAJOR<2
if (OGRSFDriverRegistrar::GetRegistrar()->GetDriverCount() == 0) if (OGRSFDriverRegistrar::GetRegistrar()->GetDriverCount() == 0)
OGRRegisterAll(); OGRRegisterAll();
// Try to open data source // Try to open data source
OGRDataSource* file = OGRSFDriverRegistrar::Open(fileName.c_str()); OGRDataSource* file = OGRSFDriverRegistrar::Open(fileName.c_str());
#else
if (GDALGetDriverCount() == 0)
GDALAllRegister();
// Try to open data source
GDALDataset* file = (GDALDataset*) GDALOpenEx( fileName.c_str(), GDAL_OF_VECTOR, NULL, NULL, NULL );
#endif
if (!file) if (!file)
return 0; return 0;
@@ -165,7 +156,6 @@ public:
osg::Group* group = new osg::Group; osg::Group* group = new osg::Group;
#if GDAL_VERSION_MAJOR<2
for (int i = 0; i < file->GetLayerCount(); i++) for (int i = 0; i < file->GetLayerCount(); i++)
{ {
osg::Group* node = readLayer(file->GetLayer(i), file->GetName(), useRandomColorByFeature, addGroupPerFeature); osg::Group* node = readLayer(file->GetLayer(i), file->GetName(), useRandomColorByFeature, addGroupPerFeature);
@@ -173,17 +163,6 @@ public:
group->addChild( node ); group->addChild( node );
} }
OGRDataSource::DestroyDataSource( file ); OGRDataSource::DestroyDataSource( file );
#else
for (int i = 0; i < GDALDatasetGetLayerCount(file); i++)
{
OGRLayer* layer = (OGRLayer *)GDALDatasetGetLayer(file, i);
osg::Group* node = readLayer(layer, layer->GetName(), useRandomColorByFeature, addGroupPerFeature);
if (node)
group->addChild( node );
}
GDALClose( file );
#endif
return group; return group;
} }

View File

@@ -1,9 +1,5 @@
SET(TARGET_SRC ReaderWriterPDF.cpp ) SET(TARGET_SRC ReaderWriterPDF.cpp )
IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
REMOVE_CXX_FLAG(-pedantic)
ENDIF()
INCLUDE_DIRECTORIES( ${CAIRO_INCLUDE_DIRS} ${POPPLER_INCLUDE_DIRS} ) INCLUDE_DIRECTORIES( ${CAIRO_INCLUDE_DIRS} ${POPPLER_INCLUDE_DIRS} )
LINK_DIRECTORIES(${CAIRO_LIBRARY_DIRS} ${POPPLER_LIBRARY_DIRS}) LINK_DIRECTORIES(${CAIRO_LIBRARY_DIRS} ${POPPLER_LIBRARY_DIRS})
SET(TARGET_EXTERNAL_LIBRARIES ${CAIRO_LIBRARIES} ${POPPLER_LIBRARIES} ) SET(TARGET_EXTERNAL_LIBRARIES ${CAIRO_LIBRARIES} ${POPPLER_LIBRARIES} )

View File

@@ -39,11 +39,7 @@ JoystickDevice::JoystickDevice()
std::cout<<"number of joysticks "<<numJoysticks<<std::endl; std::cout<<"number of joysticks "<<numJoysticks<<std::endl;
for(int i=0; i<numJoysticks; ++i) for(int i=0; i<numJoysticks; ++i)
{ {
#if SDL_VERSION_ATLEAST(2, 0, 0) std::cout<<"Joystick name '"<<SDL_JoystickName(i)<<"'"<<std::endl;
std::cout << "Joystick name '" << SDL_JoystickNameForIndex(i) << "'" << std::endl;
#else
std::cout << "Joystick name '" << SDL_JoystickName(i) << "'" << std::endl;
#endif
} }
} }

View File

@@ -248,7 +248,7 @@ simage_tiff_error(char * buffer, int buflen)
strncpy(buffer, "TIFF loader: Error opening file", buflen); strncpy(buffer, "TIFF loader: Error opening file", buflen);
break; break;
case ERR_READ: case ERR_READ:
strncpy(buffer, "TIFF loader: Error reading/decoding file", buflen); strncpy(buffer, "TIFF loader: Error reding/decoding file", buflen);
break; break;
case ERR_MEM: case ERR_MEM:
strncpy(buffer, "TIFF loader: Out of memory error", buflen); strncpy(buffer, "TIFF loader: Out of memory error", buflen);
@@ -852,9 +852,6 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter
else if (compressTypeOpt == "jpeg") { else if (compressTypeOpt == "jpeg") {
compressionType = COMPRESSION_JPEG; compressionType = COMPRESSION_JPEG;
} }
else if (compressTypeOpt == "none") {
compressionType = COMPRESSION_NONE;
}
} }
} }
} }
@@ -886,12 +883,10 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter
case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT:
case GL_LUMINANCE: case GL_LUMINANCE:
case GL_ALPHA: case GL_ALPHA:
case GL_RED:
photometric = PHOTOMETRIC_MINISBLACK; photometric = PHOTOMETRIC_MINISBLACK;
samplesPerPixel = 1; samplesPerPixel = 1;
break; break;
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
case GL_RG:
photometric = PHOTOMETRIC_MINISBLACK; photometric = PHOTOMETRIC_MINISBLACK;
samplesPerPixel = 2; samplesPerPixel = 2;
break; break;
@@ -908,22 +903,16 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter
break; break;
} }
uint32 rowsperstrip = 0;
switch(img.getDataType()){ switch(img.getDataType()){
case GL_FLOAT: case GL_FLOAT:
TIFFSetField(image, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP); TIFFSetField(image, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
rowsperstrip = 1; TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, 1);
bitsPerSample = 32; bitsPerSample = 32;
break; break;
case GL_SHORT: case GL_SHORT:
TIFFSetField(image, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT); TIFFSetField(image, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
bitsPerSample = 16; bitsPerSample = 16;
break; break;
case GL_UNSIGNED_SHORT:
TIFFSetField(image, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
bitsPerSample = 16;
break;
default: default:
bitsPerSample = 8; bitsPerSample = 8;
break; break;
@@ -937,9 +926,9 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter
TIFFSetField(image, TIFFTAG_COMPRESSION, compressionType); TIFFSetField(image, TIFFTAG_COMPRESSION, compressionType);
TIFFSetField(image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB); TIFFSetField(image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
if (rowsperstrip==0) rowsperstrip = TIFFDefaultStripSize(image, 0); //uint32 rowsperstrip = TIFFDefaultStripSize(image, -1);
TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, rowsperstrip); //TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
// Write the information to the file // Write the information to the file
for(int i = 0; i < img.t(); ++i) { for(int i = 0; i < img.t(); ++i) {

View File

@@ -870,9 +870,7 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, int
osg::Group* tileGroup = archive->getTileContent(x,y,lod,realMinRange,realMaxRange,usedMaxRange,tileCenter, childrenLoc); osg::Group* tileGroup = archive->getTileContent(x,y,lod,realMinRange,realMaxRange,usedMaxRange,tileCenter, childrenLoc);
// if group has only one child, then simply use its child. // if group has only one child, then simply use its child.
// if the node is a transform, then stop processing so as to not loose the transformation while (tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup())
while (tileGroup && !tileGroup->asTransform() &&
tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup())
{ {
tileGroup = tileGroup->getChild(0)->asGroup(); tileGroup = tileGroup->getChild(0)->asGroup();
} }
@@ -884,7 +882,7 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, int
doSeam = (lod < (archive->getNumLODs() - 1)); doSeam = (lod < (archive->getNumLODs() - 1));
// Handle seams // Handle seams
if (tileGroup && doSeam) if (doSeam)
{ {
SeamFinder sfv(x,y,lod,info,archive); SeamFinder sfv(x,y,lod,info,archive);
tileGroup->accept(sfv); tileGroup->accept(sfv);
@@ -908,15 +906,13 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, con
osg::Group* tileGroup = archive->getTileContent(loc,realMinRange,realMaxRange,usedMaxRange,tileCenter, childrenLoc); osg::Group* tileGroup = archive->getTileContent(loc,realMinRange,realMaxRange,usedMaxRange,tileCenter, childrenLoc);
// if group has only one child, then simply use its child. // if group has only one child, then simply use its child.
// if the node is a transform, then stop processing so as to not loose the transformation while (tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup())
while (tileGroup && !tileGroup->asTransform() &&
tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup())
{ {
tileGroup = tileGroup->getChild(0)->asGroup(); tileGroup = tileGroup->getChild(0)->asGroup();
} }
// Handle seams // Handle seams
if (tileGroup && childrenLoc.size() > 0) if (childrenLoc.size() > 0)
{ {
SeamFinder sfv(loc.x, loc.y, loc.lod, info, archive); SeamFinder sfv(loc.x, loc.y, loc.lod, info, archive);
tileGroup->accept(sfv); tileGroup->accept(sfv);

View File

@@ -221,11 +221,6 @@ void GlyphTexture::apply(osg::State& state) const
imageData[i] = 0; imageData[i] = 0;
} }
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
glPixelStorei(GL_UNPACK_ROW_LENGTH,getTextureWidth());
#endif
// allocate the texture memory. // allocate the texture memory.
glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA, glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA,
@@ -372,12 +367,6 @@ void GlyphTexture::apply(osg::State& state) const
// clear the list since we have now subloaded them. // clear the list since we have now subloaded them.
glyphsWereSubloading.clear(); glyphsWereSubloading.clear();
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
glPixelStorei(GL_UNPACK_ROW_LENGTH,getTextureWidth());
#endif
// Subload the image once // Subload the image once
glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0,
getTextureWidth(), getTextureWidth(),

View File

@@ -369,11 +369,12 @@ void Text3D::computeGlyphRepresentation()
++itr; ++itr;
} }
// skip over spaces if (itr!=_text.end())
while ((itr!=_text.end()) && (*itr==' ')) ++itr; {
// skip over spaces and return.
// skip over return while (*itr==' ') ++itr;
if ((itr!=_text.end()) && (*itr=='\n')) ++itr; if (*itr=='\n') ++itr;
}
// move to new line. // move to new line.
switch(_layout) switch(_layout)

View File

@@ -105,17 +105,12 @@ void TextBase::setFont(const std::string& fontfile)
void TextBase::setFontResolution(unsigned int width, unsigned int height) void TextBase::setFontResolution(unsigned int width, unsigned int height)
{ {
FontResolution size(width,height); _fontSize = FontResolution(width,height);
if (_fontSize==size) return;
_fontSize = size;
computeGlyphRepresentation(); computeGlyphRepresentation();
} }
void TextBase::setCharacterSize(float height) void TextBase::setCharacterSize(float height)
{ {
if (_characterHeight==height) return;
_characterHeight = height; _characterHeight = height;
computeGlyphRepresentation(); computeGlyphRepresentation();
} }
@@ -131,24 +126,18 @@ void TextBase::setCharacterSize(float height, float aspectRatio)
void TextBase::setMaximumWidth(float maximumWidth) void TextBase::setMaximumWidth(float maximumWidth)
{ {
if (_maximumWidth==maximumWidth) return;
_maximumWidth = maximumWidth; _maximumWidth = maximumWidth;
computeGlyphRepresentation(); computeGlyphRepresentation();
} }
void TextBase::setMaximumHeight(float maximumHeight) void TextBase::setMaximumHeight(float maximumHeight)
{ {
if (_maximumHeight==maximumHeight) return;
_maximumHeight = maximumHeight; _maximumHeight = maximumHeight;
computeGlyphRepresentation(); computeGlyphRepresentation();
} }
void TextBase::setLineSpacing(float lineSpacing) void TextBase::setLineSpacing(float lineSpacing)
{ {
if (_lineSpacing==lineSpacing) return;
_lineSpacing = lineSpacing; _lineSpacing = lineSpacing;
computeGlyphRepresentation(); computeGlyphRepresentation();
} }

View File

@@ -1361,41 +1361,19 @@ void CullVisitor::apply(osg::ClearNode& node)
namespace osgUtil namespace osgUtil
{ {
class RenderStageCache : public osg::Object, public osg::Observer class RenderStageCache : public osg::Object
{ {
public: public:
RenderStageCache() {} RenderStageCache() {}
RenderStageCache(const RenderStageCache&, const osg::CopyOp&) {} RenderStageCache(const RenderStageCache&, const osg::CopyOp&) {}
virtual ~RenderStageCache()
{
for(RenderStageMap::iterator itr = _renderStageMap.begin();
itr != _renderStageMap.end();
++itr)
{
itr->first->removeObserver(this);
}
}
META_Object(osgUtil, RenderStageCache); META_Object(osgUtil, RenderStageCache);
virtual void objectDeleted(void* object)
{
osg::Referenced* ref = reinterpret_cast<osg::Referenced*>(object);
osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(ref);
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
RenderStageMap::iterator itr = _renderStageMap.find(cv);
if (itr!=_renderStageMap.end())
{
_renderStageMap.erase(cv);
}
}
void setRenderStage(CullVisitor* cv, RenderStage* rs) void setRenderStage(CullVisitor* cv, RenderStage* rs)
{ {
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex); OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
_renderStageMap[cv] = rs; _renderStageMap[cv] = rs;
cv->addObserver(this);
} }
RenderStage* getRenderStage(osgUtil::CullVisitor* cv) RenderStage* getRenderStage(osgUtil::CullVisitor* cv)

View File

@@ -60,6 +60,7 @@ struct GeometryArrayGatherer
typedef std::vector<osg::Array*> ArrayList; typedef std::vector<osg::Array*> ArrayList;
GeometryArrayGatherer(osg::Geometry& geometry) GeometryArrayGatherer(osg::Geometry& geometry)
: _useDrawElements(true)
{ {
add(geometry.getVertexArray()); add(geometry.getVertexArray());
add(geometry.getNormalArray()); add(geometry.getNormalArray());
@@ -96,6 +97,9 @@ struct GeometryArrayGatherer
} }
ArrayList _arrayList; ArrayList _arrayList;
// True if geometry contains bindings that are compatible with
// DrawElements.
bool _useDrawElements;
}; };
// Compare vertices in a mesh using all their attributes. The vertices // Compare vertices in a mesh using all their attributes. The vertices
@@ -975,7 +979,7 @@ struct CacheRecorder : public TriangleIndexFunctor<CacheRecordOperator>
void VertexCacheMissVisitor::doGeometry(Geometry& geom) void VertexCacheMissVisitor::doGeometry(Geometry& geom)
{ {
Array* vertArray = geom.getVertexArray(); Array* vertArray = geom.getVertexArray();
if (!vertArray || vertArray->getNumElements()==0) if (!vertArray)
return; return;
Geometry::PrimitiveSetList& primSets = geom.getPrimitiveSetList(); Geometry::PrimitiveSetList& primSets = geom.getPrimitiveSetList();
CacheRecorder recorder(_cacheSize); CacheRecorder recorder(_cacheSize);
@@ -1117,9 +1121,12 @@ inline void reorderDrawElements(DE& drawElements,
void VertexAccessOrderVisitor::optimizeOrder(Geometry& geom) void VertexAccessOrderVisitor::optimizeOrder(Geometry& geom)
{ {
Array* vertArray = geom.getVertexArray(); Array* vertArray = geom.getVertexArray();
if (!vertArray || vertArray->getNumElements()==0) if (!vertArray)
return; return;
Geometry::PrimitiveSetList& primSets = geom.getPrimitiveSetList(); Geometry::PrimitiveSetList& primSets = geom.getPrimitiveSetList();
GeometryArrayGatherer gatherer(geom);
if (!gatherer._useDrawElements)
return;
VertexReorder vr(vertArray->getNumElements()); VertexReorder vr(vertArray->getNumElements());
for (Geometry::PrimitiveSetList::iterator itr = primSets.begin(), for (Geometry::PrimitiveSetList::iterator itr = primSets.begin(),
end = primSets.end(); end = primSets.end();
@@ -1137,7 +1144,6 @@ void VertexAccessOrderVisitor::optimizeOrder(Geometry& geom)
// duplicate shared arrays as it isn't safe to rearrange vertices when arrays are shared. // duplicate shared arrays as it isn't safe to rearrange vertices when arrays are shared.
if (geom.containsSharedArrays()) geom.duplicateSharedArrays(); if (geom.containsSharedArrays()) geom.duplicateSharedArrays();
GeometryArrayGatherer gatherer(geom);
Remapper remapper(vr.remap); Remapper remapper(vr.remap);
gatherer.accept(remapper); gatherer.accept(remapper);

View File

@@ -1099,7 +1099,7 @@ bool CollectLowestTransformsVisitor::removeTransforms(osg::Node* nodeWeCannotRem
titr!=_transformMap.end(); titr!=_transformMap.end();
++titr) ++titr)
{ {
if (titr->first!=0 && titr->second._canBeApplied) if (titr->second._canBeApplied)
{ {
if (titr->first!=nodeWeCannotRemove) if (titr->first!=nodeWeCannotRemove)
{ {

View File

@@ -989,10 +989,8 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b
// framebuffer is multisampled then the dimension arguments are ignored // framebuffer is multisampled then the dimension arguments are ignored
// and the whole framebuffer is always copied. // and the whole framebuffer is always copied.
fbo_ext->glBlitFramebuffer( fbo_ext->glBlitFramebuffer(
static_cast<GLint>(_viewport->x()), static_cast<GLint>(_viewport->y()), 0, 0, static_cast<GLint>(_viewport->width()), static_cast<GLint>(_viewport->height()),
static_cast<GLint>(_viewport->x() + _viewport->width()), static_cast<GLint>(_viewport->y() + _viewport->height()), 0, 0, static_cast<GLint>(_viewport->width()), static_cast<GLint>(_viewport->height()),
static_cast<GLint>(_viewport->x()), static_cast<GLint>(_viewport->y()),
static_cast<GLint>(_viewport->x() + _viewport->width()), static_cast<GLint>(_viewport->y() + _viewport->height()),
blitMask, GL_NEAREST); blitMask, GL_NEAREST);
} }
@@ -1010,10 +1008,8 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT + (attachment - osg::Camera::COLOR_BUFFER0)); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT + (attachment - osg::Camera::COLOR_BUFFER0));
fbo_ext->glBlitFramebuffer( fbo_ext->glBlitFramebuffer(
static_cast<GLint>(_viewport->x()), static_cast<GLint>(_viewport->y()), 0, 0, static_cast<GLint>(_viewport->width()), static_cast<GLint>(_viewport->height()),
static_cast<GLint>(_viewport->x() + _viewport->width()), static_cast<GLint>(_viewport->y() + _viewport->height()), 0, 0, static_cast<GLint>(_viewport->width()), static_cast<GLint>(_viewport->height()),
static_cast<GLint>(_viewport->x()), static_cast<GLint>(_viewport->y()),
static_cast<GLint>(_viewport->x() + _viewport->width()), static_cast<GLint>(_viewport->y() + _viewport->height()),
GL_COLOR_BUFFER_BIT, GL_NEAREST); GL_COLOR_BUFFER_BIT, GL_NEAREST);
} }
} }
@@ -1517,14 +1513,14 @@ void RenderStage::clearReferencesToDependentCameras()
itr != _preRenderList.end(); itr != _preRenderList.end();
++itr) ++itr)
{ {
itr->second->clearReferencesToDependentCameras(); itr->second->collateReferencesToDependentCameras();
} }
for(RenderStageList::iterator itr = _postRenderList.begin(); for(RenderStageList::iterator itr = _postRenderList.begin();
itr != _postRenderList.end(); itr != _postRenderList.end();
++itr) ++itr)
{ {
itr->second->clearReferencesToDependentCameras(); itr->second->collateReferencesToDependentCameras();
} }
_dependentCameras.clear(); _dependentCameras.clear();

View File

@@ -362,7 +362,7 @@ void CompositeViewer::setReferenceTime(double time)
{ {
osg::Timer_t tick = osg::Timer::instance()->tick(); osg::Timer_t tick = osg::Timer::instance()->tick();
double currentTime = osg::Timer::instance()->delta_s(_startTick, tick); double currentTime = osg::Timer::instance()->delta_s(_startTick, tick);
double delta_ticks = (time-currentTime)/(osg::Timer::instance()->getSecondsPerTick()); double delta_ticks = (time-currentTime)*(osg::Timer::instance()->getSecondsPerTick());
if (delta_ticks>=0) tick += osg::Timer_t(delta_ticks); if (delta_ticks>=0) tick += osg::Timer_t(delta_ticks);
else tick -= osg::Timer_t(-delta_ticks); else tick -= osg::Timer_t(-delta_ticks);

View File

@@ -962,14 +962,11 @@ bool GraphicsWindowX11::createWindow()
XFlush( _display ); XFlush( _display );
XSync( _display, 0 ); XSync( _display, 0 );
// now update the window dimensions to account for any size changes made by the window manager,
// get window geometry relative to root window/screen
Window child_return;
int windowX, windowY;
XGetWindowAttributes( _display, _window, &watt ); XGetWindowAttributes( _display, _window, &watt );
XTranslateCoordinates( _display, _window, watt.root, watt.x, watt.y, &windowX, &windowY, &child_return);
if (_traits->x != windowX || _traits->y != windowY ||_traits->width != watt.width || _traits->height != watt.height) if (_traits->x != watt.x || _traits->y != watt.y
||_traits->width != watt.width || _traits->height != watt.height)
{ {
if (doFullSceenWorkAround) if (doFullSceenWorkAround)
@@ -981,10 +978,9 @@ bool GraphicsWindowX11::createWindow()
XSync(_display, 0); XSync(_display, 0);
XGetWindowAttributes( _display, _window, &watt ); XGetWindowAttributes( _display, _window, &watt );
XTranslateCoordinates( _display, _window, watt.root, watt.x, watt.y, &windowX, &windowY, &child_return);
} }
resized( windowX, windowY, watt.width, watt.height ); resized( watt.x, watt.y, watt.width, watt.height );
} }
//OSG_NOTICE<<"After sync apply.x = "<<watt.x<<" watt.y="<<watt.y<<" width="<<watt.width<<" height="<<watt.height<<std::endl; //OSG_NOTICE<<"After sync apply.x = "<<watt.x<<" watt.y="<<watt.y<<" width="<<watt.width<<" height="<<watt.height<<std::endl;
@@ -1233,10 +1229,10 @@ bool GraphicsWindowX11::checkEvents()
{ {
case ClientMessage: case ClientMessage:
{ {
OSG_INFO<<"ClientMessage event received"<<std::endl; OSG_NOTICE<<"ClientMessage event received"<<std::endl;
if (static_cast<Atom>(ev.xclient.data.l[0]) == _deleteWindow) if (static_cast<Atom>(ev.xclient.data.l[0]) == _deleteWindow)
{ {
OSG_INFO<<"DeleteWindow event received"<<std::endl; OSG_NOTICE<<"DeleteWindow event received"<<std::endl;
// FIXME only do if _ownsWindow ? // FIXME only do if _ownsWindow ?
getEventQueue()->closeWindow(eventTime); getEventQueue()->closeWindow(eventTime);
} }
@@ -1256,13 +1252,15 @@ bool GraphicsWindowX11::checkEvents()
break; break;
case DestroyNotify : case DestroyNotify :
OSG_INFO<<"DestroyNotify event received"<<std::endl; OSG_NOTICE<<"DestroyNotify event received"<<std::endl;
_realized = false; _realized = false;
_valid = false; _valid = false;
break; break;
case ConfigureNotify : case ConfigureNotify :
{ {
OSG_INFO<<"ConfigureNotify x="<<ev.xconfigure.x<<" y="<<ev.xconfigure.y<<" width="<<ev.xconfigure.width<<", height="<<ev.xconfigure.height<<std::endl;
if (windowX != ev.xconfigure.x || if (windowX != ev.xconfigure.x ||
windowY != ev.xconfigure.y || windowY != ev.xconfigure.y ||
windowWidth != ev.xconfigure.width || windowWidth != ev.xconfigure.width ||
@@ -1287,6 +1285,8 @@ bool GraphicsWindowX11::checkEvents()
XGetWindowAttributes(display, _window, &watt ); XGetWindowAttributes(display, _window, &watt );
while( watt.map_state != IsViewable ); while( watt.map_state != IsViewable );
OSG_INFO<<"MapNotify x="<<watt.x<<" y="<<watt.y<<" width="<<watt.width<<", height="<<watt.height<<std::endl;
if (windowWidth != watt.width || windowHeight != watt.height) if (windowWidth != watt.width || windowHeight != watt.height)
{ {
resizeTime = eventTime; resizeTime = eventTime;
@@ -1543,30 +1543,19 @@ bool GraphicsWindowX11::checkEvents()
} }
default: default:
OSG_INFO<<"Other event "<<ev.type<<std::endl; OSG_NOTICE<<"Other event "<<ev.type<<std::endl;
break; break;
} }
_lastEventType = ev.type; _lastEventType = ev.type;
} }
// get window geometry relative to root window/screen
{
XWindowAttributes watt;
Window child_return;
XGetWindowAttributes( display, _window, &watt );
XTranslateCoordinates(display, _window, watt.root, watt.x, watt.y, &windowX, &windowY, &child_return);
}
// send window resize event if window position or size was changed // send window resize event if window position or size was changed
if (windowX != _traits->x || if (windowX != _traits->x ||
windowY != _traits->y || windowY != _traits->y ||
windowWidth != _traits->width || windowWidth != _traits->width ||
windowHeight != _traits->height) windowHeight != _traits->height)
{ {
resized(windowX, windowY, windowWidth, windowHeight); resized(windowX, windowY, windowWidth, windowHeight);
getEventQueue()->windowResize(windowX, windowY, windowWidth, windowHeight, resizeTime); getEventQueue()->windowResize(windowX, windowY, windowWidth, windowHeight, resizeTime);

View File

@@ -74,7 +74,7 @@ bool PixelBufferCocoa::realizeImplementation()
_context = [[NSOpenGLContext alloc] initWithFormat: pixelformat shareContext: sharedContext]; _context = [[NSOpenGLContext alloc] initWithFormat: pixelformat shareContext: sharedContext];
NSOpenGLPixelBuffer* pbuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget: _traits->target textureInternalFormat: _traits->format textureMaxMipMapLevel: _traits->level pixelsWide: _traits->width pixelsHigh: _traits->height]; NSOpenGLPixelBuffer* pbuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget: _traits->target textureInternalFormat: _traits->format textureMaxMipMapLevel: _traits->level pixelsWide: _traits->width pixelsHigh: _traits->height];
[_context setPixelBuffer: pbuffer cubeMapFace: _traits->face mipMapLevel:_traits->level currentVirtualScreen: 0]; [_context setPixelBuffer: pbuffer cubeMapFace: _traits->face mipMapLevel:_traits->level currentVirtualScreen: nil];
[pool release]; [pool release];

View File

@@ -326,7 +326,6 @@ void StatsHandler::setUpHUDCamera(osgViewer::ViewerBase* viewer)
// only clear the depth buffer // only clear the depth buffer
_camera->setClearMask(0); _camera->setClearMask(0);
_camera->setAllowEventFocus(false);
_camera->setRenderer(new Renderer(_camera.get())); _camera->setRenderer(new Renderer(_camera.get()));

View File

@@ -435,7 +435,7 @@ void Viewer::setReferenceTime(double time)
{ {
osg::Timer_t tick = osg::Timer::instance()->tick(); osg::Timer_t tick = osg::Timer::instance()->tick();
double currentTime = osg::Timer::instance()->delta_s(_startTick, tick); double currentTime = osg::Timer::instance()->delta_s(_startTick, tick);
double delta_ticks = (time-currentTime)/(osg::Timer::instance()->getSecondsPerTick()); double delta_ticks = (time-currentTime)*(osg::Timer::instance()->getSecondsPerTick());
if (delta_ticks>=0) tick += osg::Timer_t(delta_ticks); if (delta_ticks>=0) tick += osg::Timer_t(delta_ticks);
else tick -= osg::Timer_t(-delta_ticks); else tick -= osg::Timer_t(-delta_ticks);

View File

@@ -52,7 +52,7 @@ void CompositeProperty::clear()
// //
// SwitchProperty // SwitchProperty
// //
SwitchProperty::SwitchProperty():_activeProperty(0) SwitchProperty::SwitchProperty()
{ {
} }

View File

@@ -123,8 +123,6 @@ bool ProxyNode_readLocalData(Object& obj, Input& fr)
iteratorAdvanced = true; iteratorAdvanced = true;
} }
bool make_options = (fr.getOptions() == NULL);
if (make_options) fr.setOptions(new osgDB::Options()); //need valid options
unsigned int i; unsigned int i;
for(i=0; i<num_children; i++) for(i=0; i<num_children; i++)
{ {
@@ -156,7 +154,7 @@ bool ProxyNode_readLocalData(Object& obj, Input& fr)
} }
} }
} }
if (make_options) fr.setOptions(NULL);
return iteratorAdvanced; return iteratorAdvanced;
} }

View File

@@ -6,6 +6,6 @@
REGISTER_OBJECT_WRAPPER( osgVolume_VolumeTechnique, REGISTER_OBJECT_WRAPPER( osgVolume_VolumeTechnique,
new osgVolume::VolumeTechnique, new osgVolume::VolumeTechnique,
osgVolume::VolumeTechnique, osgVolume::VolumeTechnique,
"osg::Object osgVolume::VolumeTechnique" ) "osg::Object osgVolume::VolumeTechniquee" )
{ {
} }