Compare commits

..

45 Commits

Author SHA1 Message Date
Paul MARTZ
838bdcf35e Creating the 2.6.1 tag release. 2008-10-02 16:52:38 +00:00
Paul MARTZ
0798f09cfe Another (hopefully) final tweak to the workaround for the occlusion query issue in NVIDIA cards. 2008-10-02 16:44:06 +00:00
Paul MARTZ
9f0592cac7 Modification to r8795 to sleep inside the loop that checks for availability of the occlusion query result. 2008-09-29 21:02:02 +00:00
Paul MARTZ
2167f34d50 Update wrappers for 2.6.1. 2008-09-26 14:33:31 +00:00
Paul MARTZ
a0959c5fa4 Update ChangeLog to include changes for 2.6.1 release. 2008-09-23 17:04:44 +00:00
Paul MARTZ
3c9713ff60 Merge rev 8900 (Fix for FLT plugin user data handling) onto 2.6.1 branch. 2008-09-23 17:00:24 +00:00
Paul MARTZ
449448fd88 Merge rev 8821 (cmake 'maintainer' enhancements for tags) onto 2.6.1 branch. 2008-09-23 16:27:39 +00:00
Paul MARTZ
7e7208c8d3 Merge rev 8804 (Change AutoTransform interface to use doubles; osgTerrain wrapper modification for Layer.cpp) onto 2.6.1 branch. 2008-09-23 16:04:48 +00:00
Paul MARTZ
a24d91d1a9 Merge rev 8799, 8800 (cmake targets for wrappers and changelog) onto 2.6.1 branch. 2008-09-23 15:51:21 +00:00
Paul MARTZ
2810e72104 Merge rev 8775,8776 (BlendEquation support in .osg/.ive) onto 2.6.1. 2008-09-23 15:39:08 +00:00
Paul MARTZ
a5c89f469b Finish the job of bumping the version number to 2.6.1. Cange SOVERSION to 48, and change both the SOVERSION and OSG version numbers in the CMakeLists.txt. 2008-09-18 22:06:30 +00:00
Paul MARTZ
4824eac91e Merge in r8888 to correctly init the strip textures option in the OpenFlight exporter. 2008-09-18 15:32:53 +00:00
Paul MARTZ
b310af4ed9 Merge 8765 from trunk. This resolves an FBO issue encountered by Jason Beverage. 2008-09-16 17:25:39 +00:00
Paul MARTZ
02d3c097e4 Merged revisions 8795 and 8796 from trunk. This is the workaround for occlusion query on NVIDIA plus the cmake interface to enable it. Also bumped the rev to 2.6.1 in anticipation of upcoming branch release. 2008-09-16 17:16:01 +00:00
Robert Osfield
438e8506fc merged from svn trunk using :
svn merge -r 8852:8853 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk .

From Robert Osfield, "Introduced Geometry::containsSharedArrays() and Geometry::duplicateSharedArrays() to
support a fix to the osgUtil::Simplifier that couldn't handle shared arrays"
2008-09-14 10:35:07 +00:00
Paul MARTZ
dbf669030f From Paul Martz. Fix computation of the PositionAttitudeTransform matrix during export. 2008-08-22 18:11:36 +00:00
Robert Osfield
98ce387440 Merged addition osgWidget to doxygen doc build using:
svn merge -r 8746:8747 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk .
2008-08-05 20:07:20 +00:00
Robert Osfield
744c1cc464 From Eric Sokolowski, release notes for OSX. 2008-08-05 19:57:22 +00:00
Robert Osfield
2be018230d Merged improvements to namespace doxygen comments from svn/trunk. 2008-08-05 19:23:38 +00:00
Robert Osfield
e84e2b0025 Merged in from svn/trunk of Eric Sokolowski's disabling of 64bit build under OSX. Merge command:
svn merge -r 8741:8742 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk .
2008-08-05 16:10:49 +00:00
Robert Osfield
46afd39b51 merged changes in from svn/trunk using :
svn merge -r 8736:8738 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk .
2008-08-05 15:32:03 +00:00
Robert Osfield
822fec0302 Updated READE for 2.6.0 release 2008-08-05 15:31:17 +00:00
Robert Osfield
3ae660c8eb Updated NEWS for 2.6.0 release 2008-08-05 14:05:56 +00:00
Robert Osfield
0a82439a9c Updated ChangeLog, Authors file and tweak to osgversion to prevent inappropriate class names being added to authors file 2008-08-05 13:52:51 +00:00
Robert Osfield
b2db19e976 Updated wrappers 2008-08-05 10:31:05 +00:00
Robert Osfield
5d8ec3027e Updated SO version number to reflect typo fixes changing the API 2008-08-05 10:23:31 +00:00
Robert Osfield
24b608cacb Added support for both the old autoScaleTransistionWidthRatio (note typo) and newly fixed autoScaleTransitionWidthRatio in the .osg parsing 2008-08-05 10:20:20 +00:00
Paul MELIS
af9ccc5596 - Fixes for two spelling mistakes 2008-08-05 09:58:31 +00:00
Robert Osfield
cc3d0903db Added -losgWidget to lib list, change merged in from svn trunk, using : svn merge -r 8727:8728 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk . 2008-08-04 20:50:20 +00:00
Robert Osfield
faef4cea61 From Sherman Wilcox, "Minor change to bool setGLExtensionFuncPtr(T& t, const char* str1) and
setGLExtensionFuncPtr(T& t, const char* str1, const char* str2) -
functions returned false even on success."

Note, merged from svn/trunk using:

  svn merge -r 8725:8726 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk .
2008-08-04 17:10:20 +00:00
Robert Osfield
c3e42eda62 Updated ChangeLog for 2.6.0-rc2 2008-08-04 15:30:07 +00:00
Robert Osfield
62ed1a838b Updated NEWS and AUTHORS for 2.6.0-rc2 from osg trunk, using "svn merge -r 8719:8722 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk ." 2008-08-04 15:21:32 +00:00
Robert Osfield
a0e4779d76 merged Philip Pulman's Centos 5 compile fix from trunk using : svn merge -r 8717:8718 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk . 2008-08-04 14:04:14 +00:00
Robert Osfield
c3e394ba3e Merged multi-threaded crash fix to PrecipitationEffect, using "svn merge -r 8715:8716 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk ." 2008-08-04 12:48:31 +00:00
Robert Osfield
5c312685cd Merged from svn/trunk the removal of debugging info 2008-08-04 12:39:59 +00:00
Robert Osfield
d801620b6c Merged LineSegment and Quicktime fixes from svn/trunk, using : merge -r 8709:8712 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk . 2008-08-04 09:07:21 +00:00
Robert Osfield
22246158a5 Merged KdTree update from svn trunk using "svn merge -r 8706:8707 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk ." 2008-08-03 17:02:32 +00:00
Paul MARTZ
bbd40ca107 From Jean-Sebastien Guay. Fix for stuck keys problem when viewer loses focus. Equivalent to Melchior Franz's fix for the same issue in GraphicsWindowX11. When the application loses focus, all currently pressed keys are released. When it regains focus, keys are queried to see which are currently pressed and keydown messages are sent for those.
Also, from Daniel Olivier. Fix for windows based on GraphicsWindowWin32 not switching to the resize mouse cursors when the mouse goes close to window borders.
2008-07-31 17:47:09 +00:00
Paul MARTZ
2e11d93587 From Philip Lowman. #define WIN32_WINNT 0x400, consistent with other code in OpenThreads. Resolves a compile warning on mingw. 2008-07-31 14:43:16 +00:00
Paul MARTZ
48e70c0948 From Philip Lowman: The osgWidget/Window header file is missing a few export (declspec) declarations on some namespace functions. I noticed because MinGW is failing to link the osgwidgetbox example. 2008-07-30 15:45:28 +00:00
Paul MARTZ
38c14644d2 From Philip Lowman: Add #include <stdlib.h> for mingw build. 2008-07-30 15:37:50 +00:00
Paul MARTZ
1f7febfa92 From Glenn Waldron: Just downgrading a notify message in SpatializeGroupsVisitor ... one-line change. 2008-07-30 15:10:34 +00:00
Paul MARTZ
ed722b5fc7 From Glenn Waldron: The enum value for osgUtil::OptimizerOptions::FLATTEN_STATIC_TRANSFORMS_DUPLICATING_SHARED_SUBGRAPHS is set to 0x100, but it should probably be 0x10000. (From Paul Martz: changed enums to use "1 << n"-style values.) 2008-07-30 15:03:41 +00:00
Robert Osfield
f9fda5d081 Made 2.6 branch 2008-07-25 21:16:14 +00:00
Robert Osfield
97cb28ea8e Release OpenSceneGraph-2.6.0-rc1 2008-07-25 21:14:22 +00:00
1148 changed files with 44681 additions and 123042 deletions

