Compare commits
102 Commits
OpenSceneG
...
OpenSceneG
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c384664af | ||
|
|
c1f083a67e | ||
|
|
23d582fef5 | ||
|
|
074d470fa5 | ||
|
|
ee71c5a63f | ||
|
|
fc77489239 | ||
|
|
6fa7dd27f3 | ||
|
|
32366f0489 | ||
|
|
30fff3106d | ||
|
|
23458666b8 | ||
|
|
c91bfcee21 | ||
|
|
d763feddda | ||
|
|
3b789fc6b0 | ||
|
|
110cf64c3b | ||
|
|
9d326917f0 | ||
|
|
5ead09215e | ||
|
|
60838d0c42 | ||
|
|
bddbdfdefe | ||
|
|
0744b6881f | ||
|
|
3371ce640a | ||
|
|
dff397f647 | ||
|
|
1c833e2e4d | ||
|
|
cf268b4cfd | ||
|
|
1d628eebfb | ||
|
|
20401947bf | ||
|
|
16ac602824 | ||
|
|
4f830fb0e2 | ||
|
|
d4fc0ceba3 | ||
|
|
825882be19 | ||
|
|
bc473c4e0e | ||
|
|
a430566596 | ||
|
|
3d77abc06d | ||
|
|
033e52b8ef | ||
|
|
785ce9f679 | ||
|
|
f26be0155c | ||
|
|
9eb02084a6 | ||
|
|
bd82047acb | ||
|
|
f9a20d017a | ||
|
|
5878a70ede | ||
|
|
57d04290ab | ||
|
|
ceda86b31b | ||
|
|
499e38ff98 | ||
|
|
3461d9e8b5 | ||
|
|
4a535fe426 | ||
|
|
fc7302ccba | ||
|
|
7f4d116391 | ||
|
|
edf27e36ed | ||
|
|
c8d8a051ad | ||
|
|
4c9e17fcc7 | ||
|
|
95853370e1 | ||
|
|
c90cc658a0 | ||
|
|
7c8ab128a6 | ||
|
|
1185fbda34 | ||
|
|
005e52144d | ||
|
|
b6f05114dc | ||
|
|
8bb91a5265 | ||
|
|
13f2cb3f47 | ||
|
|
dab3efadce | ||
|
|
6f004ef7db | ||
|
|
6895e29417 | ||
|
|
6cf1db199c | ||
|
|
d4e5c72ebc | ||
|
|
3dd2816414 | ||
|
|
eeadbae72d | ||
|
|
b203faaa22 | ||
|
|
324dc573a0 | ||
|
|
750cd78178 | ||
|
|
b5179e247f | ||
|
|
84ec88cc25 | ||
|
|
7a9e97877c | ||
|
|
0bedd4c43a | ||
|
|
d1b9bdbbbe | ||
|
|
c923584158 | ||
|
|
c789f7bced | ||
|
|
18810de975 | ||
|
|
e3ba4c82e4 | ||
|
|
ce82cfd25f | ||
|
|
9c42d8f0da | ||
|
|
2b4221c211 | ||
|
|
7d04c3457a | ||
|
|
166a8b6ccf | ||
|
|
5cc425cf99 | ||
|
|
f19a63e50d | ||
|
|
506f26d292 | ||
|
|
c8d3571efd | ||
|
|
1fa34dbbcc | ||
|
|
3cabbb5a5a | ||
|
|
0c052ce2ed | ||
|
|
60bafc2050 | ||
|
|
0dd978df7a | ||
|
|
0ec0b79d6c | ||
|
|
9f0f107c66 | ||
|
|
cceb63ed12 | ||
|
|
e5185937c8 | ||
|
|
9221cab9c5 | ||
|
|
4b687b7a86 | ||
|
|
f32d30d033 | ||
|
|
c931140eaf | ||
|
|
21a2cf6ff1 | ||
|
|
3416f91704 | ||
|
|
7126619e40 | ||
|
|
12cf202cfc |
48
AUTHORS.txt
48
AUTHORS.txt
@@ -1,6 +1,6 @@
|
||||
OpenSceneGraph Library 3.2.1
|
||||
OpenSceneGraph Library 3.2.2
|
||||
|
||||
519 Contributors:
|
||||
529 Contributors:
|
||||
|
||||
Firstname Surname
|
||||
-----------------
|
||||
@@ -15,8 +15,8 @@ Wang Rui
|
||||
Jean-S<>bastien Guay
|
||||
Ulrich Hertlein
|
||||
Mike Weiblen
|
||||
Sukender
|
||||
Eric Wing
|
||||
Sukender
|
||||
Cedric Pinson
|
||||
Brede Johansen
|
||||
Bob Kuehne
|
||||
@@ -30,18 +30,18 @@ Colin McDonald
|
||||
Trajce Nikolov
|
||||
Tim Moore
|
||||
Martin Lavery
|
||||
Tree
|
||||
Tree
|
||||
Luigi Calori
|
||||
Mike Wittman
|
||||
Jason Beverage
|
||||
Chris Hanson
|
||||
Roland Smeenk
|
||||
Roger James
|
||||
Mattias Helsing
|
||||
Jeremy Moles
|
||||
Jan Peciva
|
||||
Mattias Helsing
|
||||
J.P. Delport
|
||||
Alberto Luaces
|
||||
J.P. Delport
|
||||
Magnus Kessler
|
||||
David Fries
|
||||
Andy Skinner
|
||||
@@ -58,23 +58,23 @@ Art Tevs
|
||||
Philip Lowman
|
||||
Per Fahlberg
|
||||
Norman Vine
|
||||
Lionel Lagarde
|
||||
Terry Welsh
|
||||
Serge Lages
|
||||
Romano Jos<6F> Magacho da Silva
|
||||
Lionel Lagarde
|
||||
Pjotr Svetachov
|
||||
Chris Denham
|
||||
Alberto Farre
|
||||
Torben Dannhauer
|
||||
Sherman Wilcox
|
||||
Robert Michael
|
||||
Mourad Boufarguine
|
||||
Glenn Waldron
|
||||
Andr<EFBFBD> Garneau
|
||||
Adrian Egli
|
||||
Ruben Lopez
|
||||
Randall Hopper
|
||||
Pjotr Svetachov
|
||||
Jan Ciger
|
||||
Glenn Waldron
|
||||
Gideon May
|
||||
Don Tidrow
|
||||
Stephane Lamoliatte
|
||||
@@ -91,6 +91,7 @@ Mike Connell
|
||||
Melchior Franz
|
||||
Johannes Baeuerle
|
||||
Thomas Hogarth
|
||||
Sebastian Messerschmidt
|
||||
Rafa Gaitan
|
||||
Neil Hughes
|
||||
Martin Beckett
|
||||
@@ -105,7 +106,6 @@ Boris Bralo
|
||||
Yefei He
|
||||
Sondra Iverson
|
||||
Simon Julier
|
||||
Sebastian Messerschmidt
|
||||
Rune Schmidt Jensen
|
||||
Rainer Oder
|
||||
Nico Kruithof
|
||||
@@ -129,6 +129,7 @@ Joseph Steel
|
||||
Jordi Torres
|
||||
John Shue
|
||||
Brad Colbert
|
||||
Bj<EFBFBD>rn Blissing
|
||||
Alexander Sinditskiy
|
||||
Vivek Rajan
|
||||
Uwe Woessner
|
||||
@@ -137,6 +138,7 @@ Thom DeCarlo
|
||||
Tatsuhiro Nishioka
|
||||
Tanguy Fautr<74>
|
||||
Sean Spicer
|
||||
Ryan Kawicki
|
||||
Richard Schmidt
|
||||
Peter Hrenka
|
||||
Paul de Repentigny
|
||||
@@ -145,6 +147,7 @@ Neil Salter
|
||||
Mihai Radu
|
||||
Michael Hartman
|
||||
Martins Innus
|
||||
Marc Helbling
|
||||
Maciej Krol
|
||||
Lilin Xiong
|
||||
Leandro Motta Barros
|
||||
@@ -153,16 +156,15 @@ Hartwig Wiesmann
|
||||
Donn Mielcarek
|
||||
Corbin Holtz
|
||||
Blasius Czink
|
||||
Bj<EFBFBD>rn Blissing
|
||||
Alexander Irion
|
||||
Toshiyuki Takahei
|
||||
Sebastien Grignard
|
||||
Ryan Kawicki
|
||||
Rudolf Wiedemann
|
||||
Robert Milharcic
|
||||
Maria Ten
|
||||
Liang Aibin
|
||||
Kristofer Tingdahl
|
||||
Konstantin Matveyev
|
||||
Katharina Plugge
|
||||
John Vidar Larring
|
||||
John Kelso
|
||||
@@ -229,7 +231,7 @@ Yuzhong Shen
|
||||
Wee See
|
||||
Warren Macchi
|
||||
Vincent Bourdier
|
||||
Terrex
|
||||
Terrex
|
||||
Tassilo Glander
|
||||
Sylvain Marie
|
||||
Steve Lunsford
|
||||
@@ -245,6 +247,7 @@ Perry Miller
|
||||
Pawel Ksiezopolski
|
||||
Paul Palumbo
|
||||
Paul Obermeier
|
||||
Patrick Neary
|
||||
Nguyen Van Truong
|
||||
Nathan Cournia
|
||||
Morten Haukness
|
||||
@@ -263,9 +266,9 @@ Marius Heise
|
||||
Marcin Hajder
|
||||
Marcel Pursche
|
||||
Lilith Bryant
|
||||
Konstantin Matveyev
|
||||
Kevin Moiule
|
||||
Keith Steffen
|
||||
Julien Valentin
|
||||
Julen Garcia
|
||||
Joseph Winston
|
||||
John Aughey
|
||||
@@ -273,6 +276,8 @@ Johannes Scholz
|
||||
Joachim Pouderoux
|
||||
Jean-Christophe Lombardo
|
||||
Javier Taibo
|
||||
Jannik Heller
|
||||
Jan Klimke
|
||||
James Moliere
|
||||
Jaap Glas
|
||||
Igor Kravtchenko
|
||||
@@ -291,7 +296,7 @@ Eric Buehler
|
||||
Eduardo Poyart
|
||||
Edgar Ellis
|
||||
Dimi Christopoulos
|
||||
Diane Delallée
|
||||
Diane Delall<EFBFBD>e
|
||||
David Longest
|
||||
David Ergo
|
||||
Daniel Trstenjak
|
||||
@@ -299,6 +304,7 @@ Craig Bosma
|
||||
Claus Scheiblauer
|
||||
Christophe Loustaunau
|
||||
Christian Ruzicka
|
||||
Bradley Baker Searles
|
||||
Brad Anderegg
|
||||
Bj<EFBFBD>rn Hein
|
||||
Aric Aumann
|
||||
@@ -327,6 +333,7 @@ Tomas Hnilica
|
||||
Todd Furlong
|
||||
Tobias Ottenweller
|
||||
Tino Schwarze
|
||||
Tim George
|
||||
Thorsten Brehm
|
||||
Thomas Weidner
|
||||
Tan Dunning
|
||||
@@ -384,13 +391,14 @@ Nicolas Brodu
|
||||
Nick Black
|
||||
Mojtaba Fathi
|
||||
Mirko Viviani
|
||||
Mikkel Gjøl
|
||||
Mikkel Gj<EFBFBD>l
|
||||
Mike Krus
|
||||
Mike Garrity
|
||||
Miha Ravsel
|
||||
Miha Rav<EFBFBD>elj
|
||||
Michael Schanne
|
||||
Michael Polak
|
||||
Michael Morrison
|
||||
Michael Mc Donnell
|
||||
Michael Logan
|
||||
Michael Kapelko
|
||||
Michael Bach Jensen
|
||||
@@ -411,7 +419,6 @@ Marius Kintel
|
||||
Mario Guimaraes
|
||||
Marco Sciabica
|
||||
Marco Lehmann
|
||||
Marc Helbling
|
||||
Maik Keller
|
||||
Lukas Diduch
|
||||
Louis Hamilton
|
||||
@@ -443,7 +450,6 @@ Jeroen den Dekker
|
||||
Jay Zuckerman
|
||||
Jason Howlett
|
||||
Jason Ballenger
|
||||
Jan Klimke
|
||||
James Turner
|
||||
James Killian
|
||||
James Athey
|
||||
@@ -486,7 +492,9 @@ Daniel Stien
|
||||
Dan Minor
|
||||
C<EFBFBD>sar L. B. Silveira
|
||||
Cyril Brulebois
|
||||
Cl<EFBFBD>ment B<>sch
|
||||
Clay Fowler
|
||||
Claus Steuer
|
||||
Chuck Sembroski
|
||||
Christopher Blaesius
|
||||
Christopher Baker
|
||||
@@ -508,6 +516,7 @@ Benjamin Wasty
|
||||
Ben van Basten
|
||||
Bart Gallet
|
||||
Axel Volley
|
||||
Arjun Ramamurthy
|
||||
Anthousis Andreadis
|
||||
Anish Thomas
|
||||
Andy Preece
|
||||
@@ -522,4 +531,5 @@ Alan Purvis
|
||||
Alan Ott
|
||||
Alan Harris
|
||||
Adrien Grandemange
|
||||
Adrian Clark
|
||||
Adam Richard
|
||||
|
||||
@@ -22,25 +22,30 @@ if(COMMAND cmake_policy)
|
||||
|
||||
# tell CMake to prefer CMake's own CMake modules when available
|
||||
# only available from cmake-2.8.4
|
||||
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3)
|
||||
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR
|
||||
(${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)
|
||||
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
|
||||
# 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} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
|
||||
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR
|
||||
(${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)
|
||||
endif()
|
||||
|
||||
# disable autolinking to qtmain as we have our own main() functions (new in Qt 5.1)
|
||||
if((${CMAKE_MAJOR_VERSION} EQUAL 2 OR ${CMAKE_MAJOR_VERSION} GREATER 2) AND
|
||||
(${CMAKE_MINOR_VERSION} EQUAL 8 OR ${CMAKE_MINOR_VERSION} GREATER 8) AND
|
||||
${CMAKE_PATCH_VERSION} GREATER 10)
|
||||
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR
|
||||
(${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 10))
|
||||
cmake_policy(SET CMP0020 OLD)
|
||||
endif()
|
||||
# nicer version check - but needs at least CMake 2.6.2? Worth upgrading the requirements?
|
||||
#if("${CMAKE_VERSION}" VERSION_GREATER 2.8.10)
|
||||
|
||||
# or even easier (available in cmake-2.6)
|
||||
#if(POLICY CMPxyzw)
|
||||
|
||||
endif()
|
||||
|
||||
@@ -48,7 +53,7 @@ PROJECT(OpenSceneGraph)
|
||||
|
||||
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
|
||||
SET(OPENSCENEGRAPH_MINOR_VERSION 2)
|
||||
SET(OPENSCENEGRAPH_PATCH_VERSION 1)
|
||||
SET(OPENSCENEGRAPH_PATCH_VERSION 3)
|
||||
SET(OPENSCENEGRAPH_SOVERSION 100)
|
||||
|
||||
# set to 0 when not a release candidate, non zero means that any generated
|
||||
@@ -80,6 +85,13 @@ SET(OpenThreads_SOURCE_DIR ${OpenSceneGraph_SOURCE_DIR})
|
||||
# Maybe this can be used override existing behavior if needed?
|
||||
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(OSG_BUILD_PLATFORM_ANDROID OFF)
|
||||
IF(OSG_BUILD_PLATFORM_ANDROID)
|
||||
@@ -234,8 +246,12 @@ IF(APPLE)
|
||||
EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion"
|
||||
OUTPUT_VARIABLE OSG_OSX_SDK_NAME
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
STRING(SUBSTRING "${OSG_OSX_SDK_NAME}" 0 4 OSG_OSX_SDK_NAME)
|
||||
SET(OSG_OSX_SDK_NAME "macosx${OSG_OSX_SDK_NAME}")
|
||||
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}")
|
||||
|
||||
# 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
|
||||
@@ -511,6 +527,12 @@ IF(WIN32 AND NOT ANDROID)
|
||||
INCLUDE(Find3rdPartyDependencies)
|
||||
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)
|
||||
ANDROID_3RD_PARTY()
|
||||
ELSE()
|
||||
@@ -596,6 +618,13 @@ 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 ( Qt5Widgets_FOUND )
|
||||
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()
|
||||
@@ -918,7 +947,7 @@ IF(APPLE AND NOT ANDROID)
|
||||
# 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.
|
||||
IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
|
||||
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9")
|
||||
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10")
|
||||
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
|
||||
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" FORCE)
|
||||
|
||||
@@ -143,6 +143,15 @@ ELSE()
|
||||
NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
||||
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
|
||||
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()
|
||||
|
||||
@@ -30,7 +30,7 @@ ELSE()
|
||||
# AVFoundation exists since 10.7, but only 10.8 has all features necessary for OSG
|
||||
# so check the SDK-setting
|
||||
|
||||
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9")
|
||||
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10")
|
||||
# nothing special here ;-)
|
||||
ELSE()
|
||||
MESSAGE("AVFoundation disabled for SDK < 10.8")
|
||||
|
||||
@@ -18,8 +18,10 @@ ELSEIF(MSVC90)
|
||||
SET(FBX_LIBDIR "vs2008")
|
||||
ELSEIF(MSVC10)
|
||||
SET(FBX_LIBDIR "vs2010")
|
||||
ELSEIF(MSVC11 OR MSVC_VERSION>1700)
|
||||
ELSEIF(MSVC11)
|
||||
SET(FBX_LIBDIR "vs2012")
|
||||
ELSEIF(MSVC12 OR MSVC_VERSION>1800)
|
||||
SET(FBX_LIBDIR "vs2013")
|
||||
ENDIF()
|
||||
|
||||
IF(APPLE)
|
||||
@@ -32,6 +34,8 @@ ELSE()
|
||||
SET(FBX_LIBDIR ${FBX_LIBDIR}/x86)
|
||||
ENDIF()
|
||||
|
||||
#try to use 2015.1 or 2014.2 version
|
||||
|
||||
IF(APPLE)
|
||||
SET(FBX_LIBNAME "libfbxsdk")
|
||||
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
@@ -44,10 +48,15 @@ SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
|
||||
|
||||
SET( FBX_SEARCH_PATHS
|
||||
$ENV{FBX_DIR}
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.1"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.1"
|
||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2015.1"
|
||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2015.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
|
||||
)
|
||||
#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
|
||||
FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
|
||||
@@ -74,21 +83,21 @@ ELSE()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT FBX_FOUND)
|
||||
#try to use 2013.3 version
|
||||
#try to use 2014.1 version
|
||||
IF(APPLE)
|
||||
SET(FBX_LIBNAME "fbxsdk-2013.3-static")
|
||||
SET(FBX_LIBNAME "fbxsdk-2014.1")
|
||||
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
SET(FBX_LIBNAME "fbxsdk-2013.3-static")
|
||||
SET(FBX_LIBNAME "fbxsdk-2014.1")
|
||||
ELSE()
|
||||
SET(FBX_LIBNAME "fbxsdk-2013.3-md")
|
||||
SET(FBX_LIBNAME "fbxsdk-2014.1")
|
||||
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
|
||||
$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.1
|
||||
$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.1
|
||||
/Applications/Autodesk/FBXSDK20141
|
||||
)
|
||||
|
||||
@@ -110,3 +119,41 @@ IF(NOT FBX_FOUND)
|
||||
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()
|
||||
|
||||
@@ -63,8 +63,8 @@ ELSE()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
# 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")
|
||||
|
||||
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")
|
||||
MESSAGE("disabling quicktime because it's not supported by the selected SDK ${OSG_OSX_SDK_NAME}")
|
||||
SET(QUICKTIME_FOUND "NO")
|
||||
ENDIF()
|
||||
|
||||
825
ChangeLog
825
ChangeLog
@@ -1,3 +1,828 @@
|
||||
2015-08-12 08:34 robert
|
||||
|
||||
* src/osgVolume/Shaders/volume_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_iso_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_lit_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_lit_tf_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_mip_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_tf_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_tf_iso_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_tf_mip_frag.cpp: Revised shaders to
|
||||
catch NVidia length bug that generates NAN's
|
||||
|
||||
2015-08-12 07:41 robert
|
||||
|
||||
* ChangeLog, include/osg/Version: Updated version and ChangeLog for
|
||||
release
|
||||
|
||||
2015-08-12 07:38 robert
|
||||
|
||||
* CMakeLists.txt: Updated version number for 3.2.3 release
|
||||
|
||||
2015-08-12 07:37 robert
|
||||
|
||||
* AUTHORS.txt, ChangeLog, README.txt: Updated AUTHORS, ChangeLog
|
||||
and README for 3.2.3 release
|
||||
|
||||
2015-08-12 06:50 robert
|
||||
|
||||
* applications/osgversion/Contributors.cpp: Merged Contributors
|
||||
list from svn/trunk.
|
||||
|
||||
2015-08-08 08:49 robert
|
||||
|
||||
* src/osgPlugins/zip/ZipArchive.cpp: From Glenn Waldron, fix error
|
||||
in ZIP plugin handling of memory buffer
|
||||
|
||||
2015-08-06 10:09 robert
|
||||
|
||||
* src/osgVolume/Shaders/volume_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_iso_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_lit_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_lit_tf_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_mip_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_tf_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_tf_iso_frag.cpp,
|
||||
src/osgVolume/Shaders/volume_tf_mip_frag.cpp: Updated
|
||||
RayTracedTechnique shaders from svn/trunk.
|
||||
|
||||
2015-08-04 15:52 robert
|
||||
|
||||
* CMakeLists.txt, NEWS.txt: Updated version and NEWS for 3.2.2
|
||||
stable release
|
||||
|
||||
2015-08-04 10:37 robert
|
||||
|
||||
* NEWS.txt: Update NEWS to online Contributors list.
|
||||
|
||||
2015-08-04 10:26 robert
|
||||
|
||||
* AUTHORS.txt: Updated AUTHORS
|
||||
|
||||
2015-08-04 10:25 robert
|
||||
|
||||
* ChangeLog, NEWS.txt: Updated ChangeLog and NEWS for 3.2.2 release
|
||||
|
||||
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. I’ve 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
|
||||
|
||||
* CMakeLists.txt: Updated version number to 3.2.1 for release
|
||||
|
||||
28
NEWS.txt
28
NEWS.txt
@@ -1,6 +1,34 @@
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
@@ -4,7 +4,7 @@ APP_PROJECT_PATH := $(call my-dir)
|
||||
|
||||
APP_OPTIM := ${ANDROID_RELEASE_OPTIM}
|
||||
|
||||
APP_PLATFORM := ${ANDROID_PLATFORM}
|
||||
APP_PLATFORM := android-${ANDROID_PLATFORM}
|
||||
APP_STL := ${ANDROID_STL}
|
||||
APP_CPPFLAGS := -fexceptions -frtti
|
||||
#APP_CPPFLAGS := -Os -mthumb-interwork -fno-short-enums
|
||||
|
||||
@@ -23,7 +23,7 @@ more indepth instructions.
|
||||
|
||||
Robert Osfield.
|
||||
Project Lead.
|
||||
4th July 2014.
|
||||
12th August 2015.
|
||||
|
||||
--
|
||||
|
||||
|
||||
@@ -259,7 +259,9 @@ const char* invalidNames[] =
|
||||
"VolumeTile",
|
||||
"PushStackValueVisitor",
|
||||
"RayIntersector",
|
||||
"OpenSceneGraph-Data"
|
||||
"OpenSceneGraph-Data",
|
||||
"Node",
|
||||
"AlphaFunc"
|
||||
};
|
||||
|
||||
|
||||
@@ -352,6 +354,7 @@ TypoCorrection typoCorrections[] =
|
||||
{"Krulthof", "Kruithof"},
|
||||
{"Lagrade", "Lagarde"},
|
||||
{"Largade", "Lagarde"},
|
||||
{"Largarde", "Lagarde"},
|
||||
{"Larshkari", "Lashkari"},
|
||||
{"Lashakari", "Lashkari"},
|
||||
{"Lashari", "Lashkari"},
|
||||
@@ -468,7 +471,20 @@ TypoCorrection typoCorrections[] =
|
||||
{"Blessing","Blissing"},
|
||||
{"Dannahuer","Dannhauer"},
|
||||
{"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>"},
|
||||
{"Vigano", "Vigan<EFBFBD>"},
|
||||
{"Frashud", "Farshid"}
|
||||
};
|
||||
|
||||
|
||||
@@ -576,6 +592,8 @@ NameCorrection nameCorrections[] =
|
||||
"Melchior", "Franz"},
|
||||
{"Glen", "Waldon",
|
||||
"Glenn", "Waldron"},
|
||||
{"Glen", "Waldron",
|
||||
"Glenn", "Waldron"},
|
||||
{"Ralf", "Karn",
|
||||
"Ralf", "Kern"},
|
||||
{"Donny", "Cipperly",
|
||||
@@ -637,7 +655,25 @@ NameCorrection nameCorrections[] =
|
||||
{"Ricard", "Schmidt",
|
||||
"Richard", "Schmidt"},
|
||||
{"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"},
|
||||
{"Albert", "Luaces",
|
||||
"Alberto","Luaces"},
|
||||
{"KOS", "",
|
||||
"Konstantin","Matveyev"},
|
||||
{"WeSee", "",
|
||||
"Alois", "Wismer"},
|
||||
{"We", "See",
|
||||
"Alois", "Wismer"}
|
||||
};
|
||||
|
||||
|
||||
@@ -969,7 +1005,9 @@ void printContributors(const std::string& changeLog, bool printNumEntries)
|
||||
cout << "-------------------------" << endl;
|
||||
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
|
||||
{
|
||||
cout << sitr->first << "\t" << sitr->second.first << " " << sitr->second.second << endl;
|
||||
cout << sitr->first << "\t" << sitr->second.first;
|
||||
if (!sitr->second.second.empty()) cout << " " << sitr->second.second;
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -978,7 +1016,9 @@ void printContributors(const std::string& changeLog, bool printNumEntries)
|
||||
cout << "-----------------" << endl;
|
||||
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
|
||||
{
|
||||
cout << sitr->second.first << " " << sitr->second.second << endl;
|
||||
cout << sitr->second.first;
|
||||
if (!sitr->second.second.empty()) cout << " " << sitr->second.second;
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
#elif defined(__sgi)
|
||||
#include <unistd.h>
|
||||
#include <net/soioctl.h>
|
||||
#elif defined(__CYGWIN__)
|
||||
#elif defined(__CYGWIN__)
|
||||
#include <unistd.h>
|
||||
#elif defined(__sun)
|
||||
#elif defined(__sun)
|
||||
#include <unistd.h>
|
||||
#include <sys/sockio.h>
|
||||
#elif defined (__APPLE__)
|
||||
@@ -249,7 +249,7 @@ void CameraPacket::writeEventQueue(osgViewer::Viewer& viewer)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Reciever
|
||||
// Reciever
|
||||
//
|
||||
Receiver::Receiver( void )
|
||||
{
|
||||
@@ -338,7 +338,7 @@ void Receiver::sync( void )
|
||||
|
||||
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \
|
||||
defined(__DragonFly__)
|
||||
socklen_t
|
||||
socklen_t
|
||||
#else
|
||||
int
|
||||
#endif
|
||||
@@ -381,7 +381,7 @@ void Receiver::sync( void )
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Broadcaster
|
||||
// Broadcaster
|
||||
//
|
||||
Broadcaster::Broadcaster( void )
|
||||
{
|
||||
|
||||
@@ -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 full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
//
|
||||
// Class definition for the recipient of a broadcasted message
|
||||
//
|
||||
class Receiver
|
||||
class Receiver
|
||||
{
|
||||
public :
|
||||
|
||||
@@ -68,7 +68,7 @@ class Receiver
|
||||
//
|
||||
// Class definition for broadcasting a buffer to a LAN
|
||||
//
|
||||
class Broadcaster
|
||||
class Broadcaster
|
||||
{
|
||||
public :
|
||||
|
||||
@@ -84,7 +84,7 @@ class Broadcaster
|
||||
// Set a recipient host. If this is used, the Broadcaster
|
||||
// no longer broadcasts, but rather directs UDP packets at
|
||||
// host.
|
||||
void setHost( const char *hostname );
|
||||
void setHost( const char *hostname );
|
||||
|
||||
// Sync broadcasts the buffer
|
||||
void sync( void );
|
||||
@@ -112,15 +112,15 @@ class Broadcaster
|
||||
|
||||
class CameraPacket {
|
||||
public:
|
||||
|
||||
|
||||
static const unsigned int MAX_NUM_EVENTS;
|
||||
static const unsigned int SWAP_BYTES_COMPARE;
|
||||
|
||||
CameraPacket():_masterKilled(false)
|
||||
|
||||
CameraPacket():_masterKilled(false)
|
||||
{
|
||||
_byte_order = SWAP_BYTES_COMPARE;
|
||||
}
|
||||
|
||||
|
||||
void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp)
|
||||
{
|
||||
_matrix = matrix;
|
||||
@@ -129,20 +129,20 @@ class CameraPacket {
|
||||
_frameStamp = *frameStamp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
void readEventQueue(osgViewer::Viewer& viewer);
|
||||
|
||||
|
||||
void writeEventQueue(osgViewer::Viewer& viewer);
|
||||
|
||||
void setMasterKilled(const bool flag) { _masterKilled = flag; }
|
||||
const bool getMasterKilled() const { return _masterKilled; }
|
||||
|
||||
|
||||
unsigned int _byte_order;
|
||||
bool _masterKilled;
|
||||
osg::Matrix _matrix;
|
||||
@@ -150,11 +150,11 @@ class CameraPacket {
|
||||
// note don't use a ref_ptr as used elsewhere for FrameStamp
|
||||
// since we don't want to copy the pointer - but the memory.
|
||||
// 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;
|
||||
|
||||
|
||||
osgGA::EventQueue::Events _events;
|
||||
|
||||
|
||||
};
|
||||
|
||||
class DataConverter
|
||||
@@ -186,22 +186,22 @@ class DataConverter
|
||||
{
|
||||
if (_currentPtr+1>=_endPtr) return;
|
||||
|
||||
*(_currentPtr++) = *(ptr);
|
||||
*(_currentPtr++) = *(ptr);
|
||||
}
|
||||
|
||||
inline void read1(char* ptr)
|
||||
{
|
||||
if (_currentPtr+1>=_endPtr) return;
|
||||
|
||||
*(ptr) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
|
||||
inline void write2(char* ptr)
|
||||
{
|
||||
if (_currentPtr+2>=_endPtr) return;
|
||||
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr);
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr);
|
||||
}
|
||||
|
||||
inline void read2(char* ptr)
|
||||
@@ -210,13 +210,13 @@ class DataConverter
|
||||
|
||||
if (_swapBytes)
|
||||
{
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
else
|
||||
{
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,10 +224,10 @@ class DataConverter
|
||||
{
|
||||
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)
|
||||
@@ -236,17 +236,17 @@ class DataConverter
|
||||
|
||||
if (_swapBytes)
|
||||
{
|
||||
*(ptr+3) = *(_currentPtr++);
|
||||
*(ptr+2) = *(_currentPtr++);
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
*(ptr+3) = *(_currentPtr++);
|
||||
*(ptr+2) = *(_currentPtr++);
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
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;
|
||||
|
||||
*(_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)
|
||||
@@ -272,27 +272,27 @@ class DataConverter
|
||||
|
||||
if (_swapBytes)
|
||||
{
|
||||
*(ptr+7) = *(_currentPtr++);
|
||||
*(ptr+6) = *(_currentPtr++);
|
||||
*(ptr+5) = *(_currentPtr++);
|
||||
*(ptr+4) = *(_currentPtr++);
|
||||
*(ptr+7) = *(_currentPtr++);
|
||||
*(ptr+6) = *(_currentPtr++);
|
||||
*(ptr+5) = *(_currentPtr++);
|
||||
*(ptr+4) = *(_currentPtr++);
|
||||
|
||||
*(ptr+3) = *(_currentPtr++);
|
||||
*(ptr+2) = *(_currentPtr++);
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
*(ptr+3) = *(_currentPtr++);
|
||||
*(ptr+2) = *(_currentPtr++);
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
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 writeDouble(double c) { write8((char*)&c); }
|
||||
|
||||
inline char readChar() { char c; read1(&c); return c; }
|
||||
inline unsigned char readUChar() { unsigned char c; read1((char*)&c); return c; }
|
||||
inline short readShort() { short c; read2((char*)&c); return c; }
|
||||
inline unsigned short readUShort() { unsigned short c; read2((char*)&c); return c; }
|
||||
inline int readInt() { int c; read4((char*)&c); return c; }
|
||||
inline unsigned int readUInt() { unsigned int c; read4((char*)&c); return c; }
|
||||
inline float readFloat() { float c; read4((char*)&c); return c; }
|
||||
inline double readDouble() { double c; read8((char*)&c); return c; }
|
||||
inline char readChar() { char c=0; read1(&c); return c; }
|
||||
inline unsigned char readUChar() { unsigned char c=0; read1((char*)&c); return c; }
|
||||
inline short readShort() { short c=0; read2((char*)&c); return c; }
|
||||
inline unsigned short readUShort() { unsigned short c=0; read2((char*)&c); return c; }
|
||||
inline int readInt() { int c=0; read4((char*)&c); return c; }
|
||||
inline unsigned int readUInt() { unsigned int c=0; read4((char*)&c); return c; }
|
||||
inline float readFloat() { float c=0.0f; read4((char*)&c); return c; }
|
||||
inline double readDouble() { double c=0.0; read8((char*)&c); return c; }
|
||||
|
||||
void write(const osg::FrameStamp& fs);
|
||||
void read(osg::FrameStamp& fs);
|
||||
@@ -322,13 +322,13 @@ class DataConverter
|
||||
|
||||
void write(const osgGA::GUIEventAdapter& event);
|
||||
void read(osgGA::GUIEventAdapter& event);
|
||||
|
||||
|
||||
void write(CameraPacket& cameraPacket);
|
||||
void read(CameraPacket& cameraPacket);
|
||||
|
||||
char* startPtr() { return _startPtr; }
|
||||
unsigned int numBytes() { return _numBytes; }
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
char* _startPtr;
|
||||
@@ -341,4 +341,4 @@ class DataConverter
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -48,13 +48,13 @@ const unsigned int MAX_NUM_EVENTS = 10;
|
||||
const unsigned int SWAP_BYTES_COMPARE = 0x12345678;
|
||||
class CameraPacket {
|
||||
public:
|
||||
|
||||
|
||||
CameraPacket():_masterKilled(false)
|
||||
|
||||
|
||||
CameraPacket():_masterKilled(false)
|
||||
{
|
||||
_byte_order = SWAP_BYTES_COMPARE;
|
||||
}
|
||||
|
||||
|
||||
void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp)
|
||||
{
|
||||
_matrix = matrix;
|
||||
@@ -63,20 +63,20 @@ class CameraPacket {
|
||||
_frameStamp = *frameStamp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
void readEventQueue(osgViewer::Viewer& viewer);
|
||||
|
||||
|
||||
void writeEventQueue(osgViewer::Viewer& viewer);
|
||||
|
||||
void setMasterKilled(const bool flag) { _masterKilled = flag; }
|
||||
const bool getMasterKilled() const { return _masterKilled; }
|
||||
|
||||
|
||||
unsigned int _byte_order;
|
||||
bool _masterKilled;
|
||||
osg::Matrix _matrix;
|
||||
@@ -84,11 +84,11 @@ class CameraPacket {
|
||||
// note don't use a ref_ptr as used elsewhere for FrameStamp
|
||||
// since we don't want to copy the pointer - but the memory.
|
||||
// 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;
|
||||
|
||||
|
||||
osgGA::EventQueue::Events _events;
|
||||
|
||||
|
||||
};
|
||||
|
||||
class DataConverter
|
||||
@@ -112,7 +112,7 @@ class DataConverter
|
||||
bool _swapBytes;
|
||||
|
||||
char* _currentPtr;
|
||||
|
||||
|
||||
void reset()
|
||||
{
|
||||
_currentPtr = _startPtr;
|
||||
@@ -122,22 +122,22 @@ class DataConverter
|
||||
{
|
||||
if (_currentPtr+1>=_endPtr) return;
|
||||
|
||||
*(_currentPtr++) = *(ptr);
|
||||
*(_currentPtr++) = *(ptr);
|
||||
}
|
||||
|
||||
inline void read1(char* ptr)
|
||||
{
|
||||
if (_currentPtr+1>=_endPtr) return;
|
||||
|
||||
*(ptr) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
|
||||
inline void write2(char* ptr)
|
||||
{
|
||||
if (_currentPtr+2>=_endPtr) return;
|
||||
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr);
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr);
|
||||
}
|
||||
|
||||
inline void read2(char* ptr)
|
||||
@@ -146,13 +146,13 @@ class DataConverter
|
||||
|
||||
if (_swapBytes)
|
||||
{
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
else
|
||||
{
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,10 +160,10 @@ class DataConverter
|
||||
{
|
||||
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)
|
||||
@@ -172,17 +172,17 @@ class DataConverter
|
||||
|
||||
if (_swapBytes)
|
||||
{
|
||||
*(ptr+3) = *(_currentPtr++);
|
||||
*(ptr+2) = *(_currentPtr++);
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
*(ptr+3) = *(_currentPtr++);
|
||||
*(ptr+2) = *(_currentPtr++);
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
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;
|
||||
|
||||
*(_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)
|
||||
@@ -208,27 +208,27 @@ class DataConverter
|
||||
|
||||
if (_swapBytes)
|
||||
{
|
||||
*(ptr+7) = *(_currentPtr++);
|
||||
*(ptr+6) = *(_currentPtr++);
|
||||
*(ptr+5) = *(_currentPtr++);
|
||||
*(ptr+4) = *(_currentPtr++);
|
||||
*(ptr+7) = *(_currentPtr++);
|
||||
*(ptr+6) = *(_currentPtr++);
|
||||
*(ptr+5) = *(_currentPtr++);
|
||||
*(ptr+4) = *(_currentPtr++);
|
||||
|
||||
*(ptr+3) = *(_currentPtr++);
|
||||
*(ptr+2) = *(_currentPtr++);
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
*(ptr+3) = *(_currentPtr++);
|
||||
*(ptr+2) = *(_currentPtr++);
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
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 writeDouble(double c) { write8((char*)&c); }
|
||||
|
||||
inline char readChar() { char c; read1(&c); return c; }
|
||||
inline unsigned char readUChar() { unsigned char c; read1((char*)&c); return c; }
|
||||
inline short readShort() { short c; read2((char*)&c); return c; }
|
||||
inline unsigned short readUShort() { unsigned short c; read2((char*)&c); return c; }
|
||||
inline int readInt() { int c; read4((char*)&c); return c; }
|
||||
inline unsigned int readUInt() { unsigned int c; read4((char*)&c); return c; }
|
||||
inline float readFloat() { float c; read4((char*)&c); return c; }
|
||||
inline double readDouble() { double c; read8((char*)&c); return c; }
|
||||
inline char readChar() { char c=0; read1(&c); return c; }
|
||||
inline unsigned char readUChar() { unsigned char c=0; read1((char*)&c); return c; }
|
||||
inline short readShort() { short c=0; read2((char*)&c); return c; }
|
||||
inline unsigned short readUShort() { unsigned short c=0; read2((char*)&c); return c; }
|
||||
inline int readInt() { int c=0; read4((char*)&c); return c; }
|
||||
inline unsigned int readUInt() { unsigned int c=0; read4((char*)&c); return c; }
|
||||
inline float readFloat() { float c=0.0f; read4((char*)&c); return c; }
|
||||
inline double readDouble() { double c=0.0; read8((char*)&c); return c; }
|
||||
|
||||
void write(const osg::FrameStamp& fs)
|
||||
{
|
||||
@@ -361,16 +361,16 @@ class DataConverter
|
||||
event.setModKeyMask(readUInt());
|
||||
event.setTime(readDouble());
|
||||
}
|
||||
|
||||
|
||||
void write(CameraPacket& cameraPacket)
|
||||
{
|
||||
writeUInt(cameraPacket._byte_order);
|
||||
|
||||
|
||||
writeUInt(cameraPacket._masterKilled);
|
||||
|
||||
|
||||
write(cameraPacket._matrix);
|
||||
write(cameraPacket._frameStamp);
|
||||
|
||||
|
||||
writeUInt(cameraPacket._events.size());
|
||||
for(osgGA::EventQueue::Events::iterator itr = cameraPacket._events.begin();
|
||||
itr != cameraPacket._events.end();
|
||||
@@ -387,12 +387,12 @@ class DataConverter
|
||||
{
|
||||
_swapBytes = !_swapBytes;
|
||||
}
|
||||
|
||||
|
||||
cameraPacket._masterKilled = readUInt()!=0;
|
||||
|
||||
|
||||
read(cameraPacket._matrix);
|
||||
read(cameraPacket._frameStamp);
|
||||
|
||||
|
||||
cameraPacket._events.clear();
|
||||
unsigned int numEvents = readUInt();
|
||||
for(unsigned int i=0;i<numEvents;++i)
|
||||
@@ -409,7 +409,7 @@ void CameraPacket::readEventQueue(osgViewer::Viewer& viewer)
|
||||
_events.clear();
|
||||
|
||||
osgViewer::ViewerBase::Contexts contexts;
|
||||
viewer.getContexts(contexts);
|
||||
viewer.getContexts(contexts);
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
viewer.getEventQueue()->copyEvents(_events);
|
||||
|
||||
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.
|
||||
osg::ArgumentParser arguments(&argc,argv);
|
||||
|
||||
|
||||
// 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()->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("-f <float>","Field of view of camera");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-o <float>","Offset angle of camera");
|
||||
|
||||
|
||||
// construct the viewer.
|
||||
osgViewer::Viewer viewer;
|
||||
|
||||
@@ -468,12 +468,12 @@ int main( int argc, char **argv )
|
||||
ViewerMode viewerMode = STAND_ALONE;
|
||||
while (arguments.read("-m")) viewerMode = MASTER;
|
||||
while (arguments.read("-s")) viewerMode = SLAVE;
|
||||
|
||||
|
||||
int socketNumber=8100;
|
||||
while (arguments.read("-n",socketNumber)) ;
|
||||
|
||||
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);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (arguments.argc()<=1)
|
||||
{
|
||||
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;
|
||||
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
|
||||
|
||||
|
||||
double original_fov = atan(tan(osg::DegreesToRadians(fovy)*0.5)*aspectRatio)*2.0;
|
||||
std::cout << "setting lens perspective : original "<<original_fov<<" "<<fovy<<std::endl;
|
||||
|
||||
|
||||
fovy = atan(tan(osg::DegreesToRadians(camera_fov)*0.5)/aspectRatio)*2.0;
|
||||
viewer.getCamera()->setProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
|
||||
|
||||
|
||||
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
|
||||
original_fov = atan(tan(osg::DegreesToRadians(fovy)*0.5)*aspectRatio)*2.0;
|
||||
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));
|
||||
|
||||
bool masterKilled = false;
|
||||
|
||||
|
||||
DataConverter scratchPad(1024);
|
||||
|
||||
while( !viewer.done() && !masterKilled )
|
||||
{
|
||||
osg::Timer_t startTick = osg::Timer::instance()->tick();
|
||||
|
||||
|
||||
viewer.advance();
|
||||
|
||||
// special handling for working as a cluster.
|
||||
@@ -563,12 +563,12 @@ int main( int argc, char **argv )
|
||||
{
|
||||
case(MASTER):
|
||||
{
|
||||
|
||||
|
||||
// take camera zero as the guide.
|
||||
osg::Matrix modelview(viewer.getCamera()->getViewMatrix());
|
||||
|
||||
|
||||
cp->setPacket(modelview,viewer.getFrameStamp());
|
||||
|
||||
|
||||
cp->readEventQueue(viewer);
|
||||
|
||||
scratchPad.reset();
|
||||
@@ -578,11 +578,11 @@ int main( int argc, char **argv )
|
||||
scratchPad.read(*cp);
|
||||
|
||||
bc.setBuffer(scratchPad._startPtr, scratchPad._numBytes);
|
||||
|
||||
|
||||
std::cout << "bc.sync()"<<scratchPad._numBytes<<std::endl;
|
||||
|
||||
bc.sync();
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case(SLAVE):
|
||||
@@ -591,13 +591,13 @@ int main( int argc, char **argv )
|
||||
rc.setBuffer(scratchPad._startPtr, scratchPad._numBytes);
|
||||
|
||||
rc.sync();
|
||||
|
||||
|
||||
scratchPad.reset();
|
||||
scratchPad.read(*cp);
|
||||
|
||||
|
||||
cp->writeEventQueue(viewer);
|
||||
|
||||
if (cp->getMasterKilled())
|
||||
if (cp->getMasterKilled())
|
||||
{
|
||||
std::cout << "Received master killed."<<std::endl;
|
||||
// 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.
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
// 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;
|
||||
cp->getModelView(modelview,camera_offset);
|
||||
|
||||
|
||||
viewer.getCamera()->setViewMatrix(modelview);
|
||||
}
|
||||
|
||||
// fire off the cull and draw traversals of the scene.
|
||||
if(!masterKilled)
|
||||
viewer.renderingTraversals();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 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.
|
||||
cp->setPacket(osg::Matrix::identity(),viewer.getFrameStamp());
|
||||
cp->setMasterKilled(true);
|
||||
cp->setMasterKilled(true);
|
||||
|
||||
scratchPad.reset();
|
||||
scratchPad.write(*cp);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
void configureShaders( osg::StateSet* stateSet )
|
||||
{
|
||||
const std::string vertexSource =
|
||||
const std::string vertexSource =
|
||||
"#version 140 \n"
|
||||
" \n"
|
||||
"uniform mat4 osg_ModelViewProjectionMatrix; \n"
|
||||
@@ -41,7 +41,7 @@ void configureShaders( osg::StateSet* stateSet )
|
||||
"} \n";
|
||||
osg::Shader* vShader = new osg::Shader( osg::Shader::VERTEX, vertexSource );
|
||||
|
||||
const std::string fragmentSource =
|
||||
const std::string fragmentSource =
|
||||
"#version 140 \n"
|
||||
" \n"
|
||||
"in vec4 color; \n"
|
||||
@@ -90,16 +90,16 @@ int main( int argc, char** argv )
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
osgViewer::Viewer viewer;
|
||||
|
||||
// Create a Camera that uses the above OpenGL context.
|
||||
osg::Camera* cam = new osg::Camera;
|
||||
osg::Camera* cam = viewer.getCamera();
|
||||
cam->setGraphicsContext( gc.get() );
|
||||
// Must set perspective projection for fovy and aspect.
|
||||
cam->setProjectionMatrix( osg::Matrix::perspective( 30., (double)width/(double)height, 1., 100. ) );
|
||||
// Unlike OpenGL, OSG viewport does *not* default to window dimensions.
|
||||
cam->setViewport( new osg::Viewport( 0, 0, width, height ) );
|
||||
|
||||
osgViewer::Viewer viewer;
|
||||
viewer.setCamera( cam );
|
||||
viewer.setSceneData( root );
|
||||
|
||||
// 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.
|
||||
|
||||
Get the draft gl3.h header file from OpenGL.org and put it in a folder called
|
||||
<EFBFBD>GL3<EFBFBD> somewhere on your hard drive. OSG includes this header as <GL3/gl3.h>. Get
|
||||
GL3 somewhere on your hard drive. OSG includes this header as <GL3/gl3.h>. Get
|
||||
gl3.h from here:
|
||||
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
|
||||
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:
|
||||
/I <EFBFBD>C:\GLHeader<EFBFBD>
|
||||
/I C:\GLHeader
|
||||
The folder GLHeader should contain a subfolder GL3, which in turn contains
|
||||
gl3.h.
|
||||
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
/* 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
|
||||
* Adapted to OpenScenegraph by John Kaniarz
|
||||
* Additional work by Michael Mc Donnell
|
||||
*/
|
||||
|
||||
#include <osg/Program>
|
||||
@@ -113,7 +120,8 @@ static const char* fragSource = {
|
||||
"}\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::Geometry *geometry = new osg::Geometry();
|
||||
const unsigned int Faces[] = {
|
||||
@@ -163,10 +171,16 @@ osg::ref_ptr<osg::Geode> CreateIcosahedron(osg::Program *program){
|
||||
geometry->setVertexArray(vertices);
|
||||
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);
|
||||
return geode;
|
||||
}
|
||||
osg::ref_ptr<osg::Program> createProgram(){
|
||||
|
||||
osg::ref_ptr<osg::Program> createProgram()
|
||||
{
|
||||
osg::Program *program = new osg::Program();
|
||||
program->addShader(new osg::Shader(osg::Shader::VERTEX,vertSource));
|
||||
program->addShader(new osg::Shader(osg::Shader::TESSCONTROL,tessControlSource));
|
||||
@@ -179,38 +193,74 @@ osg::ref_ptr<osg::Program> createProgram(){
|
||||
return program;
|
||||
}
|
||||
|
||||
float tessInner=1.0f;
|
||||
float tessOuter=1.0f;
|
||||
osg::ref_ptr<osg::Uniform> tessInnerU = new osg::Uniform("TessLevelInner",tessInner);
|
||||
osg::ref_ptr<osg::Uniform> tessOuterU = new osg::Uniform("TessLevelOuter",tessOuter);
|
||||
|
||||
class KeyboardEventHandler : public osgGA::GUIEventHandler {
|
||||
class KeyboardEventHandler : public osgGA::GUIEventHandler
|
||||
{
|
||||
public:
|
||||
KeyboardEventHandler():osgGA::GUIEventHandler(){}
|
||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& gaa){
|
||||
KeyboardEventHandler(osg::ref_ptr<osg::Uniform> tessInnerU, osg::ref_ptr<osg::Uniform> tessOuterU):
|
||||
_tessInnerU(tessInnerU),
|
||||
_tessOuterU(tessOuterU)
|
||||
{
|
||||
tessInnerU->get(_tessInner);
|
||||
tessOuterU->get(_tessOuter);
|
||||
}
|
||||
|
||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& gaa)
|
||||
{
|
||||
if(ea.getEventType()==osgGA::GUIEventAdapter::KEYDOWN){
|
||||
switch (ea.getKey()){
|
||||
case osgGA::GUIEventAdapter::KEY_Up:
|
||||
tessOuter++;
|
||||
tessOuterU->set(tessOuter);
|
||||
increaseOuterTesselation();
|
||||
return true;
|
||||
case osgGA::GUIEventAdapter::KEY_Down:
|
||||
tessOuter--;
|
||||
tessOuter=std::max(1.0f,tessOuter);
|
||||
tessOuterU->set(tessOuter);
|
||||
decreaseOuterTesselation();
|
||||
return true;
|
||||
case osgGA::GUIEventAdapter::KEY_Left:
|
||||
tessInner--;
|
||||
tessInner=std::max(1.0f,tessInner);
|
||||
tessInnerU->set(tessInner);
|
||||
decreaseInnerTesselation();
|
||||
return true;
|
||||
case osgGA::GUIEventAdapter::KEY_Right:
|
||||
tessInner++;
|
||||
tessInnerU->set(tessInner);
|
||||
increaseInnerTesselation();
|
||||
return true;
|
||||
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 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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -220,6 +270,9 @@ int main(int argc, char* argv[])
|
||||
viewer.setUpViewInWindow(100,100,800,600);
|
||||
osg::ref_ptr<osg::Program> program = createProgram();
|
||||
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;
|
||||
state = geode->getOrCreateStateSet();
|
||||
state->addUniform(new osg::Uniform("AmbientMaterial",osg::Vec3(0.04f, 0.04f, 0.04f)));
|
||||
@@ -229,7 +282,7 @@ int main(int argc, char* argv[])
|
||||
state->addUniform(tessOuterU.get());
|
||||
state->setAttribute(new osg::PatchParameter(3));
|
||||
state->setAttribute(program.get());
|
||||
|
||||
|
||||
// switch on the uniforms that track the modelview and projection matrices
|
||||
osgViewer::Viewer::Windows windows;
|
||||
viewer.getWindows(windows);
|
||||
@@ -241,8 +294,8 @@ int main(int argc, char* argv[])
|
||||
s->setUseModelViewAndProjectionUniforms(true);
|
||||
s->setUseVertexAttributeAliasing(true);
|
||||
}
|
||||
|
||||
viewer.addEventHandler(new KeyboardEventHandler());
|
||||
|
||||
viewer.addEventHandler(new KeyboardEventHandler(tessInnerU, tessOuterU));
|
||||
viewer.setSceneData(geode.get());
|
||||
return viewer.run();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ inline void clampGEQUAL(T& value,const T minValue,const char* valueName)
|
||||
{
|
||||
if (value<minValue)
|
||||
{
|
||||
notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is below permitted minimum, clampping to "<<minValue<<"."<< std::endl;
|
||||
notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is below permitted minimum, clamping to "<<minValue<<"."<< std::endl;
|
||||
value = minValue;
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ inline void clampLEQUAL(T& value,const T maxValue,const char* valueName)
|
||||
{
|
||||
if (value>maxValue)
|
||||
{
|
||||
notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is above permitted maximum, clampping to "<<maxValue<<"."<< std::endl;
|
||||
notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is above permitted maximum, clamping to "<<maxValue<<"."<< std::endl;
|
||||
value = maxValue;
|
||||
}
|
||||
}
|
||||
@@ -55,13 +55,13 @@ inline void clampBetweenRange(T& value,const T minValue,const T maxValue,const c
|
||||
{
|
||||
if (value<minValue)
|
||||
{
|
||||
notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is below permitted minimum, clampping to "<<minValue<<"."<< std::endl;
|
||||
notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is below permitted minimum, clamping to "<<minValue<<"."<< std::endl;
|
||||
value = minValue;
|
||||
}
|
||||
else
|
||||
if (value>maxValue)
|
||||
{
|
||||
notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is above permitted maximum, clampping to "<<maxValue<<"."<< std::endl;
|
||||
notify(WARN) << "Warning: "<<valueName<<" of "<<value<<" is above permitted maximum, clamping to "<<maxValue<<"."<< std::endl;
|
||||
value = maxValue;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ inline void clampArrayElementGEQUAL(A& value,unsigned int i,const T minValue,con
|
||||
{
|
||||
if (value[i]<minValue)
|
||||
{
|
||||
notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is below permitted minimum, clampping to "<<minValue<<"."<< std::endl;
|
||||
notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is below permitted minimum, clamping to "<<minValue<<"."<< std::endl;
|
||||
value[i] = minValue;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ inline void clampArrayElementLEQUAL(A& value,unsigned int i,const T maxValue,con
|
||||
{
|
||||
if (value[i]>maxValue)
|
||||
{
|
||||
notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is above permitted maximum, clampping to "<<maxValue<<"."<< std::endl;
|
||||
notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is above permitted maximum, clamping to "<<maxValue<<"."<< std::endl;
|
||||
value = maxValue;
|
||||
}
|
||||
}
|
||||
@@ -103,13 +103,13 @@ inline void clampArrayElementBetweenRange(A& value,unsigned int i,const T minVal
|
||||
{
|
||||
if (value[i]<minValue)
|
||||
{
|
||||
notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is below permitted minimum, clampping to "<<minValue<<"."<< std::endl;
|
||||
notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is below permitted minimum, clamping to "<<minValue<<"."<< std::endl;
|
||||
value[i] = minValue;
|
||||
}
|
||||
else
|
||||
if (value[i]>maxValue)
|
||||
{
|
||||
notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is above permitted maximum, clampping to "<<maxValue<<"."<< std::endl;
|
||||
notify(WARN) << "Warning: "<<valueName<<"["<<i<<"] of "<<value[i]<<" is above permitted maximum, clamping to "<<maxValue<<"."<< std::endl;
|
||||
value[i] = maxValue;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
#endif
|
||||
|
||||
// XXX This is from Win32's <ctype.h>
|
||||
#if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&((__GNUC__ == 3)||(__GNUC__ == 4)))
|
||||
#if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&(__GNUC__ >2))
|
||||
typedef unsigned short wchar_t;
|
||||
#define _WCHAR_T_DEFINED
|
||||
#endif
|
||||
|
||||
@@ -203,8 +203,9 @@ class OSG_EXPORT Node : public Object
|
||||
if (nc != NULL && _updateCallback.valid()) {
|
||||
if (_updateCallback == nc)
|
||||
{
|
||||
setUpdateCallback(nc->getNestedCallback()); // replace the callback by the nested one
|
||||
ref_ptr<NodeCallback> new_nested_callback = nc->getNestedCallback();
|
||||
nc->setNestedCallback(0);
|
||||
setUpdateCallback(new_nested_callback.get());
|
||||
}
|
||||
else _updateCallback->removeNestedCallback(nc);
|
||||
}
|
||||
@@ -237,8 +238,9 @@ class OSG_EXPORT Node : public Object
|
||||
if (nc != NULL && _eventCallback.valid()) {
|
||||
if (_eventCallback == nc)
|
||||
{
|
||||
setEventCallback(nc->getNestedCallback()); // replace the callback by the nested one
|
||||
ref_ptr<NodeCallback> new_nested_callback = nc->getNestedCallback();
|
||||
nc->setNestedCallback(0);
|
||||
setEventCallback(new_nested_callback.get()); // replace the callback by the nested one
|
||||
}
|
||||
else _eventCallback->removeNestedCallback(nc);
|
||||
}
|
||||
@@ -271,8 +273,9 @@ class OSG_EXPORT Node : public Object
|
||||
if (nc != NULL && _cullCallback.valid()) {
|
||||
if (_cullCallback == nc)
|
||||
{
|
||||
setCullCallback(nc->getNestedCallback()); // replace the callback by the nested one
|
||||
ref_ptr<NodeCallback> new_nested_callback = nc->getNestedCallback();
|
||||
nc->setNestedCallback(0);
|
||||
setCullCallback(new_nested_callback.get()); // replace the callback by the nested one
|
||||
}
|
||||
else _cullCallback->removeNestedCallback(nc);
|
||||
}
|
||||
|
||||
@@ -1336,11 +1336,6 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
if (_lastAppliedProgramObject!=program)
|
||||
{
|
||||
_lastAppliedProgramObject = program;
|
||||
if (program && _appliedProgramObjectSet.count(program)==0)
|
||||
{
|
||||
_appliedProgramObjectSet.insert(program);
|
||||
program->addObserver(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
inline const Program::PerContextProgram* getLastAppliedProgramObject() const { return _lastAppliedProgramObject; }
|
||||
|
||||
@@ -305,6 +305,25 @@
|
||||
#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E
|
||||
#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
|
||||
#define GL_RG 0x8227
|
||||
#define GL_RG_INTEGER 0x8228
|
||||
|
||||
@@ -20,7 +20,7 @@ extern "C" {
|
||||
|
||||
#define OPENSCENEGRAPH_MAJOR_VERSION 3
|
||||
#define OPENSCENEGRAPH_MINOR_VERSION 2
|
||||
#define OPENSCENEGRAPH_PATCH_VERSION 1
|
||||
#define OPENSCENEGRAPH_PATCH_VERSION 3
|
||||
#define OPENSCENEGRAPH_SOVERSION 100
|
||||
|
||||
/* Convenience macro that can be used to decide whether a feature is present or not i.e.
|
||||
|
||||
@@ -94,6 +94,10 @@ class ref_ptr
|
||||
bool operator!() const { return _ptr==0; } // not required
|
||||
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; }
|
||||
|
||||
void swap(ref_ptr& rp) { T* tmp=_ptr; _ptr=rp._ptr; rp._ptr=tmp; }
|
||||
|
||||
@@ -335,6 +335,12 @@ class OSGVIEWER_EXPORT ViewerBase : public virtual osg::Object
|
||||
osg::ref_ptr<osgUtil::IncrementalCompileOperation> _incrementalCompileOperation;
|
||||
|
||||
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; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -425,6 +425,8 @@ GLenum Image::computeFormatDataType(GLenum pixelFormat)
|
||||
{
|
||||
switch (pixelFormat)
|
||||
{
|
||||
case GL_R32F:
|
||||
case GL_RG32F:
|
||||
case GL_LUMINANCE32F_ARB:
|
||||
case GL_LUMINANCE16F_ARB:
|
||||
case GL_LUMINANCE_ALPHA32F_ARB:
|
||||
@@ -466,6 +468,8 @@ GLenum Image::computeFormatDataType(GLenum pixelFormat)
|
||||
|
||||
case GL_RGBA:
|
||||
case GL_RGB:
|
||||
case GL_RED:
|
||||
case GL_RG:
|
||||
case GL_LUMINANCE:
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
case GL_ALPHA: return GL_UNSIGNED_BYTE;
|
||||
@@ -515,6 +519,9 @@ unsigned int Image::computeNumComponents(GLenum pixelFormat)
|
||||
case(GL_ALPHA32UI_EXT): return 1;
|
||||
case(GL_ALPHA16F_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_BGR): return 3;
|
||||
case(GL_RGB8I_EXT): return 3;
|
||||
@@ -799,7 +806,11 @@ int Image::computeNumberOfMipmapLevels(int s,int t, int r)
|
||||
{
|
||||
int w = maximum(s, t);
|
||||
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
|
||||
@@ -1510,16 +1521,18 @@ void Image::flipVertical()
|
||||
{
|
||||
if (!dxtc_tool::VerticalFlip(s,t,_pixelFormat,_data+_mipmapData[i]))
|
||||
{
|
||||
OSG_NOTICE << "Notice Image::flipVertical(): Vertical flip do not succeed" << std::endl;
|
||||
OSG_NOTICE << "Notice Image::flipVertical(): Vertical flip did not succeed" << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// its not a compressed image, so implement flip oursleves.
|
||||
// it's not a compressed image, so implement flip ourselves.
|
||||
unsigned int mipRowSize = computeRowWidthInBytes(s, _pixelFormat, _dataType, _packing);
|
||||
unsigned int mipRowStep = mipRowSize;
|
||||
unsigned char* top = _data+_mipmapData[i];
|
||||
unsigned char* bottom = top + (t-1)*rowStep;
|
||||
unsigned char* bottom = top + (t-1)*mipRowStep;
|
||||
|
||||
flipImageVertical(top, bottom, rowSize, rowStep);
|
||||
flipImageVertical(top, bottom, mipRowSize, mipRowStep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,18 +68,22 @@ PolygonMode::Mode PolygonMode::getMode(Face face) const
|
||||
|
||||
void PolygonMode::apply(State&) const
|
||||
{
|
||||
#ifdef OSG_GL1_AVAILABLE
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
if (_modeFront==_modeBack)
|
||||
{
|
||||
glPolygonMode(GL_FRONT_AND_BACK,(GLenum)_modeFront);
|
||||
}
|
||||
else
|
||||
{
|
||||
glPolygonMode(GL_FRONT,(GLenum)_modeFront);
|
||||
glPolygonMode(GL_BACK,(GLenum)_modeBack);
|
||||
#ifdef OSG_GL1_AVAILABLE
|
||||
glPolygonMode(GL_FRONT,(GLenum)_modeFront);
|
||||
glPolygonMode(GL_BACK,(GLenum)_modeBack);
|
||||
#else
|
||||
OSG_NOTICE << "Warning: PolygonMode::apply(State&) - only GL_FRONT_AND_BACK is supported." << std::endl;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
OSG_NOTICE<<"Warning: PolygonMode::apply(State&) - not supported."<<std::endl;
|
||||
OSG_NOTICE << "Warning: PolygonMode::apply(State&) - is not supported." << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -134,25 +134,10 @@ State::~State()
|
||||
//_texCoordArrayList.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)
|
||||
{
|
||||
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()
|
||||
@@ -239,17 +224,6 @@ void State::reset()
|
||||
|
||||
_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...
|
||||
// go through all active Unfirom's, setting to change to force update,
|
||||
// the idea is to leave only the global defaults left.
|
||||
@@ -1386,6 +1360,18 @@ bool State::convertVertexShaderSourceToOsgBuiltIns(std::string& source) const
|
||||
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)
|
||||
{
|
||||
State_Utils::replaceAndInsertDeclaration(source, declPos, _vertexAlias._glName, _vertexAlias._osgName, _vertexAlias._declaration);
|
||||
@@ -1400,18 +1386,6 @@ 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;
|
||||
|
||||
return true;
|
||||
@@ -1716,15 +1690,6 @@ void State::print(std::ostream& fout) const
|
||||
}
|
||||
fout<<"}"<<std::endl;
|
||||
|
||||
#if 0
|
||||
TextureModeMapList _textureModeMapList;
|
||||
TextureAttributeMapList _textureAttributeMapList;
|
||||
|
||||
AppliedProgramObjectSet _appliedProgramObjectSet;
|
||||
const Program::PerContextProgram* _lastAppliedProgramObject;
|
||||
#endif
|
||||
|
||||
|
||||
fout<<"StateSetStack _stateSetStack {"<<std::endl;
|
||||
for(StateSetStack::const_iterator itr = _stateStateStack.begin();
|
||||
itr != _stateStateStack.end();
|
||||
|
||||
@@ -32,15 +32,16 @@ Texture2DArray::Texture2DArray(const Texture2DArray& text,const CopyOp& copyop):
|
||||
Texture(text,copyop),
|
||||
_textureWidth(text._textureWidth),
|
||||
_textureHeight(text._textureHeight),
|
||||
_textureDepth(text._textureDepth),
|
||||
_textureDepth(0),
|
||||
_numMipmapLevels(text._numMipmapLevels),
|
||||
_subloadCallback(text._subloadCallback)
|
||||
{
|
||||
setTextureDepth(text._textureDepth);
|
||||
|
||||
// copy all images by iterating through all of them
|
||||
for (int i=0; i < text._textureDepth; i++)
|
||||
{
|
||||
setImage(i, copyop(text._images[i].get()));
|
||||
_modifiedCount.push_back(ImageModifiedCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,14 +48,15 @@ TransferFunction1D::TransferFunction1D(const TransferFunction1D& tf, const CopyO
|
||||
TransferFunction(tf,copyop)
|
||||
{
|
||||
allocate(tf.getNumberImageCells());
|
||||
assign(_colorMap);
|
||||
assign(tf._colorMap);
|
||||
}
|
||||
|
||||
void TransferFunction1D::allocate(unsigned int numX)
|
||||
{
|
||||
_image = new osg::Image;
|
||||
_image->allocateImage(numX,1,1,GL_RGBA, GL_FLOAT);
|
||||
if (!_colorMap.empty()) assign(_colorMap);
|
||||
|
||||
updateImage();
|
||||
}
|
||||
|
||||
void TransferFunction1D::clear(const osg::Vec4& color)
|
||||
@@ -177,7 +178,7 @@ osg::Vec4 TransferFunction1D::getColor(float v) const
|
||||
|
||||
void TransferFunction1D::assign(const ColorMap& newColours)
|
||||
{
|
||||
_colorMap = newColours;
|
||||
if (&_colorMap != &newColours) _colorMap = newColours;
|
||||
|
||||
updateImage();
|
||||
}
|
||||
|
||||
@@ -107,7 +107,13 @@ bool Animation::update (double time, int priority)
|
||||
{
|
||||
case ONCE:
|
||||
if (t > _originalDuration)
|
||||
{
|
||||
for (ChannelList::const_iterator chan = _channels.begin();
|
||||
chan != _channels.end(); ++chan)
|
||||
(*chan)->update(_originalDuration, _weight, priority);
|
||||
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case STAY:
|
||||
if (t > _originalDuration)
|
||||
|
||||
@@ -7,7 +7,7 @@ IF (DYNAMIC_OPENSCENEGRAPH)
|
||||
|
||||
IF(OSG_PLUGIN_SEARCH_INSTALL_DIR_FOR_PLUGINS)
|
||||
# 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()
|
||||
|
||||
# Set the library extension according to what configuration is being built.
|
||||
|
||||
@@ -505,7 +505,7 @@ static void appendInstallationLibraryFilePaths(osgDB::FilePathList& filepath)
|
||||
#ifdef OSG_DEFAULT_LIBRARY_PATH
|
||||
|
||||
// Append the install prefix path to the library search path if configured
|
||||
filepath.push_back(ADDQUOTES(OSG_DEFAULT_LIBRARY_PATH));
|
||||
filepath.push_back(OSG_DEFAULT_LIBRARY_PATH);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ bool NodeTrackerManipulator::performMovementLeftMouseButton( const double eventT
|
||||
} else
|
||||
rotateTrackball( _ga_t0->getXnormalized(), _ga_t0->getYnormalized(),
|
||||
_ga_t1->getXnormalized(), _ga_t1->getYnormalized(),
|
||||
_thrown ? float( _delta_frame_time / eventTimeDelta ) : 1.f );
|
||||
getThrowScale( eventTimeDelta ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -379,12 +379,12 @@ void OrbitManipulator::OrbitAnimationData::start( const osg::Vec3d& movement, co
|
||||
Scale parameter is useful, for example, when manipulator is thrown.
|
||||
It scales the amount of rotation based, for example, on the current frame time.*/
|
||||
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;
|
||||
float angle;
|
||||
|
||||
trackball( axis, angle, px1, py1, px0, py0 );
|
||||
trackball( axis, angle, px0 + (px1-px0)*scale, py0 + (py1-py0)*scale, px0, py0 );
|
||||
|
||||
Quat new_rotate;
|
||||
new_rotate.makeRotate( angle, axis );
|
||||
|
||||
@@ -154,6 +154,8 @@ bool StandardManipulator::isAnimating() const
|
||||
/// Finishes the animation by performing a step that moves it to its final position.
|
||||
void StandardManipulator::finishAnimation()
|
||||
{
|
||||
_thrown = false;
|
||||
|
||||
if( !isAnimating() )
|
||||
return;
|
||||
|
||||
@@ -586,7 +588,12 @@ void StandardManipulator::setAllowThrow( bool allowThrow )
|
||||
events that started the animation.*/
|
||||
float StandardManipulator::getThrowScale( const double eventTimeDelta ) const
|
||||
{
|
||||
if( _thrown ) return float( _delta_frame_time / eventTimeDelta );
|
||||
if( _thrown )
|
||||
{
|
||||
if (eventTimeDelta == 0.f)
|
||||
return 0.f;
|
||||
return float( _delta_frame_time / eventTimeDelta );
|
||||
}
|
||||
else return 1.f;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <limits>
|
||||
#include <assert.h>
|
||||
|
||||
using namespace std;
|
||||
@@ -238,6 +239,7 @@ ReaderWriter3DS::ReaderWriter3DS()
|
||||
//supportsOption("OutputTextureFiles","Write out the texture images to file");
|
||||
//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("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("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.");
|
||||
@@ -863,7 +865,7 @@ struct RemappedFace
|
||||
{
|
||||
Lib3dsFace* face; // Original face definition.
|
||||
osg::Vec3f normal;
|
||||
unsigned short index[3]; // Indices to OSG vertex/normal/texcoord arrays.
|
||||
unsigned int index[3]; // Indices to OSG vertex/normal/texcoord arrays.
|
||||
};
|
||||
|
||||
struct VertexParams
|
||||
@@ -883,6 +885,14 @@ static bool isFaceValid(const Lib3dsMesh* mesh, const Lib3dsFace* face)
|
||||
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
|
||||
required to implement normals for smoothing groups. When a shared
|
||||
vertex is encountered when smoothing is required, normals are added
|
||||
@@ -895,7 +905,7 @@ static bool isFaceValid(const Lib3dsMesh* mesh, const Lib3dsFace* face)
|
||||
static void addVertex(
|
||||
const Lib3dsMesh* mesh,
|
||||
RemappedFace& remappedFace,
|
||||
unsigned short int i,
|
||||
unsigned int i,
|
||||
osg::Geometry* geometry,
|
||||
std::vector<int>& origToNewMapping,
|
||||
std::vector<int>& splitVertexChain,
|
||||
@@ -905,7 +915,7 @@ static void addVertex(
|
||||
osg::Vec3Array* normals = (osg::Vec3Array*)geometry->getNormalArray();
|
||||
osg::Vec2Array* texCoords = (osg::Vec2Array*)geometry->getTexCoordArray(0);
|
||||
|
||||
unsigned short int index = remappedFace.face->index[i];
|
||||
unsigned int index = remappedFace.face->index[i];
|
||||
if (origToNewMapping[index] == -1)
|
||||
{
|
||||
int newIndex = vertices->size();
|
||||
@@ -926,6 +936,10 @@ static void addVertex(
|
||||
osg::Vec2f texCoord(mesh->texcos[index][0], mesh->texcos[index][1]);
|
||||
texCoord = componentMultiply(texCoord, params.scaleUV);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1002,6 +1016,25 @@ 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
|
||||
*/
|
||||
@@ -1058,21 +1091,27 @@ osg::Drawable* ReaderWriter3DS::ReaderObject::createDrawable(Lib3dsMesh *m,FaceL
|
||||
|
||||
unsigned int faceIndex = 0;
|
||||
unsigned int faceCount = 0;
|
||||
unsigned int maxVertexIndex = 0;
|
||||
for (FaceList::iterator itr = faceList.begin();
|
||||
itr != faceList.end();
|
||||
++itr, ++faceIndex)
|
||||
{
|
||||
osg::Vec3 normal = copyLib3dsVec3ToOsgVec3(normals[*itr]);
|
||||
osg::Vec3f normal(copyLib3dsVec3ToOsgVec3(normals[*itr]));
|
||||
if (matrix) normal = osg::Matrix::transform3x3(normal, *(params.matrix));
|
||||
normal.normalize();
|
||||
|
||||
Lib3dsFace& face = m->faces[*itr];
|
||||
remappedFaces[faceIndex].face = &face;
|
||||
remappedFaces[faceIndex].normal = normal;
|
||||
if (addFace(m, remappedFaces[faceIndex], geom, origToNewMapping, splitVertexChain, params))
|
||||
RemappedFace & rf = remappedFaces[faceIndex];
|
||||
rf.face = &face;
|
||||
rf.normal = normal;
|
||||
if (addFace(m, rf, geom, origToNewMapping, splitVertexChain, params))
|
||||
{
|
||||
++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.
|
||||
@@ -1087,23 +1126,12 @@ osg::Drawable* ReaderWriter3DS::ReaderObject::createDrawable(Lib3dsMesh *m,FaceL
|
||||
geom->setColorArray(osg_colors.get(), osg::Array::BIND_OVERALL);
|
||||
|
||||
// Create triangle primitives.
|
||||
int numIndices = faceCount * 3;
|
||||
osg::ref_ptr<DrawElementsUShort> elements = new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLES, numIndices);
|
||||
DrawElementsUShort::iterator index_itr = elements->begin();
|
||||
|
||||
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());
|
||||
|
||||
// Remapping may create additional vertices, thus creating indices over USHORT_MAX
|
||||
if (maxVertexIndex < std::numeric_limits<unsigned short>::max()) {
|
||||
fillTriangles<DrawElementsUShort>(*geom, remappedFaces, faceCount * 3);
|
||||
} else {
|
||||
fillTriangles<DrawElementsUInt> (*geom, remappedFaces, faceCount * 3);
|
||||
}
|
||||
#if 0
|
||||
osgUtil::TriStripVisitor tsv;
|
||||
tsv.stripify(*geom);
|
||||
@@ -1177,7 +1205,7 @@ osg::Texture2D* ReaderWriter3DS::ReaderObject::createTexture(Lib3dsTextureMap *
|
||||
osg_texture->setImage(osg_image.get());
|
||||
osg_texture->setName(texture->name);
|
||||
// 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.
|
||||
osg::Texture2D::WrapMode wm = ((texture->flags)&LIB3DS_TEXTURE_NO_TILE) ?
|
||||
@@ -1220,6 +1248,7 @@ ReaderWriter3DS::StateSetInfo ReaderWriter3DS::ReaderObject::createStateSet(Lib3
|
||||
osg::Texture2D* texture1_map = createTexture(&(mat->texture1_map),"texture1_map",textureTransparency);
|
||||
if (texture1_map)
|
||||
{
|
||||
if(textureTransparency) transparency = true;
|
||||
stateset->setTextureAttributeAndModes(unit, texture1_map, osg::StateAttribute::ON);
|
||||
|
||||
double factor = mat->texture1_map.percent;
|
||||
@@ -1300,7 +1329,7 @@ ReaderWriter3DS::StateSetInfo ReaderWriter3DS::ReaderObject::createStateSet(Lib3
|
||||
|
||||
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->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||
}
|
||||
|
||||
@@ -1268,7 +1268,7 @@ SbBool SoVRMLImageTextureOsg::readInstance(SoInput *in, unsigned short flags)
|
||||
if (url.getNum() && url[0].getLength())
|
||||
{
|
||||
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;
|
||||
this->setReadStatus(FALSE);
|
||||
|
||||
@@ -220,7 +220,15 @@ protected:
|
||||
material->setDiffuse (osg::Material::FRONT_AND_BACK,osg::Vec4(diffuse,alpha));
|
||||
material->setSpecular(osg::Material::FRONT_AND_BACK,osg::Vec4(specular,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();
|
||||
(*mp)[index] = material;
|
||||
@@ -266,7 +274,15 @@ protected:
|
||||
material->setDiffuse (osg::Material::FRONT_AND_BACK,osg::Vec4(diffuse,alpha));
|
||||
material->setSpecular(osg::Material::FRONT_AND_BACK,osg::Vec4(specular,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();
|
||||
(*mp)[i] = material;
|
||||
|
||||
@@ -1047,7 +1047,7 @@ osg::Texture2D* daeReader::processTexture(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (sampler->getSource() == NULL )
|
||||
if (sampler->getSource() == NULL || sampler->getSource()->getValue() == NULL)
|
||||
{
|
||||
OSG_WARN << "Could not locate source for sampler2D" << std::endl;
|
||||
return NULL;
|
||||
|
||||
@@ -264,7 +264,7 @@ struct DXT1TexelsBlock
|
||||
*/
|
||||
#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_R32G32B32A32_TYPELESS = 1,
|
||||
OSG_DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
|
||||
@@ -384,7 +384,7 @@ typedef enum OSG_DXGI_FORMAT {
|
||||
OSG_DXGI_FORMAT_FORCE_UINT = 0xffffffffUL
|
||||
} 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_BUFFER = 1,
|
||||
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( height < 1 ) height = 1;
|
||||
if( depth < 1 ) depth = 1;
|
||||
|
||||
|
||||
return osg::Image::computeImageSizeInBytes(width, height, depth, pixelFormat, pixelType, packing, slice_packing, image_packing);
|
||||
}
|
||||
|
||||
@@ -982,6 +982,8 @@ 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];
|
||||
if(!imageData)
|
||||
{
|
||||
@@ -1014,8 +1016,9 @@ osg::Image* ReadDDSFile(std::istream& _istream, bool flipDDSRead)
|
||||
|
||||
if (flipDDSRead) {
|
||||
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();
|
||||
}
|
||||
else
|
||||
@@ -1061,7 +1064,9 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout, bool autoFlipDDSWri
|
||||
unsigned int pixelSize = osg::Image::computePixelSizeInBits(pixelFormat, dataType);
|
||||
unsigned int imageSize = img->getTotalSizeInBytes();
|
||||
|
||||
// Check that theorical image size (computation taking into account DXTC blocks) is not bigger than actual image size.
|
||||
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.
|
||||
// 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.
|
||||
// - Some hypothetical operation wrongly assumes the data buffer is 8x7 and truncates the buffer. This may even lead to access violations.
|
||||
@@ -1271,10 +1276,12 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout, bool autoFlipDDSWri
|
||||
osg::ref_ptr<const osg::Image> source;
|
||||
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) );
|
||||
const int s(copy->s());
|
||||
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();
|
||||
}
|
||||
@@ -1283,7 +1290,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;
|
||||
}
|
||||
source = copy;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
source = img;
|
||||
@@ -1361,7 +1368,7 @@ public:
|
||||
if (options)
|
||||
{
|
||||
std::istringstream iss(options->getOptionString());
|
||||
std::string opt;
|
||||
std::string opt;
|
||||
while (iss >> opt)
|
||||
{
|
||||
if (opt == "dds_flip") dds_flip = true;
|
||||
|
||||
@@ -24,7 +24,7 @@ using namespace Imath;
|
||||
/****************************************************************************
|
||||
*
|
||||
* Follows is code written by FOI (www.foi.se)
|
||||
* it is a wraper of openEXR(www.openexr.com)
|
||||
* it is a wrapper of openEXR(www.openexr.com)
|
||||
* to add suport of exr images into osg
|
||||
*
|
||||
* 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
|
||||
bool inputError = false;
|
||||
Array2D<Rgba> pixels;
|
||||
int width,height,numComponents;
|
||||
int width=0,height=0,numComponents;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -111,6 +111,7 @@ unsigned char *exr_load(std::istream& fin,
|
||||
rgbafile.readPixels(dw.min.y, dw.max.y);
|
||||
}
|
||||
catch( char * str ) {
|
||||
OSG_WARN << "exr_load error : " << str << std::endl;
|
||||
inputError = true;
|
||||
}
|
||||
|
||||
@@ -335,6 +336,7 @@ protected:
|
||||
}
|
||||
catch( char * str )
|
||||
{
|
||||
OSG_WARN << "writeEXRStream error : " << str << std::endl;
|
||||
writeOK = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,6 +127,27 @@ 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)
|
||||
{
|
||||
FbxDouble3 color = pFbxLambert->Diffuse.Get();
|
||||
|
||||
@@ -22,7 +22,8 @@ struct StateSetContent
|
||||
StateSetContent()
|
||||
: diffuseFactor(1.0),
|
||||
reflectionFactor(1.0),
|
||||
emissiveFactor(1.0)
|
||||
emissiveFactor(1.0),
|
||||
ambientFactor(1.0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,6 +34,7 @@ struct StateSetContent
|
||||
osg::ref_ptr<osg::Texture2D> opacityTexture;
|
||||
osg::ref_ptr<osg::Texture2D> reflectionTexture;
|
||||
osg::ref_ptr<osg::Texture2D> emissiveTexture;
|
||||
osg::ref_ptr<osg::Texture2D> ambientTexture;
|
||||
// more textures types here...
|
||||
|
||||
// textures maps channels names...
|
||||
@@ -40,12 +42,14 @@ struct StateSetContent
|
||||
std::string opacityChannel;
|
||||
std::string reflectionChannel;
|
||||
std::string emissiveChannel;
|
||||
std::string ambientChannel;
|
||||
// more channels names here...
|
||||
|
||||
// combining factors...
|
||||
double diffuseFactor;
|
||||
double reflectionFactor;
|
||||
double emissiveFactor;
|
||||
double ambientFactor;
|
||||
// more combining factors here...
|
||||
|
||||
double diffuseScaleU;
|
||||
@@ -54,6 +58,8 @@ struct StateSetContent
|
||||
double opacityScaleV;
|
||||
double emissiveScaleU;
|
||||
double emissiveScaleV;
|
||||
double ambientScaleU;
|
||||
double ambientScaleV;
|
||||
|
||||
// texture units (eventually used for each texture map)...
|
||||
enum TextureUnit
|
||||
@@ -61,7 +67,8 @@ struct StateSetContent
|
||||
DIFFUSE_TEXTURE_UNIT = 0,
|
||||
OPACITY_TEXTURE_UNIT,
|
||||
REFLECTION_TEXTURE_UNIT,
|
||||
EMISSIVE_TEXTURE_UNIT
|
||||
EMISSIVE_TEXTURE_UNIT,
|
||||
AMBIENT_TEXTURE_UNIT
|
||||
// more texture units here...
|
||||
};
|
||||
};
|
||||
|
||||
@@ -154,6 +154,7 @@ osg::Geometry* getGeometry(osg::Geode* pGeode, GeometryMap& geometryMap,
|
||||
bool useDiffuseMap,
|
||||
bool useOpacityMap,
|
||||
bool useEmissiveMap,
|
||||
bool useAmbientMap,
|
||||
// more here...
|
||||
bool bColor,
|
||||
const osgDB::Options& options,
|
||||
@@ -188,6 +189,8 @@ 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);
|
||||
if (useEmissiveMap)
|
||||
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...
|
||||
|
||||
if (bColor) pGeometry->setColorArray(createVec4Array((precision & osgDB::Options::DOUBLE_PRECISION_COLOR) != 0), osg::Array::BIND_PER_VERTEX);
|
||||
@@ -301,6 +304,22 @@ osg::Geometry* getGeometry(osg::Geode* pGeode, GeometryMap& geometryMap,
|
||||
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...
|
||||
|
||||
if (transparent)
|
||||
@@ -483,6 +502,8 @@ std::string getUVChannelForTextureMap(std::vector<StateSetContent>& stateSetList
|
||||
return stateSetList[i].reflectionChannel;
|
||||
if (0 == strcmp(pName, FbxSurfaceMaterial::sEmissive))
|
||||
return stateSetList[i].emissiveChannel;
|
||||
if (0 == strcmp(pName, FbxSurfaceMaterial::sAmbient))
|
||||
return stateSetList[i].ambientChannel;
|
||||
// more here...
|
||||
}
|
||||
|
||||
@@ -536,6 +557,7 @@ void readMeshTriangle(const FbxMesh * fbxMesh, int i /*polygonIndex*/,
|
||||
const FbxLayerElementUV* pFbxUVs_diffuse,
|
||||
const FbxLayerElementUV* pFbxUVs_opacity,
|
||||
const FbxLayerElementUV* pFbxUVs_emissive,
|
||||
const FbxLayerElementUV* pFbxUVs_ambient,
|
||||
const FbxLayerElementVertexColor* pFbxColors,
|
||||
osg::Geometry* pGeometry,
|
||||
osg::Array* pVertices,
|
||||
@@ -543,6 +565,7 @@ void readMeshTriangle(const FbxMesh * fbxMesh, int i /*polygonIndex*/,
|
||||
osg::Array* pTexCoords_diffuse,
|
||||
osg::Array* pTexCoords_opacity,
|
||||
osg::Array* pTexCoords_emissive,
|
||||
osg::Array* pTexCoords_ambient,
|
||||
osg::Array* pColors)
|
||||
{
|
||||
int v0 = fbxMesh->GetPolygonVertex(i, posInPoly0),
|
||||
@@ -594,6 +617,12 @@ 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, 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...
|
||||
|
||||
if (pColors)
|
||||
@@ -695,12 +724,14 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
|
||||
std::string diffuseChannel = getUVChannelForTextureMap(stateSetList, FbxSurfaceMaterial::sDiffuse);
|
||||
std::string opacityChannel = getUVChannelForTextureMap(stateSetList, FbxSurfaceMaterial::sTransparentColor);
|
||||
std::string emissiveChannel = getUVChannelForTextureMap(stateSetList, FbxSurfaceMaterial::sEmissive);
|
||||
std::string ambientChannel = getUVChannelForTextureMap(stateSetList, FbxSurfaceMaterial::sAmbient);
|
||||
// look for more UV elements here...
|
||||
|
||||
// UV elements...
|
||||
const FbxLayerElementUV* pFbxUVs_diffuse = getUVElementForChannel(diffuseChannel, FbxLayerElement::eTextureDiffuse, fbxMesh);
|
||||
const FbxLayerElementUV* pFbxUVs_opacity = getUVElementForChannel(opacityChannel, FbxLayerElement::eTextureTransparency, fbxMesh);
|
||||
const FbxLayerElementUV* pFbxUVs_emissive = getUVElementForChannel(emissiveChannel, FbxLayerElement::eTextureEmissive, fbxMesh);
|
||||
const FbxLayerElementUV* pFbxUVs_ambient = getUVElementForChannel(ambientChannel, FbxLayerElement::eTextureAmbient, fbxMesh);
|
||||
// more UV elements here...
|
||||
|
||||
// check elements validity...
|
||||
@@ -710,6 +741,7 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
|
||||
if (!layerElementValid(pFbxUVs_diffuse)) pFbxUVs_diffuse = 0;
|
||||
if (!layerElementValid(pFbxUVs_opacity)) pFbxUVs_opacity = 0;
|
||||
if (!layerElementValid(pFbxUVs_emissive)) pFbxUVs_emissive = 0;
|
||||
if (!layerElementValid(pFbxUVs_ambient)) pFbxUVs_ambient = 0;
|
||||
// more here...
|
||||
|
||||
int nPolys = fbxMesh->GetPolygonCount();
|
||||
@@ -750,6 +782,7 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
|
||||
pFbxUVs_diffuse != 0,
|
||||
pFbxUVs_opacity != 0,
|
||||
pFbxUVs_emissive != 0,
|
||||
pFbxUVs_ambient != 0,
|
||||
// more UV elements here...
|
||||
pFbxColors != 0,
|
||||
options,
|
||||
@@ -762,6 +795,7 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
|
||||
osg::Array* pTexCoords_diffuse = pGeometry->getTexCoordArray(StateSetContent::DIFFUSE_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_ambient = pGeometry->getTexCoordArray(StateSetContent::AMBIENT_TEXTURE_UNIT);
|
||||
// more texture coordinates here...
|
||||
|
||||
osg::Array* pColors = pGeometry->getColorArray();
|
||||
@@ -773,9 +807,9 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
|
||||
0, 1, 2,
|
||||
nVertex, nVertex+1, nVertex+2,
|
||||
fbxToOsgVertMap, osgToFbxNormMap,
|
||||
pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxColors,
|
||||
pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxUVs_ambient, pFbxColors,
|
||||
pGeometry,
|
||||
pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pColors);
|
||||
pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pTexCoords_ambient, pColors);
|
||||
nVertex += 3;
|
||||
}
|
||||
else if (lPolygonSize == 4)
|
||||
@@ -790,16 +824,16 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
|
||||
0, 1, p02,
|
||||
nVertex, nVertex+1, nVertex+p02,
|
||||
fbxToOsgVertMap, osgToFbxNormMap,
|
||||
pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxColors,
|
||||
pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxUVs_ambient, pFbxColors,
|
||||
pGeometry,
|
||||
pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pColors);
|
||||
pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pTexCoords_ambient, pColors);
|
||||
readMeshTriangle(fbxMesh, i,
|
||||
p10, 2, 3,
|
||||
nVertex+p10, nVertex+2, nVertex+3,
|
||||
fbxToOsgVertMap, osgToFbxNormMap,
|
||||
pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxColors,
|
||||
pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxUVs_ambient, pFbxColors,
|
||||
pGeometry,
|
||||
pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pColors);
|
||||
pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pTexCoords_ambient, pColors);
|
||||
nVertex += 4;
|
||||
}
|
||||
else if (tessellatePolygons)
|
||||
@@ -819,9 +853,9 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
|
||||
0, j - 1, j,
|
||||
nVertex0, nVertex - 1, nVertex,
|
||||
fbxToOsgVertMap, osgToFbxNormMap,
|
||||
pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxColors,
|
||||
pFbxVertices, pFbxNormals, pFbxUVs_diffuse, pFbxUVs_opacity, pFbxUVs_emissive, pFbxUVs_ambient, pFbxColors,
|
||||
pGeometry,
|
||||
pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pColors);
|
||||
pVertices, pNormals, pTexCoords_diffuse, pTexCoords_opacity, pTexCoords_emissive, pTexCoords_ambient, pColors);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -851,6 +885,7 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
|
||||
osg::Array* pTexCoords_diffuse = pGeometry->getTexCoordArray(StateSetContent::DIFFUSE_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_ambient = pGeometry->getTexCoordArray(StateSetContent::AMBIENT_TEXTURE_UNIT);
|
||||
osg::Array* pColors = pGeometry->getColorArray();
|
||||
// Index of the 1st vertex of the polygon in the geometry
|
||||
int osgVertex0 = pVertices->getNumElements();
|
||||
@@ -883,6 +918,10 @@ osgDB::ReaderWriter::ReadResult OsgFbxReader::readMesh(
|
||||
{
|
||||
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...
|
||||
|
||||
if (pColors)
|
||||
|
||||
@@ -21,7 +21,7 @@ ADD_DEFINITIONS(-D__STDC_CONSTANT_MACROS)
|
||||
# MESSAGE("FFMPEG_LIBAVUTIL_INCLUDE_DIRS = " ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} )
|
||||
# MESSAGE("FFMPEG_LIBRARIES = " ${FFMPEG_LIBRARIES} )
|
||||
|
||||
SET(TARGET_SRC
|
||||
SET(TARGET_SRC
|
||||
FFmpegClocks.cpp
|
||||
FFmpegDecoderAudio.cpp
|
||||
FFmpegDecoder.cpp
|
||||
@@ -46,9 +46,8 @@ SET(TARGET_H
|
||||
MessageQueue.hpp
|
||||
)
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Remove -pedantic flag as it barfs on ffmoeg headers
|
||||
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
|
||||
ENDIF()
|
||||
|
||||
#### end var setup ###
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if LIBAVCODEC_VERSION_MAJOR < 56
|
||||
#define AV_CODEC_ID_NONE CODEC_ID_NONE
|
||||
#endif
|
||||
|
||||
namespace osgFFmpeg {
|
||||
|
||||
@@ -21,7 +24,54 @@ static int decode_audio(AVCodecContext *avctx, int16_t *samples,
|
||||
int *frame_size_ptr,
|
||||
const uint8_t *buf, int buf_size)
|
||||
{
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR==52 && LIBAVCODEC_VERSION_MINOR>=32)
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 56
|
||||
|
||||
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()
|
||||
// implementation to avoid warnings about deprecated function usage.
|
||||
@@ -77,6 +127,10 @@ void FFmpegDecoderAudio::open(AVStream * const stream)
|
||||
|
||||
m_frequency = m_context->sample_rate;
|
||||
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)
|
||||
{
|
||||
case AV_SAMPLE_FMT_NONE:
|
||||
@@ -100,7 +154,7 @@ void FFmpegDecoderAudio::open(AVStream * const stream)
|
||||
}
|
||||
|
||||
// Check stream sanity
|
||||
if (m_context->codec_id == CODEC_ID_NONE)
|
||||
if (m_context->codec_id == AV_CODEC_ID_NONE)
|
||||
throw std::runtime_error("invalid audio codec");;
|
||||
|
||||
// Find the decoder for the audio stream
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace osgFFmpeg {
|
||||
|
||||
// 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"
|
||||
|
||||
|
||||
|
||||
FFmpegDecoderVideo::FFmpegDecoderVideo(PacketQueue & packets, FFmpegClocks & clocks) :
|
||||
m_packets(packets),
|
||||
@@ -74,7 +74,11 @@ void FFmpegDecoderVideo::open(AVStream * const stream)
|
||||
m_alpha_channel = (m_context->pix_fmt == PIX_FMT_YUVA420P);
|
||||
|
||||
// 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);
|
||||
#endif
|
||||
|
||||
// Find the decoder for the video stream
|
||||
m_codec = avcodec_find_decoder(m_context->codec_id);
|
||||
|
||||
@@ -561,7 +561,11 @@ GifImageStream** obj)
|
||||
*width_ret = giffile->SWidth;
|
||||
*height_ret = giffile->SHeight;
|
||||
*numComponents_ret = 4;
|
||||
#if (GIFLIB_MAJOR >= 5&& !(GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0))
|
||||
DGifCloseFile(giffile, &Error);
|
||||
#else
|
||||
DGifCloseFile(giffile);
|
||||
#endif
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ using namespace lwosg;
|
||||
namespace
|
||||
{
|
||||
|
||||
#if 0
|
||||
bool triangle_is_clockwise(const osg::Vec3Array *points, int a, int b, int c)
|
||||
{
|
||||
const osg::Vec3 &A = (*points)[a];
|
||||
@@ -29,6 +30,7 @@ namespace
|
||||
area2 += C.x() * A.y() - A.x() * C.y();
|
||||
return area2 < 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
float cylindrical_angle(float x, float y)
|
||||
{
|
||||
|
||||
@@ -208,12 +208,12 @@ load_md2 (const char *filename, const osgDB::ReaderWriter::Options* options)
|
||||
// read in the frame info into a vector
|
||||
const char *last_frame_name = NULL;
|
||||
|
||||
osg::Vec3Array *vertexCoords = NULL;
|
||||
osg::Vec2Array *texCoords = NULL;
|
||||
osg::UIntArray *vertexIndices = NULL;
|
||||
osg::UIntArray *texIndices = NULL;
|
||||
osg::Vec3Array *normalCoords = NULL;
|
||||
osg::UIntArray *normalIndices = NULL;
|
||||
osg::ref_ptr<osg::Vec3Array> vertexCoords = NULL;
|
||||
osg::ref_ptr<osg::Vec2Array> texCoords = NULL;
|
||||
osg::ref_ptr<osg::UIntArray> vertexIndices = NULL;
|
||||
osg::ref_ptr<osg::UIntArray> texIndices = NULL;
|
||||
osg::ref_ptr<osg::Vec3Array> normalCoords = NULL;
|
||||
osg::ref_ptr<osg::UIntArray> normalIndices = NULL;
|
||||
|
||||
// load the texture skins
|
||||
|
||||
@@ -375,24 +375,24 @@ load_md2 (const char *filename, const osgDB::ReaderWriter::Options* options)
|
||||
}
|
||||
}
|
||||
|
||||
deprecated_osg::Geometry *geom = new deprecated_osg::Geometry;
|
||||
osg::ref_ptr<deprecated_osg::Geometry> geom = new deprecated_osg::Geometry;
|
||||
|
||||
geom->setVertexArray (vertexCoords);
|
||||
geom->setVertexIndices (vertexIndices);
|
||||
geom->setVertexArray (vertexCoords.get());
|
||||
geom->setVertexIndices (vertexIndices.get());
|
||||
|
||||
geom->setTexCoordArray (0, texCoords);
|
||||
geom->setTexCoordIndices (0, texIndices);
|
||||
geom->setTexCoordArray (0, texCoords.get());
|
||||
geom->setTexCoordIndices (0, texIndices.get());
|
||||
|
||||
geom->setNormalArray (normalCoords);
|
||||
geom->setNormalIndices (normalIndices);
|
||||
geom->setNormalArray (normalCoords.get());
|
||||
geom->setNormalIndices (normalIndices.get());
|
||||
geom->setNormalBinding (deprecated_osg::Geometry::BIND_PER_VERTEX);
|
||||
|
||||
geom->addPrimitiveSet (new osg::DrawArrays (osg::PrimitiveSet::TRIANGLES, 0, vertexIndices->size ()));
|
||||
|
||||
osg::Geode *geode = new osg::Geode;
|
||||
geode->addDrawable (geom);
|
||||
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
||||
geode->addDrawable (geom.get());
|
||||
|
||||
current_sequence->addChild (geode);
|
||||
current_sequence->addChild (geode.get());
|
||||
current_sequence->setTime (sequence_frame, 0.2f);
|
||||
sequence_frame++;
|
||||
|
||||
|
||||
@@ -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.
|
||||
osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options;
|
||||
local_opt->setDatabasePath(osgDB::getFilePath(fileName));
|
||||
local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName));
|
||||
|
||||
obj::Model model;
|
||||
model.setDatabasePath(osgDB::getFilePath(fileName.c_str()));
|
||||
@@ -875,7 +875,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterOBJ::readNode(const std::string& fil
|
||||
|
||||
ObjOptionsStruct localOptions = parseOptions(options);
|
||||
|
||||
osg::Node* node = convertModelToSceneGraph(model, localOptions, options);
|
||||
osg::Node* node = convertModelToSceneGraph(model, localOptions, local_opt.get());
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
@@ -134,11 +134,20 @@ public:
|
||||
|
||||
virtual ReadResult readFile(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
|
||||
{
|
||||
#if GDAL_VERSION_MAJOR<2
|
||||
if (OGRSFDriverRegistrar::GetRegistrar()->GetDriverCount() == 0)
|
||||
OGRRegisterAll();
|
||||
|
||||
// Try to open data source
|
||||
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)
|
||||
return 0;
|
||||
|
||||
@@ -156,6 +165,7 @@ public:
|
||||
|
||||
osg::Group* group = new osg::Group;
|
||||
|
||||
#if GDAL_VERSION_MAJOR<2
|
||||
for (int i = 0; i < file->GetLayerCount(); i++)
|
||||
{
|
||||
osg::Group* node = readLayer(file->GetLayer(i), file->GetName(), useRandomColorByFeature, addGroupPerFeature);
|
||||
@@ -163,6 +173,17 @@ public:
|
||||
group->addChild( node );
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
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} )
|
||||
LINK_DIRECTORIES(${CAIRO_LIBRARY_DIRS} ${POPPLER_LIBRARY_DIRS})
|
||||
SET(TARGET_EXTERNAL_LIBRARIES ${CAIRO_LIBRARIES} ${POPPLER_LIBRARIES} )
|
||||
|
||||
@@ -39,7 +39,11 @@ JoystickDevice::JoystickDevice()
|
||||
std::cout<<"number of joysticks "<<numJoysticks<<std::endl;
|
||||
for(int i=0; i<numJoysticks; ++i)
|
||||
{
|
||||
std::cout<<"Joystick name '"<<SDL_JoystickName(i)<<"'"<<std::endl;
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
std::cout << "Joystick name '" << SDL_JoystickNameForIndex(i) << "'" << std::endl;
|
||||
#else
|
||||
std::cout << "Joystick name '" << SDL_JoystickName(i) << "'" << std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -248,7 +248,7 @@ simage_tiff_error(char * buffer, int buflen)
|
||||
strncpy(buffer, "TIFF loader: Error opening file", buflen);
|
||||
break;
|
||||
case ERR_READ:
|
||||
strncpy(buffer, "TIFF loader: Error reding/decoding file", buflen);
|
||||
strncpy(buffer, "TIFF loader: Error reading/decoding file", buflen);
|
||||
break;
|
||||
case ERR_MEM:
|
||||
strncpy(buffer, "TIFF loader: Out of memory error", buflen);
|
||||
@@ -852,6 +852,9 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter
|
||||
else if (compressTypeOpt == "jpeg") {
|
||||
compressionType = COMPRESSION_JPEG;
|
||||
}
|
||||
else if (compressTypeOpt == "none") {
|
||||
compressionType = COMPRESSION_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -883,10 +886,12 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter
|
||||
case GL_DEPTH_COMPONENT:
|
||||
case GL_LUMINANCE:
|
||||
case GL_ALPHA:
|
||||
case GL_RED:
|
||||
photometric = PHOTOMETRIC_MINISBLACK;
|
||||
samplesPerPixel = 1;
|
||||
break;
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
case GL_RG:
|
||||
photometric = PHOTOMETRIC_MINISBLACK;
|
||||
samplesPerPixel = 2;
|
||||
break;
|
||||
@@ -903,16 +908,22 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter
|
||||
break;
|
||||
}
|
||||
|
||||
uint32 rowsperstrip = 0;
|
||||
|
||||
switch(img.getDataType()){
|
||||
case GL_FLOAT:
|
||||
TIFFSetField(image, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
|
||||
TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, 1);
|
||||
rowsperstrip = 1;
|
||||
bitsPerSample = 32;
|
||||
break;
|
||||
case GL_SHORT:
|
||||
TIFFSetField(image, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
|
||||
bitsPerSample = 16;
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
TIFFSetField(image, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
|
||||
bitsPerSample = 16;
|
||||
break;
|
||||
default:
|
||||
bitsPerSample = 8;
|
||||
break;
|
||||
@@ -926,9 +937,9 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter
|
||||
TIFFSetField(image, TIFFTAG_COMPRESSION, compressionType);
|
||||
TIFFSetField(image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
|
||||
TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
||||
|
||||
//uint32 rowsperstrip = TIFFDefaultStripSize(image, -1);
|
||||
//TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
|
||||
|
||||
if (rowsperstrip==0) rowsperstrip = TIFFDefaultStripSize(image, 0);
|
||||
TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
|
||||
|
||||
// Write the information to the file
|
||||
for(int i = 0; i < img.t(); ++i) {
|
||||
|
||||
@@ -870,7 +870,9 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, int
|
||||
osg::Group* tileGroup = archive->getTileContent(x,y,lod,realMinRange,realMaxRange,usedMaxRange,tileCenter, childrenLoc);
|
||||
|
||||
// if group has only one child, then simply use its child.
|
||||
while (tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup())
|
||||
// if the node is a transform, then stop processing so as to not loose the transformation
|
||||
while (tileGroup && !tileGroup->asTransform() &&
|
||||
tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup())
|
||||
{
|
||||
tileGroup = tileGroup->getChild(0)->asGroup();
|
||||
}
|
||||
@@ -882,7 +884,7 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, int
|
||||
doSeam = (lod < (archive->getNumLODs() - 1));
|
||||
|
||||
// Handle seams
|
||||
if (doSeam)
|
||||
if (tileGroup && doSeam)
|
||||
{
|
||||
SeamFinder sfv(x,y,lod,info,archive);
|
||||
tileGroup->accept(sfv);
|
||||
@@ -906,13 +908,15 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, con
|
||||
osg::Group* tileGroup = archive->getTileContent(loc,realMinRange,realMaxRange,usedMaxRange,tileCenter, childrenLoc);
|
||||
|
||||
// if group has only one child, then simply use its child.
|
||||
while (tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup())
|
||||
// if the node is a transform, then stop processing so as to not loose the transformation
|
||||
while (tileGroup && !tileGroup->asTransform() &&
|
||||
tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup())
|
||||
{
|
||||
tileGroup = tileGroup->getChild(0)->asGroup();
|
||||
}
|
||||
|
||||
// Handle seams
|
||||
if (childrenLoc.size() > 0)
|
||||
if (tileGroup && childrenLoc.size() > 0)
|
||||
{
|
||||
SeamFinder sfv(loc.x, loc.y, loc.lod, info, archive);
|
||||
tileGroup->accept(sfv);
|
||||
|
||||
@@ -641,7 +641,7 @@ ZipArchive::getDataNoLock() const
|
||||
{
|
||||
data._zipHandle = OpenZip( _filename.c_str(), _password.c_str() );
|
||||
}
|
||||
else if ( _membuffer.empty() )
|
||||
else if ( !_membuffer.empty() )
|
||||
{
|
||||
data._zipHandle = OpenZip( (void*)_membuffer.c_str(), _membuffer.length(), _password.c_str() );
|
||||
}
|
||||
|
||||
@@ -221,6 +221,11 @@ void GlyphTexture::apply(osg::State& state) const
|
||||
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,
|
||||
@@ -367,6 +372,12 @@ void GlyphTexture::apply(osg::State& state) const
|
||||
// clear the list since we have now subloaded them.
|
||||
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
|
||||
glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0,
|
||||
getTextureWidth(),
|
||||
|
||||
@@ -369,12 +369,11 @@ void Text3D::computeGlyphRepresentation()
|
||||
++itr;
|
||||
}
|
||||
|
||||
if (itr!=_text.end())
|
||||
{
|
||||
// skip over spaces and return.
|
||||
while (*itr==' ') ++itr;
|
||||
if (*itr=='\n') ++itr;
|
||||
}
|
||||
// skip over spaces
|
||||
while ((itr!=_text.end()) && (*itr==' ')) ++itr;
|
||||
|
||||
// skip over return
|
||||
if ((itr!=_text.end()) && (*itr=='\n')) ++itr;
|
||||
|
||||
// move to new line.
|
||||
switch(_layout)
|
||||
|
||||
@@ -105,12 +105,17 @@ void TextBase::setFont(const std::string& fontfile)
|
||||
|
||||
void TextBase::setFontResolution(unsigned int width, unsigned int height)
|
||||
{
|
||||
_fontSize = FontResolution(width,height);
|
||||
FontResolution size(width,height);
|
||||
if (_fontSize==size) return;
|
||||
|
||||
_fontSize = size;
|
||||
computeGlyphRepresentation();
|
||||
}
|
||||
|
||||
void TextBase::setCharacterSize(float height)
|
||||
{
|
||||
if (_characterHeight==height) return;
|
||||
|
||||
_characterHeight = height;
|
||||
computeGlyphRepresentation();
|
||||
}
|
||||
@@ -126,18 +131,24 @@ void TextBase::setCharacterSize(float height, float aspectRatio)
|
||||
|
||||
void TextBase::setMaximumWidth(float maximumWidth)
|
||||
{
|
||||
if (_maximumWidth==maximumWidth) return;
|
||||
|
||||
_maximumWidth = maximumWidth;
|
||||
computeGlyphRepresentation();
|
||||
}
|
||||
|
||||
void TextBase::setMaximumHeight(float maximumHeight)
|
||||
{
|
||||
if (_maximumHeight==maximumHeight) return;
|
||||
|
||||
_maximumHeight = maximumHeight;
|
||||
computeGlyphRepresentation();
|
||||
}
|
||||
|
||||
void TextBase::setLineSpacing(float lineSpacing)
|
||||
{
|
||||
if (_lineSpacing==lineSpacing) return;
|
||||
|
||||
_lineSpacing = lineSpacing;
|
||||
computeGlyphRepresentation();
|
||||
}
|
||||
|
||||
@@ -1361,19 +1361,41 @@ void CullVisitor::apply(osg::ClearNode& node)
|
||||
namespace osgUtil
|
||||
{
|
||||
|
||||
class RenderStageCache : public osg::Object
|
||||
class RenderStageCache : public osg::Object, public osg::Observer
|
||||
{
|
||||
public:
|
||||
|
||||
RenderStageCache() {}
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
_renderStageMap[cv] = rs;
|
||||
cv->addObserver(this);
|
||||
}
|
||||
|
||||
RenderStage* getRenderStage(osgUtil::CullVisitor* cv)
|
||||
|
||||
@@ -60,7 +60,6 @@ struct GeometryArrayGatherer
|
||||
typedef std::vector<osg::Array*> ArrayList;
|
||||
|
||||
GeometryArrayGatherer(osg::Geometry& geometry)
|
||||
: _useDrawElements(true)
|
||||
{
|
||||
add(geometry.getVertexArray());
|
||||
add(geometry.getNormalArray());
|
||||
@@ -97,9 +96,6 @@ struct GeometryArrayGatherer
|
||||
}
|
||||
|
||||
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
|
||||
@@ -979,7 +975,7 @@ struct CacheRecorder : public TriangleIndexFunctor<CacheRecordOperator>
|
||||
void VertexCacheMissVisitor::doGeometry(Geometry& geom)
|
||||
{
|
||||
Array* vertArray = geom.getVertexArray();
|
||||
if (!vertArray)
|
||||
if (!vertArray || vertArray->getNumElements()==0)
|
||||
return;
|
||||
Geometry::PrimitiveSetList& primSets = geom.getPrimitiveSetList();
|
||||
CacheRecorder recorder(_cacheSize);
|
||||
@@ -1121,12 +1117,9 @@ inline void reorderDrawElements(DE& drawElements,
|
||||
void VertexAccessOrderVisitor::optimizeOrder(Geometry& geom)
|
||||
{
|
||||
Array* vertArray = geom.getVertexArray();
|
||||
if (!vertArray)
|
||||
if (!vertArray || vertArray->getNumElements()==0)
|
||||
return;
|
||||
Geometry::PrimitiveSetList& primSets = geom.getPrimitiveSetList();
|
||||
GeometryArrayGatherer gatherer(geom);
|
||||
if (!gatherer._useDrawElements)
|
||||
return;
|
||||
VertexReorder vr(vertArray->getNumElements());
|
||||
for (Geometry::PrimitiveSetList::iterator itr = primSets.begin(),
|
||||
end = primSets.end();
|
||||
@@ -1144,6 +1137,7 @@ void VertexAccessOrderVisitor::optimizeOrder(Geometry& geom)
|
||||
|
||||
// duplicate shared arrays as it isn't safe to rearrange vertices when arrays are shared.
|
||||
if (geom.containsSharedArrays()) geom.duplicateSharedArrays();
|
||||
GeometryArrayGatherer gatherer(geom);
|
||||
|
||||
Remapper remapper(vr.remap);
|
||||
gatherer.accept(remapper);
|
||||
|
||||
@@ -1099,7 +1099,7 @@ bool CollectLowestTransformsVisitor::removeTransforms(osg::Node* nodeWeCannotRem
|
||||
titr!=_transformMap.end();
|
||||
++titr)
|
||||
{
|
||||
if (titr->second._canBeApplied)
|
||||
if (titr->first!=0 && titr->second._canBeApplied)
|
||||
{
|
||||
if (titr->first!=nodeWeCannotRemove)
|
||||
{
|
||||
|
||||
@@ -989,8 +989,10 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b
|
||||
// framebuffer is multisampled then the dimension arguments are ignored
|
||||
// and the whole framebuffer is always copied.
|
||||
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()),
|
||||
static_cast<GLint>(_viewport->x()), static_cast<GLint>(_viewport->y()),
|
||||
static_cast<GLint>(_viewport->x() + _viewport->width()), static_cast<GLint>(_viewport->y() + _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);
|
||||
}
|
||||
|
||||
@@ -1008,8 +1010,10 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT + (attachment - osg::Camera::COLOR_BUFFER0));
|
||||
|
||||
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()),
|
||||
static_cast<GLint>(_viewport->x()), static_cast<GLint>(_viewport->y()),
|
||||
static_cast<GLint>(_viewport->x() + _viewport->width()), static_cast<GLint>(_viewport->y() + _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);
|
||||
}
|
||||
}
|
||||
@@ -1513,14 +1517,14 @@ void RenderStage::clearReferencesToDependentCameras()
|
||||
itr != _preRenderList.end();
|
||||
++itr)
|
||||
{
|
||||
itr->second->collateReferencesToDependentCameras();
|
||||
itr->second->clearReferencesToDependentCameras();
|
||||
}
|
||||
|
||||
for(RenderStageList::iterator itr = _postRenderList.begin();
|
||||
itr != _postRenderList.end();
|
||||
++itr)
|
||||
{
|
||||
itr->second->collateReferencesToDependentCameras();
|
||||
itr->second->clearReferencesToDependentCameras();
|
||||
}
|
||||
|
||||
_dependentCameras.clear();
|
||||
|
||||
@@ -362,7 +362,7 @@ void CompositeViewer::setReferenceTime(double time)
|
||||
{
|
||||
osg::Timer_t tick = osg::Timer::instance()->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);
|
||||
else tick -= osg::Timer_t(-delta_ticks);
|
||||
|
||||
|
||||
@@ -962,11 +962,14 @@ bool GraphicsWindowX11::createWindow()
|
||||
XFlush( _display );
|
||||
XSync( _display, 0 );
|
||||
|
||||
// now update the window dimensions to account for any size changes made by the window manager,
|
||||
XGetWindowAttributes( _display, _window, &watt );
|
||||
|
||||
if (_traits->x != watt.x || _traits->y != watt.y
|
||||
||_traits->width != watt.width || _traits->height != watt.height)
|
||||
// get window geometry relative to root window/screen
|
||||
Window child_return;
|
||||
int windowX, windowY;
|
||||
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 (doFullSceenWorkAround)
|
||||
@@ -978,9 +981,10 @@ bool GraphicsWindowX11::createWindow()
|
||||
XSync(_display, 0);
|
||||
|
||||
XGetWindowAttributes( _display, _window, &watt );
|
||||
XTranslateCoordinates( _display, _window, watt.root, watt.x, watt.y, &windowX, &windowY, &child_return);
|
||||
}
|
||||
|
||||
resized( watt.x, watt.y, watt.width, watt.height );
|
||||
resized( windowX, windowY, watt.width, watt.height );
|
||||
}
|
||||
|
||||
//OSG_NOTICE<<"After sync apply.x = "<<watt.x<<" watt.y="<<watt.y<<" width="<<watt.width<<" height="<<watt.height<<std::endl;
|
||||
@@ -1229,10 +1233,10 @@ bool GraphicsWindowX11::checkEvents()
|
||||
{
|
||||
case ClientMessage:
|
||||
{
|
||||
OSG_NOTICE<<"ClientMessage event received"<<std::endl;
|
||||
OSG_INFO<<"ClientMessage event received"<<std::endl;
|
||||
if (static_cast<Atom>(ev.xclient.data.l[0]) == _deleteWindow)
|
||||
{
|
||||
OSG_NOTICE<<"DeleteWindow event received"<<std::endl;
|
||||
OSG_INFO<<"DeleteWindow event received"<<std::endl;
|
||||
// FIXME only do if _ownsWindow ?
|
||||
getEventQueue()->closeWindow(eventTime);
|
||||
}
|
||||
@@ -1252,15 +1256,13 @@ bool GraphicsWindowX11::checkEvents()
|
||||
break;
|
||||
|
||||
case DestroyNotify :
|
||||
OSG_NOTICE<<"DestroyNotify event received"<<std::endl;
|
||||
OSG_INFO<<"DestroyNotify event received"<<std::endl;
|
||||
_realized = false;
|
||||
_valid = false;
|
||||
break;
|
||||
|
||||
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 ||
|
||||
windowY != ev.xconfigure.y ||
|
||||
windowWidth != ev.xconfigure.width ||
|
||||
@@ -1285,8 +1287,6 @@ bool GraphicsWindowX11::checkEvents()
|
||||
XGetWindowAttributes(display, _window, &watt );
|
||||
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)
|
||||
{
|
||||
resizeTime = eventTime;
|
||||
@@ -1543,19 +1543,30 @@ bool GraphicsWindowX11::checkEvents()
|
||||
}
|
||||
|
||||
default:
|
||||
OSG_NOTICE<<"Other event "<<ev.type<<std::endl;
|
||||
OSG_INFO<<"Other event "<<ev.type<<std::endl;
|
||||
break;
|
||||
|
||||
}
|
||||
_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
|
||||
if (windowX != _traits->x ||
|
||||
windowY != _traits->y ||
|
||||
windowWidth != _traits->width ||
|
||||
windowHeight != _traits->height)
|
||||
{
|
||||
|
||||
resized(windowX, windowY, windowWidth, windowHeight);
|
||||
getEventQueue()->windowResize(windowX, windowY, windowWidth, windowHeight, resizeTime);
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ bool PixelBufferCocoa::realizeImplementation()
|
||||
_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];
|
||||
|
||||
[_context setPixelBuffer: pbuffer cubeMapFace: _traits->face mipMapLevel:_traits->level currentVirtualScreen: nil];
|
||||
[_context setPixelBuffer: pbuffer cubeMapFace: _traits->face mipMapLevel:_traits->level currentVirtualScreen: 0];
|
||||
|
||||
[pool release];
|
||||
|
||||
|
||||
@@ -326,6 +326,7 @@ void StatsHandler::setUpHUDCamera(osgViewer::ViewerBase* viewer)
|
||||
|
||||
// only clear the depth buffer
|
||||
_camera->setClearMask(0);
|
||||
_camera->setAllowEventFocus(false);
|
||||
|
||||
_camera->setRenderer(new Renderer(_camera.get()));
|
||||
|
||||
|
||||
@@ -435,7 +435,7 @@ void Viewer::setReferenceTime(double time)
|
||||
{
|
||||
osg::Timer_t tick = osg::Timer::instance()->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);
|
||||
else tick -= osg::Timer_t(-delta_ticks);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ void CompositeProperty::clear()
|
||||
//
|
||||
// SwitchProperty
|
||||
//
|
||||
SwitchProperty::SwitchProperty()
|
||||
SwitchProperty::SwitchProperty():_activeProperty(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ char volume_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@@ -61,19 +61,17 @@ char volume_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" const float min_iterations = 2.0;\n"
|
||||
" const float max_iterations = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" if (num_iterations<min_iterations) num_iterations = min_iterations;\n"
|
||||
" else if (num_iterations>max_iterations) num_iterations = max_iterations;\n"
|
||||
" else if (num_iterations!=num_iterations) num_iterations = max_iterations;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/(num_iterations-1.0);\n"
|
||||
" vec3 texcoord = t0.xyz;\n"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" {\n"
|
||||
" vec4 color = texture3D( baseTexture, texcoord);\n"
|
||||
@@ -88,7 +86,7 @@ char volume_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
" texcoord += deltaTexCoord;\n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
@@ -99,7 +97,6 @@ char volume_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" fragColor *= baseColor;\n"
|
||||
"\n"
|
||||
" if (fragColor.w<AlphaFuncValue) discard;\n"
|
||||
" \n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
||||
@@ -10,7 +10,7 @@ char volume_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@@ -62,16 +62,14 @@ char volume_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" const float min_iterations = 2.0;\n"
|
||||
" const float max_iterations = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" if (num_iterations<min_iterations) num_iterations = min_iterations;\n"
|
||||
" else if (num_iterations>max_iterations) num_iterations = max_iterations;\n"
|
||||
" else if (num_iterations!=num_iterations) num_iterations = max_iterations;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(t0-te).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(t0-te).xyz/(num_iterations-1.0);\n"
|
||||
" vec3 texcoord = te.xyz;\n"
|
||||
"\n"
|
||||
" vec4 previousColor = texture3D( baseTexture, texcoord);\n"
|
||||
|
||||
@@ -10,7 +10,7 @@ char volume_lit_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@@ -62,16 +62,14 @@ char volume_lit_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" const float min_iterations = 2.0;\n"
|
||||
" const float max_iterations = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<min_iterations) num_iterations = min_iterations;\n"
|
||||
" else if (num_iterations>max_iterations) num_iterations = max_iterations;\n"
|
||||
" else if (num_iterations!=num_iterations) num_iterations = max_iterations;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/(num_iterations-1.0);\n"
|
||||
" vec3 texcoord = t0.xyz;\n"
|
||||
"\n"
|
||||
" float normalSampleDistance = 1.0/512.0;\n"
|
||||
@@ -115,18 +113,17 @@ char volume_lit_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
" texcoord += deltaTexCoord;\n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" fragColor.w *= TransparencyValue;\n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0;\n"
|
||||
"\n"
|
||||
" fragColor *= baseColor;\n"
|
||||
"\n"
|
||||
" if (fragColor.w<AlphaFuncValue) discard;\n"
|
||||
" \n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
||||
@@ -15,7 +15,7 @@ char volume_lit_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@@ -69,16 +69,14 @@ char volume_lit_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"\n"
|
||||
" vec3 eyeDirection = normalize((te-t0).xyz);\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" const float min_iterations = 2.0;\n"
|
||||
" const float max_iterations = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" if (num_iterations<min_iterations) num_iterations = min_iterations;\n"
|
||||
" else if (num_iterations>max_iterations) num_iterations = max_iterations;\n"
|
||||
" else if (num_iterations!=num_iterations) num_iterations = max_iterations;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/(num_iterations-1.0);\n"
|
||||
" vec3 texcoord = t0.xyz;\n"
|
||||
"\n"
|
||||
" float normalSampleDistance = 1.0/512.0;\n"
|
||||
@@ -112,7 +110,6 @@ char volume_lit_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" color.z *= lightScale;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
"\n"
|
||||
" float r = color[3]*TransparencyValue;\n"
|
||||
" if (r>AlphaFuncValue)\n"
|
||||
" {\n"
|
||||
@@ -124,7 +121,7 @@ char volume_lit_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
" texcoord += deltaTexCoord;\n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
|
||||
@@ -9,7 +9,7 @@ char volume_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@@ -61,19 +61,17 @@ char volume_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" const float min_iterations = 2.0;\n"
|
||||
" const float max_iterations = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" if (num_iterations<min_iterations) num_iterations = min_iterations;\n"
|
||||
" else if (num_iterations>max_iterations) num_iterations = max_iterations;\n"
|
||||
" else if (num_iterations!=num_iterations) num_iterations = max_iterations;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/(num_iterations-1.0);\n"
|
||||
" vec3 texcoord = t0.xyz;\n"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" {\n"
|
||||
" vec4 color = texture3D( baseTexture, texcoord);\n"
|
||||
@@ -81,18 +79,17 @@ char volume_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
" texcoord += deltaTexCoord;\n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" fragColor.w *= TransparencyValue;\n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0; \n"
|
||||
" if (fragColor.w>1.0) fragColor.w = 1.0;\n"
|
||||
"\n"
|
||||
" fragColor *= baseColor;\n"
|
||||
"\n"
|
||||
" if (fragColor.w<AlphaFuncValue) discard;\n"
|
||||
" \n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
||||
@@ -14,7 +14,7 @@ char volume_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@@ -66,19 +66,17 @@ char volume_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" const float min_iterations = 2.0;\n"
|
||||
" const float max_iterations = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" if (num_iterations<min_iterations) num_iterations = min_iterations;\n"
|
||||
" else if (num_iterations>max_iterations) num_iterations = max_iterations;\n"
|
||||
" else if (num_iterations!=num_iterations) num_iterations = max_iterations;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/(num_iterations-1.0);\n"
|
||||
" vec3 texcoord = t0.xyz;\n"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" {\n"
|
||||
" float v = texture3D( baseTexture, texcoord).a * tfScale + tfOffset;\n"
|
||||
@@ -95,7 +93,7 @@ char volume_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
" texcoord += deltaTexCoord;\n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
@@ -106,7 +104,6 @@ char volume_tf_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" fragColor *= baseColor;\n"
|
||||
"\n"
|
||||
" if (fragColor.w<AlphaFuncValue) discard;\n"
|
||||
" \n"
|
||||
" gl_FragColor = fragColor;\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
||||
@@ -15,7 +15,7 @@ char volume_tf_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
@@ -67,14 +67,13 @@ char volume_tf_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" const float min_iterations = 2.0;\n"
|
||||
" const float max_iterations = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" if (num_iterations<min_iterations) num_iterations = min_iterations;\n"
|
||||
" else if (num_iterations>max_iterations) num_iterations = max_iterations;\n"
|
||||
" else if (num_iterations!=num_iterations) num_iterations = max_iterations;\n"
|
||||
"\n"
|
||||
" if (num_iterations>max_iteratrions)\n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(t0-te).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 texcoord = te.xyz;\n"
|
||||
@@ -84,7 +83,7 @@ char volume_tf_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" vec3 deltaX = vec3(normalSampleDistance, 0.0, 0.0);\n"
|
||||
" vec3 deltaY = vec3(0.0, normalSampleDistance, 0.0);\n"
|
||||
" vec3 deltaZ = vec3(0.0, 0.0, normalSampleDistance);\n"
|
||||
"\n"
|
||||
" \n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" {\n"
|
||||
"\n"
|
||||
@@ -134,6 +133,5 @@ char volume_tf_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"\n"
|
||||
" // we didn't find an intersection so just discard fragment\n"
|
||||
" discard;\n"
|
||||
"\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
||||
@@ -14,9 +14,9 @@ char volume_tf_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
"varying vec4 baseColor;\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
"{ \n"
|
||||
" vec3 t0 = (texgen * vertexPos).xyz;\n"
|
||||
" vec3 te = (texgen * cameraPos).xyz;\n"
|
||||
"{\n"
|
||||
" vec4 t0 = vertexPos;\n"
|
||||
" vec4 te = cameraPos;\n"
|
||||
"\n"
|
||||
" if (te.x>=0.0 && te.x<=1.0 &&\n"
|
||||
" te.y>=0.0 && te.y<=1.0 &&\n"
|
||||
@@ -63,19 +63,20 @@ char volume_tf_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" const float max_iteratrions = 2048.0;\n"
|
||||
" float num_iterations = ceil(length(te-t0)/SampleDensityValue);\n"
|
||||
" if (num_iterations<2.0) num_iterations = 2.0;\n"
|
||||
" \n"
|
||||
" if (num_iterations>max_iteratrions) \n"
|
||||
" {\n"
|
||||
" num_iterations = max_iteratrions;\n"
|
||||
" }\n"
|
||||
" t0 = t0 * texgen;\n"
|
||||
" te = te * texgen;\n"
|
||||
"\n"
|
||||
" vec3 deltaTexCoord=(te-t0)/float(num_iterations-1.0);\n"
|
||||
" vec3 texcoord = t0;\n"
|
||||
" const float min_iterations = 2.0;\n"
|
||||
" const float max_iterations = 2048.0;\n"
|
||||
" float num_iterations = ceil(length((te-t0).xyz)/SampleDensityValue);\n"
|
||||
" if (num_iterations<min_iterations) num_iterations = min_iterations;\n"
|
||||
" else if (num_iterations>max_iterations) num_iterations = max_iterations;\n"
|
||||
" else if (num_iterations!=num_iterations) num_iterations = max_iterations;\n"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0); \n"
|
||||
" vec3 deltaTexCoord=(te-t0).xyz/float(num_iterations-1.0);\n"
|
||||
" vec3 texcoord = t0.xyz;\n"
|
||||
"\n"
|
||||
" vec4 fragColor = vec4(0.0, 0.0, 0.0, 0.0);\n"
|
||||
" while(num_iterations>0.0)\n"
|
||||
" {\n"
|
||||
" float v = texture3D( baseTexture, texcoord).s * tfScale + tfOffset;\n"
|
||||
@@ -84,7 +85,7 @@ char volume_tf_mip_frag[] = "uniform sampler3D baseTexture;\n"
|
||||
" {\n"
|
||||
" fragColor = color;\n"
|
||||
" }\n"
|
||||
" texcoord += deltaTexCoord; \n"
|
||||
" texcoord += deltaTexCoord;\n"
|
||||
"\n"
|
||||
" --num_iterations;\n"
|
||||
" }\n"
|
||||
|
||||
@@ -123,6 +123,8 @@ bool ProxyNode_readLocalData(Object& obj, Input& fr)
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
bool make_options = (fr.getOptions() == NULL);
|
||||
if (make_options) fr.setOptions(new osgDB::Options()); //need valid options
|
||||
unsigned int i;
|
||||
for(i=0; i<num_children; i++)
|
||||
{
|
||||
@@ -154,7 +156,7 @@ bool ProxyNode_readLocalData(Object& obj, Input& fr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (make_options) fr.setOptions(NULL);
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_VolumeTechnique,
|
||||
new osgVolume::VolumeTechnique,
|
||||
osgVolume::VolumeTechnique,
|
||||
"osg::Object osgVolume::VolumeTechniquee" )
|
||||
"osg::Object osgVolume::VolumeTechnique" )
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user