Compare commits

..

2 Commits

Author SHA1 Message Date
Robert Osfield
27c7db56de Fixed version number in packaging 2008-04-26 11:19:19 +00:00
Robert Osfield
d61306fa72 Release OpenSceneGraph-2.4.0 2008-04-25 13:13:14 +00:00
1430 changed files with 40846 additions and 149785 deletions

View File

@@ -1,224 +1,183 @@
OpenSceneGraph Library 2.8.2
OpenSceneGraph Library 2.4.0
373 Contributors:
307 Contributors:
Firstname Surname
-----------------
Robert Osfield
Don Burns
Marco Jez
Paul Martz
Mike Weiblen
Mathias Fr<46>hlich
Paul Martz
Eric Wing
Stephan Huber
Brede Johansen
Geoff Michel
Stephan Huber
Farshid Lashkari
Bob Kuehne
Ulrich Hertlein
Eric Sokolowsky
Jean-Sebastien Guay
Martin Lavery
David Callu
Eric Sokolowsky
Mathias Fr<46>hlich
Tree
David Callu
Luigi Calori
Trajce Nikolov
Mike Wittman
Wojciech Lewandowski
Paul Melis
Colin McDonald
Jean-Sebastien Guay
Pavel Moloshtan
Tom Jolley
Andy Skinner
Roger James
Pavel Moloshtan
Mattias Helsing
Tom Jolley
Jeremy Moles
Jason Beverage
Norman Vine
Cedric Pinson
Art Tevs
Colin McDonald
Alberto Farre
Roland Smeenk
Michael Platings
Andr<EFBFBD> Garneau
Ruben Lopez
Randall Hopper
Jason Daly
J.P. Delport
Adrian Egli
Wojciech Lewandowski
Olaf Flebbe
Mathieu Marache
Gideon May
Don Tidrow
Sherman Wilcox
Romano Jos<6F> Magacho da Silva
Per Fahlberg
Michael Gronager
Joakim Simonsson
David Spilling
Daniel Sj<53>lie
Chris Hanson
Alberto Luaces
Philip Lowman
Chris Denham
Melchior Franz
Lionel Lagarde
David Fries
Bryan Thrall
Terry Welsh
Serge Lages
Per Fahlberg
Jeremy Moles
J.P. Delport
David Spilling
Art Tevs
Sherman Wilcox
Joran Jessurun
Jason Beverage
Paul Melis
Jason Daly
Frederic Marmond
David Fries
Boris Bralo
Yefei He
Tim Moore
Stephane Lamoliatte
Sondra Iverson
Serge Lages
Rune Schmidt Jensen
Rainer Oder
Neil Groves
Mike Connell
Martin Aumueller
Mario Valle
Gordon Tomlinson
Gino van den Bergen
Melchior Franz
Joakim Simonsson
Carlo Camporesi
Ben Discoe
Andreas Ekstrand
Thibault Genessay
Sukender
Adrian Egli
Sasa Bistrovic
Martin Naylor
Martin Aumueller
Markus Trenkwalder
Loic Dachary
Joseph Steel
John Shue
Jan Peciva
Jan Ciger
Glenn Waldron
Gordon Tomlinson
Bryan Thrall
Brad Colbert
Vivek Rajan
Sean Spicer
Ravi Mathur
Peter Hrenka
Nikolaus Hanekamp
Neil Salter
Mihai Radu
Michael Platings
Michael Hartman
Luc Frauciel
Laurens Voerman
David Guthrie
Corbin Holtz
Brad Christiansen
Blasius Czink
Toshiyuki Takahei
Thom DeCarlo
Tatsuhiro Nishioka
Terry Welsh
Stephane Lamoliatte
Simon Julier
Sebastien Grignard
Romano Magacho
Richard Schmidt
Riccardo Corsi
Ralf Habacker
Philip Lowman
Paul de Repentigny
Liang Aibin
Luc Frauciel
Leandro Motta Barros
John Vidar Larring
John Kelso
Glenn Waldron
Daniel Larimer
Csaba Halasz
Colin Dunlop
Cedric Pinson
Bruce Clay
Alberto Luaces
Alberto Barbati
Vladimir Shabanov
Uwe Woessner
Tony Horrobin
Tim Moore
Thibault Genessay
Sohey Yamamoto
Rudolf Wiedemann
Roland Smeenk
Richard Schmidt
Rafa Gaitan
Phil Atkin
Miguel Escriva
Peter Hrenka
Neil Hughes
Mattias Linde
Mattias Helsing
Mathieu Marache
Maria Ten
Ken Sewell
Julian Ortiz
Jeremy Bell
Jaromir Vitek
James French
Gary Quinn
Garrett Potts
Gabor Dorka
Fabio Mierlo
Fabien Lavignotte
Doug McCorkle
Donn Mielcarek
Donald Cipperly
Domenico Mangieri
Charles Cole
Blake Williams
Antoine Hue
Andrew Bettison
Andreas Goebel
Anders Backman
Ali Botorabi
Zach Deedler
Yuzhong Shen
Wang Rui
Tugkan Calapoglu
Tim Daoust
Terrex
Tanguy Fautr<74>
Sylvain Marie
Steve Lunsford
Stephane Simon
Stephan Eilemann
Stanislav Blinov
Sergey Leontyev
Sebastian Messerschmidt
Rene Molenaar
Riccardo Corsi
Ralf Kern
Pierre Haritchabalet
Perry Miller
Paul Obermeier
Neil Hughes
Nathan Monteleone
Morn<EFBFBD> Pistorius
Michael Henheffer
Michael Guerrero
Maya Leonard
Max Bandazian
Max Behensky
Mathew May
Martin Spott
Martijn Kragtwijk
Konstantin Sinitsyn
Kevin Moiule
Keith Steffen
Katharina Plugge
Joseph Winston
John Aughey
Johan Nouvel
Jim Vaughan
James Moliere
Igor Kravtchenko
He Sicong
Gustavo Wagner
Guillaume Chouvenc
Gino van den Bergen
Gerrick Bivins
George Tarantilis
Frederic Bouvier
Ferdi Smit
Ewe Woessner
Erik den Dekker
Emmanuel Roche
Garret Potts
Fabio Mierlo
Edgar Ellis
Don Leich
Donald Cipperly
David Ergo
Daniel Trstenjak
Christophe Loustaunau
Brad Anderegg
Csaba Halasz
Andrew Sampson
Andrew Lorino
Andreas Goebel
Zbigniew Sroczynski
Yuri Vilmanis
Warren Macchi
@@ -228,51 +187,40 @@ Volker Walkiewicz
Vladimir Vukicevic
Vlad Danciu
Vincent Vivanloc
Vincent Bourdier
Vasily Radostev
Vaclav Bilek
Tyge
Troy Yee
Tomas Hnilica
Tino Schwarze
Thomas Weidner
Thom Carlo
Steven Thomas
Simon Hammett
Tery Welsh
Tatsuhiro Nishioka
Tanguy Fautr<74>
Sid Byce
Shuxing Xiao
Shane Arnott
Sebastien Kuntz
Ruth Lang
Ruben Smelik
Ross Anderson
Sebastian Messerschimdt
Rudolf Wiedemann
Ronny Krueger
Robert Swain
Rob Bloemkool
Rick Pingry
Rick Appleton
Ricard Schmidt
Rene Molenaar
Reinhard Sainitzer
Rein Kadijk
Raymond de Vries
Ragnar Hammarqvist
Qing Shen
Piotr Rak
Philipp Siemoleit
Philipp M<>chler
Petr Salinger
Paul Palumbo
Paul Obermeier
Paul Fredrikson
Paul Fotheringham
Patrick Hartling
Parag Chaudhur
Panagiotis Papadakos
Panagiotis Koutsourakis
Orhun Birsoy
Ole-Morten Duesund
Nicolas Brodu
Nathan Cournia
Morten Haukness
Morn<EFBFBD> Pistorius
Mirko Viviani
Mikkel Gjøl
Mike Garrity
@@ -280,94 +228,81 @@ Michael Polak
Michael Morrison
Michael Logan
Max Rhiener
Max Behensky
Mauricio Hofmam
Matthew May
Matt Green
Matt Burke
Mathia Walker
Mason Menninger
Martins Innus
Martin Spott
Martin Amueller
Mario Valle
Mario Guimaraes
Marin Lavery
Marco Lehmann
Marcin Prus
Maciej Krol
Lukas Diduch
Louis Hamilton
Lilin Xiong
Lewis Harmon
Lars Nilson
Kyle Centers
Kristopher Bixler
Karsten Weiss
Karl Heijdenberg
Jutta Sauer
Julian Scheid
Josh Portway
John Tan
John Grant
John Donovan
John Davis
John Argentieri
Joan Abadie
Jeroen den Dekker
Jean-Christophe Lombardo
Jay Zuckerman
Jason Howlett
Jason Ballenger
J.E. Hoffmann
Humar Carmona
Henrique Bucher
He Sicong
Hautio Jari
Guillaume Millet
Graeme Harkness
Glen Waldron
Gian Lorenzetto
George Papagiannakis
Gary Quinn
Galen Faidley
Frederic Bouvier
Frashid Lashkari
Frank Warmerdam
Frank Midgley
Frank Lindeman
Frank Lichtenheld
Ferdinand Cornelissen
Fajran Iman
Fabien Dachicourt
Emmanuel Roche
Edmond Gheury
Ed Ralston
Duvan Cope
Duncan Cavens
Drew Whitehouse
Douglas A. Pouk
Doug McCorkle
Dean Iverson
David Jung
David Gurhrie
Danny Valente
Daniel Stien
Dan Minor
Cyril Brulebois
Cory Riddell
Clay Fowler
Chuck Sembroski
Chuck Seberion
Christopher Blaesius
Christian Kaser
Chris McGlone
Carlos Garcea
Bruno Herbelin
Brian Keener
Brandon Hamm
Brad Anderegg
Bora Utka
Bj<EFBFBD>rn Hein
Bill Prendergast
Blasius Czink
Benoit Laniel
Ben van Basten
Bart Gallet
Axel Volley
Andy Preece
Andrew Reyonolds
Andreas Jochens
Andre Normann
Almalric Alexandre
Allen Bierbaum
Alexandre Amalric
@@ -375,5 +310,4 @@ Alberto Jaspe
Alan Purvis
Alan Ott
Alan Harris
Alan Dickinson
Adam Richard

View File

@@ -1,41 +1,23 @@
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
IF(WIN32)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6 FATAL_ERROR)
ELSE(WIN32)
IF(APPLE)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6 FATAL_ERROR)
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
MESSAGE("Warning: A critical CMake bug exists in 2.4.6 and below. Trying to build Universal Binaries will result in a compile error that seems unrelated. Either avoid building Universal Binaries by changing the CMAKE_OSX_ARCHITECTURES field to list only your architecture, or upgrade to the current CVS version of CMake or a newer stable version if it exists.")
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
ELSE(APPLE)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0 FATAL_ERROR)
ENDIF(APPLE)
ENDIF(WIN32)
if(COMMAND cmake_policy)
# Works around warnings libraries linked against that don't
# have absolute paths (e.g. -lpthreads)
cmake_policy(SET CMP0003 NEW)
# Works around warnings about escaped quotes in ADD_DEFINITIONS
# statements.
cmake_policy(SET CMP0005 NEW)
# 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)
cmake_policy(SET CMP0008 OLD)
endif(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
endif(COMMAND cmake_policy)
PROJECT(OpenSceneGraph)
SET(OPENSCENEGRAPH_MAJOR_VERSION 2)
SET(OPENSCENEGRAPH_MINOR_VERSION 8)
SET(OPENSCENEGRAPH_PATCH_VERSION 2)
SET(OPENSCENEGRAPH_SOVERSION 55)
# set to 0 when not a release candidate, non zero means that any generated
# svn tags will be treated as release candidates of given number
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 0)
SET(OPENSCENEGRAPH_MINOR_VERSION 4)
SET(OPENSCENEGRAPH_PATCH_VERSION 0)
SET(OPENSCENEGRAPH_SOVERSION 35)
SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
@@ -62,83 +44,34 @@ 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}")
# Mainly for Windows as a convenience. This will find a directory in parallel with the
# OSG source that contains 3rd party headers and libraries.
# Use of relative paths in CMake is ill-advised, but don't know of any alternatives in this case
#SET(CMAKE_INCLUDE_PATH "${OpenSceneGraph_SOURCE_DIR}/../3rdParty/include;${CMAKE_INCLUDE_PATH}")
#SET(CMAKE_LIBRARY_PATH "${OpenSceneGraph_SOURCE_DIR}/../3rdParty/lib;${CMAKE_LIBRARY_PATH}")
IF(USING_OSG_OP_OT_TRIPLE_SET)
SET(CMAKE_INCLUDE_PATH "${OpenSceneGraph_SOURCE_DIR}/../../3rdParty/include;${CMAKE_INCLUDE_PATH}")
SET(CMAKE_LIBRARY_PATH "${OpenSceneGraph_SOURCE_DIR}/../../3rdParty/lib;${CMAKE_LIBRARY_PATH}")
ENDIF(USING_OSG_OP_OT_TRIPLE_SET)
# Okay, here's the problem: On some platforms, linking against OpenThreads
# is not enough and explicit linking to the underlying thread library
# is not enough and explicit linking to the underlying thread library
# is also required (e.g. FreeBSD). But OpenThreads may be built with different
# backends (Pthreads, Sproc, Windows) so we don't know what the underlying
# thread library is because some platforms support multiple backends (e.g.
# IRIX supports Sproc and Pthreads). Linking all libraries won't work
# backends (Pthreads, Sproc, Windows) so we don't know what the underlying
# thread library is because some platforms support multiple backends (e.g.
# IRIX supports Sproc and Pthreads). Linking all libraries won't work
# because the libraries may be incompatible.
# So the current solution is to attempt best guess linking and exempt certain
# So the current solution is to attempt best guess linking and exempt certain
# cases. With IRIX, we're going to hope explicit linking to the underlying
# library is not necessary. We currently don't case for pthreads on Windows
# which might be an issue on things like Cygwin. This may need to be fixed.
FIND_PACKAGE(Threads)
IF(CMAKE_SYSTEM MATCHES IRIX)
# Erase CMAKE_THREAD_LIBS_INIT and hope it works
SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
ENDIF(CMAKE_SYSTEM MATCHES IRIX)
OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making svn branches, tags, updating ChangeLog." OFF)
IF (OSG_MAINTAINER)
#SET(OPENSCENEGRAPH_SVN "trunk")
SET(OPENSCENEGRAPH_SVN "branches")
SET(OPENSCENEGRAPH_BRANCH OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION})
#
# Provide target for tagging a release
#
SET(SVNCOMMAND svn)
SET(SVNTRUNKDIR http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk)
SET(SVNTAGDIR http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags)
SET(SVNBRANCHDIR http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branches)
IF (OPENSCENEGRAPH_SVN STREQUAL "trunk")
SET(SVNSOURCEDIR ${SVNTRUNKDIR})
ELSE (OPENSCENEGRAPH_SVN STREQUAL "trunk")
SET(SVNSOURCEDIR ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH})
ENDIF(OPENSCENEGRAPH_SVN STREQUAL "trunk")
IF (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION})
ELSE (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION}-rc${OPENSCENEGRAPH_RELEASE_CANDIDATE})
ENDIF(OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
ADD_CUSTOM_TARGET(tag-test
COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
)
ADD_CUSTOM_TARGET(tag-run
COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
)
ADD_CUSTOM_TARGET(branch-test
COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
)
ADD_CUSTOM_TARGET(branch-run
COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
)
#
# Provide target for generating ChangeLog
#
SET(GENERATELOGS svn2cl)
ADD_CUSTOM_TARGET(ChangeLog
COMMAND ${SVNCOMMAND} update
COMMAND ${GENERATELOGS} ${SVNSOURCEDIR}
)
ENDIF(OSG_MAINTAINER)
# Find OpenGL
FIND_PACKAGE(OpenGL)
@@ -154,42 +87,49 @@ IF(UNIX)
# Some Unicies need explicit linkage to the Math library or the build fails.
FIND_LIBRARY(MATH_LIBRARY m)
ENDIF(UNIX)
# Make the headers visible to everything
IF(NOT ${PROJECT_BINARY_DIR} EQUAL ${PROJECT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include)
ENDIF(NOT ${PROJECT_BINARY_DIR} EQUAL ${PROJECT_SOURCE_DIR})
INCLUDE_DIRECTORIES(
${OpenSceneGraph_SOURCE_DIR}/include
${OPENGL_INCLUDE_DIR}
)
# Common global definitions
#ADD_DEFINITIONS(-D)
# Platform specific definitions
IF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT OFF)
IF (CMAKE_SYSTEM MATCHES "AIX.*")
SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT ON)
ENDIF(CMAKE_SYSTEM MATCHES "AIX.*")
IF (APPLE)
SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT ON)
ENDIF(APPLE)
ENDIF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
OPTION(OSG_GLU_TESS_CALLBACK_TRIPLEDOT "Set to ON to build build with (...) version of GLU tesselator callback" ${DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT})
IF (OSG_GLU_TESS_CALLBACK_TRIPLEDOT)
ADD_DEFINITIONS(-DGLU_TESS_CALLBACK_TRIPLEDOT)
ENDIF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT)
IF(WIN32)
IF(MSVC)
# This option is to enable the /MP switch for Visual Studio 2005 and above compilers
OPTION(WIN32_USE_MP "Set to ON to build OpenSceneGraph with the /MP option (Visual Studio 2005 and above)." OFF)
MARK_AS_ADVANCED(WIN32_USE_MP)
IF(WIN32_USE_MP)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
ENDIF(WIN32_USE_MP)
# turn off various warnings
# foreach(warning 4244 4251 4267 4275 4290 4786 4305 4996)
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd${warning}")
# endforeach(warning)
# More MSVC specific compilation flags
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
ENDIF(MSVC)
# This option is to enable the /MP switch for Visual Studio 2005 and above compilers
OPTION(WIN32_USE_MP "Set to ON to build OpenSceneGraph with the /MP option (Visual Studio 2005 and above)." OFF)
MARK_AS_ADVANCED(WIN32_USE_MP)
IF(WIN32_USE_MP)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
ENDIF(WIN32_USE_MP)
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
#needed for net plugin
SET (OSG_SOCKET_LIBS wsock32)
# Both Cygwin and Msys need -DNOMINMAX ???
@@ -197,13 +137,13 @@ IF(WIN32)
ADD_DEFINITIONS(-DNOMINMAX)
ENDIF(UNIX)
########################################################################################################
# the following options are MSVC specific,
# the first OSG_MSVC_VERSIONED_DLL activate a custom build-time layout that should allow to run examples and application
# the foolowing options are MSVC specific,
# the first OSG_MSVC_VERSIONED_DLL activate a custom build-time layout that should allow to run examples and application
# fron bin folder without requiring installation step.
# it also prepend "osg${OPENSCENEGRAPH_SOVERSION}-" to only .dll files, leaving .lib files untouched in lib
# it also use a hack to get rid of Debug and Release folder in MSVC projects
# it also use a hack to get rid of Debug and Release folder in MSVC projects
# all the .dll and .pdb are in bin and all the .lib and .exp are in lib
#
#
# the second option disable incremental linking in debug build , that is enabled by default by CMake
##########################################################################################################
@@ -247,41 +187,27 @@ ENDIF(WIN32)
OPTION(OSG_USE_FLOAT_MATRIX "Set to ON to build OpenSceneGraph with float Matrix instead of double." OFF)
MARK_AS_ADVANCED(OSG_USE_FLOAT_MATRIX)
IF(OSG_USE_FLOAT_MATRIX)
ADD_DEFINITIONS(-DOSG_USE_FLOAT_MATRIX)
ENDIF(OSG_USE_FLOAT_MATRIX)
OPTION(OSG_USE_FLOAT_PLANE "Set to ON to build OpenSceneGraph with float Plane instead of double." OFF)
MARK_AS_ADVANCED(OSG_USE_FLOAT_PLANE)
IF(OSG_USE_FLOAT_PLANE)
ADD_DEFINITIONS(-DOSG_USE_FLOAT_PLANE)
ENDIF(OSG_USE_FLOAT_PLANE)
OPTION(OSG_USE_FLOAT_BOUNDINGSPHERE "Set to ON to build OpenSceneGraph with float BoundingSphere instead of double." ON)
MARK_AS_ADVANCED(OSG_USE_FLOAT_BOUNDINGSPHERE)
IF(NOT OSG_USE_FLOAT_BOUNDINGSPHERE)
ADD_DEFINITIONS(-DOSG_USE_DOUBLE_BOUNDINGSPHERE)
ENDIF(NOT OSG_USE_FLOAT_BOUNDINGSPHERE)
OPTION(OSG_USE_FLOAT_BOUNDINGBOX "Set to ON to build OpenSceneGraph with float BoundingBox instead of double." ON)
MARK_AS_ADVANCED(OSG_USE_FLOAT_BOUNDINGBOX)
OPTION(OSG_USE_UTF8_FILENAME "Set to ON to use a UTF8 locale for filenames instead of the default locale." OFF)
MARK_AS_ADVANCED(OSG_USE_UTF8_FILENAME)
OPTION(OSG_DISABLE_MSVC_WARNINGS "Set to OFF to not disable MSVC warnings generated by OSG headers." ON)
MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS)
OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON)
################################################################################
# Set Config file
SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
"${OPENSCENEGRAPH_CONFIG_HEADER}")
# INSTALL_FILES(/include/osg/ FILES "${OPENSCENEGRAPH_CONFIG_HEADER}")
################################################################################
# Optional build components
# OSG Applications
OPTION(BUILD_OSG_APPLICATIONS "Enable to build OSG Applications (e.g. osgviewer)" ON)
# OSG Examples
OPTION(BUILD_OSG_EXAMPLES "Enable to build OSG Examples" OFF)
IF(NOT OSG_USE_FLOAT_BOUNDINGBOX)
ADD_DEFINITIONS(-DOSG_USE_DOUBLE_BOUNDINGBOX)
ENDIF(NOT OSG_USE_FLOAT_BOUNDINGBOX)
################################################################################
# 3rd Party Dependency Stuff
@@ -291,126 +217,52 @@ ENDIF(WIN32)
# Common to all platforms:
FIND_PACKAGE(FreeType)
FIND_PACKAGE(FLTK)
FIND_PACKAGE(GLUT)
FIND_PACKAGE(SDL)
FIND_PACKAGE(FOX)
FIND_PACKAGE(Inventor)
FIND_PACKAGE(Jasper)
FIND_PACKAGE(OpenEXR)
FIND_PACKAGE(COLLADA)
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(Xine)
FIND_PACKAGE(OpenVRML)
FIND_PACKAGE(Performer)
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(GDAL)
FIND_PACKAGE(CURL)
FIND_PACKAGE(ITK)
FIND_PACKAGE(LibVNCServer)
FIND_PACKAGE(OurDCMTK)
FIND_PACKAGE(XUL)
#use pkg-config to find various modues
INCLUDE(FindPkgConfig OPTIONAL)
SET(wxWidgets_USE_LIBS base core gl net)
FIND_PACKAGE(wxWidgets)
IF(PKG_CONFIG_FOUND)
# To select a specific version of QT define DESIRED_QT_VERSION
# via cmake -DDESIRED_QT_VERSION=4
IF (DESIRED_QT_VERSION)
INCLUDE(FindPkgConfig)
IF (DESIRED_QT_VERSION MATCHES 4)
FIND_PACKAGE(Qt4)
ELSE(DESIRED_QT_VERSION MATCHES 4)
FIND_PACKAGE(Qt3)
ENDIF(DESIRED_QT_VERSION MATCHES 4)
ELSE(DESIRED_QT_VERSION)
PKG_CHECK_MODULES(GTK gtk+-2.0)
IF(WIN32)
PKG_CHECK_MODULES(GTKGL gtkglext-win32-1.0)
ELSE(WIN32)
PKG_CHECK_MODULES(GTKGL gtkglext-x11-1.0)
ENDIF(WIN32)
PKG_CHECK_MODULES(RSVG librsvg-2.0)
PKG_CHECK_MODULES(CAIRO cairo)
PKG_CHECK_MODULES(POPPLER poppler-glib)
ENDIF(PKG_CONFIG_FOUND)
#optional example related dependencies
IF (BUILD_OSG_EXAMPLES)
FIND_PACKAGE(Qt4)
IF (NOT QT4_FOUND)
FIND_PACKAGE(Qt3)
ENDIF(NOT QT4_FOUND)
ENDIF(DESIRED_QT_VERSION)
FIND_PACKAGE(FLTK)
FIND_PACKAGE(GLUT)
FIND_PACKAGE(SDL)
FIND_PACKAGE(FOX)
SET(wxWidgets_USE_LIBS base core gl net)
FIND_PACKAGE(wxWidgets)
# To select a specific version of QT define DESIRED_QT_VERSION
# via cmake -DDESIRED_QT_VERSION=4
IF (DESIRED_QT_VERSION)
IF (DESIRED_QT_VERSION MATCHES 4)
FIND_PACKAGE(Qt4)
ELSE(DESIRED_QT_VERSION MATCHES 4)
FIND_PACKAGE(Qt3)
ENDIF(DESIRED_QT_VERSION MATCHES 4)
ELSE(DESIRED_QT_VERSION)
FIND_PACKAGE(Qt4)
IF (NOT QT4_FOUND)
FIND_PACKAGE(Qt3)
ENDIF(NOT QT4_FOUND)
ENDIF(DESIRED_QT_VERSION)
ENDIF(BUILD_OSG_EXAMPLES)
#
# Test to determine if we want the "tripledot" form of the GLU tesselator callback.
#
IF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
IF(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Linux")
# Skip the compile check for platforms that never need the variable
# form.
SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT false)
ELSE(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Linux")
# For other platforms perform the check
INCLUDE(CheckCXXSourceCompiles)
SET(CMAKE_REQUIRED_DEFINITIONS -DGLU_TESS_CALLBACK_TRIPLEDOT)
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include ${GLUT_INCLUDE_DIR} ${GL_INCLUDE_DIR})
SET(CMAKE_REQUIRED_LIBRARIES ${GLUT_LIBRARY} ${GL_LIBRARY})
CHECK_CXX_SOURCE_COMPILES(
"#include <osg/GL>
#include <osg/GLU>
static void testcb(GLvoid *, void*) { }
int main() {
GLUtesselator *t = gluNewTess();
gluTessCallback(t, GLU_TESS_VERTEX_DATA, (GLU_TESS_CALLBACK) testcb);
return 0;
}"
GLU_Tesselator_Needs_Variable_Parameter_Callback_Convention_Failure_Means_No)
SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT
${GLU_Tesselator_Needs_Variable_Parameter_Callback_Convention_Failure_Means_No})
ENDIF(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Linux")
ENDIF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
OPTION(OSG_GLU_TESS_CALLBACK_TRIPLEDOT "Set to ON to build with variable parameter (...) version of GLU tesselator callback" ${DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT})
IF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT)
ADD_DEFINITIONS(-DGLU_TESS_CALLBACK_TRIPLEDOT)
ENDIF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT)
# Platform specific:
# (We can approach this one of two ways. We can try to FIND everything
# and simply check if we found the packages before actually building
# or we can hardcode the cases. The advantage of the former is that
# or we can hardcode the cases. The advantage of the former is that
# packages that are installed on platforms that don't require them
# will still get built (presuming no compatibility issues). But this
# also means modules that are redundant may get built. For example,
# will still get built (presuming no compatibility issues). But this
# also means modules that are redundant may get built. For example,
# OS X doesn't need GIF, JPEG, PNG, TIFF, etc because it uses QuickTime.
# Also, it will clutter the CMake menu with "NOT_FOUND".
# The downside to the latter is that it is harder to build those
@@ -428,8 +280,8 @@ IF(NOT APPLE)
IF(WIN32)
FIND_PACKAGE(QuickTime)
ENDIF(WIN32)
ELSE(NOT APPLE)
ELSE(NOT APPLE)
FIND_PACKAGE(QuickTime)
ENDIF(NOT APPLE)
@@ -444,20 +296,7 @@ ENDIF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
################################################################################
# Installation stuff
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
ADD_DEFINITIONS(-DOSG_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX})
IF(UNIX AND NOT WIN32)
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_DEFINITIONS("-D_DEBUG")
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
ENDIF(UNIX AND NOT WIN32)
IF(CYGWIN)
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_DEFINITIONS("-D_DEBUG")
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
ENDIF(CYGWIN)
SET(CMAKE_DEBUG_POSTFIX "d")
IF(UNIX AND NOT WIN32 AND NOT APPLE)
IF(CMAKE_SIZEOF_VOID_P MATCHES "8")
@@ -468,10 +307,7 @@ ENDIF(UNIX AND NOT WIN32 AND NOT APPLE)
IF(NOT DEFINED LIB_POSTFIX)
SET(LIB_POSTFIX "")
ENDIF(NOT DEFINED LIB_POSTFIX)
# Here we apparantly do some funky stuff with making the bin/ and lib/
# folders which is probably needed to work around a very old CMake bug?
#SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin/${CMAKE_SYSTEM_NAME})
SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin)
MAKE_DIRECTORY(${OUTPUT_BINDIR})
@@ -479,32 +315,17 @@ IF(MSVC AND NOT MSVC_IDE)
MAKE_DIRECTORY(${OUTPUT_BINDIR}/${OSG_PLUGINS})
ENDIF(MSVC AND NOT MSVC_IDE)
SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR})
#SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME})
SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib)
MAKE_DIRECTORY(${OUTPUT_LIBDIR})
IF(NOT MSVC)
MAKE_DIRECTORY(${OUTPUT_LIBDIR}/${OSG_PLUGINS})
ENDIF(NOT MSVC)
SET(LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR})
# On CMake 2.4.x use EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH and later
# we work around the DLL placement by use of the PREFIX target property hack
#
# On CMake 2.6.x use the newly minted CMAKE_LIBRARY_OUTPUT_DIRECTORY,
# CMAKE_ARCHIVE_OUTPUT_DIRECTORY & CMAKE_RUNTIME_OUTPUT_DIRECTORY
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4)
# If CMake >= 2.6.0
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_BINDIR})
IF(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_BINDIR})
ELSE(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
ENDIF(WIN32)
ELSE(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4)
SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR})
SET(LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR})
ENDIF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4)
#SET(INSTALL_BINDIR OpenSceneGraph/bin)
#SET(INSTALL_INCDIR OpenSceneGraph/include)
@@ -535,68 +356,6 @@ SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} CACHE STRING "You may add additiona
# This is unofficial so this may be removed or changed at anytime.
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} CACHE STRING "(EXPERIMENTAL) You may add additional search paths here. Use ; to separate multiple paths.")
# This is for an advanced option to give aggressive warnings
# under different compilers. If yours is not implemented, this option
# will not be made available.
IF(CMAKE_COMPILER_IS_GNUCXX)
# To be complete, we might also do GNUCC flags,
# but everything here is C++ code.
# -Wshadow and -Woverloaded-virtual are also interesting flags, but OSG
# returns too many hits.
# FYI, if we do implement GNUCC, then -Wmissing-prototypes in another
# interesting C-specific flag.
# Also, there is a bug in gcc 4.0. Under C++, -pedantic will create
# errors instead of warnings for certain issues, including superfluous
# semicolons and commas, and the use of long long. -fpermissive seems
# to be the workaround.
SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive)
# Previous included -Wformat=2 in OSG_AGGRESSIVE_WARNING_FLAGS but had to remove it due to standard library errors
ELSE(CMAKE_COMPILER_IS_GNUCXX)
IF(MSVC)
# FIXME: What are good aggressive warning flags for Visual Studio?
# And do we need to further subcase this for different versions of VS?
# CMake variables: MSVC60, MSVC70, MSVC71, MSVC80, CMAKE_COMPILER_2005
SET(OSG_AGGRESSIVE_WARNING_FLAGS /W4 /wd4706 /wd4127 /wd4100)
ELSE(MSVC)
# CMake lacks an elseif, so other non-gcc, non-VS compilers need
# to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should
# remain unset.
ENDIF(MSVC)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
# This part is for the CMake menu option to toggle the warnings on/off.
# This will only be made available if we set values for OSG_AGGRESSIVE_WARNING_FLAGS.
IF(OSG_AGGRESSIVE_WARNING_FLAGS)
IF (APPLE)
SET(DEFAULT_USE_AGGRESSIVE_WARNINGS OFF)
ELSE(APPLE)
SET(DEFAULT_USE_AGGRESSIVE_WARNINGS ON)
ENDIF(APPLE)
OPTION(OSG_USE_AGGRESSIVE_WARNINGS "Enable to activate aggressive warnings" ${DEFAULT_USE_AGGRESSIVE_WARNINGS})
MARK_AS_ADVANCED(OSG_USE_AGGRESSIVE_WARNINGS)
IF(OSG_USE_AGGRESSIVE_WARNINGS)
# Add flags defined by OSG_AGGRESSIVE_WARNING_FLAGS if they aren't already there
FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
IF(NOT CMAKE_CXX_FLAGS MATCHES "${flag}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "${flag}")
ENDFOREACH(flag)
ELSE(OSG_USE_AGGRESSIVE_WARNINGS)
# Remove all flags considered aggresive
FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
STRING(REGEX REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDFOREACH(flag)
ENDIF(OSG_USE_AGGRESSIVE_WARNINGS)
ENDIF(OSG_AGGRESSIVE_WARNING_FLAGS)
# Dynamic vs Static Linking
OPTION(DYNAMIC_OPENSCENEGRAPH "Set to ON to build OpenSceneGraph for dynamic linking. Use OFF for static." ON)
@@ -610,37 +369,89 @@ INCLUDE(OsgMacroUtils)
# OSG Core
ADD_SUBDIRECTORY(src)
# OSG Applications
OPTION(BUILD_OSG_APPLICATIONS "Enable to build OSG Applications (e.g. osgviewer)" ON)
IF (BUILD_OSG_APPLICATIONS)
ADD_SUBDIRECTORY(applications)
ENDIF(BUILD_OSG_APPLICATIONS)
# OSG Examples
OPTION(BUILD_OSG_EXAMPLES "Enable to build OSG Examples" OFF)
IF (BUILD_OSG_EXAMPLES)
ADD_SUBDIRECTORY(examples)
ENDIF(BUILD_OSG_EXAMPLES)
# This is for an advanced option to give aggressive warnings
# under different compilers. If yours is not implemented, this option
# will not be made available.
IF(CMAKE_COMPILER_IS_GNUCXX)
# To be complete, we might also do GNUCC flags,
# but everything here is C++ code.
# -Wshadow and -Woverloaded-virtual are also interesting flags, but OSG
# returns too many hits.
# FYI, if we do implement GNUCC, then -Wmissing-prototypes in another
# interesting C-specific flag.
# Also, there is a bug in gcc 4.0. Under C++, -pedantic will create
# errors instead of warnings for certain issues, including superfluous
# semicolons and commas, and the use of long long. -fpermissive seems
# to be the workaround.
SET(OSG_AGGRESSIVE_WARNING_FLAGS "-Wall -Wparentheses -Wformat=2 -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive")
ELSE(CMAKE_COMPILER_IS_GNUCXX)
IF(MSVC)
# FIXME: What are good aggressive warning flags for Visual Studio?
# And do we need to further subcase this for different versions of VS?
# CMake variables: MSVC60, MSVC70, MSVC71, MSVC80, CMAKE_COMPILER_2005
SET(OSG_AGGRESSIVE_WARNING_FLAGS "/Wall /W4")
# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
ELSE(MSVC)
# CMake lacks an elseif, so other non-gcc, non-VS compilers need
# to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should
# remain unset.
ENDIF(MSVC)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
# This part is for the CMake menu option to toggle the warnings on/off.
# This will only be made available if we set values for OSG_AGGRESSIVE_WARNING_FLAGS.
IF(OSG_AGGRESSIVE_WARNING_FLAGS)
OPTION(OSG_USE_AGGRESSIVE_WARNINGS "Enable to activate aggressive warnings" OFF)
MARK_AS_ADVANCED(OSG_USE_AGGRESSIVE_WARNINGS)
IF(OSG_USE_AGGRESSIVE_WARNINGS)
IF(NOT "${OLD_CMAKE_CXX_FLAGS_WAS_SET}")
SET(OLD_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE INTERNAL "Old CXX flags")
SET(OLD_CMAKE_CXX_FLAGS_WAS_SET 1 CACHE INTERNAL "Old CXX flags was set")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OSG_AGGRESSIVE_WARNING_FLAGS}" CACHE STRING "Flags used by the compiler during all build types." FORCE)
ENDIF(NOT "${OLD_CMAKE_CXX_FLAGS_WAS_SET}")
ELSE(OSG_USE_AGGRESSIVE_WARNINGS)
# FIXME: This will lose any changes made after OLD_CMAKE_CXX_FLAGS was
# set. The better way would be to parse the string and remove each
# option explicitly.
IF("${OLD_CMAKE_CXX_FLAGS_WAS_SET}")
SET(CMAKE_CXX_FLAGS "${OLD_CMAKE_CXX_FLAGS}" CACHE STRING "Flags used by the compiler during all build types." FORCE)
SET(OLD_CMAKE_CXX_FLAGS_WAS_SET 0 CACHE INTERNAL "Old CXX flags was set")
ENDIF("${OLD_CMAKE_CXX_FLAGS_WAS_SET}")
ENDIF(OSG_USE_AGGRESSIVE_WARNINGS)
ENDIF(OSG_AGGRESSIVE_WARNING_FLAGS)
# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
IF(APPLE)
# These are just defaults/recommendations, but how we want to build
# out of the box. But the user needs to be able to change these options.
# So we must only set the values the first time CMake is run, or we
# So we must only set the values the first time CMake is run, or we
# will overwrite any changes the user sets.
# 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)
# This is really fragile, but CMake doesn't provide the OS system
# version information we need. (Darwin versions can be changed
# This is really fragile, but CMake doesn't provide the OS system
# version information we need. (Darwin versions can be changed
# independently of OS X versions.)
# It does look like CMake handles the CMAKE_OSX_SYSROOT automatically.
IF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
# 64-bit compiles are not supported with Carbon. We should enable
# 64-bit compilation by default once osgviewer has been
# rewritten with Cocoa.
#SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
IF(EXISTS /Developer/SDKs/10.5.sdk)
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
ELSE(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
ELSE(EXISTS /Developer/SDKs/10.5.sdk)
IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
@@ -649,193 +460,71 @@ IF(APPLE)
# Should break down further to set the -mmacosx-version-min,
# but the SDK detection is too unreliable here.
ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
ENDIF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
ENDIF(EXISTS /Developer/SDKs/10.5.sdk)
ENDIF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF)
ENDIF(APPLE)
OPTION(BUILD_REF_DOCS "Build OpenSceneGraph reference documentation using doxygen (use: make DoxygenDoc)" OFF)
#
# Provide target for generating wrappers
#
SET(GENWRAPPER genwrapper)
ADD_CUSTOM_TARGET(wrappers
COMMAND ${GENWRAPPER} -c ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/genwrapper.conf -t ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/Doxyfile.template -d ${OpenSceneGraph_SOURCE_DIR} | doxygen -
COMMAND ${GENWRAPPER} -c ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/genwrapper.conf -l ${OpenSceneGraph_SOURCE_DIR}
)
IF(BUILD_REF_DOCS)
SET(BUILD_DOCUMENTATION YES)
OPTION(BUILD_REF_DOCS_SEARCHENGINE "Enable doxygen's search engine (requires that documentation to be installed on a php enabled web server)" OFF)
OPTION(BUILD_REF_DOCS_TAGFILE "Generate a tag file named osg.tag on the documentation web server" OFF)
ENDIF(BUILD_REF_DOCS)
# For Doxygen
#FIXME: I haven't figured out what to do with OSG's multiple doxyfiles
# and footer.
INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
OPTION(BUILD_DOCUMENTATION "Build OpenSceneGraph reference documentation using doxygen (use: make DoxygenDoc)" OFF)
MARK_AS_ADVANCED(CLEAR BUILD_DOCUMENTATION)
OPTION(BUILD_DOCUMENTATION "Build osg documentation" OFF)
# To build the documention, you will have to enable it
# and then do the equivalent of "make DoxygenDoc".
IF(BUILD_DOCUMENTATION)
SET(BUILD_DOCUMENTATION YES)
OPTION(BUILD_REF_DOCS_SEARCHENGINE "Enable doxygen's search engine (requires that documentation to be installed on a php enabled web server)" OFF)
IF(BUILD_REF_DOCS_SEARCHENGINE)
SET(SEARCHENGINE YES)
ELSE(BUILD_REF_DOCS_SEARCHENGINE)
SET(SEARCHENGINE NO)
ENDIF(BUILD_REF_DOCS_SEARCHENGINE)
OPTION(BUILD_REF_DOCS_TAGFILE "Generate a tag file named osg.tag on the documentation web server" OFF)
IF(BUILD_REF_DOCS_TAGFILE)
SET(GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs/osg.tag")
SET(GENERATE_TAGFILE "doc/OpenSceneGraphReferenceDocs/osg.tag")
ELSE(BUILD_REF_DOCS_TAGFILE)
SET(GENERATE_TAGFILE "")
ENDIF(BUILD_REF_DOCS_TAGFILE)
IF(DOT)
SET(HAVE_DOT YES)
ELSE(DOT)
SET(HAVE_DOT NO)
ENDIF(DOT)
# If html help generation was requested. DOCUMENTATION_HTML_HELP is defined by Documentation.cmake
SET(GENERATE_HTMLHELP "NO")
IF(DOCUMENTATION_HTML_HELP)
# on windows Documentation.cmake finds the html help workshop fi it exists. On u*ix we might have it with wine but no way to point it out
IF(NOT WIN32)
SET(HTML_HELP_COMPILER "" CACHE FILEPATH "Enter location of the HTML help compiler to let doxygen compile html")
MARK_AS_ADVANCED(HTML_HELP_COMPILER)
ENDIF(NOT WIN32)
# this var sets a proper value in .doxygen files when coniguring them below
SET(GENERATE_HTMLHELP "YES")
endif(DOCUMENTATION_HTML_HELP)
# This processes our doxyfile.cmake and substitutes paths to generate
# This processes our Doxyfile.in and substitutes paths to generate
# a final Doxyfile
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/doxyfile.cmake
${PROJECT_BINARY_DIR}/doc/openscenegraph.doxyfile
${PROJECT_BINARY_DIR}/doc/doxyfile
)
# copy the osg logo to documentations target folder
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PlatformSpecifics/Windows/icons/src/osg32-32.png
${PROJECT_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs/osg32-32.png COPYONLY
)
#INSTALL(FILES ${PROJECT_BINARY_DIR}/doc/${PROJECT_NAME}ReferenceDocs-${OPENSCENEGRAPH_VERSION}.chm DESTINATION doc OPTIONAL COMPONENT openscenegraph-doc)
INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs DESTINATION doc COMPONENT openscenegraph-doc)
# now set up openthreads documentation generation
IF(BUILD_REF_DOCS_TAGFILE)
SET(GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenThreadsReferenceDocs/ot.tag")
ENDIF(BUILD_REF_DOCS_TAGFILE)
# This processes our openthreads.doxyfile.cmake and generate a final doxyfile
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/openthreads.doxyfile.cmake
${PROJECT_BINARY_DIR}/doc/openthreads.doxyfile
)
# copy the osg logo to documentations target folder
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PlatformSpecifics/Windows/icons/src/osg32-32.png
${PROJECT_BINARY_DIR}/doc/OpenThreadsReferenceDocs/osg32-32.png COPYONLY
)
#INSTALL(FILES ${PROJECT_BINARY_DIR}/doc/${PROJECT_NAME}ReferenceDocs-${OPENSCENEGRAPH_VERSION}.chm DESTINATION doc OPTIONAL COMPONENT openscenegraph-doc)
INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/OpenThreadsReferenceDocs DESTINATION doc COMPONENT openthreads-doc)
# Process our other doxyfiles but don't create targets for these
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/all_Doxyfile
${PROJECT_BINARY_DIR}/doc/all_Doxyfile)
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/auto_Doxyfile
${PROJECT_BINARY_DIR}/doc/auto_Doxyfile)
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/core_Doxyfile
${PROJECT_BINARY_DIR}/doc/core_Doxyfile)
# This creates a new target to build documentation.
# It runs ${DOXYGEN} which is the full path and executable to
# Doxygen on your system, set by the FindDoxygen.cmake module
# (called by FindDocumentation.cmake).
# It runs the final generated Doxyfile against it.
# The DOT_PATH is substituted into the Doxyfile.
ADD_CUSTOM_TARGET(doc_openscenegraph ${DOXYGEN}
${PROJECT_BINARY_DIR}/doc/openscenegraph.doxyfile
)
ADD_CUSTOM_TARGET(doc_openthreads ${DOXYGEN}
${PROJECT_BINARY_DIR}/doc/openthreads.doxyfile
ADD_CUSTOM_TARGET(DoxygenDoc ${DOXYGEN}
${PROJECT_BINARY_DIR}/doc/doxyfile
)
ENDIF(BUILD_DOCUMENTATION)
OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of OpenSceneGraph builds here http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph" OFF)
IF(BUILD_DASHBOARD_REPORTS)
# The following are required to uses Dart and the Cdash dashboard
# viewable here : http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph
INCLUDE(Dart)
ENDIF(BUILD_DASHBOARD_REPORTS)
# present the packaging option only if we have the cpack command defined (effectively >= 2.6.0)
IF(CMAKE_CPACK_COMMAND)
OPTION(BUILD_OSG_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF)
IF(BUILD_OSG_PACKAGES)
INCLUDE(OsgCPack)
ENDIF(BUILD_OSG_PACKAGES)
ENDIF(CMAKE_CPACK_COMMAND)
# Generate pkg-config configuration file
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/openscenegraph.pc.in
${PROJECT_BINARY_DIR}/packaging/pkgconfig/openscenegraph.pc
@ONLY
)
INSTALL(FILES ${PROJECT_BINARY_DIR}/packaging/pkgconfig/openscenegraph.pc DESTINATION lib${LIB_POSTFIX}/pkgconfig COMPONENT libopenscenegraph-dev)
# Run this as late as possible so users can easier spot the message
IF (${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
SET(REQUIRES_LIBPATH_MESSAGE ON)
ENDIF(${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
IF(REQUIRES_LIBPATH_MESSAGE)
IF (NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE)
SET(OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether the libpath message has been reported before")
MESSAGE("\nThe build system is configured to instal libraries to ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}\n"
"Your applications may not be able to find your installed libraries unless you:\n"
" set your LD_LIBRARY_PATH (user specific) or\n"
" update your ld.so configuration (system wide)")
IF(IS_DIRECTORY /etc/ld.so.conf.d)
MESSAGE("You have an ld.so.conf.d directory on your system, so if you wish to ensure that\n"
"applications find the installed osg libraries, system wide, you could install a\n"
"openscenegraph specific ld.so configuration with:\n"
" sudo make install_ld_conf\n")
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/ld.so.conf.d/openscenegraph.conf.in
${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
)
ADD_CUSTOM_TARGET(install_ld_conf ${CMAKE_COMMAND} -E copy_if_different
${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
/etc/ld.so.conf.d/openscenegraph.conf
COMMAND ldconfig
COMMENT "Copying openscenegraph.conf to /etc/ld.so.conf.d and running ldconfig"
)
ELSE(IS_DIRECTORY /etc/ld.so.conf.d)
IF(EXISTS /etc/ld.so.conf)
MESSAGE("You have an ld.so.conf file in /etc, if you wish to ensure \n"
"that applications find the installed osg libraries, system wide, you\n"
"could add ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX} to it.")
ENDIF(EXISTS /etc/ld.so.conf)
ENDIF(IS_DIRECTORY /etc/ld.so.conf.d)
# emit a message during installation.
INSTALL(CODE "MESSAGE(\"Libraries were installed to ${CMAKE_INSTALL_PREFIX}lib${LIB_POSTFIX}.\\nYou may need to update your ld.so configuration. \")")
ENDIF(NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE)
ELSE(REQUIRES_LIBPATH_MESSAGE)
SET(OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 0 CACHE INTERNAL "Flag to track whether the libpath message has been reported before")
ENDIF(REQUIRES_LIBPATH_MESSAGE)
# This needs to be run very last so other parts of the scripts can take
# advantage of this.
IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
SET(OSG_CONFIG_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether this is the first time running CMake or if CMake has been configured before")
ENDIF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
#-----------------------------------------------------------------------------
### uninstall target
#-----------------------------------------------------------------------------
@@ -845,3 +534,4 @@ CONFIGURE_FILE(
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")

View File

@@ -1,118 +0,0 @@
# Check for availability of atomic operations
# This module defines
# OPENTHREADS_HAVE_ATOMIC_OPS
INCLUDE(CheckCXXSourceRuns)
# Do step by step checking,
CHECK_CXX_SOURCE_RUNS("
#include <cstdlib>
int main()
{
unsigned value = 0;
void* ptr = &value;
__sync_add_and_fetch(&value, 1);
__sync_synchronize();
__sync_sub_and_fetch(&value, 1);
if (!__sync_bool_compare_and_swap(&value, 0, 1))
return EXIT_FAILURE;
if (!__sync_bool_compare_and_swap(&ptr, ptr, ptr))
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
" _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
CHECK_CXX_SOURCE_RUNS("
#include <stdlib.h>
int main(int, const char**)
{
unsigned value = 0;
void* ptr = &value;
__add_and_fetch(&value, 1);
__synchronize(value);
__sub_and_fetch(&value, 1);
if (!__compare_and_swap(&value, 0, 1))
return EXIT_FAILURE;
if (!__compare_and_swap((unsigned long*)&ptr, (unsigned long)ptr, (unsigned long)ptr))
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
" _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS)
CHECK_CXX_SOURCE_RUNS("
#include <atomic.h>
#include <cstdlib>
int main(int, const char**)
{
uint_t value = 0;
void* ptr = &value;
atomic_inc_uint_nv(&value);
membar_consumer();
atomic_dec_uint_nv(&value);
if (0 != atomic_cas_uint(&value, 0, 1))
return EXIT_FAILURE;
if (ptr != atomic_cas_ptr(&ptr, ptr, ptr))
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
" _OPENTHREADS_ATOMIC_USE_SUN)
CHECK_CXX_SOURCE_RUNS("
#include <windows.h>
#include <intrin.h>
#include <cstdlib>
#pragma intrinsic(_InterlockedAnd)
#pragma intrinsic(_InterlockedOr)
#pragma intrinsic(_InterlockedXor)
int main(int, const char**)
{
volatile long value = 0;
long data = 0;
long* volatile ptr = &data;
InterlockedIncrement(&value);
MemoryBarrier();
InterlockedDecrement(&value);
if (0 != InterlockedCompareExchange(&value, 1, 0))
return EXIT_FAILURE;
if (ptr != InterlockedCompareExchangePointer((PVOID volatile*)&ptr, (PVOID)ptr, (PVOID)ptr))
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
" _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
CHECK_CXX_SOURCE_RUNS("
#include <libkern/OSAtomic.h>
int main()
{
volatile int32_t value = 0;
long data = 0;
long * volatile ptr = &data;
OSAtomicIncrement32(&value);
OSMemoryBarrier();
OSAtomicDecrement32(&value);
OSAtomicCompareAndSwapInt(value, 1, &value);
OSAtomicCompareAndSwapPtr(ptr, ptr, (void * volatile *)&ptr);
}
" _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
IF(NOT _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND NOT _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS AND NOT _OPENTHREADS_ATOMIC_USE_SUN AND NOT _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED AND NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
ENDIF(NOT _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND NOT _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS AND NOT _OPENTHREADS_ATOMIC_USE_SUN AND NOT _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED AND NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)

View File

@@ -5,8 +5,8 @@
MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES SEARCHPATHLIST DEBUGSUFFIX)
MESSAGE(STATUS "searching ${DEPNAME} -->${INCLUDEFILE}<-->${LIBRARY_NAMES}<-->${SEARCHPATHLIST}<--")
MESSAGE(STATUS "searching ${DEPNAME} -->${INCLUDEFILE}<-->${LIBRARY}<-->${SEARCHPATHLIST}<--")
SET(MY_PATH_INCLUDE )
SET(MY_PATH_LIB )
@@ -14,10 +14,9 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES SEARCHPATHLIST DEBUGSUFF
SET(MY_PATH_INCLUDE ${MY_PATH_INCLUDE} ${MYPATH}/include)
SET(MY_PATH_LIB ${MY_PATH_LIB} ${MYPATH}/lib)
ENDFOREACH( MYPATH ${SEARCHPATHLIST} )
FIND_PATH("${DEPNAME}_INCLUDE_DIR" ${INCLUDEFILE}
${MY_PATH_INCLUDE}
NO_DEFAULT_PATH
)
MARK_AS_ADVANCED("${DEPNAME}_INCLUDE_DIR")
#MESSAGE( " ${DEPNAME}_INCLUDE_DIR --> ${${DEPNAME}_INCLUDE_DIR}<--")
@@ -25,7 +24,6 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES SEARCHPATHLIST DEBUGSUFF
FIND_LIBRARY("${DEPNAME}_LIBRARY"
NAMES ${LIBRARY_NAMES}
PATHS ${MY_PATH_LIB}
NO_DEFAULT_PATH
)
SET(LIBRARY_NAMES_DEBUG "")
FOREACH(LIBNAME ${LIBRARY_NAMES})
@@ -34,7 +32,6 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES SEARCHPATHLIST DEBUGSUFF
FIND_LIBRARY("${DEPNAME}_LIBRARY_DEBUG"
NAMES ${LIBRARY_NAMES_DEBUG}
PATHS ${MY_PATH_LIB}
NO_DEFAULT_PATH
)
MARK_AS_ADVANCED("${DEPNAME}_LIBRARY")
#MESSAGE( " ${DEPNAME}_LIBRARY --> ${${DEPNAME}_LIBRARY}<--")
@@ -55,13 +52,12 @@ ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES SEARCHPATHLIST DEBUGS
MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
FIND_DEPENDENCY(TIFF tiff.h libtiff ${OSG_3RDPARTY_BIN} "D")
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype234;freetype234MT;freetype235;freetype237" ${OSG_3RDPARTY_BIN} "_D")
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype234;freetype234MT;freetype235" ${OSG_3RDPARTY_BIN} "_D")
IF(FREETYPE_FOUND)
#forcing subsequent FindFreeType stuff to not search for other variables.... kind of a hack
SET(FREETYPE_INCLUDE_DIR_ft2build ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
SET(FREETYPE_INCLUDE_DIR_freetype2 ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
SET(FREETYPE_INCLUDE_DIR_ft2build ${FREETYPE_INCLUDE_DIR} CACHE PATH "")
SET(FREETYPE_INCLUDE_DIR_freetype2 ${FREETYPE_INCLUDE_DIR} CACHE PATH "")
MARK_AS_ADVANCED(FREETYPE_INCLUDE_DIR_ft2build FREETYPE_INCLUDE_DIR_freetype2)
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
ENDIF(FREETYPE_FOUND)
FIND_DEPENDENCY(CURL curl/curl.h "libcurl;curllib" ${OSG_3RDPARTY_BIN} "D")
FIND_DEPENDENCY(JPEG jpeglib.h libjpeg ${OSG_3RDPARTY_BIN} "D")

View File

@@ -1,22 +1,15 @@
# Locate Collada
# This module defines:
# Locate gdal
# This module defines
# COLLADA_LIBRARY
# COLLADA_FOUND, if false, do not try to link to gdal
# COLLADA_INCLUDE_DIR, where to find the headers
#
# COLLADA_LIBRARY, COLLADA_LIBRARY_DEBUG
# COLLADA_FOUND, if false, do not try to link to Collada dynamically
#
# COLLADA_LIBRARY_STATIC, COLLADA_LIBRARY_STATIC_DEBUG
# COLLADA_STATIC_FOUND, if false, do not try to link to Collada statically
#
# $COLLADA_DIR is an environment variable that would
# correspond to the ./configure --prefix=$COLLADA_DIR
#
# Created by Robert Osfield.
SET(COLLADA_DOM_ROOT "$ENV{COLLADA_DIR}/dom" CACHE PATH "Location of Collada DOM directory")
FIND_PATH(COLLADA_INCLUDE_DIR dae.h
${COLLADA_DOM_ROOT}/include
$ENV{COLLADA_DIR}/include
$ENV{COLLADA_DIR}
$ENV{OSGDIR}/include
@@ -25,9 +18,7 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/local/include/colladadom
/usr/include/
/usr/include/colladadom
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
@@ -36,11 +27,9 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
/usr/freeware/include
)
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
NAMES collada_dom collada14dom libcollada14dom21
FIND_LIBRARY(COLLADA_LIBRARY
NAMES collada_dom
PATHS
${COLLADA_DOM_ROOT}/build/vc8-1.4
$ENV{COLLADA_DIR}/build/vc8-1.4
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
$ENV{COLLADA_DIR}
@@ -50,9 +39,7 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
/sw/lib
/opt/local/lib
/opt/csw/lib
@@ -61,216 +48,9 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
/usr/freeware/lib64
)
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
NAMES collada_dom-d collada14dom-d libcollada14dom21-d
PATHS
${COLLADA_DOM_ROOT}/build/vc8-1.4-d
$ENV{COLLADA_DIR}/build/vc8-1.4-d
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
$ENV{COLLADA_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
FIND_LIBRARY(COLLADA_STATIC_LIBRARY
NAMES libcollada14dom21-s
PATHS
${COLLADA_DOM_ROOT}/build/vc8-1.4
$ENV{COLLADA_DIR}/build/vc8-1.4
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
$ENV{COLLADA_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
NAMES collada_dom-sd collada14dom-sd libcollada14dom21-sd
PATHS
${COLLADA_DOM_ROOT}/build/vc8-1.4-d
$ENV{COLLADA_DIR}/build/vc8-1.4-d
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
$ENV{COLLADA_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
IF(COLLADA_STATIC_LIBRARY)
# find extra libraries that the static linking requires
FIND_PACKAGE(LibXml2)
IF (LIBXML2_FOUND)
SET(COLLADA_LIBXML_LIBRARY ${LIBXML2_LIBRARIES})
ELSE(LIBXML2_FOUND)
IF(WIN32)
FIND_LIBRARY(COLLADA_LIBXML_LIBRARY
NAMES libxml2
PATHS
${COLLADA_DOM_ROOT}/external-libs/libxml2/win32/lib
${COLLADA_DOM_ROOT}/external-libs/libxml2/mingw/lib
)
ENDIF(WIN32)
ENDIF(LIBXML2_FOUND)
FIND_PACKAGE(ZLIB)
IF (ZLIB_FOUND)
SET(COLLADA_ZLIB_LIBRARY ${ZLIB_LIBRARY})
ELSE(ZLIB_FOUND)
IF(WIN32)
FIND_LIBRARY(COLLADA_ZLIB_LIBRARY
NAMES zlib
PATHS
${COLLADA_DOM_ROOT}/external-libs/libxml2/win32/lib
${COLLADA_DOM_ROOT}/external-libs/libxml2/mingw/lib
)
ENDIF(WIN32)
ENDIF(ZLIB_FOUND)
IF(WIN32)
FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY
NAMES pcrecpp
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY_DEBUG
NAMES pcrecpp-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_PCRE_LIBRARY
NAMES pcre
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_PCRE_LIBRARY_DEBUG
NAMES pcre-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY
NAMES minizip
PATHS
${COLLADA_DOM_ROOT}/external-libs/minizip/win32/lib
${COLLADA_DOM_ROOT}/external-libs/minizip/mac
)
FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY_DEBUG
NAMES minizip-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/minizip/win32/lib
${COLLADA_DOM_ROOT}/external-libs/minizip/mac
)
ENDIF(WIN32)
ENDIF(COLLADA_STATIC_LIBRARY)
IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
IF(WIN32)
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
NAMES libboost_filesystem
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
NAMES libboost_filesystem-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
NAMES libboost_system
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
NAMES libboost_system-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
FIND_PATH(COLLADA_BOOST_INCLUDE_DIR boost/filesystem/convenience.hpp
${COLLADA_DOM_ROOT}/external-libs/boost
)
ENDIF(WIN32)
ENDIF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
SET(COLLADA_FOUND "NO")
IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
IF (COLLADA_INCLUDE_DIR)
SET(COLLADA_FOUND "YES")
ENDIF(COLLADA_INCLUDE_DIR)
ENDIF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
IF(COLLADA_LIBRARY AND COLLADA_INCLUDE_DIR)
SET(COLLADA_FOUND "YES")
ENDIF(COLLADA_LIBRARY AND COLLADA_INCLUDE_DIR)

View File

@@ -20,7 +20,6 @@
# #include "gdal.h"
FIND_PATH(GDAL_INCLUDE_DIR gdal.h
PATHS
$ENV{GDAL_DIR}
NO_DEFAULT_PATH
PATH_SUFFIXES include

View File

@@ -1,74 +0,0 @@
# Locate libvncserver
# This module defines
# LIBVNCSERVER_LIBRARY
# LIBVNCSERVER_FOUND, if false, do not try to link to libvncserver
# LIBVNCSERVER_INCLUDE_DIR, where to find the headers
#
# $LIBVNCSERVER_DIR is an environment variable that would
# correspond to the ./configure --prefix=$LIBVNCSERVER_DIR
# used in building libvncserver.
FIND_PATH(LIBVNCSERVER_INCLUDE_DIR rfb/rfb.h
$ENV{LIBVNCSERVER_DIR}/include
$ENV{LIBVNCSERVER_DIR}
$ENV{OSGDIR}/include
$ENV{OSGDIR}
$ENV{OSG_ROOT}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
/usr/freeware/include
)
FIND_LIBRARY(LIBVNCCLIENT_LIBRARY
NAMES vncclient
PATHS
$ENV{LIBVNCSERVER_DIR}/lib
$ENV{LIBVNCSERVER_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
FIND_LIBRARY(LIBVNCSERVER_LIBRARY
NAMES vncserver
PATHS
$ENV{LIBVNCSERVER_DIR}/lib
$ENV{LIBVNCSERVER_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
SET(LIBVNCSERVER_FOUND "NO")
IF(LIBVNCSERVER_LIBRARY AND LIBVNCSERVER_INCLUDE_DIR)
SET(LIBVNCSERVER_FOUND "YES")
ENDIF(LIBVNCSERVER_LIBRARY AND LIBVNCSERVER_INCLUDE_DIR)

View File

@@ -10,42 +10,37 @@
# Created by Robert Osfield.
FIND_PATH(OSG_INCLUDE_DIR osg/Node
${OSG_DIR}/include
$ENV{OSG_DIR}/include
$ENV{OSG_DIR}
$ENV{OSGDIR}/include
$ENV{OSGDIR}
$ENV{OSG_ROOT}/include
NO_DEFAULT_PATH
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
/usr/freeware/include
)
FIND_PATH(OSG_INCLUDE_DIR osg/Node)
MACRO(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY("${MYLIBRARY}_DEBUG"
NAMES "${MYLIBRARYNAME}${CMAKE_DEBUG_POSTFIX}"
FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAME}
PATHS
${OSG_DIR}/lib/Debug
${OSG_DIR}/lib
$ENV{OSG_DIR}/lib/debug
$ENV{OSG_DIR}/lib
$ENV{OSG_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
NO_DEFAULT_PATH
)
FIND_LIBRARY("${MYLIBRARY}_DEBUG"
NAMES "${MYLIBRARYNAME}${CMAKE_DEBUG_POSTFIX}"
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
/sw/lib
/opt/local/lib
/opt/csw/lib
@@ -53,57 +48,16 @@ MACRO(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAME}
PATHS
${OSG_DIR}/lib/Release
${OSG_DIR}/lib
$ENV{OSG_DIR}/lib/Release
$ENV{OSG_DIR}/lib
$ENV{OSG_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
NO_DEFAULT_PATH
)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAME}
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
IF( NOT ${MYLIBRARY}_DEBUG)
IF(MYLIBRARY)
SET(${MYLIBRARY}_DEBUG ${MYLIBRARY})
ENDIF(MYLIBRARY)
ENDIF( NOT ${MYLIBRARY}_DEBUG)
ENDMACRO(FIND_OSG_LIBRARY LIBRARY LIBRARYNAME)
FIND_OSG_LIBRARY(OSG_LIBRARY osg)
FIND_OSG_LIBRARY(OSGGA_LIBRARY osgGA)
FIND_OSG_LIBRARY(OSGUTIL_LIBRARY osgUtil)
FIND_OSG_LIBRARY(OSGDB_LIBRARY osgDB)
FIND_OSG_LIBRARY(OSGTEXT_LIBRARY osgText)
FIND_OSG_LIBRARY(OSGWIDGET_LIBRARY osgWidget)
FIND_OSG_LIBRARY(OSGTERRAIN_LIBRARY osgTerrain)
FIND_OSG_LIBRARY(OSGFX_LIBRARY osgFX)
FIND_OSG_LIBRARY(OSGVIEWER_LIBRARY osgViewer)
FIND_OSG_LIBRARY(OSGVOLUME_LIBRARY osgVolume)
FIND_OSG_LIBRARY(OPENTHREADS_LIBRARY OpenThreads)
SET(OSG_FOUND "NO")
IF(OSG_LIBRARY AND OSG_INCLUDE_DIR)

View File

@@ -1,77 +0,0 @@
# Locate OpenEXR
# This module defines
# OPENEXR_LIBRARY
# OPENEXR_FOUND, if false, do not try to link to OpenEXR
# OPENEXR_INCLUDE_DIR, where to find the headers
#
# $OPENEXR_DIR is an environment variable that would
# correspond to the ./configure --prefix=$OPENEXR_DIR
#
# Created by Robert Osfield.
FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h
$ENV{OPENEXR_DIR}/include
$ENV{OPENEXR_DIR}
$ENV{OSGDIR}/include
$ENV{OSGDIR}
$ENV{OSG_ROOT}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
/usr/freeware/include
)
FIND_LIBRARY(OPENEXR_IlmIlf_LIBRARY
NAMES IlmImf
PATHS
$ENV{OPENEXR_DIR}/lib
$ENV{OPENEXR_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
FIND_LIBRARY(OPENEXR_Half_LIBRARY
NAMES Half
PATHS
$ENV{OPENEXR_DIR}/lib
$ENV{OPENEXR_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
SET(OPENEXR_FOUND "NO")
IF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_Half_LIBRARY)
SET(OPENEXR_LIBRARIES
${OPENEXR_IlmIlf_LIBRARY}
${OPENEXR_Half_LIBRARY}
)
SET(OPENEXR_FOUND "YES")
ENDIF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_Half_LIBRARY)

View File

@@ -1,180 +0,0 @@
# - find DCMTK libraries
#
# DCMTK_INCLUDE_DIRS - Directories to include to use DCMTK
# DCMTK_LIBRARIES - Files to link against to use DCMTK
# DCMTK_FOUND - If false, don't try to use DCMTK
# DCMTK_DIR - (optional) Source directory for DCMTK
#
# DCMTK_DIR can be used to make it simpler to find the various include
# directories and compiled libraries if you've just compiled it in the
# source tree. Just set it to the root of the tree where you extracted
# the source.
#
# Written for VXL by Amitha Perera.
# Modified by Robert Osfied to enable support for install placements of DCMTK 3.5.4 versions onwards
FIND_PATH( DCMTK_ROOT_INCLUDE_DIR dcmtk/config/osconfig.h
${DCMTK_DIR}/config/include
${DCMTK_DIR}/include
/usr/local/include/
/usr/include/
/usr/local/dicom/include/
)
FIND_PATH( DCMTK_config_INCLUDE_DIR osconfig.h
${DCMTK_ROOT_INCLUDE_DIR}/dcmtk/config
${DCMTK_DIR}/config/include
${DCMTK_DIR}/include
/usr/local/include/dcmtk/config
/usr/include/dcmtk/config
/usr/local/dicom/include/dcmtk/config
)
FIND_PATH( DCMTK_ofstd_INCLUDE_DIR ofstdinc.h
${DCMTK_ROOT_INCLUDE_DIR}/dcmtk/ofstd
${DCMTK_DIR}/ofstd/include
${DCMTK_DIR}/include/ofstd
/usr/local/include/dcmtk/ofstd
/usr/include/dcmtk/ofstd
/usr/local/dicom/include/dcmtk/ofstd
)
FIND_LIBRARY( DCMTK_ofstd_LIBRARY ofstd
${DCMTK_DIR}/ofstd/libsrc
${DCMTK_DIR}/ofstd/libsrc/Release
${DCMTK_DIR}/ofstd/libsrc/Debug
${DCMTK_DIR}/ofstd/Release
${DCMTK_DIR}/ofstd/Debug
${DCMTK_DIR}/lib
/usr/local/lib64
/usr/lib64
/usr/local/lib
/usr/lib
/usr/local/dicom/lib
)
FIND_PATH( DCMTK_dcmdata_INCLUDE_DIR dctypes.h
${DCMTK_ROOT_INCLUDE_DIR}/dcmtk/dcmdata
${DCMTK_DIR}/dcmdata/include
${DCMTK_DIR}/include/dcmdata
/usr/local/include/dcmtk/dcmdata
/usr/include/dcmtk/dcmdata
/usr/local/dicom/include/dcmtk/dcmdata
)
FIND_LIBRARY( DCMTK_dcmdata_LIBRARY dcmdata
${DCMTK_DIR}/dcmdata/libsrc
${DCMTK_DIR}/dcmdata/libsrc/Release
${DCMTK_DIR}/dcmdata/libsrc/Debug
${DCMTK_DIR}/dcmdata/Release
${DCMTK_DIR}/dcmdata/Debug
${DCMTK_DIR}/lib
/usr/local/lib64
/usr/lib64
/usr/local/lib
/usr/lib
/usr/local/dicom/lib
)
FIND_PATH( DCMTK_dcmimgle_INCLUDE_DIR dcmimage.h
${DCMTK_ROOT_INCLUDE_DIR}/dcmtk/dcmimgle
${DCMTK_DIR}/dcmimgle/include
${DCMTK_DIR}/include/dcmimgle
/usr/local/include/dcmtk/dcmimgle
/usr/include/dcmtk/dcmimgle
/usr/local/dicom/include/dcmtk/dcmimgle
)
FIND_LIBRARY( DCMTK_dcmimgle_LIBRARY dcmimgle
${DCMTK_DIR}/dcmimgle/libsrc
${DCMTK_DIR}/dcmimgle/libsrc/Release
${DCMTK_DIR}/dcmimgle/libsrc/Debug
${DCMTK_DIR}/dcmimgle/Release
${DCMTK_DIR}/dcmimgle/Debug
${DCMTK_DIR}/lib
/usr/local/lib64
/usr/lib64
/usr/local/lib
/usr/lib
/usr/local/dicom/lib
)
FIND_LIBRARY(DCMTK_imagedb_LIBRARY imagedb
${DCMTK_DIR}/imagectn/libsrc/Release
${DCMTK_DIR}/imagectn/libsrc/
${DCMTK_DIR}/imagectn/libsrc/Debug
/usr/local/lib64
/usr/lib64
/usr/local/lib
/usr/lib
/usr/local/dicom/lib
)
FIND_LIBRARY(DCMTK_dcmnet_LIBRARY dcmnet
${DCMTK_DIR}/dcmnet/libsrc/Release
${DCMTK_DIR}/dcmnet/libsrc/Debug
${DCMTK_DIR}/dcmnet/libsrc/
/usr/local/lib64
/usr/lib64
/usr/local/lib
/usr/lib
/usr/local/dicom/lib
)
IF( DCMTK_config_INCLUDE_DIR
AND DCMTK_ofstd_INCLUDE_DIR
AND DCMTK_ofstd_LIBRARY
AND DCMTK_dcmdata_INCLUDE_DIR
AND DCMTK_dcmdata_LIBRARY
AND DCMTK_dcmimgle_INCLUDE_DIR
AND DCMTK_dcmimgle_LIBRARY )
SET( DCMTK_FOUND "YES" )
SET( DCMTK_INCLUDE_DIRS
${DCMTK_config_INCLUDE_DIR}
${DCMTK_ofstd_INCLUDE_DIR}
${DCMTK_dcmdata_INCLUDE_DIR}
${DCMTK_dcmimgle_INCLUDE_DIR}
)
SET( DCMTK_LIBRARIES
${DCMTK_dcmimgle_LIBRARY}
${DCMTK_dcmdata_LIBRARY}
${DCMTK_ofstd_LIBRARY}
${DCMTK_config_LIBRARY}
)
IF(DCMTK_imagedb_LIBRARY)
SET( DCMTK_LIBRARIES
${DCMTK_LIBRARIES}
${DCMTK_imagedb_LIBRARY}
)
ENDIF(DCMTK_imagedb_LIBRARY)
IF(DCMTK_dcmnet_LIBRARY)
SET( DCMTK_LIBRARIES
${DCMTK_LIBRARIES}
${DCMTK_dcmnet_LIBRARY}
)
ENDIF(DCMTK_dcmnet_LIBRARY)
IF( WIN32 )
SET( DCMTK_LIBRARIES ${DCMTK_LIBRARIES} netapi32 )
ENDIF( WIN32 )
ENDIF( DCMTK_config_INCLUDE_DIR
AND DCMTK_ofstd_INCLUDE_DIR
AND DCMTK_ofstd_LIBRARY
AND DCMTK_dcmdata_INCLUDE_DIR
AND DCMTK_dcmdata_LIBRARY
AND DCMTK_dcmimgle_INCLUDE_DIR
AND DCMTK_dcmimgle_LIBRARY )
IF( NOT DCMTK_FOUND )
SET( DCMTK_DIR "" CACHE PATH "Root of DCMTK source tree (optional)." )
MARK_AS_ADVANCED( DCMTK_DIR )
ENDIF( NOT DCMTK_FOUND )

View File

@@ -1,235 +0,0 @@
# Locate XUL
# This module defines
# XUL_LIBRARIES
# XUL_FOUND, if false, do not try to link to gdal
# XUL_INCLUDE_DIR, where to find the headers
#
# $XUL_DIR is an environment variable that would
# correspond to the ./configure --prefix=$XUL_DIR
#
# Created by Robert Osfield.
#use pkg-config to find various modues
INCLUDE(FindPkgConfig OPTIONAL)
IF(PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
pkg_check_modules(XULRUNNER_XPCOM xulrunner-xpcom<=1.8.9)
pkg_check_modules(XULRUNNER_JS xulrunner-js)
pkg_check_modules(XULRUNNER_NSPR xulrunner-nspr)
pkg_check_modules(XULRUNNER_NSS xulrunner-nss)
ENDIF(PKG_CONFIG_FOUND)
# Added check to make sure that nsIBaseWindow.h is available, as it's not a standard part the of 1.8.x SDK
FIND_PATH(NSIBASEWINDOW_INCLUDE_DIR widget/nsIBaseWindow.h
PATHS ${XULRUNNER_XPCOM_INCLUDE_DIRS}
$ENV{OSG_DIR}/include/xulrunner
$ENV{OSG_DIR}/include
$ENV{OSG_DIR}/xulrunner
$ENV{OSG_DIR}
$ENV{OSGDIR}/include/xulrunner
$ENV{OSGDIR}/include
$ENV{OSGDIR}/xulrunner
$ENV{OSGDIR}
$ENV{OSG_ROOT}/include/xulrunner
$ENV{OSG_ROOT}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include/xulrunner
/usr/local/include
/usr/include/xulrunner
/usr/include
/sw/include/xulrunner # Fink
/sw/include # Fink
/opt/local/include/xulrunner # DarwinPorts
/opt/local/include # DarwinPorts
/opt/csw/include/xulrunner # Blastwave
/opt/csw/include # Blastwave
/opt/include/xulrunner
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/xulrunner
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
/usr/freeware/include/xulrunner
/usr/freeware/include
)
FIND_PATH(XUL_INCLUDE_DIR nsEmbedAPI.h
PATHS ${XULRUNNER_XPCOM_INCLUDE_DIRS}
$ENV{OSG_DIR}/include/xulrunner
$ENV{OSG_DIR}/include
$ENV{OSG_DIR}/xulrunner
$ENV{OSG_DIR}
$ENV{OSGDIR}/include/xulrunner
$ENV{OSGDIR}/include
$ENV{OSGDIR}/xulrunner
$ENV{OSGDIR}
$ENV{OSG_ROOT}/include/xulrunner
$ENV{OSG_ROOT}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include/xulrunner
/usr/local/include
/usr/include/xulrunner
/usr/include
/sw/include/xulrunner # Fink
/sw/include # Fink
/opt/local/include/xulrunner # DarwinPorts
/opt/local/include # DarwinPorts
/opt/csw/include/xulrunner # Blastwave
/opt/csw/include # Blastwave
/opt/include/xulrunner
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/xulrunner
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
/usr/freeware/include/xulrunner
/usr/freeware/include
)
FIND_PATH(NSPR_INCLUDE_DIR prtypes.h
PATHS ${XULRUNNER_NSPR_INCLUDE_DIRS}
$ENV{OSG_DIR}/include/nspr
$ENV{OSG_DIR}/include
$ENV{OSG_DIR}/nspr
$ENV{OSG_DIR}
$ENV{OSGDIR}/include/nspr
$ENV{OSGDIR}/include
$ENV{OSGDIR}/nspr
$ENV{OSGDIR}
$ENV{OSG_ROOT}/include/nspr
$ENV{OSG_ROOT}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include/nspr
/usr/local/include
/usr/include/nspr
/usr/include
/sw/include/nspr # Fink
/sw/include # Fink
/opt/local/include/nspr # DarwinPorts
/opt/local/include # DarwinPorts
/opt/csw/include/nspr # Blastwave
/opt/csw/include # Blastwave
/opt/include/nspr
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/nspr
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
/usr/freeware/include/nspr
/usr/freeware/include
)
FIND_PATH(MOZJS_INCLUDE_DIR jsapi.h
PATHS ${XULRUNNER_JS_INCLUDE_DIRS}
$ENV{OSG_DIR}/include/mozjs
$ENV{OSG_DIR}/include
$ENV{OSG_DIR}/mozjs
$ENV{OSG_DIR}
$ENV{OSGDIR}/include/mozjs
$ENV{OSGDIR}/include
$ENV{OSGDIR}/mozjs
$ENV{OSGDIR}
$ENV{OSG_ROOT}/include/mozjs
$ENV{OSG_ROOT}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include/mozjs
/usr/local/include
/usr/include/mozjs
/usr/include
/sw/include/mozjs # Fink
/sw/include # Fink
/opt/local/include/mozjs # DarwinPorts
/opt/local/include # DarwinPorts
/opt/csw/include/mozjs # Blastwave
/opt/csw/include # Blastwave
/opt/include/mozjs
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/mozjs
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
/usr/freeware/include/mozjs
/usr/freeware/include
)
FIND_PATH(XUL_DIR
NAMES components/appshell.xpt
PATHS
$ENV{OSG_DIR}/lib
$ENV{OSG_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib/xulrunner
/usr/local/lib
/usr/lib/xulrunner
/usr/lib
/sw/lib/xulrunner
/sw/lib
/opt/local/lib/xulrunner
/opt/local/lib
/opt/csw/lib/xulrunner
/opt/csw/lib
/opt/lib/xulrunner
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64/xulrunner
/usr/freeware/lib64
)
MACRO(FIND_XUL_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY}
PATHS ${XULRUNNER_XPCOM_LIBRARY_DIRS}
PATHS ${XULRUNNER_JS_LIBRARY_DIRS}
PATHS ${XULRUNNER_NSPR_LIBRARY_DIRS}
PATHS ${XULRUNNER_NSS_LIBRARY_DIRS}
NAMES ${MYLIBRARYNAME}
PATHS
$ENV{OSG_DIR}/lib
$ENV{OSG_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib/xulrunner
/usr/local/lib
/usr/lib/xulrunner
/usr/lib
/sw/lib/xulrunner
/sw/lib
/opt/local/lib/xulrunner
/opt/local/lib
/opt/csw/lib/xulrunner
/opt/csw/lib
/opt/lib/xulrunner
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64/xulrunner
/usr/freeware/lib64
)
ENDMACRO(FIND_XUL_LIBRARY LIBRARY LIBRARYNAME)
FIND_XUL_LIBRARY(XUL_LIBRARY xul plds4 plc4 nspr4)
FIND_XUL_LIBRARY(XUL_MOZJS_LIBRARY mozjs)
FIND_XUL_LIBRARY(XUL_XPCOM_LIBRARY xpcom)
FIND_XUL_LIBRARY(XUL_PLUGIN_LIBRARY plds4)
FIND_XUL_LIBRARY(XUL_NSS_LIBRARY nss3)
SET(XUL_FOUND "NO")
IF(XUL_LIBRARY AND XUL_INCLUDE_DIR AND NSIBASEWINDOW_INCLUDE_DIR)
SET(XUL_FOUND "YES")
SET(XUL_LIBRARIES ${XUL_LIBRARY} ${XUL_MOZJS_LIBRARY} ${XUL_XPCOM_LIBRARY} ${XUL_PLUGIN_LIBRARY} ${XUL_NSS_LIBRARY})
SET(XUL_INCLUDE_DIRS ${XUL_INCLUDE_DIR} ${NSPR_INCLUDE_DIR} ${MOZJS_INCLUDE_DIR})
ENDIF(XUL_LIBRARY AND XUL_INCLUDE_DIR AND NSIBASEWINDOW_INCLUDE_DIR)
# MESSAGE("XUL_INCLUDE_DIR " ${XUL_INCLUDE_DIR})
# MESSAGE("XUL_LIBRARIES " ${XUL_LIBRARIES})

View File

@@ -1,12 +1,12 @@
# Locate zlib
# Locate gdal
# This module defines
# ZLIB_LIBRARY
# ZLIB_FOUND, if false, do not try to link to zlib
# ZLIB_FOUND, if false, do not try to link to gdal
# ZLIB_INCLUDE_DIR, where to find the headers
#
# $ZLIB_DIR is an environment variable that would
# correspond to the ./configure --prefix=$ZLIB_DIR
# used in building zlib.
# used in building gdal.
#
# Created by Ulrich Hertlein.
@@ -29,7 +29,7 @@ FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
)
FIND_LIBRARY(ZLIB_LIBRARY
NAMES z libz zlib
NAMES z libz
PATHS
$ENV{ZLIB_DIR}/lib
$ENV{ZLIB_DIR}

View File

@@ -22,19 +22,17 @@ SOURCE_GROUP(
)
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
HANDLE_MSVC_DLL()
HANDLE_MSVC_DLL()
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
INSTALL(
TARGETS ${LIB_NAME}
RUNTIME DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph
LIBRARY DESTINATION ${INSTALL_LIBDIR} COMPONENT libopenscenegraph
ARCHIVE DESTINATION ${INSTALL_ARCHIVEDIR} COMPONENT libopenscenegraph-dev
RUNTIME DESTINATION ${INSTALL_BINDIR}
LIBRARY DESTINATION ${INSTALL_LIBDIR}
ARCHIVE DESTINATION ${INSTALL_ARCHIVEDIR}
)
# FIXME: Do not run for OS X framework
INSTALL(
FILES ${LIB_PUBLIC_HEADERS}
DESTINATION ${INSTALL_INCDIR}/${LIB_NAME}
COMPONENT libopenscenegraph-dev
)

View File

@@ -1,144 +0,0 @@
# This script sets up packaging targets for each "COMPONENT" as specified in INSTALL commands
#
# for each component a CPackConfig-<component>.cmake is generated in the build tree
# and a target is added to call cpack for it (e.g. package_openscenegaph
# A target for generating a package with everything that gets INSTALLED is generated (package_openscenegraph-all)
# A target for making all of the abaove packages is generated (package_ALL)
#
# package filenames are created on the form <package>-<platform>-<arch>[-<compiler>]-<build_type>[-static].tar.gz
# ...where compiler optionally set using a cmake gui (OSG_CPACK_COMPILER). This script tries to guess compiler version for msvc generators
# ...build_type matches CMAKE_BUILD_TYPE for all generators but the msvc ones
# resolve architecture. The reason i "change" i686 to i386 is that debian packages
# require i386 so this is for the future
IF("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
SET(SYSTEM_ARCH "i386")
ELSE()
SET(SYSTEM_ARCH ${CMAKE_SYSTEM_PROCESSOR})
ENDIF()
# set a default system name - use CMake setting (Linux|Windows|...)
SET(SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
#message(STATUS "CMAKE_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}")
#message(STATUS "CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}")
# for msvc the SYSTEM_NAME is set win32/64 instead of "Windows"
IF(MSVC)
IF(CMAKE_CL_64)
SET(SYSTEM_NAME "win64")
ELSE()
SET(SYSTEM_NAME "win32")
ENDIF()
ENDIF()
# Guess the compiler (is this desired for other platforms than windows?)
IF(NOT DEFINED OSG_CPACK_COMPILER)
INCLUDE(OsgDetermineCompiler)
ENDIF()
# expose the compiler setting to the user
SET(OSG_CPACK_COMPILER "${OSG_COMPILER}" CACHE STRING "This ia short string (vc90, vc80sp1, gcc-4.3, ...) describing your compiler. The string is used for creating package filenames")
IF(OSG_CPACK_COMPILER)
SET(OSG_CPACK_SYSTEM_SPEC_STRING ${SYSTEM_NAME}-${SYSTEM_ARCH}-${OSG_CPACK_COMPILER})
ELSE()
SET(OSG_CPACK_SYSTEM_SPEC_STRING ${SYSTEM_NAME}-${SYSTEM_ARCH})
ENDIF()
## variables that apply to all packages
SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENSCENEGRAPH_VERSION}")
# these goes for all platforms. Setting these stops the CPack.cmake script from generating options about other package compression formats (.z .tz, etc.)
IF(WIN32)
SET(CPACK_GENERATOR "ZIP")
ELSE()
SET(CPACK_GENERATOR "TGZ")
ENDIF()
SET(CPACK_SOURCE_GENERATOR "TGZ")
# for ms visual studio we use it's internally defined variable to get the configuration (debug,release, ...)
IF(MSVC_IDE)
SET(OSG_CPACK_CONFIGURATION "$(OutDir)")
SET(PACKAGE_TARGET_PREFIX "Package ")
ELSE()
# on un*x an empty CMAKE_BUILD_TYPE means release
IF(CMAKE_BUILD_TYPE)
SET(OSG_CPACK_CONFIGURATION ${CMAKE_BUILD_TYPE})
ELSE()
SET(OSG_CPACK_CONFIGURATION "Release")
ENDIF()
SET(PACKAGE_TARGET_PREFIX "package_")
ENDIF()
# Get all defined components
GET_CMAKE_PROPERTY(CPACK_COMPONENTS_ALL COMPONENTS)
IF(NOT CPACK_COMPONENTS_ALL)
# cmake 2.6.0 don't supply the COMPONENTS property.
# I set it manually to be the packages that can always be packaged
MESSAGE("When building packages please consider using cmake version 2.6.1 or above")
SET(CPACK_COMPONENTS_ALL libopenscenegraph libopenthreads openscenegraph libopenscenegraph-dev libopenthreads-dev)
ENDIF()
# Create a target that will be used to generate all packages defined below
SET(PACKAGE_ALL_TARGETNAME "${PACKAGE_TARGET_PREFIX}ALL")
ADD_CUSTOM_TARGET(${PACKAGE_ALL_TARGETNAME})
MACRO(GENERATE_PACKAGING_TARGET package_name)
SET(CPACK_PACKAGE_NAME ${package_name})
# the doc packages don't need a system-arch specification
IF(${package} MATCHES -doc)
SET(OSG_PACKAGE_FILE_NAME ${package_name}-${OPENSCENEGRAPH_VERSION})
ELSE()
SET(OSG_PACKAGE_FILE_NAME ${package_name}-${OPENSCENEGRAPH_VERSION}-${OSG_CPACK_SYSTEM_SPEC_STRING}-${OSG_CPACK_CONFIGURATION})
IF(NOT DYNAMIC_OPENSCENEGRAPH)
SET(OSG_PACKAGE_FILE_NAME ${OSG_PACKAGE_FILE_NAME}-static)
ENDIF()
ENDIF()
CONFIGURE_FILE("${OpenSceneGraph_SOURCE_DIR}/CMakeModules/OsgCPackConfig.cmake.in" "${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake" IMMEDIATE)
SET(PACKAGE_TARGETNAME "${PACKAGE_TARGET_PREFIX}${package_name}")
# This is naive and will probably need fixing eventually
IF(MSVC)
SET(MOVE_COMMAND "move")
ELSE()
SET(MOVE_COMMAND "mv")
ENDIF()
# Set in and out archive filenames. Windows = zip, others = tar.gz
IF(WIN32)
SET(ARCHIVE_EXT "zip")
ELSE()
SET(ARCHIVE_EXT "tar.gz")
ENDIF()
# Create a target that creates the current package
# and rename the package to give it proper filename
ADD_CUSTOM_TARGET(${PACKAGE_TARGETNAME})
ADD_CUSTOM_COMMAND(TARGET ${PACKAGE_TARGETNAME}
COMMAND ${CMAKE_CPACK_COMMAND} -C ${OSG_CPACK_CONFIGURATION} --config ${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake
COMMAND "${MOVE_COMMAND}" "${CPACK_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}" "${OSG_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}"
COMMAND ${CMAKE_COMMAND} -E echo "renamed ${CPACK_PACKAGE_FILE_NAME}.${ARCHIVE_EXT} -> ${OSG_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}"
COMMENT "Run CPack packaging for ${package_name}..."
)
# Add the exact same custom command to the all package generating target.
# I can't use add_dependencies to do this because it would allow parallell building of packages so am going brute here
ADD_CUSTOM_COMMAND(TARGET ${PACKAGE_ALL_TARGETNAME}
COMMAND ${CMAKE_CPACK_COMMAND} -C ${OSG_CPACK_CONFIGURATION} --config ${OpenSceneGraph_BINARY_DIR}/CPackConfig-${package_name}.cmake
COMMAND "${MOVE_COMMAND}" "${CPACK_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}" "${OSG_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}"
COMMAND ${CMAKE_COMMAND} -E echo "renamed ${CPACK_PACKAGE_FILE_NAME}.${ARCHIVE_EXT} -> ${OSG_PACKAGE_FILE_NAME}.${ARCHIVE_EXT}"
)
ENDMACRO(GENERATE_PACKAGING_TARGET)
# Create configs and targets for a package including all components
SET(OSG_CPACK_COMPONENT ALL)
GENERATE_PACKAGING_TARGET(openscenegraph-all)
# Create configs and targets for each component
FOREACH(package ${CPACK_COMPONENTS_ALL})
SET(OSG_CPACK_COMPONENT ${package})
GENERATE_PACKAGING_TARGET(${package})
ENDFOREACH()

View File

@@ -1,71 +0,0 @@
# This file will be configured to contain variables for CPack. These variables
# should be set in the CMake list file of the project before CPack module is
# included. Example variables are:
# CPACK_GENERATOR - Generator used to create package
# CPACK_INSTALL_CMAKE_PROJECTS - For each project (path, name, component)
# CPACK_CMAKE_GENERATOR - CMake Generator used for the projects
# CPACK_INSTALL_COMMANDS - Extra commands to install components
# CPACK_INSTALL_DIRECTORIES - Extra directories to install
# CPACK_PACKAGE_DESCRIPTION_FILE - Description file for the package
# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Summary of the package
# CPACK_PACKAGE_EXECUTABLES - List of pairs of executables and labels
# CPACK_PACKAGE_FILE_NAME - Name of the package generated
# CPACK_PACKAGE_ICON - Icon used for the package
# CPACK_PACKAGE_INSTALL_DIRECTORY - Name of directory for the installer
# CPACK_PACKAGE_NAME - Package project name
# CPACK_PACKAGE_VENDOR - Package project vendor
# CPACK_PACKAGE_VERSION - Package project version
# CPACK_PACKAGE_VERSION_MAJOR - Package project version (major)
# CPACK_PACKAGE_VERSION_MINOR - Package project version (minor)
# CPACK_PACKAGE_VERSION_PATCH - Package project version (patch)
# There are certain generator specific ones
# NSIS Generator:
# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Name of the registry key for the installer
# CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra commands used during uninstall
# CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra commands used during install
SET(CPACK_BINARY_BUNDLE "${CPACK_BINARY_BUNDLE}")
SET(CPACK_BINARY_CYGWIN "${CPACK_BINARY_CYGWIN}")
SET(CPACK_BINARY_DEB "${CPACK_BINARY_DEB}")
SET(CPACK_BINARY_NSIS "${CPACK_BINARY_NSIS}")
SET(CPACK_BINARY_OSXX11 "${CPACK_BINARY_OSXX11}")
SET(CPACK_BINARY_PACKAGEMAKER "${CPACK_BINARY_PACKAGEMAKER}")
SET(CPACK_BINARY_RPM "${CPACK_BINARY_RPM}")
SET(CPACK_BINARY_STGZ "${CPACK_BINARY_STGZ}")
SET(CPACK_BINARY_TBZ2 "${CPACK_BINARY_TBZ2}")
SET(CPACK_BINARY_TGZ "${CPACK_BINARY_TGZ}")
SET(CPACK_BINARY_TZ "${CPACK_BINARY_TZ}")
SET(CPACK_BINARY_ZIP "${CPACK_BINARY_ZIP}")
SET(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}")
SET(CPACK_COMPONENTS_ALL "${CPACK_COMPONENTS_ALL}")
SET(CPACK_COMPONENT_UNSPECIFIED_HIDDEN "TRUE")
SET(CPACK_COMPONENT_UNSPECIFIED_REQUIRED "TRUE")
SET(CPACK_GENERATOR "${CPACK_GENERATOR}")
SET(CPACK_INSTALL_CMAKE_PROJECTS "${OpenSceneGraph_BINARY_DIR};OpenSceneGraph;${OSG_CPACK_COMPONENT};/")
SET(CPACK_INSTALL_PREFIX "${CPACK_INSTALL_PREFIX}")
SET(CPACK_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;")
SET(CPACK_NSIS_DISPLAY_NAME "${CMAKE_PROJECT_NAME} ${OPENSCENEGRAPH_VERSION}")
SET(CPACK_NSIS_INSTALLER_ICON_CODE "")
SET(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
SET(CPACK_OUTPUT_CONFIG_FILE "${PROJECT_BINARY_DIR}/CPackConfig-${OSG_CPACK_COMPONENT}.cmake")
SET(CPACK_PACKAGE_DEFAULT_LOCATION "/")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${OpenSceneGraph_SOURCE_DIR}/README.txt")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The OpenSceneGraph is an open source high performance 3d graphics toolkit")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CMAKE_PROJECT_NAME}-${OPENSCENEGRAPH_VERSION}")
SET(CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
SET(CPACK_PACKAGE_RELOCATABLE "true")
SET(CPACK_PACKAGE_VENDOR "The OpenSceneGraph developers and contributors lead by Robert Osfield")
SET(CPACK_PACKAGE_VERSION "${OPENSCENEGRAPH_VERSION}")
SET(CPACK_PACKAGE_VERSION_MAJOR "${OPENSCENEGRAPH_MAJOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_MINOR "${OPENSCENEGRAPH_MINOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_PATCH "${OPENSCENEGRAPH_PATCH_VERSION}")
SET(CPACK_RESOURCE_FILE_LICENSE "${OpenSceneGraph_SOURCE_DIR}/LICENSE.txt")
SET(CPACK_RESOURCE_FILE_README "${OpenSceneGraph_SOURCE_DIR}/README.txt")
SET(CPACK_RESOURCE_FILE_WELCOME "${OpenSceneGraph_SOURCE_DIR}/NEWS.txt")
SET(CPACK_SET_DESTDIR "OFF")
SET(CPACK_STRIP_FILES "ON")

View File

@@ -1,81 +0,0 @@
# - Figure out what compiler (and version) cmake is generating for
# Once done this will define:
#
# Variable:
# OSG_COMPILER
#
IF(CMAKE_COMPILER_IS_GNUCXX)
EXEC_PROGRAM(
${CMAKE_CXX_COMPILER}
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
OUTPUT_VARIABLE gcc_compiler_version
)
#MESSAGE("GCC Version: ${gcc_compiler_version}")
ELSE(CMAKE_COMPILER_IS_GNUCXX)
IF(MSVC)
IF(MSVC60)
SET(OSG_COMPILER "vc60")
ENDIF(MSVC60)
IF(MSVC70)
SET(OSG_COMPILER "vc70")
ENDIF(MSVC70)
IF(MSVC71)
SET(OSG_COMPILER "vc71")
ENDIF(MSVC71)
IF(MSVC80)
SET(OSG_COMPILER "vc80")
ENDIF(MSVC80)
IF(MSVC90)
SET(OSG_COMPILER "vc90")
ENDIF(MSVC90)
IF(MSVC80)
MESSAGE(STATUS "Checking if compiler has service pack 1 installed...")
FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" "int main() {return 0;}\n")
TRY_COMPILE(_TRY_RESULT
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
CMAKE_FLAGS -D CMAKE_VERBOSE_MAKEFILE=ON
OUTPUT_VARIABLE OUTPUT
)
IF(_TRY_RESULT)
# parse for exact compiler version
STRING(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+" vc_compiler_version "${OUTPUT}")
IF(vc_compiler_version)
#MESSAGE("${vc_compiler_version}")
STRING(REGEX MATCHALL "[0-9]+" CL_VERSION_LIST "${vc_compiler_version}")
LIST(GET CL_VERSION_LIST 0 CL_MAJOR_VERSION)
LIST(GET CL_VERSION_LIST 1 CL_MINOR_VERSION)
LIST(GET CL_VERSION_LIST 2 CL_PATCH_VERSION)
LIST(GET CL_VERSION_LIST 3 CL_EXTRA_VERSION)
ENDIF(vc_compiler_version)
# Standard vc80 is 14.00.50727.42, sp1 14.00.50727.762, sp2?
# Standard vc90 is 9.0.30729.1, sp1 ?
IF(CL_EXTRA_VERSION EQUAL 762)
SET(OSG_COMPILER "vc80sp1")
ELSE(CL_EXTRA_VERSION EQUAL 762)
SET(OSG_COMPILER "vc80")
ENDIF(CL_EXTRA_VERSION EQUAL 762)
# parse for exact visual studio version
#IF(MSVC_IDE)
# string(REGEX MATCH "Visual Studio Version [0-9]+.[0-9]+.[0-9]+.[0-9]+" vs_version "${OUTPUT}")
# IF(vs_version)
# MESSAGE("${vs_version}")
# string(REGEX MATCHALL "[0-9]+" VS_VERSION_LIST "${vs_version}")
# list(GET VS_VERSION_LIST 0 VS_MAJOR_VERSION)
# list(GET VS_VERSION_LIST 1 VS_MINOR_VERSION)
# list(GET VS_VERSION_LIST 2 VS_PATCH_VERSION)
# list(GET VS_VERSION_LIST 3 VS_EXTRA_VERSION)
# ENDIF(vs_version)
#ENDIF(MSVC_IDE)
ENDIF(_TRY_RESULT)
ENDIF(MSVC80)
ENDIF(MSVC)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)

View File

@@ -21,22 +21,22 @@ MACRO(LINK_WITH_VARIABLES TRGTNAME)
ENDMACRO(LINK_WITH_VARIABLES TRGTNAME)
MACRO(LINK_INTERNAL TRGTNAME)
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
TARGET_LINK_LIBRARIES(${TRGTNAME} ${ARGN})
ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
FOREACH(LINKLIB ${ARGN})
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
#when using versioned names, the .dll name differ from .lib name, there is a problem with that:
#CMake 2.4.7, at least seem to use PREFIX instead of IMPORT_PREFIX for computing linkage info to use into projects,
# so we full path name to specify linkage, this prevent automatic inferencing of dependencies, so we add explicit depemdencies
#to library targets used
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${OUTPUT_LIBDIR}/${LINKLIB}.lib" debug "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_DEBUG_POSTFIX}.lib")
ADD_DEPENDENCIES(${TRGTNAME} ${LINKLIB})
ELSE(MSVC AND OSG_MSVC_VERSIONED_DLL)
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${LINKLIB}" debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
ENDFOREACH(LINKLIB)
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
FOREACH(LINKLIB ${ARGN})
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
#when using versioned names, the .dll name differ from .lib name, there is a problem with that:
#CMake 2.4.7, at least seem to use PREFIX instead of IMPORT_PREFIX for computing linkage info to use into projects,
# so we full path name to specify linkage, this prevent automatic inferencing of dependencies, so we add explicit depemdencies
#to library targets used
IF(NOT MSVC_IDE)
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${OUTPUT_LIBDIR}/${LINKLIB}.lib" debug "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_DEBUG_POSTFIX}.lib")
ELSE(NOT MSVC_IDE)
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${OUTPUT_LIBDIR}/${LINKLIB}" debug "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
ENDIF(NOT MSVC_IDE)
ADD_DEPENDENCIES(${TRGTNAME} ${LINKLIB})
ELSE(MSVC AND OSG_MSVC_VERSIONED_DLL)
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${LINKLIB}" debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
ENDFOREACH(LINKLIB)
ENDMACRO(LINK_INTERNAL TRGTNAME)
MACRO(LINK_EXTERNAL TRGTNAME)
@@ -118,7 +118,7 @@ ENDMACRO(SETUP_LINK_LIBRARIES)
MACRO(SETUP_PLUGIN PLUGIN_NAME)
SET(TARGET_NAME ${PLUGIN_NAME} )
SET(TARGET_NAME ${PLUGIN_NAME} )
#MESSAGE("in -->SETUP_PLUGIN<-- ${TARGET_NAME}-->${TARGET_SRC} <--> ${TARGET_H}<--")
@@ -130,15 +130,8 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
IF(NOT TARGET_LABEL)
SET(TARGET_LABEL "${TARGET_DEFAULT_LABEL_PREFIX} ${TARGET_NAME}")
ENDIF(NOT TARGET_LABEL)
## plugins gets put in libopenscenegraph by default
IF(${ARGC} GREATER 1)
SET(PACKAGE_COMPONENT libopenscenegraph-${ARGV1})
ELSE(${ARGC} GREATER 1)
SET(PACKAGE_COMPONENT libopenscenegraph)
ENDIF(${ARGC} GREATER 1)
# here we use the command to generate the library
# here we use the command to generate the library
IF (DYNAMIC_OPENSCENEGRAPH)
ADD_LIBRARY(${TARGET_TARGETNAME} MODULE ${TARGET_SRC} ${TARGET_H})
@@ -148,57 +141,40 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
#not sure if needed, but for plugins only Msvc need the d suffix
IF(NOT MSVC)
IF(NOT UNIX)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "")
ENDIF(NOT UNIX)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "")
ELSE(NOT MSVC)
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
IF(NOT MSVC_IDE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "${OSG_PLUGINS}/")
ELSE(NOT MSVC_IDE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../${OSG_PLUGINS}/")
ENDIF(NOT MSVC_IDE)
ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
IF(OSG_MSVC_VERSIONED_DLL)
IF(OSG_MSVC_VERSIONED_DLL)
#this is a hack... the build place is set to lib/<debug or release> by LIBARARY_OUTPUT_PATH equal to OUTPUT_LIBDIR
#the .lib will be crated in ../ so going straight in lib by the IMPORT_PREFIX property
#because we want dll placed in OUTPUT_BINDIR ie the bin folder sibling of lib, we can use ../../bin to go there,
#it is hardcoded, we should compute OUTPUT_BINDIR position relative to OUTPUT_LIBDIR ... to be implemented
#changing bin to something else breaks this hack
#the dll are placed in bin/${OSG_PLUGINS}
IF(NOT MSVC_IDE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../bin/${OSG_PLUGINS}/")
ELSE(NOT MSVC_IDE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../../bin/${OSG_PLUGINS}/" IMPORT_PREFIX "../")
ENDIF(NOT MSVC_IDE)
ELSE(OSG_MSVC_VERSIONED_DLL)
#in standard mode (unversioned) the .lib and .dll are placed in lib/<debug or release>/${OSG_PLUGINS}.
#here the PREFIX property has been used, the same result would be accomplidhe by prepending ${OSG_PLUGINS}/ to OUTPUT_NAME target property
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "${OSG_PLUGINS}/")
ENDIF(OSG_MSVC_VERSIONED_DLL)
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
ELSE(OSG_MSVC_VERSIONED_DLL)
#in standard mode (unversioned) the .lib and .dll are placed in lib/<debug or release>/${OSG_PLUGINS}.
#here the PREFIX property has been used, the same result would be accomplidhe by prepending ${OSG_PLUGINS}/ to OUTPUT_NAME target property
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "${OSG_PLUGINS}/")
ENDIF(OSG_MSVC_VERSIONED_DLL)
ENDIF(NOT MSVC)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
SETUP_LINK_LIBRARIES()
#the installation path are differentiated for win32 that install in bib versus other architecture that install in lib${LIB_POSTFIX}/${OSG_PLUGINS}
IF(WIN32)
INSTALL(TARGETS ${TARGET_TARGETNAME}
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
ARCHIVE DESTINATION lib/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib/${OSG_PLUGINS} LIBRARY DESTINATION bin/${OSG_PLUGINS} )
ELSE(WIN32)
INSTALL(TARGETS ${TARGET_TARGETNAME}
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} )
ENDIF(WIN32)
ENDMACRO(SETUP_PLUGIN)
@@ -251,15 +227,12 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
ADD_EXECUTABLE(${TARGET_TARGETNAME} ${PLATFORM_SPECIFIC_CONTROL} ${TARGET_SRC} ${TARGET_H})
ENDIF(${IS_COMMANDLINE_APP})
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES OUTPUT_NAME ${TARGET_NAME})
IF(MSVC_IDE AND OSG_MSVC_VERSIONED_DLL)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../")
ENDIF(MSVC_IDE AND OSG_MSVC_VERSIONED_DLL)
SETUP_LINK_LIBRARIES()
ENDMACRO(SETUP_EXE)
@@ -277,11 +250,7 @@ MACRO(SETUP_APPLICATION APPLICATION_NAME)
SETUP_EXE(${IS_COMMANDLINE_APP})
IF(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin BUNDLE DESTINATION bin)
ELSE(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin COMPONENT openscenegraph )
ENDIF(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin )
ENDMACRO(SETUP_APPLICATION)
@@ -304,11 +273,7 @@ MACRO(SETUP_EXAMPLE EXAMPLE_NAME)
SETUP_EXE(${IS_COMMANDLINE_APP})
IF(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin BUNDLE DESTINATION share/OpenSceneGraph/bin )
ELSE(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples )
ENDIF(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin )
ENDMACRO(SETUP_EXAMPLE)
@@ -321,12 +286,12 @@ ENDMACRO(SETUP_COMMANDLINE_EXAMPLE)
# Takes two optional arguments -- osg prefix and osg version
MACRO(HANDLE_MSVC_DLL)
#this is a hack... the build place is set to lib/<debug or release> by LIBARARY_OUTPUT_PATH equal to OUTPUT_LIBDIR
#the .lib will be crated in ../ so going straight in lib by the IMPORT_PREFIX property
#because we want dll placed in OUTPUT_BINDIR ie the bin folder sibling of lib, we can use ../../bin to go there,
#it is hardcoded, we should compute OUTPUT_BINDIR position relative to OUTPUT_LIBDIR ... to be implemented
#changing bin to something else breaks this hack
#the dll are versioned by prefixing the name with osg${OPENSCENEGRAPH_SOVERSION}-
#this is a hack... the build place is set to lib/<debug or release> by LIBARARY_OUTPUT_PATH equal to OUTPUT_LIBDIR
#the .lib will be crated in ../ so going straight in lib by the IMPORT_PREFIX property
#because we want dll placed in OUTPUT_BINDIR ie the bin folder sibling of lib, we can use ../../bin to go there,
#it is hardcoded, we should compute OUTPUT_BINDIR position relative to OUTPUT_LIBDIR ... to be implemented
#changing bin to something else breaks this hack
#the dll are versioned by prefixing the name with osg${OPENSCENEGRAPH_SOVERSION}-
# LIB_PREFIX: use "osg" by default, else whatever we've been given.
IF(${ARGC} GREATER 0)
@@ -344,20 +309,18 @@ MACRO(HANDLE_MSVC_DLL)
IF(NOT MSVC_IDE)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../bin/${LIB_PREFIX}${LIB_SOVERSION}-")
IF (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
SET(NEW_LIB_NAME "${OUTPUT_BINDIR}/${LIB_PREFIX}${LIB_SOVERSION}-${LIB_NAME}")
ADD_CUSTOM_COMMAND(
TARGET ${LIB_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${NEW_LIB_NAME}.lib" "${OUTPUT_LIBDIR}/${LIB_NAME}.lib"
COMMAND ${CMAKE_COMMAND} -E copy "${NEW_LIB_NAME}.exp" "${OUTPUT_LIBDIR}/${LIB_NAME}.exp"
COMMAND ${CMAKE_COMMAND} -E remove "${NEW_LIB_NAME}.lib"
COMMAND ${CMAKE_COMMAND} -E remove "${NEW_LIB_NAME}.exp"
)
ENDIF (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
ELSE(NOT MSVC_IDE)
SET(NEW_LIB_NAME "${OUTPUT_BINDIR}/${LIB_PREFIX}${LIB_SOVERSION}-${LIB_NAME}")
ADD_CUSTOM_COMMAND(
TARGET ${LIB_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${NEW_LIB_NAME}.lib" "${OUTPUT_LIBDIR}/${LIB_NAME}.lib"
COMMAND ${CMAKE_COMMAND} -E copy "${NEW_LIB_NAME}.exp" "${OUTPUT_LIBDIR}/${LIB_NAME}.exp"
COMMAND ${CMAKE_COMMAND} -E remove "${NEW_LIB_NAME}.lib"
COMMAND ${CMAKE_COMMAND} -E remove "${NEW_LIB_NAME}.exp"
)
ELSE(NOT MSVC_IDE)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
ENDIF(NOT MSVC_IDE)
ENDIF(NOT MSVC_IDE)
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/osg${OPENSCENEGRAPH_SOVERSION}-")
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES IMPORT_PREFIX "../")

View File

@@ -1,13 +0,0 @@
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## ENABLE_TESTING()
## INCLUDE(Dart)
set(CTEST_PROJECT_NAME "OpenSceneGraph")
set(CTEST_NIGHTLY_START_TIME "00:00:00 CET")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "cdash.openscenegraph.org")
set(CTEST_DROP_LOCATION "/submit.php?project=OpenSceneGraph")
set(CTEST_DROP_SITE_CDASH TRUE)

44998
ChangeLog

File diff suppressed because it is too large Load Diff

View File

@@ -13,9 +13,8 @@
under the terms of the OpenSceneGraph Public License (OSGPL) version 0.0
or later.
Notes: the OSGPL is based on the LGPL, with the 4 exceptions laid
out in the wxWindows section below. The LGPL is contained in the
final section of this license.
Notes: the OSGPL is based on the LGPL, with the 4 exceptions laid in the wxWindows
section below. The LGPL in the final section of this license.
-------------------------------------------------------------------------------
@@ -188,7 +187,7 @@ modification follow. Pay close attention to the difference between a
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other

277
NEWS.txt
View File

@@ -1,283 +1,6 @@
OSG News
========
= !OpenSceneGraph 2.8.2 release - bug fix release =
PERTHSHIRE, Scotland - 28th July 2009 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 2.8.2, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 2.8 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 2.8 runs on all Microsoft Windows platforms, Apple OS/X, GNU/Linux, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
=== Open-source development delivers industry-leading features and performance ===
The !OpenSceneGraph 2.8.2 release is the culmination of 10 years of work by the lead developers and the open-source community that has grown up around the project. The real-time graphics industry and academia embraced it from the very beginning, deploying it in real-world applications, and actively participating in its development, testing and refinement. The end result is a high-quality library with a feature set relevant to application developers' needs.
=== Updates between 2.8.2 and 2.8.1 releases include: ===
* Build fixes for:
* !RedHat Enterprise Linux
* Building of dicom plugin with ITK under Linux
* Crash fixes to:
* crash during window destruction under Windows when using closing a MFC based !GraphicsWindow
* deadlock under Windows due threading issues with atomic operations in Win32 Barrier implementation
* !OpenFlight plugin crashed due to not handling spaces at the end of option strings
* !OpenFlight plugin crashed when exported scene graphs contain no TexEnv objects
* osganimationtimeline crashed when example model was not found
* Bug fixes to :
* vertical anchor in osgWidget::Widow was inverted
* bsp an mdl plugins to better handling transparency and lighting
* computation of sector range in osgSim::!LightPoint
* extension checking of FBO packed stencil support
* position of tabs at corners of manipulators
* threading bug in .osg plugin that occurred during multi-threaded initialization
* alignment of Text what setting alignment after assign text string
* loading of compressed texture arrays
* texture generate mipmap for non power of two textures
* regression in X11 key symbol remapping, improved support for Russian keyboards
* regression of !StencilMask setting in !RenderStage
* small memory leak in X11 usage
* Transform::computeBound() double !BoundingSphere support
* Resize handling when master and slave Cameras share the same !GraphicsContext
* Handling of locale in plugins and env var parsing so it always follows the '.' decimal place convention regardless of the desktop/application locale.
=== Updates between 2.8.1 and 2.8.0 releases include: ===
* Build fixes under FreeBSD and IBM AIX, and RedHat Enterprise Linux
* Improved compatibility with SWIG wrapper building
* Crash fixes in osg::State, osg::Geometry and osgWidget
* Bug fixes to :
* draw instanced support
* Optimizer - MergeGeometryVisitor, RemoveLoadedProxyNodesVisitor and SpatializeGroupsVistor
* hdr image loader
* handling of opacity maps in 3ds loader
* dxf loader
* frame buffer object
* cursor/event handling in windows
* windows threading
* memory leak in Collada loader
* fixes to display lists/vbo creation that prevent crash under ATI drivers
* subface PolygonOffset setting in OpenFlight
* osgconv --formats under OSX
* osgTerrain::Layer bounding volume calculation
=== Updates between 2.8 and 2.6 include: ===
* New osgVolume library for volume rendering, with support for:
* High quality GPU based Ray tracing
* Transfer functions
* Per pixel lighting
* Iso surface rendering
* Maximum Intensity Projection rendering
* Non-power-of-two 3D textures, and 3D texture compression
* DICOM loading for reading dicom medical data
* New osgAnimation library for character and scene animation.
* New plugin for reading Biovision hierarchical files (.BVH) to generate character motion animations.
* New osgShadow support for Light Space Perspective Shadow Maps (LispSM).
* Three new scene graph widgets for placing traditional 2D capability into fully interactive 3D scenes:
* PDF widget (based on libPoppler)
* VNC client widget (based on libVNCServer)
* Internet browser client widget (based on Gecko/UBrowser)
* New plugins for loading Half-Life 2 maps and models.
* New plugin for loading EXR, high dynamic range imagery
* Improvements to !DatabasePager, tailored for low latency paging.
* Improved runtime stats collection and on screen reporting.
* Performance improvements through optimization of matrix operations.
* Support for the OpenGL "draw instanced" extension.
* Support for zlib compressed native .ive and .gz files
* Improvements to COLLADA support.
* Build reporting using CDash
* New packaging support using CPack
* A wide range of build and bug fixes
=== 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/projects/osg/wiki/Downloads 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.
=== !OpenSceneGraph Books now available ===
The !OpenSceneGraph Quick Start Guide is now available in Chinese as well as English, and alongside the Reference Manual, books can be found at [http://www.osgbooks.com OsgBooks].
=== 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.skew-matrix.com Skew-Matrix] and [http://www.blue-newt.com Blue-Newt Software] both 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 2000 developers is centred around the public osg-users mailing list, 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/projects/osg/wiki/Support/Contributors/TwoPointEight 365 individuals] from around the world that have directly contributed to the development and refinement of the !OpenSceneGraph code base.
----
About !OpenSceneGraph: [[BR]]
The !OpenSceneGraph Project was founded in September 1999 by Don Burns and Robert Osfield.
Further information, screenshots, downloads, documentation, and support links can be found on the !OpenSceneGraph project website http://www.openscenegraph.org.
About !OpenSceneGraph Professional Services:[[BR]]
!OpenSceneGraph Professional Services, founded by project lead Robert Osfield in April 2001, is based in Callander, Perhshire, Scotland, and provides professional services on top of !OpenSceneGraph. Further information about the services it provides can be found at http://www.openscenegraph.com.
----------------------------------------------------------------------------------------
= !OpenSceneGraph 2.8.1 release - bug fix release =
PERTHSHIRE, Scotland - 19th May 2009 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 2.8.1, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 2.8 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 2.8 runs on all Microsoft Windows platforms, Apple OS/X, GNU/Linux, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
=== Open-source development delivers industry-leading features and performance ===
The !OpenSceneGraph 2.8.1 release is the culmination of 10 years of work by the lead developers and the open-source community that has grown up around the project. The real-time graphics industry and academia embraced it from the very beginning, deploying it in real-world applications, and actively participating in its development, testing and refinement. The end result is a high-quality library with a feature set relevant to application developers' needs.
=== Updates between 2.8.1 and 2.8.0 releases include: ===
* Build fixes under FreeBSD and IBM AIX, and RedHat Enterprise Linux.
* Improved compatibility with SWIG wrapper building
* Crash fixes in osg::State, osg::Geometry and osgWidget.
* Bug fixes to :
* draw instanced support
* Optimizer - MergeGeometryVisitor, RemoveLoadedProxyNodesVisitor and SpatializeGroupsVistor
* hdr image loader
* handling of opacity maps in 3ds loader
* dxf loader
* frame buffer object
* cursor/event handling in windows
* windows threading
* memory leak in Collada loader
* fixes to display lists/vbo creation that prevent crash under ATI drivers
* subface PolygonOffset setting in OpenFlight
* osgconv --formats under OSX
* osgTerrain::Layer bounding volume calculation.
=== Updates between 2.8 and 2.6 include: ===
* New osgVolume library for volume rendering, with support for:
* High quality GPU based Ray tracing
* Transfer functions
* Per pixel lighting
* Iso surface rendering
* Maximum Intensity Projection rendering
* Non-power-of-two 3D textures, and 3D texture compression
* DICOM loading for reading dicom medical data
* New osgAnimation library for character and scene animation.
* New plugin for reading Biovision hierarchical files (.BVH) to generate character motion animations.
* New osgShadow support for Light Space Perspective Shadow Maps (LispSM).
* Three new scene graph widgets for placing traditional 2D capability into fully interactive 3D scenes:
* PDF widget (based on libPoppler)
* VNC client widget (based on libVNCServer)
* Internet browser client widget (based on Gecko/UBrowser)
* New plugins for loading Half-Life 2 maps and models.
* New plugin for loading EXR, high dynamic range imagery
* Improvements to !DatabasePager, tailored for low latency paging.
* Improved runtime stats collection and on screen reporting.
* Performance improvements through optimization of matrix operations.
* Support for the OpenGL "draw instanced" extension.
* Support for zlib compressed native .ive and .gz files
* Improvements to COLLADA support.
* Build reporting using CDash
* New packaging support using CPack
* A wide range of build and bug fixes
=== 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/projects/osg/wiki/Downloads 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.
=== !OpenSceneGraph Books now available ===
The !OpenSceneGraph Quick Start Guide is now available in Chinese as well as English, and alongside the Reference Manual, books can be found at [http://www.osgbooks.com OsgBooks].
=== 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.skew-matrix.com Skew-Matrix] and [http://www.blue-newt.com Blue-Newt Software] both 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 2000 developers is centred around the public osg-users mailing list, 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/projects/osg/wiki/Support/Contributors/TwoPointEight 365 individuals] from around the world that have directly contributed to the development and refinement of the !OpenSceneGraph code base.
----
About !OpenSceneGraph: [[BR]]
The !OpenSceneGraph Project was founded in September 1999 by Don Burns and Robert Osfield.
Further information, screenshots, downloads, documentation, and support links can be found on the !OpenSceneGraph project website http://www.openscenegraph.org.
About !OpenSceneGraph Professional Services:[[BR]]
!OpenSceneGraph Professional Services, founded by project lead Robert Osfield in April 2001, is based in Callander, Perhshire, Scotland, and provides professional services on top of !OpenSceneGraph. Further information about the services it provides can be found at http://www.openscenegraph.com.
----------------------------------------------------------------------------------------
= !OpenSceneGraph 2.6 release adds osgWidget library, KdTree intersections, Anti-aliased FBOsand much more. =
PERTHSHIRE, Scotland - 5th August 2008 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 2.6, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 2.6 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 2.6 runs on all Microsoft Windows platforms, Apple OS/X, GNU/Linux, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
=== Open-source development delivers industry-leading features and performance ===
The !OpenSceneGraph 2.6 release is the culmination of 9 years of work by the lead developers and the open-source community that has grown up around the project. The real-time graphics industry and academia embraced it from the very beginning, deploying it in real-world applications, and actively participating in its development, testing and refinement. The end result is a high-quality library with a feature set relevant to application developers' needs.
=== Updates include: ===
* New osgWidget library for scene graph based graphics user interface elements (beta release).
* KdTree support, with automatic KdTree generation on load and use of KdTree during line intersections which massively improves intersection speeds.
* Precision improvements to line intersections, provide accurate whole earth intersection.
* OpenGL Multi-sample FrameBufferObject support.
* New osg::ImageSequence class for doing texture animation of a series of image files.
* New database optimizer that is able to remove static transforms by duplicating shared geometries.
* Use glGenerateMipmap to speed up mipmap generation in non power-of-two textures.
* New osgViewer::ScreenCaptureHandler for adding screen shot support to osgViewer applications.
* New osgscreencapture example that demonstrates use of double buffer PixelBufferObject's for streaming of imagery from the screen.
* New utility application osgfilecache which can be used to populate the local cache for given lat/lon ranges and levels.
* Rewritten DatabasePager that now supports multiple database reading threads. This includes handling of HTTP requests via a separate reading thread, vastly improving the speed of updates when handling HTTP hosted databases that have already partially been downloaded to local file cache.
* Support for a file cache for locally caching paged databases hosted over HTTP.
* Support for http authentication in osgDB and the libcurl plugin
* New osgconv --format <fmt>, --formats and --plugins command line options for listing available plugins and the file formats/options they support.
* Performance improvements in handling TerraPage.
* Animated GIF support.
* New SVG image loader.
* Improvements to the .obj loader to support a wider range of .obj files and material properties.
* Support for thread safe Atomic reference counting.
* Support for COLLADA DOM 2.x
* Support for Philips WOWvx 3D auto-stereoscopic displays
* New include/osg/Config and include/OpenThreads/Config configuration files, that are automatically generated by CMake, which make more straight forward to build end users applications against OpenSceneGraph versions built with non default build options.
* Support for CMake 2.6
* A wide range of build and bug fixes
=== 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/projects/osg/wiki/Downloads 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.
=== !OpenSceneGraph Books now available ===
The !OpenSceneGraph Quick Start Guide is now available in Chinese as well as English, and alongside the Reference Manual books can be found at [http://www.osgbooks.com OsgBooks].
=== Professional support and services ===
!OpenSceneGraph project is backed up with professional services by [http://openscenegraph.com OpenSceneGraph Professional Services], based in Scotland, and [http://www.skew-matrix.com Skew-Matrix] and [http://www.blue-newt.com Blue-Newt Software] both 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 1900 developers is centred around the public osg-users mailing list, 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/projects/osg/wiki/Support/Contributors/TwoPointSix 324 individuals] from around the world that have directly contributed to the development and refinement of the !OpenSceneGraph code base.
----
About !OpenSceneGraph:[[BR]]
!OpenSceneGraph Project was founded in September 1999 by Don Burns and Robert Osfield.
Further information, screenshots, downloads, documentation, and support links can be found on the !OpenSceneGraph project website http://www.openscenegraph.org.
About !OpenSceneGraph Professional Services:[[BR]]
!OpenSceneGraph Professional Services, founded by project lead Robert Osfield in April 2001, is based in Callander, Perhshire, Scotland, and provides professional services on top of !OpenSceneGraph. Further information about the services it provides can be found at http://www.openscenegraph.com.
----------------------------------------------------------------------------------------
= !OpenSceneGraph 2.4 release adds geometry shaders, multiple render targets, support for terrabyte scale terrain databases, writing to !OpenFlight and much more. =
PERTHSHIRE, Scotland - 25th April 2008 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 2.4, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 2.4 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 2.4 runs on all Microsoft Windows platforms, Apple OS/X, GNU/Linux, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.

View File

@@ -5,8 +5,8 @@ REM trees.
REM mew 2004-07-16
cd ..\..
set PATH=%CD%\OpenThreads\bin\win32;%CD%\bin;%CD%\3rdParty\bin;%PATH%
set OSG_FILE_PATH=%CD%\OpenSceneGraph-Data;%OSG_FILE_PATH%
set PATH=%CD%\OpenThreads\bin\win32;%CD%\OpenSceneGraph\bin\win32;%CD%\3rdParty\bin;%PATH%
set OSG_FILE_PATH=%CD%\OpenSceneGraph-Data;%CD%\OpenSceneGraph-Data\Images;%CD%\OpenSceneGraph-Data\fonts;%OSG_FILE_PATH%
REM uncomment one of these for your desired notify level...
rem set OSG_NOTIFY_LEVEL=ALWAYS

View File

@@ -12,9 +12,10 @@ subscribe to our public mailing list:
http://www.openscenegraph.org/projects/osg/wiki/MailingLists
Robert Osfield.
Project Lead.
28th July 2009.
25th April 2008.
--
@@ -65,82 +66,9 @@ system should help guide you through the process:
Under OSX you can either use the CMake build system above, or use the
Xcode projects that you will find in the OpenSceneGraph/Xcode
directory. See release notes on OSX CMake build below.
directory.
For further details on compilation, installation and platform-specific
information read "Getting Started" guide:
http://www.openscenegraph.org/projects/osg/wiki/Support/GettingStarted
-- Release notes on OSX build, by Eric Sokolowsky, August 5, 2008
There are several ways to compile OpenSceneGraph under OSX. The
recommended way is to use CMake 2.6 to generate Xcode projects, then use
Xcode to build the library. The default project will be able to build
Debug or Release libraries, examples, and sample applications. Here are
some key settings to consider when using CMake:
BUILD_OSG_EXAMPLES - By default this is turned off. Turn this setting on
to compile many great example programs.
CMAKE_OSX_ARCHITECTURES - Xcode can create applications, executables,
libraries, and frameworks that can be run on more than one architecture.
Use this setting to indicate the architectures on which to build OSG.
Possibilities include ppc, ppc64, i386, and x86_64. Building OSG using
either of the 64-bit options (ppc64 and x86_64) has its own caveats
below.
OSG_BUILD_APPLICATION_BUNDLES - Normally only executable binaries are
created for the examples and sample applications. Turn this option on if
you want to create real OSX .app bundles. There are caveats to creating
.app bundles, see below.
OSG_WINDOWING_SYSTEM - You have the choice to use Carbon or X11 when
building applications on OSX. Under Leopard and later, X11 applications,
when started, will automatically launch X11 when needed. However,
full-screen X11 applications will still show the menu bar at the top of
the screen. Since many parts of the Carbon user interface are not
64-bit, X11 is the only supported option for OSX applications compiled
for ppc64 or x86_64.
There is an Xcode directory in the base of the OSG software
distribution, but its future is limited, and will be discontinued once
the CMake project generator completely implements its functionality.
APPLICATION BUNDLES (.app bundles)
The example programs when built as application bundles only contain the
executable file. They do not contain the dependent libraries as would a
normal bundle, so they are not generally portable to other machines.
They also do not know where to find plugins. An environmental variable
OSG_LIBRARY_PATH may be set to point to the location where the plugin
.so files are located. OSG_FILE_PATH may be set to point to the location
where data files are located. Setting OSG_FILE_PATH to the
OpenSceneGraph-Data directory is very useful when testing OSG by running
the example programs.
Many of the example programs use command-line arguments. When
double-clicking on an application (or using the equivalent "open"
command on the command line) only those examples and applications that
do not require command-line arguments will successfully run. The
executable file within the .app bundle can be run from the command-line
if command-line arguments are needed.
64-BIT APPLICATION SUPPORT
OpenSceneGraph will not compile successfully when OSG_WINDOWING_SYSTEM is
Carbon and either x86_64 or ppc64 is selected under CMAKE_OSX_ARCHITECTURES,
as Carbon is a 32bit only API. A version of the osgviewer library written in
Cocoa is needed. However, OSG may be compiled under 64-bits if the X11
windowing system is selected. However, Two parts of the OSG default
distribution will not work with 64-bit X11: the osgviewerWX example
program and the osgdb_qt (Quicktime) plugin. These must be removed from
the Xcode project after Cmake generates it in order to compile with
64-bit architectures. The lack of the latter means that images such as
jpeg, tiff, png, and gif will not work, nor will animations dependent on
Quicktime. A new ImageIO-based plugin is being developed to handle the
still images, and a QTKit plugin will need to be developed to handle
animations.

File diff suppressed because it is too large Load Diff

View File

@@ -1,20 +0,0 @@
#ifndef _OPENTHREADS_CONFIG
#define _OPENTHREADS_CONFIG
#include <AvailabilityMacros.h>
#define _OPENTHREADS_ATOMIC_USE_MUTEX
#if defined(MAC_OS_X_VERSION_10_5)
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
#define _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC
#undef _OPENTHREADS_ATOMIC_USE_MUTEX
#endif
#endif
/* #undef _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS */
/* #undef _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS */
/* #undef _OPENTHREADS_ATOMIC_USE_SUN */
/* #undef _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED */
/* #undef _OPENTHREADS_ATOMIC_USE_MUTEX */
#endif

View File

@@ -1,10 +0,0 @@
#ifndef OSG_CONFIG
#define OSG_CONFIG 1
/* #undef OSG_USE_FLOAT_MATRIX */
/* #undef OSG_USE_FLOAT_PLANE */
#define OSG_USE_FLOAT_BOUNDINGSPHERE
#define OSG_USE_FLOAT_BOUNDINGBOX
/* #undef OSG_ENFORCE_THREADSAFE */
#endif

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>osgAnimation</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.OpenSceneGraph.osgAnimation</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.7.0</string>
</dict>
</plist>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>osgVolume</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.OpenSceneGraph.osgVolume</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.7.0</string>
</dict>
</plist>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>osgWidget</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.OpenSceneGraph.osgWidget</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.2.0</string>
</dict>
</plist>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>osgWidget</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.OpenSceneGraph.osgWidget</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.2.0</string>
</dict>
</plist>

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>osganimationviewer</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.OpenSceneGraph.osganimationviewer</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string></string>
</dict>
</plist>

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>osgimagesequence</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.OpenSceneGraph.osgimagesequence</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string></string>
</dict>
</plist>

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>osgmanipulator-example</string>
<string>osgmanipulator</string>
<key>CFBundleIdentifier</key>
<string>com.MySoftwareCompany.osgmanipulator</string>
<key>CFBundleVersion</key>

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>osgwidgetmenu</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.OpenSceneGraph.osgwidgetmenu</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string></string>
</dict>
</plist>

View File

@@ -26,20 +26,19 @@ SET(TARGET_COMMON_LIBRARIES
osgText
)
IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgviewer)
ADD_SUBDIRECTORY(osgarchive)
ADD_SUBDIRECTORY(osgconv)
ADD_SUBDIRECTORY(osgversion)
ADD_SUBDIRECTORY(osgviewer)
ADD_SUBDIRECTORY(osgarchive)
ADD_SUBDIRECTORY(osgconv)
ADD_SUBDIRECTORY(osgfilecache)
ADD_SUBDIRECTORY(osgversion)
#REWRITE_CMAKELIST(ADD_OSG_EXAMPLE)
ELSE(DYNAMIC_OPENSCENEGRAPH)
# need to define this on win32 or linker cries about _declspecs
ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
ADD_SUBDIRECTORY(osgversion)
ENDIF(DYNAMIC_OPENSCENEGRAPH)
#MESSAGE("---->${MY_EXAMPLE_LIST}<---------")
##########to get all the variables of Cmake
#GET_CMAKE_PROPERTY(MYVARS VARIABLES)
#FOREACH(myvar ${MYVARS})
# FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/AllVariables.txt
# "${myvar} -->${${myvar}}<-\n"
# )
#ENDFOREACH(myvar)

View File

@@ -79,12 +79,7 @@ int main( int argc, char **argv )
else if (fileType==osgDB::DIRECTORY)
{
osgDB::DirectoryContents directory = osgDB::getDirectoryContents(arguments[pos]);
osgDB::DirectoryContents::iterator it = directory.begin();
while( it != directory.end())
{
files.push_back(filePath + "/" + (*it));
++it;
}
files.insert(files.end(),directory.begin(),directory.end());
}
}
else

View File

@@ -1,13 +1,7 @@
#this file is automatically generated
SET(TARGET_SRC
OrientationConverter.cpp
osgconv.cpp
)
SET(TARGET_H
OrientationConverter.h
)
SET(TARGET_SRC OrientationConverter.cpp osgconv.cpp )
SET(TARGET_H OrientationConverter.h )
#### end var setup ###
SETUP_APPLICATION(osgconv)

View File

@@ -17,7 +17,6 @@
#include <osgDB/WriteFile>
#include <osgDB/FileNameUtils>
#include <osgDB/ReaderWriter>
#include <osgDB/PluginQuery>
#include <osgUtil/Optimizer>
#include <osgUtil/Simplifier>
@@ -493,17 +492,6 @@ static void usage( const char *prog, const char *msg )
" their own color values (--addMissingColours also accepted)."<< std::endl;
osg::notify(osg::NOTICE)<<" --overallNormal - Replace normals with a single overall normal."<< std::endl;
osg::notify( osg::NOTICE ) << std::endl;
osg::notify( osg::NOTICE ) <<
" --formats - Lists all supported formats and their supported options." << std::endl;
osg::notify( osg::NOTICE ) <<
" --format <format> - Displays information about the spefied <format>, where <format>\n"
" is the file extension, such as \"flt\"." << std::endl;
osg::notify( osg::NOTICE ) <<
" --plugins - Lists all supported plugin files." << std::endl;
osg::notify( osg::NOTICE ) <<
" --plugin >plugin> - Displays information about the spefied <plugin>, where <plugin>\n"
" is the plugin's full path and file name." << std::endl;
}
@@ -518,8 +506,6 @@ int main( int argc, char **argv )
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");
arguments.getApplicationUsage()->addCommandLineOption("--help-env","Display environmental variables available");
//arguments.getApplicationUsage()->addCommandLineOption("--formats","List supported file formats");
//arguments.getApplicationUsage()->addCommandLineOption("--plugins","List database olugins");
// if user request help write it out to cout.
@@ -536,45 +522,6 @@ int main( int argc, char **argv )
return 1;
}
if (arguments.read("--plugins"))
{
osgDB::FileNameList plugins = osgDB::listAllAvailablePlugins();
for(osgDB::FileNameList::iterator itr = plugins.begin();
itr != plugins.end();
++itr)
{
std::cout<<"Plugin "<<*itr<<std::endl;
}
return 0;
}
std::string plugin;
if (arguments.read("--plugin", plugin))
{
osgDB::outputPluginDetails(std::cout, plugin);
return 0;
}
std::string ext;
if (arguments.read("--format", ext))
{
plugin = osgDB::Registry::instance()->createLibraryNameForExtension(ext);
osgDB::outputPluginDetails(std::cout, plugin);
return 0;
}
if (arguments.read("--formats"))
{
osgDB::FileNameList plugins = osgDB::listAllAvailablePlugins();
for(osgDB::FileNameList::iterator itr = plugins.begin();
itr != plugins.end();
++itr)
{
osgDB::outputPluginDetails(std::cout,*itr);
}
return 0;
}
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
@@ -593,6 +540,7 @@ int main( int argc, char **argv )
osgDB::Registry::instance()->setOptions(options);
}
std::string ext;
while (arguments.read("-e",ext))
{
std::string libName = osgDB::Registry::instance()->createLibraryNameForExtension(ext);

View File

@@ -1,7 +0,0 @@
SET(TARGET_SRC osgfilecache.cpp )
SET(TARGET_ADDED_LIBRARIES osgTerrain )
#### end var setup ###
SETUP_APPLICATION(osgfilecache)

View File

@@ -1,489 +0,0 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This application is open source and may be redistributed and/or modified
* freely and without restriction, both in commericial and non commericial applications,
* as long as this copyright notice is maintained.
*
* This application 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.
*/
#include <osg/Timer>
#include <osg/ArgumentParser>
#include <osg/ApplicationUsage>
#include <osg/CoordinateSystemNode>
#include <osg/Geometry>
#include <osg/io_utils>
#include <osgTerrain/TerrainTile>
#include <osgDB/Archive>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgDB/FileUtils>
#include <osgDB/FileCache>
#include <osgDB/FileNameUtils>
#include <iostream>
#include <algorithm>
#include <signal.h>
#include <stdlib.h>
static bool s_ExitApplication = false;
struct Extents
{
Extents():
_maxLevel(0),
_min(DBL_MAX,DBL_MAX),
_max(-DBL_MAX,-DBL_MAX) {}
Extents(unsigned int maxLevel, double minX, double minY, double maxX, double maxY):
_maxLevel(maxLevel),
_min(minX, minY),
_max(maxX, maxY) {}
Extents(const Extents& extents):
_maxLevel(extents._maxLevel),
_min(extents._min),
_max(extents._max) {}
Extents& operator = (const Extents& rhs)
{
if (&rhs == this) return *this;
_maxLevel = rhs._maxLevel;
_min = rhs._min;
_max = rhs._max;
return *this;
}
bool intersects(unsigned level, osg::Vec2d& in_min, osg::Vec2d& in_max)
{
osg::notify(osg::INFO)<<"intersects("<<level<<", min="<<in_min<<" max="<<in_max<<")"<<std::endl;
osg::notify(osg::INFO)<<" _maxLevel="<<_maxLevel<<", _min="<<_min<<" _max="<<_max<<std::endl;
if (level>_maxLevel) return false;
osg::Vec2d union_min, union_max;
// handle mins
if (_min.x()!=DBL_MAX && in_min.x()!=DBL_MAX)
{
// both _min.x() and in_min.x() are defined so use max of two
union_min.x() = _min.x()>in_min.x() ? _min.x() : in_min.x();
}
else
{
// one or both _min.x() and in_min.x() aren't defined so use min of two
union_min.x() = _min.x()<in_min.x() ? _min.x() : in_min.x();
}
if (_min.y()!=DBL_MAX && in_min.y()!=DBL_MAX)
{
// both _min.y() and in_min.y() are defined so use max of two
union_min.y() = _min.y()>in_min.y() ? _min.y() : in_min.y();
}
else
{
// one or both _min.y() and in_min.y() aren't defined so use min of two
union_min.y() = _min.y()<in_min.y() ? _min.y() : in_min.y();
}
// handle maxs
if (_max.x()!=-DBL_MAX && in_max.x()!=-DBL_MAX)
{
// both _max.x() and in_max.x() are defined so use max of two
union_max.x() = _max.x()<in_max.x() ? _max.x() : in_max.x();
}
else
{
// one or both _max.x() and in_max.x() aren't defined so use max of two
union_max.x() = _max.x()>in_max.x() ? _max.x() : in_max.x();
}
if (_max.y()!=-DBL_MAX && in_max.y()!=-DBL_MAX)
{
// both _max.y() and in_max.y() are defined so use max of two
union_max.y() = _max.y()<in_max.y() ? _max.y() : in_max.y();
}
else
{
// one or both _max.y() and in_max.y() aren't defined so use max of two
union_max.y() = _max.y()>in_max.y() ? _max.y() : in_max.y();
}
bool result = union_min.x()<union_max.x() && union_min.y()<union_max.y() ;
osg::notify(osg::INFO)<<" union_min="<<union_min<<" union_max="<<union_max<<" result = "<<result<<std::endl;
return result;
}
unsigned int _maxLevel;
osg::Vec2d _min;
osg::Vec2d _max;
};
class LoadDataVisitor : public osg::NodeVisitor
{
public:
LoadDataVisitor():
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
_currentLevel(0) {}
void setFileCache(osgDB::FileCache* fileCache) { _fileCache = fileCache; }
void addExtents(unsigned int maxLevel, double minX, double minY, double maxX, double maxY)
{
_extentsList.push_back(Extents(maxLevel, minX, minY, maxX, maxY));
}
void addExtents(unsigned int maxLevel)
{
_extentsList.push_back(Extents(maxLevel, DBL_MAX, DBL_MAX, -DBL_MAX, -DBL_MAX));
}
void apply(osg::CoordinateSystemNode& cs)
{
_csnStack.push_back(&cs);
if (!s_ExitApplication) traverse(cs);
_csnStack.pop_back();
}
void apply(osg::Group& group)
{
if (s_ExitApplication) return;
osgTerrain::TerrainTile* terrainTile = dynamic_cast<osgTerrain::TerrainTile*>(&group);
osgTerrain::Locator* locator = terrainTile ? terrainTile->getLocator() : 0;
if (locator)
{
osg::Vec3d l00(0.0,0.0,0.0);
osg::Vec3d l10(1.0,0.0,0.0);
osg::Vec3d l11(1.0,1.0,0.0);
osg::Vec3d l01(0.0,1.0,0.0);
osg::Vec3d w00, w10, w11, w01;
locator->convertLocalToModel(l00, w00);
locator->convertLocalToModel(l10, w10);
locator->convertLocalToModel(l11, w11);
locator->convertLocalToModel(l01, w01);
if (locator->getEllipsoidModel() &&
locator->getCoordinateSystemType()==osgTerrain::Locator::GEOCENTRIC)
{
convertXYZToLatLongHeight(locator->getEllipsoidModel(), w00);
convertXYZToLatLongHeight(locator->getEllipsoidModel(), w10);
convertXYZToLatLongHeight(locator->getEllipsoidModel(), w11);
convertXYZToLatLongHeight(locator->getEllipsoidModel(), w01);
}
updateBound(w00);
updateBound(w10);
updateBound(w11);
updateBound(w01);
return;
}
traverse(group);
}
void apply(osg::Transform& transform)
{
osg::Matrix matrix;
if (!_matrixStack.empty()) matrix = _matrixStack.back();
transform.computeLocalToWorldMatrix(matrix,this);
pushMatrix(matrix);
traverse(transform);
popMatrix();
}
void apply(osg::PagedLOD& plod)
{
if (s_ExitApplication) return;
++_currentLevel;
initBound();
// first compute the bounds of this subgraph
for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
{
if (plod.getFileName(i).empty())
{
traverse(plod);
}
}
if (intersects())
{
for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
{
osg::notify(osg::INFO)<<" filename["<<i<<"] "<<plod.getFileName(i)<<std::endl;
if (!plod.getFileName(i).empty())
{
std::string filename;
if (!plod.getDatabasePath().empty())
{
filename = plod.getDatabasePath() + plod.getFileName(i);
}
else
{
filename = plod.getFileName(i);
}
osg::ref_ptr<osg::Node> node = readNodeFileAndWriteToCache(filename);
if (!s_ExitApplication && node.valid()) node->accept(*this);
}
}
}
--_currentLevel;
}
void apply(osg::Geode& geode)
{
for(unsigned int i=0; i<geode.getNumDrawables(); ++i)
{
osg::Geometry* geom = geode.getDrawable(i)->asGeometry();
if (geom)
{
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(geom->getVertexArray());
if (vertices) updateBound(*vertices);
}
}
}
osg::Node* readNodeFileAndWriteToCache(const std::string& filename)
{
if (_fileCache.valid() && osgDB::containsServerAddress(filename))
{
if (_fileCache->existsInCache(filename))
{
osg::notify(osg::NOTICE)<<"reading from FileCache: "<<filename<<std::endl;
return _fileCache->readNode(filename, osgDB::Registry::instance()->getOptions()).takeNode();
}
else
{
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
osg::Node* node = osgDB::readNodeFile(filename);
if (node)
{
osg::notify(osg::NOTICE)<<"write to FileCache : "<<filename<<std::endl;
_fileCache->writeNode(*node, filename, osgDB::Registry::instance()->getOptions());
}
return node;
}
}
else
{
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
return osgDB::readNodeFile(filename);
}
}
protected:
inline void pushMatrix(osg::Matrix& matrix) { _matrixStack.push_back(matrix); }
inline void popMatrix() { _matrixStack.pop_back(); }
void convertXYZToLatLongHeight(osg::EllipsoidModel* em, osg::Vec3d& v)
{
em->convertXYZToLatLongHeight(v.x(), v.y(), v.z(),
v.y(), v.x(), v.z());
v.x() = osg::RadiansToDegrees(v.x());
v.y() = osg::RadiansToDegrees(v.y());
}
void initBound()
{
_min.set(DBL_MAX, DBL_MAX);
_max.set(-DBL_MAX, -DBL_MAX);
}
void updateBound(osg::Vec3d& v)
{
if (v.x() < _min.x()) _min.x() = v.x();
if (v.y() < _min.y()) _min.y() = v.y();
if (v.x() > _max.x()) _max.x() = v.x();
if (v.y() > _max.y()) _max.y() = v.y();
}
void updateBound(osg::Vec3Array& vertices)
{
// set up matrix
osg::Matrix matrix;
if (!_matrixStack.empty()) matrix = _matrixStack.back();
// set up ellipsoid model
osg::EllipsoidModel* em = !_csnStack.empty() ? _csnStack.back()->getEllipsoidModel() : 0;
for(osg::Vec3Array::iterator itr = vertices.begin();
itr != vertices.end();
++itr)
{
osg::Vec3d v = osg::Vec3d(*itr) * matrix;
if (em) convertXYZToLatLongHeight(em, v);
updateBound(v);
}
}
bool intersects()
{
osg::notify(osg::INFO)<<"intersects() _min = "<<_min<<" _max = "<<_max<<std::endl;
for(ExtentsList::iterator itr = _extentsList.begin();
itr != _extentsList.end();
++itr)
{
if (itr->intersects(_currentLevel, _min, _max)) return true;
}
return false;
}
typedef std::vector<Extents> ExtentsList;
typedef std::vector<osg::Matrix> MatrixStack;
typedef std::vector<osg::CoordinateSystemNode*> CSNStack;
osg::ref_ptr<osgDB::FileCache> _fileCache;
ExtentsList _extentsList;
unsigned int _currentLevel;
MatrixStack _matrixStack;
CSNStack _csnStack;
osg::Vec2d _min;
osg::Vec2d _max;
};
static void signalHandler(int sig)
{
printf("\nCaught signal %d, requesting exit...\n\n",sig);
s_ExitApplication = true;
}
int main( int argc, char **argv )
{
#ifndef _WIN32
signal(SIGHUP, signalHandler);
signal(SIGQUIT, signalHandler);
signal(SIGKILL, signalHandler);
signal(SIGUSR1, signalHandler);
signal(SIGUSR2, signalHandler);
#endif
signal(SIGABRT, signalHandler);
signal(SIGINT, signalHandler);
signal(SIGTERM, signalHandler);
// 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()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an application for collecting a set of seperate files into a single archive file that can be later read in OSG applications..");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-l level","Read down to level across the whole database.");
arguments.getApplicationUsage()->addCommandLineOption("-e level minX minY maxX maxY","Read down to <level> across the extents minX, minY to maxY, maxY. Note, for geocentric datase X and Y are longitude and latitude respectively.");
arguments.getApplicationUsage()->addCommandLineOption("-c directory","Shorthand for --file-cache directory.");
arguments.getApplicationUsage()->addCommandLineOption("--file-cache directory","Set directory as to place cache download files.");
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
arguments.getApplicationUsage()->write(std::cout);
return 1;
}
LoadDataVisitor ldv;
std::string fileCachePath;
while(arguments.read("--file-cache",fileCachePath) || arguments.read("-c",fileCachePath)) {}
if (fileCachePath.empty())
{
const char* env_fileCachePath = getenv("OSG_FILE_CACHE");
if (env_fileCachePath)
{
fileCachePath = env_fileCachePath;
}
}
if (fileCachePath.empty())
{
std::cout<<"No path to the file cache defined, please set OSG_FILE_PATH env var, or use --file-cache <directory> to set a suitable directory for the file cache."<<std::endl;
return 1;
}
ldv.setFileCache(new osgDB::FileCache(fileCachePath));
unsigned int maxLevels = 0;
while(arguments.read("-l",maxLevels))
{
ldv.addExtents(maxLevels);
}
double minX, maxX, minY, maxY;
while(arguments.read("-e",maxLevels, minX, minY, maxX, maxY))
{
ldv.addExtents(maxLevels, minX, minY, maxX, maxY);
}
std::string filename;
for(int i=1; i<arguments.argc(); ++i)
{
if (!arguments.isOption(i))
{
filename = arguments[i];
break;
}
}
if (filename.empty())
{
std::cout<<"No file to load specified."<<std::endl;
return 1;
}
osg::ref_ptr<osg::Node> loadedModel = ldv.readNodeFileAndWriteToCache(filename);
if (!loadedModel)
{
std::cout<<"No data loaded, please specify a database to load"<<std::endl;
return 1;
}
loadedModel->accept(ldv);
if (s_ExitApplication)
{
std::cout<<"osgfilecache cleanly exited in response to signal."<<std::endl;
}
return 0;
}

View File

@@ -1,14 +1,8 @@
SET(TARGET_SRC osgversion.cpp )
IF (OSG_MAINTAINER)
SET(TARGET_SRC ${TARGET_SRC} Contributors.cpp )
ADD_DEFINITIONS("-DBUILD_CONTRIBUTORS")
ENDIF(OSG_MAINTAINER)
SET(TARGET_COMMON_LIBRARIES
OpenThreads
osg
osgDB
)
SETUP_COMMANDLINE_APPLICATION(osgversion)

View File

@@ -1,838 +0,0 @@
// The majority of the application is dedicated to building the
// current contribitors list by parsing the ChangeLog, it just takes
// one line in the main itself to report the version number.
#include <set>
#include <vector>
#include <iostream>
#include <OpenThreads/Version>
#include <osg/Notify>
#include <osg/Version>
#include <osg/ArgumentParser>
#include <osg/ApplicationUsage>
#include <osg/Matrix>
#include <osg/Plane>
#include <osg/BoundingBox>
#include <osg/BoundingSphere>
#include <osgDB/fstream>
using namespace std;
#if defined(_MSC_VER)
#pragma setlocale("C")
#endif
typedef pair<string, string> NamePair;
typedef map<NamePair, unsigned int> NameMap;
typedef vector<string> Words;
NamePair EmptyNamePair;
NamePair NameRobertOsfield("Robert", "Osfield");
NamePair NameDonBurns ("Don", "Burns");
const char* validNames[] =
{
"de",
"den",
"van"
};
const char* invalidNames[] =
{
"Added",
"AnimationPath",
"AnimationPathCallback",
"AnimationPathManipulator",
"ArgumentParser",
"AttrData",
"AutoTransform",
"AutoTransform.",
"Azimuth",
"BlenColour(Vec4",
"Camera",
"CameraBarrierCallback",
"CameraNode",
"Canvas",
"CluserCullingCallback",
"ClusterCullingCallback",
"CoordinateSystem",
"CoordinateSystemNode",
"CoordinateSystemNode&",
"CopyOp",
"Copyright",
"Core",
"Creator",
"CullCallbacks",
"CullingSettngs",
"CullVisitor",
"CullVistor",
"Cygwin",
"DatabasePager",
"DataSet",
"DataVariance",
"DeleteHandler",
"DisplaySettings",
"Drawable",
"DrawElementsUByte",
"Endian",
"Escape",
"EventQueue",
"Face",
"Files",
"Fixed",
"Fixes",
"FluidProgram",
"FontImplementation",
"FrameStats",
"Framstamp",
"FreeBSD",
"Geode",
"GeoemtryTechnique",
"GeometryTechnique",
"GeoSet",
"GraphicsContext",
"GraphicsContextImplementation",
"GraphicsThread",
"GraphicsWindowX11",
"Group",
"Image",
"ImageOptions",
"Images",
"Images/SolarSystem",
"ImageStream",
"Improved",
"IndexBlock",
"IndexFaceSets",
"IntersectVisitor",
"Inventor",
"KdTree",
"KeyboardMouse",
"KeyboardMouseCallback",
"LightModel",
"LightPointNode",
"LineSegment",
"LineStipple",
"Logos",
"LongIDRecord",
"Make",
"Makefile",
"Material",
"Matrix",
"Matrix*",
"MatrixManipulator",
"MatrixTransform",
"MemoryManager",
"MergeGeometryVisitor",
"MeshRecord",
"Mode",
"Mr",
"Multigen",
"New",
"NewCullVisitor",
"NodeVisitor",
"Object",
"OpenDX",
"OpenSceneGraph",
"OpenSceneGraph-2",
"OpenSceneGraph-osgWidget-dev",
"OpenThreads",
"OperationThread",
"Optimizer",
"OrientationConverter",
"Osfields",
"Ouput",
"Output",
"OveralyNode",
"PagedLOD",
"PageLOD",
"Paging",
"ParentList",
"Performer",
"PickHandler",
"PixelDataBufferObject",
"PolygonStipple",
"PolytopeVisitor",
"PrimitiveIndexFunctor",
"Prodcuer",
"Producer",
"ProducerEventCallback",
"Program",
"Proxy",
"ProxyNode",
"Quake3",
"Quicktime",
"ReaderWriters",
"ReentrantMutex",
"Referenced",
"ReferenceFrame",
"Removed",
"RemoveLoadedProxyNodes",
"RenderStage",
"RenderTargetFallback",
"RenderToTextureStage",
"SceneGraphBuilder",
"SceneView",
"Sequence",
"Shape",
"SimpleViewer",
"SimpleViewer",
"SmokeTrailEffect",
"Source",
"SpotExponent",
"State",
"StateAttribute",
"Stats",
"StatsVisitor",
"Studio",
"Support",
"Switch",
"TechniqueEventHandler",
"TerraPage",
"TessellationHints",
"TestManipulator",
"TestSupportCallback",
"TexEnv",
"TexMat(Matrix",
"Texture",
"Texture2DArray",
"Texture3D",
"TextureCubeMap",
"TextureObjectManager",
"TextureRectangle",
"TextureRectangle(Image*",
"TextureType",
"Texuture",
"TriStripVisitor",
"TrPageViewer",
"Uniform",
"UseFarLineSegments",
"UserData",
"Valve",
"Vec*",
"Vec2d",
"Vec3d",
"Vec4ub",
"Version",
"VertexData",
"View",
"Viewer",
"ViewPoint",
"Viewport",
"Viewport",
"Visual",
"VisualStudio",
"WindowData",
"Windows",
"X",
"Xcode",
"Y"
};
struct TypoCorrection
{
const char* original;
const char* corrected;
};
TypoCorrection typoCorrections[] =
{
{"Aderian", "Adrian"},
{"Adndre", "Andre"},
{"Adrain", "Adrian"},
{"Amueller", "Aumueller"},
{"Andew", "Andrew"},
{"André", "Andr<EFBFBD>"},
{"Antione", "Antoine"},
{"Antonoine", "Antoine"},
{"Atr", "Art"},
{"Baverage", "Beverage"},
{"Bistroviae", "Bistrovic"},
{"Callue", "Callu"},
{"Christaiansen", "Christiansen"},
{"Cobin", "Corbin"},
{"Comporesi", "Camporesi"},
{"Connel", "Connell"},
{"Cullu", "Callu"},
{"Daneil", "Daniel"},
{"Daust", "Daoust"},
{"Daved", "David"},
{"Drederic", "Frederic"},
{"Eileman", "Eilemann"},
{"Elgi", "Egli"},
{"Fabian", "Fabien"},
{"Fautre", "Fautr<EFBFBD>"},
{"Frashid", "Farshid"},
{"Fred", "Frederic"},
{"Fredrick", "Frederic"},
{"Fredric", "Frederic"},
{"Froechlich", "Fr<EFBFBD>hlich"},
{"Froehilch", "Fr<EFBFBD>hlich"},
{"Froehlich", "Fr<EFBFBD>hlich"},
{"Froelich", "Fr<EFBFBD>hlich"},
{"Froenlich", "Fr<EFBFBD>hlich"},
{"Fröhlich", "Fr<EFBFBD>hlich"},
{"Fruciel", "Frauciel"},
{"García", "Garcea"},
{"Garrat", "Garrett"},
{"Garret", "Garrett"},
{"Geof", "Geoff"},
{"Giatan", "Gaitan"},
{"Gronenger", "Gronager"},
{"Gronger", "Gronager"},
{"Haritchablaet", "Haritchabalet"},
{"Hebelin", "Herbelin"},
{"Heirtlein", "Hertlein"},
{"Heirtlein", "Hertlein"},
{"Hertleinm", "Hertlein"},
{"Hertlien", "Hertlein"},
{"Hi", "He"},
{"Hooper", "Hopper"},
{"Inverson", "Iverson"},
{"Iversion", "Iverson"},
{"Jean-Sebastein", "Jean-Sebastien"},
{"Jean-Sebastian", "Jean-Sebastien"},
{"Jean-Sebastirn", "Jean-Sebastien"},
{"Jea-Sebastien", "Jean-Sebastien"},
{"Johhansen", "Johansen"},
{"Johnansen", "Johansen"},
{"Johnasen", "Johansen"},
{"Jolly", "Jolley"},
{"Jose", "Jos<EFBFBD>"},
{"José", "Jos<EFBFBD>"},
{"Joson", "Jason"},
{"J", "Jos<EFBFBD>"},
{"Keuhne", "Kuehne"},
{"Kheune", "Kuehne"},
{"Lagrade", "Lagarde"},
{"Largade", "Lagarde"},
{"Larshkari", "Lashkari"},
{"Lashakari", "Lashkari"},
{"Lashari", "Lashkari"},
{"Lasharki", "Lashkari"},
{"Laskari", "Lashkari"},
{"Leandowski", "Lewandowski"},
{"Lawandowski", "Lewandowski"},
{"Lucas", "Luaces"},
{"Lugi", "Luigi"},
{"Lweandowski", "Lewandowski"},
{"Maceij", "Maciej"},
{"Machler", "M<EFBFBD>chler"},
{"Macro", "Marco"},
{"Maechler", "M<EFBFBD>chler"},
{"Mahai", "Mihai"},
{"Mammond", "Marmond"},
{"March", "Marco"},
{"Martsz", "Martz"},
{"Marz", "Martz"},
{"Matz", "Martz"},
{"Melchoir", "Melchior"},
{"Mellis", "Melis"},
{"Messerschimdt", "Messerschmidt"},
{"Micheal", "Michael"},
{"Mihair", "Mihai"},
{"Molishtan", "Moloshtan"},
{"Molishtan", "Moloshtan"},
{"Moloshton", "Moloshtan"},
{"Morné", "Morn<EFBFBD>"},
{"Morne", "Morn<EFBFBD>"},
{"Moule", "Moiule"},
{"Narache", "Marache"},
{"Nicklov", "Nikolov"},
{"Nickolov", "Nikolov"},
{"Olad", "Olaf"},
{"Olar", "Olaf"},
{"Oritz", "Ortiz"},
{"Osfeld", "Osfield"},
{"Osfied", "Osfield"},
{"Pail", "Paul"},
{"Rajce", "Trajce"},
{"Randal", "Randall"},
{"Robet", "Robert"},
{"Rodger", "Roger"},
{"Rolad", "Roland"},
{"Rucard", "Richard"},
{"Sekender", "Sukender"},
{"Sewel", "Sewell"},
{"Simmonson", "Simonsson"},
{"Simmonsson", "Simonsson"},
{"Sjolie", "Sj<EFBFBD>lie"},
{"Sjölie", "Sj<EFBFBD>lie"},
{"Skinnder", "Skinner"},
{"Sokolosky", "Sokolowsky"},
{"Sokolowky", "Sokolowsky"},
{"Sokolowki", "Sokolowsky"},
{"Sokolowski", "Sokolowsky"},
{"Sokolsky", "Sokolowsky"},
{"Sokolwsky", "Sokolowsky"},
{"Sonda", "Sondra"},
{"Stansilav", "Stanislav"},
{"Stefan", "Stephan"},
{"Stell", "Steel"},
{"Sylvan", "Sylvain"},
{"Takeahei", "Takahei"},
{"Takehei", "Takahei"},
{"Tery", "Terry"},
{"Tarantilils", "Tarantilis"},
{"Trastenjak", "Trstenjak"},
{"Urlich", "Ulrich"},
{"Vines", "Vine"},
{"Waldrom", "Waldron"},
{"Wedner", "Weidner"},
{"Weidemann", "Wiedemann"},
{"Wieblen", "Weiblen"},
{"Woesnner", "Woessner"},
{"Wojchiech", "Wojciech"},
{"Wojiech", "Wojciech"},
{"Xennon", "Hanson"},
{"Yefrei", "Yefei"},
{"Yfei", "Yefei"}
};
struct NameCorrection
{
const char* originalFirst;
const char* originalSecond;
const char* correctedFirst;
const char* correctedSecond;
};
NameCorrection nameCorrections[] =
{
{"Marc", "Sciabica",
"Mark", "Sciabica"},
{"Jean", "Sebastien",
"Jean-Sebastien", "Guay"},
{"Michale", "Platings",
"Michael", "Platings"},
{"Mick", "",
"Maik", "Keller"},
{"Gary", "Quin",
"Gary", "Quinn"},
{"BjornHein", "",
"Bj<EFBFBD>rn", "Hein"},
{"Bjorn", "Hein",
"Bj<EFBFBD>rn", "Hein"},
{"Erik", "van",
"Erik", "den Dekker"},
{"Erik", "den",
"Erik", "den Dekker"},
{"Jeoen", "den",
"Jeroen", "den Dekker"},
{"John", "Vidar",
"John", "Vidar Larring"},
{"John", "Vida",
"John", "Vidar Larring"},
{"Sebastien", "Messerschmidt",
"Sebastian", "Messerschmidt"},
{"Mattias", "Fr<EFBFBD>hlich",
"Mathias", "Fr<EFBFBD>hlich"},
{"Mathias", "Helsing",
"Mattias", "Helsing"},
{"Jose", "Delport",
"J.P.", "Delport"},
{"Jos<EFBFBD>", "Delport",
"J.P.", "Delport"},
{"Franz", "Melchior",
"Melchior", "Franz"},
{"Glen", "Waldon",
"Glenn", "Waldron"},
{"Ralf", "Karn",
"Ralf", "Kern"},
{"Donny", "Cipperly",
"Donald", "Cipperly"},
{"Gino", "van",
"Gino", "van den Bergen"},
{"Radu", "Mihai",
"Mihai", "Radu"},
{"Art", "Trevs",
"Art", "Tevs"},
{"Tim", "More",
"Tim", "Moore"},
{"Andre", "Garneau",
"Andr<EFBFBD>", "Garneau"},
{"Eric", "Hammil",
"Chris", "Hanson"},
{"Paul", "de",
"Paul", "de Repentigny"},
{"Raymond", "de",
"Raymond", "de Vries"},
{"Nick", "",
"Trajce", "Nikolov"},
{"Daniel", "",
"Daniel", "Sj<EFBFBD>lie"},
{"Julia", "Ortiz",
"Julian", "Ortiz"},
{"Rune", "Schmidt",
"Rune", "Schmidt Jensen"},
{"Romano", "Jos<EFBFBD>",
"Romano", "Jos<EFBFBD> Magacho da Silva"},
{"Rommano", "Silva",
"Romano", "Jos<EFBFBD> Magacho da Silva"},
{"Leandro", "Motta",
"Leandro", "Motta Barros"},
{"A", "Botorabi",
"Ali", "Botorabi"},
{"Waltice", "",
"Walter", "J. Altice"},
{"Drew", "",
"Drew", "Whitehouse"},
{"Douglas", "A",
"Douglas", "A. Pouk"},
{"Colin", "MacDonald",
"Colin", "McDonald"},
{"Nikolov", "Trajce",
"Trajce", "Nikolov"},
{"Frauciel", "Luc",
"Luc", "Frauciel"},
};
bool validName(const string& first)
{
// Check for valid names
for (unsigned int i = 0; i < sizeof(validNames) / sizeof(char*); ++i)
{
if (first == validNames[i])
{
return true;
}
}
if (first.empty()) return false;
if (first[0] < 'A' || first[0] > 'Z') return false;
if (first.size() >= 2 && (first[1] < 'a' || first[1] > 'z') && (first[1] != '.') && (first[1] != ',')) return false;
// Check for invalid names
for (unsigned int i = 0; i < sizeof(invalidNames) / sizeof(char*); ++i)
{
if (first == invalidNames[i])
{
return false;
}
}
// Default to a valid name
return true;
}
string typoCorrection(const string& name)
{
// Loop over all known typo corrections
for (unsigned int i = 0; i < sizeof(typoCorrections) / sizeof(TypoCorrection); ++i)
{
// If a typo is found
if (name == typoCorrections[i].original)
{
// Return the correction
return typoCorrections[i].corrected;
}
}
return name;
}
void nameCorrection(NamePair& name)
{
// Loop over all known name corrections
for (unsigned int i = 0; i < sizeof(nameCorrections) / sizeof(NameCorrection); ++i)
{
// If a matching name is found
if (name.first == nameCorrections[i].originalFirst &&
name.second == nameCorrections[i].originalSecond)
{
// Return the correction
name.first = nameCorrections[i].correctedFirst;
name.second = nameCorrections[i].correctedSecond;
// Early out, since we don't want corrections of corrections
return;
}
}
}
void lastValidCharacter(const string& name, unsigned int& pos, char c)
{
for (unsigned int i = 0; i < pos; ++i)
{
if (name[i] == c)
{
pos = i;
return;
}
}
}
void lastValidCharacter(const string& name, unsigned int& last)
{
lastValidCharacter(name, last, '.');
lastValidCharacter(name, last, ',');
lastValidCharacter(name, last, '\'');
lastValidCharacter(name, last, '/');
lastValidCharacter(name, last, '\\');
lastValidCharacter(name, last, ':');
lastValidCharacter(name, last, ';');
lastValidCharacter(name, last, ')');
}
NamePair createName(const string& first, const string& second)
{
if (first.empty()) return EmptyNamePair;
// cout << "first = " << first << " second = " << second << endl;
unsigned int last = first.size();
lastValidCharacter(first, last);
if (last == 0) return EmptyNamePair;
string name;
name.append(first.begin(), first.begin() + last);
if (!validName(name)) return EmptyNamePair;
name = typoCorrection(name);
if (second.empty() ||
!validName(second))
{
// filter any single or two letter words as unlike to be names.
if (name.size() <= 2) return EmptyNamePair;
return NamePair(name, "");
}
last = second.size();
lastValidCharacter(second, last);
if (last > 0)
{
string surname(second.begin(), second.begin() + last);
if (validName(surname))
{
surname = typoCorrection(surname);
return NamePair(name, surname);
}
}
// filter any single or two letter words as unlike to be names.
if (name.size() <= 2) return EmptyNamePair;
return NamePair(name, "");
}
bool submissionsSequence(const Words& words, unsigned int& i)
{
if (i + 1 >= words.size()) return false;
if (words[i] == "From" ||
words[i] == "from" ||
words[i] == "From:" ||
words[i] == "from:" ||
words[i] == "Merged" ||
words[i] == "Integrated") return true;
if (i + 2 >= words.size()) return false;
if (words[i] == "submitted" && words[i + 1] == "by")
{
i += 1;
return true;
}
if (words[i] == "Folded" && words[i + 1] == "in")
{
i += 1;
return true;
}
if (words[i] == "Rolled" && words[i + 1] == "in")
{
i += 1;
return true;
}
if (words[i] == "Checked" && words[i + 1] == "in")
{
i += 1;
return true;
}
if (i + 3 >= words.size()) return false;
if (words[i] == "sent" && words[i + 1] == "in" && words[i + 2] == "by")
{
i += 2;
return true;
}
return false;
}
void readContributors(NameMap& names, const string& file)
{
osgDB::ifstream fin(file.c_str());
Words words;
while(fin)
{
string keyword;
fin >> keyword;
words.push_back(keyword);
}
string blank_string;
for(unsigned int i = 0; i < words.size(); ++i)
{
if (submissionsSequence(words, i))
{
if (i + 2 < words.size() && validName(words[i + 1]))
{
NamePair name = createName(words[i + 1], words[i + 2]);
nameCorrection(name);
if (!name.first.empty()) ++names[name];
i += 2;
}
else if (i + 1 < words.size() && validName(words[i + 1]))
{
NamePair name = createName(words[i + 1], blank_string);
nameCorrection(name);
if (!name.first.empty()) ++names[name];
i += 1;
}
}
else
{
if (words[i] == "robert")
{
++names[NameRobertOsfield];
}
else if (words[i] == "don")
{
++names[NameDonBurns];
}
}
}
// reassign fisrt name entries to their full names entries
if (names.size() > 1)
{
for (NameMap::iterator itr = names.begin(); itr != names.end(); )
{
if (itr->first.second.empty())
{
NameMap::iterator next_itr = itr;
++next_itr;
if (next_itr != names.end() && itr->first.first == next_itr->first.first)
{
next_itr->second += itr->second;
names.erase(itr);
itr = next_itr;
}
else
{
++itr;
}
}
else
{
++itr;
}
}
}
// remove the double entries from Robert's contributions
if (names.size() > 1)
{
for (NameMap::iterator itr = names.begin(); itr != names.end(); ++itr)
{
if (itr->first != NameRobertOsfield && itr->first != NameDonBurns)
{
names[NameRobertOsfield] -= itr->second;
}
}
}
}
void buildContributors(NameMap& names)
{
// top five contributors
++names[NamePair("Robert", "Osfield")];
++names[NamePair("Don", "Burns")];
++names[NamePair("Marco", "Jez")];
++names[NamePair("Mike", "Weiblen")];
++names[NamePair("Geoff", "Michel")];
++names[NamePair("Ben", "van Basten")];
// contributors that don't appear in the ChangeLog due to their contributions
// being before CVS started for the OSG, or before the name logging began.
++names[NamePair("Karsten", "Weiss")];
++names[NamePair("Graeme", "Harkness")];
++names[NamePair("Axel", "Volley")];
++names[NamePair("Nikolaus", "Hanekamp")];
++names[NamePair("Kristopher", "Bixler")];
++names[NamePair("Tanguy", "Fautr<EFBFBD>")];
++names[NamePair("J.E.", "Hoffmann")];
}
void printContributors(const std::string& changeLog, bool printNumEntries)
{
NameMap names;
buildContributors(names);
if (!changeLog.empty())
{
readContributors(names, changeLog);
}
typedef multimap<unsigned int, NamePair> SortedNameMap;
SortedNameMap sortedNames;
for (NameMap::iterator itr = names.begin(); itr != names.end(); ++itr)
{
sortedNames.insert(SortedNameMap::value_type(itr->second, itr->first));
}
cout << names.size() << " Contributors:" << endl << endl;
if (printNumEntries)
{
cout << "Entries Firstname Surname" << endl;
cout << "-------------------------" << endl;
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
{
cout << sitr->first << "\t" << sitr->second.first << " " << sitr->second.second << endl;
}
}
else
{
cout << "Firstname Surname" << endl;
cout << "-----------------" << endl;
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
{
cout << sitr->second.first << " " << sitr->second.second << endl;
}
}
}

View File

@@ -1,14 +1,3 @@
// The majority of the application is dedicated to building the
// current contribitors list by parsing the ChangeLog, it just takes
// one line in the main itself to report the version number.
#include <set>
#include <vector>
#include <iostream>
#include <OpenThreads/Version>
#include <osg/Notify>
#include <osg/Version>
#include <osg/ArgumentParser>
#include <osg/ApplicationUsage>
@@ -18,137 +7,890 @@
#include <osg/BoundingBox>
#include <osg/BoundingSphere>
#ifdef BUILD_CONTRIBUTORS
extern void printContributors(const std::string& changeLog, bool printNumEntries);
#include <OpenThreads/Version>
#include <set>
#include <vector>
#include <iostream>
#include <fstream>
// the majority of the application is dedicated to building the
// current contribitors list by parsing the ChangeLog, it just takes
// one line in the main itself to report the version number.
#if defined(_MSC_VER)
#pragma setlocale("C")
#endif
using namespace std;
typedef std::pair<std::string, std::string> NamePair;
typedef std::map<NamePair,unsigned int> NameMap;
typedef std::vector< std::string > Words;
int main( int argc, char** argv)
NamePair EmptyNamePair;
NamePair NameRobertOsfield("Robert","Osfield");
NamePair NameDonBurns("Don","Burns");
bool validName(const std::string& first)
{
osg::ArgumentParser arguments(&argc, argv);
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName() + " [options]");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help", "Display this information");
arguments.getApplicationUsage()->addCommandLineOption("--version-number", "Print out version number only");
arguments.getApplicationUsage()->addCommandLineOption("--major-number", "Print out major version number only");
arguments.getApplicationUsage()->addCommandLineOption("--minor-number", "Print out minor version number only");
arguments.getApplicationUsage()->addCommandLineOption("--patch-number", "Print out patch version number only");
arguments.getApplicationUsage()->addCommandLineOption("--so-number ", "Print out shared object version number only");
arguments.getApplicationUsage()->addCommandLineOption("--openthreads-version-number", "Print out version number for OpenThreads only");
arguments.getApplicationUsage()->addCommandLineOption("--openthreads-soversion-number", "Print out shared object version number for OpenThreads only");
arguments.getApplicationUsage()->addCommandLineOption("Matrix::value_type", "Print the value of Matrix::value_type");
arguments.getApplicationUsage()->addCommandLineOption("Plane::value_type", "Print the value of Plane::value_type");
arguments.getApplicationUsage()->addCommandLineOption("BoundingSphere::value_type", "Print the value of BoundingSphere::value_type");
arguments.getApplicationUsage()->addCommandLineOption("BoundingBox::value_type", "Print the value of BoundingBox::value_type");
if (first=="de") return true;
#ifdef BUILD_CONTRIBUTORS
arguments.getApplicationUsage()->addCommandLineOption("-r <file> or --read <file>", "Read the ChangeLog to generate an estimated contributors list.");
arguments.getApplicationUsage()->addCommandLineOption("--entries", "Print out number of entries into the ChangeLog file for each contributor.");
if (first.empty()) return false;
if (first[0]<'A' || first[0]>'Z') return false;
if (first.size()>=2 && (first[1]<'a' || first[1]>'z') && (first[1]!='.') && (first[1]!=',')) return false;
if (first=="Xcode") return false;
if (first=="Added") return false;
if (first=="Camera") return false;
if (first=="CameraNode") return false;
if (first=="CopyOp") return false;
if (first=="Fixed") return false;
if (first=="View") return false;
if (first=="GraphicsContext") return false;
if (first=="WindowData") return false;
if (first=="ViewPoint") return false;
if (first=="PickHandler") return false;
if (first=="Program") return false;
if (first=="Object") return false;
if (first=="OpenSceneGraph") return false;
if (first=="SpotExponent") return false;
if (first=="Framstamp") return false;
if (first=="Stats") return false;
if (first=="Group") return false;
if (first=="Texture") return false;
if (first=="Texture2DArray") return false;
if (first=="Creator") return false;
if (first=="CullVisitor") return false;
if (first=="Drawable") return false;
if (first=="Geode") return false;
if (first=="GeoSet") return false;
if (first=="Image") return false;
if (first=="Face") return false;
if (first=="Images/SolarSystem") return false;
if (first=="IntersectVisitor") return false;
if (first=="LongIDRecord") return false;
if (first=="Makefile") return false;
if (first=="Matrix") return false;
if (first=="MemoryManager") return false;
if (first=="MeshRecord") return false;
if (first=="Multigen") return false;
if (first=="NewCullVisitor") return false;
if (first=="Output") return false;
if (first=="PageLOD") return false;
if (first=="Improved") return false;
if (first=="PagedLOD") return false;
if (first=="Referenced") return false;
if (first=="StateAttribute") return false;
if (first=="Switch") return false;
if (first=="TechniqueEventHandler") return false;
if (first=="Uniform") return false;
if (first=="Vec*") return false;
if (first=="Viewer") return false;
if (first=="VisualStudio") return false;
if (first=="X") return false;
if (first=="Y") return false;
if (first=="Producer") return false;
if (first=="New") return false;
if (first=="Removed") return false;
if (first=="Ouput") return false;
if (first=="ReaderWriters") return false;
if (first=="NodeVisitor") return false;
if (first=="Fixes") return false;
if (first=="FontImplementation") return false;
if (first=="DisplaySettings") return false;
if (first=="AnimationPath") return false;
if (first=="AnimationPathCallback") return false;
if (first=="AnimationPathManipulator") return false;
if (first=="ArgumentParser") return false;
if (first=="AttrData") return false;
if (first=="Azimuth") return false;
if (first=="CluserCullingCallback") return false;
if (first=="ClusterCullingCallback") return false;
if (first=="CoordinateSystem") return false;
if (first=="CoordinateSystemNode") return false;
if (first=="CoordinateSystemNode&") return false;
if (first=="Copyright") return false;
if (first=="Cygwin") return false;
if (first=="CullCallbacks") return false;
if (first=="CullingSettngs") return false;
if (first=="DataVariance") return false;
if (first=="DatabasePager") return false;
if (first=="DrawElementsUByte") return false;
if (first=="Escape") return false;
if (first=="FluidProgram") return false;
if (first=="FrameStats") return false;
if (first=="FreeBSD") return false;
if (first=="GraphicsContextImplementation") return false;
if (first=="GraphicsThread") return false;
if (first=="Images") return false;
if (first=="IndexBlock") return false;
if (first=="Inventor") return false;
if (first=="Make") return false;
if (first=="Material") return false;
if (first=="MergeGeometryVisitor") return false;
if (first=="Mode") return false;
if (first=="Prodcuer") return false;
if (first=="ProxyNode") return false;
if (first=="ReentrantMutex") return false;
if (first=="ReferenceFrame") return false;
if (first=="RemoveLoadedProxyNodes") return false;
if (first=="RenderTargetFallback") return false;
if (first=="RenderToTextureStage") return false;
if (first=="Sequence") return false;
if (first=="Shape") return false;
if (first=="TessellationHints") return false;
if (first=="Support") return false;
if (first=="State") return false;
if (first=="SmokeTrailEffect") return false;
if (first=="TexEnv") return false;
if (first=="Texture3D") return false;
if (first=="TextureCubeMap") return false;
if (first=="TextureObjectManager") return false;
if (first=="TextureRectangle(Image*") return false;
if (first=="TextureType") return false;
if (first=="Texuture") return false;
if (first=="TriStripVisitor") return false;
if (first=="UserData") return false;
if (first=="Viewport") return false;
if (first=="Visual") return false;
if (first=="Studio") return false;
if (first=="Vec2d") return false;
if (first=="Vec3d") return false;
if (first=="Windows") return false;
if (first=="Version") return false;
if (first=="Viewport") return false;
if (first=="Core") return false;
if (first=="DataSet") return false;
if (first=="Endian") return false;
if (first=="ImageOptions") return false;
if (first=="ImageStream") return false;
if (first=="KeyboardMouse") return false;
if (first=="KeyboardMouseCallback") return false;
if (first=="AutoTransform") return false;
if (first=="AutoTransform.") return false;
if (first=="LightModel") return false;
if (first=="MatrixManipulator") return false;
if (first=="MatrixTransform") return false;
if (first=="OpenDX") return false;
if (first=="ParentList") return false;
if (first=="TerraPage") return false;
if (first=="OveralyNode") return false;
if (first=="OpenThreads") return false;
if (first=="PolygonStipple") return false;
if (first=="SceneView") return false;
if (first=="PrimitiveIndexFunctor") return false;
if (first=="PolytopeVisitor") return false;
if (first=="Performer") return false;
if (first=="Paging") return false;
if (first=="CameraBarrierCallback") return false;
if (first=="TestSupportCallback") return false;
if (first=="Quake3") return false;
if (first=="BlenColour(Vec4") return false;
if (first=="UseFarLineSegments") return false;
if (first=="TextureRectangle") return false;
if (first=="DeleteHandler") return false;
if (first=="EventQueue") return false;
if (first=="TrPageViewer") return false;
if (first=="TestManipulator") return false;
if (first=="ProducerEventCallback") return false;
if (first=="OrientationConverter") return false;
if (first=="Logos") return false;
if (first=="StatsVisitor") return false;
if (first=="LineStipple") return false;
if (first=="Files") return false;
if (first=="Mr") return false;
if (first=="Osfields") return false;
if (first=="Optimizer") return false;
if (first=="RenderStage") return false;
if (first=="Matrix*") return false;
if (first=="Vec4ub") return false;
if (first=="Proxy") return false;
if (first=="CullVistor") return false;
if (first=="SimpleViewer") return false;
if (first=="TexMat(Matrix") return false;
if (first=="GraphicsWindowX11") return false;
if (first=="OperationThread") return false;
if (first=="SimpleViewer") return false;
if (first=="IndexFaceSets") return false;
if (first=="Quicktime") return false;
if (first=="SceneGraphBuilder") return false;
if (first=="LightPointNode") return false;
if (first=="GeometryTechnique") return false;
if (first=="GeoemtryTechnique") return false;
return true;
}
std::string typoCorrection(const std::string& name)
{
#if 0
if (name=="") return "";
if (name=="") return "";
if (name=="") return "";
if (name=="") return "";
#endif
if (name=="Martsz") return "Martz";
if (name=="Matz") return "Martz";
if (name=="Froenlich") return "Fr<EFBFBD>hlich";
if (name=="Froechlich") return "Fr<EFBFBD>hlich";
if (name=="Froelich") return "Fr<EFBFBD>hlich";
if (name=="Fruciel") return "Frauciel";
if (name=="Hebelin") return "Herbelin";
if (name=="Jea-Sebastien") return "Jean-Sebastien";
if (name=="Robet") return "Robert";
if (name=="Morné") return "Morn<EFBFBD>";
if (name=="Adndre") return "Andre";
if (name=="Mellis") return "Melis";
if (name=="Rajce") return "Trajce";
if (name=="Trastenjak") return "Trstenjak";
if (name=="Baverage") return "Beverage";
if (name=="Bistroviae") return "Bistrovic";
if (name=="Christaiansen") return "Christiansen";
if (name=="Cobin") return "Corbin";
if (name=="Connel") return "Connell";
if (name=="Daust") return "Daoust";
if (name=="Lugi") return "Luigi";
if (name=="Daved") return "David";
if (name=="Fred") return "Frederic";
if (name=="Drederic") return "Frederic";
if (name=="Fredrick") return "Frederic";
if (name=="Fredric") return "Frederic";
if (name=="Garrat") return "Garret";
if (name=="Geof") return "Geoff";
if (name=="Gronenger") return "Gronager";
if (name=="Gronger") return "Gronager";
if (name=="Heirtlein") return "Hertlein";
if (name=="Heirtlein") return "Hertlein";
if (name=="Heirtlein") return "Hertlein";
if (name=="Hertlien") return "Hertlein";
if (name=="Narache") return "Marache";
if (name=="Hi") return "He";
if (name=="Hooper") return "Hopper";
if (name=="Inverson") return "Iverson";
if (name=="Iversion") return "Iverson";
if (name=="Jeoen") return "Joran";
if (name=="Johhansen") return "Johansen";
if (name=="Johnansen") return "Johansen";
if (name=="Johnasen") return "Johansen";
if (name=="Jolly") return "Jolley";
if (name=="Jose") return "Jos<EFBFBD>";
if (name=="Joson") return "Jason";
if (name=="J") return "Jos<EFBFBD>";
if (name=="Keuhne") return "Kuehne";
if (name=="Kheune") return "Kuehne";
if (name=="Lashakari") return "Lashkari";
if (name=="Lashari") return "Lashkari";
if (name=="Lasharki") return "Lashkari";
if (name=="Laskari") return "Lashkari";
if (name=="Macro") return "Marco";
if (name=="Mammond") return "Marmond";
if (name=="March") return "Marco";
if (name=="Marz") return "Martz";
if (name=="Micheal") return "Michael";
if (name=="Molishtan") return "Moloshtan";
if (name=="Molishtan") return "Moloshtan";
if (name=="Moloshton") return "Moloshtan";
if (name=="Moule") return "Moiule";
if (name=="Nicklov") return "Nikolov";
if (name=="Nickolov") return "Nikolov";
if (name=="Olad") return "Olaf";
if (name=="Olar") return "Olaf";
if (name=="Oritz") return "Ortiz";
if (name=="Osfied") return "Osfield";
if (name=="Pail") return "Paul";
if (name=="Randal") return "Randall";
if (name=="Rodger") return "Roger";
if (name=="Sewel") return "Sewell";
if (name=="Sjolie") return "Sj<EFBFBD>lie";
if (name=="Sokolosky") return "Sokolowsky";
if (name=="Sokolowski") return "Sokolowsky";
if (name=="Sokolsky") return "Sokolowsky";
if (name=="Sonda") return "Sondra";
if (name=="Stansilav") return "Stanislav";
if (name=="Stefan") return "Stephan";
if (name=="Stell") return "Steel";
if (name=="Takeahei") return "Takahei";
if (name=="Takehei") return "Takahei";
if (name=="Tarantilils") return "Tarantilis";
if (name=="Vines") return "Vine";
if (name=="Wieblen") return "Weiblen";
if (name=="Xennon") return "Hanson";
if (name=="Yefrei") return "Yefei";
if (name=="Yfei") return "Yefei";
if (name=="Antonoine") return "Antoine";
if (name=="Antione") return "Antoine";
if (name=="Andew") return "Andrew";
if (name=="Daneil") return "Daniel";
if (name=="André") return "Andr<EFBFBD>";
if (name=="García") return "Garcea";
if (name=="Sjölie") return "Sj<EFBFBD>lie";
if (name=="José") return "Jos<EFBFBD>";
if (name=="Fröhlich") return "Fr<EFBFBD>hlich";
if (name=="Froehlich") return "Fr<EFBFBD>hlich";
if (name=="Eileman") return "Eilemann";
if (name=="Skinnder") return "Skinner";
if (name=="Mihair") return "Mihai";
if (name=="Mahai") return "Mihai";
if (name=="Wojiech" || name=="Wojchiech") return "Wojciech";
if (name=="Leandowski" || name=="Lawandowski") return "Lewandowski";
if (name=="Aderian") return "Adrian";
if (name=="Callue") return "Callu";
if (name=="Waldrom") return "Waldron";
if (name=="Atr") return "Art";
if (name=="Sylvan") return "Sylvain";
if (name=="Giatan") return "Gaitan";
if (name=="Melchoir") return "Melchior";
if (name=="Simmonsson") return "Simonsson";
if (name=="Sokolwsky") return "Sokolowsky";
if (name=="Cullu") return "Callu";
if (name=="Comporesi") return "Camporesi";
if (name=="Machler") return "M<EFBFBD>chler";
if (name=="Maechler") return "M<EFBFBD>chler";
return name;
}
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
void nameCorrection(NamePair& name)
{
if ((name.first=="Jose" || name.first=="Jos<EFBFBD>") && name.second=="Delport")
{
cout << arguments.getApplicationUsage()->getCommandLineUsage() << endl;
arguments.getApplicationUsage()->write(cout, arguments.getApplicationUsage()->getCommandLineOptions());
return 1;
name.first = "J.P.";
name.second = "Delport";
}
if (name.first=="Franz" && name.second=="Melchior")
{
name.first = "Melchior";
name.second = "Franz";
}
if (name.first=="Glen" && name.second=="Waldon")
{
name.first = "Glenn";
name.second = "Waldron";
}
if (name.first=="Ralf" && name.second=="Karn")
{
name.first = "Ralf";
name.second = "Kern";
}
if (name.first=="Donny" && name.second=="Cipperly")
{
name.first = "Donald";
name.second = "Cipperly";
}
if (name.first=="Gino" && name.second=="")
{
name.first = "Gino";
name.second = "van den Bergen";
}
if (name.first=="Radu" && name.second=="Mihai")
{
name.first = "Mihai";
name.second = "Radu";
}
if (name.first=="Art" && name.second=="Trevs")
{
name.first = "Art";
name.second = "Tevs";
}
if (name.first=="Tim" && name.second=="More")
{
name.first = "Tim";
name.second = "Moore";
}
if (name.first=="Andre" && name.second=="Garneau")
{
name.first = "Andr<EFBFBD>";
name.second = "Garneau";
}
if (name.first=="Eric" && name.second=="Hammil")
{
name.first = "Chris";
name.second = "Hanson";
}
if (name.first=="Paul" && name.second=="de")
{
name.first = "Paul";
name.second = "de Repentigny";
}
if (name.first=="Nick" && name.second=="")
{
name.first = "Trajce";
name.second = "Nikolov";
}
if (name.first=="Daniel" && name.second=="")
{
name.first = "Daniel";
name.second = "Sj<EFBFBD>lie";
}
if (name.first=="Julia" && name.second=="Ortiz")
{
name.first = "Julian";
name.second = "Ortiz";
}
if (name.first=="Rune" && name.second=="Schmidt")
{
name.first = "Rune";
name.second = "Schmidt Jensen";
}
if (name.first=="Romano" && name.second=="Jos<EFBFBD>")
{
name.first = "Romano";
name.second = "Jos<EFBFBD> Magacho da Silva";
}
if (name.first=="Rommano" && name.second=="Silva")
{
name.first = "Romano";
name.second = "Jos<EFBFBD> Magacho da Silva";
}
if (name.first=="Leandro" && name.second=="Motta")
{
name.first = "Leandro";
name.second = "Motta Barros";
}
if (name.first=="A" && name.second=="Botorabi")
{
name.first = "Ali";
name.second = "Botorabi";
}
if (name.first=="Waltice" && name.second=="")
{
name.first = "Walter";
name.second = "J. Altice";
}
if (name.first=="Drew" && name.second=="")
{
name.first = "Drew";
name.second = "Whitehouse";
}
if (name.first=="Douglas" && name.second=="A")
{
name.first = "Douglas";
name.second = "A. Pouk";
}
if (name.first=="Colin" && name.second=="MacDonald")
{
name.first = "Colin";
name.second = "McDonald";
}
if (name.first=="Nikolov" && name.second=="Trajce")
{
name.first = "Trajce";
name.second = "Nikolov";
}
if (name.first=="Frauciel" && name.second=="Luc")
{
name.first = "Luc";
name.second = "Frauciel";
}
}
void lastValidCharacter(const std::string& name, unsigned int& pos,char c)
{
for(unsigned int i=0;i<pos;++i)
{
if (name[i]==c)
{
pos = i;
return;
}
}
}
void lastValidCharacter(const std::string& name, unsigned int& last)
{
lastValidCharacter(name, last, '.');
lastValidCharacter(name, last, ',');
lastValidCharacter(name, last, '\'');
lastValidCharacter(name, last, '/');
lastValidCharacter(name, last, '\\');
lastValidCharacter(name, last, ':');
lastValidCharacter(name, last, ';');
lastValidCharacter(name, last, ')');
}
NamePair createName(const std::string& first, const std::string& second)
{
if (first.empty()) return EmptyNamePair;
unsigned int last = first.size();
lastValidCharacter(first, last);
if (last==0) return EmptyNamePair;
std::string name;
name.append(first.begin(), first.begin()+last);
if (!validName(name)) return EmptyNamePair;
name = typoCorrection(name);
if (second.empty() ||
!validName(second))
{
// filter any single or two letter words as unlike to be names.
if (name.size()<=2) return EmptyNamePair;
return NamePair(name,"");
}
last = second.size();
lastValidCharacter(second, last);
if (last>0)
{
std::string surname(second.begin(), second.begin()+last);
if (validName(surname))
{
surname = typoCorrection(surname);
return NamePair(name, surname);
}
}
// filter any single or two letter words as unlike to be names.
if (name.size()<=2) return EmptyNamePair;
return NamePair(name,"");
}
bool submissionsSequence(const Words& words, unsigned int& i)
{
if (i+1>=words.size()) return false;
if (words[i]=="From" ||
words[i]=="from" ||
words[i]=="From:" ||
words[i]=="from:" ||
words[i]=="Merged" ||
words[i]=="Integrated") return true;
if (i+2>=words.size()) return false;
if (words[i]=="submitted" && words[i+1]=="by")
{
i+=1;
return true;
}
if (words[i]=="Folded" && words[i+1]=="in")
{
i+=1;
return true;
}
if (words[i]=="Rolled" && words[i+1]=="in")
{
i+=1;
return true;
}
if (words[i]=="Checked" && words[i+1]=="in")
{
i+=1;
return true;
}
if (i+3>=words.size()) return false;
if (words[i]=="sent" && words[i+1]=="in" && words[i+2]=="by")
{
i+=2;
return true;
}
return false;
}
void readContributors(NameMap& names, const std::string& file)
{
std::ifstream fin(file.c_str());
Words words;
while(fin)
{
std::string keyword;
fin >> keyword;
words.push_back(keyword);
}
std::string blank_string;
for(unsigned int i=0; i< words.size(); ++i)
{
if (submissionsSequence(words,i))
{
if (i+2<words.size() && validName(words[i+1]))
{
NamePair name = createName(words[i+1], words[i+2]);
nameCorrection(name);
if (!name.first.empty()) ++names[name];
i+=2;
}
else if (i+1<words.size() && validName(words[i+1]))
{
NamePair name = createName(words[i+1], blank_string);
nameCorrection(name);
if (!name.first.empty()) ++names[name];
i+=1;
}
}
else
{
if (words[i]=="robert:")
{
++names[NameRobertOsfield];
}
else if (words[i]=="don:")
{
++names[NameDonBurns];
}
}
}
// reassign fisrt name entries to their full names entries
if (names.size()>1)
{
for(NameMap::iterator itr = names.begin();
itr != names.end();
)
{
if (itr->first.second.empty())
{
NameMap::iterator next_itr = itr;
++next_itr;
if (next_itr!=names.end() && itr->first.first==next_itr->first.first)
{
next_itr->second += itr->second;
names.erase(itr);
itr = next_itr;
}
else
{
++itr;
}
}
else
{
++itr;
}
}
}
// remove the double entries from Robert's contributions
if (names.size()>1)
{
for(NameMap::iterator itr = names.begin();
itr != names.end();
++itr)
{
if (itr->first != NameRobertOsfield && itr->first != NameDonBurns )
{
names[NameRobertOsfield] -= itr->second;
}
}
}
}
void buildContributors(NameMap& names)
{
// top five contributors
++names[NamePair("Robert","Osfield")];
++names[NamePair("Don","Burns")];
++names[NamePair("Marco","Jez")];
++names[NamePair("Mike","Weiblen")];
++names[NamePair("Geoff","Michel")];
++names[NamePair("Ben","van Basten")];
// contributors that don't appear in the ChangeLog due to their contributions
// being before CVS started for the OSG, or before the name logging began.
++names[NamePair("Karsten","Weiss")];
++names[NamePair("Graeme","Harkness")];
++names[NamePair("Axel","Volley")];
++names[NamePair("Nikolaus","Hanekamp")];
++names[NamePair("Kristopher","Bixler")];
++names[NamePair("Tanguy","Fautr<EFBFBD>")];
++names[NamePair("J.E.","Hoffmann")];
}
int main( int argc, char **argv)
{
osg::ArgumentParser arguments(&argc,argv);
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options]");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("--entries","Print out number of entries into the ChangeLog file for each contributor.");
arguments.getApplicationUsage()->addCommandLineOption("--version-number","Print out version number only");
arguments.getApplicationUsage()->addCommandLineOption("--major-number","Print out major version number only");
arguments.getApplicationUsage()->addCommandLineOption("--minor-number","Print out minor version number only");
arguments.getApplicationUsage()->addCommandLineOption("--patch-number","Print out patch version number only");
arguments.getApplicationUsage()->addCommandLineOption("--so-number ","Print out shared object version number only");
arguments.getApplicationUsage()->addCommandLineOption("--openthreads-version-number","Print out version number for OpenThreads only");
arguments.getApplicationUsage()->addCommandLineOption("--openthreads-soversion-number","Print out shared object version number for OpenThreads only");
arguments.getApplicationUsage()->addCommandLineOption("Matrix::value_type","Print the value of Matrix::value_type");
arguments.getApplicationUsage()->addCommandLineOption("Plane::value_type","Print the value of Plane::value_type");
arguments.getApplicationUsage()->addCommandLineOption("BoundingSphere::value_type","Print the value of BoundingSphere::value_type");
arguments.getApplicationUsage()->addCommandLineOption("BoundingBox::value_type","Print the value of BoundingBox::value_type");
arguments.getApplicationUsage()->addCommandLineOption("-r <file> or --read <file>","Read the ChangeLog to generate an estimated contributors list.");
if (arguments.read("--version-number"))
{
cout << osgGetVersion() << endl;
std::cout<<osgGetVersion()<<std::endl;
return 0;
}
if (arguments.read("--major-number"))
{
cout << OPENSCENEGRAPH_MAJOR_VERSION << endl;
std::cout<<OPENSCENEGRAPH_MAJOR_VERSION<<std::endl;
return 0;
}
if (arguments.read("--minor-number"))
{
cout << OPENSCENEGRAPH_MINOR_VERSION << endl;
std::cout<<OPENSCENEGRAPH_MINOR_VERSION<<std::endl;
return 0;
}
if (arguments.read("--patch-number"))
{
cout << OPENSCENEGRAPH_PATCH_VERSION << endl;
std::cout<<OPENSCENEGRAPH_PATCH_VERSION<<std::endl;
return 0;
}
if (arguments.read("--soversion-number") || arguments.read("--so-number") )
{
cout << osgGetSOVersion() << endl;
std::cout<<osgGetSOVersion()<<std::endl;
return 0;
}
if (arguments.read("--openthreads-version-number"))
{
cout << OpenThreadsGetVersion() << endl;
std::cout<<OpenThreadsGetVersion()<<std::endl;
return 0;
}
if (arguments.read("--openthreads-major-number"))
{
cout << OPENTHREADS_MAJOR_VERSION << endl;
std::cout<<OPENTHREADS_MAJOR_VERSION<<std::endl;
return 0;
}
if (arguments.read("--openthreads-minor-number"))
{
cout << OPENTHREADS_MINOR_VERSION << endl;
std::cout<<OPENTHREADS_MINOR_VERSION<<std::endl;
return 0;
}
if (arguments.read("--openthreads-patch-number"))
{
cout << OPENTHREADS_PATCH_VERSION << endl;
std::cout<<OPENTHREADS_PATCH_VERSION<<std::endl;
return 0;
}
if (arguments.read("--openthreads-soversion-number"))
{
cout << OpenThreadsGetSOVersion() << endl;
std::cout<<OpenThreadsGetSOVersion()<<std::endl;
return 0;
}
if (arguments.read("Matrix::value_type"))
{
cout << ((sizeof(osg::Matrix::value_type) == 4) ? "float" : "double") << endl;
std::cout<<((sizeof(osg::Matrix::value_type)==4)?"float":"double")<<std::endl;
return 0;
}
if (arguments.read("Plane::value_type"))
{
cout << ((sizeof(osg::Plane::value_type) == 4) ? "float" : "double") << endl;
std::cout<<((sizeof(osg::Plane::value_type)==4)?"float":"double")<<std::endl;
return 0;
}
if (arguments.read("BoundingSphere::value_type"))
{
cout << ((sizeof(osg::BoundingSphere::value_type) == 4) ? "float" : "double") << endl;
std::cout<<((sizeof(osg::BoundingSphere::value_type)==4)?"float":"double")<<std::endl;
return 0;
}
if (arguments.read("BoundingBox::value_type"))
{
cout << ((sizeof(osg::BoundingBox::value_type) == 4) ? "float" : "double") << endl;
std::cout<<((sizeof(osg::BoundingBox::value_type)==4)?"float":"double")<<std::endl;
return 0;
}
std::cout<<osgGetLibraryName()<< " "<< osgGetVersion()<<std::endl<<std::endl;
cout << osgGetLibraryName() << " " << osgGetVersion() << endl << endl;
#ifdef BUILD_CONTRIBUTORS
string changeLog;
while (arguments.read("-r", changeLog) ||
arguments.read("--read", changeLog))
bool printContributors = false;
bool printNumEntries = false;
while ( arguments.read("--entries"))
{
printContributors(changeLog, arguments.read("--entries"));
printContributors = true;
printNumEntries = true;
}
std::string changeLog;
while ( arguments.read("-r",changeLog) || arguments.read("--read",changeLog)) printContributors = true;
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
std::cout<<arguments.getApplicationUsage()->getCommandLineUsage()<<std::endl;
arguments.getApplicationUsage()->write(std::cout,arguments.getApplicationUsage()->getCommandLineOptions());
return 1;
}
if (printContributors)
{
NameMap names;
buildContributors(names);
if (!changeLog.empty())
{
readContributors(names, changeLog);
}
typedef std::multimap<unsigned int, NamePair> SortedNameMap;
SortedNameMap sortedNames;
for(NameMap::iterator itr = names.begin();
itr != names.end();
++itr)
{
sortedNames.insert(SortedNameMap::value_type(itr->second, itr->first));
}
std::cout<<names.size()<<" Contributors:"<<std::endl<<std::endl;
if (printNumEntries)
{
std::cout<<"Entries Firstname Surname"<<std::endl;
std::cout<<"-------------------------"<<std::endl;
for(SortedNameMap::reverse_iterator sitr = sortedNames.rbegin();
sitr != sortedNames.rend();
++sitr)
{
std::cout<<sitr->first<<"\t"<<sitr->second.first<<" "<<sitr->second.second<<std::endl;
}
}
else
{
std::cout<<"Firstname Surname"<<std::endl;
std::cout<<"-----------------"<<std::endl;
for(SortedNameMap::reverse_iterator sitr = sortedNames.rbegin();
sitr != sortedNames.rend();
++sitr)
{
std::cout<<sitr->second.first<<" "<<sitr->second.second<<std::endl;
}
}
}
#endif
return 0;
}

View File

@@ -39,16 +39,27 @@ int main(int argc, char** argv)
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("--image <filename>","Load an image and render it on a quad");
arguments.getApplicationUsage()->addCommandLineOption("--dem <filename>","Load an image/DEM and render it on a HeightField");
arguments.getApplicationUsage()->addCommandLineOption("--login <url> <username> <password>","Provide authentication information for http file access.");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");
arguments.getApplicationUsage()->addCommandLineOption("--help-env","Display environmental variables available");
arguments.getApplicationUsage()->addCommandLineOption("--help-keys","Display keyboard & mouse bindings available");
arguments.getApplicationUsage()->addCommandLineOption("--help-all","Display all command line, env vars and keyboard & mouse bindings.");
arguments.getApplicationUsage()->addCommandLineOption("--SingleThreaded","Select SingleThreaded threading model for viewer.");
arguments.getApplicationUsage()->addCommandLineOption("--CullDrawThreadPerContext","Select CullDrawThreadPerContext threading model for viewer.");
arguments.getApplicationUsage()->addCommandLineOption("--DrawThreadPerContext","Select DrawThreadPerContext threading model for viewer.");
arguments.getApplicationUsage()->addCommandLineOption("--CullThreadPerCameraDrawThreadPerContext","Select CullThreadPerCameraDrawThreadPerContext threading model for viewer.");
osgViewer::Viewer viewer(arguments);
unsigned int helpType = 0;
if ((helpType = arguments.readHelpType()))
// if user request help write it out to cout.
bool helpAll = arguments.read("--help-all");
unsigned int helpType = ((helpAll || arguments.read("-h") || arguments.read("--help"))? osg::ApplicationUsage::COMMAND_LINE_OPTION : 0 ) |
((helpAll || arguments.read("--help-env"))? osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE : 0 ) |
((helpAll || arguments.read("--help-keys"))? osg::ApplicationUsage::KEYBOARD_MOUSE_BINDING : 0 );
if (helpType)
{
arguments.getApplicationUsage()->write(std::cout, helpType);
return 1;
}
osgViewer::Viewer viewer(arguments);
// report any errors if they have occurred when parsing the program arguments.
if (arguments.errors())
@@ -63,19 +74,6 @@ int main(int argc, char** argv)
return 1;
}
std::string url, username, password;
while(arguments.read("--login",url, username, password))
{
if (!osgDB::Registry::instance()->getAuthenticationMap())
{
osgDB::Registry::instance()->setAuthenticationMap(new osgDB::AuthenticationMap);
osgDB::Registry::instance()->getAuthenticationMap()->addAuthenticationDetails(
url,
new osgDB::AuthenticationDetails(username, password)
);
}
}
// set up the camera manipulators.
{
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
@@ -123,9 +121,6 @@ int main(int argc, char** argv)
// add the LOD Scale handler
viewer.addEventHandler(new osgViewer::LODScaleHandler);
// add the screen capture handler
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
// load the data
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
if (!loadedModel)

2
configure vendored
View File

@@ -1 +1 @@
cmake . -DCMAKE_BUILD_TYPE=Release $@
cmake . -DCMAKE_BUILD_TYPE=Release

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -348,7 +348,7 @@ SHOW_USED_FILES = YES
# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
QUIET = YES
QUIET = NO
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated by doxygen. Possible values are YES and NO. If left blank

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,6 @@
<hr>
<table border="0"><tr><td>
<img src="osg32-32.png" alt="osg logo" />
</td><td>
<address><small>Generated at $datetime for the <a href="http://www.openscenegraph.org/">$projectname</a>
<address><small>Generated at $datetime for the <a href="http://www.openscenegraph.org/">OpenSceneGraph</a>
by <a href="http://www.doxygen.org">doxygen</a> $doxygenversion.</small></address>
<!-- Dimitri van Heesch's e-mail address removed, lest he get messages on the OpenSceneGraph -->
</td></tr></table>
<!-- Dimitri van Heesch's e-mail address removed, lest he get messages on the Open Scene Graph -->
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,254 +0,0 @@
# Doxyfile 1.5.7.1
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = OpenThreads
PROJECT_NUMBER = ${OPENTHREADS_VERSION}
OUTPUT_DIRECTORY = "${PROJECT_BINARY_DIR}/doc/"
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = "${OpenSceneGraph_SOURCE_DIR}/include/"
STRIP_FROM_INC_PATH =
SHORT_NAMES = YES
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
TYPEDEF_HIDES_STRUCT = NO
SYMBOL_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = NO
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = YES
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = "${OpenSceneGraph_SOURCE_DIR}/include/OpenThreads"
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *include* \
*.cpp
RECURSIVE = YES
EXCLUDE = .svn
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = */.svn/*
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 2
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = OpenThreadsReferenceDocs
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER = "${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html"
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
HTML_DYNAMIC_SECTIONS = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
GENERATE_HTMLHELP = ${GENERATE_HTMLHELP}
CHM_FILE = "../OpenThreadsReferenceDocs-${OPENSCENEGRAPH_VERSION}.chm"
HHC_LOCATION = "${HTML_HELP_COMPILER}"
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHG_LOCATION =
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
FORMULA_FONTSIZE = 10
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = DOXYGEN_SHOULD_SKIP_THIS
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE = ${GENERATE_TAGFILE}
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
MSCGEN_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
DOT_FONTNAME = FreeSans
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = NO
INCLUDED_BY_GRAPH = NO
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = YES
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = ${SEARCHENGINE}

View File

@@ -5,20 +5,18 @@ SET(TARGET_DEFAULT_PREFIX "example_")
SET(TARGET_DEFAULT_LABEL_PREFIX "Examples")
SET(TARGET_COMMON_LIBRARIES
OpenThreads
osg
osgDB
osgUtil
osgGA
osgViewer
osgText
OpenThreads
osg
osgDB
osgUtil
osgGA
osgViewer
osgText
)
IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osg2cpp)
ADD_SUBDIRECTORY(osganimate)
ADD_SUBDIRECTORY(osgautocapture)
ADD_SUBDIRECTORY(osgautotransform)
ADD_SUBDIRECTORY(osgbillboard)
ADD_SUBDIRECTORY(osgblendequation)
@@ -30,25 +28,20 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgcopy)
ADD_SUBDIRECTORY(osgcubemap)
ADD_SUBDIRECTORY(osgdelaunay)
ADD_SUBDIRECTORY(osgcluster)
ADD_SUBDIRECTORY(osgdepthpartition)
ADD_SUBDIRECTORY(osgdepthpeeling)
ADD_SUBDIRECTORY(osgdrawinstanced)
ADD_SUBDIRECTORY(osgdistortion)
ADD_SUBDIRECTORY(osgfadetext)
ADD_SUBDIRECTORY(osgfont)
ADD_SUBDIRECTORY(osgforest)
ADD_SUBDIRECTORY(osgfxbrowser)
ADD_SUBDIRECTORY(osggameoflife)
ADD_SUBDIRECTORY(osggeodemo)
ADD_SUBDIRECTORY(osggeometry)
ADD_SUBDIRECTORY(osggeometryshaders)
ADD_SUBDIRECTORY(osghangglide)
ADD_SUBDIRECTORY(osghud)
ADD_SUBDIRECTORY(osgimagesequence)
ADD_SUBDIRECTORY(osgimpostor)
ADD_SUBDIRECTORY(osgintersection)
ADD_SUBDIRECTORY(osgkdtree)
ADD_SUBDIRECTORY(osgmultiplerendertargets)
ADD_SUBDIRECTORY(osgkeyboard)
ADD_SUBDIRECTORY(osgkeyboardmouse)
ADD_SUBDIRECTORY(osglauncher)
@@ -57,15 +50,12 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osglogicop)
ADD_SUBDIRECTORY(osglogo)
ADD_SUBDIRECTORY(osgmanipulator)
ADD_SUBDIRECTORY(osgmemorytest)
ADD_SUBDIRECTORY(osgmotionblur)
ADD_SUBDIRECTORY(osgmovie)
ADD_SUBDIRECTORY(osgmultiplerendertargets)
ADD_SUBDIRECTORY(osgmultitexture)
ADD_SUBDIRECTORY(osgmultitexturecontrol)
ADD_SUBDIRECTORY(osgoccluder)
ADD_SUBDIRECTORY(osgocclusionquery)
ADD_SUBDIRECTORY(osgpackeddepthstencil)
ADD_SUBDIRECTORY(osgpagedlod)
ADD_SUBDIRECTORY(osgparametric)
ADD_SUBDIRECTORY(osgparticle)
@@ -79,9 +69,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgprerender)
ADD_SUBDIRECTORY(osgprerendercubemap)
ADD_SUBDIRECTORY(osgreflect)
ADD_SUBDIRECTORY(osgrobot)
ADD_SUBDIRECTORY(osgscalarbar)
ADD_SUBDIRECTORY(osgscreencapture)
ADD_SUBDIRECTORY(osgscribe)
ADD_SUBDIRECTORY(osgsequence)
ADD_SUBDIRECTORY(osgshaders)
@@ -91,7 +79,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgsharedarray)
ADD_SUBDIRECTORY(osgsimplifier)
ADD_SUBDIRECTORY(osgsimulation)
ADD_SUBDIRECTORY(osgsidebyside)
ADD_SUBDIRECTORY(osgslice)
ADD_SUBDIRECTORY(osgspacewarp)
ADD_SUBDIRECTORY(osgspheresegment)
@@ -100,7 +87,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgstereomatch)
ADD_SUBDIRECTORY(osgteapot)
ADD_SUBDIRECTORY(osgterrain)
ADD_SUBDIRECTORY(osgtessellate)
ADD_SUBDIRECTORY(osgtessellate)#)
ADD_SUBDIRECTORY(osgtext)
ADD_SUBDIRECTORY(osgtext3D)
ADD_SUBDIRECTORY(osgtexture1D)
@@ -112,31 +99,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgvertexprogram)
ADD_SUBDIRECTORY(osgvolume)
ADD_SUBDIRECTORY(osgwindows)
ADD_SUBDIRECTORY(osganimationtimeline)
ADD_SUBDIRECTORY(osganimationnode)
ADD_SUBDIRECTORY(osganimationmakepath)
ADD_SUBDIRECTORY(osganimationskinning)
ADD_SUBDIRECTORY(osganimationsolid)
ADD_SUBDIRECTORY(osganimationviewer)
ADD_SUBDIRECTORY(osgbrowser)
ADD_SUBDIRECTORY(osgwidgetaddremove)
ADD_SUBDIRECTORY(osgwidgetbox)
ADD_SUBDIRECTORY(osgwidgetcanvas)
ADD_SUBDIRECTORY(osgwidgetframe)
ADD_SUBDIRECTORY(osgwidgetinput)
ADD_SUBDIRECTORY(osgwidgetlabel)
ADD_SUBDIRECTORY(osgwidgetmessagebox)
ADD_SUBDIRECTORY(osgwidgetmenu)
ADD_SUBDIRECTORY(osgwidgetnotebook)
ADD_SUBDIRECTORY(osgwidgetperformance)
ADD_SUBDIRECTORY(osgwidgetscrolled)
ADD_SUBDIRECTORY(osgwidgetshader)
ADD_SUBDIRECTORY(osgwidgetstyled)
ADD_SUBDIRECTORY(osgwidgettable)
ADD_SUBDIRECTORY(osgwidgetwindow)
ADD_SUBDIRECTORY(osgpdf)
IF (BUILD_OSG_WRAPPERS)
ADD_SUBDIRECTORY(osgintrospection)
ENDIF(BUILD_OSG_WRAPPERS)
@@ -149,10 +112,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgviewerSDL)
ENDIF(SDL_FOUND)
IF (GTKGL_FOUND)
ADD_SUBDIRECTORY(osgviewerGTK)
ENDIF(GTKGL_FOUND)
IF (FOX_FOUND)
ADD_SUBDIRECTORY(osgviewerFOX)
ENDIF(FOX_FOUND)
@@ -161,9 +120,9 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgviewerWX)
ENDIF(wxWidgets_FOUND)
IF (QT_FOUND AND QT_QTOPENGL_LIBRARY)
IF (QT_FOUND)
ADD_SUBDIRECTORY(osgviewerQT)
ENDIF(QT_FOUND AND QT_QTOPENGL_LIBRARY)
ENDIF(QT_FOUND)
IF (FLTK_FOUND)
ADD_SUBDIRECTORY(osgviewerFLTK)
@@ -179,24 +138,10 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ENDIF(WIN32)
IF (APPLE)
ADD_SUBDIRECTORY(osgviewerCocoa)
ENDIF(APPLE)
IF (LIBVNCSERVER_FOUND)
ADD_SUBDIRECTORY(osgvnc)
ENDIF(LIBVNCSERVER_FOUND)
#ADD_SUBDIRECTORY(osgcegui)
#to add subject to find socket#ADD_SUBDIRECTORY(osgcluster)
ELSE(DYNAMIC_OPENSCENEGRAPH)
#needed on win32 or the linker get confused by _declspec declarations
ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
ADD_SUBDIRECTORY(osgstaticviewer)

View File

@@ -1,6 +0,0 @@
SET(TARGET_SRC
osg2cpp.cpp
)
#### end var setup ###
SETUP_APPLICATION(osg2cpp)

View File

@@ -1,102 +0,0 @@
#include <osg/ArgumentParser>
#include <osg/ApplicationUsage>
#include <osgDB/ReadFile>
#include <osgDB/FileNameUtils>
#include <osgDB/fstream>
#include <iostream>
void writeShader(osg::Shader* shader, const std::string& cppFileName, const std::string& variableName)
{
osgDB::ofstream fout(cppFileName.c_str());
if (!fout)
{
std::cout<<"Error: could not open file `"<<cppFileName<<"` for writing."<<std::endl;
}
std::string shaderSource = shader->getShaderSource();
std::string variableString = std::string("char ")+variableName+std::string("[] = ");
std::string::size_type startOfLine = 0;
std::string::size_type endOfLine = shaderSource.find_first_of('\n', startOfLine);
if (endOfLine==std::string::npos)
{
fout<<variableString<<shaderSource<<"\\n\";"<<std::endl;
}
else
{
std::string padding(variableString.size(),' ');
fout<<variableString<<"\""<<shaderSource.substr(startOfLine,endOfLine-startOfLine)<<"\\n\""<<std::endl;
startOfLine = endOfLine+1;
endOfLine = shaderSource.find_first_of('\n', startOfLine);
while (endOfLine != std::string::npos)
{
fout<<padding<<"\""<<shaderSource.substr(startOfLine,endOfLine-startOfLine)<<"\\n\""<<std::endl;
startOfLine = endOfLine + 1;
endOfLine = shaderSource.find_first_of('\n', startOfLine);
}
fout<<padding<<"\""<<shaderSource.substr(startOfLine,endOfLine-startOfLine)<<"\\n\";"<<std::endl;
}
std::cout<<"Written shader to `"<<cppFileName<<"`"<<std::endl;
}
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()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is a utility for converting between various input and output databases formats.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("--shader <filename>","Shader file to create a .cpp file for.");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
arguments.getApplicationUsage()->write(std::cout);
return 1;
}
std::string filename;
if (arguments.read("--shader",filename))
{
osg::ref_ptr<osg::Shader> shader = osgDB::readShaderFile(filename);
if (shader.valid())
{
std::string name = osgDB::getStrippedName(filename);
std::string invalidCharacters = "-+/\\*=(){}[]:;<>,.?@'~#`!\"";
std::string numbericCharacters = "0123456789";
std::string::size_type pos = name.find_first_of(invalidCharacters);
while (pos != std::string::npos)
{
name[pos] = '_';
pos = name.find_first_of(invalidCharacters);
}
std::string ext = osgDB::getFileExtension(filename);
std::string cppFileName = name + "_" + ext + ".cpp";
std::string variableName = name + "_" + ext;
writeShader(shader.get(), cppFileName, variableName);
return 0;
}
else
{
std::cout<<"Error: could not find file '"<<filename<<"'"<<std::endl;
return 1;
}
}
std::cout<<"No appropriate command line options used."<<std::endl;
arguments.getApplicationUsage()->write(std::cout);
return 1;
}

View File

@@ -1,3 +0,0 @@
SET(TARGET_SRC osganimationmakepath.cpp )
SET(TARGET_ADDED_LIBRARIES osgAnimation )
SETUP_EXAMPLE(osganimationmakepath)

View File

@@ -1,338 +0,0 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library 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
* OpenSceneGraph Public License for more details.
*
* Authors:
* Jeremy Moles <jeremy@emperorlinux.com>
* Cedric Pinson <mornifle@plopbyte.net>
*/
#include <iostream>
#include <osg/io_utils>
#include <osg/Geometry>
#include <osg/Shape>
#include <osg/ShapeDrawable>
#include <osg/Material>
#include <osg/MatrixTransform>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/TrackballManipulator>
#include <osgAnimation/Sampler>
class AnimtkUpdateCallback : public osg::NodeCallback
{
public:
META_Object(osgAnimation, AnimtkUpdateCallback);
AnimtkUpdateCallback()
{
_sampler = new osgAnimation::Vec3CubicBezierSampler;
_playing = false;
_lastUpdate = 0;
}
AnimtkUpdateCallback(const AnimtkUpdateCallback& val, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY):
osg::Object(val, copyop),
osg::NodeCallback(val, copyop),
_sampler(val._sampler),
_startTime(val._startTime),
_currentTime(val._currentTime),
_playing(val._playing),
_lastUpdate(val._lastUpdate)
{
}
/** Callback method called by the NodeVisitor when visiting a node.*/
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
if (nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR &&
nv->getFrameStamp() &&
nv->getFrameStamp()->getFrameNumber() != _lastUpdate)
{
_lastUpdate = nv->getFrameStamp()->getFrameNumber();
_currentTime = osg::Timer::instance()->tick();
if (_playing && _sampler.get() && _sampler->getKeyframeContainer())
{
osg::MatrixTransform* transform = dynamic_cast<osg::MatrixTransform*>(node);
if (transform) {
osg::Vec3 result;
float t = osg::Timer::instance()->delta_s(_startTime, _currentTime);
float duration = _sampler->getEndTime() - _sampler->getStartTime();
t = fmod(t, duration);
t += _sampler->getStartTime();
_sampler->getValueAt(t, result);
transform->setMatrix(osg::Matrix::translate(result));
}
}
}
// note, callback is responsible for scenegraph traversal so
// they must call traverse(node,nv) to ensure that the
// scene graph subtree (and associated callbacks) are traversed.
traverse(node,nv);
}
void start() { _startTime = osg::Timer::instance()->tick(); _currentTime = _startTime; _playing = true;}
void stop() { _currentTime = _startTime; _playing = false;}
osg::ref_ptr<osgAnimation::Vec3CubicBezierSampler> _sampler;
osg::Timer_t _startTime;
osg::Timer_t _currentTime;
bool _playing;
int _lastUpdate;
};
class AnimtkStateSetUpdateCallback : public osg::StateSet::Callback
{
public:
META_Object(osgAnimation, AnimtkStateSetUpdateCallback);
AnimtkStateSetUpdateCallback()
{
_sampler = new osgAnimation::Vec4LinearSampler;
_playing = false;
_lastUpdate = 0;
}
AnimtkStateSetUpdateCallback(const AnimtkStateSetUpdateCallback& val, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY):
osg::Object(val, copyop),
osg::StateSet::Callback(val, copyop),
_sampler(val._sampler),
_startTime(val._startTime),
_currentTime(val._currentTime),
_playing(val._playing),
_lastUpdate(val._lastUpdate)
{
}
/** Callback method called by the NodeVisitor when visiting a node.*/
virtual void operator()(osg::StateSet* state, osg::NodeVisitor* nv)
{
if (state &&
nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR &&
nv->getFrameStamp() &&
nv->getFrameStamp()->getFrameNumber() != _lastUpdate) {
_lastUpdate = nv->getFrameStamp()->getFrameNumber();
_currentTime = osg::Timer::instance()->tick();
if (_playing && _sampler.get() && _sampler->getKeyframeContainer())
{
osg::Material* material = dynamic_cast<osg::Material*>(state->getAttribute(osg::StateAttribute::MATERIAL));
if (material)
{
osg::Vec4 result;
float t = osg::Timer::instance()->delta_s(_startTime, _currentTime);
float duration = _sampler->getEndTime() - _sampler->getStartTime();
t = fmod(t, duration);
t += _sampler->getStartTime();
_sampler->getValueAt(t, result);
material->setDiffuse(osg::Material::FRONT_AND_BACK, result);
}
}
}
}
void start() { _startTime = osg::Timer::instance()->tick(); _currentTime = _startTime; _playing = true;}
void stop() { _currentTime = _startTime; _playing = false;}
osg::ref_ptr<osgAnimation::Vec4LinearSampler> _sampler;
osg::Timer_t _startTime;
osg::Timer_t _currentTime;
bool _playing;
int _lastUpdate;
};
// This won't really give good results in any situation, but it does demonstrate
// on possible "fast" usage...
class MakePathTimeCallback: public AnimtkUpdateCallback
{
osg::ref_ptr<osg::Geode> _geode;
float _lastAdd;
float _addSeconds;
public:
MakePathTimeCallback(osg::Geode* geode):
_geode(geode),
_lastAdd(0.0f),
_addSeconds(0.08f) {
}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
float t = osg::Timer::instance()->delta_s(_startTime, _currentTime);
if(_lastAdd + _addSeconds <= t && t <= 8.0f)
{
osg::Vec3 pos;
_sampler->getValueAt(t, pos);
_geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(pos, 0.5f)));
_geode->dirtyBound();
_lastAdd += _addSeconds;
}
AnimtkUpdateCallback::operator()(node, nv);
}
};
// This will give great results if you DO NOT have VSYNC enabled and can generate
// decent FPS.
class MakePathDistanceCallback: public AnimtkUpdateCallback
{
osg::ref_ptr<osg::Geode> _geode;
osg::Vec3 _lastAdd;
float _threshold;
unsigned int _count;
public:
MakePathDistanceCallback(osg::Geode* geode):
_geode(geode),
_threshold(0.5f),
_count(0) {}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
static bool countReported = false;
float t = osg::Timer::instance()->delta_s(_startTime, _currentTime);
osg::Vec3 pos;
_sampler->getValueAt(t, pos);
osg::Vec3 distance = _lastAdd - pos;
if(t <= 8.0f && distance.length() >= _threshold)
{
_geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(pos, 0.25f)));
_lastAdd = pos;
_count++;
}
else if(t > 8.0f)
{
if(!countReported) std::cout << "Created " << _count << " nodes." << std::endl;
countReported = true;
}
AnimtkUpdateCallback::operator()(node, nv);
}
};
osg::StateSet* setupStateSet()
{
osg::StateSet* st = new osg::StateSet();
st->setAttributeAndModes(new osg::Material(), true);
st->setMode(GL_BLEND, true);
AnimtkStateSetUpdateCallback* callback = new AnimtkStateSetUpdateCallback();
osgAnimation::Vec4KeyframeContainer* keys = callback->_sampler->getOrCreateKeyframeContainer();
keys->push_back(osgAnimation::Vec4Keyframe(0, osg::Vec4(1,0,0,1)));
keys->push_back(osgAnimation::Vec4Keyframe(2, osg::Vec4(0.,1,0,1)));
keys->push_back(osgAnimation::Vec4Keyframe(4, osg::Vec4(0,0,1,1)));
keys->push_back(osgAnimation::Vec4Keyframe(6, osg::Vec4(0,0,1,1)));
keys->push_back(osgAnimation::Vec4Keyframe(8, osg::Vec4(0,1,0,1)));
keys->push_back(osgAnimation::Vec4Keyframe(10, osg::Vec4(1,0,0,1)));
callback->start();
st->setUpdateCallback(callback);
return st;
}
osg::MatrixTransform* setupAnimtkNode(osg::Geode* staticGeode)
{
osg::Vec3 v[5];
v[0] = osg::Vec3( 0, 0, 0);
v[1] = osg::Vec3(20, 40, 60);
v[2] = osg::Vec3(40, 60, 20);
v[3] = osg::Vec3(60, 20, 40);
v[4] = osg::Vec3( 0, 0, 0);
osg::MatrixTransform* node = new osg::MatrixTransform();
AnimtkUpdateCallback* callback = new MakePathDistanceCallback(staticGeode);
osgAnimation::Vec3CubicBezierKeyframeContainer* keys = callback->_sampler->getOrCreateKeyframeContainer();
keys->push_back(osgAnimation::Vec3CubicBezierKeyframe(0, osgAnimation::Vec3CubicBezier(
v[0],
v[0] + (v[0] - v[3]),
v[1] - (v[1] - v[0])
)));
keys->push_back(osgAnimation::Vec3CubicBezierKeyframe(2, osgAnimation::Vec3CubicBezier(
v[1],
v[1] + (v[1] - v[0]),
v[2] - (v[2] - v[1])
)));
keys->push_back(osgAnimation::Vec3CubicBezierKeyframe(4, osgAnimation::Vec3CubicBezier(
v[2],
v[2] + (v[2] - v[1]),
v[3] - (v[3] - v[2])
)));
keys->push_back(osgAnimation::Vec3CubicBezierKeyframe(6, osgAnimation::Vec3CubicBezier(
v[3],
v[3] + (v[3] - v[2]),
v[4] - (v[4] - v[3])
)));
keys->push_back(osgAnimation::Vec3CubicBezierKeyframe(8, osgAnimation::Vec3CubicBezier(
v[4],
v[4] + (v[4] - v[3]),
v[0] - (v[0] - v[4])
)));
callback->start();
node->setUpdateCallback(callback);
osg::Geode* geode = new osg::Geode();
geode->setStateSet(setupStateSet());
geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0f, 0.0f, 0.0f), 2)));
node->addChild(geode);
return node;
}
int main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc, argv);
osgViewer::Viewer viewer(arguments);
osgGA::TrackballManipulator* tbm = new osgGA::TrackballManipulator();
viewer.setCameraManipulator(tbm);
viewer.addEventHandler(new osgViewer::StatsHandler());
viewer.addEventHandler(new osgViewer::WindowSizeHandler());
osg::Group* root = new osg::Group();
osg::Geode* geode = new osg::Geode();
geode->setStateSet(setupStateSet());
root->setInitialBound(osg::BoundingSphere(osg::Vec3(10,0,20), 50));
root->addChild(setupAnimtkNode(geode));
root->addChild(geode);
viewer.setSceneData(root);
// tbm->setDistance(150);
return viewer.run();
}

View File

@@ -1,3 +0,0 @@
SET(TARGET_SRC osganimationnode.cpp )
SET(TARGET_ADDED_LIBRARIES osgAnimation )
SETUP_EXAMPLE(osganimationnode)

View File

@@ -1,274 +0,0 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library 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
* OpenSceneGraph Public License for more details.
*/
#include <iostream>
#include <osg/Geometry>
#include <osg/Shape>
#include <osg/ShapeDrawable>
#include <osgViewer/Viewer>
#include <osgGA/TrackballManipulator>
#include <osg/MatrixTransform>
#include <osg/Material>
#include <osgAnimation/Sampler>
class AnimtkUpdateCallback : public osg::NodeCallback
{
public:
META_Object(osgAnimation, AnimtkUpdateCallback);
AnimtkUpdateCallback()
{
_sampler = new osgAnimation::Vec3CubicBezierSampler;
_playing = false;
_lastUpdate = 0;
}
AnimtkUpdateCallback(const AnimtkUpdateCallback& val, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY):
osg::Object(val, copyop),
osg::NodeCallback(val, copyop),
_sampler(val._sampler),
_startTime(val._startTime),
_currentTime(val._currentTime),
_playing(val._playing),
_lastUpdate(val._lastUpdate)
{
}
/** Callback method called by the NodeVisitor when visiting a node.*/
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
if (nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR &&
nv->getFrameStamp() &&
nv->getFrameStamp()->getFrameNumber() != _lastUpdate) {
_lastUpdate = nv->getFrameStamp()->getFrameNumber();
_currentTime = osg::Timer::instance()->tick();
if (_playing && _sampler.get() && _sampler->getKeyframeContainer()) {
osg::MatrixTransform* transform = dynamic_cast<osg::MatrixTransform*>(node);
if (transform) {
osg::Vec3 result;
float t = osg::Timer::instance()->delta_s(_startTime, _currentTime);
float duration = _sampler->getEndTime() - _sampler->getStartTime();
t = fmod(t, duration);
t += _sampler->getStartTime();
_sampler->getValueAt(t, result);
transform->setMatrix(osg::Matrix::translate(result));
}
}
}
// note, callback is responsible for scenegraph traversal so
// they must call traverse(node,nv) to ensure that the
// scene graph subtree (and associated callbacks) are traversed.
traverse(node,nv);
}
void start() { _startTime = osg::Timer::instance()->tick(); _currentTime = _startTime; _playing = true;}
void stop() { _currentTime = _startTime; _playing = false;}
osg::ref_ptr<osgAnimation::Vec3CubicBezierSampler> _sampler;
osg::Timer_t _startTime;
osg::Timer_t _currentTime;
bool _playing;
int _lastUpdate;
};
class AnimtkStateSetUpdateCallback : public osg::StateSet::Callback
{
public:
META_Object(osgAnimation, AnimtkStateSetUpdateCallback);
AnimtkStateSetUpdateCallback()
{
_sampler = new osgAnimation::Vec4LinearSampler;
_playing = false;
_lastUpdate = 0;
}
AnimtkStateSetUpdateCallback(const AnimtkStateSetUpdateCallback& val, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY):
osg::Object(val, copyop),
osg::StateSet::Callback(val, copyop),
_sampler(val._sampler),
_startTime(val._startTime),
_currentTime(val._currentTime),
_playing(val._playing),
_lastUpdate(val._lastUpdate)
{
}
/** Callback method called by the NodeVisitor when visiting a node.*/
virtual void operator()(osg::StateSet* state, osg::NodeVisitor* nv)
{
if (state &&
nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR &&
nv->getFrameStamp() &&
nv->getFrameStamp()->getFrameNumber() != _lastUpdate)
{
_lastUpdate = nv->getFrameStamp()->getFrameNumber();
_currentTime = osg::Timer::instance()->tick();
if (_playing && _sampler.get() && _sampler->getKeyframeContainer())
{
osg::Material* material = dynamic_cast<osg::Material*>(state->getAttribute(osg::StateAttribute::MATERIAL));
if (material)
{
osg::Vec4 result;
float t = osg::Timer::instance()->delta_s(_startTime, _currentTime);
float duration = _sampler->getEndTime() - _sampler->getStartTime();
t = fmod(t, duration);
t += _sampler->getStartTime();
_sampler->getValueAt(t, result);
material->setDiffuse(osg::Material::FRONT_AND_BACK, result);
}
}
}
}
void start() { _startTime = osg::Timer::instance()->tick(); _currentTime = _startTime; _playing = true;}
void stop() { _currentTime = _startTime; _playing = false;}
osg::ref_ptr<osgAnimation::Vec4LinearSampler> _sampler;
osg::Timer_t _startTime;
osg::Timer_t _currentTime;
bool _playing;
int _lastUpdate;
};
osg::Geode* createAxis()
{
osg::Geode* geode = new osg::Geode;
osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry());
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
vertices->push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
vertices->push_back (osg::Vec3 ( 10.0, 0.0, 0.0));
vertices->push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
vertices->push_back (osg::Vec3 ( 0.0, 10.0, 0.0));
vertices->push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
vertices->push_back (osg::Vec3 ( 0.0, 0.0, 10.0));
geometry->setVertexArray (vertices.get());
osg::ref_ptr<osg::Vec4Array> colors (new osg::Vec4Array());
colors->push_back (osg::Vec4 (1.0f, 0.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (1.0f, 0.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry->setColorArray (colors.get());
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geode->addDrawable( geometry.get() );
geode->getOrCreateStateSet()->setMode(GL_LIGHTING, false);
return geode;
}
osg::StateSet* setupStateSet()
{
osg::StateSet* st = new osg::StateSet;
st->setAttributeAndModes(new osg::Material, true);
st->setMode(GL_BLEND, true);
AnimtkStateSetUpdateCallback* callback = new AnimtkStateSetUpdateCallback;
osgAnimation::Vec4KeyframeContainer* keys = callback->_sampler->getOrCreateKeyframeContainer();
keys->push_back(osgAnimation::Vec4Keyframe(0, osg::Vec4(0,0,0,0)));
keys->push_back(osgAnimation::Vec4Keyframe(2, osg::Vec4(0.5,0,0,0.5)));
keys->push_back(osgAnimation::Vec4Keyframe(4, osg::Vec4(0,0.5,0,1)));
keys->push_back(osgAnimation::Vec4Keyframe(6, osg::Vec4(0,0,0.5,1)));
keys->push_back(osgAnimation::Vec4Keyframe(8, osg::Vec4(1,1,1,0.5)));
keys->push_back(osgAnimation::Vec4Keyframe(10, osg::Vec4(0,0,0,0)));
callback->start();
st->setUpdateCallback(callback);
return st;
}
osg::Node* setupCube()
{
osg::Geode* geode = new osg::Geode;
geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0f,0.0f,0.0f),2)));
geode->setStateSet(setupStateSet());
return geode;
}
osg::MatrixTransform* setupAnimtkNode()
{
osg::Vec3 v[5];
v[0] = osg::Vec3(0,0,0);
v[1] = osg::Vec3(10,-50,0);
v[2] = osg::Vec3(30,-10,20);
v[3] = osg::Vec3(-10,20,-20);
v[4] = osg::Vec3(0,0,0);
osg::MatrixTransform* node = new osg::MatrixTransform;
AnimtkUpdateCallback* callback = new AnimtkUpdateCallback;
osgAnimation::Vec3CubicBezierKeyframeContainer* keys = callback->_sampler->getOrCreateKeyframeContainer();
keys->push_back(osgAnimation::Vec3CubicBezierKeyframe(0, osgAnimation::Vec3CubicBezier(
v[0], // pos
v[0] + (v[0] - v[3]), // p1
v[1] - (v[1] - v[0]) // p2
)));
keys->push_back(osgAnimation::Vec3CubicBezierKeyframe(2, osgAnimation::Vec3CubicBezier(
v[1], // pos
v[1] + (v[1] - v[0]),
v[2] - (v[2] - v[1])
)));
keys->push_back(osgAnimation::Vec3CubicBezierKeyframe(4, osgAnimation::Vec3CubicBezier(
v[2], // pos
v[2] + (v[2] - v[1]),
v[3] - (v[3] - v[2])
)));
keys->push_back(osgAnimation::Vec3CubicBezierKeyframe(6, osgAnimation::Vec3CubicBezier(
v[3], // pos
v[3] + (v[3] - v[2]),
v[4] - (v[4] - v[3])
)));
keys->push_back(osgAnimation::Vec3CubicBezierKeyframe(8, osgAnimation::Vec3CubicBezier(
v[4], // pos
v[4] + (v[4] - v[3]),
v[0] - (v[0] - v[4])
)));
callback->start();
node->setUpdateCallback(callback);
node->addChild(setupCube());
return node;
}
int main (int argc, char* argv[])
{
osg::ArgumentParser arguments(&argc, argv);
osgViewer::Viewer viewer(arguments);
osgGA::TrackballManipulator* manipulator = new osgGA::TrackballManipulator();
viewer.setCameraManipulator(manipulator);
osg::Group* root = new osg::Group;
root->setInitialBound(osg::BoundingSphere(osg::Vec3(10,0,10), 30));
root->addChild(createAxis());
osg::MatrixTransform* node = setupAnimtkNode();
node->addChild(createAxis());
root->addChild(node);
viewer.setSceneData( root );
viewer.realize();
while (!viewer.done())
{
viewer.frame();
}
}

View File

@@ -1,3 +0,0 @@
SET(TARGET_SRC osganimationskinning.cpp )
SET(TARGET_ADDED_LIBRARIES osgAnimation )
SETUP_EXAMPLE(osganimationskinning)

View File

@@ -1,267 +0,0 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library 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
* OpenSceneGraph Public License for more details.
*/
#include <iostream>
#include <osg/Geometry>
#include <osg/MatrixTransform>
#include <osg/Geode>
#include <osgViewer/Viewer>
#include <osgGA/TrackballManipulator>
#include <osgUtil/SmoothingVisitor>
#include <osg/io_utils>
#include <osgAnimation/Bone>
#include <osgAnimation/Skeleton>
#include <osgAnimation/RigGeometry>
#include <osgAnimation/Skinning>
#include <osgAnimation/BasicAnimationManager>
osg::Geode* createAxis()
{
osg::Geode* geode (new osg::Geode());
osg::Geometry* geometry (new osg::Geometry());
osg::Vec3Array* vertices (new osg::Vec3Array());
vertices->push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
vertices->push_back (osg::Vec3 ( 1.0, 0.0, 0.0));
vertices->push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
vertices->push_back (osg::Vec3 ( 0.0, 1.0, 0.0));
vertices->push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
vertices->push_back (osg::Vec3 ( 0.0, 0.0, 1.0));
geometry->setVertexArray (vertices);
osg::Vec4Array* colors (new osg::Vec4Array());
colors->push_back (osg::Vec4 (1.0f, 0.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (1.0f, 0.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry->setColorArray (colors);
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geode->addDrawable( geometry );
return geode;
}
osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
{
osgAnimation::RigGeometry* geometry = new osgAnimation::RigGeometry;
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
osg::ref_ptr<osg::Vec3Array> colors (new osg::Vec3Array());
geometry->setVertexArray (vertices.get());
geometry->setColorArray (colors.get());
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
float step = size / nsplit;
float s = 0.5/4.0;
for (int i = 0; i < nsplit; i++)
{
float x = -1 + i * step;
std::cout << x << std::endl;
vertices->push_back (osg::Vec3 ( x, s, s));
vertices->push_back (osg::Vec3 ( x, -s, s));
vertices->push_back (osg::Vec3 ( x, -s, -s));
vertices->push_back (osg::Vec3 ( x, s, -s));
osg::Vec3 c (0,0,0);
c[i%3] = 1;
colors->push_back (c);
colors->push_back (c);
colors->push_back (c);
colors->push_back (c);
}
osg::ref_ptr<osg::UIntArray> array = new osg::UIntArray;
for (int i = 0; i < nsplit - 1; i++)
{
int base = i * 4;
array->push_back(base);
array->push_back(base+1);
array->push_back(base+4);
array->push_back(base+1);
array->push_back(base+5);
array->push_back(base+4);
array->push_back(base+3);
array->push_back(base);
array->push_back(base+4);
array->push_back(base+7);
array->push_back(base+3);
array->push_back(base+4);
array->push_back(base+5);
array->push_back(base+1);
array->push_back(base+2);
array->push_back(base+2);
array->push_back(base+6);
array->push_back(base+5);
array->push_back(base+2);
array->push_back(base+3);
array->push_back(base+7);
array->push_back(base+6);
array->push_back(base+2);
array->push_back(base+7);
}
geometry->addPrimitiveSet(new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, array->size(), &array->front()));
geometry->setUseDisplayList( false );
return geometry;
}
void initVertexMap(osgAnimation::Bone* b0,
osgAnimation::Bone* b1,
osgAnimation::Bone* b2,
osgAnimation::RigGeometry* geom,
osg::Vec3Array* array)
{
osgAnimation::VertexInfluenceSet vertexesInfluences;
osgAnimation::VertexInfluenceMap* vim = new osgAnimation::VertexInfluenceMap;
(*vim)[b0->getName()].setName(b0->getName());
(*vim)[b1->getName()].setName(b1->getName());
(*vim)[b2->getName()].setName(b2->getName());
for (int i = 0; i < (int)array->size(); i++)
{
float val = (*array)[i][0];
std::cout << val << std::endl;
if (val >= -1 && val <= 0)
(*vim)[b0->getName()].push_back(osgAnimation::VertexIndexWeight(i,1));
else if ( val > 0 && val <= 1)
(*vim)[b1->getName()].push_back(osgAnimation::VertexIndexWeight(i,1));
else if ( val > 1)
(*vim)[b2->getName()].push_back(osgAnimation::VertexIndexWeight(i,1));
}
geom->setInfluenceMap(vim);
}
int main (int argc, char* argv[])
{
osg::ArgumentParser arguments(&argc, argv);
osgViewer::Viewer viewer(arguments);
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
osg::ref_ptr<osgAnimation::Skeleton> skelroot = new osgAnimation::Skeleton;
skelroot->setDefaultUpdateCallback();
osg::ref_ptr<osgAnimation::Bone> root = new osgAnimation::Bone;
{
root->setBindMatrixInBoneSpace(osg::Matrix::identity());
root->setBindMatrixInBoneSpace(osg::Matrix::translate(-1,0,0));
root->setName("root");
root->setDefaultUpdateCallback();
}
osg::ref_ptr<osgAnimation::Bone> right0 = new osgAnimation::Bone;
right0->setBindMatrixInBoneSpace(osg::Matrix::translate(1,0,0));
right0->setName("right0");
right0->setDefaultUpdateCallback("right0");
osg::ref_ptr<osgAnimation::Bone> right1 = new osgAnimation::Bone;
right1->setBindMatrixInBoneSpace(osg::Matrix::translate(1,0,0));
right1->setName("right1");
right1->setDefaultUpdateCallback("right1");
root->addChild(right0.get());
right0->addChild(right1.get());
skelroot->addChild(root.get());
osg::Group* scene = new osg::Group;
osg::ref_ptr<osgAnimation::BasicAnimationManager> manager = new osgAnimation::BasicAnimationManager;
scene->setUpdateCallback(manager.get());
osgAnimation::Animation* anim = new osgAnimation::Animation;
{
osgAnimation::QuatKeyframeContainer* keys0 = new osgAnimation::QuatKeyframeContainer;
osg::Quat rotate;
rotate.makeRotate(osg::PI_2, osg::Vec3(0,0,1));
keys0->push_back(osgAnimation::QuatKeyframe(0,osg::Quat(0,0,0,1)));
keys0->push_back(osgAnimation::QuatKeyframe(3,rotate));
keys0->push_back(osgAnimation::QuatKeyframe(6,rotate));
osgAnimation::QuatSphericalLinearSampler* sampler = new osgAnimation::QuatSphericalLinearSampler;
sampler->setKeyframeContainer(keys0);
// osgAnimation::AnimationUpdateCallback* cb = dynamic_cast<osgAnimation::AnimationUpdateCallback*>(right0->getUpdateCallback());
osgAnimation::QuatSphericalLinearChannel* channel = new osgAnimation::QuatSphericalLinearChannel(sampler);
channel->setName("quaternion");
channel->setTargetName("right0");
anim->addChannel(channel);
}
{
osgAnimation::QuatKeyframeContainer* keys1 = new osgAnimation::QuatKeyframeContainer;
osg::Quat rotate;
rotate.makeRotate(osg::PI_2, osg::Vec3(0,0,1));
keys1->push_back(osgAnimation::QuatKeyframe(0,osg::Quat(0,0,0,1)));
keys1->push_back(osgAnimation::QuatKeyframe(3,osg::Quat(0,0,0,1)));
keys1->push_back(osgAnimation::QuatKeyframe(6,rotate));
osgAnimation::QuatSphericalLinearSampler* sampler = new osgAnimation::QuatSphericalLinearSampler;
sampler->setKeyframeContainer(keys1);
osgAnimation::QuatSphericalLinearChannel* channel = new osgAnimation::QuatSphericalLinearChannel(sampler);
//osgAnimation::AnimationUpdateCallback* cb = dynamic_cast<osgAnimation::AnimationUpdateCallback*>(right1->getUpdateCallback());
channel->setName("quaternion");
channel->setTargetName("right1");
anim->addChannel(channel);
}
manager->registerAnimation(anim);
manager->buildTargetReference();
// let's start !
manager->playAnimation(anim);
// we will use local data from the skeleton
osg::MatrixTransform* rootTransform = new osg::MatrixTransform;
rootTransform->setMatrix(osg::Matrix::rotate(osg::PI_2,osg::Vec3(1,0,0)));
right0->addChild(createAxis());
right0->setDataVariance(osg::Object::DYNAMIC);
right1->addChild(createAxis());
right1->setDataVariance(osg::Object::DYNAMIC);
osg::MatrixTransform* trueroot = new osg::MatrixTransform;
trueroot->setMatrix(osg::Matrix(root->getMatrixInBoneSpace().ptr()));
trueroot->addChild(createAxis());
trueroot->addChild(skelroot.get());
trueroot->setDataVariance(osg::Object::DYNAMIC);
rootTransform->addChild(trueroot);
scene->addChild(rootTransform);
osgAnimation::RigGeometry* geom = createTesselatedBox(4, 4.0);
osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom);
skelroot->addChild(geode);
osg::ref_ptr<osg::Vec3Array> src = dynamic_cast<osg::Vec3Array*>(geom->getVertexArray());
geom->getOrCreateStateSet()->setMode(GL_LIGHTING, false);
geom->setDataVariance(osg::Object::DYNAMIC);
initVertexMap(root.get(), right0.get(), right1.get(), geom, src.get());
// let's run !
viewer.setSceneData( scene );
viewer.realize();
while (!viewer.done())
{
viewer.frame();
}
return 0;
}

View File

@@ -1,3 +0,0 @@
SET(TARGET_SRC osganimationsolid.cpp )
SET(TARGET_ADDED_LIBRARIES osgAnimation )
SETUP_EXAMPLE(osganimationsolid)

View File

@@ -1,121 +0,0 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library 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
* OpenSceneGraph Public License for more details.
*/
#include <iostream>
#include <osg/Geometry>
#include <osg/Shape>
#include <osg/ShapeDrawable>
#include <osgViewer/Viewer>
#include <osgGA/TrackballManipulator>
#include <osg/MatrixTransform>
#include <osgAnimation/BasicAnimationManager>
#include <osgAnimation/Channel>
#include <osgAnimation/UpdateCallback>
using namespace osgAnimation;
osg::ref_ptr<osg::Geode> createAxis()
{
osg::ref_ptr<osg::Geode> geode (new osg::Geode());
osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry());
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
vertices->push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
vertices->push_back (osg::Vec3 ( 10.0, 0.0, 0.0));
vertices->push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
vertices->push_back (osg::Vec3 ( 0.0, 10.0, 0.0));
vertices->push_back (osg::Vec3 ( 0.0, 0.0, 0.0));
vertices->push_back (osg::Vec3 ( 0.0, 0.0, 10.0));
geometry->setVertexArray (vertices.get());
osg::ref_ptr<osg::Vec4Array> colors (new osg::Vec4Array());
colors->push_back (osg::Vec4 (1.0f, 0.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (1.0f, 0.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry->setColorArray (colors.get());
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geode->addDrawable( geometry.get() );
geode->getOrCreateStateSet()->setMode(GL_LIGHTING, false);
return geode;
}
int main (int argc, char* argv[])
{
osg::ArgumentParser arguments(&argc, argv);
osgViewer::Viewer viewer(arguments);
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
osg::Group* root = new osg::Group;
osg::ref_ptr<osg::Geode> axe = createAxis();
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0f,0.0f,0.0f),0.5)));
osg::ref_ptr<osg::MatrixTransform> trans = new osg::MatrixTransform();
trans->setName("AnimatedNode");
trans->setDataVariance(osg::Object::DYNAMIC);
trans->setUpdateCallback(new osgAnimation::UpdateTransform("AnimatedCallback"));
trans->setMatrix(osg::Matrix::identity());
trans->addChild (geode.get());
root->addChild (axe.get());
root->addChild (trans.get());
// Define a scheduler for our animations
osg::Group* grp = new osg::Group;
osgAnimation::BasicAnimationManager* mng = new osgAnimation::BasicAnimationManager();
grp->setUpdateCallback(mng);
grp->addChild(root);
// And we finaly define our channel
osgAnimation::Vec3LinearChannel* channelAnimation1 = new osgAnimation::Vec3LinearChannel;
channelAnimation1->setTargetName("AnimatedCallback");
channelAnimation1->setName("position");
channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(0, osg::Vec3(0,0,0)));
channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(2, osg::Vec3(1,1,0)));
osgAnimation::Animation* anim1 = new osgAnimation::Animation;
anim1->addChannel(channelAnimation1);
anim1->setPlaymode(osgAnimation::Animation::PPONG);
osgAnimation::Vec3LinearChannel* channelAnimation2 = new osgAnimation::Vec3LinearChannel;
channelAnimation2->setTargetName("AnimatedCallback");
channelAnimation2->setName("euler");
channelAnimation2->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(0, osg::Vec3(0,0,0)));
channelAnimation2->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(1.5, osg::Vec3(2*osg::PI,0,0)));
osgAnimation::Animation* anim2 = new osgAnimation::Animation;
anim2->addChannel(channelAnimation2);
anim2->setPlaymode(osgAnimation::Animation::LOOP);
// We register all animation inside the scheduler
mng->registerAnimation(anim1);
mng->registerAnimation(anim2);
mng->playAnimation(anim1);
mng->playAnimation(anim2);
viewer.setSceneData( grp );
return viewer.run();
}

View File

@@ -1,3 +0,0 @@
SET(TARGET_SRC osganimationtimeline.cpp )
SET(TARGET_ADDED_LIBRARIES osgAnimation )
SETUP_EXAMPLE(osganimationtimeline)

View File

@@ -1,218 +0,0 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library 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
* OpenSceneGraph Public License for more details.
*/
#include <iostream>
#include <osgDB/ReadFile>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
#include <osgGA/KeySwitchMatrixManipulator>
#include <osgGA/StateSetManipulator>
#include <osgGA/AnimationPathManipulator>
#include <osgGA/TerrainManipulator>
#include <osgAnimation/Bone>
#include <osgAnimation/Skeleton>
#include <osgAnimation/RigGeometry>
#include <osgAnimation/Skinning>
#include <osgAnimation/Timeline>
#include <osgAnimation/AnimationManagerBase>
#include <osgAnimation/TimelineAnimationManager>
struct NoseBegin : public osgAnimation::Action::Callback
{
virtual void operator()(osgAnimation::Action* action)
{
std::cout << "sacrebleu, it scratches my nose, let me scratch it" << std::endl;
std::cout << "process NoseBegin call back " << action->getName() << std::endl << std::endl;
}
};
struct NoseEnd : public osgAnimation::Action::Callback
{
virtual void operator()(osgAnimation::Action* action)
{
std::cout << "shhhrt shrrrrt shhhhhhrrrrt, haaa it's better"<< std::endl;
std::cout << "process NoseEnd call back " << action->getName() << std::endl << std::endl;
}
};
struct ExampleTimelineUsage : public osgGA::GUIEventHandler
{
osg::ref_ptr<osgAnimation::StripAnimation> _mainLoop;
osg::ref_ptr<osgAnimation::StripAnimation> _scratchHead;
osg::ref_ptr<osgAnimation::StripAnimation> _scratchNose;
osg::ref_ptr<osgAnimation::TimelineAnimationManager> _manager;
bool _releaseKey;
ExampleTimelineUsage(osgAnimation::TimelineAnimationManager* manager)
{
_releaseKey = false;
_manager = manager;
const osgAnimation::AnimationList& list = _manager->getAnimationList();
osgAnimation::AnimationMap map;
for (osgAnimation::AnimationList::const_iterator it = list.begin(); it != list.end(); it++)
map[(*it)->getName()] = *it;
_mainLoop = new osgAnimation::StripAnimation(map["Idle_Main"].get(),0.0,0.0);
_mainLoop->setLoop(0); // means forever
_scratchHead = new osgAnimation::StripAnimation(map["Idle_Head_Scratch.02"].get(),0.2,0.3);
_scratchHead->setLoop(1); // one time
map["Idle_Nose_Scratch.01"]->setDuration(10.0); // set this animation duration to 10 seconds
_scratchNose = new osgAnimation::StripAnimation(map["Idle_Nose_Scratch.01"].get(),0.2,0.3);
_scratchNose->setLoop(1); // one time
// add the main loop at priority 0 at time 0.
osgAnimation::Timeline* tml = _manager->getTimeline();
tml->play();
tml->addActionAt(0.0, _mainLoop.get(), 0);
// add a scratch head priority 1 at 3.0 second.
tml->addActionAt(5.0, _scratchHead.get(), 1);
// populate time with scratch head
for (int i = 1; i < 20; i++)
{
// we add a scratch head priority 1 each 10 second
// note:
// it's possible to add the same instance more then once on the timeline
// the only things you need to take care is if you remove it. It will remove
// all instance that exist on the timeline. If you need to differtiate
// it's better to create a new instance
tml->addActionAt(5.0 + 10.0 * i, _scratchHead.get(), 1);
}
// we will add the scratch nose action only when the player hit a key
// in the operator()
// now we will add callback at end and begin of animation of Idle_Nose_Scratch.02
_scratchNose->setCallback(0.0, new NoseBegin);
_scratchNose->setCallback(_scratchNose->getNumFrames()-1, new NoseEnd);
}
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter&)
{
if (ea.getEventType() == osgGA::GUIEventAdapter::KEYUP)
{
_releaseKey = true;
}
return false;
}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
if (nv && nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR)
{
if (_releaseKey) // we hit a key and release it execute an action
{
osgAnimation::Timeline* tml = _manager->getTimeline();
// dont play if already playing
if (!tml->isActive(_scratchNose.get()))
{
// add this animation on top of two other
// we add one to evaluate the animation at the next frame, else we
// will miss the current frame
tml->addActionAt(tml->getCurrentFrame() + 1, _scratchNose.get(), 2);
}
_releaseKey = false;
}
}
else
{
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
if (ev && ev->getActionAdapter() && !ev->getEvents().empty())
{
for(osgGA::EventQueue::Events::iterator itr = ev->getEvents().begin();
itr != ev->getEvents().end();
++itr)
{
handleWithCheckAgainstIgnoreHandledEventsMask(*(*itr), *(ev->getActionAdapter()), node, nv);
}
}
}
traverse(node, nv);
}
};
int main (int argc, char* argv[])
{
std::cerr << "This example works only with nathan.osg" << std::endl;
osg::ArgumentParser psr(&argc, argv);
osgViewer::Viewer viewer(psr);
std::string file = "nathan.osg";
if(argc >= 2)
file = psr[1];
// replace the manager
osg::Group* root = dynamic_cast<osg::Group*>(osgDB::readNodeFile(file));
if (!root) {
osg::notify(osg::FATAL) << "can't read file " << file << std::endl;
return 1;
}
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback());
if(!animationManager)
{
osg::notify(osg::FATAL) << "Did not find AnimationManagerBase updateCallback needed to animate elements" << std::endl;
return 1;
}
osg::ref_ptr<osgAnimation::TimelineAnimationManager> tl = new osgAnimation::TimelineAnimationManager(*animationManager);
root->setUpdateCallback(tl.get());
ExampleTimelineUsage* callback = new ExampleTimelineUsage(tl.get());
root->setEventCallback(callback);
root->getUpdateCallback()->addNestedCallback(callback);
// add the state manipulator
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
// add the thread model handler
viewer.addEventHandler(new osgViewer::ThreadingHandler);
// add the window size toggle handler
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
// add the stats handler
viewer.addEventHandler(new osgViewer::StatsHandler);
// add the help handler
viewer.addEventHandler(new osgViewer::HelpHandler(psr.getApplicationUsage()));
// add the LOD Scale handler
viewer.addEventHandler(new osgViewer::LODScaleHandler);
// add the screen capture handler
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
viewer.setSceneData(root);
return viewer.run();
}

View File

@@ -1,124 +0,0 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library 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
* OpenSceneGraph Public License for more details.
*
* Authors:
* Cedric Pinson <mornifle@plopbyte.net>
* jeremy Moles <jeremy@emperorlinux.com>
*/
#ifndef ANIMTKVIEWER_H
#define ANIMTKVIEWER_H
#include <osg/Node>
#include <osgDB/ReadFile>
#include <osgAnimation/BasicAnimationManager>
class AnimtkViewerModelController
{
public:
typedef std::vector<std::string> AnimationMapVector;
static AnimtkViewerModelController& instance()
{
static AnimtkViewerModelController avmc;
return avmc;
}
static bool setModel(osgAnimation::BasicAnimationManager* model)
{
AnimtkViewerModelController& self = instance();
self._model = model;
for (osgAnimation::AnimationList::const_iterator it = self._model->getAnimationList().begin(); it != self._model->getAnimationList().end(); it++)
self._map[(*it)->getName()] = *it;
for(osgAnimation::AnimationMap::iterator it = self._map.begin(); it != self._map.end(); it++)
self._amv.push_back(it->first);
return true;
}
bool list()
{
std::cout << "Animation List:" << std::endl;
for(osgAnimation::AnimationMap::iterator it = _map.begin(); it != _map.end(); it++)
std::cout << it->first << std::endl;
return true;
}
bool play()
{
if(_focus < _amv.size())
{
std::cout << "Play " << _amv[_focus] << std::endl;
_model->playAnimation(_map[_amv[_focus]].get());
return true;
}
return false;
}
bool stop()
{
if(_focus < _amv.size())
{
std::cout << "Stop " << _amv[_focus] << std::endl;
_model->stopAnimation(_map[_amv[_focus]].get());
return true;
}
return false;
}
bool next()
{
_focus = (_focus + 1) % _map.size();
std::cout << "Current now is " << _amv[_focus] << std::endl;
return true;
}
bool previous()
{
_focus = (_map.size() + _focus - 1) % _map.size();
std::cout << "Current now is " << _amv[_focus] << std::endl;
return true;
}
bool playByName(const std::string& name)
{
for(unsigned int i = 0; i < _amv.size(); i++) if(_amv[i] == name) _focus = i;
_model->playAnimation(_map[name].get());
return true;
}
const std::string& getCurrentAnimationName() const
{
return _amv[_focus];
}
const AnimationMapVector& getAnimationMap() const
{
return _amv;
}
private:
osg::ref_ptr<osgAnimation::BasicAnimationManager> _model;
osgAnimation::AnimationMap _map;
AnimationMapVector _amv;
unsigned int _focus;
AnimtkViewerModelController():
_model(0),
_focus(0) {}
};
#endif

View File

@@ -1,174 +0,0 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library 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
* OpenSceneGraph Public License for more details.
*
* Authors:
* Cedric Pinson <mornifle@plopbyte.net>
* jeremy Moles <jeremy@emperorlinux.com>
*/
#include "AnimtkViewerKeyHandler"
#include "AnimtkViewerGUI"
#include <iostream>
#include <osg/io_utils>
#include <osg/Geometry>
#include <osg/MatrixTransform>
#include <osg/Geode>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgWidget/ViewerEventHandlers>
#include <osgGA/TrackballManipulator>
#include <osgGA/StateSetManipulator>
#include <osgDB/ReadFile>
#include <osgAnimation/AnimationManagerBase>
#include <osgAnimation/Bone>
const int WIDTH = 1440;
const int HEIGHT = 900;
osg::Geode* createAxis()
{
osg::Geode* geode = new osg::Geode();
osg::Geometry* geometry = new osg::Geometry();
osg::Vec3Array* vertices = new osg::Vec3Array();
osg::Vec4Array* colors = new osg::Vec4Array();
vertices->push_back(osg::Vec3(0.0f, 0.0f, 0.0f));
vertices->push_back(osg::Vec3(1.0f, 0.0f, 0.0f));
vertices->push_back(osg::Vec3(0.0f, 0.0f, 0.0f));
vertices->push_back(osg::Vec3(0.0f, 1.0f, 0.0f));
vertices->push_back(osg::Vec3(0.0f, 0.0f, 0.0f));
vertices->push_back(osg::Vec3(0.0f, 0.0f, 1.0f));
colors->push_back(osg::Vec4(1.0f, 0.0f, 0.0f, 1.0f));
colors->push_back(osg::Vec4(1.0f, 0.0f, 0.0f, 1.0f));
colors->push_back(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
geometry->setVertexArray(vertices);
geometry->setColorArray(colors);
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, 6));
geometry->getOrCreateStateSet()->setMode(GL_LIGHTING, false);
geode->addDrawable(geometry);
return geode;
}
struct AnimationManagerFinder : public osg::NodeVisitor
{
osg::ref_ptr<osgAnimation::BasicAnimationManager> _am;
AnimationManagerFinder() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
void apply(osg::Node& node) {
if (_am.valid())
return;
if (node.getUpdateCallback()) {
osgAnimation::AnimationManagerBase* b = dynamic_cast<osgAnimation::AnimationManagerBase*>(node.getUpdateCallback());
if (b) {
_am = new osgAnimation::BasicAnimationManager(*b);
return;
}
}
traverse(node);
}
};
struct AddHelperBone : public osg::NodeVisitor
{
AddHelperBone() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
void apply(osg::Transform& node) {
osgAnimation::Bone* bone = dynamic_cast<osgAnimation::Bone*>(&node);
if (bone)
bone->addChild(createAxis());
traverse(node);
}
};
int main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc, argv);
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is a 3d poker game client");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","List command line options.");
arguments.getApplicationUsage()->addCommandLineOption("--drawbone","draw helps to display bones.");
if (arguments.read("-h") || arguments.read("--help"))
{
arguments.getApplicationUsage()->write(std::cout, osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 0;
}
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout, osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
bool drawBone = false;
if (arguments.read("--drawbone"))
drawBone = true;
osgViewer::Viewer viewer(arguments);
osg::ref_ptr<osg::Group> group = new osg::Group();
osg::Group* node = dynamic_cast<osg::Group*>(osgDB::readNodeFiles(arguments)); //dynamic_cast<osgAnimation::AnimationManager*>(osgDB::readNodeFile(psr[1]));
if(!node)
{
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
return 1;
}
// Set our Singleton's model.
AnimationManagerFinder finder;
node->accept(finder);
if (finder._am.valid()) {
node->setUpdateCallback(finder._am.get());
AnimtkViewerModelController::setModel(finder._am.get());
} else {
osg::notify(osg::WARN) << "no osgAnimation::AnimationManagerBase found in the subgraph, no animations available" << std::endl;
}
if (drawBone) {
osg::notify(osg::INFO) << "Add Bones Helper" << std::endl;
AddHelperBone addHelper;
node->accept(addHelper);
}
node->addChild(createAxis());
AnimtkViewerGUI* gui = new AnimtkViewerGUI(&viewer, WIDTH, HEIGHT, 0x1234);
osg::Camera* camera = gui->createParentOrthoCamera();
node->setNodeMask(0x0001);
group->addChild(node);
group->addChild(camera);
viewer.addEventHandler(new AnimtkKeyEventHandler());
viewer.addEventHandler(new osgViewer::StatsHandler());
viewer.addEventHandler(new osgViewer::WindowSizeHandler());
viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));
viewer.addEventHandler(new osgWidget::MouseHandler(gui));
viewer.addEventHandler(new osgWidget::KeyboardHandler(gui));
viewer.addEventHandler(new osgWidget::ResizeHandler(gui, camera));
viewer.setSceneData(group.get());
viewer.setUpViewInWindow(40, 40, WIDTH, HEIGHT);
return viewer.run();
}

View File

@@ -1,46 +0,0 @@
/* -*-c++-*-
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
Authors:
Jeremy Moles <jeremy@emperorlinux.com>
Cedric Pinson <mornifle@plopbyte.net>
*/
#ifndef ANIMTKVIEWERGUI_H
#define ANIMTKVIEWERGUI_H
#include <osgWidget/WindowManager>
class AnimtkViewerGUI: public osgWidget::WindowManager {
osg::ref_ptr<osgWidget::Box> _buttonBox;
osg::ref_ptr<osgWidget::Box> _listBox;
osg::ref_ptr<osgWidget::Box> _labelBox;
protected:
osgWidget::Widget* _createButton(const std::string&);
bool _buttonPush(osgWidget::Event&);
bool _listMouseHover(osgWidget::Event&);
void _createButtonBox();
void _createListBox();
void _createLabelBox();
public:
AnimtkViewerGUI(osgViewer::View*, float, float, unsigned int);
};
#endif

View File

@@ -1,407 +0,0 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library 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
* OpenSceneGraph Public License for more details.
*
* Authors:
* Cedric Pinson <mornifle@plopbyte.net>
* jeremy Moles <jeremy@emperorlinux.com>
*/
#include "AnimtkViewer"
#include "AnimtkViewerGUI"
#include <osg/Version>
#include <osgWidget/WindowManager>
#include <osgAnimation/EaseMotion>
const std::string IMAGE_PATH = "osgWidget/";
template <class T>
struct Sampler: public osg::Drawable::UpdateCallback
{
T _motion;
Sampler() {
}
};
typedef Sampler<osgAnimation::OutQuadMotion> WidgetSampler;
struct ButtonFunctor: public WidgetSampler
{
float _direction;
float _previous;
const float _speed;
ButtonFunctor(): _speed(5) { _direction = -_speed; _previous = 0;}
bool enter(osgWidget::Event&)
{
_direction = _speed;
return true;
}
bool leave(osgWidget::Event&)
{
_direction = -_speed;
return true;
}
void update(osg::NodeVisitor* nv , osg::Drawable* geom)
{
const osg::FrameStamp* f = nv->getFrameStamp();
float dt = f->getSimulationTime() - _previous;
_previous = f->getSimulationTime();
update(dt,dynamic_cast<osgWidget::Widget*>(geom));
}
void update(float t, osgWidget::Widget* w)
{
if (!w) return;
_motion.update(t*_direction);
float val = _motion.getValue()*0.5;
val += 0.5;
if (val >= 1.0)
val = 1.0;
w->setColor(osg::Vec4(val, val, val, 1));
}
};
struct LabelFunctor: public WidgetSampler
{
float _previous;
bool _active;
const float _fadeOutTime;
osgAnimation::OutCubicMotion _scaleSampler;
LabelFunctor():
_fadeOutTime(1.5f)
{
_previous = 0.0f;
_active = false;
_scaleSampler = osgAnimation::OutCubicMotion(0.5, 1.0, 1.0);
}
void setActive(bool active)
{
_active = active;
if(active) _motion.reset();
_scaleSampler.reset();
}
void update(osg::NodeVisitor* nv , osg::Drawable* geom)
{
const osg::FrameStamp* f = nv->getFrameStamp();
float st = f->getSimulationTime();
float dt = st - _previous;
_previous = st;
if(!_active) return;
update(dt, dynamic_cast<osgWidget::Label*>(geom));
updateScale(dt, dynamic_cast<osgWidget::Label*>(geom));
}
void update(float t, osgWidget::Label* w)
{
if(!w) return;
_motion.update(t / _fadeOutTime);
float val = _motion.getValue();
if(val >= 1.0f) {
_motion.reset();
_active = false;
}
w->setFontColor(osg::Vec4(0.0f, 0.0f, 0.0f, (1.0f - val) * 0.7f));
}
void updateScale(float t, osgWidget::Label* w)
{
_scaleSampler.update(t);
float val = _scaleSampler.getValue();
osgWidget::Window* win = w->getParent();
win->setScale(val);
win->update();
}
};
struct ListFunctor: public osg::NodeCallback
{
float _previous;
int _direction;
osgAnimation::InQuadMotion _transformSampler;
ListFunctor()
{
_direction = 1;
_previous = 0;
_transformSampler.update(1.0f);
}
void toggleShown()
{
if(_direction == 1) _direction = -1;
else _direction = 1;
}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
const osg::FrameStamp* f = nv->getFrameStamp();
float st = f->getSimulationTime();
float dt = st - _previous;
_previous = st;
_transformSampler.update((dt * _direction) / 0.5f);
float val = _transformSampler.getValue();
if(val > 1.0f || val < 0.0f) return;
osgWidget::Window* win = dynamic_cast<osgWidget::Window*>(node);
float w = win->getWidth();
float wmw = win->getWindowManager()->getWidth();
win->setX((wmw - w) + (val * w));
win->update();
}
};
// This is a temporary hack to "prevent" dragging on Widgets and Windows.
bool eatDrag(osgWidget::Event&)
{
return true;
}
AnimtkViewerGUI::AnimtkViewerGUI(osgViewer::View* view, float w, float h, unsigned int mask):
osgWidget::WindowManager(view, w, h, mask, 0)
{
_createButtonBox();
_createLabelBox();
_createListBox();
_labelBox->setAnchorHorizontal(osgWidget::Window::HA_LEFT);
_labelBox->setY(74.0f);
_labelBox->setVisibilityMode(osgWidget::Window::VM_ENTIRE);
_listBox->setOrigin(getWidth(), 74.0f);
addChild(_buttonBox.get());
addChild(_labelBox.get());
addChild(_listBox.get());
resizeAllWindows();
// Remember, you can't call resizePercent until AFTER the box is parented
// by a WindowManager; how could it possibly resize itself if it doesn't know
// how large it's viewable area is?
_buttonBox->resizePercent(100.0f);
_buttonBox->resizeAdd(0.0f, 10.0f);
}
osgWidget::Widget* AnimtkViewerGUI::_createButton(const std::string& name)
{
osgWidget::Widget* b = new osgWidget::Widget(name, 64.0f, 64.0f);
if(!b) return 0;
b->setImage(IMAGE_PATH + name + ".png", true);
b->setEventMask(osgWidget::EVENT_MASK_MOUSE_DRAG);
ButtonFunctor* bt = new ButtonFunctor();
b->setUpdateCallback(bt);
b->addCallback(new osgWidget::Callback(&ButtonFunctor::enter, bt, osgWidget::EVENT_MOUSE_ENTER));
b->addCallback(new osgWidget::Callback(&ButtonFunctor::leave, bt, osgWidget::EVENT_MOUSE_LEAVE));
b->addCallback(new osgWidget::Callback(&AnimtkViewerGUI::_buttonPush, this, osgWidget::EVENT_MOUSE_PUSH));
b->addCallback(new osgWidget::Callback(&eatDrag, osgWidget::EVENT_MOUSE_DRAG));
return b;
}
bool AnimtkViewerGUI::_listMouseHover(osgWidget::Event& ev)
{
osgWidget::Label* l = dynamic_cast<osgWidget::Label*>(ev.getWidget());
if(!l) return false;
if(ev.type == osgWidget::EVENT_MOUSE_ENTER) l->setFontColor(1.0f, 1.0f, 1.0f, 1.0f);
else if(ev.type == osgWidget::EVENT_MOUSE_LEAVE) l->setFontColor(1.0f, 1.0f, 1.0f, 0.3f);
else if(ev.type == osgWidget::EVENT_MOUSE_PUSH) {
AnimtkViewerModelController::instance().playByName(ev.getWidget()->getName());
}
else return false;
return true;
}
bool AnimtkViewerGUI::_buttonPush(osgWidget::Event& ev)
{
if(!ev.getWidget()) return false;
osgWidget::Label* l = static_cast<osgWidget::Label*>(_labelBox->getByName("label"));
if(!l) return false;
LabelFunctor* lf = dynamic_cast<LabelFunctor*>(l->getUpdateCallback());
if(!lf) return false;
// We're safe at this point, so begin processing.
AnimtkViewerModelController& mc = AnimtkViewerModelController::instance();
std::string name = ev.getWidget()->getName();
if(name == "play") mc.play();
else if(name == "stop") mc.stop();
else if(name == "next")
{
mc.next();
l->setFontColor(osg::Vec4(0.0f, 0.0f, 0.0f, 0.7f));
l->setLabel(mc.getCurrentAnimationName());
lf->setActive(true);
}
else if(name == "back")
{
mc.previous();
l->setFontColor(osg::Vec4(0.0f, 0.0f, 0.0f, 0.7f));
l->setLabel(mc.getCurrentAnimationName());
lf->setActive(true);
}
else if(name == "pause")
{
}
else if(name == "open")
{
ListFunctor* lsf = dynamic_cast<ListFunctor*>(_listBox->getUpdateCallback());
if(!lsf) return false;
lsf->toggleShown();
}
else return false;
return true;
}
void AnimtkViewerGUI::_createButtonBox()
{
_buttonBox = new osgWidget::Box("buttonBox", osgWidget::Box::HORIZONTAL);
osgWidget::Widget* space = new osgWidget::Widget("nullSpace", 0.0f, 0.0f);
osgWidget::Widget* back = _createButton("back");
osgWidget::Widget* next = _createButton("next");
osgWidget::Widget* play = _createButton("play");
osgWidget::Widget* pause = _createButton("pause");
osgWidget::Widget* stop = _createButton("stop");
osgWidget::Widget* open = _createButton("open");
space->setCanFill(true);
space->setColor(0.0f, 0.0f, 0.0f, 0.0f);
_buttonBox->addWidget(space);
_buttonBox->addWidget(back);
_buttonBox->addWidget(next);
_buttonBox->addWidget(play);
_buttonBox->addWidget(pause);
_buttonBox->addWidget(stop);
_buttonBox->addWidget(open);
_buttonBox->addWidget(osg::clone(space, "space1", osg::CopyOp::DEEP_COPY_ALL));
_buttonBox->getBackground()->setColor(0.0f, 0.0f, 0.0f, 0.7f);
_buttonBox->setEventMask(osgWidget::EVENT_MASK_MOUSE_DRAG);
_buttonBox->addCallback(new osgWidget::Callback(&eatDrag, osgWidget::EVENT_MOUSE_DRAG));
}
void AnimtkViewerGUI::_createListBox()
{
_listBox = new osgWidget::Box("listBox", osgWidget::Box::VERTICAL);
const AnimtkViewerModelController::AnimationMapVector& amv =
AnimtkViewerModelController::instance().getAnimationMap()
;
for(
AnimtkViewerModelController::AnimationMapVector::const_iterator i = amv.begin();
i != amv.end();
i++
)
{
osgWidget::Label* label = new osgWidget::Label(*i);
label->setCanFill(true);
label->setFont("fonts/Vera.ttf");
label->setFontSize(15);
label->setFontColor(1.0f, 1.0f, 1.0f, 0.3f);
label->setPadding(5.0f);
label->setAlignHorizontal(osgWidget::Widget::HA_RIGHT);
label->setLabel(*i);
label->setEventMask(osgWidget::EVENT_MASK_MOUSE_DRAG);
label->addCallback(new osgWidget::Callback(&AnimtkViewerGUI::_listMouseHover, this, osgWidget::EVENT_MOUSE_ENTER));
label->addCallback(new osgWidget::Callback(&AnimtkViewerGUI::_listMouseHover, this, osgWidget::EVENT_MOUSE_LEAVE));
label->addCallback(new osgWidget::Callback(&AnimtkViewerGUI::_listMouseHover, this, osgWidget::EVENT_MOUSE_PUSH));
_listBox->addWidget(label);
}
ListFunctor* lf = new ListFunctor();
_listBox->setUpdateCallback(lf);
_listBox->getBackground()->setColor(0.0f, 0.0f, 0.0f, 0.7f);
}
void AnimtkViewerGUI::_createLabelBox()
{
_labelBox = new osgWidget::Box("labelBox", osgWidget::Box::VERTICAL);
osgWidget::Label* label = new osgWidget::Label("label");
label->setFont("fonts/Vera.ttf");
label->setFontSize(50);
label->setFontColor(0.0f, 0.0f, 0.0f, 0.7f);
label->setAlignHorizontal(osgWidget::Widget::HA_LEFT);
label->setPadding(10.0f);
LabelFunctor* lf = new LabelFunctor();
label->setUpdateCallback(lf);
_labelBox->addWidget(label);
_labelBox->getBackground()->setColor(0.0f, 0.0f, 0.0f, 0.0f);
}

View File

@@ -1,53 +0,0 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors:
*
* Cedric Pinson <mornifle@plopbyte.net>
*
*/
#ifndef ANIMTKVIEWER_KEYHANDLER_H
#define ANIMTKVIEWER_KEYHANDLER_H
#include "AnimtkViewer"
#include <osgGA/GUIEventHandler>
class AnimtkKeyEventHandler : public osgGA::GUIEventHandler
{
public:
AnimtkKeyEventHandler();
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa,
osg::Object*, osg::NodeVisitor*);
void printUsage() const;
protected:
enum Binding
{
List,
Help,
Play,
Next,
Prev
};
std::map<Binding, int> _actionKeys;
};
#endif

View File

@@ -1,63 +0,0 @@
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors:
*
* Cedric Pinson <mornifle@plopbyte.net>
*
*/
#include "AnimtkViewerKeyHandler"
AnimtkKeyEventHandler::AnimtkKeyEventHandler()
{
_actionKeys[List] = 'l';
_actionKeys[Help] = 'h';
_actionKeys[Play] = 'p';
_actionKeys[Next] = ']';
_actionKeys[Prev] = '[';
}
void AnimtkKeyEventHandler::printUsage() const
{
std::cout << (char) _actionKeys.find(Help)->second << " for Help" << std::endl;
std::cout << (char) _actionKeys.find(List)->second << " for List" << std::endl;
std::cout << (char) _actionKeys.find(Play)->second << " for Play" << std::endl;
std::cout << (char) _actionKeys.find(Next)->second << " for select Next item" << std::endl;
std::cout << (char) _actionKeys.find(Prev)->second << " for select Previous item" << std::endl;
}
bool AnimtkKeyEventHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter&,
osg::Object*, osg::NodeVisitor*)
{
AnimtkViewerModelController& mc = AnimtkViewerModelController::instance();
if(ea.getEventType() == osgGA::GUIEventAdapter::KEYDOWN)
{
if (ea.getKey() == _actionKeys[List]) return mc.list();
else if (ea.getKey() == _actionKeys[Play]) return mc.play();
else if (ea.getKey() == _actionKeys[Next]) return mc.next();
else if (ea.getKey() == _actionKeys[Prev]) return mc.previous();
else if (ea.getKey() == _actionKeys[Help])
{
printUsage();
return true;
}
}
return false;
}

View File

@@ -1,7 +0,0 @@
SET(TARGET_SRC
AnimtkViewer.cpp
AnimtkViewerKeyHandler.cpp
AnimtkViewerGUI.cpp
)
SET(TARGET_ADDED_LIBRARIES osgAnimation osgWidget)
SETUP_EXAMPLE(osganimationviewer)

View File

@@ -1,4 +0,0 @@
SET(TARGET_SRC osgautocapture.cpp )
#### end var setup ###
SETUP_EXAMPLE(osgautocapture)

View File

@@ -1,346 +0,0 @@
/**
* TODO:
* 1) Change example to use offscreen rendering (pbuffer) so that it becomes a true commandline tool with now windows
* 2) Make example work with other threading models than SingleThreaded
* 3) Add support for autocapture to movies
*
*/
#include <osg/ArgumentParser>
#include <osg/CoordinateSystemNode>
#include <osg/Matrix>
#include <osg/NodeVisitor>
#include <osgUtil/IntersectionVisitor>
#include <osgUtil/GLObjectsVisitor>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgGA/DriveManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/KeySwitchMatrixManipulator>
#include <osgGA/TerrainManipulator>
#include <osgGA/TrackballManipulator>
#include <osgTerrain/Terrain>
#include <osgTerrain/GeometryTechnique>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/Renderer>
#include <iostream>
#include <sstream>
/** Helper class*/
template<class T>
class FindTopMostNodeOfTypeVisitor : public osg::NodeVisitor
{
public:
FindTopMostNodeOfTypeVisitor():
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
_foundNode(0)
{}
void apply(osg::Node& node)
{
T* result = dynamic_cast<T*>(&node);
if (result)
_foundNode = result;
else
traverse(node);
}
T* _foundNode;
};
/** Convenience function*/
template<class T>
T* findTopMostNodeOfType(osg::Node* node)
{
if (!node) return 0;
FindTopMostNodeOfTypeVisitor<T> fnotv;
node->accept(fnotv);
return fnotv._foundNode;
}
/** Capture the frame buffer and write image to disk*/
class WindowCaptureCallback : public osg::Camera::DrawCallback
{
public:
WindowCaptureCallback(GLenum readBuffer, const std::string& name):
_readBuffer(readBuffer),
_fileName(name)
{
_image = new osg::Image;
}
virtual void operator () (osg::RenderInfo& renderInfo) const
{
glReadBuffer(_readBuffer);
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
osg::GraphicsContext* gc = renderInfo.getState()->getGraphicsContext();
if (gc->getTraits())
{
GLenum pixelFormat;
if (gc->getTraits()->alpha)
pixelFormat = GL_RGBA;
else
pixelFormat = GL_RGB;
int width = gc->getTraits()->width;
int height = gc->getTraits()->height;
std::cout<<"Capture: size="<<width<<"x"<<height<<", format="<<(pixelFormat == GL_RGBA ? "GL_RGBA":"GL_RGB")<<std::endl;
_image->readPixels(0, 0, width, height, pixelFormat, GL_UNSIGNED_BYTE);
}
if (!_fileName.empty())
{
std::cout << "Writing to: " << _fileName << std::endl;
osgDB::writeImageFile(*_image, _fileName);
}
}
protected:
GLenum _readBuffer;
std::string _fileName;
osg::ref_ptr<osg::Image> _image;
mutable OpenThreads::Mutex _mutex;
};
/** Do Culling only while loading PagedLODs*/
class CustomRenderer : public osgViewer::Renderer
{
public:
CustomRenderer(osg::Camera* camera)
: osgViewer::Renderer(camera),
_cullOnly(true)
{
setTargetFrameRate(1);
setMinimumTimeAvailableForGLCompileAndDeletePerFrame(1);
}
/** Set flag to omit drawing in renderingTraversals */
void setCullOnly(bool on) { _cullOnly = on; }
virtual void operator () (osg::GraphicsContext* /*context*/)
{
if (_graphicsThreadDoesCull)
{
if (_cullOnly)
cull();
else
cull_draw();
}
}
virtual void cull()
{
osgUtil::SceneView* sceneView = _sceneView[0].get();
if (!sceneView || _done ) return;
updateSceneView(sceneView);
osgViewer::View* view = dynamic_cast<osgViewer::View*>(_camera->getView());
if (view) sceneView->setFusionDistance(view->getFusionDistanceMode(), view->getFusionDistanceValue());
sceneView->inheritCullSettings(*(sceneView->getCamera()));
sceneView->cull();
}
bool _cullOnly;
};
//===============================================================
// MAIN
//
int main( int argc, char **argv )
{
osg::ArgumentParser arguments(&argc, argv);
osg::ApplicationUsage* usage = arguments.getApplicationUsage();
usage->setApplicationName(arguments.getApplicationName());
usage->setDescription(arguments.getApplicationName()+" loads a model, sets a camera position and automatically captures screenshot to disk");
usage->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
usage->addCommandLineOption("--camera <lat> <lon> <alt> <heading> <incline> <roll>", "Specify camera position for image capture. Angles are specified in degrees and altitude in meters above sealevel (e.g. --camera 55 10 300000 0 30 0)");
usage->addCommandLineOption("--filename", "Filename for the captured image", "autocapture.jpg");
usage->addCommandLineOption("--db-threads", "Number of DatabasePager threads to use", "2");
usage->addCommandLineOption("--active", "Use active rendering instead of passive / lazy rendering");
// Construct the viewer and register options arguments.
osgViewer::Viewer viewer(arguments);
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
// Get user specified number of DatabaseThreads
int dbThreads = 2;
arguments.read("--db-threads", dbThreads);
if (dbThreads < 1) dbThreads = 1;
osg::DisplaySettings::instance()->setNumOfDatabaseThreadsHint(dbThreads);
// Get user specified file name
std::string fileName("autocapture.jpg");
arguments.read("--filename", fileName);
// Rendering mode is passive by default
bool activeMode = false;
if (arguments.read("--active"))
activeMode = true;
// Read camera settings for screenshot
double lat=50;
double lon=10;
double alt=2000;
double heading=0;
double incline=45;
double roll=0;
bool camera_specified=false;
if (arguments.read("--camera", lat, lon, alt, heading, incline, roll))
{
camera_specified=true;
lat = osg::DegreesToRadians(lat);
lon = osg::DegreesToRadians(lon);
heading = osg::DegreesToRadians(heading);
incline = osg::DegreesToRadians(incline);
roll = osg::DegreesToRadians(roll);
}
// load the data
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
if (!loadedModel)
{
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
return 1;
}
// any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized();
// report any errors if they have occurred when parsing the program arguments.
if (arguments.errors())
{
arguments.writeErrorMessages(std::cout);
return 1;
}
// Setup specified camera
if (camera_specified)
{
osg::CoordinateSystemNode* csn = findTopMostNodeOfType<osg::CoordinateSystemNode>(loadedModel.get());
if(!csn) return 1;
// Compute eye point in world coordiantes
osg::Vec3d eye;
csn->getEllipsoidModel()->convertLatLongHeightToXYZ(lat, lon, alt, eye.x(), eye.y(), eye.z());
// Build matrix for computing target vector
osg::Matrixd target_matrix = osg::Matrixd::rotate(-heading, osg::Vec3d(1,0,0),
-lat, osg::Vec3d(0,1,0),
lon, osg::Vec3d(0,0,1));
// Compute tangent vector ...
osg::Vec3d tangent = target_matrix.preMult(osg::Vec3d(0, 0, 1));
// Compute non-inclined, non-rolled up vector ...
osg::Vec3d up(eye);
up.normalize();
// Incline by rotating the target- and up vector around the tangent/up-vector
// cross-product ...
osg::Vec3d up_cross_tangent = up ^ tangent;
osg::Matrixd incline_matrix = osg::Matrixd::rotate(incline, up_cross_tangent);
osg::Vec3d target = incline_matrix.preMult(tangent);
// Roll by rotating the up vector around the target vector ...
osg::Matrixd roll_matrix = incline_matrix * osg::Matrixd::rotate(roll, target);
up = roll_matrix.preMult(up);
viewer.getCamera()->setViewMatrixAsLookAt(eye, eye+target, up);
}
else
{
// Only add camera manipulators if camera is not specified
camera_specified=false;
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
}
// Optimize DatabasePager for auto-capture
osgDB::DatabasePager* pager = viewer.getDatabasePager();
pager->setDoPreCompile(false);
// Install custom renderer
osg::ref_ptr<CustomRenderer> customRenderer = new CustomRenderer(viewer.getCamera());
viewer.getCamera()->setRenderer(customRenderer.get());
// Override threading model
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
// Set the final SceneData to show
viewer.setSceneData(loadedModel.get());
// Realize GUI
viewer.realize();
//--- Load PageLOD tiles ---
// Initiate the first PagedLOD request
viewer.frame();
osg::Timer_t beforeLoadTick = osg::Timer::instance()->tick();
// Keep updating and culling until full level of detail is reached
while(!viewer.done() && pager->getRequestsInProgress())
{
// std::cout <<pager->getRequestsInProgress()<<" ";
viewer.updateTraversal();
viewer.renderingTraversals();
}
// std::cout<<std::endl;
osg::Timer_t afterLoadTick = osg::Timer::instance()->tick();
std::cout<<"Load and Compile time = "<<osg::Timer::instance()->delta_s(beforeLoadTick, afterLoadTick)<<" seconds"<<std::endl;
//--- Capture the image!!! ---
if (!activeMode)
{
// Do cull and draw to render the scene correctly
customRenderer->setCullOnly(false);
// Add the WindowCaptureCallback now that we have full resolution
viewer.getCamera()->setFinalDrawCallback(new WindowCaptureCallback(GL_BACK, fileName));
osg::Timer_t beforeRenderTick = osg::Timer::instance()->tick();
// Do rendering with capture callback
viewer.renderingTraversals();
osg::Timer_t afterRenderTick = osg::Timer::instance()->tick();
std::cout<<"Rendring time = "<<osg::Timer::instance()->delta_s(beforeRenderTick, afterRenderTick) <<" seconds"<<std::endl;
return 0;
}
else
{
return viewer.run();
}
}

View File

@@ -1,9 +0,0 @@
SET(TARGET_SRC
osgbrowser.cpp
)
SET(TARGET_ADDED_LIBRARIES osgWidget)
#### end var setup ###
SETUP_EXAMPLE(osgbrowser)

View File

@@ -1,41 +0,0 @@
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgWidget/Browser>
int main(int argc,char** argv)
{
osg::ArgumentParser arguments(&argc, argv);
osgWidget::BrowserManager::instance()->init(arguments[0]);
osgViewer::Viewer viewer(arguments);
osgWidget::GeometryHints hints(osg::Vec3(0.0f,0.0f,0.0f),
osg::Vec3(1.0f,0.0f,0.0f),
osg::Vec3(0.0f,0.0f,1.0f),
osg::Vec4(1.0f,1.0f,1.0f,1.0f),
osgWidget::GeometryHints::RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO);
osg::ref_ptr<osg::Group> group = new osg::Group;
for(int i=1; i<arguments.argc(); ++i)
{
if (!arguments.isOption(i))
{
osg::ref_ptr<osgWidget::Browser> browser = new osgWidget::Browser;
if (browser->open(arguments[i], hints))
{
group->addChild(browser.get());
hints.position.x() += 1.1f;
}
}
}
viewer.setSceneData(group.get());
viewer.addEventHandler(new osgViewer::StatsHandler);
return viewer.run();
}

View File

@@ -1,12 +0,0 @@
SET(TARGET_SRC
broadcaster.cpp
receiver.cpp
osgcluster.cpp
)
IF (WIN32)
SET(TARGET_EXTERNAL_LIBRARIES ws2_32)
ENDIF(WIN32)
#### end var setup ###
SETUP_EXAMPLE(osgcluster)

View File

@@ -37,7 +37,7 @@
#if defined(__linux)
#include <unistd.h>
#include <linux/sockios.h>
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#elif defined(__FreeBSD__)
#include <unistd.h>
#include <sys/sockio.h>
#elif defined(__sgi)
@@ -164,7 +164,7 @@ void Broadcaster::setHost( const char *hostname )
struct hostent *h;
if( (h = gethostbyname( hostname )) == 0L )
{
fprintf( stderr, "Broadcaster::setHost() - Cannot resolve an address for \"%s\".\n", hostname );
fprintf( stderr, "Broadcaster::setHost() - Cannot resolv an address for \"%s\".\n", hostname );
_address = 0;
}
else
@@ -196,7 +196,7 @@ void Broadcaster::sync( void )
unsigned int size = sizeof( SOCKADDR_IN );
sendto( _so, (const char *)_buffer, _buffer_size, 0, (struct sockaddr *)&saddr, size );
int err = WSAGetLastError ();
if (err!=0) fprintf( stderr, "Broadcaster::sync() - error %d\n",err );
int *dum = (int*) _buffer;
#else
unsigned int size = sizeof( struct sockaddr_in );
sendto( _so, (const void *)_buffer, _buffer_size, 0, (struct sockaddr *)&saddr, size );

View File

@@ -386,7 +386,7 @@ class DataConverter
_swapBytes = !_swapBytes;
}
cameraPacket._masterKilled = readUInt()!=0;
cameraPacket._masterKilled = readUInt();
read(cameraPacket._matrix);
read(cameraPacket._frameStamp);
@@ -413,7 +413,7 @@ void CameraPacket::readEventQueue(osgViewer::Viewer& viewer)
void CameraPacket::writeEventQueue(osgViewer::Viewer& viewer)
{
osg::notify(osg::INFO)<<"received events = "<<_events.size()<<std::endl;
osg::notify(osg::INFO)<<"recieved events = "<<_events.size()<<std::endl;
viewer.getEventQueue()->appendEvents(_events);
}
@@ -437,7 +437,7 @@ int main( int argc, char **argv )
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("-m","Set viewer to MASTER mode, sending view via packets.");
arguments.getApplicationUsage()->addCommandLineOption("-s","Set viewer to SLAVE mode, receiving view via packets.");
arguments.getApplicationUsage()->addCommandLineOption("-s","Set viewer to SLAVE mode, reciving view via packets.");
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");

View File

@@ -142,7 +142,7 @@ void Receiver::sync( void )
recvfrom( _so, (char *)_buffer, _buffer_size, 0, (sockaddr*)&saddr, &size );
// recvfrom(sock_Receive, szMessage, 256, 0, (sockaddr*)&addr_Cli, &clilen)
int err = WSAGetLastError ();
if (err!=0) fprintf( stderr, "Receiver::sync() - error %d\n",err );
int *dum = (int*) _buffer;
while( select( _so+1, &fdset, 0L, 0L, &tv ) )
{

View File

@@ -16,8 +16,6 @@
* THE SOFTWARE.
*/
#include <iostream>
#include <osgUtil/Optimizer>
#include <osgDB/ReadFile>
@@ -46,19 +44,19 @@
// class to handle events with a pick
class PickHandler : public osgGA::GUIEventHandler {
public:
public:
PickHandler():
_mx(0.0f),
_my(0.0f) {}
~PickHandler() {}
bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa)
{
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
if (!view) return false;
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::PUSH):
@@ -80,7 +78,7 @@ public:
}
return false;
}
void pick(osgViewer::View* view, float x, float y)
{
osg::Node* node = 0;
@@ -93,7 +91,7 @@ public:
osg::NodePath& nodePath = intersection.nodePath;
node = (nodePath.size()>=1)?nodePath[nodePath.size()-1]:0;
parent = (nodePath.size()>=2)?dynamic_cast<osg::Group*>(nodePath[nodePath.size()-2]):0;
}
}
// now we try to decorate the hit node by the osgFX::Scribe to show that its been "picked"
if (parent && node)
@@ -121,7 +119,7 @@ public:
}
}
float _mx, _my;
};
@@ -132,28 +130,26 @@ int main( int argc, char **argv )
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
// read the scene from the list of file specified commandline args.
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
if (!scene)
{
std::cout << argv[0] << ": requires filename argument." << std::endl;
return 1;
}
if (!scene) return 1;
// construct the viewer.
osgViewer::CompositeViewer viewer(arguments);
if (arguments.read("-1"))
{
{
osgViewer::View* view = new osgViewer::View;
view->setName("Single view");
view->setSceneData(osgDB::readNodeFile("fountain.osg"));
view->addEventHandler( new osgViewer::StatsHandler );
view->setUpViewAcrossAllScreens();
view->setCameraManipulator(new osgGA::TrackballManipulator);
viewer.addView(view);
@@ -166,7 +162,6 @@ int main( int argc, char **argv )
// view one
{
osgViewer::View* view = new osgViewer::View;
view->setName("View one");
viewer.addView(view);
view->setUpViewOnSingleScreen(0);
@@ -179,31 +174,30 @@ int main( int argc, char **argv )
view->addEventHandler( statesetManipulator.get() );
}
// view two
{
osgViewer::View* view = new osgViewer::View;
view->setName("View two");
viewer.addView(view);
view->setUpViewOnSingleScreen(1);
view->setSceneData(scene.get());
view->setCameraManipulator(new osgGA::TrackballManipulator);
view->addEventHandler( new osgViewer::StatsHandler );
// add the handler for doing the picking
view->addEventHandler(new PickHandler());
}
}
if (arguments.read("-3") || viewer.getNumViews()==0)
{
{
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
if (!wsi)
if (!wsi)
{
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
return 1;
@@ -239,11 +233,9 @@ int main( int argc, char **argv )
// view one
{
osgViewer::View* view = new osgViewer::View;
view->setName("View one");
viewer.addView(view);
view->setSceneData(scene.get());
view->getCamera()->setName("Cam one");
view->getCamera()->setViewport(new osg::Viewport(0,0, traits->width/2, traits->height/2));
view->getCamera()->setGraphicsContext(gc.get());
view->setCameraManipulator(new osgGA::TrackballManipulator);
@@ -253,7 +245,7 @@ int main( int argc, char **argv )
statesetManipulator->setStateSet(view->getCamera()->getOrCreateStateSet());
view->addEventHandler( statesetManipulator.get() );
view->addEventHandler( new osgViewer::StatsHandler );
view->addEventHandler( new osgViewer::HelpHandler );
view->addEventHandler( new osgViewer::WindowSizeHandler );
@@ -264,29 +256,25 @@ int main( int argc, char **argv )
// view two
{
osgViewer::View* view = new osgViewer::View;
view->setName("View two");
viewer.addView(view);
view->setSceneData(scene.get());
view->getCamera()->setName("Cam two");
view->getCamera()->setViewport(new osg::Viewport(traits->width/2,0, traits->width/2, traits->height/2));
view->getCamera()->setGraphicsContext(gc.get());
view->setCameraManipulator(new osgGA::TrackballManipulator);
// add the handler for doing the picking
view->addEventHandler(new PickHandler());
}
// view three
{
osgViewer::View* view = new osgViewer::View;
view->setName("View three");
viewer.addView(view);
view->setSceneData(osgDB::readNodeFile("cessnafire.osg"));
view->getCamera()->setName("Cam three");
view->getCamera()->setProjectionMatrixAsPerspective(30.0, double(traits->width) / double(traits->height/2), 1.0, 1000.0);
view->getCamera()->setViewport(new osg::Viewport(0, traits->height/2, traits->width, traits->height/2));
view->getCamera()->setGraphicsContext(gc.get());
@@ -295,12 +283,11 @@ int main( int argc, char **argv )
}
while (arguments.read("-s")) { viewer.setThreadingModel(osgViewer::CompositeViewer::SingleThreaded); }
while (arguments.read("-g")) { viewer.setThreadingModel(osgViewer::CompositeViewer::CullDrawThreadPerContext); }
while (arguments.read("-c")) { viewer.setThreadingModel(osgViewer::CompositeViewer::CullThreadPerCameraDrawThreadPerContext); }
// run the viewer's main frame loop
return viewer.run();
}

View File

@@ -9,18 +9,18 @@
#include <assert.h>
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <osg/Geometry>
#include <osg/Geode>
#include <osgDB/FileUtils>
#include <osgDB/fstream>
bool Utility::readFile(const char* fName, std::string& s)
{
std::string foundFile = osgDB::findDataFile(fName);
if (foundFile.empty()) return false;
osgDB::ifstream is;//(fName);
std::ifstream is;//(fName);
is.open(foundFile.c_str());
if (is.fail())
{
@@ -73,7 +73,7 @@ double Utility::getNoise(unsigned x, unsigned y, unsigned random)
int n = x + y * 57 + random * 131;
n = (n<<13) ^ n;
double noise = (1.0f - ( (n * (n * n * 15731 + 789221) +
1376312589)&0x7fffffff)* 0.000000000931322574615478515625f);
1376312589)&0x7fffffff)* 0.000000000931322574615478515625f);
return noise;
}
@@ -86,13 +86,13 @@ double Utility::smoothNoise(unsigned width, unsigned height, unsigned x, unsigne
return noise[x + y*width];
double corners = (noise[x-1 + (y-1) *width]
+noise[x+1 + (y-1)*width]
+noise[x-1 + (y+1) * width]
+noise[x+1 + (y+1) * width]) / 16.0;
+noise[x+1 + (y-1)*width]
+noise[x-1 + (y+1) * width]
+noise[x+1 + (y+1) * width]) / 16.0;
double sides = (noise[x-1 + y*width]
+noise[x+1 + y*width]
+noise[x + (y-1)*width]
+noise[x + (y+1)*width]) / 8.0;
+noise[x+1 + y*width]
+noise[x + (y-1)*width]
+noise[x + (y+1)*width]) / 8.0;
double center = noise[x + y*width] / 4.0;
return corners + sides + center;

View File

@@ -174,12 +174,27 @@ public:
private:
void rotate(float x, float y)
{
osg::Matrix baseMatrix = _modelGroupTransform->getMatrix();
osg::Matrixd baseMatrix = _modelGroupTransform->getMatrix();
baseMatrix.preMultTranslate(_rotCenter);
baseMatrix.preMultRotate(osg::Quat((x - _prevX) * 3, osg::Vec3d(0.0, 0.0, 1.0)));
baseMatrix.preMultRotate(osg::Quat(-(y - _prevY) * 3, (baseMatrix * osg::Vec3d(1.0, 0.0, 0.0))));
baseMatrix.preMultTranslate(-_rotCenter);
osg::Matrixd preTransMatrix;
osg::Matrixd postTransMatrix;
osg::Matrixd rotMatrixX;
osg::Matrixd rotMatrixZ;
preTransMatrix.makeTranslate(_rotCenter);
postTransMatrix.makeTranslate(-_rotCenter);
rotMatrixZ.makeRotate((x - _prevX) * 3., osg::Vec3d(0.0, 0.0,1.0));
baseMatrix.preMult(preTransMatrix);
baseMatrix.preMult(rotMatrixZ);
baseMatrix.preMult(postTransMatrix);
rotMatrixX.makeRotate(-(y - _prevY) * 3., (baseMatrix * osg::Vec3d(1.0, 0.0,0.0)));
baseMatrix.preMult(preTransMatrix);
baseMatrix.preMult(rotMatrixX);
baseMatrix.preMult(postTransMatrix);
_modelGroupTransform->setMatrix(baseMatrix);

View File

@@ -1,4 +0,0 @@
SET(TARGET_SRC osgdrawinstanced.cpp )
#### end var setup ###
SETUP_EXAMPLE(osgdrawinstanced)

View File

@@ -1,150 +0,0 @@
/* OpenSceneGraph example, osgdrawinstanced.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
//
// This code is copyright (c) 2008 Skew Matrix Software LLC. You may use
// the code under the licensing terms described above.
//
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <osg/Geometry>
#include <osg/Texture2D>
#include <osgDB/WriteFile>
#include <iostream>
void
createDAIGeometry( osg::Geometry& geom, int nInstances=1 )
{
const float halfDimX( .5 );
const float halfDimZ( .5 );
osg::Vec3Array* v = new osg::Vec3Array;
v->resize( 4 );
geom.setVertexArray( v );
// Geometry for a single quad.
(*v)[ 0 ] = osg::Vec3( -halfDimX, 0., -halfDimZ );
(*v)[ 1 ] = osg::Vec3( halfDimX, 0., -halfDimZ );
(*v)[ 2 ] = osg::Vec3( halfDimX, 0., halfDimZ );
(*v)[ 3 ] = osg::Vec3( -halfDimX, 0., halfDimZ );
// Use the DrawArraysInstanced PrimitiveSet and tell it to draw 1024 instances.
geom.addPrimitiveSet( new osg::DrawArrays( GL_QUADS, 0, 4, nInstances ) );
}
osg::StateSet*
createStateSet()
{
osg::ref_ptr< osg::StateSet > ss = new osg::StateSet;
// Create a vertex program that references the gl_InstanceID to
// render each instance uniquely. gl_InstanceID will be in the range
// 0 to numInstances-1 (1023 in our case).
std::string vertexSource =
"uniform sampler2D osgLogo; \n"
"uniform float osg_SimulationTime; \n"
"void main() \n"
"{ \n"
// Using the instance ID, generate "texture coords" for this instance.
"vec2 tC; \n"
"const float r = gl_InstanceID / 32.; \n"
"tC.s = fract( r ); tC.t = floor( r ) / 32.; \n"
// Get the color from the OSG logo.
"gl_FrontColor = texture2D( osgLogo, tC ); \n"
// Use the (scaled) tex coord to translate the position of the vertices.
"vec4 pos = vec4( tC.s * 48., 0., tC.t * 48., 1. ); \n"
// Compute a rotation angle from the instanceID and elapsed time.
"float timeOffset = gl_InstanceID / (32. * 32.); \n"
"float angle = ( osg_SimulationTime - timeOffset ) * 6.283; \n"
"float sa = sin( angle ); \n"
"float ca = cos( angle ); \n"
// New orientation, rotate around z axis.
"vec4 newX = vec4( ca, sa, 0., 0. ); \n"
"vec4 newY = vec4( sa, ca, 0., 0. ); \n"
"vec4 newZ = vec4( 0., 0., 1., 0. ); \n"
"mat4 mV = mat4( newX, newY, newZ, pos ); \n"
"gl_Position = ( gl_ModelViewProjectionMatrix * mV * gl_Vertex ); \n"
"} \n";
osg::ref_ptr< osg::Shader > vertexShader = new osg::Shader();
vertexShader->setType( osg::Shader::VERTEX );
vertexShader->setShaderSource( vertexSource );
osg::ref_ptr< osg::Program > program = new osg::Program();
program->addShader( vertexShader.get() );
ss->setAttribute( program.get(),
osg::StateAttribute::ON | osg::StateAttribute::PROTECTED );
osg::ref_ptr< osg::Image> iLogo = osgDB::readImageFile( "Images/osg128.png" );
if( !iLogo.valid() )
{
osg::notify( osg::ALWAYS ) << "Can't open image file osg128.png" << std::endl;
return( NULL );
}
osg::Texture2D* texLogo = new osg::Texture2D( iLogo.get() );
texLogo->setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR );
texLogo->setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR );
ss->setTextureAttribute( 0, texLogo );
osg::ref_ptr< osg::Uniform > texLogoUniform =
new osg::Uniform( "osgLogo", 0 );
ss->addUniform( texLogoUniform.get() );
return( ss.release() );
}
int main( int argc, char **argv )
{
osg::ArgumentParser arguments(&argc, argv);
// Make a scene graph consisting of a single Geode, containing
// a single Geometry, and a single PrimitiveSet.
osg::ref_ptr< osg::Geode > geode = new osg::Geode;
osg::ref_ptr< osg::Geometry > geom = new osg::Geometry;
// Configure the Geometry for use with EXT_draw_arrays:
// DL off and buffer objects on.
geom->setUseDisplayList( false );
geom->setUseVertexBufferObjects( true );
// OSG has no clue where out vertex shader will place the geometric data,
// so specify an initial bound to allow proper culling and near/far computation.
osg::BoundingBox bb( -1., -.1, -1., 49., 1., 49. );
geom->setInitialBound( bb );
// Add geometric data and the PrimitiveSet. Specify numInstances as 32*32 or 1024.
createDAIGeometry( *geom, 32*32 );
geode->addDrawable( geom.get() );
// Create a StateSet to render the instanced Geometry.
osg::ref_ptr< osg::StateSet > ss = createStateSet();
geode->setStateSet( ss.get() );
// osgDB::writeNodeFile(*geode, "instanced.osg");
osgViewer::Viewer viewer(arguments);
viewer.setSceneData( geode.get() );
return viewer.run();
}

View File

@@ -1,4 +0,0 @@
SET(TARGET_SRC osgfont.cpp)
SET(TARGET_ADDED_LIBRARIES osgText)
SETUP_EXAMPLE(osgfont)

View File

@@ -1,141 +0,0 @@
#include <cstdlib>
#include <sstream>
#include <osg/io_utils>
#include <osg/ArgumentParser>
#include <osg/Geode>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
void textInfo(osgText::Text* text)
{
const osgText::Text::TextureGlyphQuadMap& tgqm = text->getTextureGlyphQuadMap();
const osgText::Text::TextureGlyphQuadMap::const_iterator tgqmi = tgqm.begin();
const osgText::Text::GlyphQuads& gq = tgqmi->second;
osgText::String& s = text->getText();
for(unsigned int i = 0; i < s.size(); i++)
{
osg::Vec2 ul = gq.getCoords()[0 + (i * 4)]; // upperLeft
osg::Vec2 ll = gq.getCoords()[1 + (i * 4)]; // lowerLeft
osg::Vec2 lr = gq.getCoords()[2 + (i * 4)]; // lowerRight
osg::Vec2 ur = gq.getCoords()[3 + (i * 4)]; // upperRight
/*
osg::Vec3 ul = gq.getTransformedCoords(0)[0 + (i * 4)];
osg::Vec3 ll = gq.getTransformedCoords(0)[1 + (i * 4)];
osg::Vec3 lr = gq.getTransformedCoords(0)[2 + (i * 4)];
osg::Vec3 ur = gq.getTransformedCoords(0)[3 + (i * 4)];
*/
osg::notify(osg::NOTICE)
<< "'" << static_cast<char>(s[i]) << "':"
<< " width(" << lr.x() - ll.x() << ")"
<< " height(" << ul.y() - ll.y() << ")" << std::endl << "\t"
<< "ul(" << ul << "), "
<< "ll(" << ll << "), "
<< "lr(" << lr << "), "
<< "ur(" << ur << ")"
<< std::endl
;
}
}
osg::Camera* createOrthoCamera(double width, double height)
{
osg::Camera* camera = new osg::Camera();
camera->getOrCreateStateSet()->setMode(
GL_LIGHTING,
osg::StateAttribute::PROTECTED | osg::StateAttribute::OFF
);
osg::Matrix m = osg::Matrix::ortho2D(0.0f, width, 0.0f, height);
camera->setProjectionMatrix(m);
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera->setViewMatrix(osg::Matrix::identity());
camera->setClearMask(GL_DEPTH_BUFFER_BIT);
camera->setRenderOrder(osg::Camera::POST_RENDER);
return camera;
}
osgText::Text* createLabel(const std::string& l, const char* f, unsigned int size)
{
static osg::Vec3 pos(10.0f, 10.0f, 0.0f);
osgText::Text* label = new osgText::Text();
osgText::Font* font = osgText::readFontFile(f);
label->setFont(font);
label->setCharacterSize(size);
label->setFontResolution(size, size);
label->setColor(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
label->setPosition(pos);
label->setAlignment(osgText::Text::LEFT_BOTTOM);
// It seems to be important we do this last to get best results?
label->setText(l);
textInfo(label);
pos.y() += size + 10.0f;
return label;
}
typedef std::list<unsigned int> Sizes;
int main(int argc, char** argv)
{
osgViewer::Viewer viewer;
osg::ArgumentParser args(&argc, argv);
// Make sure we have the minimum args...
if(argc <= 2)
{
osg::notify(osg::FATAL) << "usage: " << args[0] << " fontfile size1 [size2 ...]" << std::endl;
return 1;
}
viewer.addEventHandler(new osgViewer::StatsHandler());
viewer.addEventHandler(new osgViewer::WindowSizeHandler());
osg::Group* group = new osg::Group();
osg::Camera* camera = createOrthoCamera(1280.0f, 1024.0f);
// Create the list of desired sizes.
Sizes sizes;
for(int i = 2; i < argc; i++)
{
if(!args.isNumber(i)) continue;
sizes.push_back(std::atoi(args[i]));
}
osg::Geode* geode = new osg::Geode();
// Add all of our osgText drawables.
for(Sizes::const_iterator i = sizes.begin(); i != sizes.end(); i++)
{
std::stringstream ss;
ss << *i << " 1234567890 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
geode->addDrawable(createLabel(ss.str(), args[1], *i));
}
camera->addChild(geode);
group->addChild(camera);
viewer.setSceneData(group);
return viewer.run();
}

View File

@@ -36,15 +36,12 @@
#include <osgDB/ReadFile>
#include <osgDB/FileUtils>
#include <osgUtil/LineSegmentIntersector>
#include <osgUtil/IntersectionVisitor>
#include <osgUtil/IntersectVisitor>
#include <osgUtil/SmoothingVisitor>
#include <osgText/Text>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/StateSetManipulator>
#include <iostream>
@@ -511,22 +508,22 @@ void ForestTechniqueManager::createTreeList(osg::Node* terrain,const osg::Vec3&
if (terrain)
{
osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector =
new osgUtil::LineSegmentIntersector(tree->_position,tree->_position+osg::Vec3(0.0f,0.0f,size.z()));
osgUtil::IntersectVisitor iv;
osg::ref_ptr<osg::LineSegment> segDown = new osg::LineSegment;
osgUtil::IntersectionVisitor iv(intersector.get());
segDown->set(tree->_position,tree->_position+osg::Vec3(0.0f,0.0f,size.z()));
iv.addLineSegment(segDown.get());
terrain->accept(iv);
if (intersector->containsIntersections())
if (iv.hits())
{
osgUtil::LineSegmentIntersector::Intersections& intersections = intersector->getIntersections();
for(osgUtil::LineSegmentIntersector::Intersections::iterator itr = intersections.begin();
itr != intersections.end();
++itr)
osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(segDown.get());
if (!hitList.empty())
{
const osgUtil::LineSegmentIntersector::Intersection& intersection = *itr;
tree->_position = intersection.getWorldIntersectPoint();
osg::Vec3 ip = hitList.front().getWorldIntersectPoint();
osg::Vec3 np = hitList.front().getWorldIntersectNormal();
tree->_position = ip;
}
}
}
@@ -1102,9 +1099,6 @@ int main( int argc, char **argv )
osg::ref_ptr<ForestTechniqueManager> ttm = new ForestTechniqueManager;
// add the stats handler
viewer.addEventHandler(new osgViewer::StatsHandler);
viewer.addEventHandler(new TechniqueEventHandler(ttm.get()));
viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));

View File

@@ -1,11 +0,0 @@
SET(TARGET_SRC
GameOfLifePass.cpp
osggameoflife.cpp
)
SET(TARGET_H
GameOfLifePass.h
)
#### end var setup ###
SETUP_EXAMPLE(osggameoflife)

View File

@@ -1,204 +0,0 @@
/* OpenSceneGraph example, osggameoflife.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "GameOfLifePass.h"
#include <osgDB/FileUtils>
#include <iostream>
ProcessPass::ProcessPass(osg::TextureRectangle *in_tex,
osg::TextureRectangle *out_tex,
int width, int height):
_TextureWidth(width),
_TextureHeight(height)
{
_RootGroup = new osg::Group;
_InTexture = in_tex;
_OutTexture = out_tex;
_Camera = new osg::Camera;
setupCamera();
_Camera->addChild(createTexturedQuad().get());
_RootGroup->addChild(_Camera.get());
setShader("shaders/gameoflife.frag");
}
ProcessPass::~ProcessPass()
{
}
osg::ref_ptr<osg::Group> ProcessPass::createTexturedQuad()
{
osg::ref_ptr<osg::Group> top_group = new osg::Group;
osg::ref_ptr<osg::Geode> quad_geode = new osg::Geode;
osg::ref_ptr<osg::Vec3Array> quad_coords = new osg::Vec3Array; // vertex coords
// counter-clockwise
quad_coords->push_back(osg::Vec3d(0, 0, -1));
quad_coords->push_back(osg::Vec3d(1, 0, -1));
quad_coords->push_back(osg::Vec3d(1, 1, -1));
quad_coords->push_back(osg::Vec3d(0, 1, -1));
osg::ref_ptr<osg::Vec2Array> quad_tcoords = new osg::Vec2Array; // texture coords
quad_tcoords->push_back(osg::Vec2(0, 0));
quad_tcoords->push_back(osg::Vec2(_TextureWidth, 0));
quad_tcoords->push_back(osg::Vec2(_TextureWidth, _TextureHeight));
quad_tcoords->push_back(osg::Vec2(0, _TextureHeight));
osg::ref_ptr<osg::Geometry> quad_geom = new osg::Geometry;
osg::ref_ptr<osg::DrawArrays> quad_da = new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4);
osg::ref_ptr<osg::Vec4Array> quad_colors = new osg::Vec4Array;
quad_colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
quad_geom->setVertexArray(quad_coords.get());
quad_geom->setTexCoordArray(0, quad_tcoords.get());
quad_geom->addPrimitiveSet(quad_da.get());
quad_geom->setColorArray(quad_colors.get());
quad_geom->setColorBinding(osg::Geometry::BIND_OVERALL);
_StateSet = quad_geom->getOrCreateStateSet();
_StateSet->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
_StateSet->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
_StateSet->setTextureAttributeAndModes(0, _InTexture.get(), osg::StateAttribute::ON);
_StateSet->addUniform(new osg::Uniform("textureIn", 0));
quad_geode->addDrawable(quad_geom.get());
top_group->addChild(quad_geode.get());
return top_group;
}
void ProcessPass::setupCamera()
{
// clearing
_Camera->setClearMask(GL_DEPTH_BUFFER_BIT);
// projection and view
_Camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1,0,1));
_Camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
_Camera->setViewMatrix(osg::Matrix::identity());
// viewport
_Camera->setViewport(0, 0, _TextureWidth, _TextureHeight);
_Camera->setRenderOrder(osg::Camera::PRE_RENDER);
_Camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
_Camera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER), _OutTexture.get());
}
void ProcessPass::setShader(std::string filename)
{
std::string foundFile = osgDB::findDataFile(filename);
if (foundFile.empty())
{
osg::notify(osg::NOTICE)<<"Could not file shader file: "<<filename<<std::endl;
return;
}
osg::ref_ptr<osg::Shader> fshader = new osg::Shader( osg::Shader::FRAGMENT );
fshader->loadShaderSourceFromFile(foundFile);
_FragmentProgram = 0;
_FragmentProgram = new osg::Program;
_FragmentProgram->addShader(fshader.get());
_StateSet->setAttributeAndModes(_FragmentProgram.get(), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE );
}
////////////////////////////////////////////////////////////////////////
GameOfLifePass::GameOfLifePass(osg::Image *in_image)
{
_TextureWidth = in_image->s();
_TextureHeight = in_image->t();
_RootGroup = new osg::Group;
_BranchSwith[0] = new osg::Switch;
_BranchSwith[1] = new osg::Switch;
_RootGroup->addChild(_BranchSwith[0].get());
_RootGroup->addChild(_BranchSwith[1].get());
_ActiveBranch = 0;
activateBranch();
createOutputTextures();
_InOutTextureLife[0]->setImage(in_image);
_ProcessPass[0] = new ProcessPass(_InOutTextureLife[0].get(),
_InOutTextureLife[1].get(),
_TextureWidth, _TextureHeight);
// For the other pass, the input/output textures are flipped
_ProcessPass[1] = new ProcessPass(_InOutTextureLife[1].get(),
_InOutTextureLife[0].get(),
_TextureWidth, _TextureHeight);
_BranchSwith[0]->addChild(_ProcessPass[0]->getRoot().get());
_BranchSwith[1]->addChild(_ProcessPass[1]->getRoot().get());
}
GameOfLifePass::~GameOfLifePass()
{
delete _ProcessPass[0];
delete _ProcessPass[1];
}
osg::ref_ptr<osg::TextureRectangle> GameOfLifePass::getOutputTexture()
{
int out_tex = (_ActiveBranch == 0) ? 1 : 0;
return _ProcessPass[out_tex]->getOutputTexture();
}
void GameOfLifePass::activateBranch()
{
int onb = _ActiveBranch;
int offb = (onb == 1) ? 0 : 1;
_BranchSwith[onb]->setAllChildrenOn();
_BranchSwith[offb]->setAllChildrenOff();
}
void GameOfLifePass::flip()
{
_ActiveBranch = (_ActiveBranch == 1) ? 0 : 1;
activateBranch();
}
void GameOfLifePass::createOutputTextures()
{
for (int i=0; i<2; i++) {
_InOutTextureLife[i] = new osg::TextureRectangle;
_InOutTextureLife[i]->setTextureSize(_TextureWidth, _TextureHeight);
_InOutTextureLife[i]->setInternalFormat(GL_RGBA);
_InOutTextureLife[i]->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);
_InOutTextureLife[i]->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);
}
}

View File

@@ -1,83 +0,0 @@
/* OpenSceneGraph example, osggameoflife.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef GAMEOFLIFEPASS_H
#define GAMEOFLIFEPASS_H 1
#include <osg/ref_ptr>
#include <osg/Group>
#include <osg/Switch>
#include <osg/Camera>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/Texture2D>
#include <osg/TextureRectangle>
class ProcessPass {
public:
ProcessPass(osg::TextureRectangle *in_tex,
osg::TextureRectangle *out_tex,
int width, int height);
~ProcessPass();
osg::ref_ptr<osg::Group> getRoot() { return _RootGroup; }
osg::ref_ptr<osg::TextureRectangle> getOutputTexture() { return _OutTexture; }
void setShader(std::string filename);
private:
osg::ref_ptr<osg::Group> createTexturedQuad();
void setupCamera();
osg::ref_ptr<osg::Group> _RootGroup;
osg::ref_ptr<osg::Camera> _Camera;
osg::ref_ptr<osg::TextureRectangle> _InTexture;
osg::ref_ptr<osg::TextureRectangle> _OutTexture;
int _TextureWidth;
int _TextureHeight;
osg::ref_ptr<osg::Program> _FragmentProgram;
osg::ref_ptr<osg::StateSet> _StateSet;
};
class GameOfLifePass {
public:
GameOfLifePass(osg::Image *in_image);
~GameOfLifePass();
osg::ref_ptr<osg::Group> getRoot() { return _RootGroup; }
osg::ref_ptr<osg::TextureRectangle> getOutputTexture();
void setShader(std::string filename);
// Switch branches so we flip textures
void flip();
private:
osg::ref_ptr<osg::Group> createTexturedQuad();
void setupCamera();
void createOutputTextures();
void activateBranch();
osg::ref_ptr<osg::Group> _RootGroup;
osg::ref_ptr<osg::Camera> _Camera;
osg::ref_ptr<osg::TextureRectangle> _InOutTextureLife[2];
int _TextureWidth;
int _TextureHeight;
int _ActiveBranch;
osg::ref_ptr<osg::Program> _FragmentProgram;
osg::ref_ptr<osg::StateSet> _StateSet;
osg::ref_ptr<osg::Switch> _BranchSwith[2];
ProcessPass *_ProcessPass[2];
};
#endif //GAMEOFLIFEPASS_H

View File

@@ -1,154 +0,0 @@
/* OpenSceneGraph example, osggameoflife.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <osg/Vec3>
#include <osg/Vec4>
#include <osg/Geometry>
#include <osg/Geode>
#include <osg/TextureRectangle>
#include <osgDB/FileUtils>
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/TrackballManipulator>
#include <iostream>
#include "GameOfLifePass.h"
GameOfLifePass *golpass;
osg::ref_ptr<osg::StateSet> geomss; // stateset where we can attach textures
osg::Node* createScene(osg::Image *start_im)
{
int width = start_im->s();
int height = start_im->t();
osg::Group* topnode = new osg::Group;
// create quad to display image on
osg::ref_ptr<osg::Geode> geode = new osg::Geode();
// each geom will contain a quad
osg::ref_ptr<osg::DrawArrays> da = new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4);
osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
osg::ref_ptr<osg::Vec2Array> tcoords = new osg::Vec2Array; // texture coords
tcoords->push_back(osg::Vec2(0, 0));
tcoords->push_back(osg::Vec2(width, 0));
tcoords->push_back(osg::Vec2(width, height));
tcoords->push_back(osg::Vec2(0, height));
osg::ref_ptr<osg::Vec3Array> vcoords = new osg::Vec3Array; // vertex coords
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
// initial viewer camera looks along y
vcoords->push_back(osg::Vec3d(0, 0, 0));
vcoords->push_back(osg::Vec3d(width, 0, 0));
vcoords->push_back(osg::Vec3d(width, 0, height));
vcoords->push_back(osg::Vec3d(0, 0, height));
geom->setVertexArray(vcoords.get());
geom->setTexCoordArray(0,tcoords.get());
geom->addPrimitiveSet(da.get());
geom->setColorArray(colors.get());
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geomss = geom->getOrCreateStateSet();
geomss->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
geode->addDrawable(geom.get());
topnode->addChild(geode.get());
// create the ping pong processing passes
golpass = new GameOfLifePass(start_im);
topnode->addChild(golpass->getRoot().get());
// attach the output of the processing to the geom
geomss->setTextureAttributeAndModes(0,
golpass->getOutputTexture().get(),
osg::StateAttribute::ON);
return topnode;
}
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 ping pong rendering with FBOs and mutliple rendering branches. It uses Conway's Game of Life to illustrate the concept.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] --startim start_image");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("--startim","The initial image to seed the game of life with.");
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
arguments.getApplicationUsage()->write(std::cout);
return 1;
}
std::string startName("");
while(arguments.read("--startim", startName)) {}
if (startName == "") {
arguments.getApplicationUsage()->write(std::cout);
return 1;
}
// load the image
osg::ref_ptr<osg::Image> startIm = osgDB::readImageFile(startName);
if (!startIm) {
std::cout << "Could not load start image.\n";
return(1);
}
osg::Node* scene = createScene(startIm.get());
// construct the viewer.
osgViewer::Viewer viewer;
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
// add the stats handler
viewer.addEventHandler(new osgViewer::StatsHandler);
viewer.setSceneData(scene);
viewer.realize();
viewer.setCameraManipulator( new osgGA::TrackballManipulator );
while(!viewer.done())
{
viewer.frame();
// flip the textures after we've completed a frame
golpass->flip();
// attach the proper output to view
geomss->setTextureAttributeAndModes(0,
golpass->getOutputTexture().get(),
osg::StateAttribute::ON);
}
return 0;
}

View File

@@ -110,7 +110,7 @@ int main( int argc, char **argv )
osg::Node* rootnode = osgDB::readNodeFiles(arguments);
if (!rootnode)
{
osg::notify(osg::NOTICE)<<"Please specify a geo model filename on the command line."<<std::endl;
osg::notify(osg::NOTICE)<<"Please specify and geo model filename on the command line."<<std::endl;
return 1;
}

View File

@@ -84,12 +84,11 @@ static const char* geomSource = {
"#version 120\n"
"#extension GL_EXT_geometry_shader4 : enable\n"
"uniform float u_anim1;\n"
"varying in vec4 v_color[];\n"
"varying out vec4 v_color_out;\n"
"varying vec4 v_color;\n"
"void main(void)\n"
"{\n"
" vec4 v = gl_PositionIn[0];\n"
" v_color_out = v + v_color[0];\n"
" v_color = v;\n"
"\n"
" gl_Position = v + vec4(u_anim1,0.,0.,0.); EmitVertex();\n"
" gl_Position = v - vec4(u_anim1,0.,0.,0.); EmitVertex();\n"
@@ -106,10 +105,10 @@ static const char* fragSource = {
"#version 120\n"
"#extension GL_EXT_geometry_shader4 : enable\n"
"uniform float u_anim1;\n"
"varying vec4 v_color_out;\n"
"varying vec4 v_color;\n"
"void main(void)\n"
"{\n"
" gl_FragColor = v_color_out;\n"
" gl_FragColor = v_color;\n"
"}\n"
};
@@ -179,7 +178,7 @@ public:
///////////////////////////////////////////////////////////////////////////
int main( int , char** )
int main( int argc, char *argv[] )
{
osg::Geode* root( new osg::Geode );
root->addDrawable( new SomePoints );

View File

@@ -54,7 +54,7 @@ public:
if (cv)
{
osg::Vec3 eyePointLocal = cv->getEyeLocal();
matrix.preMultTranslate(osg::Vec3(eyePointLocal.x(),eyePointLocal.y(),0.0f));
matrix.preMult(osg::Matrix::translate(eyePointLocal.x(),eyePointLocal.y(),0.0f));
}
return true;
}
@@ -68,7 +68,7 @@ public:
if (cv)
{
osg::Vec3 eyePointLocal = cv->getEyeLocal();
matrix.postMultTranslate(osg::Vec3(-eyePointLocal.x(),-eyePointLocal.y(),0.0f));
matrix.postMult(osg::Matrix::translate(-eyePointLocal.x(),-eyePointLocal.y(),0.0f));
}
return true;
}

View File

@@ -236,7 +236,7 @@ struct SnapeImageHandler : public osgGA::GUIEventHandler
_key(key),
_snapImage(si) {}
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter&)
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
{
if (ea.getHandled()) return false;

View File

@@ -1,4 +0,0 @@
SET(TARGET_SRC osgimagesequence.cpp )
#### end var setup ###
SETUP_EXAMPLE(osgimagesequence)

View File

@@ -1,360 +0,0 @@
/* OpenSceneGraph example, osgtexture3D.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <osg/Node>
#include <osg/Geometry>
#include <osg/Notify>
#include <osg/Texture1D>
#include <osg/Texture2D>
#include <osg/Texture3D>
#include <osg/TextureRectangle>
#include <osg/ImageSequence>
#include <osg/Geode>
#include <osgDB/Registry>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <iostream>
//
// A simple demo demonstrating how to set on an animated texture using an osg::ImageSequence
//
osg::StateSet* createState(osg::ArgumentParser& arguments)
{
osg::ref_ptr<osg::ImageSequence> imageSequence = new osg::ImageSequence;
bool preLoad = true;
while (arguments.read("--page-and-discard"))
{
imageSequence->setMode(osg::ImageSequence::PAGE_AND_DISCARD_USED_IMAGES);
preLoad = false;
}
while (arguments.read("--page-and-retain"))
{
imageSequence->setMode(osg::ImageSequence::PAGE_AND_RETAIN_IMAGES);
preLoad = false;
}
while (arguments.read("--preload"))
{
imageSequence->setMode(osg::ImageSequence::PRE_LOAD_ALL_IMAGES);
preLoad = true;
}
double length = -1.0;
while (arguments.read("--length",length)) {}
if (arguments.argc()>1)
{
for(int i=1; i<arguments.argc(); ++i)
{
if (preLoad)
{
osg::ref_ptr<osg::Image> image = osgDB::readImageFile(arguments[i]);
if (image.valid())
{
imageSequence->addImage(image.get());
}
}
else
{
imageSequence->addImageFile(arguments[i]);
}
}
if (length>0.0)
{
imageSequence->setLength(length);
}
else
{
unsigned int maxNum = osg::maximum(imageSequence->getFileNames().size(),
imageSequence->getImages().size());
imageSequence->setLength(float(maxNum)*0.1f);
}
}
else
{
if (length>0.0)
{
imageSequence->setLength(length);
}
else
{
imageSequence->setLength(4.0);
}
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/posx.png"));
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/negx.png"));
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/posy.png"));
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/negy.png"));
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/posz.png"));
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/negz.png"));
}
// start the image sequence playing
imageSequence->play();
#if 1
osg::Texture2D* texture = new osg::Texture2D;
texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
texture->setWrap(osg::Texture::WRAP_R,osg::Texture::REPEAT);
texture->setResizeNonPowerOfTwoHint(false);
texture->setImage(imageSequence.get());
//texture->setTextureSize(512,512);
#else
osg::TextureRectangle* texture = new osg::TextureRectangle;
texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
texture->setWrap(osg::Texture::WRAP_R,osg::Texture::REPEAT);
texture->setImage(imageSequence.get());
//texture->setTextureSize(512,512);
#endif
// create the StateSet to store the texture data
osg::StateSet* stateset = new osg::StateSet;
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
return stateset;
}
osg::Node* createModel(osg::ArgumentParser& arguments)
{
// create the geometry of the model, just a simple 2d quad right now.
osg::Geode* geode = new osg::Geode;
geode->addDrawable(osg::createTexturedQuadGeometry(osg::Vec3(0.0f,0.0f,0.0), osg::Vec3(1.0f,0.0f,0.0), osg::Vec3(0.0f,0.0f,1.0f)));
geode->setStateSet(createState(arguments));
return geode;
}
osg::ImageStream* s_imageStream = 0;
class MovieEventHandler : public osgGA::GUIEventHandler
{
public:
MovieEventHandler():_playToggle(true),_trackMouse(false) {}
void setMouseTracking(bool track) { _trackMouse = track; }
bool getMouseTracking() const { return _trackMouse; }
void set(osg::Node* node);
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv);
virtual void getUsage(osg::ApplicationUsage& usage) const;
typedef std::vector< osg::observer_ptr<osg::ImageStream> > ImageStreamList;
protected:
virtual ~MovieEventHandler() {}
class FindImageStreamsVisitor : public osg::NodeVisitor
{
public:
FindImageStreamsVisitor(ImageStreamList& imageStreamList):
_imageStreamList(imageStreamList) {}
virtual void apply(osg::Geode& geode)
{
apply(geode.getStateSet());
for(unsigned int i=0;i<geode.getNumDrawables();++i)
{
apply(geode.getDrawable(i)->getStateSet());
}
traverse(geode);
}
virtual void apply(osg::Node& node)
{
apply(node.getStateSet());
traverse(node);
}
inline void apply(osg::StateSet* stateset)
{
if (!stateset) return;
osg::StateAttribute* attr = stateset->getTextureAttribute(0,osg::StateAttribute::TEXTURE);
if (attr)
{
osg::Texture2D* texture2D = dynamic_cast<osg::Texture2D*>(attr);
if (texture2D) apply(dynamic_cast<osg::ImageStream*>(texture2D->getImage()));
osg::TextureRectangle* textureRec = dynamic_cast<osg::TextureRectangle*>(attr);
if (textureRec) apply(dynamic_cast<osg::ImageStream*>(textureRec->getImage()));
}
}
inline void apply(osg::ImageStream* imagestream)
{
if (imagestream)
{
_imageStreamList.push_back(imagestream);
s_imageStream = imagestream;
}
}
ImageStreamList& _imageStreamList;
protected:
FindImageStreamsVisitor& operator = (const FindImageStreamsVisitor&) { return *this; }
};
bool _playToggle;
bool _trackMouse;
ImageStreamList _imageStreamList;
};
void MovieEventHandler::set(osg::Node* node)
{
_imageStreamList.clear();
if (node)
{
FindImageStreamsVisitor fisv(_imageStreamList);
node->accept(fisv);
}
}
bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv)
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (ea.getKey()=='p')
{
for(ImageStreamList::iterator itr=_imageStreamList.begin();
itr!=_imageStreamList.end();
++itr)
{
if ((*itr)->getStatus()==osg::ImageStream::PLAYING)
{
// playing, so pause
std::cout<<"Pause"<<std::endl;
(*itr)->pause();
}
else
{
// playing, so pause
std::cout<<"Play"<<std::endl;
(*itr)->play();
}
}
return true;
}
else if (ea.getKey()=='r')
{
for(ImageStreamList::iterator itr=_imageStreamList.begin();
itr!=_imageStreamList.end();
++itr)
{
std::cout<<"Restart"<<std::endl;
(*itr)->rewind();
}
return true;
}
else if (ea.getKey()=='L')
{
for(ImageStreamList::iterator itr=_imageStreamList.begin();
itr!=_imageStreamList.end();
++itr)
{
if ( (*itr)->getLoopingMode() == osg::ImageStream::LOOPING)
{
std::cout<<"Toggle Looping Off"<<std::endl;
(*itr)->setLoopingMode( osg::ImageStream::NO_LOOPING );
}
else
{
std::cout<<"Toggle Looping On"<<std::endl;
(*itr)->setLoopingMode( osg::ImageStream::LOOPING );
}
}
return true;
}
return false;
}
default:
return false;
}
}
void MovieEventHandler::getUsage(osg::ApplicationUsage& usage) const
{
usage.addKeyboardMouseBinding("p","Play/Pause movie");
usage.addKeyboardMouseBinding("r","Restart movie");
usage.addKeyboardMouseBinding("l","Toggle looping of movie");
}
int main(int argc, char **argv)
{
osg::ArgumentParser arguments(&argc,argv);
// construct the viewer.
osgViewer::Viewer viewer(arguments);
std::string filename;
arguments.read("-o",filename);
// create a model from the images and pass it to the viewer.
viewer.setSceneData(createModel(arguments));
// pass the model to the MovieEventHandler so it can pick out ImageStream's to manipulate.
MovieEventHandler* meh = new MovieEventHandler();
meh->set( viewer.getSceneData() );
viewer.addEventHandler( meh );
viewer.addEventHandler( new osgViewer::StatsHandler());
if (!filename.empty())
{
osgDB::writeNodeFile(*viewer.getSceneData(),filename);
}
return viewer.run();
}

View File

@@ -1,9 +0,0 @@
SET(TARGET_SRC
osgkdtree.cpp
)
SET(TARGET_ADDED_LIBRARIES osgSim )
#### end var setup ###
SETUP_EXAMPLE(osgkdtree)

Some files were not shown because too many files have changed in this diff Show More