View File

@@ -1,6 +1,6 @@
OpenSceneGraph Library 2.8.1
OpenSceneGraph Library 2.6.0
372 Contributors:
324 Contributors:
Firstname Surname
-----------------
@@ -10,98 +10,88 @@ Marco Jez
Paul Martz
Mike Weiblen
Eric Wing
Stephan Huber
Mathias Fr<46>hlich
Brede Johansen
Stephan Huber
Geoff Michel
Farshid Lashkari
Bob Kuehne
Ulrich Hertlein
Mathias Fr<46>hlich
Eric Sokolowsky
Jean-Sebastien Guay
Ulrich Hertlein
Martin Lavery
David Callu
Tree
Jean-Sebastien Guay
Luigi Calori
Trajce Nikolov
Mike Wittman
Wojciech Lewandowski
Paul Melis
Pavel Moloshtan
Colin McDonald
Tom Jolley
Andy Skinner
Roger James
Pavel Moloshtan
Mattias Helsing
Tom Jolley
Jeremy Moles
Jason Beverage
Norman Vine
Cedric Pinson
Art Tevs
Jeremy Moles
Alberto Farre
Roland Smeenk
Michael Platings
Andr<EFBFBD> Garneau
Wojciech Lewandowski
Ruben Lopez
Randall Hopper
Jason Daly
J.P. Delport
Adrian Egli
Art Tevs
Olaf Flebbe
Mathieu Marache
Gideon May
Don Tidrow
Sherman Wilcox
Romano Jos<6F> Magacho da Silva
Per Fahlberg
Philip Lowman
Paul Melis
Michael Platings
Michael Gronager
Joakim Simonsson
David Spilling
Daniel Sj<53>lie
Chris Hanson
Alberto Luaces
Philip Lowman
Chris Denham
Adrian Egli
Sherman Wilcox
Per Fahlberg
J.P. Delport
David Spilling
Melchior Franz
Serge Lages
Lionel Lagarde
Joran Jessurun
Joakim Simonsson
Jason Beverage
Jason Daly
Frederic Marmond
David Fries
Bryan Thrall
Boris Bralo
Yefei He
Tim Moore
Terry Welsh
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
Mathieu Marache
Glenn Waldron
Carlo Camporesi
Ben Discoe
Andreas Ekstrand
Thibault Genessay
Sukender
Stephane Lamoliatte
Sasa Bistrovic
Martin Naylor
Martin Aumueller
Markus Trenkwalder
Mario Valle
Loic Dachary
Joseph Steel
John Shue
Jan Peciva
Jan Ciger
Glenn Waldron
Gordon Tomlinson
Gino van den Bergen
Bryan Thrall
Brad Colbert
Vivek Rajan
Thibault Genessay
Sean Spicer
Ravi Mathur
Peter Hrenka
Nikolaus Hanekamp
Neil Salter
Mihai Radu
@@ -110,48 +100,41 @@ Luc Frauciel
Laurens Voerman
David Guthrie
Corbin Holtz
Cedric Pinson
Brad Christiansen
Blasius Czink
Toshiyuki Takahei
Thom DeCarlo
Tatsuhiro Nishioka
Simon Julier
Sebastien Grignard
Romano Magacho
Richard Schmidt
Riccardo Corsi
Ralf Habacker
Roland Smeenk
Paul de Repentigny
Liang Aibin
Leandro Motta Barros
John Vidar Larring
John Kelso
Daniel Larimer
Csaba Halasz
Colin Dunlop
Bruce Clay
Alberto Luaces
Alberto Barbati
Vladimir Shabanov
Uwe Woessner
Tony Horrobin
Tim Moore
Sohey Yamamoto
Rudolf Wiedemann
Richard Schmidt
Rafa Gaitan
Phil Atkin
Miguel Escriva
Peter Hrenka
Neil Groves
Mattias Linde
Mattias Helsing
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
@@ -159,66 +142,54 @@ 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
Rudolf Wiedemann
Riccardo Corsi
Ralf Kern
Pierre Haritchabalet
Perry Miller
Paul Obermeier
Neil Hughes
Nathan Monteleone
Morn<EFBFBD> Pistorius
Miguel Escriva
Michael Henheffer
Michael Guerrero
Maya Leonard
Max Bandazian
Max Behensky
Mathew May
Martin Spott
Martijn Kragtwijk
Liang Aibin
Kevin Moiule
Keith Steffen
Katharina Plugge
Joseph Winston
John Aughey
Johan Nouvel
Jim Vaughan
James Moliere
Igor Kravtchenko
He Sicong
Gustavo Wagner
Guillaume Chouvenc
Gerrick Bivins
George Tarantilis
Frederic Bouvier
Ferdi Smit
Ewe Woessner
Erik den Dekker
Fabio Mierlo
Edgar Ellis
Don Leich
Doug McCorkle
David Ergo
Daniel Trstenjak
Christophe Loustaunau
Csaba Halasz
Brad Anderegg
Andrew Sampson
Andrew Lorino
Andreas Goebel
Zbigniew Sroczynski
Yuri Vilmanis
Warren Macchi
Wang Rui
Wang Lam
Walter J. Altice
Volker Walkiewicz
@@ -232,45 +203,37 @@ Tyge
Troy Yee
Tomas Hnilica
Tino Schwarze
Thomas Weidner
Thom Carlo
Tery Welsh
Tatsuhiro Nishioka
Tanguy Fautr<74>
Steven Thomas
Simon Hammett
Sid Byce
Shuxing Xiao
Shane Arnott
Sebastien Kuntz
Ruth Lang
Ruben Smelik
Ross Anderson
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
Patrick Hartling
Parag Chaudhur
Panagiotis Papadakos
Panagiotis Koutsourakis
Orhun Birsoy
Ole-Morten Duesund
Nicolas Brodu
Neil Hughes
Nathan Cournia
Morten Haukness
Morn<EFBFBD> Pistorius
Mirko Viviani
Mikkel Gjøl
Mike Garrity
@@ -278,59 +241,51 @@ 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 Guimaraes
Marin Lavery
Marco Lehmann
Marcin Prus
Maciej Krol
Lukas Diduch
Louis Hamilton
Lilin Xiong
Lewis Harmon
Lars Nilson
Kyle Centers
Kristopher Bixler
Konstantin Sinitsyn
Karsten Weiss
Karl Heijdenberg
Jutta Sauer
Julian Scheid
Josh Portway
John Vidar Larring
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
@@ -342,14 +297,14 @@ Douglas A. Pouk
Dean Iverson
David Jung
David Gurhrie
Danny Valente
Daniel Stien
Daniel Olivier
Dan Minor
Cyril Brulebois
Clay Fowler
Chuck Sembroski
Chuck Seberion
Christopher Blaesius
Christophe Loustaunau
Christian Kaser
Chris McGlone
Carlos Garcea
@@ -357,13 +312,11 @@ Bruno Herbelin
Brian Keener
Brandon Hamm
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
@@ -374,5 +327,4 @@ Alberto Jaspe
Alan Purvis
Alan Ott
Alan Harris
Alan Dickinson
Adam Richard

