Compare commits
250 Commits
OpenSceneG
...
OpenSceneG
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d69f2a81f9 | ||
|
|
35334daae4 | ||
|
|
14232cd993 | ||
|
|
ec86072533 | ||
|
|
3f66f1d276 | ||
|
|
c1055fdfbc | ||
|
|
328632af75 | ||
|
|
ec89d96114 | ||
|
|
ea17943a74 | ||
|
|
07d05840e9 | ||
|
|
d108bea9eb | ||
|
|
1bc5ef030f | ||
|
|
15e60acfb5 | ||
|
|
4710b6556d | ||
|
|
a231483ea6 | ||
|
|
5e48c51bd7 | ||
|
|
036c6676c1 | ||
|
|
ed9c28b4ec | ||
|
|
50e471d900 | ||
|
|
5b7ef57ad7 | ||
|
|
a3e11f1d50 | ||
|
|
4e67d6deb2 | ||
|
|
edee9d0946 | ||
|
|
e5cccefafe | ||
|
|
2c35b63d38 | ||
|
|
700dd2b9a7 | ||
|
|
c1585d3c17 | ||
|
|
76a92314cf | ||
|
|
60eb458c47 | ||
|
|
7e5a9582b3 | ||
|
|
662e76d721 | ||
|
|
428f4a3804 | ||
|
|
23edfad1fd | ||
|
|
0c1fad2c91 | ||
|
|
1201ac230d | ||
|
|
eabd08ef25 | ||
|
|
a5bcbc1822 | ||
|
|
f822603446 | ||
|
|
f449bd3730 | ||
|
|
b37b635a7c | ||
|
|
224f837e0d | ||
|
|
1d7d1dda42 | ||
|
|
ac36649ed6 | ||
|
|
9c7a474032 | ||
|
|
06a45ef889 | ||
|
|
1e4f6f675b | ||
|
|
e6ab01c7c6 | ||
|
|
b2cd4b5836 | ||
|
|
09b37224ff | ||
|
|
6d4afbbb49 | ||
|
|
8b433f8364 | ||
|
|
10c1fedfca | ||
|
|
0af180f8b0 | ||
|
|
b001e8d36d | ||
|
|
397ab4aa51 | ||
|
|
9eaf03e16e | ||
|
|
9ba9221ccf | ||
|
|
16591a310a | ||
|
|
1b9e1301cf | ||
|
|
796b9f0a9b | ||
|
|
232d227170 | ||
|
|
95818b0819 | ||
|
|
ad0a73273c | ||
|
|
168212f383 | ||
|
|
320e0ce60c | ||
|
|
6f1a828b37 | ||
|
|
e07f1ff5e9 | ||
|
|
b6ec9dc532 | ||
|
|
d93d2e0ec1 | ||
|
|
f272089857 | ||
|
|
ad917a5318 | ||
|
|
f0056c6d3b | ||
|
|
fe25b2961b | ||
|
|
6511347d4b | ||
|
|
192e654cdb | ||
|
|
b59c46c3cf | ||
|
|
29049ea238 | ||
|
|
46df1fd141 | ||
|
|
8af48d369c | ||
|
|
95d450e026 | ||
|
|
b58048e43b | ||
|
|
1f1c21772a | ||
|
|
fa27a1f3ed | ||
|
|
d5d4f7239b | ||
|
|
2a110515c1 | ||
|
|
d2a0315e20 | ||
|
|
1f9725ea49 | ||
|
|
d772304cec | ||
|
|
192574958a | ||
|
|
7df7eb78ac | ||
|
|
e2359890bd | ||
|
|
912e4f8a0c | ||
|
|
78300f7d61 | ||
|
|
2bd81226c3 | ||
|
|
37f6e2b39e | ||
|
|
2f4064d757 | ||
|
|
04f27c370e | ||
|
|
02eb8de191 | ||
|
|
d3f5aef5ef | ||
|
|
ec8cb360c8 | ||
|
|
8c79dccbbc | ||
|
|
517728c7d9 | ||
|
|
0f7e30a74e | ||
|
|
6cacc5a2c2 | ||
|
|
aae4f22163 | ||
|
|
6eaf2f5781 | ||
|
|
e536d8e601 | ||
|
|
af9d8889c8 | ||
|
|
a4c9cac2a8 | ||
|
|
5c46d9de3e | ||
|
|
8d08b75e19 | ||
|
|
6ec5d80b0d | ||
|
|
f48b5a3fdb | ||
|
|
7bcc5d861e | ||
|
|
933b8cdbaf | ||
|
|
7200e38fce | ||
|
|
4a1f033dbe | ||
|
|
ec19ee9655 | ||
|
|
653af27d02 | ||
|
|
29ce4f616d | ||
|
|
f39cc7b6f1 | ||
|
|
879a8bd020 | ||
|
|
ccb06f003a | ||
|
|
79fa48c984 | ||
|
|
47022a1bf0 | ||
|
|
926cffb2ee | ||
|
|
f044bc6b45 | ||
|
|
ac8bbb9d1e | ||
|
|
db24f7f09d | ||
|
|
520b6c24f6 | ||
|
|
244cec821e | ||
|
|
ba309bf38b | ||
|
|
60a7b8ce02 | ||
|
|
3a15c66290 | ||
|
|
577d161303 | ||
|
|
6011bc4307 | ||
|
|
40caedc7cd | ||
|
|
4371512dd2 | ||
|
|
9132d98785 | ||
|
|
47c531cc37 | ||
|
|
4704621c39 | ||
|
|
0244b234ca | ||
|
|
09fd75dcf4 | ||
|
|
c3d45732a1 | ||
|
|
89f74b1a56 | ||
|
|
6089257d3c | ||
|
|
97336b89ac | ||
|
|
229b833a5a | ||
|
|
7ae1421864 | ||
|
|
bf1aa5088e | ||
|
|
e798db04c8 | ||
|
|
adbadd66be | ||
|
|
bd0cf5e47d | ||
|
|
7239050c5b | ||
|
|
55bb474c3b | ||
|
|
ff1051a6fd | ||
|
|
845bb6aceb | ||
|
|
3e23c5b22d | ||
|
|
5675d86c9b | ||
|
|
5405d9c465 | ||
|
|
3b17418031 | ||
|
|
9fc6850962 | ||
|
|
46904ff67a | ||
|
|
636d595912 | ||
|
|
5310a96c73 | ||
|
|
5dc251a5c1 | ||
|
|
6a67be2e32 | ||
|
|
74f1838960 | ||
|
|
f4e71bad3a | ||
|
|
61d317b0b8 | ||
|
|
05f3e038d8 | ||
|
|
1a9a74216b | ||
|
|
6344d4430d | ||
|
|
3c7bf7ec8a | ||
|
|
87e5c54ee7 | ||
|
|
0567ce316d | ||
|
|
5cbd785f78 | ||
|
|
4ee38248a2 | ||
|
|
f4013a68da | ||
|
|
2ad1e661e0 | ||
|
|
c1d5b6992c | ||
|
|
b92c3f1455 | ||
|
|
9975e15a97 | ||
|
|
5b242d22ff | ||
|
|
814a885a6c | ||
|
|
471b256d30 | ||
|
|
8f73ddc27d | ||
|
|
0874f126c0 | ||
|
|
697128a11d | ||
|
|
96d247aa7e | ||
|
|
c0ac503123 | ||
|
|
b74924fab4 | ||
|
|
75217a2ed5 | ||
|
|
2bed348da1 | ||
|
|
af8b11a391 | ||
|
|
27f080159e | ||
|
|
e8722e76ea | ||
|
|
8b4ff0f50a | ||
|
|
559da06ffa | ||
|
|
5c40e9bf81 | ||
|
|
1186143571 | ||
|
|
732364d49b | ||
|
|
0153c3e7e2 | ||
|
|
5e8d5b50db | ||
|
|
e9b75e0ded | ||
|
|
803677e03c | ||
|
|
0f97a42e17 | ||
|
|
91fd245d7c | ||
|
|
eb90d9aa34 | ||
|
|
8e9f688809 | ||
|
|
6c1c179c62 | ||
|
|
cfe3e621ad | ||
|
|
761cf52bb7 | ||
|
|
42efcf24fb | ||
|
|
0a56f65077 | ||
|
|
3339395071 | ||
|
|
34e53a37e0 | ||
|
|
482fd41d58 | ||
|
|
2eef9d233b | ||
|
|
4a886c6e22 | ||
|
|
717d566713 | ||
|
|
1d0a265cd4 | ||
|
|
3d69d46e3e | ||
|
|
8e20224828 | ||
|
|
6e65a9955e | ||
|
|
2264c3b7e2 | ||
|
|
8c991c056f | ||
|
|
34ab8bc048 | ||
|
|
d73e979ea8 | ||
|
|
6273495c64 | ||
|
|
8f26396e78 | ||
|
|
78bf1e8ea4 | ||
|
|
83a03f3346 | ||
|
|
4626f6fb6a | ||
|
|
9e581f91db | ||
|
|
887768b55a | ||
|
|
5b1cfd26ab | ||
|
|
f48a4baa4e | ||
|
|
49c802153d | ||
|
|
13e79d3210 | ||
|
|
236617b6c5 | ||
|
|
a0229ee684 | ||
|
|
5ebfa0a71e | ||
|
|
5acad4e07e | ||
|
|
ccae59e98a | ||
|
|
222871aade | ||
|
|
d221133728 | ||
|
|
2eff96d1a4 | ||
|
|
0394ba5453 | ||
|
|
1db8a4e818 |
94
.gitignore
vendored
Normal file
94
.gitignore
vendored
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
doc/all_Doxyfile
|
||||||
|
doc/auto_Doxyfile
|
||||||
|
doc/core_Doxyfile
|
||||||
|
doc/openscenegraph.doxyfile
|
||||||
|
doc/openthreads.doxyfile
|
||||||
|
|
||||||
|
doc/OpenSceneGraphReferenceDocs/
|
||||||
|
doc/OpenThreadsReferenceDocs/
|
||||||
|
|
||||||
|
cmake_uninstall.cmake
|
||||||
|
|
||||||
|
include/OpenThreads/Config
|
||||||
|
include/OpenThreads/Version
|
||||||
|
include/osg/Config
|
||||||
|
include/osg/GL
|
||||||
|
include/osg/Version
|
||||||
|
include/osgQt/Version
|
||||||
|
src/osgQt/__
|
||||||
|
|
||||||
|
lib/
|
||||||
|
bin/
|
||||||
|
|
||||||
|
*.pc
|
||||||
|
*.conf
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles
|
||||||
|
CMakeScripts
|
||||||
|
Makefile
|
||||||
|
cmake_install.cmake
|
||||||
|
install_manifest*.txt
|
||||||
|
|
||||||
|
|
||||||
|
# Compiled Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Compiled Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Fortran module files
|
||||||
|
*.mod
|
||||||
|
|
||||||
|
# Compiled Static libraries
|
||||||
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
# Platform Specifics - auto generated files
|
||||||
|
PlatformSpecifics/Windows/*.rc
|
||||||
|
|
||||||
|
# Visual studio - project files
|
||||||
|
*.sln
|
||||||
|
*.suo
|
||||||
|
*.vcxproj
|
||||||
|
*.vcxproj.filters
|
||||||
|
*.vcxproj.user
|
||||||
|
|
||||||
|
# Visual Studio - Build Results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Rr]elease/
|
||||||
|
[Mm]in[Ss]ize[Rr]el/
|
||||||
|
[Rr]el[Ww]ith[Dd]eb[Ii]nfo/
|
||||||
|
|
||||||
|
# Visual Studio - Browsing Database File
|
||||||
|
*.sdf
|
||||||
|
*.opensdf
|
||||||
|
|
||||||
|
#osx xcode
|
||||||
|
DerivedData/
|
||||||
|
*.DS_Store
|
||||||
|
*.build
|
||||||
|
*.xcodeproj
|
||||||
|
|
||||||
|
#CPACK related files
|
||||||
|
CPackConfig-*.cmake
|
||||||
|
_CPack_Packages/
|
||||||
|
|
||||||
|
#packages
|
||||||
|
*.tar.gz
|
||||||
|
*.zip
|
||||||
36
.travis.yml
Normal file
36
.travis.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
|
include:
|
||||||
|
#Linux build
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
language: cpp
|
||||||
|
env:
|
||||||
|
#- LLVM_VERSION=3.8
|
||||||
|
sudo: false
|
||||||
|
cache:
|
||||||
|
apt: true
|
||||||
|
directories:
|
||||||
|
- $HOME/.ccache
|
||||||
|
compiler:
|
||||||
|
#- clang
|
||||||
|
- g++
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
#- llvm-toolchain-precise-3.8
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
#- clang-3.8
|
||||||
|
- g++
|
||||||
|
- cmake
|
||||||
|
# OSX build
|
||||||
|
- os: osx
|
||||||
|
language: cpp
|
||||||
|
|
||||||
|
script:
|
||||||
|
- mkdir build
|
||||||
|
- cd build
|
||||||
|
- travis_wait 60 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../product -DBUILD_OSG_EXAMPLES=ON ..
|
||||||
|
- make install -j3
|
||||||
|
|
||||||
88
AUTHORS.txt
88
AUTHORS.txt
@@ -1,11 +1,10 @@
|
|||||||
OpenSceneGraph Library 3.3.9
|
OpenSceneGraph Library 3.4.1
|
||||||
|
|
||||||
548 Contributors:
|
562 Contributors:
|
||||||
|
|
||||||
Firstname Surname
|
Firstname Surname
|
||||||
-----------------
|
-----------------
|
||||||
Robert Osfield
|
Robert Osfield
|
||||||
Don Burns
|
|
||||||
Stephan Huber
|
Stephan Huber
|
||||||
Paul Martz
|
Paul Martz
|
||||||
Farshid Lashkari
|
Farshid Lashkari
|
||||||
@@ -20,38 +19,41 @@ Eric Wing
|
|||||||
Cedric Pinson
|
Cedric Pinson
|
||||||
Brede Johansen
|
Brede Johansen
|
||||||
Bob Kuehne
|
Bob Kuehne
|
||||||
|
Wojciech Lewandowski
|
||||||
Michael Platings
|
Michael Platings
|
||||||
Geoff Michel
|
Geoff Michel
|
||||||
Wojciech Lewandowski
|
|
||||||
Eric Sokolowsky
|
Eric Sokolowsky
|
||||||
David Callu
|
|
||||||
Laurens Voerman
|
Laurens Voerman
|
||||||
|
David Callu
|
||||||
Colin McDonald
|
Colin McDonald
|
||||||
Trajce Nikolov
|
Trajce Nikolov
|
||||||
Tim Moore
|
Tim Moore
|
||||||
Martin Lavery
|
Martin Lavery
|
||||||
Mattias Helsing
|
Mattias Helsing
|
||||||
Tree
|
|
||||||
Jason Beverage
|
Jason Beverage
|
||||||
Luigi Calori
|
Tree
|
||||||
Pjotr Svetachov
|
Pjotr Svetachov
|
||||||
|
Luigi Calori
|
||||||
|
Alberto Luaces
|
||||||
Mike Wittman
|
Mike Wittman
|
||||||
Jan Peciva
|
Jan Peciva
|
||||||
Chris Hanson
|
Chris Hanson
|
||||||
Alberto Luaces
|
|
||||||
Roland Smeenk
|
Roland Smeenk
|
||||||
Roger James
|
Roger James
|
||||||
Jeremy Moles
|
Jeremy Moles
|
||||||
|
Jannik Heller
|
||||||
J.P. Delport
|
J.P. Delport
|
||||||
|
Andy Skinner
|
||||||
Magnus Kessler
|
Magnus Kessler
|
||||||
David Fries
|
David Fries
|
||||||
Andy Skinner
|
|
||||||
Tom Jolley
|
Tom Jolley
|
||||||
Paul Melis
|
Paul Melis
|
||||||
Luc Frauciel
|
Luc Frauciel
|
||||||
Aurelien Albert
|
Aurelien Albert
|
||||||
Pavel Moloshtan
|
Pavel Moloshtan
|
||||||
Brad Christiansen
|
Brad Christiansen
|
||||||
|
Torben Dannhauer
|
||||||
|
Terry Welsh
|
||||||
Olaf Flebbe
|
Olaf Flebbe
|
||||||
Mathieu Marache
|
Mathieu Marache
|
||||||
Lionel Lagarde
|
Lionel Lagarde
|
||||||
@@ -61,36 +63,33 @@ Philip Lowman
|
|||||||
Per Fahlberg
|
Per Fahlberg
|
||||||
Norman Vine
|
Norman Vine
|
||||||
Chris Denham
|
Chris Denham
|
||||||
Terry Welsh
|
Sherman Wilcox
|
||||||
Serge Lages
|
Serge Lages
|
||||||
Romano Jos<6F> Magacho da Silva
|
Romano Jos<6F> Magacho da Silva
|
||||||
Jannik Heller
|
|
||||||
Alberto Farre
|
|
||||||
Torben Dannhauer
|
|
||||||
Sherman Wilcox
|
|
||||||
Robert Michael
|
|
||||||
Mourad Boufarguine
|
Mourad Boufarguine
|
||||||
|
Alberto Farre
|
||||||
|
Glenn Waldron
|
||||||
Andr<EFBFBD> Garneau
|
Andr<EFBFBD> Garneau
|
||||||
Adrian Egli
|
Adrian Egli
|
||||||
Ruben Lopez
|
|
||||||
Randall Hopper
|
|
||||||
Jan Ciger
|
|
||||||
Glenn Waldron
|
|
||||||
Sebastian Messerschmidt
|
Sebastian Messerschmidt
|
||||||
|
Randall Hopper
|
||||||
|
Kristofer Tingdahl
|
||||||
|
Jan Ciger
|
||||||
|
Ruben Lopez
|
||||||
|
Robert Michael
|
||||||
Gideon May
|
Gideon May
|
||||||
Don Tidrow
|
Don Tidrow
|
||||||
Stephane Lamoliatte
|
Stephane Lamoliatte
|
||||||
Michael Gronager
|
Michael Gronager
|
||||||
Martin Naylor
|
Martin Naylor
|
||||||
Kristofer Tingdahl
|
|
||||||
Joakim Simonsson
|
Joakim Simonsson
|
||||||
David Spilling
|
David Spilling
|
||||||
Daniel Sj<53>lie
|
Daniel Sj<53>lie
|
||||||
Bryan Thrall
|
Bryan Thrall
|
||||||
|
Andreas Ekstrand
|
||||||
Rafa Gaitan
|
Rafa Gaitan
|
||||||
Mike Connell
|
Mike Connell
|
||||||
Fabien Lavignotte
|
Fabien Lavignotte
|
||||||
Andreas Ekstrand
|
|
||||||
Thomas Hogarth
|
Thomas Hogarth
|
||||||
Riccardo Corsi
|
Riccardo Corsi
|
||||||
Melchior Franz
|
Melchior Franz
|
||||||
@@ -99,9 +98,9 @@ Johannes Baeuerle
|
|||||||
Neil Hughes
|
Neil Hughes
|
||||||
Martin Beckett
|
Martin Beckett
|
||||||
Marc Helbling
|
Marc Helbling
|
||||||
|
Jordi Torres
|
||||||
Joran Jessurun
|
Joran Jessurun
|
||||||
Gino van den Bergen
|
Gino van den Bergen
|
||||||
Frederic Marmond
|
|
||||||
David Guthrie
|
David Guthrie
|
||||||
Csaba Halasz
|
Csaba Halasz
|
||||||
Cory Riddell
|
Cory Riddell
|
||||||
@@ -111,21 +110,21 @@ Yefei He
|
|||||||
Sondra Iverson
|
Sondra Iverson
|
||||||
Simon Julier
|
Simon Julier
|
||||||
Rune Schmidt Jensen
|
Rune Schmidt Jensen
|
||||||
|
Ravi Mathur
|
||||||
Rainer Oder
|
Rainer Oder
|
||||||
Nico Kruithof
|
Nico Kruithof
|
||||||
Martin Aumueller
|
Martin Aumueller
|
||||||
Mario Valle
|
Mario Valle
|
||||||
Lukasz Izdebski
|
Lukasz Izdebski
|
||||||
Jorge Izquierdo Ciges
|
Jorge Izquierdo Ciges
|
||||||
Jordi Torres
|
|
||||||
Gordon Tomlinson
|
Gordon Tomlinson
|
||||||
|
Frederic Marmond
|
||||||
Frederic Bouvier
|
Frederic Bouvier
|
||||||
Carlo Camporesi
|
Carlo Camporesi
|
||||||
Ben Discoe
|
Bj<EFBFBD>rn Blissing
|
||||||
Alexander Sinditskiy
|
Alexander Sinditskiy
|
||||||
Thibault Genessay
|
Thibault Genessay
|
||||||
Sasa Bistrovic
|
Sasa Bistrovic
|
||||||
Ravi Mathur
|
|
||||||
Ralf Habacker
|
Ralf Habacker
|
||||||
Neil Groves
|
Neil Groves
|
||||||
Mikhail Izmestev
|
Mikhail Izmestev
|
||||||
@@ -133,8 +132,10 @@ Markus Trenkwalder
|
|||||||
Loic Dachary
|
Loic Dachary
|
||||||
Joseph Steel
|
Joseph Steel
|
||||||
John Shue
|
John Shue
|
||||||
|
Hartwig Wiesmann
|
||||||
Brad Colbert
|
Brad Colbert
|
||||||
Bj<EFBFBD>rn Blissing
|
Ben Discoe
|
||||||
|
Vladimir Chebaev
|
||||||
Vivek Rajan
|
Vivek Rajan
|
||||||
Uwe Woessner
|
Uwe Woessner
|
||||||
Tony Horrobin
|
Tony Horrobin
|
||||||
@@ -154,9 +155,9 @@ Martins Innus
|
|||||||
Maciej Krol
|
Maciej Krol
|
||||||
Lilin Xiong
|
Lilin Xiong
|
||||||
Leandro Motta Barros
|
Leandro Motta Barros
|
||||||
|
Julien Valentin
|
||||||
Johan Nouvel
|
Johan Nouvel
|
||||||
Javier Taibo
|
Javier Taibo
|
||||||
Hartwig Wiesmann
|
|
||||||
Donn Mielcarek
|
Donn Mielcarek
|
||||||
Corbin Holtz
|
Corbin Holtz
|
||||||
Blasius Czink
|
Blasius Czink
|
||||||
@@ -167,7 +168,6 @@ Rudolf Wiedemann
|
|||||||
Maria Ten
|
Maria Ten
|
||||||
Liang Aibin
|
Liang Aibin
|
||||||
Katharina Plugge
|
Katharina Plugge
|
||||||
Julien Valentin
|
|
||||||
John Vidar Larring
|
John Vidar Larring
|
||||||
John Kelso
|
John Kelso
|
||||||
John Ivar
|
John Ivar
|
||||||
@@ -182,10 +182,9 @@ Bradley Anderegg
|
|||||||
Andreas Goebel
|
Andreas Goebel
|
||||||
Alok Priyadarshi
|
Alok Priyadarshi
|
||||||
Ali Botorabi
|
Ali Botorabi
|
||||||
Alberto Barbati
|
|
||||||
Alan Dickinson
|
Alan Dickinson
|
||||||
|
Wee See
|
||||||
Vladimir Shabanov
|
Vladimir Shabanov
|
||||||
Vladimir Chebaev
|
|
||||||
Tugkan Calapoglu
|
Tugkan Calapoglu
|
||||||
Tim Daoust
|
Tim Daoust
|
||||||
Sylvain Marie
|
Sylvain Marie
|
||||||
@@ -196,8 +195,10 @@ Ryan Pavlik
|
|||||||
Robert Milharcic
|
Robert Milharcic
|
||||||
Rene Molenaar
|
Rene Molenaar
|
||||||
Piotr Domagalski
|
Piotr Domagalski
|
||||||
|
Philippe Renon
|
||||||
Phil Atkin
|
Phil Atkin
|
||||||
Pawel Ksiezopolski
|
Pawel Ksiezopolski
|
||||||
|
Patrick Neary
|
||||||
Nathan Monteleone
|
Nathan Monteleone
|
||||||
Miha Rav<61>elj
|
Miha Rav<61>elj
|
||||||
Miguel Escriva
|
Miguel Escriva
|
||||||
@@ -225,6 +226,7 @@ Fabio Mierlo
|
|||||||
Doug McCorkle
|
Doug McCorkle
|
||||||
Donald Cipperly
|
Donald Cipperly
|
||||||
Don Leich
|
Don Leich
|
||||||
|
Don Burns
|
||||||
Dietmar Funck
|
Dietmar Funck
|
||||||
Colin Cochran
|
Colin Cochran
|
||||||
Christian Ruzicka
|
Christian Ruzicka
|
||||||
@@ -239,9 +241,9 @@ Andreas Henne
|
|||||||
Anders Backman
|
Anders Backman
|
||||||
Alexander Wiebel
|
Alexander Wiebel
|
||||||
Alessandro Terenzi
|
Alessandro Terenzi
|
||||||
|
Alberto Barbati
|
||||||
Zach Deedler
|
Zach Deedler
|
||||||
Yuzhong Shen
|
Yuzhong Shen
|
||||||
Wee See
|
|
||||||
Warren Macchi
|
Warren Macchi
|
||||||
Vincent Bourdier
|
Vincent Bourdier
|
||||||
Terrex
|
Terrex
|
||||||
@@ -256,7 +258,6 @@ Raymond de Vries
|
|||||||
Ralf Kern
|
Ralf Kern
|
||||||
Piotr Gwiazdowski
|
Piotr Gwiazdowski
|
||||||
Pierre Haritchabalet
|
Pierre Haritchabalet
|
||||||
Philippe Renon
|
|
||||||
Perry Miller
|
Perry Miller
|
||||||
Paul Palumbo
|
Paul Palumbo
|
||||||
Paul Obermeier
|
Paul Obermeier
|
||||||
@@ -267,7 +268,6 @@ Morn
|
|||||||
Michael Mc Donnell
|
Michael Mc Donnell
|
||||||
Michael Henheffer
|
Michael Henheffer
|
||||||
Michael Guerrero
|
Michael Guerrero
|
||||||
Maya Leonard
|
|
||||||
Max Bandazian
|
Max Bandazian
|
||||||
Mathias Fiedler
|
Mathias Fiedler
|
||||||
Mathew May
|
Mathew May
|
||||||
@@ -301,7 +301,6 @@ Giampaolo Vigan
|
|||||||
Gerrick Bivins
|
Gerrick Bivins
|
||||||
George Tarantilis
|
George Tarantilis
|
||||||
Ferdi Smit
|
Ferdi Smit
|
||||||
Eric Buehler
|
|
||||||
Eduardo Poyart
|
Eduardo Poyart
|
||||||
Edgar Ellis
|
Edgar Ellis
|
||||||
Dmitry Marakasov
|
Dmitry Marakasov
|
||||||
@@ -317,6 +316,7 @@ Christian Kehl
|
|||||||
Bradley Baker Searles
|
Bradley Baker Searles
|
||||||
Brad Anderegg
|
Brad Anderegg
|
||||||
Aric Aumann
|
Aric Aumann
|
||||||
|
Anish Thomas
|
||||||
Andrew Sampson
|
Andrew Sampson
|
||||||
Andrew Lorino
|
Andrew Lorino
|
||||||
Alexandre Amalric
|
Alexandre Amalric
|
||||||
@@ -339,6 +339,8 @@ Valeriy Dubov
|
|||||||
Vaclav Bilek
|
Vaclav Bilek
|
||||||
Tyge L<>vset
|
Tyge L<>vset
|
||||||
Troy Yee
|
Troy Yee
|
||||||
|
Torben Dannahauer
|
||||||
|
Tony Vasile
|
||||||
Tomas Hogarth
|
Tomas Hogarth
|
||||||
Tomas Hnilica
|
Tomas Hnilica
|
||||||
Todd Furlong
|
Todd Furlong
|
||||||
@@ -361,6 +363,7 @@ Shane Arnott
|
|||||||
Sergey Kurdakov
|
Sergey Kurdakov
|
||||||
Sebastien Kuntz
|
Sebastien Kuntz
|
||||||
Ruth Lang
|
Ruth Lang
|
||||||
|
Ruben The
|
||||||
Ruben Smelik
|
Ruben Smelik
|
||||||
Ross Anderson
|
Ross Anderson
|
||||||
Ronny Krueger
|
Ronny Krueger
|
||||||
@@ -402,12 +405,14 @@ Oren Fromberg
|
|||||||
Oliver Neumann
|
Oliver Neumann
|
||||||
Ole-Morten Duesund
|
Ole-Morten Duesund
|
||||||
Nicolas Brodu
|
Nicolas Brodu
|
||||||
|
Nick Thu
|
||||||
Nick Black
|
Nick Black
|
||||||
Mojtaba Fathi
|
Mojtaba Fathi
|
||||||
Mirko Viviani
|
Mirko Viviani
|
||||||
Mikkel Gj<47>l
|
Mikkel Gj<47>l
|
||||||
Mike Krus
|
Mike Krus
|
||||||
Mike Garrity
|
Mike Garrity
|
||||||
|
Mick Thu
|
||||||
Michal Durkovic
|
Michal Durkovic
|
||||||
Michael Schanne
|
Michael Schanne
|
||||||
Michael Polak
|
Michael Polak
|
||||||
@@ -415,6 +420,8 @@ Michael Morrison
|
|||||||
Michael Logan
|
Michael Logan
|
||||||
Michael Kapelko
|
Michael Kapelko
|
||||||
Michael Bach Jensen
|
Michael Bach Jensen
|
||||||
|
Maya Thu
|
||||||
|
Maya Leonard
|
||||||
Max Rhiener
|
Max Rhiener
|
||||||
Max Behensky
|
Max Behensky
|
||||||
Mauricio Hofmam
|
Mauricio Hofmam
|
||||||
@@ -431,9 +438,9 @@ Martin Beck
|
|||||||
Marius Kintel
|
Marius Kintel
|
||||||
Mario Guimaraes
|
Mario Guimaraes
|
||||||
Marcus Hein
|
Marcus Hein
|
||||||
|
Marco Thu
|
||||||
Marco Sciabica
|
Marco Sciabica
|
||||||
Marco Lehmann
|
Marco Lehmann
|
||||||
Maik Keller
|
|
||||||
Lukas Diduch
|
Lukas Diduch
|
||||||
Louis Hamilton
|
Louis Hamilton
|
||||||
Likasz Izebski
|
Likasz Izebski
|
||||||
@@ -455,11 +462,14 @@ Juan Hernando
|
|||||||
Josh Portway
|
Josh Portway
|
||||||
Jonathan Greig
|
Jonathan Greig
|
||||||
John Tan
|
John Tan
|
||||||
|
John Hedström
|
||||||
John Grant
|
John Grant
|
||||||
|
John Farrier
|
||||||
John Donovan
|
John Donovan
|
||||||
John Davis
|
John Davis
|
||||||
John Cummings
|
John Cummings
|
||||||
John Argentieri
|
John Argentieri
|
||||||
|
Joe Thompson
|
||||||
Joan Abadie
|
Joan Abadie
|
||||||
Jim Brooks
|
Jim Brooks
|
||||||
Jeroen den Dekker
|
Jeroen den Dekker
|
||||||
@@ -478,8 +488,10 @@ Hartmut Seichter
|
|||||||
Gunter Huber
|
Gunter Huber
|
||||||
Gregory Jaegy
|
Gregory Jaegy
|
||||||
Graeme Harkness
|
Graeme Harkness
|
||||||
|
Github It
|
||||||
Gian Lorenzetto
|
Gian Lorenzetto
|
||||||
George Papagiannakis
|
George Papagiannakis
|
||||||
|
Geoff Thu
|
||||||
Galen Faidley
|
Galen Faidley
|
||||||
Frida Schlaug
|
Frida Schlaug
|
||||||
Frederic Smith
|
Frederic Smith
|
||||||
@@ -494,6 +506,8 @@ Ferdinand Cornelissen
|
|||||||
Fajran Iman
|
Fajran Iman
|
||||||
Fabien Dachicourt
|
Fabien Dachicourt
|
||||||
Erik Johnson
|
Erik Johnson
|
||||||
|
Eric Thu
|
||||||
|
Eric Buehler
|
||||||
Eduardo Alberto
|
Eduardo Alberto
|
||||||
Edmond Gheury
|
Edmond Gheury
|
||||||
Ed Ralston
|
Ed Ralston
|
||||||
@@ -509,6 +523,7 @@ Daniel Stien
|
|||||||
Dan Minor
|
Dan Minor
|
||||||
C<EFBFBD>sar L. B. Silveira
|
C<EFBFBD>sar L. B. Silveira
|
||||||
Cyril Brulebois
|
Cyril Brulebois
|
||||||
|
Cory Slep
|
||||||
Cl<EFBFBD>ment B<>sch
|
Cl<EFBFBD>ment B<>sch
|
||||||
Clay Fowler
|
Clay Fowler
|
||||||
Claus Steuer
|
Claus Steuer
|
||||||
@@ -524,8 +539,8 @@ Carlos Garcea
|
|||||||
Bryce Eldridge
|
Bryce Eldridge
|
||||||
Bruno Herbelin
|
Bruno Herbelin
|
||||||
Brian Keener
|
Brian Keener
|
||||||
|
Brede Thu
|
||||||
Brandon Hamm
|
Brandon Hamm
|
||||||
Bora Utka
|
|
||||||
Bill Prendergast
|
Bill Prendergast
|
||||||
Bernardt Duvenhage
|
Bernardt Duvenhage
|
||||||
Benoit Laniel
|
Benoit Laniel
|
||||||
@@ -535,7 +550,6 @@ Bart Gallet
|
|||||||
Axel Volley
|
Axel Volley
|
||||||
Arjun Ramamurthy
|
Arjun Ramamurthy
|
||||||
Anthousis Andreadis
|
Anthousis Andreadis
|
||||||
Anish Thomas
|
|
||||||
Andy Preece
|
Andy Preece
|
||||||
Andrew Reyonolds
|
Andrew Reyonolds
|
||||||
Andreas Roth
|
Andreas Roth
|
||||||
|
|||||||
111
CMakeLists.txt
111
CMakeLists.txt
@@ -53,12 +53,12 @@ PROJECT(OpenSceneGraph)
|
|||||||
|
|
||||||
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
|
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
|
||||||
SET(OPENSCENEGRAPH_MINOR_VERSION 4)
|
SET(OPENSCENEGRAPH_MINOR_VERSION 4)
|
||||||
SET(OPENSCENEGRAPH_PATCH_VERSION 0)
|
SET(OPENSCENEGRAPH_PATCH_VERSION 1)
|
||||||
SET(OPENSCENEGRAPH_SOVERSION 130)
|
SET(OPENSCENEGRAPH_SOVERSION 131)
|
||||||
|
|
||||||
# set to 0 when not a release candidate, non zero means that any generated
|
# set to 0 when not a release candidate, non zero means that any generated
|
||||||
# svn tags will be treated as release candidates of given number
|
# git tags will be treated as release candidates of given number
|
||||||
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 1)
|
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 0)
|
||||||
|
|
||||||
SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
|
SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
|
||||||
|
|
||||||
@@ -114,27 +114,15 @@ IF(CMAKE_SYSTEM MATCHES IRIX)
|
|||||||
SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
|
SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making svn branches, tags, updating ChangeLog." OFF)
|
OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making git branches, tags, updating ChangeLog." OFF)
|
||||||
IF (OSG_MAINTAINER)
|
IF (OSG_MAINTAINER)
|
||||||
|
|
||||||
SET(OPENSCENEGRAPH_SVN "trunk")
|
|
||||||
#SET(OPENSCENEGRAPH_SVN "branches")
|
|
||||||
SET(OPENSCENEGRAPH_BRANCH OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION})
|
SET(OPENSCENEGRAPH_BRANCH OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION})
|
||||||
|
|
||||||
#
|
#
|
||||||
# Provide target for tagging a release
|
# Provide target for tagging a release
|
||||||
#
|
#
|
||||||
SET(SVNCOMMAND svn)
|
SET(GITCOMMAND git)
|
||||||
SET(SVNTRUNKDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk)
|
|
||||||
SET(SVNTAGDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/tags)
|
|
||||||
SET(SVNBRANCHDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/branches)
|
|
||||||
|
|
||||||
IF (OPENSCENEGRAPH_SVN STREQUAL "trunk")
|
|
||||||
SET(SVNSOURCEDIR ${SVNTRUNKDIR})
|
|
||||||
ELSE()
|
|
||||||
SET(SVNSOURCEDIR ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH})
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
|
|
||||||
IF (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
|
IF (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
|
||||||
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION})
|
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION})
|
||||||
@@ -142,31 +130,38 @@ IF (OSG_MAINTAINER)
|
|||||||
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION}-rc${OPENSCENEGRAPH_RELEASE_CANDIDATE})
|
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION}-rc${OPENSCENEGRAPH_RELEASE_CANDIDATE})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
SET(RELEASE_MESSAGE "Release ${RELEASE_NAME}")
|
||||||
|
SET(BRANCH_MESSAGE "Branch ${OPENSCENEGRAPH_BRANCH}")
|
||||||
|
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(tag-test
|
ADD_CUSTOM_TARGET(tag-test
|
||||||
COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
|
COMMAND echo ${GITCOMMAND} tag -a ${RELEASE_NAME} -m ${RELEASE_MESSAGE}
|
||||||
|
COMMAND echo ${GITCOMMAND} push origin ${RELEASE_NAME}
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(tag-run
|
ADD_CUSTOM_TARGET(tag-run
|
||||||
COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
|
COMMAND ${GITCOMMAND} tag -a ${RELEASE_NAME} -m ${RELEASE_MESSAGE}
|
||||||
|
COMMAND ${GITCOMMAND} push origin ${RELEASE_NAME}
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(branch-test
|
ADD_CUSTOM_TARGET(branch-test
|
||||||
COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
|
COMMAND echo ${GITCOMMAND} branch ${OPENSCENEGRAPH_BRANCH} -m ${BRANCH_MESSAGE}
|
||||||
|
COMMAND echo ${GITCOMMAND} push origin ${OPENSCENEGRAPH_BRANCH}
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(branch-run
|
ADD_CUSTOM_TARGET(branch-run
|
||||||
COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
|
COMMAND ${GITCOMMAND} branch ${OPENSCENEGRAPH_BRANCH} -m ${BRANCH_MESSAGE}
|
||||||
|
COMMAND ${GITCOMMAND} push origin ${OPENSCENEGRAPH_BRANCH}
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Provide target for generating ChangeLog
|
# Provide target for generating ChangeLog
|
||||||
#
|
#
|
||||||
SET(GENERATELOGS svn2cl)
|
SET(GITLOGFORMAT "%aD%nChecked in by : %an%n%s%b%n")
|
||||||
|
SET(GENERATELOGS git log --pretty=format:${GITLOGFORMAT})
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(ChangeLog
|
ADD_CUSTOM_TARGET(ChangeLog
|
||||||
COMMAND ${SVNCOMMAND} update
|
COMMAND ${GENERATELOGS} > ChangeLog
|
||||||
COMMAND ${GENERATELOGS} ${SVNSOURCEDIR}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
ENDIF(OSG_MAINTAINER)
|
ENDIF(OSG_MAINTAINER)
|
||||||
@@ -398,11 +393,12 @@ ENDIF()
|
|||||||
OPTION(OSG_DISABLE_MSVC_WARNINGS "Set to OFF to not disable MSVC warnings generated by OSG headers." ON)
|
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)
|
MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS)
|
||||||
|
|
||||||
|
OPTION(OSG_PROVIDE_READFILE "Set to ON for include/osgDB/ReadFile to provide the osgDB::read*File(() methods. " ON)
|
||||||
OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON)
|
OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON)
|
||||||
|
|
||||||
|
|
||||||
# Map the OPENGL_PROFILE to OSG_GL*_AVAILABLE settings
|
# Map the OPENGL_PROFILE to OSG_GL*_AVAILABLE settings
|
||||||
SET(OPENGL_PROFILE "GL2" CACHE STRING "OpenGL Profile to use, choose from GL2, GL3, GLES1, GLES2, GLES3")
|
SET(OPENGL_PROFILE "GL2" CACHE STRING "OpenGL Profile to use, choose from GL1, GL2, GL3, GLES1, GLES2, GLES3")
|
||||||
|
|
||||||
IF ((OPENGL_PROFILE STREQUAL "GL1") OR (OPENGL_PROFILE STREQUAL "GL2"))
|
IF ((OPENGL_PROFILE STREQUAL "GL1") OR (OPENGL_PROFILE STREQUAL "GL2"))
|
||||||
OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON )
|
OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON )
|
||||||
@@ -519,39 +515,39 @@ ELSE()
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF (OSG_GL1_AVAILABLE)
|
IF (OSG_GL1_AVAILABLE)
|
||||||
SET(OSG_GL1_FEATURES "true")
|
SET(OSG_GL1_FEATURES 1)
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(OSG_GL1_FEATURES "false")
|
SET(OSG_GL1_FEATURES 0)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF (OSG_GL2_AVAILABLE)
|
IF (OSG_GL2_AVAILABLE)
|
||||||
SET(OSG_GL2_FEATURES "true")
|
SET(OSG_GL2_FEATURES 1)
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(OSG_GL2_FEATURES "false")
|
SET(OSG_GL2_FEATURES 0)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF (OSG_GL3_AVAILABLE)
|
IF (OSG_GL3_AVAILABLE)
|
||||||
SET(OSG_GL3_FEATURES "true")
|
SET(OSG_GL3_FEATURES 1)
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(OSG_GL3_FEATURES "false")
|
SET(OSG_GL3_FEATURES 0)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF (OSG_GLES1_AVAILABLE)
|
IF (OSG_GLES1_AVAILABLE)
|
||||||
SET(OSG_GLES1_FEATURES "true")
|
SET(OSG_GLES1_FEATURES 1)
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(OSG_GLES1_FEATURES "false")
|
SET(OSG_GLES1_FEATURES 0)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF (OSG_GLES2_AVAILABLE)
|
IF (OSG_GLES2_AVAILABLE)
|
||||||
SET(OSG_GLES2_FEATURES "true")
|
SET(OSG_GLES2_FEATURES 1)
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(OSG_GLES2_FEATURES "false")
|
SET(OSG_GLES2_FEATURES 0)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF (OSG_GLES3_AVAILABLE)
|
IF (OSG_GLES3_AVAILABLE)
|
||||||
SET(OSG_GLES3_FEATURES "true")
|
SET(OSG_GLES3_FEATURES 1)
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(OSG_GLES3_FEATURES "false")
|
SET(OSG_GLES3_FEATURES 0)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(ANDROID)
|
IF(ANDROID)
|
||||||
@@ -574,12 +570,33 @@ ENDIF()
|
|||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Set Config/OpenGL header file
|
# Set Config header file
|
||||||
|
|
||||||
SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config")
|
SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config")
|
||||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
|
||||||
"${OPENSCENEGRAPH_CONFIG_HEADER}")
|
"${OPENSCENEGRAPH_CONFIG_HEADER}")
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Set OpenGL header file
|
||||||
|
|
||||||
|
INCLUDE (CheckCXXSourceCompiles)
|
||||||
|
#SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${OPENGL_INCLUDE_DIR})
|
||||||
|
|
||||||
|
check_cxx_source_compiles(
|
||||||
|
"${OPENGL_HEADER1}
|
||||||
|
${OPENGL_HEADER2}
|
||||||
|
int main() { GLint64 test; return 0; }"
|
||||||
|
GL_HEADER_HAS_GLINT64
|
||||||
|
)
|
||||||
|
|
||||||
|
check_cxx_source_compiles(
|
||||||
|
"${OPENGL_HEADER1}
|
||||||
|
${OPENGL_HEADER2}
|
||||||
|
int main() { GLuint64 test; return 0; }"
|
||||||
|
GL_HEADER_HAS_GLUINT64
|
||||||
|
)
|
||||||
|
|
||||||
SET(OPENSCENEGRAPH_OPENGL_HEADER "${PROJECT_BINARY_DIR}/include/osg/GL")
|
SET(OPENSCENEGRAPH_OPENGL_HEADER "${PROJECT_BINARY_DIR}/include/osg/GL")
|
||||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/GL.in"
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/GL.in"
|
||||||
"${OPENSCENEGRAPH_OPENGL_HEADER}")
|
"${OPENSCENEGRAPH_OPENGL_HEADER}")
|
||||||
@@ -588,7 +605,7 @@ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/GL.in"
|
|||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Set Vertsion header file
|
# Set Version header file
|
||||||
|
|
||||||
SET(OPENSCENEGRAPH_VERSION_HEADER "${PROJECT_BINARY_DIR}/include/osg/Version")
|
SET(OPENSCENEGRAPH_VERSION_HEADER "${PROJECT_BINARY_DIR}/include/osg/Version")
|
||||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Version.in"
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Version.in"
|
||||||
@@ -661,7 +678,6 @@ ELSE()
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
FIND_PACKAGE(ZeroConf)
|
FIND_PACKAGE(ZeroConf)
|
||||||
|
|
||||||
FIND_PACKAGE(Boost) # used by LIBLAS
|
|
||||||
FIND_PACKAGE(LIBLAS)
|
FIND_PACKAGE(LIBLAS)
|
||||||
|
|
||||||
IF (NOT(OSG_USE_LOCAL_LUA_SOURCE))
|
IF (NOT(OSG_USE_LOCAL_LUA_SOURCE))
|
||||||
@@ -692,11 +708,11 @@ IF(OSG_USE_QT AND NOT ANDROID)
|
|||||||
|
|
||||||
IF (DESIRED_QT_VERSION)
|
IF (DESIRED_QT_VERSION)
|
||||||
IF (DESIRED_QT_VERSION MATCHES 5)
|
IF (DESIRED_QT_VERSION MATCHES 5)
|
||||||
FIND_PACKAGE(Qt5Widgets)
|
FIND_PACKAGE(Qt5Widgets)
|
||||||
ELSEIF (DESIRED_QT_VERSION MATCHES 4)
|
ELSEIF (DESIRED_QT_VERSION MATCHES 4)
|
||||||
FIND_PACKAGE(Qt4)
|
FIND_PACKAGE(Qt4)
|
||||||
ELSE()
|
ELSE()
|
||||||
FIND_PACKAGE(Qt3)
|
FIND_PACKAGE(Qt3)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ELSE()
|
ELSE()
|
||||||
@@ -728,6 +744,13 @@ IF(OSG_USE_QT AND NOT ANDROID)
|
|||||||
#If we have found Qt5, let's try to top off by getting the webkit as well
|
#If we have found Qt5, let's try to top off by getting the webkit as well
|
||||||
IF ( Qt5Widgets_FOUND )
|
IF ( Qt5Widgets_FOUND )
|
||||||
FIND_PACKAGE(Qt5WebKitWidgets QUIET)
|
FIND_PACKAGE(Qt5WebKitWidgets QUIET)
|
||||||
|
|
||||||
|
IF(COMMAND cmake_policy)
|
||||||
|
IF(${CMAKE_MAJOR_VERSION} GREATER 2)
|
||||||
|
# Qt5 qt5_use_modules usage was causing "Policy CMP0043 is not set: Ignore COMPILE_DEFINITIONS_<Config> properties." warnings
|
||||||
|
cmake_policy(SET CMP0043 NEW)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|||||||
@@ -9,19 +9,19 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBU
|
|||||||
|
|
||||||
SET(MY_PATH_INCLUDE )
|
SET(MY_PATH_INCLUDE )
|
||||||
SET(MY_PATH_LIB )
|
SET(MY_PATH_LIB )
|
||||||
|
|
||||||
FOREACH( MYPATH ${SEARCHPATHLIST} )
|
FOREACH( MYPATH ${SEARCHPATHLIST} )
|
||||||
SET(MY_PATH_INCLUDE ${MY_PATH_INCLUDE} ${MYPATH}/include)
|
SET(MY_PATH_INCLUDE ${MY_PATH_INCLUDE} ${MYPATH}/include)
|
||||||
SET(MY_PATH_LIB ${MY_PATH_LIB} ${MYPATH}/lib)
|
SET(MY_PATH_LIB ${MY_PATH_LIB} ${MYPATH}/lib)
|
||||||
ENDFOREACH( MYPATH ${SEARCHPATHLIST} )
|
ENDFOREACH( MYPATH ${SEARCHPATHLIST} )
|
||||||
|
|
||||||
FIND_PATH("${DEPNAME}_INCLUDE_DIR" ${INCLUDEFILE}
|
FIND_PATH("${DEPNAME}_INCLUDE_DIR" ${INCLUDEFILE}
|
||||||
${MY_PATH_INCLUDE}
|
${MY_PATH_INCLUDE}
|
||||||
NO_DEFAULT_PATH
|
NO_DEFAULT_PATH
|
||||||
)
|
)
|
||||||
MARK_AS_ADVANCED("${DEPNAME}_INCLUDE_DIR")
|
MARK_AS_ADVANCED("${DEPNAME}_INCLUDE_DIR")
|
||||||
#MESSAGE( " ${DEPNAME}_INCLUDE_DIR --> ${${DEPNAME}_INCLUDE_DIR}<--")
|
#MESSAGE( " ${DEPNAME}_INCLUDE_DIR --> ${${DEPNAME}_INCLUDE_DIR}<--")
|
||||||
|
|
||||||
SET(LIBRARY_NAMES "")
|
SET(LIBRARY_NAMES "")
|
||||||
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
|
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
|
||||||
LIST(APPEND LIBRARY_NAMES "${LIBNAME}${EXSUFFIX}")
|
LIST(APPEND LIBRARY_NAMES "${LIBNAME}${EXSUFFIX}")
|
||||||
@@ -35,7 +35,7 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBU
|
|||||||
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
|
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
|
||||||
LIST(APPEND LIBRARY_NAMES_DEBUG "${LIBNAME}${DEBUGSUFFIX}${EXSUFFIX}")
|
LIST(APPEND LIBRARY_NAMES_DEBUG "${LIBNAME}${DEBUGSUFFIX}${EXSUFFIX}")
|
||||||
ENDFOREACH(LIBNAME)
|
ENDFOREACH(LIBNAME)
|
||||||
FIND_LIBRARY("${DEPNAME}_LIBRARY_DEBUG"
|
FIND_LIBRARY("${DEPNAME}_LIBRARY_DEBUG"
|
||||||
NAMES ${LIBRARY_NAMES_DEBUG}
|
NAMES ${LIBRARY_NAMES_DEBUG}
|
||||||
PATHS ${MY_PATH_LIB}
|
PATHS ${MY_PATH_LIB}
|
||||||
NO_DEFAULT_PATH
|
NO_DEFAULT_PATH
|
||||||
@@ -49,7 +49,13 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBU
|
|||||||
MESSAGE("-- Warning Debug ${DEPNAME} not found, using: ${${DEPNAME}_LIBRARY}")
|
MESSAGE("-- Warning Debug ${DEPNAME} not found, using: ${${DEPNAME}_LIBRARY}")
|
||||||
SET(${DEPNAME}_LIBRARY_DEBUG "${${DEPNAME}_LIBRARY}")
|
SET(${DEPNAME}_LIBRARY_DEBUG "${${DEPNAME}_LIBRARY}")
|
||||||
ENDIF(NOT ${DEPNAME}_LIBRARY_DEBUG)
|
ENDIF(NOT ${DEPNAME}_LIBRARY_DEBUG)
|
||||||
|
|
||||||
|
SET(${DEPNAME}_LIBRARIES debug ${${DEPNAME}_LIBRARY_DEBUG} optimized ${${DEPNAME}_LIBRARY} )
|
||||||
|
|
||||||
ENDIF(${DEPNAME}_INCLUDE_DIR AND ${DEPNAME}_LIBRARY)
|
ENDIF(${DEPNAME}_INCLUDE_DIR AND ${DEPNAME}_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX)
|
ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX)
|
||||||
|
|
||||||
|
|
||||||
@@ -58,21 +64,21 @@ ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST D
|
|||||||
################################################################################################
|
################################################################################################
|
||||||
|
|
||||||
MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
||||||
FIND_DEPENDENCY(TIFF tiff.h libtiff ${OSG_3RDPARTY_BIN} "D" "_i")
|
FIND_DEPENDENCY(TIFF tiff.h "libtiff;tiff" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype2311MT;freetype234;freetype234MT;freetype235;freetype237;freetype238;freetype244;freetype250;" ${OSG_3RDPARTY_BIN} "d" "")
|
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype2311MT;freetype234;freetype234MT;freetype235;freetype237;freetype238;freetype244;freetype250;freetype27;" ${OSG_3RDPARTY_BIN} "d" "")
|
||||||
IF(FREETYPE_FOUND)
|
IF(FREETYPE_FOUND)
|
||||||
#forcing subsequent FindFreeType stuff to not search for other variables.... kind of a hack
|
#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_ft2build ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
|
||||||
SET(FREETYPE_INCLUDE_DIR_freetype2 ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
|
SET(FREETYPE_INCLUDE_DIR_freetype2 ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
|
||||||
MARK_AS_ADVANCED(FREETYPE_INCLUDE_DIR_ft2build FREETYPE_INCLUDE_DIR_freetype2)
|
MARK_AS_ADVANCED(FREETYPE_INCLUDE_DIR_ft2build FREETYPE_INCLUDE_DIR_freetype2)
|
||||||
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
|
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
|
||||||
ENDIF(FREETYPE_FOUND)
|
ENDIF(FREETYPE_FOUND)
|
||||||
FIND_DEPENDENCY(CURL curl/curl.h "libcurl;curllib" ${OSG_3RDPARTY_BIN} "D" "")
|
FIND_DEPENDENCY(CURL curl/curl.h "libcurl;curllib;libcurl_imp" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
FIND_DEPENDENCY(JPEG jpeglib.h "libjpeg;jpeg" ${OSG_3RDPARTY_BIN} "D" "")
|
FIND_DEPENDENCY(JPEG jpeglib.h "libjpeg;jpeg" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
FIND_DEPENDENCY(GDAL gdal.h "gdal;gdal16" ${OSG_3RDPARTY_BIN} "d" "_i")
|
FIND_DEPENDENCY(GDAL gdal.h "gdal;gdal16" ${OSG_3RDPARTY_BIN} "d" "_i")
|
||||||
FIND_DEPENDENCY(GLUT GL/glut.h glut32 ${OSG_3RDPARTY_BIN} "D" "")
|
FIND_DEPENDENCY(GLUT GL/glut.h glut32 ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
IF(GLUT_FOUND)
|
IF(GLUT_FOUND)
|
||||||
#forcing subsequent FindGlut stuff to not search for other variables.... kind of a hack
|
#forcing subsequent FindGlut stuff to not search for other variables.... kind of a hack
|
||||||
SET(GLUT_glut_LIBRARY ${GLUT_LIBRARY} CACHE FILEPATH "")
|
SET(GLUT_glut_LIBRARY ${GLUT_LIBRARY} CACHE FILEPATH "")
|
||||||
MARK_AS_ADVANCED(GLUT_glut_LIBRARY)
|
MARK_AS_ADVANCED(GLUT_glut_LIBRARY)
|
||||||
ENDIF(GLUT_FOUND)
|
ENDIF(GLUT_FOUND)
|
||||||
@@ -81,16 +87,18 @@ MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
|||||||
IF(ZLIB_FOUND)
|
IF(ZLIB_FOUND)
|
||||||
FIND_DEPENDENCY(PNG png.h "libpng;libpng13;libpng15;libpng16" ${OSG_3RDPARTY_BIN} "D" "")
|
FIND_DEPENDENCY(PNG png.h "libpng;libpng13;libpng15;libpng16" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
IF(PNG_FOUND)
|
IF(PNG_FOUND)
|
||||||
#forcing subsequent FindPNG stuff to not search for other variables.... kind of a hack
|
#forcing subsequent FindPNG stuff to not search for other variables.... kind of a hack
|
||||||
SET(PNG_PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE FILEPATH "")
|
SET(PNG_PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE FILEPATH "")
|
||||||
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR)
|
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR)
|
||||||
ENDIF(PNG_FOUND)
|
ENDIF(PNG_FOUND)
|
||||||
ENDIF(ZLIB_FOUND)
|
ENDIF(ZLIB_FOUND)
|
||||||
FIND_DEPENDENCY(LIBXML2 libxml2 "libxml2" ${OSG_3RDPARTY_BIN} "D" "")
|
|
||||||
|
# CMakes default module to find libxml2 will not find the in
|
||||||
|
FIND_DEPENDENCY(LIBXML2 libxml/xpath.h "libxml2" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
IF(LIBXML2_FOUND)
|
IF(LIBXML2_FOUND)
|
||||||
# The CMAKE find libxml module uses LIBXML2_LIBRARIES -> fill it.... kind of a hack
|
# The CMAKE find libxml module uses LIBXML2_LIBRARIES -> fill it.... kind of a hack
|
||||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY} CACHE FILEPATH "" FORCE)
|
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY} CACHE FILEPATH "LibXML2 library for collada" FORCE)
|
||||||
SET(LIBXML2_XMLLINT_EXECUTABLE ${OSG_3RDPARTY_BIN}/bin/xmllint.exe CACHE FILEPATH "Path to xmllint executable" FORCE)
|
# SET(LIBXML2_XMLLINT_EXECUTABLE ${OSG_3RDPARTY_BIN}/bin/xmllint.exe CACHE FILEPATH "Path to xmllint executable" FORCE)
|
||||||
ENDIF(LIBXML2_FOUND)
|
ENDIF(LIBXML2_FOUND)
|
||||||
#FIND_DEPENDENCY(DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX EXSUFFIX)
|
#FIND_DEPENDENCY(DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX EXSUFFIX)
|
||||||
FIND_Package(NVTT)
|
FIND_Package(NVTT)
|
||||||
@@ -104,7 +112,7 @@ ENDMACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
|||||||
# this is code for handling optional 3RDPARTY usage
|
# this is code for handling optional 3RDPARTY usage
|
||||||
################################################################################################
|
################################################################################################
|
||||||
|
|
||||||
OPTION(USE_3RDPARTY_BIN "Set to ON to use Mike prebuilt dependencies situated side of OpenSceneGraph source. Use OFF for avoiding." ON)
|
OPTION(USE_3RDPARTY_BIN "Set to ON to use Mike or Torbens prebuilt dependencies situated side of OpenSceneGraph source. Use OFF for avoiding." ON)
|
||||||
IF(USE_3RDPARTY_BIN)
|
IF(USE_3RDPARTY_BIN)
|
||||||
|
|
||||||
# Check Architecture
|
# Check Architecture
|
||||||
@@ -132,7 +140,7 @@ IF(USE_3RDPARTY_BIN)
|
|||||||
SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdParty_win32binaries_vs90sp1")
|
SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdParty_win32binaries_vs90sp1")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF(NOT EXISTS ${TEST_3RDPARTY_DIR})
|
ENDIF(NOT EXISTS ${TEST_3RDPARTY_DIR})
|
||||||
|
|
||||||
SET(ACTUAL_3RDPARTY_DIR "${TEST_3RDPARTY_DIR}" CACHE PATH "Location of 3rdparty dependencies")
|
SET(ACTUAL_3RDPARTY_DIR "${TEST_3RDPARTY_DIR}" CACHE PATH "Location of 3rdparty dependencies")
|
||||||
SET(ACTUAL_3DPARTY_DIR "${ACTUAL_3RDPARTY_DIR}") # kept for backcompatibility
|
SET(ACTUAL_3DPARTY_DIR "${ACTUAL_3RDPARTY_DIR}") # kept for backcompatibility
|
||||||
IF(EXISTS ${ACTUAL_3RDPARTY_DIR})
|
IF(EXISTS ${ACTUAL_3RDPARTY_DIR})
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ ELSE()
|
|||||||
# AVFoundation exists since 10.7, but only 10.8 has all features necessary for OSG
|
# AVFoundation exists since 10.7, but only 10.8 has all features necessary for OSG
|
||||||
# so check the SDK-setting
|
# so check the SDK-setting
|
||||||
|
|
||||||
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10")
|
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.11")
|
||||||
# nothing special here ;-)
|
# nothing special here ;-)
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE("AVFoundation disabled for SDK < 10.8")
|
MESSAGE("AVFoundation disabled for SDK < 10.8")
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# Locate ASIO-headers (http://think-async.com/Asio)
|
# Locate ASIO-headers (http://think-async.com/Asio)
|
||||||
# This module defines
|
# This module defines
|
||||||
# ASIO_FOUND, if false, do not try to link to gdal
|
# ASIO_FOUND, if false, do not try to link to gdal
|
||||||
# ASIO_INCLUDE_DIR, where to find the headers
|
# ASIO_INCLUDE_DIR, where to find the headers
|
||||||
#
|
#
|
||||||
# Created by Stephan Maximilian Huber
|
# Created by Stephan Maximilian Huber
|
||||||
|
|
||||||
FIND_PATH(ASIO_INCLUDE_DIR
|
FIND_PATH(ASIO_INCLUDE_DIR
|
||||||
NAMES
|
NAMES
|
||||||
@@ -14,7 +14,9 @@ FIND_PATH(ASIO_INCLUDE_DIR
|
|||||||
)
|
)
|
||||||
|
|
||||||
SET(ASIO_FOUND "NO")
|
SET(ASIO_FOUND "NO")
|
||||||
FIND_PACKAGE( Boost 1.37 )
|
IF(ASIO_INCLUDE_DIR)
|
||||||
IF(Boost_FOUND AND ASIO_INCLUDE_DIR)
|
FIND_PACKAGE( Boost 1.37 )
|
||||||
SET(ASIO_FOUND "YES")
|
IF(Boost_FOUND)
|
||||||
|
SET(ASIO_FOUND "YES")
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ IF(APPLE)
|
|||||||
SET(COLLADA_BUILDNAME "mac")
|
SET(COLLADA_BUILDNAME "mac")
|
||||||
ELSEIF(MINGW)
|
ELSEIF(MINGW)
|
||||||
SET(COLLADA_BUILDNAME "mingw")
|
SET(COLLADA_BUILDNAME "mingw")
|
||||||
|
ELSEIF(MSVC14)
|
||||||
|
SET(COLLADA_BUILDNAME "vc14")
|
||||||
ELSEIF(MSVC12)
|
ELSEIF(MSVC12)
|
||||||
SET(COLLADA_BUILDNAME "vc12")
|
SET(COLLADA_BUILDNAME "vc12")
|
||||||
ELSEIF(MSVC11)
|
ELSEIF(MSVC11)
|
||||||
@@ -53,10 +55,16 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
|
|||||||
/usr/local/include
|
/usr/local/include
|
||||||
/usr/local/include/colladadom
|
/usr/local/include/colladadom
|
||||||
/usr/local/include/collada-dom
|
/usr/local/include/collada-dom
|
||||||
|
/usr/local/include/collada-dom2.4
|
||||||
|
/usr/local/include/collada-dom2.2
|
||||||
/opt/local/include/collada-dom
|
/opt/local/include/collada-dom
|
||||||
|
/opt/local/include/collada-dom2.4
|
||||||
|
/opt/local/include/collada-dom2.2
|
||||||
/usr/include/
|
/usr/include/
|
||||||
/usr/include/colladadom
|
/usr/include/colladadom
|
||||||
/usr/include/collada-dom
|
/usr/include/collada-dom
|
||||||
|
/usr/include/collada-dom2.4
|
||||||
|
/usr/include/collada-dom2.2
|
||||||
/sw/include # Fink
|
/sw/include # Fink
|
||||||
/opt/local/include # DarwinPorts
|
/opt/local/include # DarwinPorts
|
||||||
/opt/csw/include # Blastwave
|
/opt/csw/include # Blastwave
|
||||||
@@ -66,7 +74,7 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
|
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
|
||||||
NAMES collada_dom collada14dom Collada14Dom libcollada14dom21 libcollada14dom22 collada-dom2.4-dp
|
NAMES collada_dom collada14dom Collada14Dom libcollada14dom21 libcollada14dom22 collada-dom2.4-dp collada-dom2.4-dp-vc120-mt
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
|
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
|
||||||
${COLLADA_DOM_ROOT}
|
${COLLADA_DOM_ROOT}
|
||||||
@@ -90,7 +98,7 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
|
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
|
||||||
NAMES collada_dom-d collada14dom-d Collada14Dom-d libcollada14dom21-d libcollada14dom22-d collada-dom2.4-dp-d
|
NAMES collada_dom-d collada14dom-d Collada14Dom-d libcollada14dom21-d libcollada14dom22-d collada-dom2.4-dp-d collada-dom2.4-dp-vc120-mt-d
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
|
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
|
||||||
${COLLADA_DOM_ROOT}
|
${COLLADA_DOM_ROOT}
|
||||||
@@ -178,7 +186,16 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
|
|
||||||
FIND_PACKAGE(ZLIB)
|
FIND_PACKAGE(ZLIB)
|
||||||
IF (ZLIB_FOUND)
|
IF (ZLIB_FOUND)
|
||||||
SET(COLLADA_ZLIB_LIBRARY "${ZLIB_LIBRARY}" CACHE FILEPATH "" FORCE)
|
IF (ZLIB_LIBRARY_RELEASE)
|
||||||
|
SET(COLLADA_ZLIB_LIBRARY "${ZLIB_LIBRARY_RELEASE}" CACHE FILEPATH "" FORCE)
|
||||||
|
ELSE(ZLIB_LIBRARY_RELEASE)
|
||||||
|
SET(COLLADA_ZLIB_LIBRARY "${ZLIB_LIBRARY}" CACHE FILEPATH "" FORCE)
|
||||||
|
ENDIF(ZLIB_LIBRARY_RELEASE)
|
||||||
|
IF (ZLIB_LIBRARY_DEBUG)
|
||||||
|
SET(COLLADA_ZLIB_LIBRARY_DEBUG "${ZLIB_LIBRARY_DEBUG}" CACHE FILEPATH "" FORCE)
|
||||||
|
ELSE(ZLIB_LIBRARY_DEBUG)
|
||||||
|
SET(COLLADA_ZLIB_LIBRARY_DEBUG "${COLLADA_ZLIB_LIBRARY}" CACHE FILEPATH "" FORCE)
|
||||||
|
ENDIF(ZLIB_LIBRARY_DEBUG)
|
||||||
ELSE(ZLIB_FOUND)
|
ELSE(ZLIB_FOUND)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
FIND_LIBRARY(COLLADA_ZLIB_LIBRARY
|
FIND_LIBRARY(COLLADA_ZLIB_LIBRARY
|
||||||
@@ -244,7 +261,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
|
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
|
||||||
NAMES libboost_filesystem boost_filesystem boost_filesystem-mt libboost_filesystem-${COLLADA_BUILDNAME}0-mt libboost_filesystem-${COLLADA_BUILDNAME}0-mt-1_54 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-1_55
|
NAMES libboost_filesystem boost_filesystem boost_filesystem-mt libboost_filesystem-${COLLADA_BUILDNAME}0-mt libboost_filesystem-${COLLADA_BUILDNAME}0-mt-1_54 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-1_55 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-1_58 boost_filesystem-${COLLADA_BUILDNAME}0-mt-1_62
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
||||||
@@ -252,7 +269,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
|
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
|
||||||
NAMES libboost_filesystem-d boost_filesystem-d boost_filesystem-mt-d libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_54 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_55
|
NAMES libboost_filesystem-d boost_filesystem-d boost_filesystem-mt-d libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_54 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_55 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_58 boost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_62
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
||||||
@@ -260,7 +277,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
|
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
|
||||||
NAMES libboost_system boost_system boost_system-mt libboost_system-${COLLADA_BUILDNAME}0-mt libboost_system-${COLLADA_BUILDNAME}0-mt-1_54 libboost_system-${COLLADA_BUILDNAME}0-mt-1_55
|
NAMES libboost_system boost_system boost_system-mt libboost_system-${COLLADA_BUILDNAME}0-mt libboost_system-${COLLADA_BUILDNAME}0-mt-1_54 libboost_system-${COLLADA_BUILDNAME}0-mt-1_55 libboost_system-${COLLADA_BUILDNAME}0-mt-1_58 boost_system-${COLLADA_BUILDNAME}0-mt-1_62
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
||||||
@@ -268,7 +285,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
|
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
|
||||||
NAMES libboost_system-d boost_system-d boost_system-mt-d libboost_system-${COLLADA_BUILDNAME}0-mt-gd libboost_system-${COLLADA_BUILDNAME}0-mt-gd-1_54 libboost_system-${COLLADA_BUILDNAME}0-mt-gd-1_55
|
NAMES libboost_system-d boost_system-d boost_system-mt-d libboost_system-${COLLADA_BUILDNAME}0-mt-gd libboost_system-${COLLADA_BUILDNAME}0-mt-gd-1_54 libboost_system-${COLLADA_BUILDNAME}0-mt-gd-1_55 libboost_system-${COLLADA_BUILDNAME}0-mt-gd-1_58 boost_system-${COLLADA_BUILDNAME}0-mt-gd-1_62
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
||||||
|
|||||||
@@ -50,13 +50,13 @@ SET( FBX_SEARCH_PATHS
|
|||||||
$ENV{FBX_DIR}
|
$ENV{FBX_DIR}
|
||||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2015.1"
|
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2015.1"
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2015.1"
|
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2015.1"
|
||||||
|
"/Applications/Autodesk/FBX/FBX SDK/2015.1"
|
||||||
/Applications/Autodesk/FBXSDK20151
|
/Applications/Autodesk/FBXSDK20151
|
||||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.2"
|
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.2"
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.2"
|
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.2"
|
||||||
|
"/Applications/Autodesk/FBX/FBX SDK/2014.2"
|
||||||
/Applications/Autodesk/FBXSDK20142
|
/Applications/Autodesk/FBXSDK20142
|
||||||
/Applications/Autodesk/FBXSDK20141
|
|
||||||
)
|
)
|
||||||
#I think the last line in the search path is an old typo, but let's search for 2014.1 anyway - LV
|
|
||||||
|
|
||||||
# search for headers & debug/release libraries
|
# search for headers & debug/release libraries
|
||||||
FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
|
FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
|
||||||
@@ -96,8 +96,9 @@ IF(NOT FBX_FOUND)
|
|||||||
|
|
||||||
SET( FBX_SEARCH_PATHS
|
SET( FBX_SEARCH_PATHS
|
||||||
$ENV{FBX_DIR}
|
$ENV{FBX_DIR}
|
||||||
$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.1
|
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.1"
|
||||||
$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.1
|
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.1"
|
||||||
|
"/Applications/Autodesk/FBX/FBX SDK/2014.1"
|
||||||
/Applications/Autodesk/FBXSDK20141
|
/Applications/Autodesk/FBXSDK20141
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -134,8 +135,9 @@ IF(NOT FBX_FOUND)
|
|||||||
|
|
||||||
SET( FBX_SEARCH_PATHS
|
SET( FBX_SEARCH_PATHS
|
||||||
$ENV{FBX_DIR}
|
$ENV{FBX_DIR}
|
||||||
$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2013.3
|
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2013.3"
|
||||||
$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2013.3
|
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2013.3"
|
||||||
|
"/Applications/Autodesk/FBX/FBX SDK/2013.3"
|
||||||
/Applications/Autodesk/FBXSDK20133
|
/Applications/Autodesk/FBXSDK20133
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,141 +1,188 @@
|
|||||||
# - Locate FreeType library
|
#.rst:
|
||||||
|
# FindFreetype
|
||||||
|
# ------------
|
||||||
|
#
|
||||||
|
# Locate FreeType library
|
||||||
|
#
|
||||||
# This module defines
|
# This module defines
|
||||||
# FREETYPE_LIBRARY, the library to link against
|
#
|
||||||
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
|
# ::
|
||||||
# FREETYPE_INCLUDE_DIRS, where to find headers.
|
#
|
||||||
# This is the concatenation of the paths:
|
# FREETYPE_LIBRARIES, the library to link against
|
||||||
# FREETYPE_INCLUDE_DIR_ft2build
|
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
|
||||||
# FREETYPE_INCLUDE_DIR_freetype2
|
# FREETYPE_INCLUDE_DIRS, where to find headers.
|
||||||
#
|
# FREETYPE_VERSION_STRING, the version of freetype found (since CMake 2.8.8)
|
||||||
# $FREETYPE_DIR is an environment variable that would
|
# This is the concatenation of the paths:
|
||||||
# correspond to the ./configure --prefix=$FREETYPE_DIR
|
# FREETYPE_INCLUDE_DIR_ft2build
|
||||||
# used in building FREETYPE.
|
# FREETYPE_INCLUDE_DIR_freetype2
|
||||||
# Created by Eric Wing.
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# $FREETYPE_DIR is an environment variable that would correspond to the
|
||||||
|
# ./configure --prefix=$FREETYPE_DIR used in building FREETYPE.
|
||||||
|
|
||||||
# prefer FindFreetype from cmake distribution
|
#=============================================================================
|
||||||
if(EXISTS ${CMAKE_ROOT}/Modules/FindFreetype.cmake)
|
# Copyright 2000-2016 Kitware, Inc.
|
||||||
include(${CMAKE_ROOT}/Modules/FindFreetype.cmake)
|
# Copyright 2000-2011 Insight Software Consortium
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
|
||||||
|
# nor the names of their contributors may be used to endorse or promote
|
||||||
|
# products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#=============================================================================
|
||||||
|
|
||||||
if(FREETYPE_FOUND)
|
# Created by Eric Wing.
|
||||||
return()
|
# Modifications by Alexander Neundorf.
|
||||||
endif()
|
# This file has been renamed to "FindFreetype.cmake" instead of the correct
|
||||||
endif()
|
# "FindFreeType.cmake" in order to be compatible with the one from KDE4, Alex.
|
||||||
|
|
||||||
# Ugh, FreeType seems to use some #include trickery which
|
# Ugh, FreeType seems to use some #include trickery which
|
||||||
# makes this harder than it should be. It looks like they
|
# makes this harder than it should be. It looks like they
|
||||||
# put ft2build.h in a common/easier-to-find location which
|
# put ft2build.h in a common/easier-to-find location which
|
||||||
# then contains a #include to a more specific header in a
|
# then contains a #include to a more specific header in a
|
||||||
# more specific location (#include <freetype/config/ftheader.h>).
|
# more specific location (#include <freetype/config/ftheader.h>).
|
||||||
# Then from there, they need to set a bunch of #define's
|
# Then from there, they need to set a bunch of #define's
|
||||||
# so you can do something like:
|
# so you can do something like:
|
||||||
# #include FT_FREETYPE_H
|
# #include FT_FREETYPE_H
|
||||||
# Unfortunately, using CMake's mechanisms like INCLUDE_DIRECTORIES()
|
# Unfortunately, using CMake's mechanisms like include_directories()
|
||||||
# wants explicit full paths and this trickery doesn't work too well.
|
# wants explicit full paths and this trickery doesn't work too well.
|
||||||
# I'm going to attempt to cut out the middleman and hope
|
# I'm going to attempt to cut out the middleman and hope
|
||||||
# everything still works.
|
# everything still works.
|
||||||
|
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
|
# Adapted for OpenSceneGraph until the updates here for finding the debug Windows library freetyped are released with CMake
|
||||||
|
|
||||||
|
set(FREETYPE_FIND_ARGS
|
||||||
|
HINTS
|
||||||
|
ENV FREETYPE_DIR
|
||||||
PATHS
|
PATHS
|
||||||
$ENV{FREETYPE_DIR}
|
/usr/X11R6
|
||||||
NO_DEFAULT_PATH
|
/usr/local/X11R6
|
||||||
PATH_SUFFIXES include
|
/usr/local/X11
|
||||||
)
|
/usr/freeware
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
|
ENV GTKMM_BASEPATH
|
||||||
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
|
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
|
||||||
NO_DEFAULT_PATH
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
|
||||||
PATH_SUFFIXES include
|
|
||||||
)
|
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
|
|
||||||
PATHS
|
|
||||||
/usr/local
|
|
||||||
/usr
|
|
||||||
/usr/local/X11R6
|
|
||||||
/usr/local/X11
|
|
||||||
/usr/X11R6
|
|
||||||
/usr/X11
|
|
||||||
/sw
|
|
||||||
/opt/local
|
|
||||||
/opt/csw
|
|
||||||
/opt
|
|
||||||
/usr/freeware
|
|
||||||
PATH_SUFFIXES include include/freetype2
|
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
|
find_path(
|
||||||
$ENV{FREETYPE_DIR}/include/freetype2
|
FREETYPE_INCLUDE_DIR_ft2build
|
||||||
NO_DEFAULT_PATH
|
ft2build.h
|
||||||
)
|
${FREETYPE_FIND_ARGS}
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
|
PATH_SUFFIXES
|
||||||
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
|
include/freetype2
|
||||||
NO_DEFAULT_PATH
|
include
|
||||||
PATH_SUFFIXES include/freetype2
|
freetype2
|
||||||
)
|
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
|
|
||||||
/usr/local/include/freetype2
|
|
||||||
/usr/include/freetype2
|
|
||||||
/usr/local/X11R6/include/freetype2
|
|
||||||
/usr/local/X11/include/freetype2
|
|
||||||
/usr/X11R6/include/freetype2
|
|
||||||
/usr/X11/include/freetype2
|
|
||||||
/sw/include/freetype2
|
|
||||||
/opt/local/include/freetype2
|
|
||||||
/opt/csw/include/freetype2
|
|
||||||
/opt/include/freetype2
|
|
||||||
/usr/freeware/include/freetype2
|
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 config/ftheader.h
|
find_path(
|
||||||
/usr/local/include/freetype2
|
FREETYPE_INCLUDE_DIR_freetype2
|
||||||
/usr/include/freetype2
|
NAMES
|
||||||
/usr/local/X11R6/include/freetype2
|
freetype/config/ftheader.h
|
||||||
/usr/local/X11/include/freetype2
|
config/ftheader.h
|
||||||
/usr/X11R6/include/freetype2
|
${FREETYPE_FIND_ARGS}
|
||||||
/usr/X11/include/freetype2
|
PATH_SUFFIXES
|
||||||
/sw/include/freetype2
|
include/freetype2
|
||||||
/opt/local/include/freetype2
|
include
|
||||||
/opt/csw/include/freetype2
|
freetype2
|
||||||
/opt/include/freetype2
|
|
||||||
/usr/freeware/include/freetype2
|
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(FREETYPE_LIBRARY
|
if(NOT FREETYPE_LIBRARY)
|
||||||
NAMES freetype libfreetype freetype219
|
find_library(FREETYPE_LIBRARY_RELEASE
|
||||||
PATHS
|
NAMES
|
||||||
$ENV{FREETYPE_DIR}
|
freetype
|
||||||
NO_DEFAULT_PATH
|
libfreetype
|
||||||
PATH_SUFFIXES lib64 lib
|
freetype219
|
||||||
)
|
${FREETYPE_FIND_ARGS}
|
||||||
FIND_LIBRARY(FREETYPE_LIBRARY
|
PATH_SUFFIXES
|
||||||
NAMES freetype libfreetype freetype219
|
lib
|
||||||
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
|
)
|
||||||
NO_DEFAULT_PATH
|
find_library(FREETYPE_LIBRARY_DEBUG
|
||||||
PATH_SUFFIXES lib64 lib
|
NAMES
|
||||||
)
|
freetyped
|
||||||
FIND_LIBRARY(FREETYPE_LIBRARY
|
libfreetyped
|
||||||
NAMES freetype libfreetype freetype219
|
freetype219d
|
||||||
PATHS
|
${FREETYPE_FIND_ARGS}
|
||||||
/usr/local
|
PATH_SUFFIXES
|
||||||
/usr
|
lib
|
||||||
/usr/local/X11R6
|
)
|
||||||
/usr/local/X11
|
include(SelectLibraryConfigurations) #OSG Look in CMake Modules dir
|
||||||
/usr/X11R6
|
select_library_configurations(FREETYPE)
|
||||||
/usr/X11
|
endif()
|
||||||
/sw
|
|
||||||
/opt/local
|
unset(FREETYPE_FIND_ARGS)
|
||||||
/opt/csw
|
|
||||||
/opt
|
# set the user variables
|
||||||
/usr/freeware
|
if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
|
||||||
PATH_SUFFIXES lib64 lib
|
set(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
|
||||||
|
list(REMOVE_DUPLICATES FREETYPE_INCLUDE_DIRS)
|
||||||
|
endif()
|
||||||
|
set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
|
||||||
|
|
||||||
|
if(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
|
||||||
|
set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
|
||||||
|
elseif(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
|
||||||
|
set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
|
||||||
|
file(STRINGS "${FREETYPE_H}" freetype_version_str
|
||||||
|
REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
|
||||||
|
|
||||||
|
unset(FREETYPE_VERSION_STRING)
|
||||||
|
foreach(VPART MAJOR MINOR PATCH)
|
||||||
|
foreach(VLINE ${freetype_version_str})
|
||||||
|
if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$")
|
||||||
|
set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}")
|
||||||
|
if(FREETYPE_VERSION_STRING)
|
||||||
|
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
|
||||||
|
else()
|
||||||
|
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
|
||||||
|
endif()
|
||||||
|
unset(FREETYPE_VERSION_PART)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
|
||||||
|
# all listed variables are TRUE
|
||||||
|
include(FindPackageHandleStandardArgs) #OSG Look in CMake Modules dir
|
||||||
|
|
||||||
|
find_package_handle_standard_args(
|
||||||
|
Freetype
|
||||||
|
REQUIRED_VARS
|
||||||
|
FREETYPE_LIBRARY
|
||||||
|
FREETYPE_INCLUDE_DIRS
|
||||||
|
VERSION_VAR
|
||||||
|
FREETYPE_VERSION_STRING
|
||||||
)
|
)
|
||||||
|
|
||||||
IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
|
mark_as_advanced(
|
||||||
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
|
FREETYPE_INCLUDE_DIR_freetype2
|
||||||
ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
|
FREETYPE_INCLUDE_DIR_ft2build
|
||||||
|
)
|
||||||
|
|
||||||
SET(FREETYPE_FOUND "NO")
|
|
||||||
IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
|
|
||||||
SET(FREETYPE_FOUND "YES")
|
|
||||||
ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -83,18 +83,18 @@ else ()
|
|||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
|
|
||||||
macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library)
|
macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library)
|
||||||
pkg_check_modules(PC_${_component_prefix} QUIET ${_pkgconfig_name})
|
pkg_check_modules(${_component_prefix} QUIET ${_pkgconfig_name})
|
||||||
|
|
||||||
find_path(${_component_prefix}_INCLUDE_DIRS
|
# find_path(${_component_prefix}_INCLUDE_DIRS
|
||||||
NAMES ${_header}
|
# NAMES ${_header}
|
||||||
HINTS ${PC_${_component_prefix}_INCLUDE_DIRS} ${PC_${_component_prefix}_INCLUDEDIR}
|
# HINTS ${PC_${_component_prefix}_INCLUDE_DIRS} ${PC_${_component_prefix}_INCLUDEDIR}
|
||||||
PATH_SUFFIXES gstreamer-1.0
|
# PATH_SUFFIXES gstreamer-1.0
|
||||||
)
|
# )
|
||||||
|
|
||||||
find_library(${_component_prefix}_LIBRARIES
|
# find_library(${_component_prefix}_LIBRARIES
|
||||||
NAMES ${_library}
|
# NAMES ${_library}
|
||||||
HINTS ${PC_${_component_prefix}_LIBRARY_DIRS} ${PC_${_component_prefix}_LIBDIR}
|
# HINTS ${PC_${_component_prefix}_LIBRARY_DIRS} ${PC_${_component_prefix}_LIBDIR}
|
||||||
)
|
# )
|
||||||
endmacro()
|
endmacro()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,10 @@ FIND_LIBLAS_LIBRARY(LIBLASC_LIBRARY las_c)
|
|||||||
|
|
||||||
set(LIBLAS_FOUND "NO")
|
set(LIBLAS_FOUND "NO")
|
||||||
if(LIBLAS_LIBRARY AND LIBLASC_LIBRARY AND LIBLAS_INCLUDE_DIR)
|
if(LIBLAS_LIBRARY AND LIBLASC_LIBRARY AND LIBLAS_INCLUDE_DIR)
|
||||||
set(LIBLAS_LIBRARIES ${LIBLAS_LIBRARY} ${LIBLASC_LIBRARY} )
|
|
||||||
set(LIBLAS_FOUND "YES")
|
FIND_PACKAGE(Boost) # used by LIBLAS
|
||||||
|
if(Boost_FOUND)
|
||||||
|
set(LIBLAS_LIBRARIES ${LIBLAS_LIBRARY} ${LIBLASC_LIBRARY} )
|
||||||
|
set(LIBLAS_FOUND "YES")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -98,6 +98,85 @@ FIND_LIBRARY(NVCORE_LIBRARY_DEBUG
|
|||||||
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# NVTHREAD
|
||||||
|
FIND_LIBRARY(NVTHREAD_LIBRARY
|
||||||
|
NAMES nvthread
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
FIND_LIBRARY(NVTHREAD_LIBRARY_DEBUG
|
||||||
|
NAMES nvthread_d
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
|
||||||
|
# SQUISH
|
||||||
|
FIND_LIBRARY(NVSQUISH_LIBRARY
|
||||||
|
NAMES squish
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
FIND_LIBRARY(NVSQUISH_LIBRARY_DEBUG
|
||||||
|
NAMES squish_d
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
|
||||||
|
# BC6H
|
||||||
|
FIND_LIBRARY(NVBC6H_LIBRARY
|
||||||
|
NAMES bc6h
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
FIND_LIBRARY(NVBC6H_LIBRARY_DEBUG
|
||||||
|
NAMES bc6h_d
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
|
||||||
|
# BC7
|
||||||
|
FIND_LIBRARY(NVBC7_LIBRARY
|
||||||
|
NAMES bc7
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
FIND_LIBRARY(NVBC7_LIBRARY_DEBUG
|
||||||
|
NAMES bc7_d
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,12 @@ INSTALL(
|
|||||||
ARCHIVE DESTINATION ${INSTALL_ARCHIVEDIR} COMPONENT libopenscenegraph-dev
|
ARCHIVE DESTINATION ${INSTALL_ARCHIVEDIR} COMPONENT libopenscenegraph-dev
|
||||||
)
|
)
|
||||||
|
|
||||||
|
IF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||||
|
GET_TARGET_PROPERTY(PREFIX ${LIB_NAME} PREFIX)
|
||||||
|
INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS RelWithDebInfo)
|
||||||
|
INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS Debug)
|
||||||
|
ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||||
|
|
||||||
IF(NOT OSG_COMPILE_FRAMEWORKS)
|
IF(NOT OSG_COMPILE_FRAMEWORKS)
|
||||||
INSTALL (
|
INSTALL (
|
||||||
FILES ${TARGET_H}
|
FILES ${TARGET_H}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#JPEG
|
#JPEG
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(JPEG_INCLUDE_DIR Android.mk
|
FIND_PATH(JPEG_INCLUDE_DIR Android.mk
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/libjpeg
|
${CMAKE_SOURCE_DIR}/3rdparty/libjpeg NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libjpeg")
|
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libjpeg")
|
||||||
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${JPEG_INCLUDE_DIR}/Android.mk \n")
|
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${JPEG_INCLUDE_DIR}/Android.mk \n")
|
||||||
@@ -82,7 +82,7 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#PNG
|
#PNG
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(PNG_INCLUDE_DIR Android.mk
|
FIND_PATH(PNG_INCLUDE_DIR Android.mk
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/libpng
|
${CMAKE_SOURCE_DIR}/3rdparty/libpng NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libpng")
|
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libpng")
|
||||||
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${PNG_INCLUDE_DIR}/Android.mk \n")
|
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${PNG_INCLUDE_DIR}/Android.mk \n")
|
||||||
@@ -97,7 +97,7 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#GIF
|
#GIF
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(GIFLIB_INCLUDE_DIR Android.mk
|
FIND_PATH(GIFLIB_INCLUDE_DIR Android.mk
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/giflib
|
${CMAKE_SOURCE_DIR}/3rdparty/giflib NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libgif")
|
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libgif")
|
||||||
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${GIFLIB_INCLUDE_DIR}/Android.mk \n")
|
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${GIFLIB_INCLUDE_DIR}/Android.mk \n")
|
||||||
@@ -112,7 +112,7 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#TIF
|
#TIF
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(TIFF_INCLUDE_DIR Android.mk
|
FIND_PATH(TIFF_INCLUDE_DIR Android.mk
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/libtiff
|
${CMAKE_SOURCE_DIR}/3rdparty/libtiff NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libtiff")
|
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libtiff")
|
||||||
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${TIFF_INCLUDE_DIR}/Android.mk \n")
|
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${TIFF_INCLUDE_DIR}/Android.mk \n")
|
||||||
@@ -142,7 +142,7 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#CURL
|
#CURL
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(CURL_DIR Android.mk
|
FIND_PATH(CURL_DIR Android.mk
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/curl
|
${CMAKE_SOURCE_DIR}/3rdparty/curl NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libcurl")
|
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libcurl")
|
||||||
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${CURL_DIR}/Android.mk \n")
|
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${CURL_DIR}/Android.mk \n")
|
||||||
@@ -159,11 +159,11 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#FREETYPE
|
#FREETYPE
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(FREETYPE_DIR Android.mk
|
FIND_PATH(FREETYPE_DIR Android.mk
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/freetype
|
${CMAKE_SOURCE_DIR}/3rdparty/freetype NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libft2")
|
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libft2")
|
||||||
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${FREETYPE_DIR}/Android.mk \n")
|
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${FREETYPE_DIR}/Android.mk \n")
|
||||||
set(FREETYPE_INCLUDE_DIRS "${FREETYPE_DIR}/include ${FREETYPE_DIR}/include/freetype/config")
|
set(FREETYPE_INCLUDE_DIRS ${FREETYPE_DIR}/include ${FREETYPE_DIR}/include/freetype/config)
|
||||||
if(FREETYPE_DIR)
|
if(FREETYPE_DIR)
|
||||||
message(STATUS "FREETYPE found ${FREETYPE_DIR}" )
|
message(STATUS "FREETYPE found ${FREETYPE_DIR}" )
|
||||||
set(FREETYPE_FOUND "Yes")
|
set(FREETYPE_FOUND "Yes")
|
||||||
@@ -175,7 +175,7 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#GDAL
|
#GDAL
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(GDAL_DIR gdal.h
|
FIND_PATH(GDAL_DIR gdal.h
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/gdal/include
|
${CMAKE_SOURCE_DIR}/3rdparty/gdal/include NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
set(GDAL_INCLUDE_DIR "${GDAL_DIR}")
|
set(GDAL_INCLUDE_DIR "${GDAL_DIR}")
|
||||||
if(GDAL_DIR)
|
if(GDAL_DIR)
|
||||||
|
|||||||
@@ -43,7 +43,11 @@ SET(VALID_BUILDER_VERSION OFF)
|
|||||||
MACRO(LINK_WITH_VARIABLES TRGTNAME)
|
MACRO(LINK_WITH_VARIABLES TRGTNAME)
|
||||||
FOREACH(varname ${ARGN})
|
FOREACH(varname ${ARGN})
|
||||||
IF(${varname}_DEBUG)
|
IF(${varname}_DEBUG)
|
||||||
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${${varname}}" debug "${${varname}_DEBUG}")
|
IF(${varname}_RELEASE)
|
||||||
|
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${${varname}_RELEASE}" debug "${${varname}_DEBUG}")
|
||||||
|
ELSE(${varname}_RELEASE)
|
||||||
|
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${${varname}}" debug "${${varname}_DEBUG}")
|
||||||
|
ENDIF(${varname}_RELEASE)
|
||||||
ELSE(${varname}_DEBUG)
|
ELSE(${varname}_DEBUG)
|
||||||
TARGET_LINK_LIBRARIES(${TRGTNAME} "${${varname}}" )
|
TARGET_LINK_LIBRARIES(${TRGTNAME} "${${varname}}" )
|
||||||
ENDIF(${varname}_DEBUG)
|
ENDIF(${varname}_DEBUG)
|
||||||
@@ -123,9 +127,9 @@ MACRO(SETUP_LINK_LIBRARIES)
|
|||||||
FOREACH(LINKLIB ${TARGET_ADDED_LIBRARIES})
|
FOREACH(LINKLIB ${TARGET_ADDED_LIBRARIES})
|
||||||
SET(TO_INSERT TRUE)
|
SET(TO_INSERT TRUE)
|
||||||
FOREACH (value ${TARGET_COMMON_LIBRARIES})
|
FOREACH (value ${TARGET_COMMON_LIBRARIES})
|
||||||
IF (${value} STREQUAL ${LINKLIB})
|
IF ("${value}" STREQUAL "${LINKLIB}")
|
||||||
SET(TO_INSERT FALSE)
|
SET(TO_INSERT FALSE)
|
||||||
ENDIF (${value} STREQUAL ${LINKLIB})
|
ENDIF ("${value}" STREQUAL "${LINKLIB}")
|
||||||
ENDFOREACH (value ${TARGET_COMMON_LIBRARIES})
|
ENDFOREACH (value ${TARGET_COMMON_LIBRARIES})
|
||||||
IF(TO_INSERT)
|
IF(TO_INSERT)
|
||||||
LIST(APPEND TARGET_LIBRARIES ${LINKLIB})
|
LIST(APPEND TARGET_LIBRARIES ${LINKLIB})
|
||||||
@@ -326,6 +330,10 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
|||||||
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
|
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
|
||||||
ARCHIVE DESTINATION lib/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
|
ARCHIVE DESTINATION lib/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
|
||||||
LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
|
LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
|
||||||
|
IF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||||
|
INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS RelWithDebInfo)
|
||||||
|
INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS Debug)
|
||||||
|
ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||||
ELSE(WIN32)
|
ELSE(WIN32)
|
||||||
INSTALL(TARGETS ${TARGET_TARGETNAME}
|
INSTALL(TARGETS ${TARGET_TARGETNAME}
|
||||||
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
|
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
|
||||||
@@ -428,6 +436,10 @@ MACRO(SETUP_APPLICATION APPLICATION_NAME)
|
|||||||
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin BUNDLE DESTINATION bin)
|
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin BUNDLE DESTINATION bin)
|
||||||
ELSE(APPLE)
|
ELSE(APPLE)
|
||||||
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin COMPONENT openscenegraph )
|
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin COMPONENT openscenegraph )
|
||||||
|
IF(MSVC)
|
||||||
|
INSTALL(FILES ${CMAKE_BINARY_DIR}/bin/${TARGET_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION bin COMPONENT openscenegraph CONFIGURATIONS RelWithDebInfo)
|
||||||
|
INSTALL(FILES ${CMAKE_BINARY_DIR}/bin/${TARGET_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION bin COMPONENT openscenegraph CONFIGURATIONS Debug)
|
||||||
|
ENDIF(MSVC)
|
||||||
ENDIF(APPLE)
|
ENDIF(APPLE)
|
||||||
|
|
||||||
ENDMACRO(SETUP_APPLICATION)
|
ENDMACRO(SETUP_APPLICATION)
|
||||||
@@ -457,6 +469,10 @@ MACRO(SETUP_EXAMPLE EXAMPLE_NAME)
|
|||||||
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin BUNDLE DESTINATION share/OpenSceneGraph/bin )
|
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin BUNDLE DESTINATION share/OpenSceneGraph/bin )
|
||||||
ELSE(APPLE)
|
ELSE(APPLE)
|
||||||
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples )
|
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples )
|
||||||
|
IF(MSVC)
|
||||||
|
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_TARGETNAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples CONFIGURATIONS RelWithDebInfo)
|
||||||
|
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_TARGETNAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples CONFIGURATIONS Debug)
|
||||||
|
ENDIF(MSVC)
|
||||||
ENDIF(APPLE)
|
ENDIF(APPLE)
|
||||||
|
|
||||||
ENDMACRO(SETUP_EXAMPLE)
|
ENDMACRO(SETUP_EXAMPLE)
|
||||||
|
|||||||
71
NEWS.txt
71
NEWS.txt
@@ -1,6 +1,77 @@
|
|||||||
OSG News
|
OSG News
|
||||||
========
|
========
|
||||||
|
|
||||||
|
OpenSceneGraph 3.4.1 release is maintaince release that provide build/runtime improvements and better GLES support
|
||||||
|
PERTHSHIRE, Scotland - 28th August 2017 - OpenSceneGraph Professional Services announces the release of OpenSceneGraph 3.4.1, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. OpenSceneGraph 3.4 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. OpenSceneGraph 3.4 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
|
||||||
|
Updates include:
|
||||||
|
|
||||||
|
* Improves to GLES support across platforms
|
||||||
|
* Full support for osgText and on screen stats across all platfroms, including GLES2 and core pofile
|
||||||
|
* Build fixes to allow compilation against recent 3rd party depdendency changes
|
||||||
|
* Range of runtime 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 Downloads section of the openscenegraph.org website.
|
||||||
|
|
||||||
|
OpenSceneGraph is released under the OpenSceneGraph Public License, which is based on the Lesser GNU Public License (LGPL), permitting the software to be used free of charge across the full spectrum of commercial and open-source applications. Furthermore, it allows both static and dynamic linking of the OpenSceneGraph libraries without restricting the licensing of the user's software.
|
||||||
|
Professional support and services
|
||||||
|
|
||||||
|
OpenSceneGraph project is backed up with professional services by OpenSceneGraph Professional Services, based in Scotland, and a range of Contractors from around the world. Services available include:
|
||||||
|
|
||||||
|
Confidential Professional Support
|
||||||
|
Bespoke development
|
||||||
|
Consultancy
|
||||||
|
Training
|
||||||
|
|
||||||
|
Community support and contributions:
|
||||||
|
|
||||||
|
The diverse and growing community of over 5000 developers is centred around the public osg-users mailing list/forum, where members discuss how best to use OpenSceneGraph, provide mutual support, and coordinate development of new features and bug fixes. Members of this community come from many different countries with backgrounds ranging from some of the world's largest aerospace companies, game companies, and visual simulation specialists to university researchers, students and hobbyists.
|
||||||
|
|
||||||
|
The OpenSceneGraph project owes a great deal to the community for its development and support, in particular we wish to thank the 562 individuals from around the world that have directly contributed to the development and refinement of the OpenSceneGraph code base.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
OpenSceneGraph 3.4 release introduces shader composition, new osgUI library, displacement mapping, volume rendering, lua scripting support and much more
|
||||||
|
PERTHSHIRE, Scotland - 12th August 2015 - OpenSceneGraph Professional Services announces the release of OpenSceneGraph 3.4, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. OpenSceneGraph 3.4 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. OpenSceneGraph 3.4 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
|
||||||
|
Updates include:
|
||||||
|
|
||||||
|
* New #pragma(tic) composition shader functionality built into the core OSG that provides a easy to use yet flexible scheme for controlling and composing shaders at runtime levering GLSL support for #define and #pragma.
|
||||||
|
* New osgTerrain::DisplacementMappingTechnique to uses vertex, geometry and fragment shader based displacement mapping technique that dramatically lowers the CPU and GPU memory footprint and bandwidth needs for the same visual quality. The new scheme enables paged terrain that work robustly on smaller hardware, or with far higher loads without framedrops. This new technique levels #pragma(tic) shader composition to enable one to toggle on/off features in the shaders at runtime in a way that is as convenient to use as toggle modes in a fixed function pipeline scene graph.
|
||||||
|
* New osgVolume::MultipassTechique that uses multipass rendering and shaders to enable seamless mixing of traditional 3D geometry and volumes, support for geometry hulls that constrain where the volume should be rendered as well as improving the ray tracing shaders so that they are both faster and have higher visual quality than the previous generation of ray traced shaders supported by OSG-3.2 releases and before.
|
||||||
|
* New osgDB::Classiterface class that provides an easy to use mechanism for introspection of scene graph classes, allowing one to get, set properties and invoke methods in a generic way, making the task of integrating 3rd prarty tools such as scripting languages straight forward.
|
||||||
|
* New Lua scripting support via a plugin that integrates Lua 5.2.3 and the OSG via the OSG's native serialization codes.
|
||||||
|
* New osgUI NodeKit, that enables User Interface elements to be placed directly into 3D scene graph. The classes are fully scriptable so you create create UI and behaviours all within lua scripts.
|
||||||
|
* Improvements to OpenGL ES 1.1, ES 2.0 and ES3.0 support, including platform specific extensions
|
||||||
|
* Improvements to OpenGL 4.x support with a range of new extensions support
|
||||||
|
* Updates to osgQt to support Qt5 and provide better support for Qt4
|
||||||
|
|
||||||
|
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 Downloads section of the openscenegraph.org website.
|
||||||
|
|
||||||
|
OpenSceneGraph is released under the OpenSceneGraph Public License, which is based on the Lesser GNU Public License (LGPL), permitting the software to be used free of charge across the full spectrum of commercial and open-source applications. Furthermore, it allows both static and dynamic linking of the OpenSceneGraph libraries without restricting the licensing of the user's software.
|
||||||
|
Professional support and services
|
||||||
|
|
||||||
|
OpenSceneGraph project is backed up with professional services by OpenSceneGraph Professional Services, based in Scotland, and a range of Contractors from around the world. Services available include:
|
||||||
|
|
||||||
|
Confidential Professional Support
|
||||||
|
Bespoke development
|
||||||
|
Consultancy
|
||||||
|
Training
|
||||||
|
|
||||||
|
Community support and contributions:
|
||||||
|
|
||||||
|
The diverse and growing community of over 5000 developers is centred around the public osg-users mailing list/forum, where members discuss how best to use OpenSceneGraph, provide mutual support, and coordinate development of new features and bug fixes. Members of this community come from many different countries with backgrounds ranging from some of the world's largest aerospace companies, game companies, and visual simulation specialists to university researchers, students and hobbyists.
|
||||||
|
|
||||||
|
The OpenSceneGraph project owes a great deal to the community for its development and support, in particular we wish to thank the 550 individuals from around the world that have directly contributed to the development and refinement of the OpenSceneGraph code base.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
= !OpenSceneGraph 3.2 release improves support iOS and Android, supports a range of new OpenGL features much more.
|
= !OpenSceneGraph 3.2 release improves support iOS and Android, supports a range of new OpenGL features much more.
|
||||||
|
|
||||||
PERTHSHIRE, Scotland - 24th July 2013 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 3.2, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 3.2 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. !OpenSceneGraph 3.2 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
|
PERTHSHIRE, Scotland - 24th July 2013 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 3.2, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 3.2 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. !OpenSceneGraph 3.2 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ more indepth instructions.
|
|||||||
|
|
||||||
Robert Osfield.
|
Robert Osfield.
|
||||||
Project Lead.
|
Project Lead.
|
||||||
3rd July 2015.
|
28th August 2017.
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This application is open source and may be redistributed and/or modified
|
* This application is open source and may be redistributed and/or modified
|
||||||
* freely and without restriction, both in commercial and non commercial applications,
|
* freely and without restriction, both in commercial and non commercial applications,
|
||||||
* as long as this copyright notice is maintained.
|
* as long as this copyright notice is maintained.
|
||||||
*
|
*
|
||||||
* This application is distributed in the hope that it will be useful,
|
* This application is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
@@ -26,12 +26,12 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an application for collecting a set of separate files into a single archive file that can be later read in OSG applications..");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an application for collecting a set of separate files into a single archive file that can be later read in OSG applications..");
|
||||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
||||||
|
|
||||||
// if user request help write it out to cout.
|
// if user request help write it out to cout.
|
||||||
if (arguments.read("-h") || arguments.read("--help"))
|
if (arguments.read("-h") || arguments.read("--help"))
|
||||||
{
|
{
|
||||||
@@ -49,14 +49,14 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
insert = true;
|
insert = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool extract = false;
|
bool extract = false;
|
||||||
while (arguments.read("-e") || arguments.read("--extract"))
|
while (arguments.read("-e") || arguments.read("--extract"))
|
||||||
{
|
{
|
||||||
extract = true;
|
extract = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool list = false;
|
bool list = false;
|
||||||
while (arguments.read("-l") || arguments.read("--list"))
|
while (arguments.read("-l") || arguments.read("--list"))
|
||||||
{
|
{
|
||||||
list = true;
|
list = true;
|
||||||
@@ -93,7 +93,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// any option left unread are converted into errors to write out later.
|
// any option left unread are converted into errors to write out later.
|
||||||
arguments.reportRemainingOptionsAsUnrecognized();
|
arguments.reportRemainingOptionsAsUnrecognized();
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ int main( int argc, char **argv )
|
|||||||
arguments.writeErrorMessages(std::cout);
|
arguments.writeErrorMessages(std::cout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (archiveFilename.empty())
|
if (archiveFilename.empty())
|
||||||
{
|
{
|
||||||
std::cout<<"Please specify an archive name using --archive filename"<<std::endl;
|
std::cout<<"Please specify an archive name using --archive filename"<<std::endl;
|
||||||
@@ -115,7 +115,7 @@ int main( int argc, char **argv )
|
|||||||
std::cout<<"Please specify an operation on the archive, either --insert, --extract or --list"<<std::endl;
|
std::cout<<"Please specify an operation on the archive, either --insert, --extract or --list"<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (insert && extract)
|
if (insert && extract)
|
||||||
{
|
{
|
||||||
std::cout<<"Cannot insert and extract files from the archive at one time, please use either --insert or --extract."<<std::endl;
|
std::cout<<"Cannot insert and extract files from the archive at one time, please use either --insert or --extract."<<std::endl;
|
||||||
@@ -127,7 +127,7 @@ int main( int argc, char **argv )
|
|||||||
if (insert)
|
if (insert)
|
||||||
{
|
{
|
||||||
archive = osgDB::openArchive(archiveFilename, osgDB::Archive::WRITE);
|
archive = osgDB::openArchive(archiveFilename, osgDB::Archive::WRITE);
|
||||||
|
|
||||||
if (archive.valid())
|
if (archive.valid())
|
||||||
{
|
{
|
||||||
for (FileNameList::iterator itr=files.begin();
|
for (FileNameList::iterator itr=files.begin();
|
||||||
@@ -135,7 +135,7 @@ int main( int argc, char **argv )
|
|||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
std::cout<<"reading "<<*itr<<std::endl;
|
std::cout<<"reading "<<*itr<<std::endl;
|
||||||
osg::ref_ptr<osg::Object> obj = osgDB::readObjectFile(*itr);
|
osg::ref_ptr<osg::Object> obj = osgDB::readRefObjectFile(*itr);
|
||||||
if (obj.valid())
|
if (obj.valid())
|
||||||
{
|
{
|
||||||
std::cout<<" write to archive "<<*itr<<std::endl;
|
std::cout<<" write to archive "<<*itr<<std::endl;
|
||||||
@@ -152,10 +152,10 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
archive = osgDB::openArchive(archiveFilename, osgDB::Archive::READ);
|
archive = osgDB::openArchive(archiveFilename, osgDB::Archive::READ);
|
||||||
|
|
||||||
if (extract && archive.valid())
|
if (extract && archive.valid())
|
||||||
{
|
{
|
||||||
for (FileNameList::iterator itr=files.begin();
|
for (FileNameList::iterator itr=files.begin();
|
||||||
@@ -175,7 +175,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (list && archive.valid())
|
if (list && archive.valid())
|
||||||
{
|
{
|
||||||
std::cout<<"List of files in archive:"<<std::endl;
|
std::cout<<"List of files in archive:"<<std::endl;
|
||||||
osgDB::Archive::FileNameList fileNames;
|
osgDB::Archive::FileNameList fileNames;
|
||||||
if (archive->getFileNames(fileNames))
|
if (archive->getFileNames(fileNames))
|
||||||
@@ -187,11 +187,11 @@ int main( int argc, char **argv )
|
|||||||
std::cout<<" "<<*itr<<std::endl;
|
std::cout<<" "<<*itr<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout<<std::endl;
|
std::cout<<std::endl;
|
||||||
std::cout<<"Master file "<<archive->getMasterFileName()<<std::endl;
|
std::cout<<"Master file "<<archive->getMasterFileName()<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::State> state = new osg::State;
|
osg::ref_ptr<osg::State> state = new osg::State;
|
||||||
|
state->initializeExtensionProcs();
|
||||||
|
|
||||||
for(TextureSet::iterator itr=_textureSet.begin();
|
for(TextureSet::iterator itr=_textureSet.begin();
|
||||||
itr!=_textureSet.end();
|
itr!=_textureSet.end();
|
||||||
@@ -771,7 +772,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
osg::Timer_t startTick = osg::Timer::instance()->tick();
|
osg::Timer_t startTick = osg::Timer::instance()->tick();
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> root = osgDB::readNodeFiles(fileNames);
|
osg::ref_ptr<osg::Node> root = osgDB::readRefNodeFiles(fileNames);
|
||||||
|
|
||||||
if (root.valid())
|
if (root.valid())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This application is open source and may be redistributed and/or modified
|
* This application is open source and may be redistributed and/or modified
|
||||||
* freely and without restriction, both in commercial and non commercial applications,
|
* freely and without restriction, both in commercial and non commercial applications,
|
||||||
* as long as this copyright notice is maintained.
|
* as long as this copyright notice is maintained.
|
||||||
*
|
*
|
||||||
* This application is distributed in the hope that it will be useful,
|
* This application is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
@@ -46,20 +46,20 @@ struct Extents
|
|||||||
_maxLevel(maxLevel),
|
_maxLevel(maxLevel),
|
||||||
_min(minX, minY),
|
_min(minX, minY),
|
||||||
_max(maxX, maxY) {}
|
_max(maxX, maxY) {}
|
||||||
|
|
||||||
Extents(const Extents& extents):
|
Extents(const Extents& extents):
|
||||||
_maxLevel(extents._maxLevel),
|
_maxLevel(extents._maxLevel),
|
||||||
_min(extents._min),
|
_min(extents._min),
|
||||||
_max(extents._max) {}
|
_max(extents._max) {}
|
||||||
|
|
||||||
Extents& operator = (const Extents& rhs)
|
Extents& operator = (const Extents& rhs)
|
||||||
{
|
{
|
||||||
if (&rhs == this) return *this;
|
if (&rhs == this) return *this;
|
||||||
|
|
||||||
_maxLevel = rhs._maxLevel;
|
_maxLevel = rhs._maxLevel;
|
||||||
_min = rhs._min;
|
_min = rhs._min;
|
||||||
_max = rhs._max;
|
_max = rhs._max;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,10 +69,10 @@ struct Extents
|
|||||||
osg::notify(osg::INFO)<<" _maxLevel="<<_maxLevel<<", _min="<<_min<<" _max="<<_max<<std::endl;
|
osg::notify(osg::INFO)<<" _maxLevel="<<_maxLevel<<", _min="<<_min<<" _max="<<_max<<std::endl;
|
||||||
|
|
||||||
if (level>_maxLevel) return false;
|
if (level>_maxLevel) return false;
|
||||||
|
|
||||||
osg::Vec2d union_min, union_max;
|
osg::Vec2d union_min, union_max;
|
||||||
|
|
||||||
// handle mins
|
// handle mins
|
||||||
if (_min.x()!=DBL_MAX && in_min.x()!=DBL_MAX)
|
if (_min.x()!=DBL_MAX && in_min.x()!=DBL_MAX)
|
||||||
{
|
{
|
||||||
// both _min.x() and in_min.x() are defined so use max of two
|
// both _min.x() and in_min.x() are defined so use max of two
|
||||||
@@ -95,7 +95,7 @@ struct Extents
|
|||||||
union_min.y() = _min.y()<in_min.y() ? _min.y() : in_min.y();
|
union_min.y() = _min.y()<in_min.y() ? _min.y() : in_min.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle maxs
|
// handle maxs
|
||||||
if (_max.x()!=-DBL_MAX && in_max.x()!=-DBL_MAX)
|
if (_max.x()!=-DBL_MAX && in_max.x()!=-DBL_MAX)
|
||||||
{
|
{
|
||||||
// both _max.x() and in_max.x() are defined so use max of two
|
// both _max.x() and in_max.x() are defined so use max of two
|
||||||
@@ -121,7 +121,7 @@ struct Extents
|
|||||||
bool result = union_min.x()<union_max.x() && union_min.y()<union_max.y() ;
|
bool result = union_min.x()<union_max.x() && union_min.y()<union_max.y() ;
|
||||||
|
|
||||||
osg::notify(osg::INFO)<<" union_min="<<union_min<<" union_max="<<union_max<<" result = "<<result<<std::endl;
|
osg::notify(osg::INFO)<<" union_min="<<union_min<<" union_max="<<union_max<<" result = "<<result<<std::endl;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ public:
|
|||||||
_currentLevel(0) {}
|
_currentLevel(0) {}
|
||||||
|
|
||||||
void setFileCache(osgDB::FileCache* fileCache) { _fileCache = fileCache; }
|
void setFileCache(osgDB::FileCache* fileCache) { _fileCache = fileCache; }
|
||||||
|
|
||||||
void addExtents(unsigned int maxLevel, double minX, double minY, double maxX, double maxY)
|
void addExtents(unsigned int maxLevel, double minX, double minY, double maxX, double maxY)
|
||||||
{
|
{
|
||||||
_extentsList.push_back(Extents(maxLevel, minX, minY, maxX, maxY));
|
_extentsList.push_back(Extents(maxLevel, minX, minY, maxX, maxY));
|
||||||
@@ -154,16 +154,16 @@ public:
|
|||||||
void apply(osg::CoordinateSystemNode& cs)
|
void apply(osg::CoordinateSystemNode& cs)
|
||||||
{
|
{
|
||||||
_csnStack.push_back(&cs);
|
_csnStack.push_back(&cs);
|
||||||
|
|
||||||
if (!s_ExitApplication) traverse(cs);
|
if (!s_ExitApplication) traverse(cs);
|
||||||
|
|
||||||
_csnStack.pop_back();
|
_csnStack.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply(osg::Group& group)
|
void apply(osg::Group& group)
|
||||||
{
|
{
|
||||||
if (s_ExitApplication) return;
|
if (s_ExitApplication) return;
|
||||||
|
|
||||||
osgTerrain::TerrainTile* terrainTile = dynamic_cast<osgTerrain::TerrainTile*>(&group);
|
osgTerrain::TerrainTile* terrainTile = dynamic_cast<osgTerrain::TerrainTile*>(&group);
|
||||||
osgTerrain::Locator* locator = terrainTile ? terrainTile->getLocator() : 0;
|
osgTerrain::Locator* locator = terrainTile ? terrainTile->getLocator() : 0;
|
||||||
if (locator)
|
if (locator)
|
||||||
@@ -196,7 +196,7 @@ public:
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
traverse(group);
|
traverse(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,11 +217,11 @@ public:
|
|||||||
void apply(osg::PagedLOD& plod)
|
void apply(osg::PagedLOD& plod)
|
||||||
{
|
{
|
||||||
if (s_ExitApplication) return;
|
if (s_ExitApplication) return;
|
||||||
|
|
||||||
++_currentLevel;
|
++_currentLevel;
|
||||||
|
|
||||||
initBound();
|
initBound();
|
||||||
|
|
||||||
// first compute the bounds of this subgraph
|
// first compute the bounds of this subgraph
|
||||||
for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
|
for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
|
||||||
{
|
{
|
||||||
@@ -230,7 +230,7 @@ public:
|
|||||||
traverse(plod);
|
traverse(plod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intersects())
|
if (intersects())
|
||||||
{
|
{
|
||||||
for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
|
for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
|
||||||
@@ -239,7 +239,7 @@ public:
|
|||||||
if (!plod.getFileName(i).empty())
|
if (!plod.getFileName(i).empty())
|
||||||
{
|
{
|
||||||
std::string filename;
|
std::string filename;
|
||||||
if (!plod.getDatabasePath().empty())
|
if (!plod.getDatabasePath().empty())
|
||||||
{
|
{
|
||||||
filename = plod.getDatabasePath() + plod.getFileName(i);
|
filename = plod.getDatabasePath() + plod.getFileName(i);
|
||||||
}
|
}
|
||||||
@@ -255,10 +255,10 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
--_currentLevel;
|
--_currentLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply(osg::Geode& geode)
|
void apply(osg::Geode& geode)
|
||||||
{
|
{
|
||||||
for(unsigned int i=0; i<geode.getNumDrawables(); ++i)
|
for(unsigned int i=0; i<geode.getNumDrawables(); ++i)
|
||||||
@@ -271,10 +271,10 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node* readNodeFileAndWriteToCache(const std::string& filename)
|
osg::ref_ptr<osg::Node> readNodeFileAndWriteToCache(const std::string& filename)
|
||||||
{
|
{
|
||||||
osg::Node* node = 0;
|
osg::ref_ptr<osg::Node> node = 0;
|
||||||
if (_fileCache.valid() )
|
if (_fileCache.valid() )
|
||||||
{
|
{
|
||||||
if (_fileCache->existsInCache(filename))
|
if (_fileCache->existsInCache(filename))
|
||||||
@@ -286,7 +286,7 @@ public:
|
|||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
|
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
|
||||||
|
|
||||||
node = osgDB::readNodeFile(filename);
|
node = osgDB::readRefNodeFile(filename);
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"write to FileCache : "<<filename<<std::endl;
|
osg::notify(osg::NOTICE)<<"write to FileCache : "<<filename<<std::endl;
|
||||||
@@ -298,7 +298,7 @@ public:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
|
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
|
||||||
node = osgDB::readNodeFile(filename);
|
node = osgDB::readRefNodeFile(filename);
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
@@ -307,18 +307,18 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
inline void pushMatrix(osg::Matrix& matrix) { _matrixStack.push_back(matrix); }
|
inline void pushMatrix(osg::Matrix& matrix) { _matrixStack.push_back(matrix); }
|
||||||
|
|
||||||
inline void popMatrix() { _matrixStack.pop_back(); }
|
inline void popMatrix() { _matrixStack.pop_back(); }
|
||||||
|
|
||||||
void convertXYZToLatLongHeight(osg::EllipsoidModel* em, osg::Vec3d& v)
|
void convertXYZToLatLongHeight(osg::EllipsoidModel* em, osg::Vec3d& v)
|
||||||
{
|
{
|
||||||
em->convertXYZToLatLongHeight(v.x(), v.y(), v.z(),
|
em->convertXYZToLatLongHeight(v.x(), v.y(), v.z(),
|
||||||
v.y(), v.x(), v.z());
|
v.y(), v.x(), v.z());
|
||||||
|
|
||||||
v.x() = osg::RadiansToDegrees(v.x());
|
v.x() = osg::RadiansToDegrees(v.x());
|
||||||
v.y() = osg::RadiansToDegrees(v.y());
|
v.y() = osg::RadiansToDegrees(v.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBound()
|
void initBound()
|
||||||
{
|
{
|
||||||
_min.set(DBL_MAX, DBL_MAX);
|
_min.set(DBL_MAX, DBL_MAX);
|
||||||
@@ -332,16 +332,16 @@ protected:
|
|||||||
if (v.x() > _max.x()) _max.x() = v.x();
|
if (v.x() > _max.x()) _max.x() = v.x();
|
||||||
if (v.y() > _max.y()) _max.y() = v.y();
|
if (v.y() > _max.y()) _max.y() = v.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateBound(osg::Vec3Array& vertices)
|
void updateBound(osg::Vec3Array& vertices)
|
||||||
{
|
{
|
||||||
// set up matrix
|
// set up matrix
|
||||||
osg::Matrix matrix;
|
osg::Matrix matrix;
|
||||||
if (!_matrixStack.empty()) matrix = _matrixStack.back();
|
if (!_matrixStack.empty()) matrix = _matrixStack.back();
|
||||||
|
|
||||||
// set up ellipsoid model
|
// set up ellipsoid model
|
||||||
osg::EllipsoidModel* em = !_csnStack.empty() ? _csnStack.back()->getEllipsoidModel() : 0;
|
osg::EllipsoidModel* em = !_csnStack.empty() ? _csnStack.back()->getEllipsoidModel() : 0;
|
||||||
|
|
||||||
for(osg::Vec3Array::iterator itr = vertices.begin();
|
for(osg::Vec3Array::iterator itr = vertices.begin();
|
||||||
itr != vertices.end();
|
itr != vertices.end();
|
||||||
++itr)
|
++itr)
|
||||||
@@ -352,7 +352,7 @@ protected:
|
|||||||
updateBound(v);
|
updateBound(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool intersects()
|
bool intersects()
|
||||||
{
|
{
|
||||||
osg::notify(osg::INFO)<<"intersects() _min = "<<_min<<" _max = "<<_max<<std::endl;
|
osg::notify(osg::INFO)<<"intersects() _min = "<<_min<<" _max = "<<_max<<std::endl;
|
||||||
@@ -362,7 +362,7 @@ protected:
|
|||||||
{
|
{
|
||||||
if (itr->intersects(_currentLevel, _min, _max)) return true;
|
if (itr->intersects(_currentLevel, _min, _max)) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ protected:
|
|||||||
unsigned int _currentLevel;
|
unsigned int _currentLevel;
|
||||||
MatrixStack _matrixStack;
|
MatrixStack _matrixStack;
|
||||||
CSNStack _csnStack;
|
CSNStack _csnStack;
|
||||||
|
|
||||||
osg::Vec2d _min;
|
osg::Vec2d _min;
|
||||||
osg::Vec2d _max;
|
osg::Vec2d _max;
|
||||||
};
|
};
|
||||||
@@ -403,7 +403,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an application for collecting a set of separate files into a single archive file that can be later read in OSG applications..");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an application for collecting a set of separate files into a single archive file that can be later read in OSG applications..");
|
||||||
@@ -412,21 +412,21 @@ int main( int argc, char **argv )
|
|||||||
arguments.getApplicationUsage()->addCommandLineOption("-e level minX minY maxX maxY","Read down to <level> across the extents minX, minY to maxY, maxY. Note, for geocentric datase X and Y are longitude and latitude respectively.");
|
arguments.getApplicationUsage()->addCommandLineOption("-e level minX minY maxX maxY","Read down to <level> across the extents minX, minY to maxY, maxY. Note, for geocentric datase X and Y are longitude and latitude respectively.");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-c directory","Shorthand for --file-cache directory.");
|
arguments.getApplicationUsage()->addCommandLineOption("-c directory","Shorthand for --file-cache directory.");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--file-cache directory","Set directory as to place cache download files.");
|
arguments.getApplicationUsage()->addCommandLineOption("--file-cache directory","Set directory as to place cache download files.");
|
||||||
|
|
||||||
// if user request help write it out to cout.
|
// if user request help write it out to cout.
|
||||||
if (arguments.read("-h") || arguments.read("--help"))
|
if (arguments.read("-h") || arguments.read("--help"))
|
||||||
{
|
{
|
||||||
arguments.getApplicationUsage()->write(std::cout);
|
arguments.getApplicationUsage()->write(std::cout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadDataVisitor ldv;
|
LoadDataVisitor ldv;
|
||||||
|
|
||||||
std::string fileCachePath;
|
std::string fileCachePath;
|
||||||
while(arguments.read("--file-cache",fileCachePath) || arguments.read("-c",fileCachePath)) {}
|
while(arguments.read("--file-cache",fileCachePath) || arguments.read("-c",fileCachePath)) {}
|
||||||
|
|
||||||
if (fileCachePath.empty())
|
if (fileCachePath.empty())
|
||||||
{
|
{
|
||||||
const char* env_fileCachePath = getenv("OSG_FILE_CACHE");
|
const char* env_fileCachePath = getenv("OSG_FILE_CACHE");
|
||||||
if (env_fileCachePath)
|
if (env_fileCachePath)
|
||||||
{
|
{
|
||||||
@@ -439,7 +439,7 @@ int main( int argc, char **argv )
|
|||||||
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;
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ldv.setFileCache(new osgDB::FileCache(fileCachePath));
|
ldv.setFileCache(new osgDB::FileCache(fileCachePath));
|
||||||
|
|
||||||
unsigned int maxLevels = 0;
|
unsigned int maxLevels = 0;
|
||||||
@@ -447,14 +447,14 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
ldv.addExtents(maxLevels);
|
ldv.addExtents(maxLevels);
|
||||||
}
|
}
|
||||||
|
|
||||||
double minX, maxX, minY, maxY;
|
double minX, maxX, minY, maxY;
|
||||||
while(arguments.read("-e",maxLevels, minX, minY, maxX, maxY))
|
while(arguments.read("-e",maxLevels, minX, minY, maxX, maxY))
|
||||||
{
|
{
|
||||||
ldv.addExtents(maxLevels, minX, minY, maxX, maxY);
|
ldv.addExtents(maxLevels, minX, minY, maxX, maxY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string filename;
|
std::string filename;
|
||||||
for(int i=1; i<arguments.argc(); ++i)
|
for(int i=1; i<arguments.argc(); ++i)
|
||||||
{
|
{
|
||||||
@@ -464,21 +464,21 @@ int main( int argc, char **argv )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filename.empty())
|
if (filename.empty())
|
||||||
{
|
{
|
||||||
std::cout<<"No file to load specified."<<std::endl;
|
std::cout<<"No file to load specified."<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> loadedModel = ldv.readNodeFileAndWriteToCache(filename);
|
osg::ref_ptr<osg::Node> loadedModel = ldv.readNodeFileAndWriteToCache(filename);
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout<<"No data loaded, please specify a database to load"<<std::endl;
|
std::cout<<"No data loaded, please specify a database to load"<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
loadedModel->accept(ldv);
|
loadedModel->accept(ldv);
|
||||||
|
|
||||||
if (s_ExitApplication)
|
if (s_ExitApplication)
|
||||||
|
|||||||
@@ -260,7 +260,22 @@ const char* invalidNames[] =
|
|||||||
"PushStackValueVisitor",
|
"PushStackValueVisitor",
|
||||||
"RayIntersector",
|
"RayIntersector",
|
||||||
"OpenSceneGraph-Data",
|
"OpenSceneGraph-Data",
|
||||||
"Node"
|
"Node",
|
||||||
|
"AlphaFunc",
|
||||||
|
"CompositeViewer",
|
||||||
|
"OpenSceneGraph-3",
|
||||||
|
"DisplaySettings::SHADER_NONE",
|
||||||
|
"CodeDocs",
|
||||||
|
"Mon",
|
||||||
|
"Tue",
|
||||||
|
"Wed",
|
||||||
|
"Fri",
|
||||||
|
"Sat",
|
||||||
|
"Sun",
|
||||||
|
"I",
|
||||||
|
"TriangleFunctor",
|
||||||
|
"PrimitiveFunctor",
|
||||||
|
"OpenMW"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -483,7 +498,9 @@ TypoCorrection typoCorrections[] =
|
|||||||
{"Janik", "Jannik"},
|
{"Janik", "Jannik"},
|
||||||
{"Viganò", "Vigan<EFBFBD>"},
|
{"Viganò", "Vigan<EFBFBD>"},
|
||||||
{"Vigano", "Vigan<EFBFBD>"},
|
{"Vigano", "Vigan<EFBFBD>"},
|
||||||
{"Frashud", "Farshid"}
|
{"Frashud", "Farshid"},
|
||||||
|
{"Dannahauer","Dannahauer"},
|
||||||
|
{"Sando","Sandro"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -497,6 +514,16 @@ struct NameCorrection
|
|||||||
|
|
||||||
NameCorrection nameCorrections[] =
|
NameCorrection nameCorrections[] =
|
||||||
{
|
{
|
||||||
|
{"LaurensVoerman","Meta_Shape",
|
||||||
|
"Laurens", "Voerman"},
|
||||||
|
{"LaurensVoerman","OpenCascade",
|
||||||
|
"Laurens", "Voerman"},
|
||||||
|
{"LaurensVoerman","Fri",
|
||||||
|
"Laurens", "Voerman"},
|
||||||
|
{"LaurensVoerman","",
|
||||||
|
"Laurens", "Voerman"},
|
||||||
|
{"Laurens","Loerman",
|
||||||
|
"Laurens", "Voerman"},
|
||||||
{"FrancoisTigeot","",
|
{"FrancoisTigeot","",
|
||||||
"Francois", "Tigeot"},
|
"Francois", "Tigeot"},
|
||||||
{"Juan","Manuel",
|
{"Juan","Manuel",
|
||||||
|
|||||||
@@ -87,10 +87,10 @@ int main(int argc, char** argv)
|
|||||||
std::string device;
|
std::string device;
|
||||||
while(arguments.read("--device", device))
|
while(arguments.read("--device", device))
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device);
|
osg::ref_ptr<osgGA::Device> dev = osgDB::readRefFile<osgGA::Device>(device);
|
||||||
if (dev.valid())
|
if (dev.valid())
|
||||||
{
|
{
|
||||||
viewer.addDevice(dev.get());
|
viewer.addDevice(dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ int main(int argc, char** argv)
|
|||||||
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
|
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
|
||||||
|
|
||||||
// load the data
|
// load the data
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
@@ -172,9 +172,9 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
// optimize the scene graph, remove redundant nodes and state etc.
|
// optimize the scene graph, remove redundant nodes and state etc.
|
||||||
osgUtil::Optimizer optimizer;
|
osgUtil::Optimizer optimizer;
|
||||||
optimizer.optimize(loadedModel.get());
|
optimizer.optimize(loadedModel);
|
||||||
|
|
||||||
viewer.setSceneData( loadedModel.get() );
|
viewer.setSceneData(loadedModel);
|
||||||
|
|
||||||
viewer.realize();
|
viewer.realize();
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#if defined(__linux)
|
#if defined(__linux)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <linux/sockios.h>
|
#include <linux/sockios.h>
|
||||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
#elif defined(__sgi)
|
#elif defined(__sgi)
|
||||||
@@ -41,6 +41,8 @@
|
|||||||
#include <net/soioctl.h>
|
#include <net/soioctl.h>
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#elif defined (__GNU__)
|
||||||
|
#include <unistd.h>
|
||||||
#elif defined(__sun)
|
#elif defined(__sun)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
@@ -338,7 +340,7 @@ void Receiver::sync( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \
|
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \
|
||||||
defined(__DragonFly__)
|
defined(__DragonFly__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
|
||||||
socklen_t
|
socklen_t
|
||||||
#else
|
#else
|
||||||
int
|
int
|
||||||
|
|||||||
@@ -215,24 +215,24 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
|
|||||||
std::string filename;
|
std::string filename;
|
||||||
while (arguments.read("--image",filename))
|
while (arguments.read("--image",filename))
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Image> image = readImageFile(filename.c_str(), local_options.get());
|
osg::ref_ptr<osg::Image> image = readRefImageFile(filename.c_str(), local_options.get());
|
||||||
if (image.valid()) nodeList.push_back(osg::createGeodeForImage(image.get()));
|
if (image.valid()) nodeList.push_back(osg::createGeodeForImage(image));
|
||||||
}
|
}
|
||||||
|
|
||||||
while (arguments.read("--movie",filename))
|
while (arguments.read("--movie",filename))
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Image> image = readImageFile(filename.c_str(), local_options.get());
|
osg::ref_ptr<osg::Image> image = readRefImageFile(filename.c_str(), local_options.get());
|
||||||
osg::ref_ptr<osg::ImageStream> imageStream = dynamic_cast<osg::ImageStream*>(image.get());
|
osg::ref_ptr<osg::ImageStream> imageStream = dynamic_cast<osg::ImageStream*>(image.get());
|
||||||
if (image.valid())
|
if (image.valid())
|
||||||
{
|
{
|
||||||
imageStream->play();
|
imageStream->play();
|
||||||
nodeList.push_back(osg::createGeodeForImage(imageStream.get()));
|
nodeList.push_back(osg::createGeodeForImage(imageStream));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (arguments.read("--dem",filename))
|
while (arguments.read("--dem",filename))
|
||||||
{
|
{
|
||||||
osg::HeightField* hf = readHeightFieldFile(filename.c_str(), local_options.get());
|
osg::ref_ptr<osg::HeightField> hf = readRefHeightFieldFile(filename.c_str(), local_options.get());
|
||||||
if (hf)
|
if (hf)
|
||||||
{
|
{
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
@@ -247,7 +247,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
|
|||||||
if (!arguments.isOption(pos))
|
if (!arguments.isOption(pos))
|
||||||
{
|
{
|
||||||
// not an option so assume string is a filename.
|
// not an option so assume string is a filename.
|
||||||
osg::Node *node = osgDB::readNodeFile( arguments[pos], local_options.get());
|
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFile( arguments[pos], local_options.get());
|
||||||
|
|
||||||
if(node)
|
if(node)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ void processLoadedModel(osg::ref_ptr<osg::Node>& loadedModel, int optimizer_opti
|
|||||||
|
|
||||||
void addDeviceTo(osgViewer::Viewer& viewer, const std::string& device_name, bool forward_mouse_events)
|
void addDeviceTo(osgViewer::Viewer& viewer, const std::string& device_name, bool forward_mouse_events)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device_name);
|
osg::ref_ptr<osgGA::Device> dev = osgDB::readRefFile<osgGA::Device>(device_name);
|
||||||
if (dev.valid())
|
if (dev.valid())
|
||||||
{
|
{
|
||||||
OSG_INFO << "Adding Device : " << device_name << std::endl;
|
OSG_INFO << "Adding Device : " << device_name << std::endl;
|
||||||
@@ -317,7 +317,7 @@ int main( int argc, char **argv )
|
|||||||
if (arguments.read("-devices") || arguments.read("--devices"))
|
if (arguments.read("-devices") || arguments.read("--devices"))
|
||||||
{
|
{
|
||||||
// Force load QuickTime plugin, probe video capability, exit
|
// Force load QuickTime plugin, probe video capability, exit
|
||||||
osgDB::readImageFile("devices.live");
|
osgDB::readRefImageFile("devices.live");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,7 +451,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
osg::ref_ptr<osgDB::Options> device_options = new osgDB::Options("documentRegisteredHandlers");
|
osg::ref_ptr<osgDB::Options> device_options = new osgDB::Options("documentRegisteredHandlers");
|
||||||
|
|
||||||
osg::ref_ptr<osgGA::Device> rest_http_device = osgDB::readFile<osgGA::Device>(server_address+":"+server_port+"/"+document_root+".resthttp", device_options.get());
|
osg::ref_ptr<osgGA::Device> rest_http_device = osgDB::readRefFile<osgGA::Device>(server_address+":"+server_port+"/"+document_root+".resthttp", device_options.get());
|
||||||
if (rest_http_device.valid())
|
if (rest_http_device.valid())
|
||||||
{
|
{
|
||||||
viewer.addDevice(rest_http_device.get());
|
viewer.addDevice(rest_http_device.get());
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ int main( int argc, char **argv )
|
|||||||
std::string filename;
|
std::string filename;
|
||||||
if (arguments.read("--shader",filename))
|
if (arguments.read("--shader",filename))
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Shader> shader = osgDB::readShaderFile(filename);
|
osg::ref_ptr<osg::Shader> shader = osgDB::readRefShaderFile(filename);
|
||||||
if (shader.valid())
|
if (shader.valid())
|
||||||
{
|
{
|
||||||
std::string name = osgDB::getStrippedName(filename);
|
std::string name = osgDB::getStrippedName(filename);
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ enum BufferOffset
|
|||||||
|
|
||||||
const int __numDataValuesPerChannel = OFFSET_END;
|
const int __numDataValuesPerChannel = OFFSET_END;
|
||||||
const int __numChannels = 4;
|
const int __numChannels = 4;
|
||||||
const float __particleRenderScaleMultiplier = 0.3;
|
|
||||||
|
|
||||||
//512x512x4x7 = 7.340.032 floats in SSBO on GPU
|
//512x512x4x7 = 7.340.032 floats in SSBO on GPU
|
||||||
const int NUM_ELEMENTS_X = 512;
|
const int NUM_ELEMENTS_X = 512;
|
||||||
@@ -312,7 +311,7 @@ public:
|
|||||||
//set OSG_FILE_PATH for loading axes.osgt
|
//set OSG_FILE_PATH for loading axes.osgt
|
||||||
void ComputeNode::addHelperGeometry()
|
void ComputeNode::addHelperGeometry()
|
||||||
{
|
{
|
||||||
_helperNode = osgDB::readNodeFile("axes.osgt");
|
_helperNode = osgDB::readRefNodeFile("axes.osgt");
|
||||||
|
|
||||||
if (_helperNode.valid())
|
if (_helperNode.valid())
|
||||||
{
|
{
|
||||||
@@ -465,8 +464,8 @@ void ComputeNode::addDataMonitor(osg::Vec3 placement, osg::Vec3 relativePlacemen
|
|||||||
ss->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
ss->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||||
|
|
||||||
//add a label
|
//add a label
|
||||||
osgText::Text* text = new osgText::Text;
|
osg::ref_ptr<osgText::Text> text = new osgText::Text;
|
||||||
osgText::Font* font = osgText::readFontFile("fonts/arial.ttf");
|
osg::ref_ptr<osgText::Font> font = osgText::readRefFontFile("fonts/arial.ttf");
|
||||||
text->setFont(font);
|
text->setFont(font);
|
||||||
text->setColor(osg::Vec4(1, 1, 1, 1));
|
text->setColor(osg::Vec4(1, 1, 1, 1));
|
||||||
text->setCharacterSize(0.1*scale);
|
text->setCharacterSize(0.1*scale);
|
||||||
|
|||||||
@@ -504,7 +504,7 @@ protected:
|
|||||||
optimizeVertexOrder = false;
|
optimizeVertexOrder = false;
|
||||||
|
|
||||||
reallocateMemory = false;
|
reallocateMemory = false;
|
||||||
|
|
||||||
modifyTextureSettings = false;
|
modifyTextureSettings = false;
|
||||||
buildImageMipmaps = false;
|
buildImageMipmaps = false;
|
||||||
compressImages = false;
|
compressImages = false;
|
||||||
@@ -524,22 +524,23 @@ protected:
|
|||||||
bool optimizeVertexOrder;
|
bool optimizeVertexOrder;
|
||||||
|
|
||||||
bool reallocateMemory;
|
bool reallocateMemory;
|
||||||
|
|
||||||
bool modifyTextureSettings;
|
bool modifyTextureSettings;
|
||||||
bool buildImageMipmaps;
|
bool buildImageMipmaps;
|
||||||
bool compressImages;
|
bool compressImages;
|
||||||
bool disableMipmaps;
|
bool disableMipmaps;
|
||||||
|
|
||||||
};
|
};
|
||||||
//
|
//
|
||||||
class DatabasePagingOperation : public osg::Operation, public osgUtil::IncrementalCompileOperation::CompileCompletedCallback
|
class DatabasePagingOperation : public osg::Operation, public osgUtil::IncrementalCompileOperation::CompileCompletedCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DatabasePagingOperation(const std::string& filename,
|
DatabasePagingOperation(const std::string& filename,
|
||||||
const std::string& outputFilename,
|
const std::string& outputFilename,
|
||||||
SceneGraphProcessor* sceneGraphProcessor,
|
SceneGraphProcessor* sceneGraphProcessor,
|
||||||
osgUtil::IncrementalCompileOperation* ico):
|
osgUtil::IncrementalCompileOperation* ico):
|
||||||
|
osg::Referenced(true),
|
||||||
Operation("DatabasePaging Operation", false),
|
Operation("DatabasePaging Operation", false),
|
||||||
_filename(filename),
|
_filename(filename),
|
||||||
_outputFilename(outputFilename),
|
_outputFilename(outputFilename),
|
||||||
@@ -554,7 +555,7 @@ public:
|
|||||||
osg::notify(osg::NOTICE)<<"LoadAndCompileOperation "<<_filename<<std::endl;
|
osg::notify(osg::NOTICE)<<"LoadAndCompileOperation "<<_filename<<std::endl;
|
||||||
|
|
||||||
_modelReadyToMerge = false;
|
_modelReadyToMerge = false;
|
||||||
_loadedModel = osgDB::readNodeFile(_filename);
|
_loadedModel = osgDB::readRefNodeFile(_filename);
|
||||||
|
|
||||||
if (_loadedModel.valid())
|
if (_loadedModel.valid())
|
||||||
{
|
{
|
||||||
@@ -569,7 +570,7 @@ public:
|
|||||||
if (!_outputFilename.empty())
|
if (!_outputFilename.empty())
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"Writing out file "<<_outputFilename<<std::endl;
|
OSG_NOTICE<<"Writing out file "<<_outputFilename<<std::endl;
|
||||||
|
|
||||||
osgDB::writeNodeFile(*_loadedModel, _outputFilename);
|
osgDB::writeNodeFile(*_loadedModel, _outputFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -663,7 +664,7 @@ int main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
apm->setTimeScale(animationSpeed);
|
apm->setTimeScale(animationSpeed);
|
||||||
apm->setAnimationCompletedCallback(new ReportStatsAnimationCompletedCallback());
|
apm->setAnimationCompletedCallback(new ReportStatsAnimationCompletedCallback());
|
||||||
|
|
||||||
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
||||||
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
||||||
keyswitchManipulator->selectMatrixManipulator(num);
|
keyswitchManipulator->selectMatrixManipulator(num);
|
||||||
@@ -674,7 +675,7 @@ int main(int argc, char** argv)
|
|||||||
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up event handlers
|
// set up event handlers
|
||||||
{
|
{
|
||||||
viewer.addEventHandler( new osgViewer::StatsHandler());
|
viewer.addEventHandler( new osgViewer::StatsHandler());
|
||||||
viewer.addEventHandler( new osgViewer::WindowSizeHandler() );
|
viewer.addEventHandler( new osgViewer::WindowSizeHandler() );
|
||||||
@@ -796,7 +797,7 @@ int main(int argc, char** argv)
|
|||||||
if (databasePagingOperation.get() && databasePagingOperation->_modelReadyToMerge)
|
if (databasePagingOperation.get() && databasePagingOperation->_modelReadyToMerge)
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"Merging subgraph"<<std::endl;
|
OSG_NOTICE<<"Merging subgraph"<<std::endl;
|
||||||
|
|
||||||
timeOfLastMerge = currentTime;
|
timeOfLastMerge = currentTime;
|
||||||
|
|
||||||
group->removeChildren(0,group->getNumChildren());
|
group->removeChildren(0,group->getNumChildren());
|
||||||
|
|||||||
@@ -136,9 +136,9 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
|
|||||||
|
|
||||||
osg::AnimationPath* animationPath = createAnimationPath(center,radius,animationLength);
|
osg::AnimationPath* animationPath = createAnimationPath(center,radius,animationLength);
|
||||||
|
|
||||||
osg::Group* model = new osg::Group;
|
osg::ref_ptr<osg::Group> model = new osg::Group;
|
||||||
|
|
||||||
osg::Node* glider = osgDB::readNodeFile("glider.osgt");
|
osg::ref_ptr<osg::Node> glider = osgDB::readRefNodeFile("glider.osgt");
|
||||||
if (glider)
|
if (glider)
|
||||||
{
|
{
|
||||||
const osg::BoundingSphere& bs = glider->getBound();
|
const osg::BoundingSphere& bs = glider->getBound();
|
||||||
@@ -159,7 +159,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
|
|||||||
model->addChild(xform);
|
model->addChild(xform);
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node* cessna = osgDB::readNodeFile("cessna.osgt");
|
osg::ref_ptr<osg::Node> cessna = osgDB::readRefNodeFile("cessna.osgt");
|
||||||
if (cessna)
|
if (cessna)
|
||||||
{
|
{
|
||||||
const osg::BoundingSphere& bs = cessna->getBound();
|
const osg::BoundingSphere& bs = cessna->getBound();
|
||||||
@@ -173,26 +173,26 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
|
|||||||
|
|
||||||
positioned->addChild(cessna);
|
positioned->addChild(cessna);
|
||||||
|
|
||||||
osg::MatrixTransform* xform = new osg::MatrixTransform;
|
osg::ref_ptr<osg::MatrixTransform> xform = new osg::MatrixTransform;
|
||||||
xform->setUpdateCallback(new osg::AnimationPathCallback(animationPath,0.0f,2.0));
|
xform->setUpdateCallback(new osg::AnimationPathCallback(animationPath,0.0f,2.0));
|
||||||
xform->addChild(positioned);
|
xform->addChild(positioned);
|
||||||
|
|
||||||
model->addChild(xform);
|
model->addChild(xform);
|
||||||
}
|
}
|
||||||
|
|
||||||
return model;
|
return model.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node* createModel(bool overlay, osgSim::OverlayNode::OverlayTechnique technique)
|
osg::ref_ptr<osg::Group> createModel(bool overlay, osgSim::OverlayNode::OverlayTechnique technique)
|
||||||
{
|
{
|
||||||
osg::Vec3 center(0.0f,0.0f,0.0f);
|
osg::Vec3 center(0.0f,0.0f,0.0f);
|
||||||
float radius = 100.0f;
|
float radius = 100.0f;
|
||||||
|
|
||||||
osg::Group* root = new osg::Group;
|
osg::ref_ptr<osg::Group> root = new osg::Group;
|
||||||
|
|
||||||
float baseHeight = center.z()-radius*0.5;
|
float baseHeight = center.z()-radius*0.5;
|
||||||
osg::Node* baseModel = createBase(osg::Vec3(center.x(), center.y(), baseHeight),radius);
|
osg::ref_ptr<osg::Node> baseModel = createBase(osg::Vec3(center.x(), center.y(), baseHeight),radius);
|
||||||
osg::Node* movingModel = createMovingModel(center,radius*0.8f);
|
osg::ref_ptr<osg::Node> movingModel = createMovingModel(center,radius*0.8f);
|
||||||
|
|
||||||
if (overlay)
|
if (overlay)
|
||||||
{
|
{
|
||||||
@@ -232,14 +232,14 @@ int main( int argc, char **argv )
|
|||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* model = createModel(overlay, technique);
|
osg::ref_ptr<osg::Group> model = createModel(overlay, technique);
|
||||||
if (!model)
|
if (!model)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// tilt the scene so the default eye position is looking down on the model.
|
// tilt the scene so the default eye position is looking down on the model.
|
||||||
osg::MatrixTransform* rootnode = new osg::MatrixTransform;
|
osg::ref_ptr<osg::MatrixTransform> rootnode = new osg::MatrixTransform;
|
||||||
rootnode->setMatrix(osg::Matrix::rotate(osg::inDegrees(30.0f),1.0f,0.0f,0.0f));
|
rootnode->setMatrix(osg::Matrix::rotate(osg::inDegrees(30.0f),1.0f,0.0f,0.0f));
|
||||||
rootnode->addChild(model);
|
rootnode->addChild(model);
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
/* -*-c++-*-
|
/* -*-c++-*-
|
||||||
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
|
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
|
||||||
*
|
*
|
||||||
* This library is open source and may be redistributed and/or modified under
|
* 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
|
* 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
|
* (at your option) any later version. The full license is in LICENSE file
|
||||||
* included with this distribution, and on the openscenegraph.org website.
|
* included with this distribution, and on the openscenegraph.org website.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* OpenSceneGraph Public License for more details.
|
* OpenSceneGraph Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ struct MyRigTransformHardware : public osgAnimation::RigTransformHardware
|
|||||||
|
|
||||||
osg::notify(osg::INFO) << "set vertex attrib " << ss.str() << std::endl;
|
osg::notify(osg::INFO) << "set vertex attrib " << ss.str() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < nbAttribs; i++)
|
for (int i = 0; i < nbAttribs; i++)
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
@@ -134,7 +134,7 @@ struct SetupRigGeometry : public osg::NodeVisitor
|
|||||||
{
|
{
|
||||||
bool _hardware;
|
bool _hardware;
|
||||||
SetupRigGeometry( bool hardware = true) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _hardware(hardware) {}
|
SetupRigGeometry( bool hardware = true) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _hardware(hardware) {}
|
||||||
|
|
||||||
void apply(osg::Geode& geode)
|
void apply(osg::Geode& geode)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < geode.getNumDrawables(); i++)
|
for (unsigned int i = 0; i < geode.getNumDrawables(); i++)
|
||||||
@@ -173,7 +173,7 @@ osg::Group* createCharacterInstance(osg::Group* character, bool hardware)
|
|||||||
anim->playAnimation(list[v].get());
|
anim->playAnimation(list[v].get());
|
||||||
v = (v + 1)%list.size();
|
v = (v + 1)%list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
anim->playAnimation(list[v].get());
|
anim->playAnimation(list[v].get());
|
||||||
|
|
||||||
SetupRigGeometry switcher(hardware);
|
SetupRigGeometry switcher(hardware);
|
||||||
@@ -196,9 +196,9 @@ int main (int argc, char* argv[])
|
|||||||
while (psr.read("--software")) { hardware = false; }
|
while (psr.read("--software")) { hardware = false; }
|
||||||
while (psr.read("--number", maxChar)) {}
|
while (psr.read("--number", maxChar)) {}
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFiles(psr);
|
||||||
osg::ref_ptr<osg::Group> root = dynamic_cast<osg::Group*>(osgDB::readNodeFiles(psr));
|
osg::ref_ptr<osg::Group> root = dynamic_cast<osg::Group*>(node.get());
|
||||||
if (!root)
|
if (!root)
|
||||||
{
|
{
|
||||||
std::cout << psr.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << psr.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@@ -206,7 +206,7 @@ int main (int argc, char* argv[])
|
|||||||
|
|
||||||
{
|
{
|
||||||
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback());
|
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback());
|
||||||
if(!animationManager)
|
if(!animationManager)
|
||||||
{
|
{
|
||||||
osg::notify(osg::FATAL) << "no AnimationManagerBase found, updateCallback need to animate elements" << std::endl;
|
osg::notify(osg::FATAL) << "no AnimationManagerBase found, updateCallback need to animate elements" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@@ -218,13 +218,13 @@ int main (int argc, char* argv[])
|
|||||||
|
|
||||||
// add the state manipulator
|
// add the state manipulator
|
||||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||||
|
|
||||||
// add the thread model handler
|
// add the thread model handler
|
||||||
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
||||||
|
|
||||||
// add the window size toggle handler
|
// add the window size toggle handler
|
||||||
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
||||||
|
|
||||||
// add the stats handler
|
// add the stats handler
|
||||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
/* -*-c++-*-
|
/* -*-c++-*-
|
||||||
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
|
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
|
||||||
*
|
*
|
||||||
* This library is open source and may be redistributed and/or modified under
|
* 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
|
* 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
|
* (at your option) any later version. The full license is in LICENSE file
|
||||||
* included with this distribution, and on the openscenegraph.org website.
|
* included with this distribution, and on the openscenegraph.org website.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* OpenSceneGraph Public License for more details.
|
* OpenSceneGraph Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -33,11 +33,11 @@ struct GeometryFinder : public osg::NodeVisitor
|
|||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Geometry> _geom;
|
osg::ref_ptr<osg::Geometry> _geom;
|
||||||
GeometryFinder() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
GeometryFinder() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||||
void apply(osg::Geode& geode)
|
void apply(osg::Geode& geode)
|
||||||
{
|
{
|
||||||
if (_geom.valid())
|
if (_geom.valid())
|
||||||
return;
|
return;
|
||||||
for (unsigned int i = 0; i < geode.getNumDrawables(); i++)
|
for (unsigned int i = 0; i < geode.getNumDrawables(); i++)
|
||||||
{
|
{
|
||||||
osg::Geometry* geom = dynamic_cast<osg::Geometry*>(geode.getDrawable(i));
|
osg::Geometry* geom = dynamic_cast<osg::Geometry*>(geode.getDrawable(i));
|
||||||
if (geom) {
|
if (geom) {
|
||||||
@@ -50,7 +50,7 @@ struct GeometryFinder : public osg::NodeVisitor
|
|||||||
|
|
||||||
osg::ref_ptr<osg::Geometry> getShape(const std::string& name)
|
osg::ref_ptr<osg::Geometry> getShape(const std::string& name)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Node> shape0 = osgDB::readNodeFile(name);
|
osg::ref_ptr<osg::Node> shape0 = osgDB::readRefNodeFile(name);
|
||||||
if (shape0)
|
if (shape0)
|
||||||
{
|
{
|
||||||
GeometryFinder finder;
|
GeometryFinder finder;
|
||||||
@@ -104,7 +104,7 @@ int main (int argc, char* argv[])
|
|||||||
|
|
||||||
osg::Group* scene = new osg::Group;
|
osg::Group* scene = new osg::Group;
|
||||||
scene->addUpdateCallback(bam);
|
scene->addUpdateCallback(bam);
|
||||||
|
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
geode->addDrawable(morph);
|
geode->addDrawable(morph);
|
||||||
geode->addUpdateCallback(new osgAnimation::UpdateMorph("MorphNodeCallback"));
|
geode->addUpdateCallback(new osgAnimation::UpdateMorph("MorphNodeCallback"));
|
||||||
|
|||||||
@@ -163,7 +163,8 @@ int main (int argc, char* argv[])
|
|||||||
file = psr[1];
|
file = psr[1];
|
||||||
|
|
||||||
// replace the manager
|
// replace the manager
|
||||||
osg::Group* root = dynamic_cast<osg::Group*>(osgDB::readNodeFile(file));
|
osg::ref_ptr<osg::Node> loadedmodel = osgDB::readRefNodeFile(file);
|
||||||
|
osg::Group* root = dynamic_cast<osg::Group*>(loadedmodel.get());
|
||||||
if (!root) {
|
if (!root) {
|
||||||
osg::notify(osg::FATAL) << "can't read file " << file << std::endl;
|
osg::notify(osg::FATAL) << "can't read file " << file << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -127,7 +127,8 @@ int main(int argc, char** argv)
|
|||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
osg::ref_ptr<osg::Group> group = new osg::Group();
|
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]));
|
osg::ref_ptr<osg::Node> loadedmodel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
osg::Group* node = dynamic_cast<osg::Group*>(loadedmodel.get());
|
||||||
if(!node)
|
if(!node)
|
||||||
{
|
{
|
||||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ int main(int argc, char** argv)
|
|||||||
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
|
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
|
||||||
|
|
||||||
// load the data
|
// load the data
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
osg::Geometry * quad = osg::createTexturedQuadGeometry(osg::Vec3f(-2.0f, 0.0f, -2.0f),
|
osg::Geometry * quad = osg::createTexturedQuadGeometry(osg::Vec3f(-2.0f, 0.0f, -2.0f),
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include <osgViewer/Viewer>
|
#include <osgViewer/Viewer>
|
||||||
#include <osgViewer/ViewerEventHandlers>
|
#include <osgViewer/ViewerEventHandlers>
|
||||||
#include <osgViewer/Renderer>
|
#include <osgViewer/Renderer>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
|
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
|
||||||
_foundNode(0)
|
_foundNode(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void apply(osg::Node& node)
|
void apply(osg::Node& node)
|
||||||
{
|
{
|
||||||
T* result = dynamic_cast<T*>(&node);
|
T* result = dynamic_cast<T*>(&node);
|
||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
else
|
else
|
||||||
traverse(node);
|
traverse(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
T* _foundNode;
|
T* _foundNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,21 +62,21 @@ T* findTopMostNodeOfType(osg::Node* node)
|
|||||||
|
|
||||||
FindTopMostNodeOfTypeVisitor<T> fnotv;
|
FindTopMostNodeOfTypeVisitor<T> fnotv;
|
||||||
node->accept(fnotv);
|
node->accept(fnotv);
|
||||||
|
|
||||||
return fnotv._foundNode;
|
return fnotv._foundNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Capture the frame buffer and write image to disk*/
|
/** Capture the frame buffer and write image to disk*/
|
||||||
class WindowCaptureCallback : public osg::Camera::DrawCallback
|
class WindowCaptureCallback : public osg::Camera::DrawCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WindowCaptureCallback(GLenum readBuffer, const std::string& name):
|
WindowCaptureCallback(GLenum readBuffer, const std::string& name):
|
||||||
_readBuffer(readBuffer),
|
_readBuffer(readBuffer),
|
||||||
_fileName(name)
|
_fileName(name)
|
||||||
{
|
{
|
||||||
_image = new osg::Image;
|
_image = new osg::Image;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void operator () (osg::RenderInfo& renderInfo) const
|
virtual void operator () (osg::RenderInfo& renderInfo) const
|
||||||
{
|
{
|
||||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||||
@@ -93,9 +93,9 @@ public:
|
|||||||
|
|
||||||
if (gc->getTraits()->alpha)
|
if (gc->getTraits()->alpha)
|
||||||
pixelFormat = GL_RGBA;
|
pixelFormat = GL_RGBA;
|
||||||
else
|
else
|
||||||
pixelFormat = GL_RGB;
|
pixelFormat = GL_RGB;
|
||||||
|
|
||||||
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
|
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
|
||||||
if (pixelFormat == GL_RGB)
|
if (pixelFormat == GL_RGB)
|
||||||
{
|
{
|
||||||
@@ -118,7 +118,7 @@ public:
|
|||||||
|
|
||||||
_image->readPixels(0, 0, width, height, pixelFormat, GL_UNSIGNED_BYTE);
|
_image->readPixels(0, 0, width, height, pixelFormat, GL_UNSIGNED_BYTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_fileName.empty())
|
if (!_fileName.empty())
|
||||||
{
|
{
|
||||||
std::cout << "Writing to: " << _fileName << std::endl;
|
std::cout << "Writing to: " << _fileName << std::endl;
|
||||||
@@ -126,7 +126,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GLenum _readBuffer;
|
GLenum _readBuffer;
|
||||||
std::string _fileName;
|
std::string _fileName;
|
||||||
osg::ref_ptr<osg::Image> _image;
|
osg::ref_ptr<osg::Image> _image;
|
||||||
@@ -138,7 +138,7 @@ protected:
|
|||||||
class CustomRenderer : public osgViewer::Renderer
|
class CustomRenderer : public osgViewer::Renderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CustomRenderer(osg::Camera* camera)
|
CustomRenderer(osg::Camera* camera)
|
||||||
: osgViewer::Renderer(camera),
|
: osgViewer::Renderer(camera),
|
||||||
_cullOnly(true)
|
_cullOnly(true)
|
||||||
{
|
{
|
||||||
@@ -162,19 +162,19 @@ public:
|
|||||||
{
|
{
|
||||||
osgUtil::SceneView* sceneView = _sceneView[0].get();
|
osgUtil::SceneView* sceneView = _sceneView[0].get();
|
||||||
if (!sceneView || _done ) return;
|
if (!sceneView || _done ) return;
|
||||||
|
|
||||||
updateSceneView(sceneView);
|
updateSceneView(sceneView);
|
||||||
|
|
||||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(_camera->getView());
|
osgViewer::View* view = dynamic_cast<osgViewer::View*>(_camera->getView());
|
||||||
if (view) sceneView->setFusionDistance(view->getFusionDistanceMode(), view->getFusionDistanceValue());
|
if (view) sceneView->setFusionDistance(view->getFusionDistanceMode(), view->getFusionDistanceValue());
|
||||||
|
|
||||||
sceneView->inheritCullSettings(*(sceneView->getCamera()));
|
sceneView->inheritCullSettings(*(sceneView->getCamera()));
|
||||||
sceneView->cull();
|
sceneView->cull();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _cullOnly;
|
bool _cullOnly;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//===============================================================
|
//===============================================================
|
||||||
// MAIN
|
// MAIN
|
||||||
@@ -287,8 +287,8 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load the data
|
// load the data
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@@ -309,7 +309,7 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
osg::CoordinateSystemNode* csn = findTopMostNodeOfType<osg::CoordinateSystemNode>(loadedModel.get());
|
osg::CoordinateSystemNode* csn = findTopMostNodeOfType<osg::CoordinateSystemNode>(loadedModel.get());
|
||||||
if(!csn) return 1;
|
if(!csn) return 1;
|
||||||
|
|
||||||
// Compute eye point in world coordiantes
|
// Compute eye point in world coordiantes
|
||||||
osg::Vec3d eye;
|
osg::Vec3d eye;
|
||||||
csn->getEllipsoidModel()->convertLatLongHeightToXYZ(lat, lon, alt, eye.x(), eye.y(), eye.z());
|
csn->getEllipsoidModel()->convertLatLongHeightToXYZ(lat, lon, alt, eye.x(), eye.y(), eye.z());
|
||||||
@@ -331,11 +331,11 @@ int main( int argc, char **argv )
|
|||||||
osg::Vec3d up_cross_tangent = up ^ tangent;
|
osg::Vec3d up_cross_tangent = up ^ tangent;
|
||||||
osg::Matrixd incline_matrix = osg::Matrixd::rotate(incline, up_cross_tangent);
|
osg::Matrixd incline_matrix = osg::Matrixd::rotate(incline, up_cross_tangent);
|
||||||
osg::Vec3d target = incline_matrix.preMult(tangent);
|
osg::Vec3d target = incline_matrix.preMult(tangent);
|
||||||
|
|
||||||
// Roll by rotating the up vector around the target vector ...
|
// Roll by rotating the up vector around the target vector ...
|
||||||
osg::Matrixd roll_matrix = incline_matrix * osg::Matrixd::rotate(roll, target);
|
osg::Matrixd roll_matrix = incline_matrix * osg::Matrixd::rotate(roll, target);
|
||||||
up = roll_matrix.preMult(up);
|
up = roll_matrix.preMult(up);
|
||||||
|
|
||||||
viewer.getCamera()->setViewMatrixAsLookAt(eye, eye+target, up);
|
viewer.getCamera()->setViewMatrixAsLookAt(eye, eye+target, up);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -349,10 +349,10 @@ int main( int argc, char **argv )
|
|||||||
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
|
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
|
||||||
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
|
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
|
||||||
|
|
||||||
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Optimize DatabasePager for auto-capture
|
// Optimize DatabasePager for auto-capture
|
||||||
osgDB::DatabasePager* pager = viewer.getDatabasePager();
|
osgDB::DatabasePager* pager = viewer.getDatabasePager();
|
||||||
pager->setDoPreCompile(false);
|
pager->setDoPreCompile(false);
|
||||||
@@ -374,9 +374,9 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// Initiate the first PagedLOD request
|
// Initiate the first PagedLOD request
|
||||||
viewer.frame();
|
viewer.frame();
|
||||||
|
|
||||||
osg::Timer_t beforeLoadTick = osg::Timer::instance()->tick();
|
osg::Timer_t beforeLoadTick = osg::Timer::instance()->tick();
|
||||||
|
|
||||||
// Keep updating and culling until full level of detail is reached
|
// Keep updating and culling until full level of detail is reached
|
||||||
while(!viewer.done() && pager->getRequestsInProgress())
|
while(!viewer.done() && pager->getRequestsInProgress())
|
||||||
{
|
{
|
||||||
@@ -385,14 +385,14 @@ int main( int argc, char **argv )
|
|||||||
viewer.renderingTraversals();
|
viewer.renderingTraversals();
|
||||||
}
|
}
|
||||||
// std::cout<<std::endl;
|
// std::cout<<std::endl;
|
||||||
|
|
||||||
osg::Timer_t afterLoadTick = osg::Timer::instance()->tick();
|
osg::Timer_t afterLoadTick = osg::Timer::instance()->tick();
|
||||||
std::cout<<"Load and Compile time = "<<osg::Timer::instance()->delta_s(beforeLoadTick, afterLoadTick)<<" seconds"<<std::endl;
|
std::cout<<"Load and Compile time = "<<osg::Timer::instance()->delta_s(beforeLoadTick, afterLoadTick)<<" seconds"<<std::endl;
|
||||||
|
|
||||||
// Do cull and draw to render the scene correctly
|
// Do cull and draw to render the scene correctly
|
||||||
customRenderer->setCullOnly(false);
|
customRenderer->setCullOnly(false);
|
||||||
|
|
||||||
|
|
||||||
//--- Capture the image!!! ---
|
//--- Capture the image!!! ---
|
||||||
if (!activeMode)
|
if (!activeMode)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,10 +42,10 @@
|
|||||||
typedef std::vector< osg::ref_ptr<osg::Image> > ImageList;
|
typedef std::vector< osg::ref_ptr<osg::Image> > ImageList;
|
||||||
|
|
||||||
/** create quad at specified position. */
|
/** create quad at specified position. */
|
||||||
osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const osg::Vec3& height, osg::Image* image=NULL)
|
osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const osg::Vec3& height, osg::ref_ptr<osg::Image> image)
|
||||||
{
|
{
|
||||||
// set up the Geometry.
|
// set up the Geometry.
|
||||||
osg::Geometry* geom = new osg::Geometry;
|
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
|
||||||
|
|
||||||
osg::Vec3Array* coords = new osg::Vec3Array(4);
|
osg::Vec3Array* coords = new osg::Vec3Array(4);
|
||||||
(*coords)[0] = corner;
|
(*coords)[0] = corner;
|
||||||
@@ -80,13 +80,13 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
|
|||||||
geom->setStateSet(stateset);
|
geom->setStateSet(stateset);
|
||||||
}
|
}
|
||||||
|
|
||||||
return geom;
|
return geom.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Drawable* createAxis(const osg::Vec3& corner,const osg::Vec3& xdir,const osg::Vec3& ydir,const osg::Vec3& zdir)
|
osg::Drawable* createAxis(const osg::Vec3& corner,const osg::Vec3& xdir,const osg::Vec3& ydir,const osg::Vec3& zdir)
|
||||||
{
|
{
|
||||||
// set up the Geometry.
|
// set up the Geometry.
|
||||||
osg::Geometry* geom = new osg::Geometry;
|
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
|
||||||
|
|
||||||
osg::Vec3Array* coords = new osg::Vec3Array(6);
|
osg::Vec3Array* coords = new osg::Vec3Array(6);
|
||||||
(*coords)[0] = corner;
|
(*coords)[0] = corner;
|
||||||
@@ -121,20 +121,20 @@ osg::Drawable* createAxis(const osg::Vec3& corner,const osg::Vec3& xdir,const os
|
|||||||
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||||
geom->setStateSet(stateset);
|
geom->setStateSet(stateset);
|
||||||
|
|
||||||
return geom;
|
return geom.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node* createModel()
|
osg::ref_ptr<osg::Node> createModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
// create the root node which will hold the model.
|
// create the root node which will hold the model.
|
||||||
osg::Group* root = new osg::Group();
|
osg::ref_ptr<osg::Group> root = new osg::Group();
|
||||||
|
|
||||||
// add the drawable into a single geode to be shared...
|
// add the drawable into a single geode to be shared...
|
||||||
osg::Billboard* center = new osg::Billboard();
|
osg::Billboard* center = new osg::Billboard();
|
||||||
center->setMode(osg::Billboard::POINT_ROT_EYE);
|
center->setMode(osg::Billboard::POINT_ROT_EYE);
|
||||||
center->addDrawable(
|
center->addDrawable(
|
||||||
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readImageFile("Images/reflect.rgb")),
|
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readRefImageFile("Images/reflect.rgb")),
|
||||||
osg::Vec3(0.0f,0.0f,0.0f));
|
osg::Vec3(0.0f,0.0f,0.0f));
|
||||||
|
|
||||||
osg::Billboard* x_arrow = new osg::Billboard();
|
osg::Billboard* x_arrow = new osg::Billboard();
|
||||||
@@ -142,7 +142,7 @@ osg::Node* createModel()
|
|||||||
x_arrow->setAxis(osg::Vec3(1.0f,0.0f,0.0f));
|
x_arrow->setAxis(osg::Vec3(1.0f,0.0f,0.0f));
|
||||||
x_arrow->setNormal(osg::Vec3(0.0f,-1.0f,0.0f));
|
x_arrow->setNormal(osg::Vec3(0.0f,-1.0f,0.0f));
|
||||||
x_arrow->addDrawable(
|
x_arrow->addDrawable(
|
||||||
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readImageFile("Cubemap_axis/posx.png")),
|
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readRefImageFile("Cubemap_axis/posx.png")),
|
||||||
osg::Vec3(5.0f,0.0f,0.0f));
|
osg::Vec3(5.0f,0.0f,0.0f));
|
||||||
|
|
||||||
osg::Billboard* y_arrow = new osg::Billboard();
|
osg::Billboard* y_arrow = new osg::Billboard();
|
||||||
@@ -150,7 +150,7 @@ osg::Node* createModel()
|
|||||||
y_arrow->setAxis(osg::Vec3(0.0f,1.0f,0.0f));
|
y_arrow->setAxis(osg::Vec3(0.0f,1.0f,0.0f));
|
||||||
y_arrow->setNormal(osg::Vec3(1.0f,0.0f,0.0f));
|
y_arrow->setNormal(osg::Vec3(1.0f,0.0f,0.0f));
|
||||||
y_arrow->addDrawable(
|
y_arrow->addDrawable(
|
||||||
createSquare(osg::Vec3(0.0f,-0.5f,-0.5f),osg::Vec3(0.0f,1.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readImageFile("Cubemap_axis/posy.png")),
|
createSquare(osg::Vec3(0.0f,-0.5f,-0.5f),osg::Vec3(0.0f,1.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readRefImageFile("Cubemap_axis/posy.png")),
|
||||||
osg::Vec3(0.0f,5.0f,0.0f));
|
osg::Vec3(0.0f,5.0f,0.0f));
|
||||||
|
|
||||||
osg::Billboard* z_arrow = new osg::Billboard();
|
osg::Billboard* z_arrow = new osg::Billboard();
|
||||||
@@ -158,7 +158,7 @@ osg::Node* createModel()
|
|||||||
z_arrow->setAxis(osg::Vec3(0.0f,0.0f,1.0f));
|
z_arrow->setAxis(osg::Vec3(0.0f,0.0f,1.0f));
|
||||||
z_arrow->setNormal(osg::Vec3(0.0f,-1.0f,0.0f));
|
z_arrow->setNormal(osg::Vec3(0.0f,-1.0f,0.0f));
|
||||||
z_arrow->addDrawable(
|
z_arrow->addDrawable(
|
||||||
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readImageFile("Cubemap_axis/posz.png")),
|
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readRefImageFile("Cubemap_axis/posz.png")),
|
||||||
osg::Vec3(0.0f,0.0f,5.0f));
|
osg::Vec3(0.0f,0.0f,5.0f));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,9 +71,17 @@ int main( int argc, char **argv )
|
|||||||
bool useGlobalBlending = false;
|
bool useGlobalBlending = false;
|
||||||
if ( arguments.read("--no-draw-buffers") ) useGlobalBlending = true;
|
if ( arguments.read("--no-draw-buffers") ) useGlobalBlending = true;
|
||||||
|
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Node> cessna = osgDB::readRefNodeFile("cessna.osgt");
|
||||||
|
if (!cessna)
|
||||||
|
{
|
||||||
|
OSG_NOTICE<<"Cannot not find model 'cessna.osg' to render"<<std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Create a camera to output multi-rendering-targets (MRT)
|
// Create a camera to output multi-rendering-targets (MRT)
|
||||||
osg::Camera* mrtCam = createMRTCamera( textures );
|
osg::ref_ptr<osg::Camera> mrtCam = createMRTCamera( textures );
|
||||||
mrtCam->addChild( osgDB::readNodeFile("cessna.osgt") );
|
mrtCam->addChild( cessna );
|
||||||
|
|
||||||
// Create shader program to be used
|
// Create shader program to be used
|
||||||
const char* mrtFragmentCode = {
|
const char* mrtFragmentCode = {
|
||||||
@@ -87,8 +95,8 @@ int main( int argc, char **argv )
|
|||||||
osg::ref_ptr<osg::Program> program = new osg::Program;
|
osg::ref_ptr<osg::Program> program = new osg::Program;
|
||||||
program->addShader( new osg::Shader(osg::Shader::FRAGMENT, mrtFragmentCode) );
|
program->addShader( new osg::Shader(osg::Shader::FRAGMENT, mrtFragmentCode) );
|
||||||
|
|
||||||
osg::StateSet* ss = mrtCam->getOrCreateStateSet();
|
osg::ref_ptr<osg::StateSet> ss = mrtCam->getOrCreateStateSet();
|
||||||
ss->setAttributeAndModes( program.get() );
|
ss->setAttributeAndModes( program );
|
||||||
|
|
||||||
// Apply blending to the original scene in MRT
|
// Apply blending to the original scene in MRT
|
||||||
if ( !useGlobalBlending )
|
if ( !useGlobalBlending )
|
||||||
@@ -103,8 +111,8 @@ int main( int argc, char **argv )
|
|||||||
// Accept different blend/colormask attributes on multiple render targets
|
// Accept different blend/colormask attributes on multiple render targets
|
||||||
osg::ref_ptr<osg::BlendFunci> blend0 = new osg::BlendFunci(0, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
osg::ref_ptr<osg::BlendFunci> blend0 = new osg::BlendFunci(0, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
osg::ref_ptr<osg::ColorMaski> colormask3 = new osg::ColorMaski(3, false, true, false, true);
|
osg::ref_ptr<osg::ColorMaski> colormask3 = new osg::ColorMaski(3, false, true, false, true);
|
||||||
ss->setAttribute( blend0.get() );
|
ss->setAttribute( blend0 );
|
||||||
ss->setAttributeAndModes( colormask3.get() );
|
ss->setAttributeAndModes( colormask3 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -139,10 +139,10 @@ int main( int argc, char **argv )
|
|||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("cessnafire.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("cessnafire.osgt");
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
@@ -150,11 +150,11 @@ int main( int argc, char **argv )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Group* root = new osg::Group;
|
osg::ref_ptr<osg::Group> root = new osg::Group;
|
||||||
root->addChild(loadedModel);
|
root->addChild(loadedModel);
|
||||||
|
|
||||||
|
|
||||||
osg::StateSet* stateset = new osg::StateSet;
|
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet;
|
||||||
stateset->setDataVariance(osg::Object::DYNAMIC);
|
stateset->setDataVariance(osg::Object::DYNAMIC);
|
||||||
|
|
||||||
osg::BlendEquation* blendEquation = new osg::BlendEquation(osg::BlendEquation::FUNC_ADD);
|
osg::BlendEquation* blendEquation = new osg::BlendEquation(osg::BlendEquation::FUNC_ADD);
|
||||||
|
|||||||
@@ -239,10 +239,10 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rootnode = osgDB::readNodeFiles(arguments);
|
rootnode = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!rootnode) rootnode = osgDB::readNodeFile("cow.osgt");
|
if (!rootnode) rootnode = osgDB::readRefNodeFile("cow.osgt");
|
||||||
|
|
||||||
if (!rootnode)
|
if (!rootnode)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,50 +25,50 @@
|
|||||||
#include <osgGA/AnimationPathManipulator>
|
#include <osgGA/AnimationPathManipulator>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
class ModelHandler : public osgGA::GUIEventHandler
|
class ModelHandler : public osgGA::GUIEventHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ModelHandler():
|
ModelHandler():
|
||||||
_position(0) {}
|
_position(0) {}
|
||||||
|
|
||||||
typedef std::vector<std::string> Filenames;
|
typedef std::vector<std::string> Filenames;
|
||||||
Filenames _filenames;
|
Filenames _filenames;
|
||||||
unsigned int _position;
|
unsigned int _position;
|
||||||
|
|
||||||
void add(const std::string& filename) { _filenames.push_back(filename); }
|
void add(const std::string& filename) { _filenames.push_back(filename); }
|
||||||
|
|
||||||
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
|
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
|
||||||
{
|
{
|
||||||
osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(&aa);
|
osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(&aa);
|
||||||
if (!viewer) return false;
|
if (!viewer) return false;
|
||||||
|
|
||||||
if (_filenames.empty()) return false;
|
if (_filenames.empty()) return false;
|
||||||
|
|
||||||
switch(ea.getEventType())
|
switch(ea.getEventType())
|
||||||
{
|
{
|
||||||
case(osgGA::GUIEventAdapter::KEYUP):
|
case(osgGA::GUIEventAdapter::KEYUP):
|
||||||
{
|
{
|
||||||
if (ea.getKey()=='l')
|
if (ea.getKey()=='l')
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Node> model = osgDB::readNodeFile( _filenames[_position] );
|
osg::ref_ptr<osg::Node> model = osgDB::readRefNodeFile( _filenames[_position] );
|
||||||
++_position;
|
++_position;
|
||||||
if (_position>=_filenames.size()) _position = 0;
|
if (_position>=_filenames.size()) _position = 0;
|
||||||
|
|
||||||
if (model.valid())
|
if (model.valid())
|
||||||
{
|
{
|
||||||
viewer->setSceneData(model.get());
|
viewer->setSceneData(model.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _done;
|
bool _done;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,12 +76,12 @@ public:
|
|||||||
void singleWindowMultipleCameras(osgViewer::Viewer& viewer)
|
void singleWindowMultipleCameras(osgViewer::Viewer& viewer)
|
||||||
{
|
{
|
||||||
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
||||||
if (!wsi)
|
if (!wsi)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
|
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int width, height;
|
unsigned int width, height;
|
||||||
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
|
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
|
||||||
|
|
||||||
@@ -127,12 +127,12 @@ void singleWindowMultipleCameras(osgViewer::Viewer& viewer)
|
|||||||
void multipleWindowMultipleCameras(osgViewer::Viewer& viewer, bool multipleScreens)
|
void multipleWindowMultipleCameras(osgViewer::Viewer& viewer, bool multipleScreens)
|
||||||
{
|
{
|
||||||
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
||||||
if (!wsi)
|
if (!wsi)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
|
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int width, height;
|
unsigned int width, height;
|
||||||
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
|
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ int main( int argc, char **argv )
|
|||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
if (argc<2)
|
if (argc<2)
|
||||||
{
|
{
|
||||||
std::cout << argv[0] <<": requires filename argument." << std::endl;
|
std::cout << argv[0] <<": requires filename argument." << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@@ -214,7 +214,7 @@ int main( int argc, char **argv )
|
|||||||
osg::ref_ptr<osg::Node> model;
|
osg::ref_ptr<osg::Node> model;
|
||||||
if (sharedModel)
|
if (sharedModel)
|
||||||
{
|
{
|
||||||
model = osgDB::readNodeFiles(arguments);
|
model = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!model) return 0;
|
if (!model) return 0;
|
||||||
|
|
||||||
if (enableVBO)
|
if (enableVBO)
|
||||||
@@ -242,7 +242,7 @@ int main( int argc, char **argv )
|
|||||||
if (sharedModel) viewer.setSceneData(model.get());
|
if (sharedModel) viewer.setSceneData(model.get());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Node> node = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!node) return 0;
|
if (!node) return 0;
|
||||||
|
|
||||||
if (enableVBO)
|
if (enableVBO)
|
||||||
@@ -268,19 +268,19 @@ int main( int argc, char **argv )
|
|||||||
while (arguments.read("-p",pathfile))
|
while (arguments.read("-p",pathfile))
|
||||||
{
|
{
|
||||||
apm = new osgGA::AnimationPathManipulator(pathfile);
|
apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||||
if (!apm.valid() || !(apm->valid()) )
|
if (!apm.valid() || !(apm->valid()) )
|
||||||
{
|
{
|
||||||
apm = 0;
|
apm = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
while (arguments.read("-s")) { viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); }
|
while (arguments.read("-s")) { viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); }
|
||||||
while (arguments.read("-g")) { viewer.setThreadingModel(osgViewer::Viewer::CullDrawThreadPerContext); }
|
while (arguments.read("-g")) { viewer.setThreadingModel(osgViewer::Viewer::CullDrawThreadPerContext); }
|
||||||
while (arguments.read("-d")) { viewer.setThreadingModel(osgViewer::Viewer::DrawThreadPerContext); }
|
while (arguments.read("-d")) { viewer.setThreadingModel(osgViewer::Viewer::DrawThreadPerContext); }
|
||||||
while (arguments.read("-c")) { viewer.setThreadingModel(osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext); }
|
while (arguments.read("-c")) { viewer.setThreadingModel(osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext); }
|
||||||
|
|
||||||
bool limitNumberOfFrames = false;
|
bool limitNumberOfFrames = false;
|
||||||
unsigned int maxFrames = 10;
|
unsigned int maxFrames = 10;
|
||||||
while (arguments.read("--run-till-frame-number",maxFrames)) { limitNumberOfFrames = true; }
|
while (arguments.read("--run-till-frame-number",maxFrames)) { limitNumberOfFrames = true; }
|
||||||
@@ -292,7 +292,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
if (apm.valid()) viewer.setCameraManipulator(apm.get());
|
if (apm.valid()) viewer.setCameraManipulator(apm.get());
|
||||||
else viewer.setCameraManipulator( new osgGA::TrackballManipulator() );
|
else viewer.setCameraManipulator( new osgGA::TrackballManipulator() );
|
||||||
|
|
||||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||||
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ int main( int argc, char **argv )
|
|||||||
while (arguments.read("--config", configfile))
|
while (arguments.read("--config", configfile))
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Trying to read config file "<<configfile<<std::endl;
|
osg::notify(osg::NOTICE)<<"Trying to read config file "<<configfile<<std::endl;
|
||||||
osg::ref_ptr<osg::Object> object = osgDB::readObjectFile(configfile);
|
osg::ref_ptr<osg::Object> object = osgDB::readRefObjectFile(configfile);
|
||||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(object.get());
|
osgViewer::View* view = dynamic_cast<osgViewer::View*>(object.get());
|
||||||
if (view)
|
if (view)
|
||||||
{
|
{
|
||||||
@@ -329,19 +329,19 @@ int main( int argc, char **argv )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// load the scene.
|
// load the scene.
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("cow.osgt");
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout << argv[0] <<": No data loaded." << std::endl;
|
std::cout << argv[0] <<": No data loaded." << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer.setSceneData(loadedModel.get());
|
viewer.setSceneData(loadedModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer.realize();
|
viewer.realize();
|
||||||
|
|
||||||
unsigned int numFrames = 0;
|
unsigned int numFrames = 0;
|
||||||
|
|||||||
@@ -55,11 +55,11 @@ class Character : public osg::Referenced
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Character();
|
Character();
|
||||||
|
|
||||||
void setCharacter(const std::string& filename, const std::string& name, const osg::Vec3& orgin, const osg::Vec3& width, const osg::Vec3& catchPos, float positionRatio);
|
void setCharacter(const std::string& filename, const std::string& name, const osg::Vec3& orgin, const osg::Vec3& width, const osg::Vec3& catchPos, float positionRatio);
|
||||||
|
|
||||||
void setLives(const std::string& filename, const osg::Vec3& orgin, const osg::Vec3& delta, unsigned int numLives);
|
void setLives(const std::string& filename, const osg::Vec3& orgin, const osg::Vec3& delta, unsigned int numLives);
|
||||||
|
|
||||||
void setCatches(const std::string& filename, const osg::Vec3& orgin, const osg::Vec3& delta, unsigned int numLives);
|
void setCatches(const std::string& filename, const osg::Vec3& orgin, const osg::Vec3& delta, unsigned int numLives);
|
||||||
|
|
||||||
void moveLeft();
|
void moveLeft();
|
||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
void resetCatches();
|
void resetCatches();
|
||||||
|
|
||||||
bool addCatch();
|
bool addCatch();
|
||||||
|
|
||||||
bool looseLife();
|
bool looseLife();
|
||||||
|
|
||||||
osg::Vec3 getCurrentCenterOfBasket() const { return _character->getPosition()+_centerBasket; }
|
osg::Vec3 getCurrentCenterOfBasket() const { return _character->getPosition()+_centerBasket; }
|
||||||
@@ -91,12 +91,12 @@ public:
|
|||||||
|
|
||||||
unsigned int _numCatches;
|
unsigned int _numCatches;
|
||||||
osg::ref_ptr<osg::Switch> _catchSwitch;
|
osg::ref_ptr<osg::Switch> _catchSwitch;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Group> _objectsGroup;
|
osg::ref_ptr<osg::Group> _objectsGroup;
|
||||||
|
|
||||||
osg::Vec3 _centerBasket;
|
osg::Vec3 _centerBasket;
|
||||||
float _radiusBasket;
|
float _radiusBasket;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Character::Character():
|
Character::Character():
|
||||||
@@ -117,7 +117,7 @@ void Character::setCharacter(const std::string& filename, const std::string& nam
|
|||||||
|
|
||||||
float _characterSize = _width.length()*0.2f;
|
float _characterSize = _width.length()*0.2f;
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile(filename);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(filename);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Vec3 pos(-0.5f*_characterSize,0.0f,0.0f);
|
osg::Vec3 pos(-0.5f*_characterSize,0.0f,0.0f);
|
||||||
@@ -136,14 +136,14 @@ void Character::setCharacter(const std::string& filename, const std::string& nam
|
|||||||
_character = new osg::PositionAttitudeTransform;
|
_character = new osg::PositionAttitudeTransform;
|
||||||
_character->setName(name);
|
_character->setName(name);
|
||||||
_character->addChild(geode);
|
_character->addChild(geode);
|
||||||
|
|
||||||
moveTo(positionRatio);
|
moveTo(positionRatio);
|
||||||
|
|
||||||
_centerBasket = width*catchPos.x() + height*catchPos.y() + pos;
|
_centerBasket = width*catchPos.x() + height*catchPos.y() + pos;
|
||||||
_radiusBasket = width.length()*catchPos.z();
|
_radiusBasket = width.length()*catchPos.z();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Character::setLives(const std::string& filename, const osg::Vec3& origin, const osg::Vec3& delta, unsigned int numLives)
|
void Character::setLives(const std::string& filename, const osg::Vec3& origin, const osg::Vec3& delta, unsigned int numLives)
|
||||||
@@ -153,7 +153,7 @@ void Character::setLives(const std::string& filename, const osg::Vec3& origin, c
|
|||||||
_numLives = numLives;
|
_numLives = numLives;
|
||||||
_livesSwitch = new osg::Switch;
|
_livesSwitch = new osg::Switch;
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile(filename);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(filename);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::StateSet* stateset = _livesSwitch->getOrCreateStateSet();
|
osg::StateSet* stateset = _livesSwitch->getOrCreateStateSet();
|
||||||
@@ -186,7 +186,7 @@ void Character::setCatches(const std::string& filename, const osg::Vec3& origin,
|
|||||||
_numCatches = 0;
|
_numCatches = 0;
|
||||||
_catchSwitch = new osg::Switch;
|
_catchSwitch = new osg::Switch;
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile(filename);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(filename);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::StateSet* stateset = _catchSwitch->getOrCreateStateSet();
|
osg::StateSet* stateset = _catchSwitch->getOrCreateStateSet();
|
||||||
@@ -249,20 +249,20 @@ void Character::resetCatches()
|
|||||||
bool Character::addCatch()
|
bool Character::addCatch()
|
||||||
{
|
{
|
||||||
if (!_catchSwitch || _numCatches>=_catchSwitch->getNumChildren()) return false;
|
if (!_catchSwitch || _numCatches>=_catchSwitch->getNumChildren()) return false;
|
||||||
|
|
||||||
_catchSwitch->setValue(_numCatches,true);
|
_catchSwitch->setValue(_numCatches,true);
|
||||||
++_numCatches;
|
++_numCatches;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Character::looseLife()
|
bool Character::looseLife()
|
||||||
{
|
{
|
||||||
if (!_livesSwitch || _numLives==0) return false;
|
if (!_livesSwitch || _numLives==0) return false;
|
||||||
|
|
||||||
--_numLives;
|
--_numLives;
|
||||||
_livesSwitch->setValue(_numLives,false);
|
_livesSwitch->setValue(_numLives,false);
|
||||||
|
|
||||||
return (_numLives!=0);
|
return (_numLives!=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,21 +279,21 @@ class CatchableObject : public osg::Referenced
|
|||||||
bool anyInside(const osg::Vec3& lower_left, const osg::Vec3& top_right);
|
bool anyInside(const osg::Vec3& lower_left, const osg::Vec3& top_right);
|
||||||
|
|
||||||
bool centerInside(const osg::Vec3& center, float radius);
|
bool centerInside(const osg::Vec3& center, float radius);
|
||||||
|
|
||||||
void explode();
|
void explode();
|
||||||
|
|
||||||
bool dangerous() { return _dangerous; }
|
bool dangerous() { return _dangerous; }
|
||||||
|
|
||||||
void stop() { _stopped = true; }
|
void stop() { _stopped = true; }
|
||||||
|
|
||||||
bool stopped() { return _stopped; }
|
bool stopped() { return _stopped; }
|
||||||
|
|
||||||
void setTimeToRemove(double time) { _timeToRemove=time; }
|
void setTimeToRemove(double time) { _timeToRemove=time; }
|
||||||
|
|
||||||
double getTimeToRemove() { return _timeToRemove; }
|
double getTimeToRemove() { return _timeToRemove; }
|
||||||
|
|
||||||
bool needToRemove(double time) { return _timeToRemove>=0.0 && time>_timeToRemove; }
|
bool needToRemove(double time) { return _timeToRemove>=0.0 && time>_timeToRemove; }
|
||||||
|
|
||||||
osg::ref_ptr<osg::PositionAttitudeTransform> _object;
|
osg::ref_ptr<osg::PositionAttitudeTransform> _object;
|
||||||
osg::Vec3 _velocity;
|
osg::Vec3 _velocity;
|
||||||
float _mass;
|
float _mass;
|
||||||
@@ -307,7 +307,7 @@ class CatchableObject : public osg::Referenced
|
|||||||
static void setUpCatchablesMap(const FileList& fileList);
|
static void setUpCatchablesMap(const FileList& fileList);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// update position and velocity
|
// update position and velocity
|
||||||
void update(double dt);
|
void update(double dt);
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ class CatchableObject : public osg::Referenced
|
|||||||
_viscosity = v;
|
_viscosity = v;
|
||||||
_viscosityCoefficient = 6 * osg::PI * _viscosity;
|
_viscosityCoefficient = 6 * osg::PI * _viscosity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the viscosity of the fluid.
|
/// Get the viscosity of the fluid.
|
||||||
inline float getFluidViscosity() const { return _viscosity; }
|
inline float getFluidViscosity() const { return _viscosity; }
|
||||||
|
|
||||||
@@ -330,17 +330,17 @@ class CatchableObject : public osg::Referenced
|
|||||||
|
|
||||||
/// Get the density of the fluid.
|
/// Get the density of the fluid.
|
||||||
inline float getFluidDensity() const { return _density; }
|
inline float getFluidDensity() const { return _density; }
|
||||||
|
|
||||||
|
|
||||||
/// Set the wind vector.
|
/// Set the wind vector.
|
||||||
inline void setWind(const osg::Vec3& wind) { _wind = wind; }
|
inline void setWind(const osg::Vec3& wind) { _wind = wind; }
|
||||||
|
|
||||||
/// Get the wind vector.
|
/// Get the wind vector.
|
||||||
inline const osg::Vec3& getWind() const { return _wind; }
|
inline const osg::Vec3& getWind() const { return _wind; }
|
||||||
|
|
||||||
/// Set the acceleration vector.
|
/// Set the acceleration vector.
|
||||||
inline void setAcceleration(const osg::Vec3& v) { _acceleration = v; }
|
inline void setAcceleration(const osg::Vec3& v) { _acceleration = v; }
|
||||||
|
|
||||||
/// Get the acceleration vector.
|
/// Get the acceleration vector.
|
||||||
inline const osg::Vec3& getAcceleration() const { return _acceleration; }
|
inline const osg::Vec3& getAcceleration() const { return _acceleration; }
|
||||||
|
|
||||||
@@ -349,22 +349,22 @@ class CatchableObject : public osg::Referenced
|
|||||||
*/
|
*/
|
||||||
inline void setToGravity(float scale = 1.0f) { _acceleration.set(0, 0, -9.81f*scale); }
|
inline void setToGravity(float scale = 1.0f) { _acceleration.set(0, 0, -9.81f*scale); }
|
||||||
|
|
||||||
/// Set the fluid parameters as for air (20<EFBFBD>C temperature).
|
/// Set the fluid parameters as for air (20C temperature).
|
||||||
inline void setFluidToAir()
|
inline void setFluidToAir()
|
||||||
{
|
{
|
||||||
setToGravity(1.0f);
|
setToGravity(1.0f);
|
||||||
setFluidDensity(1.2929f);
|
setFluidDensity(1.2929f);
|
||||||
setFluidViscosity(1.8e-5f);
|
setFluidViscosity(1.8e-5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the fluid parameters as for pure water (20<EFBFBD>C temperature).
|
/// Set the fluid parameters as for pure water (20C temperature).
|
||||||
inline void setFluidToWater()
|
inline void setFluidToWater()
|
||||||
{
|
{
|
||||||
setToGravity(1.0f);
|
setToGravity(1.0f);
|
||||||
setFluidDensity(1.0f);
|
setFluidDensity(1.0f);
|
||||||
setFluidViscosity(1.002e-3f);
|
setFluidViscosity(1.002e-3f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -375,15 +375,15 @@ class CatchableObject : public osg::Referenced
|
|||||||
|
|
||||||
float _viscosityCoefficient;
|
float _viscosityCoefficient;
|
||||||
float _densityCoefficeint;
|
float _densityCoefficeint;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CatchableObject::CatchableObject()
|
CatchableObject::CatchableObject()
|
||||||
{
|
{
|
||||||
_stopped = false;
|
_stopped = false;
|
||||||
_dangerous = false;
|
_dangerous = false;
|
||||||
|
|
||||||
_timeToRemove = -1.0; // do not remove.
|
_timeToRemove = -1.0; // do not remove.
|
||||||
setFluidToAir();
|
setFluidToAir();
|
||||||
}
|
}
|
||||||
@@ -395,14 +395,14 @@ void CatchableObject::setUpCatchablesMap(const FileList& fileList)
|
|||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
const std::string& filename = *itr;
|
const std::string& filename = *itr;
|
||||||
osg::Image* image = osgDB::readImageFile(filename);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(filename);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet();
|
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet();
|
||||||
stateset->setTextureAttributeAndModes(0,new osg::Texture2D(image),osg::StateAttribute::ON);
|
stateset->setTextureAttributeAndModes(0,new osg::Texture2D(image),osg::StateAttribute::ON);
|
||||||
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
|
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
|
||||||
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||||
|
|
||||||
osg::Vec3 width((float)(image->s())/(float)(image->t()),0.0f,0.0);
|
osg::Vec3 width((float)(image->s())/(float)(image->t()),0.0f,0.0);
|
||||||
osg::Vec3 height(0.0f,0.0f,1.0f);
|
osg::Vec3 height(0.0f,0.0f,1.0f);
|
||||||
osg::Vec3 pos = (width+height)*-0.5f;
|
osg::Vec3 pos = (width+height)*-0.5f;
|
||||||
@@ -455,8 +455,8 @@ void CatchableObject::update(double dt)
|
|||||||
osg::Vec3 force = _acceleration * (_mass - _density*Volume);
|
osg::Vec3 force = _acceleration * (_mass - _density*Volume);
|
||||||
|
|
||||||
// compute force due to friction
|
// compute force due to friction
|
||||||
osg::Vec3 relative_wind = _velocity-_wind;
|
osg::Vec3 relative_wind = _velocity-_wind;
|
||||||
force -= relative_wind * Area * (_viscosityCoefficient + _densityCoefficeint*relative_wind.length());
|
force -= relative_wind * Area * (_viscosityCoefficient + _densityCoefficeint*relative_wind.length());
|
||||||
|
|
||||||
// divide force by mass to get acceleration.
|
// divide force by mass to get acceleration.
|
||||||
_velocity += force*(dt/_mass);
|
_velocity += force*(dt/_mass);
|
||||||
@@ -466,7 +466,7 @@ void CatchableObject::update(double dt)
|
|||||||
bool CatchableObject::anyInside(const osg::Vec3& lower_left, const osg::Vec3& upper_right)
|
bool CatchableObject::anyInside(const osg::Vec3& lower_left, const osg::Vec3& upper_right)
|
||||||
{
|
{
|
||||||
osg::Vec3 pos = _object->getPosition();
|
osg::Vec3 pos = _object->getPosition();
|
||||||
|
|
||||||
if (pos.x()+_radius < lower_left.x()) return false;
|
if (pos.x()+_radius < lower_left.x()) return false;
|
||||||
if (pos.x()-_radius > upper_right.x()) return false;
|
if (pos.x()-_radius > upper_right.x()) return false;
|
||||||
if (pos.z()+_radius < lower_left.z()) return false;
|
if (pos.z()+_radius < lower_left.z()) return false;
|
||||||
@@ -513,20 +513,20 @@ class GameEventHandler : public osgGA::GUIEventHandler
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
GameEventHandler();
|
GameEventHandler();
|
||||||
|
|
||||||
META_Object(osgStereImageApp,GameEventHandler);
|
META_Object(osgStereImageApp,GameEventHandler);
|
||||||
|
|
||||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
|
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
|
||||||
|
|
||||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||||
|
|
||||||
osg::Matrix getCameraPosition();
|
osg::Matrix getCameraPosition();
|
||||||
|
|
||||||
void compileGLObjects(osg::State& state)
|
void compileGLObjects(osg::State& state)
|
||||||
{
|
{
|
||||||
osgUtil::GLObjectsVisitor compile;
|
osgUtil::GLObjectsVisitor compile;
|
||||||
compile.setState(&state);
|
compile.setState(&state);
|
||||||
|
|
||||||
for(ObjectMap::iterator itr = s_objectMap.begin();
|
for(ObjectMap::iterator itr = s_objectMap.begin();
|
||||||
itr != s_objectMap.end();
|
itr != s_objectMap.end();
|
||||||
++itr)
|
++itr)
|
||||||
@@ -534,14 +534,14 @@ public:
|
|||||||
itr->second->accept(compile);
|
itr->second->accept(compile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node* createScene();
|
osg::Node* createScene();
|
||||||
|
|
||||||
void setFOVY(float fovy) { _fovy = fovy; }
|
void setFOVY(float fovy) { _fovy = fovy; }
|
||||||
float getFOVY() const { return _fovy; }
|
float getFOVY() const { return _fovy; }
|
||||||
|
|
||||||
void createNewCatchable();
|
void createNewCatchable();
|
||||||
|
|
||||||
void clearCatchables()
|
void clearCatchables()
|
||||||
{
|
{
|
||||||
for(CatchableObjectList::iterator itr=_catchableObjects.begin();
|
for(CatchableObjectList::iterator itr=_catchableObjects.begin();
|
||||||
@@ -562,7 +562,7 @@ public:
|
|||||||
|
|
||||||
_catchableObjects.clear();
|
_catchableObjects.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetLevel()
|
void resetLevel()
|
||||||
{
|
{
|
||||||
_level = 0;
|
_level = 0;
|
||||||
@@ -573,7 +573,7 @@ public:
|
|||||||
|
|
||||||
_levelStartTick = osg::Timer::instance()->tick();
|
_levelStartTick = osg::Timer::instance()->tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nextLevel()
|
void nextLevel()
|
||||||
{
|
{
|
||||||
++_level;
|
++_level;
|
||||||
@@ -596,12 +596,12 @@ public:
|
|||||||
void resetGame()
|
void resetGame()
|
||||||
{
|
{
|
||||||
_currentScore = 0;
|
_currentScore = 0;
|
||||||
|
|
||||||
updateTextWithScore();
|
updateTextWithScore();
|
||||||
|
|
||||||
clearCatchables();
|
clearCatchables();
|
||||||
resetLevel();
|
resetLevel();
|
||||||
|
|
||||||
for(unsigned int i=0;i<_numberOfPlayers;++i)
|
for(unsigned int i=0;i<_numberOfPlayers;++i)
|
||||||
{
|
{
|
||||||
_players[i].reset();
|
_players[i].reset();
|
||||||
@@ -629,12 +629,12 @@ public:
|
|||||||
livesPosition = _originBaseLine+osg::Vec3(1000.0f,-0.5f,000.0f);
|
livesPosition = _originBaseLine+osg::Vec3(1000.0f,-0.5f,000.0f);
|
||||||
catchesPosition = _originBaseLine+osg::Vec3(1100.0f,-0.5f,0.0f);
|
catchesPosition = _originBaseLine+osg::Vec3(1100.0f,-0.5f,0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(player)
|
switch(player)
|
||||||
{
|
{
|
||||||
case PLAYER_GIRL:
|
case PLAYER_GIRL:
|
||||||
{
|
{
|
||||||
std::string player_one = "Catch/girl.png";
|
std::string player_one = "Catch/girl.png";
|
||||||
osg::Vec3 catchPos(0.2, 0.57, 0.34);
|
osg::Vec3 catchPos(0.2, 0.57, 0.34);
|
||||||
|
|
||||||
_players[_numberOfPlayers].setCharacter(player_one,"girl", _originBaseLine + osg::Vec3(0.0f,-1.0f,0.0f), _widthBaseLine, catchPos, 0.5f);
|
_players[_numberOfPlayers].setCharacter(player_one,"girl", _originBaseLine + osg::Vec3(0.0f,-1.0f,0.0f), _widthBaseLine, catchPos, 0.5f);
|
||||||
@@ -646,7 +646,7 @@ public:
|
|||||||
}
|
}
|
||||||
case PLAYER_BOY:
|
case PLAYER_BOY:
|
||||||
{
|
{
|
||||||
std::string player_two = "Catch/boy.png";
|
std::string player_two = "Catch/boy.png";
|
||||||
osg::Vec3 catchPos(0.8, 0.57, 0.34);
|
osg::Vec3 catchPos(0.8, 0.57, 0.34);
|
||||||
|
|
||||||
_players[_numberOfPlayers].setCharacter(player_two,"boy", _originBaseLine + osg::Vec3(0.0f,-2.0f,0.0f), _widthBaseLine, catchPos, 0.5f);
|
_players[_numberOfPlayers].setCharacter(player_two,"boy", _originBaseLine + osg::Vec3(0.0f,-2.0f,0.0f), _widthBaseLine, catchPos, 0.5f);
|
||||||
@@ -656,10 +656,10 @@ public:
|
|||||||
++_numberOfPlayers;
|
++_numberOfPlayers;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef std::vector< osg::ref_ptr<osgText::Text> > TextList;
|
typedef std::vector< osg::ref_ptr<osgText::Text> > TextList;
|
||||||
|
|
||||||
void updateScoreWithCatch()
|
void updateScoreWithCatch()
|
||||||
@@ -673,8 +673,8 @@ public:
|
|||||||
osg::Timer_t newTick = osg::Timer::instance()->tick();
|
osg::Timer_t newTick = osg::Timer::instance()->tick();
|
||||||
double timeForLevel = osg::Timer::instance()->delta_s(_levelStartTick, newTick);
|
double timeForLevel = osg::Timer::instance()->delta_s(_levelStartTick, newTick);
|
||||||
|
|
||||||
// a ten second level gets you 10 points,
|
// a ten second level gets you 10 points,
|
||||||
// a twenty second levels gets you 5 points.
|
// a twenty second levels gets you 5 points.
|
||||||
_currentScore += static_cast<unsigned int>(10000.0f/(timeForLevel*timeForLevel));
|
_currentScore += static_cast<unsigned int>(10000.0f/(timeForLevel*timeForLevel));
|
||||||
|
|
||||||
updateTextWithScore();
|
updateTextWithScore();
|
||||||
@@ -685,24 +685,24 @@ public:
|
|||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os<<"Score: "<<_currentScore;
|
os<<"Score: "<<_currentScore;
|
||||||
|
|
||||||
std::string textString = os.str();
|
std::string textString = os.str();
|
||||||
|
|
||||||
for(TextList::iterator itr = _scoreTextList.begin();
|
for(TextList::iterator itr = _scoreTextList.begin();
|
||||||
itr != _scoreTextList.end();
|
itr != _scoreTextList.end();
|
||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
(*itr)->setText(textString);
|
(*itr)->setText(textString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateLevelText()
|
void updateLevelText()
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os<<"Level: "<<_level+1;
|
os<<"Level: "<<_level+1;
|
||||||
_levelText->setText(os.str());
|
_levelText->setText(os.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -715,45 +715,45 @@ protected:
|
|||||||
osg::Vec3 _originBaseLine;
|
osg::Vec3 _originBaseLine;
|
||||||
osg::Vec3 _widthBaseLine;
|
osg::Vec3 _widthBaseLine;
|
||||||
float _characterSize;
|
float _characterSize;
|
||||||
|
|
||||||
float _fovy;
|
float _fovy;
|
||||||
|
|
||||||
unsigned _level;
|
unsigned _level;
|
||||||
|
|
||||||
float _chanceOfExplodingAtStart;
|
float _chanceOfExplodingAtStart;
|
||||||
float _initialNumDropsPerSecond;
|
float _initialNumDropsPerSecond;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Switch> _gameSwitch;
|
osg::ref_ptr<osg::Switch> _gameSwitch;
|
||||||
osg::ref_ptr<osg::Group> _gameGroup;
|
osg::ref_ptr<osg::Group> _gameGroup;
|
||||||
osg::ref_ptr<osg::Switch> _levelSwitch;
|
osg::ref_ptr<osg::Switch> _levelSwitch;
|
||||||
|
|
||||||
unsigned int _currentIndex;
|
unsigned int _currentIndex;
|
||||||
unsigned int _welcomeIndex;
|
unsigned int _welcomeIndex;
|
||||||
unsigned int _lostIndex;
|
unsigned int _lostIndex;
|
||||||
unsigned int _wonIndex;
|
unsigned int _wonIndex;
|
||||||
unsigned int _gameIndex;
|
unsigned int _gameIndex;
|
||||||
|
|
||||||
osg::Timer_t _levelStartTick;
|
osg::Timer_t _levelStartTick;
|
||||||
unsigned int _currentScore;
|
unsigned int _currentScore;
|
||||||
|
|
||||||
osg::ref_ptr<osgText::Text> _levelText;
|
osg::ref_ptr<osgText::Text> _levelText;
|
||||||
TextList _scoreTextList;
|
TextList _scoreTextList;
|
||||||
|
|
||||||
unsigned int _numberOfPlayers;
|
unsigned int _numberOfPlayers;
|
||||||
Character _players[2];
|
Character _players[2];
|
||||||
|
|
||||||
typedef std::list< osg::ref_ptr<CatchableObject> > CatchableObjectList;
|
typedef std::list< osg::ref_ptr<CatchableObject> > CatchableObjectList;
|
||||||
CatchableObjectList _catchableObjects;
|
CatchableObjectList _catchableObjects;
|
||||||
|
|
||||||
FileList _backgroundFiles;
|
FileList _backgroundFiles;
|
||||||
FileList _benignCatachables;
|
FileList _benignCatachables;
|
||||||
|
|
||||||
bool _leftKeyPressed;
|
bool _leftKeyPressed;
|
||||||
bool _rightKeyPressed;
|
bool _rightKeyPressed;
|
||||||
|
|
||||||
osg::ref_ptr<CatchableObject> _dummyCatchable;
|
osg::ref_ptr<CatchableObject> _dummyCatchable;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -791,11 +791,11 @@ GameEventHandler::GameEventHandler()
|
|||||||
_benignCatachables.push_back("Catch/t.png");
|
_benignCatachables.push_back("Catch/t.png");
|
||||||
_benignCatachables.push_back("Catch/u.png");
|
_benignCatachables.push_back("Catch/u.png");
|
||||||
_benignCatachables.push_back("Catch/ball.png");
|
_benignCatachables.push_back("Catch/ball.png");
|
||||||
|
|
||||||
CatchableObject::setUpCatchablesMap(_benignCatachables);
|
CatchableObject::setUpCatchablesMap(_benignCatachables);
|
||||||
|
|
||||||
_currentScore = 0;
|
_currentScore = 0;
|
||||||
|
|
||||||
setFOVY(osg::DegreesToRadians(60.0));
|
setFOVY(osg::DegreesToRadians(60.0));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -817,7 +817,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (_currentIndex==_lostIndex)
|
else if (_currentIndex==_lostIndex)
|
||||||
{
|
{
|
||||||
@@ -834,7 +834,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (_currentIndex==_wonIndex)
|
else if (_currentIndex==_wonIndex)
|
||||||
{
|
{
|
||||||
@@ -851,7 +851,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (_currentIndex==_gameIndex)
|
else if (_currentIndex==_gameIndex)
|
||||||
{
|
{
|
||||||
@@ -888,7 +888,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
for(unsigned int i=0;i<_numberOfPlayers;++i)
|
for(unsigned int i=0;i<_numberOfPlayers;++i)
|
||||||
{
|
{
|
||||||
bool inBasket = ((*itr)->centerInside(_players[i].getCurrentCenterOfBasket(),_players[i].getCurrentRadiusOfBasket()));
|
bool inBasket = ((*itr)->centerInside(_players[i].getCurrentCenterOfBasket(),_players[i].getCurrentRadiusOfBasket()));
|
||||||
|
|
||||||
if ((*itr)->dangerous())
|
if ((*itr)->dangerous())
|
||||||
{
|
{
|
||||||
if ((*itr)->anyInside(_players[i].getLowerLeft(),_players[i].getUpperRight()) || inBasket)
|
if ((*itr)->anyInside(_players[i].getLowerLeft(),_players[i].getUpperRight()) || inBasket)
|
||||||
@@ -912,7 +912,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
{
|
{
|
||||||
// player has caught a safe object.
|
// player has caught a safe object.
|
||||||
updateScoreWithCatch();
|
updateScoreWithCatch();
|
||||||
|
|
||||||
if (!_players[i].addCatch())
|
if (!_players[i].addCatch())
|
||||||
{
|
{
|
||||||
_players[i].resetCatches();
|
_players[i].resetCatches();
|
||||||
@@ -930,7 +930,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(*itr)->anyInside(_origin, _origin+_width+_height) ||
|
if (!(*itr)->anyInside(_origin, _origin+_width+_height) ||
|
||||||
(*itr)->needToRemove(ea.getTime()) ||
|
(*itr)->needToRemove(ea.getTime()) ||
|
||||||
removeEntry)
|
removeEntry)
|
||||||
{
|
{
|
||||||
@@ -968,7 +968,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
float numDropsPerSecond = _initialNumDropsPerSecond * (_level+1);
|
float numDropsPerSecond = _initialNumDropsPerSecond * (_level+1);
|
||||||
float r = (float)rand()/(float)RAND_MAX;
|
float r = (float)rand()/(float)RAND_MAX;
|
||||||
if (r < deltaTime*numDropsPerSecond)
|
if (r < deltaTime*numDropsPerSecond)
|
||||||
{
|
{
|
||||||
createNewCatchable();
|
createNewCatchable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1015,7 +1015,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameEventHandler::getUsage(osg::ApplicationUsage&) const
|
void GameEventHandler::getUsage(osg::ApplicationUsage&) const
|
||||||
@@ -1026,9 +1026,9 @@ osg::Matrix GameEventHandler::getCameraPosition()
|
|||||||
{
|
{
|
||||||
osg::Matrix cameraPosition;
|
osg::Matrix cameraPosition;
|
||||||
osg::Vec3 center = _origin+(_width+_height)*0.5f;
|
osg::Vec3 center = _origin+(_width+_height)*0.5f;
|
||||||
|
|
||||||
float distance = _height.length()/(2.0f*tanf(_fovy*0.5f));
|
float distance = _height.length()/(2.0f*tanf(_fovy*0.5f));
|
||||||
|
|
||||||
cameraPosition.makeLookAt(center-osg::Vec3(0.0f,distance,0.0f),center,osg::Vec3(0.0f,0.0f,1.0f));
|
cameraPosition.makeLookAt(center-osg::Vec3(0.0f,distance,0.0f),center,osg::Vec3(0.0f,0.0f,1.0f));
|
||||||
return cameraPosition;
|
return cameraPosition;
|
||||||
}
|
}
|
||||||
@@ -1036,8 +1036,8 @@ osg::Matrix GameEventHandler::getCameraPosition()
|
|||||||
osg::Node* GameEventHandler::createScene()
|
osg::Node* GameEventHandler::createScene()
|
||||||
{
|
{
|
||||||
_gameSwitch = new osg::Switch;
|
_gameSwitch = new osg::Switch;
|
||||||
|
|
||||||
// create a dummy catchable to load all the particule textures to reduce
|
// create a dummy catchable to load all the particule textures to reduce
|
||||||
// latency later on..
|
// latency later on..
|
||||||
_dummyCatchable = new CatchableObject;
|
_dummyCatchable = new CatchableObject;
|
||||||
_dummyCatchable->setObject("Catch/a.png","a",osg::Vec3(0.0f,0.0,0.0f),1.0f,osg::Vec3(0.0f,0.0,0.0f));
|
_dummyCatchable->setObject("Catch/a.png","a",osg::Vec3(0.0f,0.0,0.0f),1.0f,osg::Vec3(0.0f,0.0,0.0f));
|
||||||
@@ -1045,10 +1045,10 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
// set up welcome subgraph
|
// set up welcome subgraph
|
||||||
{
|
{
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
||||||
|
|
||||||
// set up the background
|
// set up the background
|
||||||
osg::Image* image = osgDB::readImageFile("Catch/Welcome.jpg");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Catch/Welcome.jpg");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
||||||
@@ -1057,7 +1057,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
geode->addDrawable(geometry);
|
geode->addDrawable(geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up the text
|
// set up the text
|
||||||
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.8f -osg::Vec3(0.0f,0.1f,0.0f);
|
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.8f -osg::Vec3(0.0f,0.1f,0.0f);
|
||||||
{
|
{
|
||||||
@@ -1072,7 +1072,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
geode->addDrawable(text);
|
geode->addDrawable(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
textPosition -= _height*0.25f;
|
textPosition -= _height*0.25f;
|
||||||
osgText::Text* text = new osgText::Text;
|
osgText::Text* text = new osgText::Text;
|
||||||
@@ -1121,9 +1121,9 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
// set up you've lost subgraph
|
// set up you've lost subgraph
|
||||||
{
|
{
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile("Catch/YouLost.jpg");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Catch/YouLost.jpg");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
||||||
@@ -1132,7 +1132,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
geode->addDrawable(geometry);
|
geode->addDrawable(geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up the text
|
// set up the text
|
||||||
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.75f -osg::Vec3(0.0f,0.1f,0.0f);
|
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.75f -osg::Vec3(0.0f,0.1f,0.0f);
|
||||||
{
|
{
|
||||||
@@ -1147,7 +1147,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
geode->addDrawable(text);
|
geode->addDrawable(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
textPosition -= _height*0.25f;
|
textPosition -= _height*0.25f;
|
||||||
osgText::Text* text = new osgText::Text;
|
osgText::Text* text = new osgText::Text;
|
||||||
@@ -1184,9 +1184,9 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
// set up you've won subgraph
|
// set up you've won subgraph
|
||||||
{
|
{
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile("Catch/YouWon.jpg");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Catch/YouWon.jpg");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
||||||
@@ -1195,7 +1195,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
geode->addDrawable(geometry);
|
geode->addDrawable(geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up the text
|
// set up the text
|
||||||
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.75f -osg::Vec3(0.0f,0.1f,0.0f);
|
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.75f -osg::Vec3(0.0f,0.1f,0.0f);
|
||||||
{
|
{
|
||||||
@@ -1210,7 +1210,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
geode->addDrawable(text);
|
geode->addDrawable(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
textPosition -= _height*0.25f;
|
textPosition -= _height*0.25f;
|
||||||
osgText::Text* text = new osgText::Text;
|
osgText::Text* text = new osgText::Text;
|
||||||
@@ -1258,7 +1258,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
_gameGroup->addChild(_players[i]._character.get());
|
_gameGroup->addChild(_players[i]._character.get());
|
||||||
_gameGroup->addChild(_players[i]._livesSwitch.get());
|
_gameGroup->addChild(_players[i]._livesSwitch.get());
|
||||||
_gameGroup->addChild(_players[i]._catchSwitch.get());
|
_gameGroup->addChild(_players[i]._catchSwitch.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// background
|
// background
|
||||||
{
|
{
|
||||||
@@ -1269,7 +1269,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile(*itr);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(*itr);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
||||||
@@ -1305,7 +1305,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
geode->addDrawable(text);
|
geode->addDrawable(text);
|
||||||
_scoreTextList.push_back(text);
|
_scoreTextList.push_back(text);
|
||||||
|
|
||||||
textPosition -= _height*0.05f;
|
textPosition -= _height*0.05f;
|
||||||
_levelText = new osgText::Text;
|
_levelText = new osgText::Text;
|
||||||
_levelText->setText("Level : 0");
|
_levelText->setText("Level : 0");
|
||||||
@@ -1317,7 +1317,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
_levelText->setAxisAlignment(osgText::Text::XZ_PLANE);
|
_levelText->setAxisAlignment(osgText::Text::XZ_PLANE);
|
||||||
|
|
||||||
geode->addDrawable(_levelText.get());
|
geode->addDrawable(_levelText.get());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_gameGroup->addChild(geode);
|
_gameGroup->addChild(geode);
|
||||||
@@ -1325,7 +1325,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentIndex = _welcomeIndex;
|
_currentIndex = _welcomeIndex;
|
||||||
_gameSwitch->setSingleChildOn(_currentIndex);
|
_gameSwitch->setSingleChildOn(_currentIndex);
|
||||||
|
|
||||||
@@ -1338,7 +1338,7 @@ void GameEventHandler::createNewCatchable()
|
|||||||
|
|
||||||
unsigned int catachableIndex = (unsigned int)((float)_benignCatachables.size()*(float)rand()/(float)RAND_MAX);
|
unsigned int catachableIndex = (unsigned int)((float)_benignCatachables.size()*(float)rand()/(float)RAND_MAX);
|
||||||
if (catachableIndex>=_benignCatachables.size()) catachableIndex = _benignCatachables.size()-1;
|
if (catachableIndex>=_benignCatachables.size()) catachableIndex = _benignCatachables.size()-1;
|
||||||
|
|
||||||
const std::string& filename = _benignCatachables[catachableIndex];
|
const std::string& filename = _benignCatachables[catachableIndex];
|
||||||
|
|
||||||
float ratio = ((float)rand() / (float)RAND_MAX);
|
float ratio = ((float)rand() / (float)RAND_MAX);
|
||||||
@@ -1356,7 +1356,7 @@ void GameEventHandler::createNewCatchable()
|
|||||||
float r = (float)rand() / (float)RAND_MAX;
|
float r = (float)rand() / (float)RAND_MAX;
|
||||||
if (r < _chanceOfExplodingAtStart)
|
if (r < _chanceOfExplodingAtStart)
|
||||||
{
|
{
|
||||||
catchableObject->explode();
|
catchableObject->explode();
|
||||||
}
|
}
|
||||||
|
|
||||||
_gameGroup->addChild(catchableObject->_object.get());
|
_gameGroup->addChild(catchableObject->_object.get());
|
||||||
@@ -1366,9 +1366,10 @@ class CompileStateCallback : public osg::Operation
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CompileStateCallback(GameEventHandler* eh):
|
CompileStateCallback(GameEventHandler* eh):
|
||||||
|
osg::Referenced(true),
|
||||||
osg::Operation("CompileStateCallback", false),
|
osg::Operation("CompileStateCallback", false),
|
||||||
_gameEventHandler(eh) {}
|
_gameEventHandler(eh) {}
|
||||||
|
|
||||||
virtual void operator () (osg::Object* object)
|
virtual void operator () (osg::Object* object)
|
||||||
{
|
{
|
||||||
osg::GraphicsContext* context = dynamic_cast<osg::GraphicsContext*>(object);
|
osg::GraphicsContext* context = dynamic_cast<osg::GraphicsContext*>(object);
|
||||||
@@ -1379,7 +1380,7 @@ class CompileStateCallback : public osg::Operation
|
|||||||
_gameEventHandler->compileGLObjects(*(context->getState()));
|
_gameEventHandler->compileGLObjects(*(context->getState()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenThreads::Mutex _mutex;
|
OpenThreads::Mutex _mutex;
|
||||||
GameEventHandler* _gameEventHandler;
|
GameEventHandler* _gameEventHandler;
|
||||||
};
|
};
|
||||||
@@ -1389,7 +1390,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use node masks to create stereo images.");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use node masks to create stereo images.");
|
||||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file_left_eye image_file_right_eye");
|
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file_left_eye image_file_right_eye");
|
||||||
@@ -1409,8 +1410,8 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
while (arguments.read("--boy")) seh->addPlayer(GameEventHandler::PLAYER_BOY);
|
while (arguments.read("--boy")) seh->addPlayer(GameEventHandler::PLAYER_BOY);
|
||||||
while (arguments.read("--girl")) seh->addPlayer(GameEventHandler::PLAYER_GIRL);
|
while (arguments.read("--girl")) seh->addPlayer(GameEventHandler::PLAYER_GIRL);
|
||||||
|
|
||||||
|
|
||||||
// if user request help write it out to cout.
|
// if user request help write it out to cout.
|
||||||
if (arguments.read("-h") || arguments.read("--help"))
|
if (arguments.read("-h") || arguments.read("--help"))
|
||||||
{
|
{
|
||||||
@@ -1427,8 +1428,8 @@ int main( int argc, char **argv )
|
|||||||
arguments.writeErrorMessages(std::cout);
|
arguments.writeErrorMessages(std::cout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// enable the image cache so we don't need to keep loading the particle files
|
// enable the image cache so we don't need to keep loading the particle files
|
||||||
osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options;
|
osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options;
|
||||||
options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_IMAGES);
|
options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_IMAGES);
|
||||||
@@ -1453,7 +1454,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
double fovy, aspectRatio, zNear, zFar;
|
double fovy, aspectRatio, zNear, zFar;
|
||||||
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar);
|
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar);
|
||||||
seh->setFOVY(osg::DegreesToRadians(fovy));
|
seh->setFOVY(osg::DegreesToRadians(fovy));
|
||||||
|
|
||||||
// todo for osgViewer - create default set up.
|
// todo for osgViewer - create default set up.
|
||||||
viewer.setUpViewAcrossAllScreens();
|
viewer.setUpViewAcrossAllScreens();
|
||||||
@@ -1471,7 +1472,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// todo for osgViewer - implement warp pointer that can be done relative to different coordinate frames
|
// todo for osgViewer - implement warp pointer that can be done relative to different coordinate frames
|
||||||
// viewer.requestWarpPointer(0.5f,0.5f);
|
// viewer.requestWarpPointer(0.5f,0.5f);
|
||||||
|
|
||||||
while( !viewer.done() )
|
while( !viewer.done() )
|
||||||
{
|
{
|
||||||
@@ -1479,8 +1480,8 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// fire off the cull and draw traversals of the scene.
|
// fire off the cull and draw traversals of the scene.
|
||||||
viewer.frame();
|
viewer.frame();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,10 +40,9 @@
|
|||||||
#include <osgUtil/Optimizer>
|
#include <osgUtil/Optimizer>
|
||||||
|
|
||||||
|
|
||||||
osg::Node* decorate_with_clip_node(osg::Node* subgraph)
|
osg::ref_ptr<osg::Node> decorate_with_clip_node(const osg::ref_ptr<osg::Node>& subgraph)
|
||||||
{
|
{
|
||||||
osg::Group* rootnode = new osg::Group;
|
osg::ref_ptr<osg::Group> rootnode = new osg::Group;
|
||||||
|
|
||||||
|
|
||||||
// create wireframe view of the model so the user can see
|
// create wireframe view of the model so the user can see
|
||||||
// what parts are being culled away.
|
// what parts are being culled away.
|
||||||
@@ -52,7 +51,7 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
|
|||||||
osg::PolygonMode* polymode = new osg::PolygonMode;
|
osg::PolygonMode* polymode = new osg::PolygonMode;
|
||||||
polymode->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE);
|
polymode->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE);
|
||||||
stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
||||||
|
|
||||||
osg::Group* wireframe_subgraph = new osg::Group;
|
osg::Group* wireframe_subgraph = new osg::Group;
|
||||||
wireframe_subgraph->setStateSet(stateset);
|
wireframe_subgraph->setStateSet(stateset);
|
||||||
wireframe_subgraph->addChild(subgraph);
|
wireframe_subgraph->addChild(subgraph);
|
||||||
@@ -80,7 +79,7 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
|
|||||||
// more complex approach to managing ClipNode, allowing
|
// more complex approach to managing ClipNode, allowing
|
||||||
// ClipNode node to be transformed independently from the subgraph
|
// ClipNode node to be transformed independently from the subgraph
|
||||||
// that it is clipping.
|
// that it is clipping.
|
||||||
|
|
||||||
osg::MatrixTransform* transform= new osg::MatrixTransform;
|
osg::MatrixTransform* transform= new osg::MatrixTransform;
|
||||||
|
|
||||||
osg::NodeCallback* nc = new osg::AnimationPathCallback(subgraph->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
osg::NodeCallback* nc = new osg::AnimationPathCallback(subgraph->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||||
@@ -117,11 +116,11 @@ int main( int argc, char **argv )
|
|||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("cow.osgt");
|
||||||
|
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
@@ -129,16 +128,16 @@ int main( int argc, char **argv )
|
|||||||
osg::notify(osg::NOTICE)<<"Please specify a filename on the command line"<<std::endl;
|
osg::notify(osg::NOTICE)<<"Please specify a filename on the command line"<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// decorate the scenegraph with a clip node.
|
// decorate the scenegraph with a clip node.
|
||||||
osg::Node* rootnode = decorate_with_clip_node(loadedModel);
|
osg::ref_ptr<osg::Node> rootnode = decorate_with_clip_node(loadedModel);
|
||||||
|
|
||||||
// run optimization over the scene graph
|
// run optimization over the scene graph
|
||||||
osgUtil::Optimizer optimzer;
|
osgUtil::Optimizer optimzer;
|
||||||
optimzer.optimize(rootnode);
|
optimzer.optimize(rootnode);
|
||||||
|
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
// set the scene to render
|
// set the scene to render
|
||||||
viewer.setSceneData(rootnode);
|
viewer.setSceneData(rootnode);
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,8 @@
|
|||||||
#include <net/soioctl.h>
|
#include <net/soioctl.h>
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#elif defined (__GNU__)
|
||||||
|
#include <unistd.h>
|
||||||
#elif defined(__sun)
|
#elif defined(__sun)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
#include "broadcaster.h"
|
#include "broadcaster.h"
|
||||||
|
|
||||||
|
|
||||||
const unsigned int MAX_NUM_EVENTS = 10;
|
|
||||||
const unsigned int SWAP_BYTES_COMPARE = 0x12345678;
|
const unsigned int SWAP_BYTES_COMPARE = 0x12345678;
|
||||||
class CameraPacket {
|
class CameraPacket {
|
||||||
public:
|
public:
|
||||||
@@ -506,7 +505,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load model.
|
// load model.
|
||||||
osg::ref_ptr<osg::Node> rootnode = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> rootnode = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// set the scene to render
|
// set the scene to render
|
||||||
viewer.setSceneData(rootnode.get());
|
viewer.setSceneData(rootnode.get());
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ void Receiver::sync( void )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ )
|
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || defined(__FreeBSD_kernel__) || defined(__GNU__)
|
||||||
socklen_t size;
|
socklen_t size;
|
||||||
#else
|
#else
|
||||||
int size;
|
int size;
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ int main( int argc, char **argv )
|
|||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> scene = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
if (!scene)
|
if (!scene)
|
||||||
{
|
{
|
||||||
@@ -149,7 +149,7 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
osgViewer::View* view = new osgViewer::View;
|
osgViewer::View* view = new osgViewer::View;
|
||||||
view->setName("Single view");
|
view->setName("Single view");
|
||||||
view->setSceneData(osgDB::readNodeFile("fountain.osgt"));
|
view->setSceneData(osgDB::readRefNodeFile("fountain.osgt"));
|
||||||
|
|
||||||
view->addEventHandler( new osgViewer::StatsHandler );
|
view->addEventHandler( new osgViewer::StatsHandler );
|
||||||
|
|
||||||
@@ -283,7 +283,7 @@ int main( int argc, char **argv )
|
|||||||
view->setName("View three");
|
view->setName("View three");
|
||||||
viewer.addView(view);
|
viewer.addView(view);
|
||||||
|
|
||||||
view->setSceneData(osgDB::readNodeFile("cessnafire.osgt"));
|
view->setSceneData(osgDB::readRefNodeFile("cessnafire.osgt"));
|
||||||
|
|
||||||
view->getCamera()->setName("Cam three");
|
view->getCamera()->setName("Cam three");
|
||||||
view->getCamera()->setProjectionMatrixAsPerspective(30.0, double(traits->width) / double(traits->height/2), 1.0, 1000.0);
|
view->getCamera()->setProjectionMatrixAsPerspective(30.0, double(traits->width) / double(traits->height/2), 1.0, 1000.0);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ static const char* computeSrc = {
|
|||||||
int main( int argc, char** argv )
|
int main( int argc, char** argv )
|
||||||
{
|
{
|
||||||
osg::ArgumentParser arguments( &argc, argv );
|
osg::ArgumentParser arguments( &argc, argv );
|
||||||
|
|
||||||
// Create the texture as both the output of compute shader and the input of a normal quad
|
// Create the texture as both the output of compute shader and the input of a normal quad
|
||||||
osg::ref_ptr<osg::Texture2D> tex2D = new osg::Texture2D;
|
osg::ref_ptr<osg::Texture2D> tex2D = new osg::Texture2D;
|
||||||
tex2D->setTextureSize( 512, 512 );
|
tex2D->setTextureSize( 512, 512 );
|
||||||
@@ -53,23 +53,23 @@ int main( int argc, char** argv )
|
|||||||
tex2D->setSourceFormat( GL_RED );
|
tex2D->setSourceFormat( GL_RED );
|
||||||
tex2D->setSourceType( GL_FLOAT );
|
tex2D->setSourceType( GL_FLOAT );
|
||||||
tex2D->bindToImageUnit( 0, osg::Texture::WRITE_ONLY ); // So we can use 'image2D' in the compute shader
|
tex2D->bindToImageUnit( 0, osg::Texture::WRITE_ONLY ); // So we can use 'image2D' in the compute shader
|
||||||
|
|
||||||
// The compute shader can't work with other kinds of shaders
|
// The compute shader can't work with other kinds of shaders
|
||||||
// It also requires the work group numbers. Setting them to 0 will disable the compute shader
|
// It also requires the work group numbers. Setting them to 0 will disable the compute shader
|
||||||
osg::ref_ptr<osg::Program> computeProg = new osg::Program;
|
osg::ref_ptr<osg::Program> computeProg = new osg::Program;
|
||||||
computeProg->setComputeGroups( 512/16, 512/16, 1 );
|
computeProg->setComputeGroups( 512/16, 512/16, 1 );
|
||||||
computeProg->addShader( new osg::Shader(osg::Shader::COMPUTE, computeSrc) );
|
computeProg->addShader( new osg::Shader(osg::Shader::COMPUTE, computeSrc) );
|
||||||
|
|
||||||
// Create a node for outputting to the texture.
|
// Create a node for outputting to the texture.
|
||||||
// It is OK to have just an empty node here, but seems inbuilt uniforms like osg_FrameTime won't work then.
|
// It is OK to have just an empty node here, but seems inbuilt uniforms like osg_FrameTime won't work then.
|
||||||
// TODO: maybe we can have a custom drawable which also will implement glMemoryBarrier?
|
// TODO: maybe we can have a custom drawable which also will implement glMemoryBarrier?
|
||||||
osg::Node* sourceNode = osgDB::readNodeFile("axes.osgt");
|
osg::ref_ptr<osg::Node> sourceNode = osgDB::readRefNodeFile("axes.osgt");
|
||||||
if ( !sourceNode ) sourceNode = new osg::Node;
|
if ( !sourceNode ) sourceNode = new osg::Node;
|
||||||
sourceNode->setDataVariance( osg::Object::DYNAMIC );
|
sourceNode->setDataVariance( osg::Object::DYNAMIC );
|
||||||
sourceNode->getOrCreateStateSet()->setAttributeAndModes( computeProg.get() );
|
sourceNode->getOrCreateStateSet()->setAttributeAndModes( computeProg.get() );
|
||||||
sourceNode->getOrCreateStateSet()->addUniform( new osg::Uniform("targetTex", (int)0) );
|
sourceNode->getOrCreateStateSet()->addUniform( new osg::Uniform("targetTex", (int)0) );
|
||||||
sourceNode->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
|
sourceNode->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
|
||||||
|
|
||||||
// Display the texture on a quad. We will also be able to operate on the data if reading back to CPU side
|
// Display the texture on a quad. We will also be able to operate on the data if reading back to CPU side
|
||||||
osg::Geometry* geom = osg::createTexturedQuadGeometry(
|
osg::Geometry* geom = osg::createTexturedQuadGeometry(
|
||||||
osg::Vec3(), osg::Vec3(1.0f,0.0f,0.0f), osg::Vec3(0.0f,0.0f,1.0f) );
|
osg::Vec3(), osg::Vec3(1.0f,0.0f,0.0f), osg::Vec3(0.0f,0.0f,1.0f) );
|
||||||
@@ -77,12 +77,12 @@ int main( int argc, char** argv )
|
|||||||
quad->addDrawable( geom );
|
quad->addDrawable( geom );
|
||||||
quad->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
|
quad->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
|
||||||
quad->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
|
quad->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
|
||||||
|
|
||||||
// Create the scene graph and start the viewer
|
// Create the scene graph and start the viewer
|
||||||
osg::ref_ptr<osg::Group> scene = new osg::Group;
|
osg::ref_ptr<osg::Group> scene = new osg::Group;
|
||||||
scene->addChild( sourceNode );
|
scene->addChild( sourceNode );
|
||||||
scene->addChild( quad.get() );
|
scene->addChild( quad.get() );
|
||||||
|
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||||
viewer.addEventHandler( new osgViewer::StatsHandler );
|
viewer.addEventHandler( new osgViewer::StatsHandler );
|
||||||
|
|||||||
@@ -33,12 +33,12 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// Customize the CopyOp so that we add our own verbose
|
// Customize the CopyOp so that we add our own verbose
|
||||||
// output of what's being copied.
|
// output of what's being copied.
|
||||||
class MyCopyOp : public osg::CopyOp
|
class MyCopyOp : public osg::CopyOp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
inline MyCopyOp(CopyFlags flags=SHALLOW_COPY):
|
inline MyCopyOp(CopyFlags flags=SHALLOW_COPY):
|
||||||
osg::CopyOp(flags),
|
osg::CopyOp(flags),
|
||||||
_indent(0),
|
_indent(0),
|
||||||
@@ -46,11 +46,11 @@ class MyCopyOp : public osg::CopyOp
|
|||||||
|
|
||||||
inline void moveIn() const { _indent += _step; }
|
inline void moveIn() const { _indent += _step; }
|
||||||
inline void moveOut() const { _indent -= _step; }
|
inline void moveOut() const { _indent -= _step; }
|
||||||
inline void writeIndent() const
|
inline void writeIndent() const
|
||||||
{
|
{
|
||||||
for(int i=0;i<_indent;++i) std::cout << " ";
|
for(int i=0;i<_indent;++i) std::cout << " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual osg::Referenced* operator() (const osg::Referenced* ref) const
|
virtual osg::Referenced* operator() (const osg::Referenced* ref) const
|
||||||
{
|
{
|
||||||
writeIndent(); std::cout << "copying Referenced "<<ref<<std::endl;
|
writeIndent(); std::cout << "copying Referenced "<<ref<<std::endl;
|
||||||
@@ -59,7 +59,7 @@ class MyCopyOp : public osg::CopyOp
|
|||||||
moveOut();
|
moveOut();
|
||||||
return ret_ref;
|
return ret_ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual osg::Object* operator() (const osg::Object* obj) const
|
virtual osg::Object* operator() (const osg::Object* obj) const
|
||||||
{
|
{
|
||||||
writeIndent(); std::cout << "copying Object "<<obj;
|
writeIndent(); std::cout << "copying Object "<<obj;
|
||||||
@@ -70,7 +70,7 @@ class MyCopyOp : public osg::CopyOp
|
|||||||
moveOut();
|
moveOut();
|
||||||
return ret_obj;
|
return ret_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual osg::Node* operator() (const osg::Node* node) const
|
virtual osg::Node* operator() (const osg::Node* node) const
|
||||||
{
|
{
|
||||||
writeIndent(); std::cout << "copying Node "<<node;
|
writeIndent(); std::cout << "copying Node "<<node;
|
||||||
@@ -136,25 +136,25 @@ class MyCopyOp : public osg::CopyOp
|
|||||||
moveOut();
|
moveOut();
|
||||||
return ret_image;
|
return ret_image;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// must be mutable since CopyOp is passed around as const to
|
// must be mutable since CopyOp is passed around as const to
|
||||||
// the various clone/copy constructors.
|
// the various clone/copy constructors.
|
||||||
mutable int _indent;
|
mutable int _indent;
|
||||||
mutable int _step;
|
mutable int _step;
|
||||||
};
|
};
|
||||||
|
|
||||||
// this CopyOp class will preserve the multi-parent structure of the copied
|
// this CopyOp class will preserve the multi-parent structure of the copied
|
||||||
// object, instead of expanding it into a tree. Works with the
|
// object, instead of expanding it into a tree. Works with the
|
||||||
// DEEP_COPY_NODES flag.
|
// DEEP_COPY_NODES flag.
|
||||||
class GraphCopyOp : public osg::CopyOp
|
class GraphCopyOp : public osg::CopyOp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
inline GraphCopyOp(CopyFlags flags=SHALLOW_COPY):
|
inline GraphCopyOp(CopyFlags flags=SHALLOW_COPY):
|
||||||
osg::CopyOp(flags) { _nodeCopyMap.clear();}
|
osg::CopyOp(flags) { _nodeCopyMap.clear();}
|
||||||
|
|
||||||
virtual osg::Node* operator() (const osg::Node* node) const
|
virtual osg::Node* operator() (const osg::Node* node) const
|
||||||
{
|
{
|
||||||
if (node && _flags&DEEP_COPY_NODES)
|
if (node && _flags&DEEP_COPY_NODES)
|
||||||
@@ -180,9 +180,9 @@ class GraphCopyOp : public osg::CopyOp
|
|||||||
else
|
else
|
||||||
return const_cast<osg::Node*>(node);
|
return const_cast<osg::Node*>(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// must be mutable since CopyOp is passed around as const to
|
// must be mutable since CopyOp is passed around as const to
|
||||||
// the various clone/copy constructors.
|
// the various clone/copy constructors.
|
||||||
mutable std::map<const osg::Node*,osg::Node*> _nodeCopyMap;
|
mutable std::map<const osg::Node*,osg::Node*> _nodeCopyMap;
|
||||||
@@ -198,19 +198,19 @@ int main( int argc, char **argv )
|
|||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* rootnode = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> rootnode = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!rootnode)
|
if (!rootnode)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Please specify a model filename on the command line."<<std::endl;
|
osg::notify(osg::NOTICE)<<"Please specify a model filename on the command line."<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// run optimization over the scene graph
|
// run optimization over the scene graph
|
||||||
osgUtil::Optimizer optimzer;
|
osgUtil::Optimizer optimzer;
|
||||||
optimzer.optimize(rootnode);
|
optimzer.optimize(rootnode);
|
||||||
|
|
||||||
// ------------- Start of copy specific code -------------------------------------------------------
|
// ------------- Start of copy specific code -------------------------------------------------------
|
||||||
|
|
||||||
// do a deep copy, using MyCopyOp to reveal whats going on under the hood,
|
// do a deep copy, using MyCopyOp to reveal whats going on under the hood,
|
||||||
// in your own code you'd typically just use the basic osg::CopyOp something like
|
// in your own code you'd typically just use the basic osg::CopyOp something like
|
||||||
osg::ref_ptr<osg::Node> mycopy = dynamic_cast<osg::Node*>(rootnode->clone(osg::CopyOp::DEEP_COPY_ALL));
|
osg::ref_ptr<osg::Node> mycopy = dynamic_cast<osg::Node*>(rootnode->clone(osg::CopyOp::DEEP_COPY_ALL));
|
||||||
@@ -219,7 +219,7 @@ int main( int argc, char **argv )
|
|||||||
// note, we need the dyanmic_cast because MS Visual Studio can't handle covarient
|
// note, we need the dyanmic_cast because MS Visual Studio can't handle covarient
|
||||||
// return types, so that clone has return just Object*. bahh hum bug
|
// return types, so that clone has return just Object*. bahh hum bug
|
||||||
osg::ref_ptr<osg::Node> deep_copy = dynamic_cast<osg::Node*>(rootnode->clone(MyCopyOp(osg::CopyOp::DEEP_COPY_ALL)));
|
osg::ref_ptr<osg::Node> deep_copy = dynamic_cast<osg::Node*>(rootnode->clone(MyCopyOp(osg::CopyOp::DEEP_COPY_ALL)));
|
||||||
|
|
||||||
std::cout << "----------------------------------------------------------------"<<std::endl;
|
std::cout << "----------------------------------------------------------------"<<std::endl;
|
||||||
|
|
||||||
// do a graph preserving deep copy.
|
// do a graph preserving deep copy.
|
||||||
@@ -260,18 +260,18 @@ int main( int argc, char **argv )
|
|||||||
// DEEP_COPY_IMAGES = 64,
|
// DEEP_COPY_IMAGES = 64,
|
||||||
// DEEP_COPY_ALL = 0xffffffff
|
// DEEP_COPY_ALL = 0xffffffff
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// These options you can use together such as :
|
// These options you can use together such as :
|
||||||
// osg::Node* mycopy = dynamic_cast<osg::Node*>(rootnode->clone(osg::CopyOp::DEEP_COPY_NODES | DEEP_COPY_DRAWABLES));
|
// osg::Node* mycopy = dynamic_cast<osg::Node*>(rootnode->clone(osg::CopyOp::DEEP_COPY_NODES | DEEP_COPY_DRAWABLES));
|
||||||
// Which shares state but creates copies of all nodes and drawables (which contain the geometry).
|
// Which shares state but creates copies of all nodes and drawables (which contain the geometry).
|
||||||
//
|
//
|
||||||
// You may also want to subclass from CopyOp to provide finer grained control of what gets shared (shallow copy) vs
|
// You may also want to subclass from CopyOp to provide finer grained control of what gets shared (shallow copy) vs
|
||||||
// cloned (deep copy).
|
// cloned (deep copy).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ------------- End of copy specific code -------------------------------------------------------
|
// ------------- End of copy specific code -------------------------------------------------------
|
||||||
|
|
||||||
// set the scene to render
|
// set the scene to render
|
||||||
viewer.setSceneData(rootnode);
|
viewer.setSceneData(rootnode);
|
||||||
|
|
||||||
|
|||||||
@@ -95,10 +95,10 @@ int main(int argc, char *argv[])
|
|||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* rootnode = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> rootnode = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!rootnode) rootnode = osgDB::readNodeFile("cessna.osgt");
|
if (!rootnode) rootnode = osgDB::readRefNodeFile("cessna.osgt");
|
||||||
|
|
||||||
if (!rootnode)
|
if (!rootnode)
|
||||||
{
|
{
|
||||||
@@ -107,7 +107,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create specular highlights
|
// create specular highlights
|
||||||
create_specular_highlights(rootnode);
|
create_specular_highlights(rootnode.get());
|
||||||
|
|
||||||
// run optimization over the scene graph
|
// run optimization over the scene graph
|
||||||
osgUtil::Optimizer optimzer;
|
osgUtil::Optimizer optimzer;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This application is open source and may be redistributed and/or modified
|
* This application is open source and may be redistributed and/or modified
|
||||||
* freely and without restriction, both in commercial and non commercial applications,
|
* freely and without restriction, both in commercial and non commercial applications,
|
||||||
* as long as this copyright notice is maintained.
|
* as long as this copyright notice is maintained.
|
||||||
*
|
*
|
||||||
* This application is distributed in the hope that it will be useful,
|
* This application is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
@@ -50,7 +50,7 @@ int main(int argc, char** argv)
|
|||||||
arguments.getApplicationUsage()->write(std::cout, helpType);
|
arguments.getApplicationUsage()->write(std::cout, helpType);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// report any errors if they have occurred when parsing the program arguments.
|
// report any errors if they have occurred when parsing the program arguments.
|
||||||
if (arguments.errors())
|
if (arguments.errors())
|
||||||
{
|
{
|
||||||
@@ -81,7 +81,7 @@ int main(int argc, char** argv)
|
|||||||
while (arguments.read("-p",pathfile))
|
while (arguments.read("-p",pathfile))
|
||||||
{
|
{
|
||||||
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||||
if (apm || !apm->valid())
|
if (apm || !apm->valid())
|
||||||
{
|
{
|
||||||
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
||||||
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
||||||
@@ -95,13 +95,13 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
// add the state manipulator
|
// add the state manipulator
|
||||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||||
|
|
||||||
// add the thread model handler
|
// add the thread model handler
|
||||||
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
||||||
|
|
||||||
// add the window size toggle handler
|
// add the window size toggle handler
|
||||||
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
||||||
|
|
||||||
// add the stats handler
|
// add the stats handler
|
||||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||||
|
|
||||||
@@ -129,8 +129,8 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
|
|
||||||
// load the data
|
// load the data
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile(file);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFile(file);
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ public:
|
|||||||
osg::StateSet *dstate= gm->getOrCreateStateSet( );
|
osg::StateSet *dstate= gm->getOrCreateStateSet( );
|
||||||
dstate->setMode( GL_LIGHTING, osg::StateAttribute::ON );
|
dstate->setMode( GL_LIGHTING, osg::StateAttribute::ON );
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile("Images/Brick-Std-Orange.TGA");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Images/Brick-Std-Orange.TGA");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* txt = new osg::Texture2D;
|
osg::Texture2D* txt = new osg::Texture2D;
|
||||||
@@ -354,7 +354,7 @@ osg::Group *makedelaunay(const int ndcs)
|
|||||||
|
|
||||||
osg::Vec3Array *points=new osg::Vec3Array;
|
osg::Vec3Array *points=new osg::Vec3Array;
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile("Images/blueFlowers.png");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Images/blueFlowers.png");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* texture = new osg::Texture2D;
|
osg::Texture2D* texture = new osg::Texture2D;
|
||||||
@@ -817,7 +817,7 @@ osg::Geometry *WallConstraint::makeWallGeometry() const
|
|||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry; // the wall
|
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry; // the wall
|
||||||
if (texture!="") {
|
if (texture!="") {
|
||||||
osg::Image* image = osgDB::readImageFile(texture.c_str());
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(texture.c_str());
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* txt = new osg::Texture2D;
|
osg::Texture2D* txt = new osg::Texture2D;
|
||||||
@@ -1005,7 +1005,7 @@ deprecated_osg::Geometry *ArealConstraint::makeWallGeometry( osg::Vec3Array *pt)
|
|||||||
tscx->retessellatePolygons(*(edges)); // find all edges
|
tscx->retessellatePolygons(*(edges)); // find all edges
|
||||||
|
|
||||||
if (walltexture!="") {
|
if (walltexture!="") {
|
||||||
osg::Image* image = osgDB::readImageFile(walltexture.c_str());
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(walltexture.c_str());
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* txt = new osg::Texture2D;
|
osg::Texture2D* txt = new osg::Texture2D;
|
||||||
@@ -1062,7 +1062,7 @@ deprecated_osg::Geometry * ArealConstraint::makeAreal( osg::Vec3Array *points)
|
|||||||
gm->setNormalArray(getCanopyNormals(points));
|
gm->setNormalArray(getCanopyNormals(points));
|
||||||
gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
|
gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
|
||||||
gm->setTexCoordArray(0,getCanopyTexcoords(points));
|
gm->setTexCoordArray(0,getCanopyTexcoords(points));
|
||||||
osg::Image* image = osgDB::readImageFile(texture);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(texture);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* txt = new osg::Texture2D;
|
osg::Texture2D* txt = new osg::Texture2D;
|
||||||
@@ -1238,7 +1238,7 @@ deprecated_osg::Geometry * LinearConstraint::makeGeometry(const osg::Vec3Array *
|
|||||||
if (_midline->size()>0) {
|
if (_midline->size()>0) {
|
||||||
osg::ref_ptr<osg::Vec3Array> locpts=getPoints(points);
|
osg::ref_ptr<osg::Vec3Array> locpts=getPoints(points);
|
||||||
if (texture!="") {
|
if (texture!="") {
|
||||||
osg::Image* image = osgDB::readImageFile(texture.c_str());
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(texture.c_str());
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* txt = new osg::Texture2D;
|
osg::Texture2D* txt = new osg::Texture2D;
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ int main( int argc, char **argv )
|
|||||||
bool needToSetHomePosition = false;
|
bool needToSetHomePosition = false;
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> scene = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if one hasn't been loaded create an earth and sun test model.
|
// if one hasn't been loaded create an earth and sun test model.
|
||||||
if (!scene)
|
if (!scene)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "DePee.h"
|
#include "DePee.h"
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Handles keyboard events.
|
Handles keyboard events.
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
class KeyboardEventHandler : public osgGA::GUIEventHandler
|
class KeyboardEventHandler : public osgGA::GUIEventHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
KeyboardEventHandler(DePee* dePee)
|
KeyboardEventHandler(DePee* dePee)
|
||||||
{
|
{
|
||||||
_apc = 0;
|
_apc = 0;
|
||||||
@@ -41,12 +41,12 @@ public:
|
|||||||
_dePee->setSketchy(_sketchy);
|
_dePee->setSketchy(_sketchy);
|
||||||
_dePee->setColored(_colored);
|
_dePee->setColored(_colored);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
||||||
{
|
{
|
||||||
switch(ea.getEventType())
|
switch(ea.getEventType())
|
||||||
{
|
{
|
||||||
|
|
||||||
case(osgGA::GUIEventAdapter::KEYDOWN):
|
case(osgGA::GUIEventAdapter::KEYDOWN):
|
||||||
{
|
{
|
||||||
if (ea.getKey()==osgGA::GUIEventAdapter::KEY_Space)
|
if (ea.getKey()==osgGA::GUIEventAdapter::KEY_Space)
|
||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
_dePee->setSketchy(_sketchy);
|
_dePee->setSketchy(_sketchy);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (ea.getKey() == 'e')
|
else if (ea.getKey() == 'e')
|
||||||
{
|
{
|
||||||
_edgy = !_edgy;
|
_edgy = !_edgy;
|
||||||
@@ -106,13 +106,13 @@ public:
|
|||||||
_crayon = !_crayon;
|
_crayon = !_crayon;
|
||||||
_dePee->setCrayon(_crayon);
|
_dePee->setCrayon(_crayon);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -139,12 +139,12 @@ private:
|
|||||||
class MouseEventHandler : public osgGA::GUIEventHandler
|
class MouseEventHandler : public osgGA::GUIEventHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MouseEventHandler(DePee* dePee)
|
MouseEventHandler(DePee* dePee)
|
||||||
{
|
{
|
||||||
_dePee = dePee;
|
_dePee = dePee;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
||||||
{
|
{
|
||||||
switch(ea.getEventType())
|
switch(ea.getEventType())
|
||||||
@@ -152,17 +152,17 @@ public:
|
|||||||
//mouse
|
//mouse
|
||||||
case(osgGA::GUIEventAdapter::DRAG):
|
case(osgGA::GUIEventAdapter::DRAG):
|
||||||
{
|
{
|
||||||
rotate(ea.getXnormalized(), ea.getYnormalized());
|
rotate(ea.getXnormalized(), ea.getYnormalized());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(osgGA::GUIEventAdapter::MOVE):
|
case(osgGA::GUIEventAdapter::MOVE):
|
||||||
_prevX = ea.getXnormalized();
|
_prevX = ea.getXnormalized();
|
||||||
_prevY = ea.getYnormalized();
|
_prevY = ea.getYnormalized();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -175,25 +175,25 @@ private:
|
|||||||
void rotate(float x, float y)
|
void rotate(float x, float y)
|
||||||
{
|
{
|
||||||
osg::Matrix baseMatrix = _modelGroupTransform->getMatrix();
|
osg::Matrix baseMatrix = _modelGroupTransform->getMatrix();
|
||||||
|
|
||||||
baseMatrix.preMultTranslate(_rotCenter);
|
baseMatrix.preMultTranslate(_rotCenter);
|
||||||
baseMatrix.preMultRotate(osg::Quat((x - _prevX) * 3, osg::Vec3d(0.0, 0.0, 1.0)));
|
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.preMultRotate(osg::Quat(-(y - _prevY) * 3, (baseMatrix * osg::Vec3d(1.0, 0.0, 0.0))));
|
||||||
baseMatrix.preMultTranslate(-_rotCenter);
|
baseMatrix.preMultTranslate(-_rotCenter);
|
||||||
|
|
||||||
_modelGroupTransform->setMatrix(baseMatrix);
|
_modelGroupTransform->setMatrix(baseMatrix);
|
||||||
|
|
||||||
_prevX = x;
|
_prevX = x;
|
||||||
_prevY = y;
|
_prevY = y;
|
||||||
};
|
};
|
||||||
|
|
||||||
DePee* _dePee;
|
DePee* _dePee;
|
||||||
|
|
||||||
float _prevX;
|
float _prevX;
|
||||||
float _prevY;
|
float _prevY;
|
||||||
|
|
||||||
osg::Vec3 _rotCenter;
|
osg::Vec3 _rotCenter;
|
||||||
osg::MatrixTransform* _modelGroupTransform;
|
osg::MatrixTransform* _modelGroupTransform;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -202,25 +202,25 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates Depth Peeling");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates Depth Peeling");
|
||||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" filename");
|
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" filename");
|
||||||
|
|
||||||
|
|
||||||
// construct the viewer
|
// construct the viewer
|
||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
// any option left unread are converted into errors to write out later.
|
// any option left unread are converted into errors to write out later.
|
||||||
arguments.reportRemainingOptionsAsUnrecognized();
|
arguments.reportRemainingOptionsAsUnrecognized();
|
||||||
|
|
||||||
// report any errors if they have occurred when parsing the program arguments.
|
// report any errors if they have occurred when parsing the program arguments.
|
||||||
if (arguments.errors())
|
if (arguments.errors())
|
||||||
{
|
{
|
||||||
arguments.writeErrorMessages(std::cout);
|
arguments.writeErrorMessages(std::cout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arguments.argc()<=1 || arguments.argc() > 3)
|
if (arguments.argc()<=1 || arguments.argc() > 3)
|
||||||
{
|
{
|
||||||
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
||||||
@@ -232,29 +232,29 @@ int main( int argc, char **argv )
|
|||||||
viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
|
viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
|
||||||
|
|
||||||
// read the model to do depth peeling with
|
// read the model to do depth peeling with
|
||||||
osg::Node* loadedModel = osgDB::readNodeFile(arguments.argv()[1]);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFile(arguments.argv()[1]);
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
// create a transform to spin the model.
|
// create a transform to spin the model.
|
||||||
osg::MatrixTransform* modelGroupTransform = new osg::MatrixTransform;
|
osg::MatrixTransform* modelGroupTransform = new osg::MatrixTransform;
|
||||||
osg::Group* modelGroup = new osg::Group;
|
osg::Group* modelGroup = new osg::Group;
|
||||||
modelGroupTransform->addChild(modelGroup);
|
modelGroupTransform->addChild(modelGroup);
|
||||||
modelGroup->addChild(loadedModel);
|
modelGroup->addChild(loadedModel);
|
||||||
|
|
||||||
osg::Group* rootNode = new osg::Group();
|
osg::Group* rootNode = new osg::Group();
|
||||||
|
|
||||||
// add model to the viewer.
|
// add model to the viewer.
|
||||||
viewer.setSceneData(rootNode);
|
viewer.setSceneData(rootNode);
|
||||||
|
|
||||||
// Depth peel example only works on a single graphics context right now
|
// Depth peel example only works on a single graphics context right now
|
||||||
// so open up viewer on single screen to prevent problems
|
// so open up viewer on single screen to prevent problems
|
||||||
viewer.setUpViewOnSingleScreen(0);
|
viewer.setUpViewOnSingleScreen(0);
|
||||||
|
|
||||||
// create the windows and run the threads.
|
// create the windows and run the threads.
|
||||||
viewer.realize();
|
viewer.realize();
|
||||||
|
|
||||||
unsigned int width = 1280;
|
unsigned int width = 1280;
|
||||||
unsigned int height = 1280;
|
unsigned int height = 1280;
|
||||||
osgViewer::Viewer::Windows windows;
|
osgViewer::Viewer::Windows windows;
|
||||||
@@ -266,11 +266,11 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
osg::ref_ptr<DePee> dePee = new DePee(rootNode,
|
osg::ref_ptr<DePee> dePee = new DePee(rootNode,
|
||||||
modelGroupTransform,
|
modelGroupTransform,
|
||||||
width,
|
width,
|
||||||
height);
|
height);
|
||||||
|
|
||||||
//create event handlers
|
//create event handlers
|
||||||
KeyboardEventHandler* keyboardEventHandler = new KeyboardEventHandler(dePee.get());
|
KeyboardEventHandler* keyboardEventHandler = new KeyboardEventHandler(dePee.get());
|
||||||
MouseEventHandler* mouseEventHandler = new MouseEventHandler(dePee.get());
|
MouseEventHandler* mouseEventHandler = new MouseEventHandler(dePee.get());
|
||||||
@@ -278,7 +278,7 @@ int main( int argc, char **argv )
|
|||||||
viewer.addEventHandler(mouseEventHandler);
|
viewer.addEventHandler(mouseEventHandler);
|
||||||
|
|
||||||
//viewer.setCameraManipulator(new osgGA::TrackballManipulator);
|
//viewer.setCameraManipulator(new osgGA::TrackballManipulator);
|
||||||
|
|
||||||
osg::StateSet* stateset = modelGroupTransform->getOrCreateStateSet();
|
osg::StateSet* stateset = modelGroupTransform->getOrCreateStateSet();
|
||||||
|
|
||||||
stateset->setMode(GL_BLEND, osg::StateAttribute::OFF);
|
stateset->setMode(GL_BLEND, osg::StateAttribute::OFF);
|
||||||
@@ -287,15 +287,15 @@ int main( int argc, char **argv )
|
|||||||
osg::AnimationPathCallback* apc = new osg::AnimationPathCallback(modelGroupTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
osg::AnimationPathCallback* apc = new osg::AnimationPathCallback(modelGroupTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||||
apc->setPause(true);
|
apc->setPause(true);
|
||||||
modelGroupTransform->setUpdateCallback(apc);
|
modelGroupTransform->setUpdateCallback(apc);
|
||||||
|
|
||||||
keyboardEventHandler->registerAnimationPathCallback(apc);
|
keyboardEventHandler->registerAnimationPathCallback(apc);
|
||||||
mouseEventHandler->registerModelGroupTransform(modelGroupTransform);
|
mouseEventHandler->registerModelGroupTransform(modelGroupTransform);
|
||||||
|
|
||||||
//setup stuff that is necessary for measuring fps
|
//setup stuff that is necessary for measuring fps
|
||||||
osg::Timer_t current_tick, previous_tick = 1;
|
osg::Timer_t current_tick, previous_tick = 1;
|
||||||
double* fps = new double;
|
double* fps = new double;
|
||||||
dePee->setFPS(fps);
|
dePee->setFPS(fps);
|
||||||
|
|
||||||
while(!viewer.done())
|
while(!viewer.done())
|
||||||
{
|
{
|
||||||
current_tick = osg::Timer::instance()->tick();
|
current_tick = osg::Timer::instance()->tick();
|
||||||
|
|||||||
@@ -703,10 +703,10 @@ int main(int argc, char** argv)
|
|||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("cow.osgt");
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
@@ -731,7 +731,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
osg::Node* distortionNode = createDistortionSubgraph( options, loadedModel, viewer.getCamera()->getClearColor());
|
osg::Node* distortionNode = createDistortionSubgraph( options, loadedModel.get(), viewer.getCamera()->getClearColor());
|
||||||
viewer.setSceneData( distortionNode );
|
viewer.setSceneData( distortionNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ createStateSet()
|
|||||||
ss->setAttribute( program.get(),
|
ss->setAttribute( program.get(),
|
||||||
osg::StateAttribute::ON | osg::StateAttribute::PROTECTED );
|
osg::StateAttribute::ON | osg::StateAttribute::PROTECTED );
|
||||||
|
|
||||||
osg::ref_ptr< osg::Image> iLogo = osgDB::readImageFile( "Images/osg128.png" );
|
osg::ref_ptr< osg::Image> iLogo = osgDB::readRefImageFile( "Images/osg128.png" );
|
||||||
if( !iLogo.valid() )
|
if( !iLogo.valid() )
|
||||||
{
|
{
|
||||||
osg::notify( osg::ALWAYS ) << "Can't open image file osg128.png" << std::endl;
|
osg::notify( osg::ALWAYS ) << "Can't open image file osg128.png" << std::endl;
|
||||||
|
|||||||
@@ -44,21 +44,21 @@ osg::Node* createEarth()
|
|||||||
osg::TessellationHints* hints = new osg::TessellationHints;
|
osg::TessellationHints* hints = new osg::TessellationHints;
|
||||||
hints->setDetailRatio(5.0f);
|
hints->setDetailRatio(5.0f);
|
||||||
|
|
||||||
|
|
||||||
osg::ShapeDrawable* sd = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0,0.0,0.0), osg::WGS_84_RADIUS_POLAR), hints);
|
osg::ShapeDrawable* sd = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0,0.0,0.0), osg::WGS_84_RADIUS_POLAR), hints);
|
||||||
|
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
geode->addDrawable(sd);
|
geode->addDrawable(sd);
|
||||||
|
|
||||||
std::string filename = osgDB::findDataFile("Images/land_shallow_topo_2048.jpg");
|
std::string filename = osgDB::findDataFile("Images/land_shallow_topo_2048.jpg");
|
||||||
geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, new osg::Texture2D(osgDB::readImageFile(filename)));
|
geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, new osg::Texture2D(osgDB::readRefImageFile(filename)));
|
||||||
|
|
||||||
osg::CoordinateSystemNode* csn = new osg::CoordinateSystemNode;
|
osg::CoordinateSystemNode* csn = new osg::CoordinateSystemNode;
|
||||||
csn->setEllipsoidModel(new osg::EllipsoidModel());
|
csn->setEllipsoidModel(new osg::EllipsoidModel());
|
||||||
csn->addChild(geode);
|
csn->addChild(geode);
|
||||||
|
|
||||||
return csn;
|
return csn;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
osgText::Text* createText(osg::EllipsoidModel* ellipsoid, double latitude, double longitude, double height, const std::string& str)
|
osgText::Text* createText(osg::EllipsoidModel* ellipsoid, double latitude, double longitude, double height, const std::string& str)
|
||||||
@@ -78,7 +78,7 @@ osgText::Text* createText(osg::EllipsoidModel* ellipsoid, double latitude, doubl
|
|||||||
text->setCharacterSize(300000.0f);
|
text->setCharacterSize(300000.0f);
|
||||||
text->setCharacterSizeMode(osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
|
text->setCharacterSizeMode(osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
|
||||||
text->setAutoRotateToScreen(true);
|
text->setAutoRotateToScreen(true);
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,10 +87,10 @@ osg::Node* createFadeText(osg::EllipsoidModel* ellipsoid)
|
|||||||
osg::Group* group = new osg::Group;
|
osg::Group* group = new osg::Group;
|
||||||
|
|
||||||
group->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
|
group->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
|
||||||
|
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
group->addChild(geode);
|
group->addChild(geode);
|
||||||
|
|
||||||
std::vector<std::string> textList;
|
std::vector<std::string> textList;
|
||||||
textList.push_back("Town");
|
textList.push_back("Town");
|
||||||
textList.push_back("City");
|
textList.push_back("City");
|
||||||
@@ -99,7 +99,7 @@ osg::Node* createFadeText(osg::EllipsoidModel* ellipsoid)
|
|||||||
textList.push_back("Mountain");
|
textList.push_back("Mountain");
|
||||||
textList.push_back("Road");
|
textList.push_back("Road");
|
||||||
textList.push_back("Lake");
|
textList.push_back("Lake");
|
||||||
|
|
||||||
unsigned int numLat = 15;
|
unsigned int numLat = 15;
|
||||||
unsigned int numLong = 20;
|
unsigned int numLong = 20;
|
||||||
double latitude = 0.0;
|
double latitude = 0.0;
|
||||||
@@ -118,7 +118,7 @@ osg::Node* createFadeText(osg::EllipsoidModel* ellipsoid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
@@ -128,10 +128,10 @@ int main(int, char**)
|
|||||||
|
|
||||||
viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::COMPUTE_NEAR_FAR_USING_PRIMITIVES);
|
viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::COMPUTE_NEAR_FAR_USING_PRIMITIVES);
|
||||||
viewer.getCamera()->setNearFarRatio(0.00001f);
|
viewer.getCamera()->setNearFarRatio(0.00001f);
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> root = createEarth();
|
osg::ref_ptr<osg::Node> root = createEarth();
|
||||||
|
|
||||||
if (!root) return 0;
|
if (!root) return 0;
|
||||||
|
|
||||||
// add a viewport to the viewer and attach the scene graph.
|
// add a viewport to the viewer and attach the scene graph.
|
||||||
@@ -142,7 +142,7 @@ int main(int, char**)
|
|||||||
{
|
{
|
||||||
// add fade text around the globe
|
// add fade text around the globe
|
||||||
csn->addChild(createFadeText(csn->getEllipsoidModel()));
|
csn->addChild(createFadeText(csn->getEllipsoidModel()));
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer.setCameraManipulator(new osgGA::TerrainManipulator);
|
viewer.setCameraManipulator(new osgGA::TerrainManipulator);
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ osgText::Text* createLabel(const std::string& l, const char* f, unsigned int siz
|
|||||||
static osg::Vec3 pos(10.0f, 10.0f, 0.0f);
|
static osg::Vec3 pos(10.0f, 10.0f, 0.0f);
|
||||||
|
|
||||||
osgText::Text* label = new osgText::Text();
|
osgText::Text* label = new osgText::Text();
|
||||||
osgText::Font* font = osgText::readFontFile(f);
|
osg::ref_ptr<osgText::Font> font = osgText::readRefFontFile(f);
|
||||||
|
|
||||||
label->setFont(font);
|
label->setFont(font);
|
||||||
label->setCharacterSize(size);
|
label->setCharacterSize(size);
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ osg::Geode* ForestTechniqueManager::createTerrain(const osg::Vec3& origin, const
|
|||||||
// ---------------------------------------
|
// ---------------------------------------
|
||||||
osg::StateSet* stateset = new osg::StateSet();
|
osg::StateSet* stateset = new osg::StateSet();
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile("Images/lz.rgb");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Images/lz.rgb");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* texture = new osg::Texture2D;
|
osg::Texture2D* texture = new osg::Texture2D;
|
||||||
@@ -1182,7 +1182,7 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates, u
|
|||||||
osg::Texture2D *tex = new osg::Texture2D;
|
osg::Texture2D *tex = new osg::Texture2D;
|
||||||
tex->setWrap( osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP );
|
tex->setWrap( osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP );
|
||||||
tex->setWrap( osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP );
|
tex->setWrap( osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP );
|
||||||
tex->setImage(osgDB::readImageFile("Images/tree0.rgba"));
|
tex->setImage(osgDB::readRefImageFile("Images/tree0.rgba"));
|
||||||
|
|
||||||
osg::StateSet *dstate = new osg::StateSet;
|
osg::StateSet *dstate = new osg::StateSet;
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -963,7 +963,7 @@ int main(int argc, char **argv)
|
|||||||
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ref_ptr<Node> loadedModel = osgDB::readNodeFiles(arguments);
|
ref_ptr<Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!loadedModel) {
|
if (!loadedModel) {
|
||||||
cerr << "couldn't load " << argv[1] << "\n";
|
cerr << "couldn't load " << argv[1] << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public:
|
|||||||
for (osgFX::Registry::EffectMap::const_iterator i=emap.begin(); i!=emap.end(); ++i) {
|
for (osgFX::Registry::EffectMap::const_iterator i=emap.begin(); i!=emap.end(); ++i) {
|
||||||
std::cout << "INFO: \t" << i->first << "\n";
|
std::cout << "INFO: \t" << i->first << "\n";
|
||||||
osg::ref_ptr<osgFX::Effect> effect = static_cast<osgFX::Effect *>(i->second->cloneType());
|
osg::ref_ptr<osgFX::Effect> effect = static_cast<osgFX::Effect *>(i->second->cloneType());
|
||||||
_effects.push_back(effect.get());
|
_effects.push_back(effect.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "INFO: " << emap.size() << " effect(s) ready.\n";
|
std::cout << "INFO: " << emap.size() << " effect(s) ready.\n";
|
||||||
@@ -144,9 +144,9 @@ public:
|
|||||||
inline void setScene(osg::Node* node) { _scene = node; }
|
inline void setScene(osg::Node* node) { _scene = node; }
|
||||||
|
|
||||||
inline bool getEffectsEnabled() const { return _fxen; }
|
inline bool getEffectsEnabled() const { return _fxen; }
|
||||||
inline void setEffectsEnabled(bool v)
|
inline void setEffectsEnabled(bool v)
|
||||||
{
|
{
|
||||||
_fxen = v;
|
_fxen = v;
|
||||||
if (getSelectedEffect()) {
|
if (getSelectedEffect()) {
|
||||||
getSelectedEffect()->setEnabled(_fxen);
|
getSelectedEffect()->setEnabled(_fxen);
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ public:
|
|||||||
inline void setEffectIndex(int i)
|
inline void setEffectIndex(int i)
|
||||||
{
|
{
|
||||||
if (i >= static_cast<int>(_effects.size())) i = 0;
|
if (i >= static_cast<int>(_effects.size())) i = 0;
|
||||||
if (i < 0) i = static_cast<int>(_effects.size()-1);
|
if (i < 0) i = static_cast<int>(_effects.size()-1);
|
||||||
_selected_fx = i;
|
_selected_fx = i;
|
||||||
rebuild();
|
rebuild();
|
||||||
}
|
}
|
||||||
@@ -174,11 +174,11 @@ protected:
|
|||||||
{
|
{
|
||||||
float zPos = -0.1; // note from Robert, was 0.1f, but now must be -0.1f to keep text visible??#!? due
|
float zPos = -0.1; // note from Robert, was 0.1f, but now must be -0.1f to keep text visible??#!? due
|
||||||
// to some other change in the OSG not tracked down yet...
|
// to some other change in the OSG not tracked down yet...
|
||||||
|
|
||||||
osg::ref_ptr<osgText::Font> arial = osgText::readFontFile("fonts/arial.ttf");
|
osg::ref_ptr<osgText::Font> arial = osgText::readRefFontFile("fonts/arial.ttf");
|
||||||
|
|
||||||
osg::ref_ptr<osgText::Text> hints = new osgText::Text;
|
osg::ref_ptr<osgText::Text> hints = new osgText::Text;
|
||||||
hints->setFont(arial.get());
|
hints->setFont(arial);
|
||||||
hints->setColor(_hints_color);
|
hints->setColor(_hints_color);
|
||||||
hints->setAlignment(osgText::Text::CENTER_BOTTOM);
|
hints->setAlignment(osgText::Text::CENTER_BOTTOM);
|
||||||
hints->setCharacterSize(13);
|
hints->setCharacterSize(13);
|
||||||
@@ -195,7 +195,7 @@ protected:
|
|||||||
if (!author_name.empty()) {
|
if (!author_name.empty()) {
|
||||||
effect_description = author_name = "AUTHOR: " + std::string(_effects[_selected_fx]->effectAuthor()) + std::string("\n\n");
|
effect_description = author_name = "AUTHOR: " + std::string(_effects[_selected_fx]->effectAuthor()) + std::string("\n\n");
|
||||||
}
|
}
|
||||||
effect_description += "DESCRIPTION:\n" + std::string(_effects[_selected_fx]->effectDescription());
|
effect_description += "DESCRIPTION:\n" + std::string(_effects[_selected_fx]->effectDescription());
|
||||||
|
|
||||||
if (_scene.valid() && _root.valid()) {
|
if (_scene.valid() && _root.valid()) {
|
||||||
_root->removeChildren(0, _root->getNumChildren());
|
_root->removeChildren(0, _root->getNumChildren());
|
||||||
@@ -268,7 +268,7 @@ EffectPanel* build_gui(osg::Group* root)
|
|||||||
|
|
||||||
osg::ref_ptr<EffectPanel> effect_panel = new EffectPanel;
|
osg::ref_ptr<EffectPanel> effect_panel = new EffectPanel;
|
||||||
effect_panel->setCaption("osgFX Effect Browser");
|
effect_panel->setCaption("osgFX Effect Browser");
|
||||||
effect_panel->setRect(osgfxbrowser::Rect(20, 20, 1000, 280));
|
effect_panel->setRect(osgfxbrowser::Rect(20, 20, 1000, 280));
|
||||||
|
|
||||||
hud->addChild(effect_panel.get());
|
hud->addChild(effect_panel.get());
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@ int main(int argc, char *argv[])
|
|||||||
unsigned int clearMask = viewer.getCamera()->getClearMask();
|
unsigned int clearMask = viewer.getCamera()->getClearMask();
|
||||||
viewer.getCamera()->setClearMask(clearMask | GL_STENCIL_BUFFER_BIT);
|
viewer.getCamera()->setClearMask(clearMask | GL_STENCIL_BUFFER_BIT);
|
||||||
viewer.getCamera()->setClearStencil(0);
|
viewer.getCamera()->setClearStencil(0);
|
||||||
|
|
||||||
// any option left unread are converted into errors to write out later.
|
// any option left unread are converted into errors to write out later.
|
||||||
arguments.reportRemainingOptionsAsUnrecognized();
|
arguments.reportRemainingOptionsAsUnrecognized();
|
||||||
|
|
||||||
@@ -336,11 +336,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("dumptruck.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("dumptruck.osgt");
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
|
|||||||
@@ -117,14 +117,14 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load the image
|
// load the image
|
||||||
osg::ref_ptr<osg::Image> startIm = osgDB::readImageFile(startName);
|
osg::ref_ptr<osg::Image> startIm = osgDB::readRefImageFile(startName);
|
||||||
|
|
||||||
if (!startIm) {
|
if (!startIm) {
|
||||||
std::cout << "Could not load start image.\n";
|
std::cout << "Could not load start image.\n";
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node* scene = createScene(startIm.get());
|
osg::ref_ptr<osg::Node> scene = createScene(startIm.get());
|
||||||
|
|
||||||
// construct the viewer.
|
// construct the viewer.
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|||||||
@@ -550,7 +550,7 @@ osg::Node* createBackground()
|
|||||||
{
|
{
|
||||||
|
|
||||||
// we'll create a texture mapped quad to sit behind the Geometry
|
// we'll create a texture mapped quad to sit behind the Geometry
|
||||||
osg::Image* image = osgDB::readImageFile("Images/primitives.gif");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Images/primitives.gif");
|
||||||
if (!image) return NULL;
|
if (!image) return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -287,4 +287,4 @@ protected:
|
|||||||
unsigned int _currentLodNumber;
|
unsigned int _currentLodNumber;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -434,8 +434,8 @@ int main(int argv, char **argc)
|
|||||||
|
|
||||||
osg::ref_ptr<osg::Group> group = new osg::Group;
|
osg::ref_ptr<osg::Group> group = new osg::Group;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
if (loadedModel.valid()) group->addChild(loadedModel.get());
|
if (loadedModel.valid()) group->addChild(loadedModel);
|
||||||
|
|
||||||
for(Tracks::iterator itr = tracks.begin();
|
for(Tracks::iterator itr = tracks.begin();
|
||||||
itr != tracks.end();
|
itr != tracks.end();
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ class CalibrateCostEsimator : public osg::GraphicsOperation
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
CalibrateCostEsimator(osg::GraphicsCostEstimator* gce):
|
CalibrateCostEsimator(osg::GraphicsCostEstimator* gce):
|
||||||
|
osg::Referenced(true),
|
||||||
osg::GraphicsOperation("CalbirateCostEstimator",false),
|
osg::GraphicsOperation("CalbirateCostEstimator",false),
|
||||||
_gce(gce) {}
|
_gce(gce) {}
|
||||||
|
|
||||||
@@ -51,12 +52,12 @@ int main(int argc, char** argv)
|
|||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> node = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!node) return 0;
|
if (!node) return 0;
|
||||||
|
|
||||||
osg::ref_ptr<osg::GraphicsCostEstimator> gce = new osg::GraphicsCostEstimator;
|
osg::ref_ptr<osg::GraphicsCostEstimator> gce = new osg::GraphicsCostEstimator;
|
||||||
|
|
||||||
viewer.setSceneData(node.get());
|
viewer.setSceneData(node);
|
||||||
|
|
||||||
viewer.realize();
|
viewer.realize();
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ Node *makeBase( void )
|
|||||||
|
|
||||||
Texture2D *tex = new Texture2D;
|
Texture2D *tex = new Texture2D;
|
||||||
|
|
||||||
tex->setImage(osgDB::readImageFile("Images/water.rgb"));
|
tex->setImage(osgDB::readRefImageFile("Images/water.rgb"));
|
||||||
tex->setWrap( Texture2D::WRAP_S, Texture2D::REPEAT );
|
tex->setWrap( Texture2D::WRAP_S, Texture2D::REPEAT );
|
||||||
tex->setWrap( Texture2D::WRAP_T, Texture2D::REPEAT );
|
tex->setWrap( Texture2D::WRAP_T, Texture2D::REPEAT );
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ Node *makeSky( void )
|
|||||||
|
|
||||||
|
|
||||||
Texture2D *tex = new Texture2D;
|
Texture2D *tex = new Texture2D;
|
||||||
tex->setImage(osgDB::readImageFile("Images/white.rgb"));
|
tex->setImage(osgDB::readRefImageFile("Images/white.rgb"));
|
||||||
|
|
||||||
StateSet *dstate = new StateSet;
|
StateSet *dstate = new StateSet;
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ Node *makeTank( void )
|
|||||||
|
|
||||||
for( i = 0; i < c; i++ )
|
for( i = 0; i < c; i++ )
|
||||||
conv( vc[i], mat, vc[i] );
|
conv( vc[i], mat, vc[i] );
|
||||||
|
|
||||||
gset->addPrimitiveSet(new DrawArrays(PrimitiveSet::TRIANGLE_FAN,prev_c,c-prev_c));
|
gset->addPrimitiveSet(new DrawArrays(PrimitiveSet::TRIANGLE_FAN,prev_c,c-prev_c));
|
||||||
|
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ Node *makeTank( void )
|
|||||||
|
|
||||||
tex->setWrap( Texture2D::WRAP_S, Texture2D::REPEAT );
|
tex->setWrap( Texture2D::WRAP_S, Texture2D::REPEAT );
|
||||||
tex->setWrap( Texture2D::WRAP_T, Texture2D::REPEAT );
|
tex->setWrap( Texture2D::WRAP_T, Texture2D::REPEAT );
|
||||||
tex->setImage(osgDB::readImageFile("Images/tank.rgb"));
|
tex->setImage(osgDB::readRefImageFile("Images/tank.rgb"));
|
||||||
|
|
||||||
StateSet *dstate = new StateSet;
|
StateSet *dstate = new StateSet;
|
||||||
dstate->setTextureAttributeAndModes(0, tex, StateAttribute::ON );
|
dstate->setTextureAttributeAndModes(0, tex, StateAttribute::ON );
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ Node *makeTerrain( void )
|
|||||||
|
|
||||||
Texture2D *tex = new Texture2D;
|
Texture2D *tex = new Texture2D;
|
||||||
|
|
||||||
tex->setImage(osgDB::readImageFile("Images/lz.rgb"));
|
tex->setImage(osgDB::readRefImageFile("Images/lz.rgb"));
|
||||||
|
|
||||||
StateSet *dstate = new StateSet;
|
StateSet *dstate = new StateSet;
|
||||||
dstate->setMode( GL_LIGHTING, StateAttribute::OFF );
|
dstate->setMode( GL_LIGHTING, StateAttribute::OFF );
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ Node *makeTrees( void )
|
|||||||
struct _tree *t;
|
struct _tree *t;
|
||||||
|
|
||||||
Texture2D *tex = new Texture2D;
|
Texture2D *tex = new Texture2D;
|
||||||
tex->setImage(osgDB::readImageFile("Images/tree0.rgba"));
|
tex->setImage(osgDB::readRefImageFile("Images/tree0.rgba"));
|
||||||
|
|
||||||
StateSet *dstate = new StateSet;
|
StateSet *dstate = new StateSet;
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ struct SnapeImageHandler : public osgGA::GUIEventHandler
|
|||||||
{
|
{
|
||||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
|
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
|
||||||
osg::Node* node = view ? view->getSceneData() : 0;
|
osg::Node* node = view ? view->getSceneData() : 0;
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
osgDB::writeNodeFile(*node, "hud.osgt");
|
osgDB::writeNodeFile(*node, "hud.osgt");
|
||||||
osgDB::writeNodeFile(*node, "hud.osgb");
|
osgDB::writeNodeFile(*node, "hud.osgb");
|
||||||
@@ -284,10 +284,10 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> scene = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default model instead.
|
// if not loaded assume no arguments passed in, try use default model instead.
|
||||||
if (!scene) scene = osgDB::readNodeFile("dumptruck.osgt");
|
if (!scene) scene = osgDB::readRefNodeFile("dumptruck.osgt");
|
||||||
|
|
||||||
|
|
||||||
if (!scene)
|
if (!scene)
|
||||||
@@ -320,7 +320,7 @@ int main( int argc, char **argv )
|
|||||||
viewer.addSlave(hudCamera, false);
|
viewer.addSlave(hudCamera, false);
|
||||||
|
|
||||||
// set the scene to render
|
// set the scene to render
|
||||||
viewer.setSceneData(scene.get());
|
viewer.setSceneData(scene);
|
||||||
|
|
||||||
return viewer.run();
|
return viewer.run();
|
||||||
|
|
||||||
@@ -334,7 +334,7 @@ int main( int argc, char **argv )
|
|||||||
osgViewer::View* view = new osgViewer::View;
|
osgViewer::View* view = new osgViewer::View;
|
||||||
viewer.addView(view);
|
viewer.addView(view);
|
||||||
|
|
||||||
view->setSceneData(scene.get());
|
view->setSceneData(scene);
|
||||||
view->setUpViewAcrossAllScreens();;
|
view->setUpViewAcrossAllScreens();;
|
||||||
view->setCameraManipulator(new osgGA::TrackballManipulator);
|
view->setCameraManipulator(new osgGA::TrackballManipulator);
|
||||||
|
|
||||||
@@ -375,11 +375,11 @@ int main( int argc, char **argv )
|
|||||||
osg::ref_ptr<osg::Group> group = new osg::Group;
|
osg::ref_ptr<osg::Group> group = new osg::Group;
|
||||||
|
|
||||||
// add the HUD subgraph.
|
// add the HUD subgraph.
|
||||||
if (scene.valid()) group->addChild(scene.get());
|
if (scene.valid()) group->addChild(scene);
|
||||||
group->addChild(createHUD());
|
group->addChild(createHUD());
|
||||||
|
|
||||||
// set the scene to render
|
// set the scene to render
|
||||||
viewer.setSceneData(group.get());
|
viewer.setSceneData(group);
|
||||||
|
|
||||||
return viewer.run();
|
return viewer.run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ static osgDB::DirectoryContents getSuitableFiles(osg::ArgumentParser& arguments)
|
|||||||
{
|
{
|
||||||
const std::string& directory = arguments[i];
|
const std::string& directory = arguments[i];
|
||||||
osgDB::DirectoryContents dc = osgDB::getSortedDirectoryContents(directory);
|
osgDB::DirectoryContents dc = osgDB::getSortedDirectoryContents(directory);
|
||||||
|
|
||||||
for(osgDB::DirectoryContents::iterator itr = dc.begin(); itr != dc.end(); ++itr)
|
for(osgDB::DirectoryContents::iterator itr = dc.begin(); itr != dc.end(); ++itr)
|
||||||
{
|
{
|
||||||
std::string full_file_name = directory + "/" + (*itr);
|
std::string full_file_name = directory + "/" + (*itr);
|
||||||
@@ -76,28 +76,28 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
|
|||||||
osg::ref_ptr<osg::ImageSequence> imageSequence = new osg::ImageSequence;
|
osg::ref_ptr<osg::ImageSequence> imageSequence = new osg::ImageSequence;
|
||||||
|
|
||||||
bool preLoad = true;
|
bool preLoad = true;
|
||||||
|
|
||||||
while (arguments.read("--page-and-discard"))
|
while (arguments.read("--page-and-discard"))
|
||||||
{
|
{
|
||||||
imageSequence->setMode(osg::ImageSequence::PAGE_AND_DISCARD_USED_IMAGES);
|
imageSequence->setMode(osg::ImageSequence::PAGE_AND_DISCARD_USED_IMAGES);
|
||||||
preLoad = false;
|
preLoad = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (arguments.read("--page-and-retain"))
|
while (arguments.read("--page-and-retain"))
|
||||||
{
|
{
|
||||||
imageSequence->setMode(osg::ImageSequence::PAGE_AND_RETAIN_IMAGES);
|
imageSequence->setMode(osg::ImageSequence::PAGE_AND_RETAIN_IMAGES);
|
||||||
preLoad = false;
|
preLoad = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (arguments.read("--preload"))
|
while (arguments.read("--preload"))
|
||||||
{
|
{
|
||||||
imageSequence->setMode(osg::ImageSequence::PRE_LOAD_ALL_IMAGES);
|
imageSequence->setMode(osg::ImageSequence::PRE_LOAD_ALL_IMAGES);
|
||||||
preLoad = true;
|
preLoad = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
double length = -1.0;
|
double length = -1.0;
|
||||||
while (arguments.read("--length",length)) {}
|
while (arguments.read("--length",length)) {}
|
||||||
|
|
||||||
double fps = 30.0;
|
double fps = 30.0;
|
||||||
while (arguments.read("--fps",fps)) {}
|
while (arguments.read("--fps",fps)) {}
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
|
|||||||
const std::string& filename = *itr;
|
const std::string& filename = *itr;
|
||||||
if (preLoad)
|
if (preLoad)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Image> image = osgDB::readImageFile(filename);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(filename);
|
||||||
if (image.valid())
|
if (image.valid())
|
||||||
{
|
{
|
||||||
imageSequence->addImage(image.get());
|
imageSequence->addImage(image.get());
|
||||||
@@ -123,7 +123,7 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length>0.0)
|
if (length>0.0)
|
||||||
{
|
{
|
||||||
imageSequence->setLength(length);
|
imageSequence->setLength(length);
|
||||||
@@ -144,14 +144,14 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
|
|||||||
{
|
{
|
||||||
imageSequence->setLength(4.0);
|
imageSequence->setLength(4.0);
|
||||||
}
|
}
|
||||||
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/posx.png"));
|
imageSequence->addImage(osgDB::readRefImageFile("Cubemap_axis/posx.png"));
|
||||||
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/negx.png"));
|
imageSequence->addImage(osgDB::readRefImageFile("Cubemap_axis/negx.png"));
|
||||||
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/posy.png"));
|
imageSequence->addImage(osgDB::readRefImageFile("Cubemap_axis/posy.png"));
|
||||||
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/negy.png"));
|
imageSequence->addImage(osgDB::readRefImageFile("Cubemap_axis/negy.png"));
|
||||||
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/posz.png"));
|
imageSequence->addImage(osgDB::readRefImageFile("Cubemap_axis/posz.png"));
|
||||||
imageSequence->addImage(osgDB::readImageFile("Cubemap_axis/negz.png"));
|
imageSequence->addImage(osgDB::readRefImageFile("Cubemap_axis/negz.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// start the image sequence playing
|
// start the image sequence playing
|
||||||
imageSequence->play();
|
imageSequence->play();
|
||||||
|
|
||||||
@@ -163,7 +163,7 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
|
|||||||
texture->setResizeNonPowerOfTwoHint(false);
|
texture->setResizeNonPowerOfTwoHint(false);
|
||||||
texture->setImage(imageSequence.get());
|
texture->setImage(imageSequence.get());
|
||||||
//texture->setTextureSize(512,512);
|
//texture->setTextureSize(512,512);
|
||||||
#else
|
#else
|
||||||
osg::TextureRectangle* texture = new osg::TextureRectangle;
|
osg::TextureRectangle* texture = new osg::TextureRectangle;
|
||||||
texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
|
texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
|
||||||
texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
|
texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
|
||||||
@@ -183,12 +183,12 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
|
|||||||
osg::Node* createModel(osg::ArgumentParser& arguments)
|
osg::Node* createModel(osg::ArgumentParser& arguments)
|
||||||
{
|
{
|
||||||
|
|
||||||
// create the geometry of the model, just a simple 2d quad right now.
|
// create the geometry of the model, just a simple 2d quad right now.
|
||||||
osg::Geode* geode = new osg::Geode;
|
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->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(arguments));
|
||||||
|
|
||||||
return geode;
|
return geode;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -200,10 +200,10 @@ class MovieEventHandler : public osgGA::GUIEventHandler
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
MovieEventHandler():_playToggle(true),_trackMouse(false) {}
|
MovieEventHandler():_playToggle(true),_trackMouse(false) {}
|
||||||
|
|
||||||
void setMouseTracking(bool track) { _trackMouse = track; }
|
void setMouseTracking(bool track) { _trackMouse = track; }
|
||||||
bool getMouseTracking() const { return _trackMouse; }
|
bool getMouseTracking() const { return _trackMouse; }
|
||||||
|
|
||||||
void set(osg::Node* node);
|
void set(osg::Node* node);
|
||||||
|
|
||||||
void setTrackMouse(bool tm)
|
void setTrackMouse(bool tm)
|
||||||
@@ -233,20 +233,20 @@ public:
|
|||||||
bool getTrackMouse() const { return _trackMouse; }
|
bool getTrackMouse() const { return _trackMouse; }
|
||||||
|
|
||||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv);
|
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv);
|
||||||
|
|
||||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||||
|
|
||||||
typedef std::vector< osg::observer_ptr<osg::ImageStream> > ImageStreamList;
|
typedef std::vector< osg::observer_ptr<osg::ImageStream> > ImageStreamList;
|
||||||
|
|
||||||
struct ImageStreamPlaybackSpeedData {
|
struct ImageStreamPlaybackSpeedData {
|
||||||
double fps;
|
double fps;
|
||||||
unsigned char* lastData;
|
unsigned char* lastData;
|
||||||
double timeStamp, lastOutput;
|
double timeStamp, lastOutput;
|
||||||
|
|
||||||
ImageStreamPlaybackSpeedData() : fps(0), lastData(NULL), timeStamp(0), lastOutput(0) {}
|
ImageStreamPlaybackSpeedData() : fps(0), lastData(NULL), timeStamp(0), lastOutput(0) {}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector< ImageStreamPlaybackSpeedData > ImageStreamPlayBackSpeedList;
|
typedef std::vector< ImageStreamPlaybackSpeedData > ImageStreamPlayBackSpeedList;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -258,7 +258,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
FindImageStreamsVisitor(ImageStreamList& imageStreamList):
|
FindImageStreamsVisitor(ImageStreamList& imageStreamList):
|
||||||
_imageStreamList(imageStreamList) {}
|
_imageStreamList(imageStreamList) {}
|
||||||
|
|
||||||
virtual void apply(osg::Geode& geode)
|
virtual void apply(osg::Geode& geode)
|
||||||
{
|
{
|
||||||
apply(geode.getStateSet());
|
apply(geode.getStateSet());
|
||||||
@@ -267,7 +267,7 @@ protected:
|
|||||||
{
|
{
|
||||||
apply(geode.getDrawable(i)->getStateSet());
|
apply(geode.getDrawable(i)->getStateSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
traverse(geode);
|
traverse(geode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,11 +276,11 @@ protected:
|
|||||||
apply(node.getStateSet());
|
apply(node.getStateSet());
|
||||||
traverse(node);
|
traverse(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void apply(osg::StateSet* stateset)
|
inline void apply(osg::StateSet* stateset)
|
||||||
{
|
{
|
||||||
if (!stateset) return;
|
if (!stateset) return;
|
||||||
|
|
||||||
osg::StateAttribute* attr = stateset->getTextureAttribute(0,osg::StateAttribute::TEXTURE);
|
osg::StateAttribute* attr = stateset->getTextureAttribute(0,osg::StateAttribute::TEXTURE);
|
||||||
if (attr)
|
if (attr)
|
||||||
{
|
{
|
||||||
@@ -291,20 +291,20 @@ protected:
|
|||||||
if (textureRec) apply(dynamic_cast<osg::ImageStream*>(textureRec->getImage()));
|
if (textureRec) apply(dynamic_cast<osg::ImageStream*>(textureRec->getImage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void apply(osg::ImageStream* imagestream)
|
inline void apply(osg::ImageStream* imagestream)
|
||||||
{
|
{
|
||||||
if (imagestream)
|
if (imagestream)
|
||||||
{
|
{
|
||||||
_imageStreamList.push_back(imagestream);
|
_imageStreamList.push_back(imagestream);
|
||||||
s_imageStream = imagestream;
|
s_imageStream = imagestream;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageStreamList& _imageStreamList;
|
ImageStreamList& _imageStreamList;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
FindImageStreamsVisitor& operator = (const FindImageStreamsVisitor&) { return *this; }
|
FindImageStreamsVisitor& operator = (const FindImageStreamsVisitor&) { return *this; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ protected:
|
|||||||
bool _trackMouse;
|
bool _trackMouse;
|
||||||
ImageStreamList _imageStreamList;
|
ImageStreamList _imageStreamList;
|
||||||
ImageStreamPlayBackSpeedList _imageStreamPlayBackSpeedList;
|
ImageStreamPlayBackSpeedList _imageStreamPlayBackSpeedList;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
|
|||||||
{
|
{
|
||||||
double t = ea.getTime();
|
double t = ea.getTime();
|
||||||
bool printed(false);
|
bool printed(false);
|
||||||
|
|
||||||
ImageStreamPlayBackSpeedList::iterator fps_itr = _imageStreamPlayBackSpeedList.begin();
|
ImageStreamPlayBackSpeedList::iterator fps_itr = _imageStreamPlayBackSpeedList.begin();
|
||||||
for(ImageStreamList::iterator itr=_imageStreamList.begin();
|
for(ImageStreamList::iterator itr=_imageStreamList.begin();
|
||||||
itr!=_imageStreamList.end();
|
itr!=_imageStreamList.end();
|
||||||
@@ -351,17 +351,17 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
|
|||||||
data.lastData = (*itr)->data();
|
data.lastData = (*itr)->data();
|
||||||
data.fps = (*fps_itr).fps * 0.8 + 0.2 * (1/dt);
|
data.fps = (*fps_itr).fps * 0.8 + 0.2 * (1/dt);
|
||||||
data.timeStamp = t;
|
data.timeStamp = t;
|
||||||
|
|
||||||
if (t-data.lastOutput > 1)
|
if (t-data.lastOutput > 1)
|
||||||
{
|
{
|
||||||
std::cout << data.fps << " ";
|
std::cout << data.fps << " ";
|
||||||
data.lastOutput = t;
|
data.lastOutput = t;
|
||||||
printed = true;
|
printed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (printed)
|
if (printed)
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -380,7 +380,7 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
case(osgGA::GUIEventAdapter::KEYDOWN):
|
case(osgGA::GUIEventAdapter::KEYDOWN):
|
||||||
{
|
{
|
||||||
if (ea.getKey()=='p')
|
if (ea.getKey()=='p')
|
||||||
@@ -434,11 +434,11 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (ea.getKey() == 'i')
|
else if (ea.getKey() == 'i')
|
||||||
{
|
{
|
||||||
setTrackMouse(!_trackMouse);
|
setTrackMouse(!_trackMouse);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -479,7 +479,7 @@ int main(int argc, char **argv)
|
|||||||
meh->set( viewer.getSceneData() );
|
meh->set( viewer.getSceneData() );
|
||||||
|
|
||||||
if (arguments.read("--track-mouse")) meh->setTrackMouse(true);
|
if (arguments.read("--track-mouse")) meh->setTrackMouse(true);
|
||||||
|
|
||||||
viewer.addEventHandler( meh );
|
viewer.addEventHandler( meh );
|
||||||
|
|
||||||
viewer.addEventHandler( new osgViewer::StatsHandler());
|
viewer.addEventHandler( new osgViewer::StatsHandler());
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::ref_ptr<osg::Node> model = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> model = osgDB::readRefNodeFiles(arguments);
|
||||||
if (model)
|
if (model)
|
||||||
{
|
{
|
||||||
// the osgSim::InsertImpostorsVisitor used lower down to insert impostors
|
// the osgSim::InsertImpostorsVisitor used lower down to insert impostors
|
||||||
@@ -280,7 +280,7 @@ int main( int argc, char **argv )
|
|||||||
// on it right now as it requires a getRoots() method to be added to
|
// on it right now as it requires a getRoots() method to be added to
|
||||||
// osg::Node, and we're about to make a release so no new features!
|
// osg::Node, and we're about to make a release so no new features!
|
||||||
osg::ref_ptr<osg::Group> rootnode = new osg::Group;
|
osg::ref_ptr<osg::Group> rootnode = new osg::Group;
|
||||||
rootnode->addChild(model.get());
|
rootnode->addChild(model);
|
||||||
|
|
||||||
|
|
||||||
// now insert impostors in the model using the InsertImpostorsVisitor.
|
// now insert impostors in the model using the InsertImpostorsVisitor.
|
||||||
@@ -304,7 +304,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add model to viewer.
|
// add model to viewer.
|
||||||
viewer.setSceneData(model.get());
|
viewer.setSceneData(model);
|
||||||
|
|
||||||
return viewer.run();
|
return viewer.run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ struct MyReadCallback : public osgUtil::IntersectionVisitor::ReadCallback
|
|||||||
{
|
{
|
||||||
virtual osg::Node* readNodeFile(const std::string& filename)
|
virtual osg::Node* readNodeFile(const std::string& filename)
|
||||||
{
|
{
|
||||||
return osgDB::readNodeFile(filename);
|
return osgDB::readRefNodeFile(filename).release();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -47,37 +47,37 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> scene = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
if (!scene)
|
if (!scene)
|
||||||
{
|
{
|
||||||
std::cout<<"No model loaded, please specify a valid model on the command line."<<std::endl;
|
std::cout<<"No model loaded, please specify a valid model on the command line."<<std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout<<"Intersection "<<std::endl;
|
std::cout<<"Intersection "<<std::endl;
|
||||||
|
|
||||||
|
|
||||||
osg::BoundingSphere bs = scene->getBound();
|
osg::BoundingSphere bs = scene->getBound();
|
||||||
|
|
||||||
|
|
||||||
bool useIntersectorGroup = true;
|
bool useIntersectorGroup = true;
|
||||||
bool useLineOfSight = true;
|
bool useLineOfSight = true;
|
||||||
|
|
||||||
//osg::CoordinateSystemNode* csn = dynamic_cast<osg::CoordinateSystemNode*>(scene.get());
|
//osg::CoordinateSystemNode* csn = dynamic_cast<osg::CoordinateSystemNode*>(scene.get());
|
||||||
//osg::EllipsoidModel* em = csn ? csn->getEllipsoidModel() : 0;
|
//osg::EllipsoidModel* em = csn ? csn->getEllipsoidModel() : 0;
|
||||||
|
|
||||||
if (useLineOfSight)
|
if (useLineOfSight)
|
||||||
{
|
{
|
||||||
|
|
||||||
osg::Vec3d start = bs.center() + osg::Vec3d(0.0,bs.radius(),0.0);
|
osg::Vec3d start = bs.center() + osg::Vec3d(0.0,bs.radius(),0.0);
|
||||||
osg::Vec3d end = bs.center() - osg::Vec3d(0.0, bs.radius(),0.0);
|
osg::Vec3d end = bs.center() - osg::Vec3d(0.0, bs.radius(),0.0);
|
||||||
osg::Vec3d deltaRow( 0.0, 0.0, bs.radius()*0.01);
|
osg::Vec3d deltaRow( 0.0, 0.0, bs.radius()*0.01);
|
||||||
osg::Vec3d deltaColumn( bs.radius()*0.01, 0.0, 0.0);
|
osg::Vec3d deltaColumn( bs.radius()*0.01, 0.0, 0.0);
|
||||||
|
|
||||||
osgSim::LineOfSight los;
|
osgSim::LineOfSight los;
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
unsigned int numRows = 20;
|
unsigned int numRows = 20;
|
||||||
unsigned int numColumns = 20;
|
unsigned int numColumns = 20;
|
||||||
@@ -118,7 +118,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// now do a second traversal to test performance of cache.
|
// now do a second traversal to test performance of cache.
|
||||||
osg::Timer_t startTick = osg::Timer::instance()->tick();
|
osg::Timer_t startTick = osg::Timer::instance()->tick();
|
||||||
@@ -173,7 +173,7 @@ int main(int argc, char **argv)
|
|||||||
else if (useIntersectorGroup)
|
else if (useIntersectorGroup)
|
||||||
{
|
{
|
||||||
osg::Timer_t startTick = osg::Timer::instance()->tick();
|
osg::Timer_t startTick = osg::Timer::instance()->tick();
|
||||||
|
|
||||||
osg::Vec3d start = bs.center() + osg::Vec3d(0.0,bs.radius(),0.0);
|
osg::Vec3d start = bs.center() + osg::Vec3d(0.0,bs.radius(),0.0);
|
||||||
osg::Vec3d end = bs.center();// - osg::Vec3d(0.0, bs.radius(),0.0);
|
osg::Vec3d end = bs.center();// - osg::Vec3d(0.0, bs.radius(),0.0);
|
||||||
osg::Vec3d deltaRow( 0.0, 0.0, bs.radius()*0.01);
|
osg::Vec3d deltaRow( 0.0, 0.0, bs.radius()*0.01);
|
||||||
@@ -194,7 +194,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
osgUtil::IntersectionVisitor intersectVisitor( intersectorGroup.get(), new MyReadCallback );
|
osgUtil::IntersectionVisitor intersectVisitor( intersectorGroup.get(), new MyReadCallback );
|
||||||
scene->accept(intersectVisitor);
|
scene->accept(intersectVisitor);
|
||||||
|
|
||||||
@@ -229,7 +229,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -272,6 +272,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <osgDB/ReadFile>
|
#include <osgDB/ReadFile>
|
||||||
|
|
||||||
#include <osg/ArgumentParser>
|
#include <osg/ArgumentParser>
|
||||||
@@ -47,24 +47,24 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
int maxNumLevels = 16;
|
int maxNumLevels = 16;
|
||||||
int targetNumIndicesPerLeaf = 16;
|
int targetNumIndicesPerLeaf = 16;
|
||||||
|
|
||||||
while (arguments.read("--max", maxNumLevels)) {}
|
while (arguments.read("--max", maxNumLevels)) {}
|
||||||
while (arguments.read("--leaf", targetNumIndicesPerLeaf)) {}
|
while (arguments.read("--leaf", targetNumIndicesPerLeaf)) {}
|
||||||
|
|
||||||
osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES);
|
osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> scene = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
if (!scene)
|
if (!scene)
|
||||||
{
|
{
|
||||||
std::cout<<"No model loaded, please specify a valid model on the command line."<<std::endl;
|
std::cout<<"No model loaded, please specify a valid model on the command line."<<std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
viewer.setSceneData(scene.get());
|
viewer.setSceneData(scene);
|
||||||
return viewer.run();
|
return viewer.run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -341,10 +341,10 @@ int main( int argc, char **argv )
|
|||||||
osg::ref_ptr<osg::Node> loadedModel;
|
osg::ref_ptr<osg::Node> loadedModel;
|
||||||
|
|
||||||
// load the scene.
|
// load the scene.
|
||||||
if (argc>1) loadedModel = osgDB::readNodeFile(argv[1]);
|
if (argc>1) loadedModel = osgDB::readRefNodeFile(argv[1]);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("dumptruck.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("dumptruck.osgt");
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
@@ -374,7 +374,7 @@ int main( int argc, char **argv )
|
|||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
viewer.getCamera()->setGraphicsContext(gc.get());
|
viewer.getCamera()->setGraphicsContext(gc.get());
|
||||||
viewer.getCamera()->setViewport(0,0,800,600);
|
viewer.getCamera()->setViewport(0,0,800,600);
|
||||||
viewer.setSceneData(loadedModel.get());
|
viewer.setSceneData(loadedModel);
|
||||||
|
|
||||||
// create a tracball manipulator to move the camera around in response to keyboard/mouse events
|
// create a tracball manipulator to move the camera around in response to keyboard/mouse events
|
||||||
viewer.setCameraManipulator( new osgGA::TrackballManipulator );
|
viewer.setCameraManipulator( new osgGA::TrackballManipulator );
|
||||||
|
|||||||
@@ -38,14 +38,14 @@
|
|||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
{
|
{
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// initialize the viewer.
|
// initialize the viewer.
|
||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
osg::DisplaySettings* ds = viewer.getDisplaySettings() ? viewer.getDisplaySettings() : osg::DisplaySettings::instance().get();
|
osg::DisplaySettings* ds = viewer.getDisplaySettings() ? viewer.getDisplaySettings() : osg::DisplaySettings::instance().get();
|
||||||
ds->readCommandLine(arguments);
|
ds->readCommandLine(arguments);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> model = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> model = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
if (!model)
|
if (!model)
|
||||||
{
|
{
|
||||||
@@ -57,8 +57,8 @@ int main( int argc, char **argv )
|
|||||||
OSG_NOTICE<<"Stereo "<<ds->getStereo()<<std::endl;
|
OSG_NOTICE<<"Stereo "<<ds->getStereo()<<std::endl;
|
||||||
OSG_NOTICE<<"StereoMode "<<ds->getStereoMode()<<std::endl;
|
OSG_NOTICE<<"StereoMode "<<ds->getStereoMode()<<std::endl;
|
||||||
|
|
||||||
viewer.setSceneData(model.get());
|
viewer.setSceneData(model);
|
||||||
|
|
||||||
// add the state manipulator
|
// add the state manipulator
|
||||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
ds->setKeystoneHint(true);
|
ds->setKeystoneHint(true);
|
||||||
|
|
||||||
if (!ds->getKeystoneFileNames().empty())
|
if (!ds->getKeystoneFileNames().empty())
|
||||||
{
|
{
|
||||||
for(osg::DisplaySettings::Objects::iterator itr = ds->getKeystones().begin();
|
for(osg::DisplaySettings::Objects::iterator itr = ds->getKeystones().begin();
|
||||||
@@ -85,19 +85,19 @@ int main( int argc, char **argv )
|
|||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
osgViewer::Keystone* keystone = dynamic_cast<osgViewer::Keystone*>(itr->get());
|
osgViewer::Keystone* keystone = dynamic_cast<osgViewer::Keystone*>(itr->get());
|
||||||
if (keystone)
|
if (keystone)
|
||||||
{
|
{
|
||||||
std::string filename;
|
std::string filename;
|
||||||
keystone->getUserValue("filename",filename);
|
keystone->getUserValue("filename",filename);
|
||||||
OSG_NOTICE<<"Loaded keystone "<<filename<<", "<<keystone<<std::endl;
|
OSG_NOTICE<<"Loaded keystone "<<filename<<", "<<keystone<<std::endl;
|
||||||
|
|
||||||
ds->getKeystones().push_back(keystone);
|
ds->getKeystones().push_back(keystone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer.apply(new osgViewer::SingleScreen(0));
|
viewer.apply(new osgViewer::SingleScreen(0));
|
||||||
|
|
||||||
viewer.realize();
|
viewer.realize();
|
||||||
|
|
||||||
while(!viewer.done())
|
while(!viewer.done())
|
||||||
|
|||||||
@@ -53,23 +53,23 @@ int runApp(std::string xapp);
|
|||||||
|
|
||||||
// class to handle events with a pick
|
// class to handle events with a pick
|
||||||
class PickHandler : public osgGA::GUIEventHandler {
|
class PickHandler : public osgGA::GUIEventHandler {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PickHandler(osgViewer::Viewer* viewer,osgText::Text* updateText):
|
PickHandler(osgViewer::Viewer* viewer,osgText::Text* updateText):
|
||||||
_viewer(viewer),
|
_viewer(viewer),
|
||||||
_updateText(updateText) {}
|
_updateText(updateText) {}
|
||||||
|
|
||||||
~PickHandler() {}
|
~PickHandler() {}
|
||||||
|
|
||||||
bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& us);
|
bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& us);
|
||||||
|
|
||||||
std::string pick(const osgGA::GUIEventAdapter& event);
|
std::string pick(const osgGA::GUIEventAdapter& event);
|
||||||
|
|
||||||
void highlight(const std::string& name)
|
void highlight(const std::string& name)
|
||||||
{
|
{
|
||||||
if (_updateText.get()) _updateText->setText(name);
|
if (_updateText.get()) _updateText->setText(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
osgViewer::Viewer* _viewer;
|
osgViewer::Viewer* _viewer;
|
||||||
@@ -133,14 +133,14 @@ osg::Node* createHUD(osgText::Text* updateText)
|
|||||||
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
|
||||||
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
modelview_abs->setMatrix(osg::Matrix::identity());
|
modelview_abs->setMatrix(osg::Matrix::identity());
|
||||||
|
|
||||||
osg::Projection* projection = new osg::Projection;
|
osg::Projection* projection = new osg::Projection;
|
||||||
projection->setMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
|
projection->setMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
|
||||||
projection->addChild(modelview_abs);
|
projection->addChild(modelview_abs);
|
||||||
|
|
||||||
|
|
||||||
std::string timesFont("fonts/times.ttf");
|
std::string timesFont("fonts/times.ttf");
|
||||||
|
|
||||||
// turn lighting off for the text and disable depth test to ensure its always ontop.
|
// turn lighting off for the text and disable depth test to ensure its always ontop.
|
||||||
osg::Vec3 position(50.0f,510.0f,0.0f);
|
osg::Vec3 position(50.0f,510.0f,0.0f);
|
||||||
osg::Vec3 delta(0.0f,-60.0f,0.0f);
|
osg::Vec3 delta(0.0f,-60.0f,0.0f);
|
||||||
@@ -153,16 +153,16 @@ osg::Node* createHUD(osgText::Text* updateText)
|
|||||||
geode->setName("The text label");
|
geode->setName("The text label");
|
||||||
geode->addDrawable( updateText );
|
geode->addDrawable( updateText );
|
||||||
modelview_abs->addChild(geode);
|
modelview_abs->addChild(geode);
|
||||||
|
|
||||||
updateText->setCharacterSize(20.0f);
|
updateText->setCharacterSize(20.0f);
|
||||||
updateText->setFont(timesFont);
|
updateText->setFont(timesFont);
|
||||||
updateText->setColor(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
|
updateText->setColor(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
|
||||||
updateText->setText("");
|
updateText->setText("");
|
||||||
updateText->setPosition(position);
|
updateText->setPosition(position);
|
||||||
|
|
||||||
position += delta;
|
position += delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
return projection;
|
return projection;
|
||||||
|
|
||||||
} // end create HUDf
|
} // end create HUDf
|
||||||
@@ -179,13 +179,13 @@ class Xample
|
|||||||
std::string app;
|
std::string app;
|
||||||
public:
|
public:
|
||||||
Xample(std::string image, std::string prog)
|
Xample(std::string image, std::string prog)
|
||||||
{
|
{
|
||||||
texture = image;
|
texture = image;
|
||||||
app = prog;
|
app = prog;
|
||||||
osg::notify(osg::INFO) << "New Xample!" << std::endl;
|
osg::notify(osg::INFO) << "New Xample!" << std::endl;
|
||||||
};
|
};
|
||||||
~Xample() { };
|
~Xample() { };
|
||||||
|
|
||||||
std::string getTexture()
|
std::string getTexture()
|
||||||
{
|
{
|
||||||
return texture;
|
return texture;
|
||||||
@@ -225,11 +225,11 @@ int runApp(std::string xapp)
|
|||||||
if(!xapp.compare(x.getApp()))
|
if(!xapp.compare(x.getApp()))
|
||||||
{
|
{
|
||||||
osg::notify(osg::INFO) << "app found!" << std::endl;
|
osg::notify(osg::INFO) << "app found!" << std::endl;
|
||||||
|
|
||||||
const char* cxapp = xapp.c_str();
|
const char* cxapp = xapp.c_str();
|
||||||
|
|
||||||
osg::notify(osg::INFO) << "char* = " << cxapp <<std::endl;
|
osg::notify(osg::INFO) << "char* = " << cxapp <<std::endl;
|
||||||
|
|
||||||
return system(cxapp);
|
return system(cxapp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,14 +241,14 @@ int runApp(std::string xapp)
|
|||||||
void readConfFile(const char* confFile) // read confFile 1
|
void readConfFile(const char* confFile) // read confFile 1
|
||||||
{
|
{
|
||||||
osg::notify(osg::INFO) << "Start reading confFile" << std::endl;
|
osg::notify(osg::INFO) << "Start reading confFile" << std::endl;
|
||||||
|
|
||||||
std::string fileName = osgDB::findDataFile(confFile);
|
std::string fileName = osgDB::findDataFile(confFile);
|
||||||
if (fileName.empty())
|
if (fileName.empty())
|
||||||
{
|
{
|
||||||
osg::notify(osg::INFO) << "Config file not found"<<confFile << std::endl;
|
osg::notify(osg::INFO) << "Config file not found"<<confFile << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
osgDB::ifstream in(fileName.c_str());
|
osgDB::ifstream in(fileName.c_str());
|
||||||
if (!in)
|
if (!in)
|
||||||
@@ -258,7 +258,7 @@ void readConfFile(const char* confFile)
|
|||||||
}
|
}
|
||||||
std::string imageBuffer;
|
std::string imageBuffer;
|
||||||
std::string appBuffer;
|
std::string appBuffer;
|
||||||
|
|
||||||
while (!in.eof())
|
while (!in.eof())
|
||||||
{
|
{
|
||||||
std::getline(in, imageBuffer);
|
std::getline(in, imageBuffer);
|
||||||
@@ -269,18 +269,18 @@ void readConfFile(const char* confFile)
|
|||||||
osg::notify(osg::INFO) << "imageBuffer: " << imageBuffer << std::endl;
|
osg::notify(osg::INFO) << "imageBuffer: " << imageBuffer << std::endl;
|
||||||
osg::notify(osg::INFO) << "appBuffer: " << appBuffer << std::endl;
|
osg::notify(osg::INFO) << "appBuffer: " << appBuffer << std::endl;
|
||||||
// jeweils checken ob image vorhanden ist.
|
// jeweils checken ob image vorhanden ist.
|
||||||
|
|
||||||
Xample tmp(imageBuffer, appBuffer); // create Xample objects 2
|
Xample tmp(imageBuffer, appBuffer); // create Xample objects 2
|
||||||
|
|
||||||
Xamplelist.push_back(tmp); // store objects in list 2
|
Xamplelist.push_back(tmp); // store objects in list 2
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
in.close();
|
in.close();
|
||||||
|
|
||||||
osg::notify(osg::INFO) << "End reading confFile" << std::endl;
|
osg::notify(osg::INFO) << "End reading confFile" << std::endl;
|
||||||
|
|
||||||
printList();
|
printList();
|
||||||
} // end readConfFile
|
} // end readConfFile
|
||||||
|
|
||||||
@@ -291,8 +291,8 @@ void SetObjectTextureState(osg::Geode *geodeCurrent, std::string texture)
|
|||||||
osg::StateSet* stateTexture = geodeCurrent->getOrCreateStateSet();
|
osg::StateSet* stateTexture = geodeCurrent->getOrCreateStateSet();
|
||||||
|
|
||||||
// load texture.jpg as an image
|
// load texture.jpg as an image
|
||||||
osg::Image* imgTexture = osgDB::readImageFile( texture );
|
osg::ref_ptr<osg::Image> imgTexture = osgDB::readRefImageFile( texture );
|
||||||
|
|
||||||
// if the image is successfully loaded
|
// if the image is successfully loaded
|
||||||
if (imgTexture)
|
if (imgTexture)
|
||||||
{
|
{
|
||||||
@@ -338,11 +338,11 @@ osg::PositionAttitudeTransform* getPATransformation(osg::Node* object, osg::Vec3
|
|||||||
{
|
{
|
||||||
osg::PositionAttitudeTransform* tmpTrans = new osg::PositionAttitudeTransform();
|
osg::PositionAttitudeTransform* tmpTrans = new osg::PositionAttitudeTransform();
|
||||||
tmpTrans->addChild( object );
|
tmpTrans->addChild( object );
|
||||||
|
|
||||||
tmpTrans->setPosition( position );
|
tmpTrans->setPosition( position );
|
||||||
tmpTrans->setScale( scale );
|
tmpTrans->setScale( scale );
|
||||||
tmpTrans->setPivotPoint( pivot );
|
tmpTrans->setPivotPoint( pivot );
|
||||||
|
|
||||||
return tmpTrans;
|
return tmpTrans;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,7 +352,7 @@ void printBoundings(osg::Node* current, std::string name)
|
|||||||
osg::notify(osg::INFO) << name << std::endl;
|
osg::notify(osg::INFO) << name << std::endl;
|
||||||
osg::notify(osg::INFO) << "center = " << currentBound.center() << std::endl;
|
osg::notify(osg::INFO) << "center = " << currentBound.center() << std::endl;
|
||||||
osg::notify(osg::INFO) << "radius = " << currentBound.radius() << std::endl;
|
osg::notify(osg::INFO) << "radius = " << currentBound.radius() << std::endl;
|
||||||
|
|
||||||
// return currentBound.radius();
|
// return currentBound.radius();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,7 +361,7 @@ osg::Group* setupGraph()
|
|||||||
{
|
{
|
||||||
osg::Group* xGroup = new osg::Group();
|
osg::Group* xGroup = new osg::Group();
|
||||||
|
|
||||||
|
|
||||||
// positioning and sizes
|
// positioning and sizes
|
||||||
float defaultRadius = 0.8f;
|
float defaultRadius = 0.8f;
|
||||||
|
|
||||||
@@ -375,20 +375,20 @@ osg::Group* setupGraph()
|
|||||||
float xjump = (2*bs);
|
float xjump = (2*bs);
|
||||||
float zjump = xjump;
|
float zjump = xjump;
|
||||||
osg::Vec3 vScale( 0.5f, 0.5f, 0.5f );
|
osg::Vec3 vScale( 0.5f, 0.5f, 0.5f );
|
||||||
osg::Vec3 vPivot( 0.0f, 0.0f, 0.0f );
|
osg::Vec3 vPivot( 0.0f, 0.0f, 0.0f );
|
||||||
|
|
||||||
// run through Xampleliste
|
// run through Xampleliste
|
||||||
int z = 1;
|
int z = 1;
|
||||||
for (OP i = Xamplelist.begin() ; i != Xamplelist.end() ; ++i, ++z)
|
for (OP i = Xamplelist.begin() ; i != Xamplelist.end() ; ++i, ++z)
|
||||||
{
|
{
|
||||||
Xample& x = *i;
|
Xample& x = *i;
|
||||||
|
|
||||||
osg::Node* tmpCube = createTexturedCube(defaultRadius, defaultPos, x.getTexture(), x.getApp());
|
osg::Node* tmpCube = createTexturedCube(defaultRadius, defaultPos, x.getTexture(), x.getApp());
|
||||||
printBoundings(tmpCube, x.getApp());
|
printBoundings(tmpCube, x.getApp());
|
||||||
osg::Vec3 vPosition( xnext, 0.0f, znext );
|
osg::Vec3 vPosition( xnext, 0.0f, znext );
|
||||||
osg::PositionAttitudeTransform* transX = getPATransformation(tmpCube, vPosition, vScale, vPivot);
|
osg::PositionAttitudeTransform* transX = getPATransformation(tmpCube, vPosition, vScale, vPivot);
|
||||||
xGroup->addChild( transX );
|
xGroup->addChild( transX );
|
||||||
|
|
||||||
// line feed
|
// line feed
|
||||||
if(z < itemsInLine)
|
if(z < itemsInLine)
|
||||||
xnext += xjump;
|
xnext += xjump;
|
||||||
@@ -398,8 +398,8 @@ osg::Group* setupGraph()
|
|||||||
znext -= zjump;
|
znext -= zjump;
|
||||||
z = 0;
|
z = 0;
|
||||||
}
|
}
|
||||||
} // end run through list
|
} // end run through list
|
||||||
|
|
||||||
return xGroup;
|
return xGroup;
|
||||||
} // end setupGraph
|
} // end setupGraph
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
readConfFile(argv[1]); // read ConfigFile 1
|
readConfFile(argv[1]); // read ConfigFile 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// construct the viewer.
|
// construct the viewer.
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
@@ -428,9 +428,9 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
root->addChild( setupGraph() );
|
root->addChild( setupGraph() );
|
||||||
|
|
||||||
// add the HUD subgraph.
|
// add the HUD subgraph.
|
||||||
root->addChild(createHUD(updateText.get()));
|
root->addChild(createHUD(updateText.get()));
|
||||||
|
|
||||||
// add model to viewer.
|
// add model to viewer.
|
||||||
viewer.setSceneData( root );
|
viewer.setSceneData( root );
|
||||||
|
|
||||||
@@ -438,13 +438,13 @@ int main( int argc, char **argv )
|
|||||||
lookAt.makeLookAt(osg::Vec3(0.0f, -4.0f, 0.0f), centerScope, osg::Vec3(0.0f, 0.0f, 1.0f));
|
lookAt.makeLookAt(osg::Vec3(0.0f, -4.0f, 0.0f), centerScope, osg::Vec3(0.0f, 0.0f, 1.0f));
|
||||||
|
|
||||||
viewer.getCamera()->setViewMatrix(lookAt);
|
viewer.getCamera()->setViewMatrix(lookAt);
|
||||||
|
|
||||||
viewer.realize();
|
viewer.realize();
|
||||||
|
|
||||||
while( !viewer.done() )
|
while( !viewer.done() )
|
||||||
{
|
{
|
||||||
// fire off the cull and draw traversals of the scene.
|
// fire off the cull and draw traversals of the scene.
|
||||||
viewer.frame();
|
viewer.frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ osg::Geometry* createWall(const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
osg::Node* createRoom(osg::Node* loadedModel)
|
osg::ref_ptr<osg::Node> createRoom(const osg::ref_ptr<osg::Node>& loadedModel)
|
||||||
{
|
{
|
||||||
// default scale for this model.
|
// default scale for this model.
|
||||||
osg::BoundingSphere bs(osg::Vec3(0.0f,0.0f,0.0f),1.0f);
|
osg::BoundingSphere bs(osg::Vec3(0.0f,0.0f,0.0f),1.0f);
|
||||||
@@ -323,20 +323,20 @@ int main( int argc, char **argv )
|
|||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("glider.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("glider.osgt");
|
||||||
|
|
||||||
// create a room made of foor walls, a floor, a roof, and swinging light fitting.
|
// create a room made of foor walls, a floor, a roof, and swinging light fitting.
|
||||||
osg::Node* rootnode = createRoom(loadedModel);
|
osg::ref_ptr<osg::Node> rootnode = createRoom(loadedModel);
|
||||||
|
|
||||||
// run optimization over the scene graph
|
// run optimization over the scene graph
|
||||||
osgUtil::Optimizer optimzer;
|
osgUtil::Optimizer optimzer;
|
||||||
optimzer.optimize(rootnode);
|
optimzer.optimize(rootnode);
|
||||||
|
|
||||||
// add a viewport to the viewer and attach the scene graph.
|
// add a viewport to the viewer and attach the scene graph.
|
||||||
viewer.setSceneData( rootnode );
|
viewer.setSceneData(rootnode);
|
||||||
|
|
||||||
|
|
||||||
// create the windows and run the threads.
|
// create the windows and run the threads.
|
||||||
|
|||||||
@@ -47,12 +47,12 @@ void addToLightPointNode(osgSim::LightPointNode& lpn,osgSim::LightPoint& start,o
|
|||||||
lpn.addLightPoint(start);
|
lpn.addLightPoint(start);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float rend = 0.0f;
|
float rend = 0.0f;
|
||||||
float rdelta = 1.0f/((float)noSteps-1.0f);
|
float rdelta = 1.0f/((float)noSteps-1.0f);
|
||||||
|
|
||||||
lpn.getLightPointList().reserve(noSteps);
|
lpn.getLightPointList().reserve(noSteps);
|
||||||
|
|
||||||
for(unsigned int i=0;i<noSteps;++i,rend+=rdelta)
|
for(unsigned int i=0;i<noSteps;++i,rend+=rdelta)
|
||||||
{
|
{
|
||||||
float rstart = 1.0f-rend;
|
float rstart = 1.0f-rend;
|
||||||
@@ -63,7 +63,7 @@ void addToLightPointNode(osgSim::LightPointNode& lpn,osgSim::LightPoint& start,o
|
|||||||
INTERPOLATE(_radius);
|
INTERPOLATE(_radius);
|
||||||
|
|
||||||
lpn.addLightPoint(lp);
|
lpn.addLightPoint(lp);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,12 +78,12 @@ osg::Node* createLightPointsDatabase()
|
|||||||
|
|
||||||
start._position.set(-500.0f,-500.0f,0.0f);
|
start._position.set(-500.0f,-500.0f,0.0f);
|
||||||
start._color.set(1.0f,0.0f,0.0f,1.0f);
|
start._color.set(1.0f,0.0f,0.0f,1.0f);
|
||||||
|
|
||||||
end._position.set(500.0f,-500.0f,0.0f);
|
end._position.set(500.0f,-500.0f,0.0f);
|
||||||
end._color.set(1.0f,1.0f,1.0f,1.0f);
|
end._color.set(1.0f,1.0f,1.0f,1.0f);
|
||||||
|
|
||||||
osg::MatrixTransform* transform = new osg::MatrixTransform;
|
osg::MatrixTransform* transform = new osg::MatrixTransform;
|
||||||
|
|
||||||
transform->setDataVariance(osg::Object::STATIC);
|
transform->setDataVariance(osg::Object::STATIC);
|
||||||
transform->setMatrix(osg::Matrix::scale(0.1,0.1,0.1));
|
transform->setMatrix(osg::Matrix::scale(0.1,0.1,0.1));
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ osg::Node* createLightPointsDatabase()
|
|||||||
// bs->addPulse(0.5,osg::Vec4(0.0f,0.0f,0.0f,0.0f)); // off
|
// bs->addPulse(0.5,osg::Vec4(0.0f,0.0f,0.0f,0.0f)); // off
|
||||||
// bs->addPulse(1.0,osg::Vec4(1.0f,1.0f,1.0f,1.0f));
|
// bs->addPulse(1.0,osg::Vec4(1.0f,1.0f,1.0f,1.0f));
|
||||||
// bs->addPulse(0.5,osg::Vec4(0.0f,0.0f,0.0f,0.0f)); // off
|
// bs->addPulse(0.5,osg::Vec4(0.0f,0.0f,0.0f,0.0f)); // off
|
||||||
|
|
||||||
|
|
||||||
// osgSim::Sector* sector = new osgSim::ConeSector(osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0),osg::inDegrees(45.0));
|
// osgSim::Sector* sector = new osgSim::ConeSector(osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0),osg::inDegrees(45.0));
|
||||||
// osgSim::Sector* sector = new osgSim::ElevationSector(-osg::inDegrees(45.0),osg::inDegrees(45.0),osg::inDegrees(45.0));
|
// osgSim::Sector* sector = new osgSim::ElevationSector(-osg::inDegrees(45.0),osg::inDegrees(45.0),osg::inDegrees(45.0));
|
||||||
@@ -113,7 +113,7 @@ osg::Node* createLightPointsDatabase()
|
|||||||
{
|
{
|
||||||
|
|
||||||
// osgSim::BlinkSequence* local_bs = new osgSim::BlinkSequence(*bs);
|
// osgSim::BlinkSequence* local_bs = new osgSim::BlinkSequence(*bs);
|
||||||
// local_bs->setSequenceGroup(new osgSim::BlinkSequence::SequenceGroup((double)i*0.1));
|
// local_bs->setSequenceGroup(new osgSim::BlinkSequence::SequenceGroup((double)i*0.1));
|
||||||
// start._blinkSequence = local_bs;
|
// start._blinkSequence = local_bs;
|
||||||
|
|
||||||
// start._sector = sector;
|
// start._sector = sector;
|
||||||
@@ -129,7 +129,7 @@ osg::Node* createLightPointsDatabase()
|
|||||||
|
|
||||||
// Set point sprite texture in LightPointNode StateSet.
|
// Set point sprite texture in LightPointNode StateSet.
|
||||||
osg::Texture2D *tex = new osg::Texture2D();
|
osg::Texture2D *tex = new osg::Texture2D();
|
||||||
tex->setImage(osgDB::readImageFile("Images/particle.rgb"));
|
tex->setImage(osgDB::readRefImageFile("Images/particle.rgb"));
|
||||||
set->setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON);
|
set->setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,17 +140,17 @@ osg::Node* createLightPointsDatabase()
|
|||||||
//
|
//
|
||||||
|
|
||||||
addToLightPointNode(*lpn,start,end,noStepsX);
|
addToLightPointNode(*lpn,start,end,noStepsX);
|
||||||
|
|
||||||
start._position += start_delta;
|
start._position += start_delta;
|
||||||
end._position += end_delta;
|
end._position += end_delta;
|
||||||
|
|
||||||
transform->addChild(lpn);
|
transform->addChild(lpn);
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Group* group = new osg::Group;
|
osg::Group* group = new osg::Group;
|
||||||
group->addChild(transform);
|
group->addChild(transform);
|
||||||
|
|
||||||
|
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,16 +232,16 @@ int main( int argc, char **argv )
|
|||||||
osg::Group* rootnode = new osg::Group;
|
osg::Group* rootnode = new osg::Group;
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
rootnode->addChild(osgDB::readNodeFiles(arguments));
|
rootnode->addChild(osgDB::readRefNodeFiles(arguments));
|
||||||
rootnode->addChild(createLightPointsDatabase());
|
rootnode->addChild(createLightPointsDatabase());
|
||||||
rootnode->addChild(CreateBlinkSequenceLightNode());
|
rootnode->addChild(CreateBlinkSequenceLightNode());
|
||||||
|
|
||||||
// run optimization over the scene graph
|
// run optimization over the scene graph
|
||||||
osgUtil::Optimizer optimzer;
|
osgUtil::Optimizer optimzer;
|
||||||
optimzer.optimize(rootnode);
|
optimzer.optimize(rootnode);
|
||||||
|
|
||||||
// add a viewport to the viewer and attach the scene graph.
|
// add a viewport to the viewer and attach the scene graph.
|
||||||
viewer.setSceneData( rootnode );
|
viewer.setSceneData( rootnode );
|
||||||
|
|
||||||
return viewer.run();
|
return viewer.run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
const int _ops_nb=16;
|
const int _ops_nb=16;
|
||||||
const osg::LogicOp::Opcode _operations[_ops_nb]=
|
const osg::LogicOp::Opcode _operations[_ops_nb]=
|
||||||
{
|
{
|
||||||
osg::LogicOp::CLEAR,
|
osg::LogicOp::CLEAR,
|
||||||
osg::LogicOp::SET,
|
osg::LogicOp::SET,
|
||||||
osg::LogicOp::COPY,
|
osg::LogicOp::COPY,
|
||||||
@@ -52,7 +52,7 @@ const osg::LogicOp::Opcode _operations[_ops_nb]=
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char* _ops_name[_ops_nb]=
|
const char* _ops_name[_ops_nb]=
|
||||||
{
|
{
|
||||||
"osg::LogicOp::CLEAR",
|
"osg::LogicOp::CLEAR",
|
||||||
"osg::LogicOp::SET",
|
"osg::LogicOp::SET",
|
||||||
"osg::LogicOp::COPY",
|
"osg::LogicOp::COPY",
|
||||||
@@ -142,22 +142,22 @@ int main( int argc, char **argv )
|
|||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("glider.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("glider.osgt");
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Please specify model filename on the command line."<<std::endl;
|
osg::notify(osg::NOTICE)<<"Please specify model filename on the command line."<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Group* root = new osg::Group;
|
osg::ref_ptr<osg::Group> root = new osg::Group;
|
||||||
root->addChild(loadedModel);
|
root->addChild(loadedModel);
|
||||||
|
|
||||||
osg::StateSet* stateset = new osg::StateSet;
|
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet;
|
||||||
osg::LogicOp* logicOp = new osg::LogicOp(osg::LogicOp::OR_INVERTED);
|
osg::ref_ptr<osg::LogicOp> logicOp = new osg::LogicOp(osg::LogicOp::OR_INVERTED);
|
||||||
|
|
||||||
stateset->setAttributeAndModes(logicOp,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
stateset->setAttributeAndModes(logicOp,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
||||||
|
|
||||||
@@ -170,14 +170,14 @@ int main( int argc, char **argv )
|
|||||||
// construct the viewer.
|
// construct the viewer.
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
viewer.addEventHandler(new TechniqueEventHandler(logicOp));
|
viewer.addEventHandler(new TechniqueEventHandler(logicOp.get()));
|
||||||
|
|
||||||
// run optimization over the scene graph
|
// run optimization over the scene graph
|
||||||
osgUtil::Optimizer optimzer;
|
osgUtil::Optimizer optimzer;
|
||||||
optimzer.optimize(root);
|
optimzer.optimize(root);
|
||||||
|
|
||||||
// add a viewport to the viewer and attach the scene graph.
|
// add a viewport to the viewer and attach the scene graph.
|
||||||
viewer.setSceneData( root );
|
viewer.setSceneData( root );
|
||||||
|
|
||||||
return viewer.run();
|
return viewer.run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ osg:: Node* createGlobe(const osg::BoundingBox& bb,float ratio, const std::strin
|
|||||||
osg::MatrixTransform* xform = new osg::MatrixTransform;
|
osg::MatrixTransform* xform = new osg::MatrixTransform;
|
||||||
xform->setUpdateCallback(new osg::AnimationPathCallback(bb.center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(10.0f)));
|
xform->setUpdateCallback(new osg::AnimationPathCallback(bb.center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(10.0f)));
|
||||||
|
|
||||||
osg::Node* bluemarble = filename.empty() ? 0 : osgDB::readNodeFile(filename.c_str());
|
osg::ref_ptr<osg::Node> bluemarble = filename.empty() ? 0 : osgDB::readRefNodeFile(filename.c_str());
|
||||||
if (bluemarble)
|
if (bluemarble)
|
||||||
{
|
{
|
||||||
const osg::BoundingSphere& bs = bluemarble->getBound();
|
const osg::BoundingSphere& bs = bluemarble->getBound();
|
||||||
@@ -252,7 +252,7 @@ osg:: Node* createGlobe(const osg::BoundingBox& bb,float ratio, const std::strin
|
|||||||
|
|
||||||
osg::StateSet* stateset = geode->getOrCreateStateSet();
|
osg::StateSet* stateset = geode->getOrCreateStateSet();
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile("Images/land_shallow_topo_2048.jpg");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Images/land_shallow_topo_2048.jpg");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* texture = new osg::Texture2D;
|
osg::Texture2D* texture = new osg::Texture2D;
|
||||||
|
|||||||
@@ -453,7 +453,7 @@ int main( int argc, char **argv )
|
|||||||
osg::Timer_t start_tick = osg::Timer::instance()->tick();
|
osg::Timer_t start_tick = osg::Timer::instance()->tick();
|
||||||
|
|
||||||
// read the scene from the list of file specified command line args.
|
// read the scene from the list of file specified command line args.
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if no model has been successfully loaded report failure.
|
// if no model has been successfully loaded report failure.
|
||||||
bool tragger2Scene(true);
|
bool tragger2Scene(true);
|
||||||
@@ -481,14 +481,14 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// optimize the scene graph, remove redundant nodes and state etc.
|
// optimize the scene graph, remove redundant nodes and state etc.
|
||||||
osgUtil::Optimizer optimizer;
|
osgUtil::Optimizer optimizer;
|
||||||
optimizer.optimize(loadedModel.get());
|
optimizer.optimize(loadedModel);
|
||||||
|
|
||||||
|
|
||||||
// pass the loaded scene graph to the viewer.
|
// pass the loaded scene graph to the viewer.
|
||||||
if ( tragger2Scene ) {
|
if ( tragger2Scene ) {
|
||||||
viewer.setSceneData(addDraggerToScene(loadedModel.get(), dragger_name, fixedSizeInScreen));
|
viewer.setSceneData(addDraggerToScene(loadedModel.get(), dragger_name, fixedSizeInScreen));
|
||||||
} else {
|
} else {
|
||||||
viewer.setSceneData(loadedModel.get());
|
viewer.setSceneData(loadedModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class MotionBlurOperation: public osg::Operation
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MotionBlurOperation(double persistence):
|
MotionBlurOperation(double persistence):
|
||||||
|
osg::Referenced(true),
|
||||||
osg::Operation("MotionBlur",true),
|
osg::Operation("MotionBlur",true),
|
||||||
cleared_(false),
|
cleared_(false),
|
||||||
persistence_(persistence)
|
persistence_(persistence)
|
||||||
@@ -36,7 +37,7 @@ public:
|
|||||||
{
|
{
|
||||||
osg::GraphicsContext* gc = dynamic_cast<osg::GraphicsContext*>(object);
|
osg::GraphicsContext* gc = dynamic_cast<osg::GraphicsContext*>(object);
|
||||||
if (!gc) return;
|
if (!gc) return;
|
||||||
|
|
||||||
double t = gc->getState()->getFrameStamp()->getSimulationTime();
|
double t = gc->getState()->getFrameStamp()->getSimulationTime();
|
||||||
|
|
||||||
if (!cleared_)
|
if (!cleared_)
|
||||||
@@ -72,14 +73,14 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an OpenSceneGraph example that shows how to use the accumulation buffer to achieve a simple motion blur effect.");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an OpenSceneGraph example that shows how to use the accumulation buffer to achieve a simple motion blur effect.");
|
||||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
|
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-P or --persistence","Set the motion blur persistence time");
|
arguments.getApplicationUsage()->addCommandLineOption("-P or --persistence","Set the motion blur persistence time");
|
||||||
|
|
||||||
|
|
||||||
// construct the viewer.
|
// construct the viewer.
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
@@ -95,13 +96,13 @@ int main( int argc, char **argv )
|
|||||||
arguments.read("-P", persistence) || arguments.read("--persistence", persistence);
|
arguments.read("-P", persistence) || arguments.read("--persistence", persistence);
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("cow.osgt");
|
||||||
|
|
||||||
// if no model has been successfully loaded report failure.
|
// if no model has been successfully loaded report failure.
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -469,23 +469,46 @@ int main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
//useTextureRectangle = false;
|
//useTextureRectangle = false;
|
||||||
|
|
||||||
static const char *shaderSourceTextureRec = {
|
static const char *shaderSourceTextureVertex = {
|
||||||
"uniform vec4 cutoff_color;\n"
|
"#ifdef GL_ES\n"
|
||||||
"uniform samplerRect movie_texture;\n"
|
" precision highp float;\n"
|
||||||
|
" precision highp int;\n"
|
||||||
|
"#endif\n"
|
||||||
|
"varying vec4 texcoord;\n"
|
||||||
"void main(void)\n"
|
"void main(void)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" vec4 texture_color = textureRect(movie_texture, gl_TexCoord[0].st); \n"
|
" texcoord = gl_MultiTexCoord0; \n"
|
||||||
|
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||||
|
"}\n"
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *shaderSourceTextureRec = {
|
||||||
|
"#ifdef GL_ES\n"
|
||||||
|
" precision highp float;\n"
|
||||||
|
" precision highp int;\n"
|
||||||
|
"#endif\n"
|
||||||
|
"uniform vec4 cutoff_color;\n"
|
||||||
|
"uniform samplerRect movie_texture;\n"
|
||||||
|
"varying vec4 texcoord;\n"
|
||||||
|
"void main(void)\n"
|
||||||
|
"{\n"
|
||||||
|
" vec4 texture_color = textureRect(movie_texture, texcoord.st); \n"
|
||||||
" if (all(lessThanEqual(texture_color,cutoff_color))) discard; \n"
|
" if (all(lessThanEqual(texture_color,cutoff_color))) discard; \n"
|
||||||
" gl_FragColor = texture_color;\n"
|
" gl_FragColor = texture_color;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *shaderSourceTexture2D = {
|
static const char *shaderSourceTexture2D = {
|
||||||
|
"#ifdef GL_ES\n"
|
||||||
|
" precision highp float;\n"
|
||||||
|
" precision highp int;\n"
|
||||||
|
"#endif\n"
|
||||||
"uniform vec4 cutoff_color;\n"
|
"uniform vec4 cutoff_color;\n"
|
||||||
"uniform sampler2D movie_texture;\n"
|
"uniform sampler2D movie_texture;\n"
|
||||||
|
"varying vec4 texcoord;\n"
|
||||||
"void main(void)\n"
|
"void main(void)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" vec4 texture_color = texture2D(movie_texture, gl_TexCoord[0].st); \n"
|
" vec4 texture_color = texture2D(movie_texture, texcoord.st); \n"
|
||||||
" if (all(lessThanEqual(texture_color,cutoff_color))) discard; \n"
|
" if (all(lessThanEqual(texture_color,cutoff_color))) discard; \n"
|
||||||
" gl_FragColor = texture_color;\n"
|
" gl_FragColor = texture_color;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
@@ -493,6 +516,9 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
osg::Program* program = new osg::Program;
|
osg::Program* program = new osg::Program;
|
||||||
|
|
||||||
|
|
||||||
|
program->addShader(new osg::Shader(osg::Shader::VERTEX, shaderSourceTextureVertex));
|
||||||
|
|
||||||
program->addShader(new osg::Shader(osg::Shader::FRAGMENT,
|
program->addShader(new osg::Shader(osg::Shader::FRAGMENT,
|
||||||
useTextureRectangle ? shaderSourceTextureRec : shaderSourceTexture2D));
|
useTextureRectangle ? shaderSourceTextureRec : shaderSourceTexture2D));
|
||||||
|
|
||||||
@@ -520,8 +546,8 @@ int main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
if (arguments.isString(i))
|
if (arguments.isString(i))
|
||||||
{
|
{
|
||||||
osg::Image* image = osgDB::readImageFile(arguments[i]);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(arguments[i]);
|
||||||
osg::ImageStream* imagestream = dynamic_cast<osg::ImageStream*>(image);
|
osg::ImageStream* imagestream = dynamic_cast<osg::ImageStream*>(image.get());
|
||||||
if (imagestream)
|
if (imagestream)
|
||||||
{
|
{
|
||||||
osg::ImageStream::AudioStreams& audioStreams = imagestream->getAudioStreams();
|
osg::ImageStream::AudioStreams& audioStreams = imagestream->getAudioStreams();
|
||||||
@@ -550,7 +576,7 @@ int main(int argc, char** argv)
|
|||||||
float width = image->s() * image->getPixelAspectRatio();
|
float width = image->s() * image->getPixelAspectRatio();
|
||||||
float height = image->t();
|
float height = image->t();
|
||||||
|
|
||||||
osg::ref_ptr<osg::Drawable> drawable = myCreateTexturedQuadGeometry(pos, width, height,image, useTextureRectangle, xyPlane, flip);
|
osg::ref_ptr<osg::Drawable> drawable = myCreateTexturedQuadGeometry(pos, width, height, image.get(), useTextureRectangle, xyPlane, flip);
|
||||||
|
|
||||||
if (image->isImageTranslucent())
|
if (image->isImageTranslucent())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ private:
|
|||||||
|
|
||||||
static osg::Node* readImageStream(const std::string& file_name, osg::Vec3& p, float desired_height, osgDB::Options* options)
|
static osg::Node* readImageStream(const std::string& file_name, osg::Vec3& p, float desired_height, osgDB::Options* options)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Object> obj = osgDB::readObjectFile(file_name, options);
|
osg::ref_ptr<osg::Object> obj = osgDB::readRefObjectFile(file_name, options);
|
||||||
osg::ref_ptr<osg::Texture> tex = dynamic_cast<osg::Texture*>(obj.get());
|
osg::ref_ptr<osg::Texture> tex = dynamic_cast<osg::Texture*>(obj.get());
|
||||||
osg::Geometry* geo(NULL);
|
osg::Geometry* geo(NULL);
|
||||||
float w(0);
|
float w(0);
|
||||||
@@ -374,7 +374,7 @@ static osg::Node* readImageStream(const std::string& file_name, osg::Vec3& p, fl
|
|||||||
// try readImageFile if readObjectFile failed
|
// try readImageFile if readObjectFile failed
|
||||||
if (!img_stream)
|
if (!img_stream)
|
||||||
{
|
{
|
||||||
img_stream = dynamic_cast<osg::ImageStream*>(osgDB::readImageFile(file_name, options));
|
img_stream = osgDB::readRefFile<osg::ImageStream>(file_name, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (img_stream)
|
if (img_stream)
|
||||||
@@ -531,7 +531,9 @@ private:
|
|||||||
if (!tex) {
|
if (!tex) {
|
||||||
osg::ref_ptr<osg::ImageStream> stream = dynamic_cast<osg::ImageStream*>(obj.get());
|
osg::ref_ptr<osg::ImageStream> stream = dynamic_cast<osg::ImageStream*>(obj.get());
|
||||||
if (!stream)
|
if (!stream)
|
||||||
stream = dynamic_cast<osg::ImageStream*>(osgDB::readImageFile(_files[_currentFile], _options.get()));
|
{
|
||||||
|
stream = osgDB::readRefFile<osg::ImageStream>(_files[_currentFile], _options.get());
|
||||||
|
}
|
||||||
|
|
||||||
if (stream)
|
if (stream)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ int main( int argc, char **argv )
|
|||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* rootnode = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> rootnode = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!rootnode) rootnode = osgDB::readNodeFile("cessnafire.osgt");
|
if (!rootnode) rootnode = osgDB::readRefNodeFile("cessnafire.osgt");
|
||||||
|
|
||||||
if (!rootnode)
|
if (!rootnode)
|
||||||
{
|
{
|
||||||
@@ -55,7 +55,7 @@ int main( int argc, char **argv )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile("Images/reflect.rgb");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Images/reflect.rgb");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* texture = new osg::Texture2D;
|
osg::Texture2D* texture = new osg::Texture2D;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
|
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
|
||||||
_foundNode(0)
|
_foundNode(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void apply(osg::Node& node)
|
void apply(osg::Node& node)
|
||||||
{
|
{
|
||||||
T* result = dynamic_cast<T*>(&node);
|
T* result = dynamic_cast<T*>(&node);
|
||||||
@@ -68,18 +68,18 @@ public:
|
|||||||
traverse(node);
|
traverse(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
T* _foundNode;
|
T* _foundNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T, class R>
|
||||||
T* findTopMostNodeOfType(osg::Node* node)
|
T* findTopMostNodeOfType(R node)
|
||||||
{
|
{
|
||||||
if (!node) return 0;
|
if (!node) return 0;
|
||||||
|
|
||||||
FindTopMostNodeOfTypeVisitor<T> fnotv;
|
FindTopMostNodeOfTypeVisitor<T> fnotv;
|
||||||
node->accept(fnotv);
|
node->accept(fnotv);
|
||||||
|
|
||||||
return fnotv._foundNode;
|
return fnotv._foundNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ T* findTopMostNodeOfType(osg::Node* node)
|
|||||||
class ElevationLayerBlendingCallback : public osg::NodeCallback
|
class ElevationLayerBlendingCallback : public osg::NodeCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef std::vector<double> Elevations;
|
typedef std::vector<double> Elevations;
|
||||||
|
|
||||||
ElevationLayerBlendingCallback(osgFX::MultiTextureControl* mtc, const Elevations& elevations, float animationTime=4.0f):
|
ElevationLayerBlendingCallback(osgFX::MultiTextureControl* mtc, const Elevations& elevations, float animationTime=4.0f):
|
||||||
@@ -97,7 +97,7 @@ class ElevationLayerBlendingCallback : public osg::NodeCallback
|
|||||||
_currentElevation(0.0),
|
_currentElevation(0.0),
|
||||||
_mtc(mtc),
|
_mtc(mtc),
|
||||||
_elevations(elevations) {}
|
_elevations(elevations) {}
|
||||||
|
|
||||||
/** Callback method called by the NodeVisitor when visiting a node.*/
|
/** Callback method called by the NodeVisitor when visiting a node.*/
|
||||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||||
{
|
{
|
||||||
@@ -118,7 +118,7 @@ class ElevationLayerBlendingCallback : public osg::NodeCallback
|
|||||||
unsigned int index = _mtc->getNumTextureWeights()-1;
|
unsigned int index = _mtc->getNumTextureWeights()-1;
|
||||||
for(unsigned int i=0; i<_elevations.size(); ++i)
|
for(unsigned int i=0; i<_elevations.size(); ++i)
|
||||||
{
|
{
|
||||||
if (_currentElevation>_elevations[i])
|
if (_currentElevation>_elevations[i])
|
||||||
{
|
{
|
||||||
index = i;
|
index = i;
|
||||||
break;
|
break;
|
||||||
@@ -153,7 +153,7 @@ class ElevationLayerBlendingCallback : public osg::NodeCallback
|
|||||||
_currentElevation = nv->getViewPoint().z();
|
_currentElevation = nv->getViewPoint().z();
|
||||||
|
|
||||||
osg::CoordinateSystemNode* csn = dynamic_cast<osg::CoordinateSystemNode*>(node);
|
osg::CoordinateSystemNode* csn = dynamic_cast<osg::CoordinateSystemNode*>(node);
|
||||||
if (csn)
|
if (csn)
|
||||||
{
|
{
|
||||||
osg::EllipsoidModel* em = csn->getEllipsoidModel();
|
osg::EllipsoidModel* em = csn->getEllipsoidModel();
|
||||||
if (em)
|
if (em)
|
||||||
@@ -175,7 +175,7 @@ class ElevationLayerBlendingCallback : public osg::NodeCallback
|
|||||||
double _previousTime;
|
double _previousTime;
|
||||||
float _animationTime;
|
float _animationTime;
|
||||||
double _currentElevation;
|
double _currentElevation;
|
||||||
|
|
||||||
osg::observer_ptr<osgFX::MultiTextureControl> _mtc;
|
osg::observer_ptr<osgFX::MultiTextureControl> _mtc;
|
||||||
Elevations _elevations;
|
Elevations _elevations;
|
||||||
};
|
};
|
||||||
@@ -183,17 +183,17 @@ class ElevationLayerBlendingCallback : public osg::NodeCallback
|
|||||||
|
|
||||||
// class to handle events with a pick
|
// class to handle events with a pick
|
||||||
class TerrainHandler : public osgGA::GUIEventHandler {
|
class TerrainHandler : public osgGA::GUIEventHandler {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TerrainHandler(osgTerrain::Terrain* terrain):
|
TerrainHandler(osgTerrain::Terrain* terrain):
|
||||||
_terrain(terrain) {}
|
_terrain(terrain) {}
|
||||||
|
|
||||||
bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa)
|
bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa)
|
||||||
{
|
{
|
||||||
switch(ea.getEventType())
|
switch(ea.getEventType())
|
||||||
{
|
{
|
||||||
case(osgGA::GUIEventAdapter::KEYDOWN):
|
case(osgGA::GUIEventAdapter::KEYDOWN):
|
||||||
{
|
{
|
||||||
if (ea.getKey()=='r')
|
if (ea.getKey()=='r')
|
||||||
{
|
{
|
||||||
_terrain->setSampleRatio(_terrain->getSampleRatio()*0.5);
|
_terrain->setSampleRatio(_terrain->getSampleRatio()*0.5);
|
||||||
@@ -220,12 +220,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
~TerrainHandler() {}
|
~TerrainHandler() {}
|
||||||
@@ -240,7 +240,7 @@ int main( int argc, char **argv )
|
|||||||
arguments.getApplicationUsage()->addCommandLineOption("-v","Set the terrain vertical scale.");
|
arguments.getApplicationUsage()->addCommandLineOption("-v","Set the terrain vertical scale.");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-r","Set the terrain sample ratio.");
|
arguments.getApplicationUsage()->addCommandLineOption("-r","Set the terrain sample ratio.");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--login <url> <username> <password>","Provide authentication information for http file access.");
|
arguments.getApplicationUsage()->addCommandLineOption("--login <url> <username> <password>","Provide authentication information for http file access.");
|
||||||
|
|
||||||
// construct the viewer.
|
// construct the viewer.
|
||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ int main( int argc, char **argv )
|
|||||||
// obtain the vertical scale
|
// obtain the vertical scale
|
||||||
float verticalScale = 1.0f;
|
float verticalScale = 1.0f;
|
||||||
while(arguments.read("-v",verticalScale)) {}
|
while(arguments.read("-v",verticalScale)) {}
|
||||||
|
|
||||||
// obtain the sample ratio
|
// obtain the sample ratio
|
||||||
float sampleRatio = 1.0f;
|
float sampleRatio = 1.0f;
|
||||||
while(arguments.read("-r",sampleRatio)) {}
|
while(arguments.read("-r",sampleRatio)) {}
|
||||||
@@ -322,7 +322,7 @@ int main( int argc, char **argv )
|
|||||||
while (arguments.read("-p",pathfile))
|
while (arguments.read("-p",pathfile))
|
||||||
{
|
{
|
||||||
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||||
if (apm || !apm->valid())
|
if (apm || !apm->valid())
|
||||||
{
|
{
|
||||||
num = keyswitchManipulator->getNumMatrixManipulators();
|
num = keyswitchManipulator->getNumMatrixManipulators();
|
||||||
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
||||||
@@ -338,7 +338,7 @@ int main( int argc, char **argv )
|
|||||||
// set up the scene graph
|
// set up the scene graph
|
||||||
{
|
{
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* rootnode = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> rootnode = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
if (!rootnode)
|
if (!rootnode)
|
||||||
{
|
{
|
||||||
@@ -410,7 +410,7 @@ int main( int argc, char **argv )
|
|||||||
// add a viewport to the viewer and attach the scene graph.
|
// add a viewport to the viewer and attach the scene graph.
|
||||||
viewer.setSceneData( rootnode );
|
viewer.setSceneData( rootnode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// create the windows and run the threads.
|
// create the windows and run the threads.
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ osg::Camera* createHUD(unsigned int w, unsigned int h)
|
|||||||
// set the projection matrix
|
// set the projection matrix
|
||||||
camera->setProjectionMatrix(osg::Matrix::ortho2D(0,w,0,h));
|
camera->setProjectionMatrix(osg::Matrix::ortho2D(0,w,0,h));
|
||||||
|
|
||||||
// set the view matrix
|
// set the view matrix
|
||||||
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
camera->setViewMatrix(osg::Matrix::identity());
|
camera->setViewMatrix(osg::Matrix::identity());
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ osg::Camera* createHUD(unsigned int w, unsigned int h)
|
|||||||
|
|
||||||
// we don't want the camera to grab event focus from the viewers main camera(s).
|
// we don't want the camera to grab event focus from the viewers main camera(s).
|
||||||
camera->setAllowEventFocus(false);
|
camera->setAllowEventFocus(false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// add to this camera a subgraph to render
|
// add to this camera a subgraph to render
|
||||||
@@ -87,7 +87,7 @@ osg::Camera* createHUD(unsigned int w, unsigned int h)
|
|||||||
text->setFont(timesFont);
|
text->setFont(timesFont);
|
||||||
text->setPosition(position);
|
text->setPosition(position);
|
||||||
text->setText("A simple multi-touch-example\n1 touch = rotate, \n2 touches = drag + scale, \n3 touches = home");
|
text->setText("A simple multi-touch-example\n1 touch = rotate, \n2 touches = drag + scale, \n3 touches = home");
|
||||||
}
|
}
|
||||||
|
|
||||||
camera->addChild(geode);
|
camera->addChild(geode);
|
||||||
}
|
}
|
||||||
@@ -106,49 +106,49 @@ public:
|
|||||||
{
|
{
|
||||||
createTouchRepresentations(parent_group, 10);
|
createTouchRepresentations(parent_group, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createTouchRepresentations(osg::Group* parent_group, unsigned int num_objects)
|
void createTouchRepresentations(osg::Group* parent_group, unsigned int num_objects)
|
||||||
{
|
{
|
||||||
// create some geometry which is shown for every touch-point
|
// create some geometry which is shown for every touch-point
|
||||||
for(unsigned int i = 0; i != num_objects; ++i)
|
for(unsigned int i = 0; i != num_objects; ++i)
|
||||||
{
|
{
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
|
|
||||||
osg::Geode* geode = new osg::Geode();
|
osg::Geode* geode = new osg::Geode();
|
||||||
|
|
||||||
osg::ShapeDrawable* drawable = new osg::ShapeDrawable(new osg::Box(osg::Vec3(0,0,0), 100));
|
osg::ShapeDrawable* drawable = new osg::ShapeDrawable(new osg::Box(osg::Vec3(0,0,0), 100));
|
||||||
drawable->setColor(osg::Vec4(0.5, 0.5, 0.5,1));
|
drawable->setColor(osg::Vec4(0.5, 0.5, 0.5,1));
|
||||||
geode->addDrawable(drawable);
|
geode->addDrawable(drawable);
|
||||||
|
|
||||||
ss << "Touch " << i;
|
ss << "Touch " << i;
|
||||||
|
|
||||||
osgText::Text* text = new osgText::Text;
|
osgText::Text* text = new osgText::Text;
|
||||||
geode->addDrawable( text );
|
geode->addDrawable( text );
|
||||||
drawable->setDataVariance(osg::Object::DYNAMIC);
|
drawable->setDataVariance(osg::Object::DYNAMIC);
|
||||||
_drawables.push_back(drawable);
|
_drawables.push_back(drawable);
|
||||||
|
|
||||||
|
|
||||||
text->setFont("fonts/arial.ttf");
|
text->setFont("fonts/arial.ttf");
|
||||||
text->setPosition(osg::Vec3(110,0,0));
|
text->setPosition(osg::Vec3(110,0,0));
|
||||||
text->setText(ss.str());
|
text->setText(ss.str());
|
||||||
_texts.push_back(text);
|
_texts.push_back(text);
|
||||||
text->setDataVariance(osg::Object::DYNAMIC);
|
text->setDataVariance(osg::Object::DYNAMIC);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
osg::MatrixTransform* mat = new osg::MatrixTransform();
|
osg::MatrixTransform* mat = new osg::MatrixTransform();
|
||||||
mat->addChild(geode);
|
mat->addChild(geode);
|
||||||
mat->setNodeMask(0x0);
|
mat->setNodeMask(0x0);
|
||||||
|
|
||||||
_mats.push_back(mat);
|
_mats.push_back(mat);
|
||||||
|
|
||||||
parent_group->addChild(mat);
|
parent_group->addChild(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent_group->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
parent_group->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *)
|
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *)
|
||||||
{
|
{
|
||||||
if (ea.getEventType() != osgGA::GUIEventAdapter::FRAME) {
|
if (ea.getEventType() != osgGA::GUIEventAdapter::FRAME) {
|
||||||
@@ -162,7 +162,7 @@ private:
|
|||||||
}
|
}
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(ea.getEventType())
|
switch(ea.getEventType())
|
||||||
{
|
{
|
||||||
case osgGA::GUIEventAdapter::FRAME:
|
case osgGA::GUIEventAdapter::FRAME:
|
||||||
@@ -171,7 +171,7 @@ private:
|
|||||||
_cleanupOnNextFrame = false;
|
_cleanupOnNextFrame = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case osgGA::GUIEventAdapter::PUSH:
|
case osgGA::GUIEventAdapter::PUSH:
|
||||||
case osgGA::GUIEventAdapter::DRAG:
|
case osgGA::GUIEventAdapter::DRAG:
|
||||||
case osgGA::GUIEventAdapter::RELEASE:
|
case osgGA::GUIEventAdapter::RELEASE:
|
||||||
@@ -179,74 +179,74 @@ private:
|
|||||||
// is this a multi-touch event?
|
// is this a multi-touch event?
|
||||||
if (!ea.isMultiTouchEvent())
|
if (!ea.isMultiTouchEvent())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
unsigned int j(0);
|
unsigned int j(0);
|
||||||
|
|
||||||
// iterate over all touch-points and update the geometry
|
// iterate over all touch-points and update the geometry
|
||||||
unsigned num_touch_ended(0);
|
unsigned num_touch_ended(0);
|
||||||
|
|
||||||
for(osgGA::GUIEventAdapter::TouchData::iterator i = ea.getTouchData()->begin(); i != ea.getTouchData()->end(); ++i, ++j)
|
for(osgGA::GUIEventAdapter::TouchData::iterator i = ea.getTouchData()->begin(); i != ea.getTouchData()->end(); ++i, ++j)
|
||||||
{
|
{
|
||||||
const osgGA::GUIEventAdapter::TouchData::TouchPoint& tp = (*i);
|
const osgGA::GUIEventAdapter::TouchData::TouchPoint& tp = (*i);
|
||||||
float x = ea.getTouchPointNormalizedX(j);
|
float x = ea.getTouchPointNormalizedX(j);
|
||||||
float y = ea.getTouchPointNormalizedY(j);
|
float y = ea.getTouchPointNormalizedY(j);
|
||||||
|
|
||||||
// std::cout << j << ": " << tp.x << "/" << tp.y <<" "<< x << " " << y << " " << _w << " " << _h << std::endl;
|
// std::cout << j << ": " << tp.x << "/" << tp.y <<" "<< x << " " << y << " " << _w << " " << _h << std::endl;
|
||||||
|
|
||||||
_mats[j]->setMatrix(osg::Matrix::translate((1+x) * 0.5 * _w, (1+y) * 0.5 * _h, 0));
|
_mats[j]->setMatrix(osg::Matrix::translate((1+x) * 0.5 * _w, (1+y) * 0.5 * _h, 0));
|
||||||
_mats[j]->setNodeMask(0xffff);
|
_mats[j]->setNodeMask(0xffff);
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "Touch " << tp.id;
|
ss << "Touch " << tp.id;
|
||||||
_texts[j]->setText(ss.str());
|
_texts[j]->setText(ss.str());
|
||||||
|
|
||||||
switch (tp.phase)
|
switch (tp.phase)
|
||||||
{
|
{
|
||||||
case osgGA::GUIEventAdapter::TOUCH_BEGAN:
|
case osgGA::GUIEventAdapter::TOUCH_BEGAN:
|
||||||
_drawables[j]->setColor(osg::Vec4(0,1,0,1));
|
_drawables[j]->setColor(osg::Vec4(0,1,0,1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case osgGA::GUIEventAdapter::TOUCH_MOVED:
|
case osgGA::GUIEventAdapter::TOUCH_MOVED:
|
||||||
_drawables[j]->setColor(osg::Vec4(1,1,1,1));
|
_drawables[j]->setColor(osg::Vec4(1,1,1,1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case osgGA::GUIEventAdapter::TOUCH_ENDED:
|
case osgGA::GUIEventAdapter::TOUCH_ENDED:
|
||||||
_drawables[j]->setColor(osg::Vec4(1,0,0,1));
|
_drawables[j]->setColor(osg::Vec4(1,0,0,1));
|
||||||
++num_touch_ended;
|
++num_touch_ended;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case osgGA::GUIEventAdapter::TOUCH_STATIONERY:
|
case osgGA::GUIEventAdapter::TOUCH_STATIONERY:
|
||||||
_drawables[j]->setColor(osg::Vec4(0.8,0.8,0.8,1));
|
_drawables[j]->setColor(osg::Vec4(0.8,0.8,0.8,1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide unused geometry
|
// hide unused geometry
|
||||||
cleanup(j);
|
cleanup(j);
|
||||||
|
|
||||||
//check if all touches ended
|
//check if all touches ended
|
||||||
if ((ea.getTouchData()->getNumTouchPoints() > 0) && (ea.getTouchData()->getNumTouchPoints() == num_touch_ended))
|
if ((ea.getTouchData()->getNumTouchPoints() > 0) && (ea.getTouchData()->getNumTouchPoints() == num_touch_ended))
|
||||||
{
|
{
|
||||||
_cleanupOnNextFrame = true;
|
_cleanupOnNextFrame = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reposition mouse-pointer
|
// reposition mouse-pointer
|
||||||
aa.requestWarpPointer((ea.getWindowX() + ea.getWindowWidth()) / 2.0, (ea.getWindowY() + ea.getWindowHeight()) / 2.0);
|
aa.requestWarpPointer((ea.getWindowX() + ea.getWindowWidth()) / 2.0, (ea.getWindowY() + ea.getWindowHeight()) / 2.0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup(unsigned int j)
|
void cleanup(unsigned int j)
|
||||||
{
|
{
|
||||||
for(unsigned k = j; k < _mats.size(); ++k) {
|
for(unsigned k = j; k < _mats.size(); ++k) {
|
||||||
_mats[k]->setNodeMask(0x0);
|
_mats[k]->setNodeMask(0x0);
|
||||||
@@ -257,7 +257,7 @@ private:
|
|||||||
std::vector<osg::MatrixTransform*> _mats;
|
std::vector<osg::MatrixTransform*> _mats;
|
||||||
std::vector<osgText::Text*> _texts;
|
std::vector<osgText::Text*> _texts;
|
||||||
bool _cleanupOnNextFrame;
|
bool _cleanupOnNextFrame;
|
||||||
|
|
||||||
float _w, _h;
|
float _w, _h;
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -267,7 +267,7 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
|
|
||||||
unsigned int helpType = 0;
|
unsigned int helpType = 0;
|
||||||
if ((helpType = arguments.readHelpType()))
|
if ((helpType = arguments.readHelpType()))
|
||||||
@@ -284,12 +284,12 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> scene = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default model instead.
|
// if not loaded assume no arguments passed in, try use default model instead.
|
||||||
if (!scene) scene = osgDB::readNodeFile("dumptruck.osgt");
|
if (!scene) scene = osgDB::readRefNodeFile("dumptruck.osgt");
|
||||||
|
|
||||||
if (!scene)
|
if (!scene)
|
||||||
{
|
{
|
||||||
osg::Geode* geode = new osg::Geode();
|
osg::Geode* geode = new osg::Geode();
|
||||||
osg::ShapeDrawable* drawable = new osg::ShapeDrawable(new osg::Box(osg::Vec3(0,0,0), 100));
|
osg::ShapeDrawable* drawable = new osg::ShapeDrawable(new osg::Box(osg::Vec3(0,0,0), 100));
|
||||||
@@ -301,43 +301,43 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// construct the viewer.
|
// construct the viewer.
|
||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
|
|
||||||
//opening devices
|
//opening devices
|
||||||
std::string device;
|
std::string device;
|
||||||
while(arguments.read("--device", device))
|
while(arguments.read("--device", device))
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device);
|
osg::ref_ptr<osgGA::Device> dev = osgDB::readRefFile<osgGA::Device>(device);
|
||||||
if (dev.valid())
|
if (dev.valid())
|
||||||
{
|
{
|
||||||
viewer.addDevice(dev.get());
|
viewer.addDevice(dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Group> group = new osg::Group;
|
osg::ref_ptr<osg::Group> group = new osg::Group;
|
||||||
|
|
||||||
// add the HUD subgraph.
|
// add the HUD subgraph.
|
||||||
if (scene.valid()) group->addChild(scene.get());
|
if (scene) group->addChild(scene);
|
||||||
|
|
||||||
viewer.setCameraManipulator(new osgGA::MultiTouchTrackballManipulator());
|
viewer.setCameraManipulator(new osgGA::MultiTouchTrackballManipulator());
|
||||||
viewer.realize();
|
viewer.realize();
|
||||||
|
|
||||||
osg::GraphicsContext* gc = viewer.getCamera()->getGraphicsContext();
|
osg::GraphicsContext* gc = viewer.getCamera()->getGraphicsContext();
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// as multitouch is disabled by default, enable it now
|
// as multitouch is disabled by default, enable it now
|
||||||
osgViewer::GraphicsWindowCocoa* win = dynamic_cast<osgViewer::GraphicsWindowCocoa*>(gc);
|
osgViewer::GraphicsWindowCocoa* win = dynamic_cast<osgViewer::GraphicsWindowCocoa*>(gc);
|
||||||
if (win) win->setMultiTouchEnabled(true);
|
if (win) win->setMultiTouchEnabled(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::cout << "creating hud with " << gc->getTraits()->width << "x" << gc->getTraits()->height << std::endl;
|
std::cout << "creating hud with " << gc->getTraits()->width << "x" << gc->getTraits()->height << std::endl;
|
||||||
osg::Camera* hud_camera = createHUD(gc->getTraits()->width, gc->getTraits()->height);
|
osg::Camera* hud_camera = createHUD(gc->getTraits()->width, gc->getTraits()->height);
|
||||||
|
|
||||||
|
|
||||||
viewer.addEventHandler(new TestMultiTouchEventHandler(hud_camera, gc->getTraits()->width, gc->getTraits()->height));
|
viewer.addEventHandler(new TestMultiTouchEventHandler(hud_camera, gc->getTraits()->width, gc->getTraits()->height));
|
||||||
|
|
||||||
|
|
||||||
group->addChild(hud_camera);
|
group->addChild(hud_camera);
|
||||||
|
|
||||||
// set the scene to render
|
// set the scene to render
|
||||||
@@ -345,5 +345,5 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
return viewer.run();
|
return viewer.run();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,11 +64,11 @@ int main( int argc, char **argv )
|
|||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> scene = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
if (!scene)
|
if (!scene)
|
||||||
{
|
{
|
||||||
scene = osgDB::readNodeFile("http://www.openscenegraph.org/data/earth_bayarea/earth.ive");
|
scene = osgDB::readRefNodeFile("http://www.openscenegraph.org/data/earth_bayarea/earth.ive");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!scene)
|
if (!scene)
|
||||||
@@ -123,7 +123,7 @@ int main( int argc, char **argv )
|
|||||||
view->setName("View one");
|
view->setName("View one");
|
||||||
viewer.addView(view);
|
viewer.addView(view);
|
||||||
|
|
||||||
view->setSceneData(scene.get());
|
view->setSceneData(scene);
|
||||||
view->getCamera()->setName("Cam one");
|
view->getCamera()->setName("Cam one");
|
||||||
view->getCamera()->setViewport(new osg::Viewport(0,0, traits->width/2, traits->height/2));
|
view->getCamera()->setViewport(new osg::Viewport(0,0, traits->width/2, traits->height/2));
|
||||||
view->getCamera()->setGraphicsContext(gc.get());
|
view->getCamera()->setGraphicsContext(gc.get());
|
||||||
@@ -148,7 +148,7 @@ int main( int argc, char **argv )
|
|||||||
view->setName("View two");
|
view->setName("View two");
|
||||||
viewer.addView(view);
|
viewer.addView(view);
|
||||||
|
|
||||||
view->setSceneData(scene.get());
|
view->setSceneData(scene);
|
||||||
view->getCamera()->setName("Cam two");
|
view->getCamera()->setName("Cam two");
|
||||||
view->getCamera()->setViewport(new osg::Viewport(traits->width/2,0, traits->width/2, traits->height/2));
|
view->getCamera()->setViewport(new osg::Viewport(traits->width/2,0, traits->width/2, traits->height/2));
|
||||||
view->getCamera()->setGraphicsContext(gc.get());
|
view->getCamera()->setGraphicsContext(gc.get());
|
||||||
@@ -162,7 +162,7 @@ int main( int argc, char **argv )
|
|||||||
view->setName("View three");
|
view->setName("View three");
|
||||||
viewer.addView(view);
|
viewer.addView(view);
|
||||||
|
|
||||||
view->setSceneData(scene.get());
|
view->setSceneData(scene);
|
||||||
|
|
||||||
view->getCamera()->setName("Cam three");
|
view->getCamera()->setName("Cam three");
|
||||||
view->getCamera()->setProjectionMatrixAsPerspective(30.0, double(traits->width) / double(traits->height/2), 1.0, 1000.0);
|
view->getCamera()->setProjectionMatrixAsPerspective(30.0, double(traits->width) / double(traits->height/2), 1.0, 1000.0);
|
||||||
|
|||||||
@@ -311,10 +311,10 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* loadedmodel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedmodel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try using default mode instead.
|
// if not loaded assume no arguments passed in, try using default mode instead.
|
||||||
if (!loadedmodel) loadedmodel = osgDB::readNodeFile("glider.osgt");
|
if (!loadedmodel) loadedmodel = osgDB::readRefNodeFile("glider.osgt");
|
||||||
|
|
||||||
if (!loadedmodel)
|
if (!loadedmodel)
|
||||||
{
|
{
|
||||||
@@ -336,12 +336,12 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rootnode = createOccludersAroundModel(loadedmodel);
|
rootnode = createOccludersAroundModel(loadedmodel.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// add a viewport to the viewer and attach the scene graph.
|
// add a viewport to the viewer and attach the scene graph.
|
||||||
viewer.setSceneData( rootnode.get() );
|
viewer.setSceneData( rootnode );
|
||||||
|
|
||||||
return viewer.run();
|
return viewer.run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -749,8 +749,8 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
if (arguments.argc()>1)
|
if (arguments.argc()>1)
|
||||||
{
|
{
|
||||||
root = osgDB::readNodeFiles( arguments );
|
root = osgDB::readRefNodeFiles( arguments );
|
||||||
if (root.valid())
|
if (root)
|
||||||
{
|
{
|
||||||
// Run a NodeVisitor to insert OcclusionQueryNodes in the scene graph.
|
// Run a NodeVisitor to insert OcclusionQueryNodes in the scene graph.
|
||||||
OcclusionQueryVisitor oqv;
|
OcclusionQueryVisitor oqv;
|
||||||
@@ -787,10 +787,10 @@ int main(int argc, char** argv)
|
|||||||
if (optimize)
|
if (optimize)
|
||||||
{
|
{
|
||||||
osgUtil::Optimizer optimizer;
|
osgUtil::Optimizer optimizer;
|
||||||
optimizer.optimize( root.get() );
|
optimizer.optimize( root );
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer.setSceneData( root.get() );
|
viewer.setSceneData( root );
|
||||||
|
|
||||||
KeyHandler* kh = new KeyHandler( *root );
|
KeyHandler* kh = new KeyHandler( *root );
|
||||||
viewer.addEventHandler( kh );
|
viewer.addEventHandler( kh );
|
||||||
|
|||||||
@@ -139,10 +139,8 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
DepthPeeling::CullCallback::CullCallback(unsigned int texUnit, unsigned int texWidth, unsigned int texHeight, unsigned int offsetValue) :
|
DepthPeeling::CullCallback::CullCallback(unsigned int texUnit, unsigned int offsetValue) :
|
||||||
_texUnit(texUnit),
|
_texUnit(texUnit),
|
||||||
_texWidth(texWidth),
|
|
||||||
_texHeight(texHeight),
|
|
||||||
_offsetValue(offsetValue)
|
_offsetValue(offsetValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -317,7 +315,7 @@ void DepthPeeling::createPeeling()
|
|||||||
// create some uniform and cull callback objects
|
// create some uniform and cull callback objects
|
||||||
osg::Uniform *depthOff = new osg::Uniform("depthtest", (bool)false);
|
osg::Uniform *depthOff = new osg::Uniform("depthtest", (bool)false);
|
||||||
osg::Uniform *depthOn = new osg::Uniform("depthtest", (bool)true);
|
osg::Uniform *depthOn = new osg::Uniform("depthtest", (bool)true);
|
||||||
CullCallback *ccb = new CullCallback(_texUnit, _texWidth, _texHeight, _offsetValue);
|
CullCallback *ccb = new CullCallback(_texUnit, _offsetValue);
|
||||||
|
|
||||||
// create a node for solid model rendering
|
// create a node for solid model rendering
|
||||||
osg::Group *pre_solidNode = new osg::Group;
|
osg::Group *pre_solidNode = new osg::Group;
|
||||||
@@ -412,7 +410,7 @@ void DepthPeeling::createPeeling()
|
|||||||
_compositeCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
_compositeCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
_compositeCamera->setViewMatrix(osg::Matrix());
|
_compositeCamera->setViewMatrix(osg::Matrix());
|
||||||
_compositeCamera->setProjectionMatrix(osg::Matrix::ortho2D(0, 1, 0, 1));
|
_compositeCamera->setProjectionMatrix(osg::Matrix::ortho2D(0, 1, 0, 1));
|
||||||
_compositeCamera->setCullCallback(new CullCallback(0, _texWidth, _texHeight, 0));
|
_compositeCamera->setCullCallback(new CullCallback(0, 0));
|
||||||
osg::StateSet* stateSet = _compositeCamera->getOrCreateStateSet();
|
osg::StateSet* stateSet = _compositeCamera->getOrCreateStateSet();
|
||||||
stateSet->setRenderBinDetails(100, "TraversalOrderBin", osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);
|
stateSet->setRenderBinDetails(100, "TraversalOrderBin", osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);
|
||||||
_root->addChild(_compositeCamera.get());
|
_root->addChild(_compositeCamera.get());
|
||||||
|
|||||||
@@ -63,13 +63,11 @@ protected:
|
|||||||
|
|
||||||
class CullCallback : public osg::NodeCallback {
|
class CullCallback : public osg::NodeCallback {
|
||||||
public:
|
public:
|
||||||
CullCallback(unsigned int texUnit, unsigned int texWidth, unsigned int texHeight, unsigned int offsetValue);
|
CullCallback(unsigned int texUnit, unsigned int offsetValue);
|
||||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int _texUnit;
|
unsigned int _texUnit;
|
||||||
unsigned int _texWidth;
|
|
||||||
unsigned int _texHeight;
|
|
||||||
unsigned int _offsetValue;
|
unsigned int _offsetValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -55,23 +55,23 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
osg::DisplaySettings* displaySettings = new osg::DisplaySettings;
|
osg::DisplaySettings* displaySettings = new osg::DisplaySettings;
|
||||||
viewer.setDisplaySettings(displaySettings);
|
viewer.setDisplaySettings(displaySettings);
|
||||||
|
|
||||||
// Add the stats handler
|
// Add the stats handler
|
||||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||||
|
|
||||||
// add the help handler
|
// add the help handler
|
||||||
viewer.addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage()));
|
viewer.addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage()));
|
||||||
|
|
||||||
// any option left unread are converted into errors to write out later.
|
// any option left unread are converted into errors to write out later.
|
||||||
arguments.reportRemainingOptionsAsUnrecognized();
|
arguments.reportRemainingOptionsAsUnrecognized();
|
||||||
|
|
||||||
// read the dump truck, we will need it twice
|
// read the dump truck, we will need it twice
|
||||||
osg::ref_ptr<osg::Node> dt = osgDB::readNodeFile("dumptruck.osg");
|
osg::ref_ptr<osg::Node> dt = osgDB::readRefNodeFile("dumptruck.osg");
|
||||||
|
|
||||||
// display a solid version of the dump truck
|
// display a solid version of the dump truck
|
||||||
osg::ref_ptr<osg::PositionAttitudeTransform> solidModel = new osg::PositionAttitudeTransform;
|
osg::ref_ptr<osg::PositionAttitudeTransform> solidModel = new osg::PositionAttitudeTransform;
|
||||||
solidModel->setPosition(osg::Vec3f(7.0f, -2.0f, 7.0f));
|
solidModel->setPosition(osg::Vec3f(7.0f, -2.0f, 7.0f));
|
||||||
solidModel->addChild(dt.get());
|
solidModel->addChild(dt);
|
||||||
|
|
||||||
// generate the 3D heatmap surface to display
|
// generate the 3D heatmap surface to display
|
||||||
osg::ref_ptr<Heatmap> hm = new Heatmap(30, 30, 10, 30, 30, 1.0, 0.25);
|
osg::ref_ptr<Heatmap> hm = new Heatmap(30, 30, 10, 30, 30, 1.0, 0.25);
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ private:
|
|||||||
|
|
||||||
bool UserEventHandler::handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv)
|
bool UserEventHandler::handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv)
|
||||||
{
|
{
|
||||||
|
|
||||||
OSG_ALWAYS << "handle user-event: " << event->getName() << std::endl;
|
OSG_ALWAYS << "handle user-event: " << event->getName() << std::endl;
|
||||||
|
|
||||||
if (event->getName() == "/pick-result")
|
if (event->getName() == "/pick-result")
|
||||||
@@ -215,7 +215,7 @@ bool UserEventHandler::handle(osgGA::Event* event, osg::Object* object, osg::Nod
|
|||||||
ss << "x: " << y << " y: " << y << std::endl;
|
ss << "x: " << y << " y: " << y << std::endl;
|
||||||
|
|
||||||
_text->setText(ss.str());
|
_text->setText(ss.str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(event->getName() == "/osgga")
|
else if(event->getName() == "/osgga")
|
||||||
@@ -231,7 +231,7 @@ bool UserEventHandler::handle(osgGA::Event* event, osg::Object* object, osg::Nod
|
|||||||
if (win)
|
if (win)
|
||||||
win->setWindowRectangle(rect[2] + 10 + rect[0], rect[1], rect[2], rect[3]);
|
win->setWindowRectangle(rect[2] + 10 + rect[0], rect[1], rect[2], rect[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -251,7 +251,7 @@ bool UserEventHandler::handle(osgGA::Event* event, osg::Object* object, osg::Nod
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,8 +377,8 @@ public:
|
|||||||
|
|
||||||
std::ostringstream ss ;
|
std::ostringstream ss ;
|
||||||
ss << host << ":" << port << ".sender.osc";
|
ss << host << ":" << port << ".sender.osc";
|
||||||
_device = osgDB::readFile<osgGA::Device>(ss.str());
|
_device = osgDB::readRefFile<osgGA::Device>(ss.str());
|
||||||
|
|
||||||
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
|
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
|
||||||
osgViewer::View* view = ev ? dynamic_cast<osgViewer::View*>(ev->getActionAdapter()) : NULL;
|
osgViewer::View* view = ev ? dynamic_cast<osgViewer::View*>(ev->getActionAdapter()) : NULL;
|
||||||
if (view)
|
if (view)
|
||||||
@@ -403,14 +403,14 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> scene = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
if (!scene)
|
if (!scene)
|
||||||
{
|
{
|
||||||
osg::Geode* geode = new osg::Geode();
|
osg::Geode* geode = new osg::Geode();
|
||||||
osg::ShapeDrawable* drawable = new osg::ShapeDrawable(new osg::Box());
|
osg::ShapeDrawable* drawable = new osg::ShapeDrawable(new osg::Box());
|
||||||
geode->addDrawable(drawable);
|
geode->addDrawable(drawable);
|
||||||
|
|
||||||
scene = geode;
|
scene = geode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,15 +463,15 @@ int main( int argc, char **argv )
|
|||||||
view->addEventHandler( new osgViewer::StatsHandler );
|
view->addEventHandler( new osgViewer::StatsHandler );
|
||||||
view->addEventHandler( new UserEventHandler(text) );
|
view->addEventHandler( new UserEventHandler(text) );
|
||||||
|
|
||||||
osg::ref_ptr<osgGA::Device> device = osgDB::readFile<osgGA::Device>("0.0.0.0:9000.receiver.osc");
|
osg::ref_ptr<osgGA::Device> device = osgDB::readRefFile<osgGA::Device>("0.0.0.0:9000.receiver.osc");
|
||||||
if (device.valid() && (device->getCapabilities() & osgGA::Device::RECEIVE_EVENTS))
|
if (device.valid() && (device->getCapabilities() & osgGA::Device::RECEIVE_EVENTS))
|
||||||
{
|
{
|
||||||
view->addDevice(device.get());
|
view->addDevice(device);
|
||||||
|
|
||||||
// add a zeroconf device, advertising the osc-device
|
// add a zeroconf device, advertising the osc-device
|
||||||
if(use_zeroconf)
|
if(use_zeroconf)
|
||||||
{
|
{
|
||||||
osgGA::Device* zeroconf_device = osgDB::readFile<osgGA::Device>("_osc._udp:9000.advertise.zeroconf");
|
osg::ref_ptr<osgGA::Device> zeroconf_device = osgDB::readRefFile<osgGA::Device>("_osc._udp:9000.advertise.zeroconf");
|
||||||
if (zeroconf_device)
|
if (zeroconf_device)
|
||||||
{
|
{
|
||||||
view->addDevice(zeroconf_device);
|
view->addDevice(zeroconf_device);
|
||||||
@@ -496,8 +496,8 @@ int main( int argc, char **argv )
|
|||||||
traits->windowName = "Sender / view one";
|
traits->windowName = "Sender / view one";
|
||||||
|
|
||||||
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
|
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
|
||||||
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// as multitouch is disabled by default, enable it now
|
// as multitouch is disabled by default, enable it now
|
||||||
osgViewer::GraphicsWindowCocoa* win = dynamic_cast<osgViewer::GraphicsWindowCocoa*>(gc.get());
|
osgViewer::GraphicsWindowCocoa* win = dynamic_cast<osgViewer::GraphicsWindowCocoa*>(gc.get());
|
||||||
@@ -527,7 +527,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
if (use_zeroconf)
|
if (use_zeroconf)
|
||||||
{
|
{
|
||||||
osgGA::Device* zeroconf_device = osgDB::readFile<osgGA::Device>("_osc._udp.discover.zeroconf");
|
osg::ref_ptr<osgGA::Device> zeroconf_device = osgDB::readRefFile<osgGA::Device>("_osc._udp.discover.zeroconf");
|
||||||
if(zeroconf_device) {
|
if(zeroconf_device) {
|
||||||
view->addDevice(zeroconf_device);
|
view->addDevice(zeroconf_device);
|
||||||
view->getEventHandlers().push_front(new OscServiceDiscoveredEventHandler());
|
view->getEventHandlers().push_front(new OscServiceDiscoveredEventHandler());
|
||||||
@@ -536,7 +536,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osgGA::Device> device = osgDB::readFile<osgGA::Device>("localhost:9000.sender.osc");
|
osg::ref_ptr<osgGA::Device> device = osgDB::readRefFile<osgGA::Device>("localhost:9000.sender.osc");
|
||||||
if (device.valid() && (device->getCapabilities() & osgGA::Device::SEND_EVENTS))
|
if (device.valid() && (device->getCapabilities() & osgGA::Device::SEND_EVENTS))
|
||||||
{
|
{
|
||||||
// add as first event handler, so it gets ALL events ...
|
// add as first event handler, so it gets ALL events ...
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
// load outlined object
|
// load outlined object
|
||||||
std::string modelFilename = arguments.argc() > 1 ? arguments[1] : "dumptruck.osgt";
|
std::string modelFilename = arguments.argc() > 1 ? arguments[1] : "dumptruck.osgt";
|
||||||
osg::ref_ptr<osg::Node> outlineModel = osgDB::readNodeFile(modelFilename);
|
osg::ref_ptr<osg::Node> outlineModel = osgDB::readRefNodeFile(modelFilename);
|
||||||
if (!outlineModel)
|
if (!outlineModel)
|
||||||
{
|
{
|
||||||
osg::notify(osg::FATAL) << "Unable to load model '" << modelFilename << "'\n";
|
osg::notify(osg::FATAL) << "Unable to load model '" << modelFilename << "'\n";
|
||||||
@@ -38,18 +38,18 @@ int main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
// create outline effect
|
// create outline effect
|
||||||
osg::ref_ptr<osgFX::Outline> outline = new osgFX::Outline;
|
osg::ref_ptr<osgFX::Outline> outline = new osgFX::Outline;
|
||||||
root->addChild(outline.get());
|
root->addChild(outline);
|
||||||
|
|
||||||
outline->setWidth(8);
|
outline->setWidth(8);
|
||||||
outline->setColor(osg::Vec4(1,1,0,1));
|
outline->setColor(osg::Vec4(1,1,0,1));
|
||||||
outline->addChild(outlineModel.get());
|
outline->addChild(outlineModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testOcclusion)
|
if (testOcclusion)
|
||||||
{
|
{
|
||||||
// load occluder
|
// load occluder
|
||||||
std::string occludedModelFilename = "cow.osgt";
|
std::string occludedModelFilename = "cow.osgt";
|
||||||
osg::ref_ptr<osg::Node> occludedModel = osgDB::readNodeFile(occludedModelFilename);
|
osg::ref_ptr<osg::Node> occludedModel = osgDB::readRefNodeFile(occludedModelFilename);
|
||||||
if (!occludedModel)
|
if (!occludedModel)
|
||||||
{
|
{
|
||||||
osg::notify(osg::FATAL) << "Unable to load model '" << occludedModelFilename << "'\n";
|
osg::notify(osg::FATAL) << "Unable to load model '" << occludedModelFilename << "'\n";
|
||||||
@@ -63,14 +63,14 @@ int main(int argc, char** argv)
|
|||||||
// occluder behind outlined model
|
// occluder behind outlined model
|
||||||
osg::ref_ptr<osg::PositionAttitudeTransform> modelTransform0 = new osg::PositionAttitudeTransform;
|
osg::ref_ptr<osg::PositionAttitudeTransform> modelTransform0 = new osg::PositionAttitudeTransform;
|
||||||
modelTransform0->setPosition(bsphere.center() + occluderOffset);
|
modelTransform0->setPosition(bsphere.center() + occluderOffset);
|
||||||
modelTransform0->addChild(occludedModel.get());
|
modelTransform0->addChild(occludedModel);
|
||||||
root->addChild(modelTransform0.get());
|
root->addChild(modelTransform0);
|
||||||
|
|
||||||
// occluder in front of outlined model
|
// occluder in front of outlined model
|
||||||
osg::ref_ptr<osg::PositionAttitudeTransform> modelTransform1 = new osg::PositionAttitudeTransform;
|
osg::ref_ptr<osg::PositionAttitudeTransform> modelTransform1 = new osg::PositionAttitudeTransform;
|
||||||
modelTransform1->setPosition(bsphere.center() - occluderOffset);
|
modelTransform1->setPosition(bsphere.center() - occluderOffset);
|
||||||
modelTransform1->addChild(occludedModel.get());
|
modelTransform1->addChild(occludedModel);
|
||||||
root->addChild(modelTransform1.get());
|
root->addChild(modelTransform1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// must have stencil buffer...
|
// must have stencil buffer...
|
||||||
@@ -78,7 +78,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
// construct the viewer
|
// construct the viewer
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
viewer.setSceneData(root.get());
|
viewer.setSceneData(root);
|
||||||
|
|
||||||
// must clear stencil buffer...
|
// must clear stencil buffer...
|
||||||
unsigned int clearMask = viewer.getCamera()->getClearMask();
|
unsigned int clearMask = viewer.getCamera()->getClearMask();
|
||||||
|
|||||||
@@ -43,17 +43,17 @@ public:
|
|||||||
_count(0)
|
_count(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void apply(osg::Node& node)
|
virtual void apply(osg::Node& node)
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << node.className() << "_"<<_count++;
|
os << node.className() << "_"<<_count++;
|
||||||
|
|
||||||
node.setName(os.str());
|
node.setName(os.str());
|
||||||
|
|
||||||
traverse(node);
|
traverse(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int _count;
|
unsigned int _count;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ public:
|
|||||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
|
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void apply(osg::PagedLOD& plod)
|
virtual void apply(osg::PagedLOD& plod)
|
||||||
{
|
{
|
||||||
std::cout<<"PagedLOD "<<plod.getName()<<" numRanges = "<< plod.getNumRanges()<<" numFiles = "<<plod.getNumFileNames()<<std::endl;
|
std::cout<<"PagedLOD "<<plod.getName()<<" numRanges = "<< plod.getNumRanges()<<" numFiles = "<<plod.getNumFileNames()<<std::endl;
|
||||||
@@ -72,7 +72,7 @@ public:
|
|||||||
{
|
{
|
||||||
std::cout<<" files = '"<<plod.getFileName(i)<<"'"<<std::endl;
|
std::cout<<" files = '"<<plod.getFileName(i)<<"'"<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
|
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void apply(osg::PagedLOD& plod)
|
virtual void apply(osg::PagedLOD& plod)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -98,9 +98,9 @@ public:
|
|||||||
osgDB::writeNodeFile(*child,filename);
|
osgDB::writeNodeFile(*child,filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
traverse(plod);
|
traverse(plod);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConvertToPageLODVistor : public osg::NodeVisitor
|
class ConvertToPageLODVistor : public osg::NodeVisitor
|
||||||
@@ -113,7 +113,7 @@ public:
|
|||||||
_makeAllChildrenPaged(makeAllChildrenPaged)
|
_makeAllChildrenPaged(makeAllChildrenPaged)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~ConvertToPageLODVistor()
|
virtual ~ConvertToPageLODVistor()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -121,9 +121,9 @@ public:
|
|||||||
virtual void apply(osg::LOD& lod)
|
virtual void apply(osg::LOD& lod)
|
||||||
{
|
{
|
||||||
_lodSet.insert(&lod);
|
_lodSet.insert(&lod);
|
||||||
|
|
||||||
traverse(lod);
|
traverse(lod);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void apply(osg::PagedLOD& plod)
|
virtual void apply(osg::PagedLOD& plod)
|
||||||
{
|
{
|
||||||
@@ -139,7 +139,7 @@ public:
|
|||||||
++itr, ++lodNum)
|
++itr, ++lodNum)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::LOD> lod = const_cast<osg::LOD*>(itr->get());
|
osg::ref_ptr<osg::LOD> lod = const_cast<osg::LOD*>(itr->get());
|
||||||
|
|
||||||
if (lod->getNumParents()==0)
|
if (lod->getNumParents()==0)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Warning can't operator on root node."<<std::endl;
|
osg::notify(osg::NOTICE)<<"Warning can't operator on root node."<<std::endl;
|
||||||
@@ -153,9 +153,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
osg::notify(osg::NOTICE)<<"Converting LOD to PagedLOD."<<std::endl;
|
osg::notify(osg::NOTICE)<<"Converting LOD to PagedLOD."<<std::endl;
|
||||||
|
|
||||||
osg::PagedLOD* plod = new osg::PagedLOD;
|
osg::PagedLOD* plod = new osg::PagedLOD;
|
||||||
|
|
||||||
const osg::LOD::RangeList& originalRangeList = lod->getRangeList();
|
const osg::LOD::RangeList& originalRangeList = lod->getRangeList();
|
||||||
typedef std::multimap< osg::LOD::MinMaxPair , unsigned int > MinMaxPairMap;
|
typedef std::multimap< osg::LOD::MinMaxPair , unsigned int > MinMaxPairMap;
|
||||||
MinMaxPairMap rangeMap;
|
MinMaxPairMap rangeMap;
|
||||||
@@ -166,7 +166,7 @@ public:
|
|||||||
{
|
{
|
||||||
rangeMap.insert(std::multimap< osg::LOD::MinMaxPair , unsigned int >::value_type(*ritr, pos));
|
rangeMap.insert(std::multimap< osg::LOD::MinMaxPair , unsigned int >::value_type(*ritr, pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
for(MinMaxPairMap::reverse_iterator mitr = rangeMap.rbegin();
|
for(MinMaxPairMap::reverse_iterator mitr = rangeMap.rbegin();
|
||||||
mitr != rangeMap.rend();
|
mitr != rangeMap.rend();
|
||||||
@@ -181,11 +181,11 @@ public:
|
|||||||
std::string filename = _basename;
|
std::string filename = _basename;
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << _basename << "_"<<lodNum<<"_"<<pos<<_extension;
|
os << _basename << "_"<<lodNum<<"_"<<pos<<_extension;
|
||||||
|
|
||||||
plod->addChild(lod->getChild(mitr->second), mitr->first.first, mitr->first.second, os.str());
|
plod->addChild(lod->getChild(mitr->second), mitr->first.first, mitr->first.second, os.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node::ParentList parents = lod->getParents();
|
osg::Node::ParentList parents = lod->getParents();
|
||||||
for(osg::Node::ParentList::iterator pitr=parents.begin();
|
for(osg::Node::ParentList::iterator pitr=parents.begin();
|
||||||
pitr!=parents.end();
|
pitr!=parents.end();
|
||||||
@@ -195,12 +195,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
plod->setCenter(plod->getBound().center());
|
plod->setCenter(plod->getBound().center());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef std::set< osg::ref_ptr<osg::LOD> > LODSet;
|
typedef std::set< osg::ref_ptr<osg::LOD> > LODSet;
|
||||||
LODSet _lodSet;
|
LODSet _lodSet;
|
||||||
std::string _basename;
|
std::string _basename;
|
||||||
@@ -214,7 +214,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" creates a hierarchy of files for paging which can be later loaded by viewers.");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" creates a hierarchy of files for paging which can be later loaded by viewers.");
|
||||||
@@ -232,8 +232,8 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
std::string outputfile("output.ive");
|
std::string outputfile("output.ive");
|
||||||
while (arguments.read("-o",outputfile)) {}
|
while (arguments.read("-o",outputfile)) {}
|
||||||
|
|
||||||
|
|
||||||
bool makeAllChildrenPaged = false;
|
bool makeAllChildrenPaged = false;
|
||||||
while (arguments.read("--makeAllChildrenPaged")) { makeAllChildrenPaged = true; }
|
while (arguments.read("--makeAllChildrenPaged")) { makeAllChildrenPaged = true; }
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ int main( int argc, char **argv )
|
|||||||
arguments.writeErrorMessages(std::cout);
|
arguments.writeErrorMessages(std::cout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (arguments.argc()<=1)
|
// if (arguments.argc()<=1)
|
||||||
// {
|
// {
|
||||||
// arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
// arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
||||||
@@ -254,21 +254,21 @@ int main( int argc, char **argv )
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> model = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> model = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
if (!model)
|
if (!model)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"No model loaded."<<std::endl;
|
osg::notify(osg::NOTICE)<<"No model loaded."<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string basename( osgDB::getNameLessExtension(outputfile) );
|
std::string basename( osgDB::getNameLessExtension(outputfile) );
|
||||||
std::string ext = '.'+ osgDB::getFileExtension(outputfile);
|
std::string ext = '.'+ osgDB::getFileExtension(outputfile);
|
||||||
|
|
||||||
ConvertToPageLODVistor converter(basename,ext, makeAllChildrenPaged);
|
ConvertToPageLODVistor converter(basename,ext, makeAllChildrenPaged);
|
||||||
model->accept(converter);
|
model->accept(converter);
|
||||||
converter.convert();
|
converter.convert();
|
||||||
|
|
||||||
NameVistor nameNodes;
|
NameVistor nameNodes;
|
||||||
model->accept(nameNodes);
|
model->accept(nameNodes);
|
||||||
|
|
||||||
@@ -278,7 +278,7 @@ int main( int argc, char **argv )
|
|||||||
if (model.valid())
|
if (model.valid())
|
||||||
{
|
{
|
||||||
osgDB::writeNodeFile(*model,outputfile);
|
osgDB::writeNodeFile(*model,outputfile);
|
||||||
|
|
||||||
WriteOutPagedLODSubgraphsVistor woplsv;
|
WriteOutPagedLODSubgraphsVistor woplsv;
|
||||||
model->accept(woplsv);
|
model->accept(woplsv);
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user