View File

@@ -3,6 +3,9 @@ IF(WIN32)
ELSE(WIN32)
IF(APPLE)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 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)
@@ -16,20 +19,14 @@ if(COMMAND cmake_policy)
# 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_MINOR_VERSION 6)
SET(OPENSCENEGRAPH_PATCH_VERSION 1)
SET(OPENSCENEGRAPH_SOVERSION 55)
SET(OPENSCENEGRAPH_SOVERSION 48)
# 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
@@ -60,6 +57,16 @@ 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
@@ -81,9 +88,8 @@ 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_SVN "trunk")
#SET(OPENSCENEGRAPH_SVN "branches")
SET(OPENSCENEGRAPH_BRANCH OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION})
#
@@ -92,12 +98,12 @@ IF (OSG_MAINTAINER)
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)
SET(SVNBRANCHDIR http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branch)
IF (OPENSCENEGRAPH_SVN STREQUAL "trunk")
SET(SVNSOURCEDIR ${SVNTRUNKDIR})
ELSE (OPENSCENEGRAPH_SVN STREQUAL "trunk")
SET(SVNSOURCEDIR ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH})
SET(SVNSOURCEDIR ${SVNBRANCH_DIR}/${OPENSCENEGRAPH_BRANCH})
ENDIF(OPENSCENEGRAPH_SVN STREQUAL "trunk")
@@ -127,11 +133,11 @@ IF (OSG_MAINTAINER)
#
# Provide target for generating ChangeLog
#
SET(GENERATELOGS svn2cl)
SET(SVN2LOG ~/bin/svn2log.py)
SET(GENERATELOGS svn log -v --xml | python ${SVN2LOG} -L -H)
ADD_CUSTOM_TARGET(ChangeLog
COMMAND ${SVNCOMMAND} update
COMMAND ${GENERATELOGS} ${SVNSOURCEDIR}
COMMAND ${GENERATELOGS}
)
ENDIF(OSG_MAINTAINER)
@@ -178,11 +184,6 @@ IF(WIN32)
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)
@@ -195,7 +196,7 @@ IF(WIN32)
ADD_DEFINITIONS(-DNOMINMAX)
ENDIF(UNIX)
########################################################################################################
# the following options are MSVC specific,
# 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
@@ -255,13 +256,6 @@ MARK_AS_ADVANCED(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
@@ -272,15 +266,6 @@ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
# 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)
################################################################################
# 3rd Party Dependency Stuff
IF(WIN32)
@@ -289,20 +274,42 @@ 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)
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)
#use pkg-config to find various modues
INCLUDE(FindPkgConfig OPTIONAL)
@@ -321,46 +328,17 @@ IF(PKG_CONFIG_FOUND)
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(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)
#
# Enable workaround for OpenGL driver crash with occlusion query
#
OPTION(OSG_FORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL "Set to ON to build OcclussionQueryNode with a workaround for multi-threaded OpenGL driver occlussion query crash. " OFF)
IF(OSG_FORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL)
ADD_DEFINITIONS(-DFORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL)
ENDIF(OSG_FORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL)
@@ -397,7 +375,7 @@ IF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
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})
OPTION(OSG_GLU_TESS_CALLBACK_TRIPLEDOT "Set to ON to build 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)
@@ -443,19 +421,17 @@ 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_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
ADD_DEFINITIONS(-DOSG_DEBUG_POSTFIX="${CMAKE_DEBUG_POSTFIX}")
ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
ADD_DEFINITIONS(-DOSG_DEBUG_POSTFIX='\"${CMAKE_DEBUG_POSTFIX}\"')
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
IF(UNIX AND NOT WIN32 AND NOT APPLE)
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_DEFINITIONS("-D_DEBUG")
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
ENDIF(UNIX AND NOT WIN32)
ENDIF(UNIX AND NOT WIN32 AND NOT APPLE)
IF(CYGWIN)
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_DEFINITIONS("-D_DEBUG")
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
ENDIF(CYGWIN)
IF(UNIX AND NOT WIN32 AND NOT APPLE)
IF(CMAKE_SIZEOF_VOID_P MATCHES "8")
@@ -533,6 +509,31 @@ 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.")
# Dynamic vs Static Linking
OPTION(DYNAMIC_OPENSCENEGRAPH "Set to ON to build OpenSceneGraph for dynamic linking. Use OFF for static." ON)
IF (DYNAMIC_OPENSCENEGRAPH)
SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED")
ELSE (DYNAMIC_OPENSCENEGRAPH)
SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC")
ENDIF(DYNAMIC_OPENSCENEGRAPH)
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.
@@ -547,17 +548,13 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
# 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
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 /W4 /wd4706 /wd4127 /wd4100)
SET(OSG_AGGRESSIVE_WARNING_FLAGS "/Wall /W4")
ELSE(MSVC)
@@ -570,53 +567,26 @@ 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})
OPTION(OSG_USE_AGGRESSIVE_WARNINGS "Enable to activate aggressive warnings" OFF)
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)
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)
# Remove all flags considered aggresive
FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
STRING(REGEX REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDFOREACH(flag)
# 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)
# Dynamic vs Static Linking
OPTION(DYNAMIC_OPENSCENEGRAPH "Set to ON to build OpenSceneGraph for dynamic linking. Use OFF for static." ON)
IF (DYNAMIC_OPENSCENEGRAPH)
SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED")
ELSE (DYNAMIC_OPENSCENEGRAPH)
SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC")
ENDIF(DYNAMIC_OPENSCENEGRAPH)
INCLUDE(OsgMacroUtils)
# OSG Core
ADD_SUBDIRECTORY(src)
IF (BUILD_OSG_APPLICATIONS)
ADD_SUBDIRECTORY(applications)
ENDIF(BUILD_OSG_APPLICATIONS)
IF (BUILD_OSG_EXAMPLES)
ADD_SUBDIRECTORY(examples)
ENDIF(BUILD_OSG_EXAMPLES)
# 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)
@@ -665,24 +635,33 @@ ADD_CUSTOM_TARGET(wrappers
COMMAND ${GENWRAPPER} -c ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/genwrapper.conf -l ${OpenSceneGraph_SOURCE_DIR}
)
OPTION(BUILD_REF_DOCS "Build OpenSceneGraph reference documentation using doxygen (use: make DoxygenDoc)" OFF)
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)
@@ -692,148 +671,29 @@ IF(BUILD_DOCUMENTATION)
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
#-----------------------------------------------------------------------------
@@ -843,3 +703,4 @@ CONFIGURE_FILE(
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")

View File

@@ -68,13 +68,8 @@ int main(int, const char**)
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;
@@ -95,24 +90,6 @@ int main(int, const char**)
}
" _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)
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)
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)
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)

View File

@@ -55,13 +55,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
@@ -36,11 +29,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 collada14dom
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}
@@ -61,216 +52,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

@@ -30,7 +30,11 @@ MACRO(LINK_INTERNAL TRGTNAME)
#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")
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}")
@@ -130,13 +134,6 @@ 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
@@ -191,14 +188,14 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
#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})
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})
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS}
LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} )
ENDIF(WIN32)
ENDMACRO(SETUP_PLUGIN)
@@ -280,7 +277,7 @@ MACRO(SETUP_APPLICATION APPLICATION_NAME)
IF(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin BUNDLE DESTINATION bin)
ELSE(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin COMPONENT openscenegraph )
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin )
ENDIF(APPLE)
ENDMACRO(SETUP_APPLICATION)
@@ -307,7 +304,7 @@ MACRO(SETUP_EXAMPLE EXAMPLE_NAME)
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 )
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin )
ENDIF(APPLE)
ENDMACRO(SETUP_EXAMPLE)
@@ -344,20 +341,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 "www.cdash.org")
set(CTEST_DROP_LOCATION "/CDashPublic/submit.php?project=OpenSceneGraph")
set(CTEST_DROP_SITE_CDASH TRUE)

44181
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

View File

@@ -1,97 +1,6 @@
OSG News
========
= !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.

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.
19th May 2009.
26th August 2008.
--

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +1,6 @@
#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 */

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,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,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

@@ -26,20 +26,20 @@ SET(TARGET_COMMON_LIBRARIES
osgText
)
IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgviewer)
ADD_SUBDIRECTORY(osgarchive)
ADD_SUBDIRECTORY(osgconv)
ADD_SUBDIRECTORY(osgversion)
ADD_SUBDIRECTORY(osgfilecache)
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

@@ -493,17 +493,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 +507,8 @@ 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");
arguments.getApplicationUsage()->addCommandLineOption("--formats","List supported file formats");
arguments.getApplicationUsage()->addCommandLineOption("--plugins","List database olugins");
// if user request help write it out to cout.

View File

@@ -22,14 +22,11 @@
#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;
@@ -137,8 +134,6 @@ 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)
{
@@ -247,8 +242,9 @@ public:
filename = plod.getFileName(i);
}
osg::notify(osg::NOTICE)<<"reading "<<filename<<std::endl;
osg::ref_ptr<osg::Node> node = readNodeFileAndWriteToCache(filename);
osg::ref_ptr<osg::Node> node = osgDB::readNodeFile(filename);
if (!s_ExitApplication && node.valid()) node->accept(*this);
}
@@ -271,37 +267,6 @@ public:
}
}
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); }
@@ -367,8 +332,7 @@ protected:
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;
@@ -420,26 +384,6 @@ int main( int argc, char **argv )
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))
{
@@ -452,24 +396,18 @@ int main( int argc, char **argv )
ldv.addExtents(maxLevels, minX, minY, maxX, maxY);
}
std::string fileCache;
while(arguments.read("--file-cache",fileCache) || arguments.read("-c",fileCache)) {}
std::string filename;
for(int i=1; i<arguments.argc(); ++i)
{
if (!arguments.isOption(i))
{
filename = arguments[i];
break;
}
if (!fileCache.empty())
{
std::string str("OSG_FILE_CACHE=");
str += fileCache;
putenv(strdup((char*)str.c_str()));
}
if (filename.empty())
{
std::cout<<"No file to load specified."<<std::endl;
return 1;
}
osg::ref_ptr<osg::Node> loadedModel = ldv.readNodeFileAndWriteToCache(filename);
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
if (!loadedModel)
{
std::cout<<"No data loaded, please specify a database to load"<<std::endl;

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()
SET(TARGET_COMMON_LIBRARIES
OpenThreads
osg
osgDB
)
SETUP_COMMANDLINE_APPLICATION(osgversion)

View File

@@ -1,836 +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"},
{"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"},
{"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,916 @@
#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;
if (first=="KdTree") return false;
if (first=="LineSegment") 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=="Weidemann") return "Wiedemann";
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=="Jean-Sebastian") 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 "Garrett";
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=="Simmonson") 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";
if (name=="Messerschimdt") return "Messerschmidt";
if (name=="Garret") return "Garrett";
if (name=="Adrain") return "Adrian";
if (name=="Elgi") return "Egli";
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=="John" && name.second=="Vidar")
{
cout << arguments.getApplicationUsage()->getCommandLineUsage() << endl;
arguments.getApplicationUsage()->write(cout, arguments.getApplicationUsage()->getCommandLineOptions());
return 1;
name.first = "John";
name.second = "Vidar Larring";
}
if (name.first=="Sebastien" && name.second=="Messerschmidt")
{
name.first = "Sebastian";
name.second = "Messerschmidt";
}
if ((name.first=="Jose" || name.first=="Jos<EFBFBD>") && name.second=="Delport")
{
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=="Raymond" && name.second=="de")
{
name.first = "Raymond";
name.second = "de Vries";
}
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;
}

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

@@ -16,9 +16,7 @@ SET(TARGET_COMMON_LIBRARIES
IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osg2cpp)
ADD_SUBDIRECTORY(osganimate)
ADD_SUBDIRECTORY(osgautocapture)
ADD_SUBDIRECTORY(osgautotransform)
ADD_SUBDIRECTORY(osgbillboard)
ADD_SUBDIRECTORY(osgblendequation)
@@ -30,16 +28,13 @@ 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)
@@ -57,7 +52,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osglogicop)
ADD_SUBDIRECTORY(osglogo)
ADD_SUBDIRECTORY(osgmanipulator)
ADD_SUBDIRECTORY(osgmemorytest)
ADD_SUBDIRECTORY(osgmotionblur)
ADD_SUBDIRECTORY(osgmovie)
ADD_SUBDIRECTORY(osgmultiplerendertargets)
@@ -65,7 +59,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgmultitexturecontrol)
ADD_SUBDIRECTORY(osgoccluder)
ADD_SUBDIRECTORY(osgocclusionquery)
ADD_SUBDIRECTORY(osgpackeddepthstencil)
ADD_SUBDIRECTORY(osgpagedlod)
ADD_SUBDIRECTORY(osgparametric)
ADD_SUBDIRECTORY(osgparticle)
@@ -79,7 +72,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgprerender)
ADD_SUBDIRECTORY(osgprerendercubemap)
ADD_SUBDIRECTORY(osgreflect)
ADD_SUBDIRECTORY(osgrobot)
ADD_SUBDIRECTORY(osgscalarbar)
ADD_SUBDIRECTORY(osgscreencapture)
ADD_SUBDIRECTORY(osgscribe)
@@ -91,7 +83,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)
@@ -112,31 +103,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)
@@ -161,9 +128,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)
@@ -183,20 +150,27 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgviewerCocoa)
ENDIF(APPLE)
IF (LIBVNCSERVER_FOUND)
ADD_SUBDIRECTORY(osgvnc)
ENDIF(LIBVNCSERVER_FOUND)
IF (BUILD_OSGWIDGET)
ADD_SUBDIRECTORY(osgwidgetaddremove)
ADD_SUBDIRECTORY(osgwidgetbox)
ADD_SUBDIRECTORY(osgwidgetcanvas)
ADD_SUBDIRECTORY(osgwidgetframe)
ADD_SUBDIRECTORY(osgwidgetinput)
ADD_SUBDIRECTORY(osgwidgetlabel)
ADD_SUBDIRECTORY(osgwidgetmenu)
ADD_SUBDIRECTORY(osgwidgetnotebook)
ADD_SUBDIRECTORY(osgwidgetscrolled)
ADD_SUBDIRECTORY(osgwidgetshader)
ADD_SUBDIRECTORY(osgwidgetstyled)
ADD_SUBDIRECTORY(osgwidgettable)
ADD_SUBDIRECTORY(osgwidgetwindow)
ENDIF(BUILD_OSGWIDGET)
#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,214 +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 <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 osgAnimation/nathan.osg" << std::endl;
osg::ArgumentParser psr(&argc, argv);
osgViewer::Viewer viewer(psr);
std::string file = "osgAnimation/nathan.osg";
if(argc >= 2)
file = psr[1];
// replace the manager
osg::Group* root = dynamic_cast<osg::Group*>(osgDB::readNodeFile(file));
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback());
if(!animationManager)
{
std::cerr << "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

@@ -11,7 +11,7 @@ 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();
@@ -59,7 +59,7 @@ osg::Camera* createOrthoCamera(double width, double height)
camera->setViewMatrix(osg::Matrix::identity());
camera->setClearMask(GL_DEPTH_BUFFER_BIT);
camera->setRenderOrder(osg::Camera::POST_RENDER);
return camera;
}
@@ -97,7 +97,7 @@ int main(int argc, char** argv)
// Make sure we have the minimum args...
if(argc <= 2)
{
osg::notify(osg::FATAL) << "usage: " << args[0] << " fontfile size1 [size2 ...]" << std::endl;
osg::notify(osg::FATAL) << "usage: " << args[0] << " FONTFILE [sizes...]" << std::endl;
return 1;
}
@@ -106,7 +106,7 @@ int main(int argc, char** argv)
viewer.addEventHandler(new osgViewer::WindowSizeHandler());
osg::Group* group = new osg::Group();
osg::Camera* camera = createOrthoCamera(1280.0f, 1024.0f);
osg::Camera* camera = createOrthoCamera(1280.0f, 1024.0f);
// Create the list of desired sizes.
Sizes sizes;
@@ -138,4 +138,3 @@ int main(int argc, char** argv)
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

@@ -31,94 +31,24 @@
#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::StateSet* createState()
{
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();
imageSequence->setDuration(2.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"));
#if 1
osg::Texture2D* texture = new osg::Texture2D;
@@ -128,13 +58,18 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
texture->setResizeNonPowerOfTwoHint(false);
texture->setImage(imageSequence.get());
//texture->setTextureSize(512,512);
//texture->setUpdateCallback(new osg::ImageSequence::UpdateCallback);
#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->setResizeNonPowerOfTwoHint(false);
texture->setImage(imageSequence.get());
//texture->setTextureSize(512,512);
//texture->setUpdateCallback(new osg::ImageSequence::UpdateCallback);
#endif
// create the StateSet to store the texture data
@@ -145,192 +80,20 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
return stateset;
}
osg::Node* createModel(osg::ArgumentParser& arguments)
osg::Node* createModel()
{
// 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));
geode->setStateSet(createState());
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);
@@ -338,20 +101,11 @@ int main(int argc, char **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));
viewer.setSceneData(createModel());
// 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())
std::string filename;
if (arguments.read("-o",filename))
{
osgDB::writeNodeFile(*viewer.getSceneData(),filename);
}

View File

@@ -21,6 +21,7 @@
#include <iostream>
#include <list>
#include <string>
#include <fstream>
#include <sstream>
#include <osg/Geode>
@@ -47,7 +48,6 @@
#include <osgDB/ReadFile>
#include <osgDB/FileUtils>
#include <osgDB/fstream>
int runApp(std::string xapp);
@@ -194,8 +194,6 @@ class Xample
{
return app;
}
private:
Xample() {}
}; // end class Xample
@@ -230,11 +228,12 @@ int runApp(std::string xapp)
osg::notify(osg::INFO) << "char* = " << cxapp <<std::endl;
return system(cxapp);
system(cxapp);
return 1;
}
}
osg::notify(osg::INFO) << "app not found!" << std::endl;
return 1;
return 0;
} // end printList()
@@ -250,7 +249,7 @@ void readConfFile(const char* confFile)
}
osgDB::ifstream in(fileName.c_str());
std::ifstream in(fileName.c_str());
if (!in)
{
osg::notify(osg::INFO) << "File " << fileName << " can not be opened!" << std::endl;

View File

@@ -67,10 +67,11 @@ class MyBillboardTransform : public osg::PositionAttitudeTransform
}
matrix.preMultTranslate(_position);
matrix.preMultRotate(billboardRotation);
matrix.preMultRotate(_attitude);
matrix.preMultTranslate(-_pivotPoint);
matrix.preMult(osg::Matrix::translate(-_pivotPoint)*
osg::Matrix::rotate(_attitude)*
osg::Matrix::rotate(billboardRotation)*
osg::Matrix::translate(_position));
return true;
}

View File

@@ -351,6 +351,7 @@ int main( int argc, char **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 the standard OpenSceneGraph example which loads and visualises 3d models.");
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");

View File

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

View File

@@ -1,495 +0,0 @@
/* OpenSceneGraph example, osganimate.
*
* 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/Notify>
#include <osg/Timer>
#include <osg/ArgumentParser>
#include <osg/Texture1D>
#include <osg/Texture2D>
#include <osg/Texture3D>
#include <osg/Geometry>
#include <osg/FrameBufferObject>
#include <osgViewer/Version>
#include <stdio.h>
#include <iostream>
class MemoryTest : public osg::Referenced
{
public:
};
class GLObject : public osg::Referenced
{
public:
virtual void apply(osg::RenderInfo& renderInfo) = 0;
};
class GLMemoryTest : public MemoryTest
{
public:
virtual GLObject* allocate() = 0;
};
/////////////////////////////////////////////////////////////////////////
//
// Context test
class ContextTest : public MemoryTest
{
public:
ContextTest(int width, int height, bool pbuffer):
_width(width),
_height(height),
_pbuffer(pbuffer) {}
virtual osg::GraphicsContext* allocate()
{
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->width = _width;
traits->height = _height;
traits->windowDecoration = true;
traits->pbuffer = _pbuffer;
osg::ref_ptr<osg::GraphicsContext> window = osg::GraphicsContext::createGraphicsContext(traits.get());
if (window.valid())
{
if (window->realize())
{
return window.release();
}
else
{
if (_pbuffer) throw "Failed to realize PixelBuffer";
else throw "Failed to realize GraphicsWindow";
}
}
else
{
std::cerr<<"Error: Unable to create graphics context, problem with running osgViewer-"<<osgViewerGetVersion()<<", cannot create windows/pbuffers."<<std::endl;
if (_pbuffer) throw "Failed to create PixelBuffer";
else throw "Failed to create GraphicsWindow";
}
}
protected:
int _width;
int _height;
bool _pbuffer;
};
////////////////////////////////////////////////////////////////////////
//
// Wrap StateAttribute
class StateAttributeObject : public GLObject
{
public:
StateAttributeObject(osg::StateAttribute* sa): _attribute(sa) {}
void apply(osg::RenderInfo& renderInfo)
{
_attribute->apply(*renderInfo.getState());
if (renderInfo.getState()->checkGLErrors(_attribute.get()))
{
throw "OpenGL error";
}
}
osg::ref_ptr<osg::StateAttribute> _attribute;
};
/////////////////////////////////////////////////////////////////////////
//
// Texture test
class TextureTest : public GLMemoryTest
{
public:
TextureTest(int width=256, int height=256, int depth=1):
_width(width),
_height(height),
_depth(depth) {}
virtual GLObject* allocate()
{
if (_depth>1)
{
osg::ref_ptr<osg::Image> image = new osg::Image;
image->allocateImage(_width, _height, _depth, GL_RGBA, GL_UNSIGNED_BYTE);
osg::ref_ptr<osg::Texture3D> texture = new osg::Texture3D;
texture->setImage(image.get());
texture->setResizeNonPowerOfTwoHint(false);
return new StateAttributeObject(texture.get());
}
if (_height>1)
{
osg::ref_ptr<osg::Image> image = new osg::Image;
image->allocateImage(_width, _height, 1, GL_RGBA, GL_UNSIGNED_BYTE);
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
texture->setImage(image.get());
texture->setResizeNonPowerOfTwoHint(false);
return new StateAttributeObject(texture.get());
}
if (_width>1)
{
osg::ref_ptr<osg::Image> image = new osg::Image;
image->allocateImage(_width, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE);
osg::ref_ptr<osg::Texture1D> texture = new osg::Texture1D;
texture->setImage(image.get());
texture->setResizeNonPowerOfTwoHint(false);
return new StateAttributeObject(texture.get());
}
else
{
throw "Invalid texture size of 0,0,0";
}
}
protected:
int _width;
int _height;
int _depth;
};
/////////////////////////////////////////////////////////////////////////
//
// FrameBufferObject test
class FboTest : public GLMemoryTest
{
public:
FboTest(int width=1024, int height=1024, int depth=2):
_width(width),
_height(height),
_depth(depth) {}
virtual GLObject* allocate()
{
osg::ref_ptr<osg::FrameBufferObject> fbo = new osg::FrameBufferObject;
if (_depth>=1) fbo->setAttachment(osg::Camera::COLOR_BUFFER, osg::FrameBufferAttachment(new osg::RenderBuffer(_width, _height, GL_RGBA)));
if (_depth>=2) fbo->setAttachment(osg::Camera::DEPTH_BUFFER, osg::FrameBufferAttachment(new osg::RenderBuffer(_width, _height, GL_DEPTH_COMPONENT24)));
return new StateAttributeObject(fbo.get());
}
protected:
int _width;
int _height;
int _depth;
};
////////////////////////////////////////////////////////////////////////
//
// Wrap Drawable
class DrawableObject : public GLObject
{
public:
DrawableObject(osg::Drawable* drawable): _drawable(drawable) {}
void apply(osg::RenderInfo& renderInfo)
{
_drawable->draw(renderInfo);
if (renderInfo.getState()->checkGLErrors("Drawable"))
{
throw "OpenGL error";
}
}
osg::ref_ptr<osg::Drawable> _drawable;
};
/////////////////////////////////////////////////////////////////////////
//
// Geometry test
class GeometryTest : public GLMemoryTest
{
public:
enum GLObjectType
{
VERTEX_ARRAY,
DISPLAY_LIST,
VERTEX_BUFFER_OBJECT
};
GeometryTest(GLObjectType type, int width=64, int height=64):
_glObjectType(type),
_width(width),
_height(height) {}
virtual GLObject* allocate()
{
unsigned int numVertices = _width * _height;
osg::Vec3Array* vertices = new osg::Vec3Array(numVertices);
for(int j=0; j<_height; ++j)
{
for(int i=0; i<_width; ++i)
{
(*vertices)[i+j*_width].set(float(i),float(j),0.0f);
}
}
unsigned int numIndices = (_width-1) * (_height-1) * 4;
osg::DrawElementsUShort* quads = new osg::DrawElementsUShort(GL_QUADS);
quads->reserve(numIndices);
for(int j=0; j<_height-1; ++j)
{
for(int i=0; i<_width-1; ++i)
{
quads->push_back(i + j*_width);
quads->push_back(i+1 + j*_width);
quads->push_back(i+1 + (j+1)*_width);
quads->push_back(i + (j+1)*_width);
}
}
osg::Geometry* geometry = new osg::Geometry;
geometry->setVertexArray(vertices);
geometry->addPrimitiveSet(quads);
switch(_glObjectType)
{
case(VERTEX_ARRAY):
geometry->setUseDisplayList(false);
geometry->setUseVertexBufferObjects(false);
break;
case(DISPLAY_LIST):
geometry->setUseDisplayList(true);
geometry->setUseVertexBufferObjects(false);
break;
case(VERTEX_BUFFER_OBJECT):
geometry->setUseDisplayList(false);
geometry->setUseVertexBufferObjects(true);
break;
}
return new DrawableObject(geometry);
}
protected:
GLObjectType _glObjectType;
int _width;
int _height;
};
int main( int argc, char **argv )
{
osg::ArgumentParser arguments(&argc,argv);
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" tests OpenGL and Windowing memory scalability..");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","List command line options.");
arguments.getApplicationUsage()->addCommandLineOption("--pbuffer","Create a 512x512 pixel buffer.");
arguments.getApplicationUsage()->addCommandLineOption("--pbuffer <width> <height>","Create a pixel buffer of specified dimensions.");
arguments.getApplicationUsage()->addCommandLineOption("--window","Create a 512x512 graphics window.");
arguments.getApplicationUsage()->addCommandLineOption("--window <width> <height>","Create a graphics window of specified dimensions.");
arguments.getApplicationUsage()->addCommandLineOption("--delay <micoseconds>","Set a delay in microseconds before all OpenGL object operations.");
arguments.getApplicationUsage()->addCommandLineOption("--texture <width> <height> <depth>","Allocate a 3D texture of specified dimensions.");
arguments.getApplicationUsage()->addCommandLineOption("--texture <width> <height>","Allocate a 2D texture of specified dimensions.");
arguments.getApplicationUsage()->addCommandLineOption("--texture <width>","Allocate a 1D texture of specified dimensions.");
arguments.getApplicationUsage()->addCommandLineOption("--geometry <width> <height>","Allocate a osg::Geometry representing a grid of specified size, using OpenGL Dislay Lists.");
arguments.getApplicationUsage()->addCommandLineOption("--geometry-va <width> <height>","Allocate a osg::Geometry representing a grid of specified size, using Vertex Arrays.");
arguments.getApplicationUsage()->addCommandLineOption("--geometry-vbo <width> <height>","Allocate a osg::Geometry representing a grid of specified size, using Vertex Buffer Objects.");
arguments.getApplicationUsage()->addCommandLineOption("--fbo <width> <height>","Allocate a FrameBufferObject of specified dimensions.");
arguments.getApplicationUsage()->addCommandLineOption("-c <num>","Set the number of contexts to create of each type specified.");
arguments.getApplicationUsage()->addCommandLineOption("-g <num>","Set the number of GL objects to create of each type specified.");
if (arguments.read("-h") || arguments.read("--help"))
{
arguments.getApplicationUsage()->write(std::cout, osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
typedef std::list< osg::ref_ptr<GLMemoryTest> > GLMemoryTests;
typedef std::list< osg::ref_ptr<ContextTest> > ContextTests;
ContextTests contextTests;
GLMemoryTests glMemoryTests;
int width, height, depth;
while(arguments.read("--pbuffer",width,height)) { contextTests.push_back(new ContextTest(width, height, true)); }
while(arguments.read("--pbuffer")) { contextTests.push_back(new ContextTest(512, 512, true)); }
while(arguments.read("--window",width,height)) { contextTests.push_back(new ContextTest(width, height, false)); }
while(arguments.read("--window")) { contextTests.push_back(new ContextTest(512,512, false)); }
while(arguments.read("--texture",width,height,depth)) { glMemoryTests.push_back(new TextureTest(width,height,depth)); }
while(arguments.read("--texture",width,height)) { glMemoryTests.push_back(new TextureTest(width,height,1)); }
while(arguments.read("--texture",width)) { glMemoryTests.push_back(new TextureTest(width,1,1)); }
while(arguments.read("--fbo",width,height,depth)) { glMemoryTests.push_back(new FboTest(width,height,depth)); }
while(arguments.read("--fbo",width,height)) { glMemoryTests.push_back(new FboTest(width,height,2)); }
while(arguments.read("--fbo")) { glMemoryTests.push_back(new FboTest(1024,1024,2)); }
while(arguments.read("--geometry",width,height)) { glMemoryTests.push_back(new GeometryTest(GeometryTest::DISPLAY_LIST,width,height)); }
while(arguments.read("--geometry")) { glMemoryTests.push_back(new GeometryTest(GeometryTest::DISPLAY_LIST,64,64)); }
while(arguments.read("--geometry-vbo",width,height)) { glMemoryTests.push_back(new GeometryTest(GeometryTest::VERTEX_BUFFER_OBJECT,width,height)); }
while(arguments.read("--geometry-vbo")) { glMemoryTests.push_back(new GeometryTest(GeometryTest::VERTEX_BUFFER_OBJECT,64,64)); }
while(arguments.read("--geometry-va",width,height)) { glMemoryTests.push_back(new GeometryTest(GeometryTest::VERTEX_ARRAY,width,height)); }
while(arguments.read("--geometry-va")) { glMemoryTests.push_back(new GeometryTest(GeometryTest::VERTEX_ARRAY,64,64)); }
unsigned int sleepTime = 0;
while(arguments.read("--delay",sleepTime)) {}
int maxNumContextIterations = 1;
while(arguments.read("-c",maxNumContextIterations)) {}
int maxNumGLIterations = 1000;
while(arguments.read("-g",maxNumGLIterations)) {}
#if 0
// 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;
}
#endif
typedef std::list< osg::ref_ptr<osg::GraphicsContext> > Contexts;
typedef std::list< osg::ref_ptr<GLObject> > GLObjects;
Contexts allocatedContexts;
GLObjects glObjects;
if (contextTests.empty())
{
if (glMemoryTests.empty())
{
std::cout<<"No tests specified, please specify test using the command line options below."<<std::endl<<std::endl;
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
else
{
contextTests.push_back(new ContextTest(512,512, false));
}
}
osg::Timer_t startTick = osg::Timer::instance()->tick();
// use printf's below as C++'s ostream classes use more memory and are more likely to fail when everything
// goes wrong with memory allocations.
int numContextIterations = 0;
int numGLObjectIterations = 0;
int numGLObjectsApplied = 0;
try
{
for(; numGLObjectIterations<maxNumGLIterations; ++numGLObjectIterations)
{
for(GLMemoryTests::iterator itr = glMemoryTests.begin();
itr != glMemoryTests.end();
++itr)
{
osg::ref_ptr<GLObject> glObject = (*itr)->allocate();
if (glObject.valid()) glObjects.push_back(glObject.get());
}
}
for(;numContextIterations<maxNumContextIterations; ++numContextIterations)
{
printf("GraphicsContext %i\n",numContextIterations);
for(ContextTests::iterator itr = contextTests.begin();
itr != contextTests.end();
++itr)
{
osg::ref_ptr<osg::GraphicsContext> context = (*itr)->allocate();
if (context.valid())
{
allocatedContexts.push_back(context);
context->makeCurrent();
osg::RenderInfo renderInfo;
renderInfo.setState(context->getState());
for(GLObjects::iterator gitr = glObjects.begin();
gitr != glObjects.end();
++gitr)
{
if (sleepTime>0) OpenThreads::Thread::microSleep( sleepTime );
printf("%i ",numGLObjectsApplied);fflush(stdout);
(*gitr)->apply(renderInfo);
++numGLObjectsApplied;
}
context->releaseContext();
printf("\n\n"); fflush(stdout);
}
}
}
}
catch(const char* errorString)
{
printf("\nException caught, contexts completed = %i, gl objects successfully applied = %i, error = %s\n\n",numContextIterations, numGLObjectsApplied, errorString);
return 1;
}
catch(...)
{
printf("\nException caught, contexts completed = %i, gl objects successfully applied = %i\n\n",numContextIterations, numGLObjectsApplied);
return 1;
}
osg::Timer_t endTick = osg::Timer::instance()->tick();
printf("\nSuccessful completion, contexts created = %i, gl objects applied = %i\n",numContextIterations, numGLObjectsApplied);
printf("Duration = %f seconds.\n\n",osg::Timer::instance()->delta_s(startTick, endTick));
return 0;
}

View File

@@ -39,19 +39,20 @@
#include <iostream>
osg::ImageStream* s_imageStream = 0;
class MovieEventHandler : public osgGA::GUIEventHandler
{
public:
MovieEventHandler():_playToggle(true),_trackMouse(false) {}
MovieEventHandler():_trackMouse(false),playToggle_(true) {}
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;
@@ -65,7 +66,7 @@ protected:
public:
FindImageStreamsVisitor(ImageStreamList& imageStreamList):
_imageStreamList(imageStreamList) {}
virtual void apply(osg::Geode& geode)
{
apply(geode.getStateSet());
@@ -74,7 +75,7 @@ protected:
{
apply(geode.getDrawable(i)->getStateSet());
}
traverse(geode);
}
@@ -83,11 +84,11 @@ protected:
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)
{
@@ -98,28 +99,24 @@ protected:
if (textureRec) apply(dynamic_cast<osg::ImageStream*>(textureRec->getImage()));
}
}
inline void apply(osg::ImageStream* imagestream)
{
if (imagestream)
{
_imageStreamList.push_back(imagestream);
_imageStreamList.push_back(imagestream);
s_imageStream = imagestream;
}
}
ImageStreamList& _imageStreamList;
protected:
FindImageStreamsVisitor& operator = (const FindImageStreamsVisitor&) { return *this; }
};
bool _playToggle;
bool playToggle_;
bool _trackMouse;
ImageStreamList _imageStreamList;
};
@@ -150,11 +147,11 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
bool foundIntersection = view==0 ? false :
(nv==0 ? view->computeIntersections(ea.getX(), ea.getY(), intersections) :
view->computeIntersections(ea.getX(), ea.getY(), nv->getNodePath(), intersections));
if (foundIntersection)
{
// use the nearest intersection
// use the nearest intersection
const osgUtil::LineSegmentIntersector::Intersection& intersection = *(intersections.begin());
osg::Drawable* drawable = intersection.drawable.get();
osg::Geometry* geometry = drawable ? drawable->asGeometry() : 0;
@@ -179,7 +176,7 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
osg::Vec2Array* texcoords_Vec2Array = dynamic_cast<osg::Vec2Array*>(texcoords);
if (texcoords_Vec2Array)
{
// we have tex coord array so now we can compute the final tex coord at the point of intersection.
// we have tex coord array so now we can compute the final tex coord at the point of intersection.
osg::Vec2 tc1 = (*texcoords_Vec2Array)[i1];
osg::Vec2 tc2 = (*texcoords_Vec2Array)[i2];
osg::Vec2 tc3 = (*texcoords_Vec2Array)[i3];
@@ -211,8 +208,8 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
itr!=_imageStreamList.end();
++itr)
{
_playToggle = !_playToggle;
if ( _playToggle )
playToggle_ = !playToggle_;
if ( playToggle_ )
{
// playing, so pause
std::cout<<"Play"<<std::endl;
@@ -279,7 +276,7 @@ osg::Geometry* myCreateTexturedQuadGeometry(const osg::Vec3& pos,float width,flo
{
bool flip = image->getOrigin()==osg::Image::TOP_LEFT;
if (option_flip) flip = !flip;
if (useTextureRectangle)
{
osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(pos,
@@ -290,12 +287,12 @@ osg::Geometry* myCreateTexturedQuadGeometry(const osg::Vec3& pos,float width,flo
osg::TextureRectangle* texture = new osg::TextureRectangle(image);
texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
pictureQuad->getOrCreateStateSet()->setTextureAttributeAndModes(0,
texture,
osg::StateAttribute::ON);
return pictureQuad;
}
else
@@ -304,14 +301,13 @@ osg::Geometry* myCreateTexturedQuadGeometry(const osg::Vec3& pos,float width,flo
osg::Vec3(width,0.0f,0.0f),
xyPlane ? osg::Vec3(0.0f,height,0.0f) : osg::Vec3(0.0f,0.0f,height),
0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f);
osg::Texture2D* texture = new osg::Texture2D(image);
texture->setResizeNonPowerOfTwoHint(false);
texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
pictureQuad->getOrCreateStateSet()->setTextureAttributeAndModes(0,
texture,
osg::StateAttribute::ON);
@@ -324,7 +320,7 @@ int main(int argc, char** argv)
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" example demonstrates the use of ImageStream for rendering movies as textures.");
@@ -334,23 +330,20 @@ int main(int argc, char** argv)
arguments.getApplicationUsage()->addCommandLineOption("--shader","Use shaders to post process the video.");
arguments.getApplicationUsage()->addCommandLineOption("--interactive","Use camera manipulator to allow movement around movie.");
arguments.getApplicationUsage()->addCommandLineOption("--flip","Flip the movie so top becomes bottom.");
#if defined(WIN32) || defined(__APPLE__)
arguments.getApplicationUsage()->addCommandLineOption("--devices","Print the Video input capability via QuickTime and exit.");
#endif
bool useTextureRectangle = true;
bool useShader = false;
// construct the viewer.
osgViewer::Viewer viewer(arguments);
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
#if defined(WIN32) || defined(__APPLE__)
// if user requests devices video capability.
if (arguments.read("-devices") || arguments.read("--devices"))
{
@@ -358,13 +351,12 @@ int main(int argc, char** argv)
osgDB::readImageFile("devices.live");
return 1;
}
#endif
while (arguments.read("--texture2D")) useTextureRectangle=false;
while (arguments.read("--shader")) useShader=true;
bool mouseTracking = false;
while (arguments.read("--mouse")) mouseTracking=true;
while (arguments.read("--mouse")) mouseTracking=true;
// if user request help write it out to cout.
@@ -391,7 +383,7 @@ int main(int argc, char** argv)
"uniform samplerRect movie_texture;\n"
"void main(void)\n"
"{\n"
" vec4 texture_color = textureRect(movie_texture, gl_TexCoord[0].st); \n"
" vec4 texture_color = textureRect(movie_texture, gl_TexCoord[0]); \n"
" if (all(lessThanEqual(texture_color,cutoff_color))) discard; \n"
" gl_FragColor = texture_color;\n"
"}\n"
@@ -402,7 +394,7 @@ int main(int argc, char** argv)
"uniform sampler2D movie_texture;\n"
"void main(void)\n"
"{\n"
" vec4 texture_color = texture2D(movie_texture, gl_TexCoord[0].st); \n"
" vec4 texture_color = texture2D(movie_texture, gl_TexCoord[0]); \n"
" if (all(lessThanEqual(texture_color,cutoff_color))) discard; \n"
" gl_FragColor = texture_color;\n"
"}\n"
@@ -423,9 +415,9 @@ int main(int argc, char** argv)
osg::Vec3 pos(0.0f,0.0f,0.0f);
osg::Vec3 topleft = pos;
osg::Vec3 bottomright = pos;
bool xyPlane = fullscreen;
for(int i=1;i<arguments.argc();++i)
{
if (arguments.isString(i))
@@ -437,9 +429,9 @@ int main(int argc, char** argv)
if (image)
{
osg::notify(osg::NOTICE)<<"image->s()"<<image->s()<<" image-t()="<<image->t()<<std::endl;
geode->addDrawable(myCreateTexturedQuadGeometry(pos,image->s(),image->t(),image, useTextureRectangle, xyPlane, flip));
bottomright = pos + osg::Vec3(static_cast<float>(image->s()),static_cast<float>(image->t()),0.0f);
if (xyPlane) pos.y() += image->t()*1.05f;
@@ -448,10 +440,10 @@ int main(int argc, char** argv)
else
{
std::cout<<"Unable to read file "<<arguments[i]<<std::endl;
}
}
}
}
// set the scene to render
viewer.setSceneData(geode.get());
@@ -500,4 +492,3 @@ int main(int argc, char** argv)
return viewer.run();
}
}

View File

@@ -33,10 +33,9 @@
#include <osgViewer/Viewer>
#include <iostream>
#include <stdio.h>
//
// Below is relatively straight forward example of using the OpenGL multiple render targets (MRT) extension
// Below is relatively straight forward example of use OpenGL multiple render targets extension
// to FrameBufferObjects/GLSL shaders.
//
// Another, more sophisticated MRT example can be found in the osgstereomatch example.
@@ -213,16 +212,8 @@ osg::Node* createScene(osg::Node* cam_subgraph, unsigned int tex_width, unsigned
if (useHDR)
{
// Default HDR format
textureRect[i]->setInternalFormat(GL_RGBA32F_ARB);
// GL_FLOAT_RGBA32_NV might be supported on pre 8-series GPUs
//textureRect[i]->setInternalFormat(GL_FLOAT_RGBA32_NV);
// GL_RGBA16F_ARB can be used with this example,
// but modify e-12 and e12 in the shaders accordingly
//textureRect[i]->setInternalFormat(GL_RGBA16F_ARB);
textureRect[i]->setInternalFormat(GL_FLOAT_RGBA32_NV);
//textureRect[i]->setInternalFormat(GL_FLOAT_RGBA16_NV);
textureRect[i]->setSourceFormat(GL_RGBA);
textureRect[i]->setSourceType(GL_FLOAT);
}
@@ -387,13 +378,13 @@ int main( int argc, char **argv )
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() + " demonstrates the use of multiple render targets (MRT) with frame buffer objects (FBOs). A render to texture (RTT) camera is used to render to four textures using a single shader. The four textures are then combined to texture the viewed geometry.");
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName() + " demonstrates the use of multiple render targets (MRT) using frame buffer objects. A render to texture camera is used to render to four textures using a single shader. The four textures are then combined to texture the viewed geometry.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information.");
arguments.getApplicationUsage()->addCommandLineOption("--width","Set the width of the render to texture.");
arguments.getApplicationUsage()->addCommandLineOption("--height","Set the height of the render to texture.");
arguments.getApplicationUsage()->addCommandLineOption("--image","Render one of the targets to an image, then apply a post draw callback to modify it and use this image to update the final texture. Print some texture values when using HDR.");
arguments.getApplicationUsage()->addCommandLineOption("--hdr","Use high dynamic range (HDR). Create floating point textures to render to.");
arguments.getApplicationUsage()->addCommandLineOption("--image","Render one of the targets to an image, then apply a post draw callback to modify it, and use this image to update a texture.");
arguments.getApplicationUsage()->addCommandLineOption("--hdr","Use high dynamic range. Create floating point textures to render to.");
// construct the viewer.
osgViewer::Viewer viewer(arguments);

View File

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

View File

@@ -39,7 +39,6 @@
#include <osgGA/TerrainManipulator>
#include <osgTerrain/Terrain>
#include <osgTerrain/TerrainTile>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/Viewer>
@@ -93,10 +92,10 @@ class ElevationLayerBlendingCallback : public osg::NodeCallback
ElevationLayerBlendingCallback(osgFX::MultiTextureControl* mtc, const Elevations& elevations, float animationTime=4.0f):
_previousFrame(-1),
_previousTime(0.0),
_animationTime(animationTime),
_currentElevation(0.0),
_mtc(mtc),
_elevations(elevations) {}
_elevations(elevations),
_animationTime(animationTime) {}
/** Callback method called by the NodeVisitor when visiting a node.*/
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
@@ -243,32 +242,13 @@ int main( int argc, char **argv )
// construct the viewer.
osgViewer::Viewer viewer(arguments);
// set the tile loaded callback to load the optional imagery
osg::ref_ptr<osgTerrain::WhiteListTileLoadedCallback> whiteList = new osgTerrain::WhiteListTileLoadedCallback;
std::string setname;
while(arguments.read("--allow",setname))
{
whiteList->allow(setname);
}
while(arguments.read("--allow-all"))
{
whiteList->setAllowAll(true);
}
osgTerrain::TerrainTile::setTileLoadedCallback(whiteList.get());
// obtain the vertical scale
float verticalScale = 1.0f;
while(arguments.read("-v",verticalScale)) {}
// obtain the sample ratio
float sampleRatio = 1.0f;
while(arguments.read("-r",sampleRatio)) {}
// set up any authentication.
std::string url, username, password;
while(arguments.read("--login",url, username, password))
{
@@ -368,13 +348,6 @@ int main( int argc, char **argv )
if (mtc)
{
numLayers = mtc->getNumTextureWeights();
// switch on just the first texture layer.
mtc->setTextureWeight(0,1.0f);
for(unsigned int i=1; i<numLayers; ++i)
{
mtc->setTextureWeight(i,0.0f);
}
}
if (numLayers<2)

View File

@@ -23,6 +23,7 @@
#include <osg/Geode>
#include <osg/Group>
#include <osg/Notify>
#include <osg/LineSegment>
#include <osg/io_utils>
#include <osgDB/Registry>
@@ -34,6 +35,7 @@
#include <osgGA/DriveManipulator>
#include <osgUtil/Optimizer>
#include <osgUtil/IntersectVisitor>
#include <osg/OccluderNode>
#include <osg/Geometry>

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