Compare commits
287 Commits
OpenSceneG
...
OpenSceneG
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb442ffacc | ||
|
|
d75bdbc7e5 | ||
|
|
9e8c1b033e | ||
|
|
0aab63cfba | ||
|
|
66b31b677a | ||
|
|
86f312cae9 | ||
|
|
6ceb0a8f87 | ||
|
|
fe40f0b9a4 | ||
|
|
25612d10af | ||
|
|
3477e813d0 | ||
|
|
ef322aba61 | ||
|
|
a6db4f56ef | ||
|
|
6c6c1183c0 | ||
|
|
8d20926032 | ||
|
|
b345512b23 | ||
|
|
9f2030cbcd | ||
|
|
7ab3207732 | ||
|
|
baa210b4a9 | ||
|
|
27c359a69a | ||
|
|
85281a6d1b | ||
|
|
b6ef8c9b6c | ||
|
|
19d6e20cc7 | ||
|
|
578f54beba | ||
|
|
2f7167d011 | ||
|
|
288fb20eb6 | ||
|
|
18d9206a5e | ||
|
|
eddbbe28fa | ||
|
|
71eb974c1b | ||
|
|
f4be375ab8 | ||
|
|
38b454f824 | ||
|
|
fb91677fce | ||
|
|
dab855f141 | ||
|
|
01b510865f | ||
|
|
6c08cc5937 | ||
|
|
7f3fe7baed | ||
|
|
ae233b9392 | ||
|
|
1712176900 | ||
|
|
967e2b7926 | ||
|
|
64d4e6a913 | ||
|
|
ae33aeed8a | ||
|
|
49bf375b68 | ||
|
|
40a0c1cde2 | ||
|
|
bfd9ec30ca | ||
|
|
599715e1d1 | ||
|
|
3fc3fc060f | ||
|
|
29199a9a68 | ||
|
|
b8a76a0ce0 | ||
|
|
a927748a73 | ||
|
|
5d53cb13d5 | ||
|
|
aa3766ca70 | ||
|
|
b5743c1c9f | ||
|
|
894800115c | ||
|
|
0574e17eaa | ||
|
|
9e1362445c | ||
|
|
a1af64be80 | ||
|
|
f02caa5371 | ||
|
|
6d1a94c785 | ||
|
|
1163ebb25b | ||
|
|
4563195a18 | ||
|
|
00ca996576 | ||
|
|
7ab4faeae1 | ||
|
|
4e90ccb13a | ||
|
|
5c70f4828f | ||
|
|
bdcba7220c | ||
|
|
cfa9c3682f | ||
|
|
8f8f217ee7 | ||
|
|
ec0faff644 | ||
|
|
201e73c3c1 | ||
|
|
cb3868872e | ||
|
|
9f45b89722 | ||
|
|
18b8d05d1f | ||
|
|
ae10c4ef89 | ||
|
|
6222373479 | ||
|
|
5be809ab04 | ||
|
|
da79cd85e4 | ||
|
|
211764ca2d | ||
|
|
8041a24a4f | ||
|
|
b011470dfe | ||
|
|
3155b1722c | ||
|
|
40fc0eb263 | ||
|
|
38e68ed7f1 | ||
|
|
15fd3bdcc2 | ||
|
|
1858366514 | ||
|
|
7269f71c47 | ||
|
|
32fb841e58 | ||
|
|
241efbaa33 | ||
|
|
5c6c51c887 | ||
|
|
ace1188557 | ||
|
|
817780e67c | ||
|
|
7ed9ef7db0 | ||
|
|
12d20ee257 | ||
|
|
2bed6a2dca | ||
|
|
315e749cce | ||
|
|
0b5d743411 | ||
|
|
0029d8fc46 | ||
|
|
a5d6c1a6a3 | ||
|
|
65f85fee6d | ||
|
|
df14b9980a | ||
|
|
7ba85b16db | ||
|
|
bda1350be4 | ||
|
|
31f2e7902f | ||
|
|
e89336a306 | ||
|
|
9a8abe7fee | ||
|
|
01b27a9fb2 | ||
|
|
21f735d653 | ||
|
|
4dfa7485c1 | ||
|
|
7bbc1c419b | ||
|
|
ab029febbd | ||
|
|
d5d19ac1a4 | ||
|
|
44da3958c3 | ||
|
|
26e3f00882 | ||
|
|
fb6e1d4d9f | ||
|
|
e4fa4f9119 | ||
|
|
a9c1dd1a4a | ||
|
|
102e5c2439 | ||
|
|
264746a5c2 | ||
|
|
dfa3c9a2c9 | ||
|
|
b795e65a39 | ||
|
|
b1dbb9e96b | ||
|
|
4f6add4c14 | ||
|
|
edb1eede40 | ||
|
|
9cccbcd7b7 | ||
|
|
1bf529b391 | ||
|
|
83b84eb2f4 | ||
|
|
90325a5895 | ||
|
|
c2bc684eb2 | ||
|
|
5b439806ce | ||
|
|
5574c50607 | ||
|
|
31cb807db3 | ||
|
|
3326c26a60 | ||
|
|
8d70cc0b0f | ||
|
|
3558d1d010 | ||
|
|
be47c9f44a | ||
|
|
6dab8c3380 | ||
|
|
bbc8e7b58c | ||
|
|
9d8c98395e | ||
|
|
abbf13d7bf | ||
|
|
431c34024c | ||
|
|
ba50def217 | ||
|
|
7592acf224 | ||
|
|
62f5a4d3bc | ||
|
|
0c345e76d4 | ||
|
|
d4ec341573 | ||
|
|
371778e0e7 | ||
|
|
ca58e0db21 | ||
|
|
a6e017dc3c | ||
|
|
e843836292 | ||
|
|
e7447a46be | ||
|
|
ec23bf1b1c | ||
|
|
285240fd2d | ||
|
|
bf5cad7a0c | ||
|
|
c81ba225c9 | ||
|
|
79967399fe | ||
|
|
adced1b3dc | ||
|
|
0e64a4773a | ||
|
|
f86dbaed74 | ||
|
|
6612b98ddb | ||
|
|
67ef3fd2c5 | ||
|
|
4ae4b9fdf5 | ||
|
|
e1c5969b0e | ||
|
|
029c114c4c | ||
|
|
bc7f1cf5ac | ||
|
|
34c458f075 | ||
|
|
7e84617d24 | ||
|
|
aab533c046 | ||
|
|
b2e40572e5 | ||
|
|
f175cad6d8 | ||
|
|
2d2b13361b | ||
|
|
aa7b0becf7 | ||
|
|
4f3e2c2e82 | ||
|
|
ebee4b6721 | ||
|
|
e383ef95bc | ||
|
|
2741c38c0d | ||
|
|
a15b93432a | ||
|
|
3d4ff7ae02 | ||
|
|
cc3f8eba8b | ||
|
|
5802844f52 | ||
|
|
98c3d362e5 | ||
|
|
9c6f1ac45a | ||
|
|
3e340bb23d | ||
|
|
1bbcc0ea44 | ||
|
|
b3f1204c64 | ||
|
|
df731d8244 | ||
|
|
29857b3b19 | ||
|
|
b608c191c1 | ||
|
|
d3d0c28f61 | ||
|
|
c78d065d51 | ||
|
|
171bc9da21 | ||
|
|
2bb480759f | ||
|
|
4ff8df73bc | ||
|
|
8631eaaf40 | ||
|
|
ed2aa7c90f | ||
|
|
8cd7d36982 | ||
|
|
d843de261e | ||
|
|
c60cff5eb6 | ||
|
|
18726b72ea | ||
|
|
04e10363bb | ||
|
|
ee4d49c398 | ||
|
|
a6774396bd | ||
|
|
c37b478ed6 | ||
|
|
339026a0f2 | ||
|
|
e68110f303 | ||
|
|
1490271272 | ||
|
|
8faa9d3f63 | ||
|
|
8297d8f0cb | ||
|
|
439c3a866b | ||
|
|
8954964c32 | ||
|
|
7e75fa6a66 | ||
|
|
ced46026e5 | ||
|
|
36ba62e69a | ||
|
|
721505f7c9 | ||
|
|
e4eb3896dd | ||
|
|
98df276818 | ||
|
|
c3bad2bd04 | ||
|
|
e4ad3d311d | ||
|
|
fc05e7d8b1 | ||
|
|
d58a21ca5f | ||
|
|
03e08d7918 | ||
|
|
6ce7cc9d6a | ||
|
|
2646423be7 | ||
|
|
625ea05d3f | ||
|
|
f963397726 | ||
|
|
7c97bab944 | ||
|
|
89052bec27 | ||
|
|
99120af181 | ||
|
|
166f949592 | ||
|
|
145d93073c | ||
|
|
db00cb1613 | ||
|
|
1420393b00 | ||
|
|
440445aa8b | ||
|
|
07bccafd05 | ||
|
|
6df979f8c8 | ||
|
|
aef27c4387 | ||
|
|
d3061ac0f7 | ||
|
|
4adc16bcdd | ||
|
|
6a051be85a | ||
|
|
cbb9881003 | ||
|
|
be40ac8aad | ||
|
|
919a1e5286 | ||
|
|
85acee5dcc | ||
|
|
77326d2c17 | ||
|
|
ea3b08526d | ||
|
|
437377b5d5 | ||
|
|
c7f2e570ed | ||
|
|
b9540fc9f1 | ||
|
|
fa8de3058f | ||
|
|
1194f8941c | ||
|
|
1a922f0f28 | ||
|
|
ce1d7c0c90 | ||
|
|
3c50ac6f04 | ||
|
|
b783a7468e | ||
|
|
4e2c17ee02 | ||
|
|
578a910ad0 | ||
|
|
e0f4fb0952 | ||
|
|
6ad6bf8b5a | ||
|
|
0b702d27de | ||
|
|
d3f2c6e505 | ||
|
|
12d62940bc | ||
|
|
ffcece130a | ||
|
|
e2d7743a80 | ||
|
|
6298312cf0 | ||
|
|
1a3a801857 | ||
|
|
5ee4a99de0 | ||
|
|
9097925163 | ||
|
|
f29ddb0e05 | ||
|
|
96cd49d43a | ||
|
|
cd666f61e8 | ||
|
|
1224e0883a | ||
|
|
fde95d5ccf | ||
|
|
d0e12bd379 | ||
|
|
9acbe3e44f | ||
|
|
eb9b99b5ec | ||
|
|
42f06bf81a | ||
|
|
76dd3698ce | ||
|
|
a571574a1c | ||
|
|
223c603a8c | ||
|
|
91716f6e06 | ||
|
|
b8345534c5 | ||
|
|
33cba8392a | ||
|
|
2ab6a762c8 | ||
|
|
cc68950e7a | ||
|
|
59c1483fb9 | ||
|
|
cb37bf2446 | ||
|
|
3a34e2869b | ||
|
|
849333d43e | ||
|
|
a15813c4a7 | ||
|
|
a606fd688c |
182
AUTHORS.txt
182
AUTHORS.txt
@@ -1,169 +1,148 @@
|
||||
OpenSceneGraph Library 2.9.7
|
||||
OpenSceneGraph Library 2.8.2
|
||||
|
||||
407 Contributors:
|
||||
373 Contributors:
|
||||
|
||||
Firstname Surname
|
||||
-----------------
|
||||
Robert Osfield
|
||||
Don Burns
|
||||
Stephan Huber
|
||||
Paul Martz
|
||||
Marco Jez
|
||||
Paul Martz
|
||||
Mike Weiblen
|
||||
Mathias Fr<46>hlich
|
||||
Eric Wing
|
||||
Stephan Huber
|
||||
Brede Johansen
|
||||
Cedric Pinson
|
||||
Jean-Sebastien Guay
|
||||
Geoff Michel
|
||||
Farshid Lashkari
|
||||
Bob Kuehne
|
||||
Ulrich Hertlein
|
||||
Geoff Michel
|
||||
Eric Sokolowsky
|
||||
Wojciech Lewandowski
|
||||
David Callu
|
||||
Jean-Sebastien Guay
|
||||
Martin Lavery
|
||||
Trajce Nikolov
|
||||
Michael Platings
|
||||
David Callu
|
||||
Tree
|
||||
Colin McDonald
|
||||
Luigi Calori
|
||||
Trajce Nikolov
|
||||
Mike Wittman
|
||||
Roger James
|
||||
Wojciech Lewandowski
|
||||
Paul Melis
|
||||
Roland Smeenk
|
||||
Mattias Helsing
|
||||
Jeremy Moles
|
||||
Chris Hanson
|
||||
Colin McDonald
|
||||
Andy Skinner
|
||||
Tom Jolley
|
||||
Roger James
|
||||
Pavel Moloshtan
|
||||
Mattias Helsing
|
||||
Tom Jolley
|
||||
Jeremy Moles
|
||||
Jason Beverage
|
||||
Norman Vine
|
||||
Jason Daly
|
||||
J.P. Delport
|
||||
Cedric Pinson
|
||||
Art Tevs
|
||||
Philip Lowman
|
||||
Alberto Luaces
|
||||
Alberto Farre
|
||||
Wang Rui
|
||||
Sukender
|
||||
Serge Lages
|
||||
Roland Smeenk
|
||||
Michael Platings
|
||||
Andr<EFBFBD> Garneau
|
||||
Adrian Egli
|
||||
Ruben Lopez
|
||||
Randall Hopper
|
||||
Mathieu Marache
|
||||
Sherman Wilcox
|
||||
Robert Milharcic
|
||||
Jason Daly
|
||||
J.P. Delport
|
||||
Adrian Egli
|
||||
Olaf Flebbe
|
||||
Mathieu Marache
|
||||
Gideon May
|
||||
Don Tidrow
|
||||
David Fries
|
||||
Chris Denham
|
||||
Terry Welsh
|
||||
Stephane Lamoliatte
|
||||
Sherman Wilcox
|
||||
Romano Jos<6F> Magacho da Silva
|
||||
Per Fahlberg
|
||||
Michael Gronager
|
||||
Joakim Simonsson
|
||||
David Spilling
|
||||
Daniel Sj<53>lie
|
||||
Bryan Thrall
|
||||
Laurens Voerman
|
||||
Tim Moore
|
||||
Chris Hanson
|
||||
Alberto Luaces
|
||||
Philip Lowman
|
||||
Chris Denham
|
||||
Melchior Franz
|
||||
Lionel Lagarde
|
||||
Jan Peciva
|
||||
Jan Ciger
|
||||
Neil Hughes
|
||||
Mike Connell
|
||||
David Fries
|
||||
Bryan Thrall
|
||||
Terry Welsh
|
||||
Serge Lages
|
||||
Joran Jessurun
|
||||
Glenn Waldron
|
||||
Gino van den Bergen
|
||||
Frederic Marmond
|
||||
Csaba Halasz
|
||||
Boris Bralo
|
||||
Yefei He
|
||||
Tim Moore
|
||||
Stephane Lamoliatte
|
||||
Sondra Iverson
|
||||
Rune Schmidt Jensen
|
||||
Rainer Oder
|
||||
Martin Beckett
|
||||
Neil Groves
|
||||
Mike Connell
|
||||
Martin Aumueller
|
||||
Mario Valle
|
||||
Gordon Tomlinson
|
||||
Fabien Lavignotte
|
||||
Cory Riddell
|
||||
Gino van den Bergen
|
||||
Carlo Camporesi
|
||||
Ben Discoe
|
||||
Andreas Ekstrand
|
||||
Thibault Genessay
|
||||
Sukender
|
||||
Sasa Bistrovic
|
||||
Ravi Mathur
|
||||
Ralf Habacker
|
||||
Neil Groves
|
||||
Martin Naylor
|
||||
Markus Trenkwalder
|
||||
Luc Frauciel
|
||||
Loic Dachary
|
||||
Joseph Steel
|
||||
John Shue
|
||||
David Guthrie
|
||||
Jan Peciva
|
||||
Jan Ciger
|
||||
Glenn Waldron
|
||||
Brad Colbert
|
||||
Vivek Rajan
|
||||
Thom DeCarlo
|
||||
Tatsuhiro Nishioka
|
||||
Tanguy Fautr<74>
|
||||
Simon Julier
|
||||
Sean Spicer
|
||||
Ravi Mathur
|
||||
Peter Hrenka
|
||||
Nikolaus Hanekamp
|
||||
Neil Salter
|
||||
Mihai Radu
|
||||
Michael Hartman
|
||||
Maciej Krol
|
||||
Luc Frauciel
|
||||
Laurens Voerman
|
||||
David Guthrie
|
||||
Corbin Holtz
|
||||
Brad Christiansen
|
||||
Blasius Czink
|
||||
Toshiyuki Takahei
|
||||
Tony Horrobin
|
||||
Thom DeCarlo
|
||||
Tatsuhiro Nishioka
|
||||
Simon Julier
|
||||
Sebastien Grignard
|
||||
Romano Magacho
|
||||
Richard Schmidt
|
||||
Riccardo Corsi
|
||||
Rafa Gaitan
|
||||
Ralf Habacker
|
||||
Paul de Repentigny
|
||||
Liang Aibin
|
||||
Leandro Motta Barros
|
||||
John Vidar Larring
|
||||
John Kelso
|
||||
Gustav Haapalahti
|
||||
Frederic Bouvier
|
||||
Emmanuel Roche
|
||||
Donn Mielcarek
|
||||
Daniel Larimer
|
||||
Csaba Halasz
|
||||
Colin Dunlop
|
||||
Bruce Clay
|
||||
Andreas Goebel
|
||||
Alberto Barbati
|
||||
Vladimir Shabanov
|
||||
Uwe Woessner
|
||||
Tugkan Calapoglu
|
||||
Tony Horrobin
|
||||
Sohey Yamamoto
|
||||
Sergey Leontyev
|
||||
Santosh Gaikwad
|
||||
Rudolf Wiedemann
|
||||
Rafa Gaitan
|
||||
Phil Atkin
|
||||
Nico Kruithof
|
||||
Miguel Escriva
|
||||
Mattias Linde
|
||||
Maria Ten
|
||||
Lilin Xiong
|
||||
Lee Butler
|
||||
Konstantin Sinitsyn
|
||||
Ken Sewell
|
||||
Julian Ortiz
|
||||
Johan Nouvel
|
||||
Jeremy Bell
|
||||
Jaromir Vitek
|
||||
James French
|
||||
@@ -171,32 +150,38 @@ Gary Quinn
|
||||
Garrett Potts
|
||||
Gabor Dorka
|
||||
Fabio Mierlo
|
||||
Erik den Dekker
|
||||
Fabien Lavignotte
|
||||
Doug McCorkle
|
||||
Donn Mielcarek
|
||||
Donald Cipperly
|
||||
Don Leich
|
||||
Domenico Mangieri
|
||||
Charles Cole
|
||||
Blake Williams
|
||||
Antoine Hue
|
||||
Andrew Bettison
|
||||
Andreas Goebel
|
||||
Anders Backman
|
||||
Ali Botorabi
|
||||
Zach Deedler
|
||||
Yuzhong Shen
|
||||
Wang Rui
|
||||
Tugkan Calapoglu
|
||||
Tim Daoust
|
||||
Terrex
|
||||
Tanguy Fautr<74>
|
||||
Sylvain Marie
|
||||
Steve Lunsford
|
||||
Stephane Simon
|
||||
Stephan Eilemann
|
||||
Stanislav Blinov
|
||||
Sergey Leontyev
|
||||
Sebastian Messerschmidt
|
||||
Rene Molenaar
|
||||
Ralf Kern
|
||||
Pierre Haritchabalet
|
||||
Perry Miller
|
||||
Paul Obermeier
|
||||
Neil Hughes
|
||||
Nathan Monteleone
|
||||
Morn<EFBFBD> Pistorius
|
||||
Michael Henheffer
|
||||
@@ -206,37 +191,34 @@ Max Bandazian
|
||||
Mathew May
|
||||
Martin Spott
|
||||
Martijn Kragtwijk
|
||||
Mark Sciabica
|
||||
Magnus Kessler
|
||||
Lilith Bryant
|
||||
Lars Nilsson
|
||||
Konstantin Sinitsyn
|
||||
Kevin Moiule
|
||||
Keith Steffen
|
||||
Katharina Plugge
|
||||
Julen Garcia
|
||||
Joseph Winston
|
||||
John Aughey
|
||||
Johan Nouvel
|
||||
Jim Vaughan
|
||||
James Moliere
|
||||
Igor Kravtchenko
|
||||
Himar Carmona
|
||||
He Sicong
|
||||
Gustavo Wagner
|
||||
Guillaume Chouvenc
|
||||
Gerrick Bivins
|
||||
George Tarantilis
|
||||
Frederic Bouvier
|
||||
Ferdi Smit
|
||||
Ewe Woessner
|
||||
Erik den Dekker
|
||||
Emmanuel Roche
|
||||
Edgar Ellis
|
||||
Don Leich
|
||||
David Ergo
|
||||
Daniel Trstenjak
|
||||
Chuck Seberino
|
||||
Christophe Loustaunau
|
||||
Brad Anderegg
|
||||
Aric Aumann
|
||||
Andrew Sampson
|
||||
Andrew Lorino
|
||||
Alexandre Amalric
|
||||
Zbigniew Sroczynski
|
||||
Yuri Vilmanis
|
||||
Warren Macchi
|
||||
@@ -246,34 +228,26 @@ Volker Walkiewicz
|
||||
Vladimir Vukicevic
|
||||
Vlad Danciu
|
||||
Vincent Vivanloc
|
||||
Vincent Gadoury
|
||||
Vincent Bourdier
|
||||
Vasily Radostev
|
||||
Valery Bickov
|
||||
Vaclav Bilek
|
||||
Tyge
|
||||
Troy Yee
|
||||
Tomas Hnilica
|
||||
Tino Schwarze
|
||||
Thomas Weidner
|
||||
Thomas Halgarth
|
||||
Stewart Andreason
|
||||
Thom Carlo
|
||||
Steven Thomas
|
||||
Simon Hammett
|
||||
Simon Carmody
|
||||
Sid Byce
|
||||
Shuxing Xiao
|
||||
Shane Arnott
|
||||
Sebastien Kuntz
|
||||
Ryan Kawicki
|
||||
Ruth Lang
|
||||
Ruben Smelik
|
||||
Ross Anderson
|
||||
Ronny Krueger
|
||||
Ronald van Maarseveen
|
||||
Romain Charbit
|
||||
Robert Swain
|
||||
Rob Radtke
|
||||
Rob Bloemkool
|
||||
Rick Pingry
|
||||
Rick Appleton
|
||||
@@ -287,11 +261,9 @@ Piotr Rak
|
||||
Philipp Siemoleit
|
||||
Philipp M<>chler
|
||||
Petr Salinger
|
||||
Peter Amstutz
|
||||
Paul Palumbo
|
||||
Paul Fredrikson
|
||||
Paul Fotheringham
|
||||
Pau Garcia
|
||||
Patrick Hartling
|
||||
Parag Chaudhur
|
||||
Panagiotis Papadakos
|
||||
@@ -300,9 +272,7 @@ Orhun Birsoy
|
||||
Ole-Morten Duesund
|
||||
Nicolas Brodu
|
||||
Nathan Cournia
|
||||
Mourad Boufarguine
|
||||
Morten Haukness
|
||||
Mojtaba Fathi
|
||||
Mirko Viviani
|
||||
Mikkel Gjøl
|
||||
Mike Garrity
|
||||
@@ -318,26 +288,22 @@ Matt Burke
|
||||
Mathia Walker
|
||||
Mason Menninger
|
||||
Martins Innus
|
||||
Martin Scheffler
|
||||
Martin Lambers
|
||||
Marius Heise
|
||||
Mario Guimaraes
|
||||
Marin Lavery
|
||||
Marco Lehmann
|
||||
Marcin Prus
|
||||
Maik Keller
|
||||
Maciej Krol
|
||||
Lukas Diduch
|
||||
Louis Hamilton
|
||||
Lilin Xiong
|
||||
Lewis Harmon
|
||||
Laurence Muller
|
||||
Lars Nilson
|
||||
Kyle Centers
|
||||
Kristopher Bixler
|
||||
Konstantin Matveyev
|
||||
Karsten Weiss
|
||||
Karl Heijdenberg
|
||||
Jutta Sauer
|
||||
Julian Scheid
|
||||
Juan Hernando
|
||||
Josh Portway
|
||||
John Tan
|
||||
John Grant
|
||||
@@ -350,13 +316,13 @@ Jean-Christophe Lombardo
|
||||
Jay Zuckerman
|
||||
Jason Howlett
|
||||
Jason Ballenger
|
||||
James Killian
|
||||
J.E. Hoffmann
|
||||
Humar Carmona
|
||||
Henrique Bucher
|
||||
Hautio Jari
|
||||
Guillaume Millet
|
||||
Gregory Jaegy
|
||||
Graeme Harkness
|
||||
Glen Waldron
|
||||
Gian Lorenzetto
|
||||
George Papagiannakis
|
||||
Galen Faidley
|
||||
@@ -367,7 +333,6 @@ Frank Lichtenheld
|
||||
Ferdinand Cornelissen
|
||||
Fajran Iman
|
||||
Fabien Dachicourt
|
||||
Eduardo Alberto
|
||||
Edmond Gheury
|
||||
Ed Ralston
|
||||
Duvan Cope
|
||||
@@ -376,17 +341,17 @@ Drew Whitehouse
|
||||
Douglas A. Pouk
|
||||
Dean Iverson
|
||||
David Jung
|
||||
David Gurhrie
|
||||
Danny Valente
|
||||
Daniel Stien
|
||||
Dan Minor
|
||||
C<EFBFBD>sar L. B. Silveira
|
||||
Cyril Brulebois
|
||||
Cory Riddell
|
||||
Clay Fowler
|
||||
Chuck Sembroski
|
||||
Chuck Seberion
|
||||
Christopher Blaesius
|
||||
Christian Kaser
|
||||
Christian Ehrlicher
|
||||
Christian Buchner
|
||||
Chris McGlone
|
||||
Carlos Garcea
|
||||
Bruno Herbelin
|
||||
@@ -405,6 +370,7 @@ Andreas Jochens
|
||||
Andre Normann
|
||||
Almalric Alexandre
|
||||
Allen Bierbaum
|
||||
Alexandre Amalric
|
||||
Alberto Jaspe
|
||||
Alan Purvis
|
||||
Alan Ott
|
||||
|
||||
370
CMakeLists.txt
370
CMakeLists.txt
@@ -6,7 +6,7 @@ ELSE(WIN32)
|
||||
IF(APPLE)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
|
||||
ELSE(APPLE)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4 FATAL_ERROR)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0 FATAL_ERROR)
|
||||
ENDIF(APPLE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
@@ -23,15 +23,15 @@ if(COMMAND cmake_policy)
|
||||
# quote from cvslog "Such libraries worked by accident in the VS IDE and Xcode generators in CMake 2.4 and below."
|
||||
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
|
||||
cmake_policy(SET CMP0008 OLD)
|
||||
endif()
|
||||
endif()
|
||||
endif(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
|
||||
endif(COMMAND cmake_policy)
|
||||
|
||||
PROJECT(OpenSceneGraph)
|
||||
|
||||
SET(OPENSCENEGRAPH_MAJOR_VERSION 2)
|
||||
SET(OPENSCENEGRAPH_MINOR_VERSION 9)
|
||||
SET(OPENSCENEGRAPH_PATCH_VERSION 8)
|
||||
SET(OPENSCENEGRAPH_SOVERSION 66)
|
||||
SET(OPENSCENEGRAPH_MINOR_VERSION 8)
|
||||
SET(OPENSCENEGRAPH_PATCH_VERSION 5)
|
||||
SET(OPENSCENEGRAPH_SOVERSION 74)
|
||||
|
||||
# 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
|
||||
@@ -45,11 +45,11 @@ SET(OSG_PLUGIN_PREFIX "")
|
||||
|
||||
IF (CYGWIN)
|
||||
SET(OSG_PLUGIN_PREFIX "cygwin_")
|
||||
ENDIF()
|
||||
ENDIF(CYGWIN)
|
||||
|
||||
IF(MINGW)
|
||||
SET(OSG_PLUGIN_PREFIX "mingw_")
|
||||
ENDIF()
|
||||
ENDIF(MINGW)
|
||||
|
||||
|
||||
# We want to build SONAMES shared librariess
|
||||
@@ -78,13 +78,14 @@ FIND_PACKAGE(Threads)
|
||||
IF(CMAKE_SYSTEM MATCHES IRIX)
|
||||
# Erase CMAKE_THREAD_LIBS_INIT and hope it works
|
||||
SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
|
||||
ENDIF()
|
||||
ENDIF(CMAKE_SYSTEM MATCHES IRIX)
|
||||
|
||||
OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making svn branches, tags, updating ChangeLog." OFF)
|
||||
IF (OSG_MAINTAINER)
|
||||
|
||||
SET(OPENSCENEGRAPH_SVN "trunk")
|
||||
#SET(OPENSCENEGRAPH_SVN "branches")
|
||||
#SET(OPENSCENEGRAPH_SVN "trunk")
|
||||
SET(OPENSCENEGRAPH_SVN "branches")
|
||||
|
||||
SET(OPENSCENEGRAPH_BRANCH OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION})
|
||||
|
||||
#
|
||||
@@ -97,16 +98,16 @@ IF (OSG_MAINTAINER)
|
||||
|
||||
IF (OPENSCENEGRAPH_SVN STREQUAL "trunk")
|
||||
SET(SVNSOURCEDIR ${SVNTRUNKDIR})
|
||||
ELSE()
|
||||
ELSE (OPENSCENEGRAPH_SVN STREQUAL "trunk")
|
||||
SET(SVNSOURCEDIR ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH})
|
||||
ENDIF()
|
||||
ENDIF(OPENSCENEGRAPH_SVN STREQUAL "trunk")
|
||||
|
||||
|
||||
IF (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
|
||||
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION})
|
||||
ELSE()
|
||||
ELSE (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
|
||||
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION}-rc${OPENSCENEGRAPH_RELEASE_CANDIDATE})
|
||||
ENDIF()
|
||||
ENDIF(OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
|
||||
|
||||
|
||||
ADD_CUSTOM_TARGET(tag-test
|
||||
@@ -144,7 +145,7 @@ FIND_PACKAGE(OpenGL)
|
||||
IF(APPLE)
|
||||
FIND_LIBRARY(CARBON_LIBRARY Carbon)
|
||||
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
|
||||
ENDIF()
|
||||
ENDIF(APPLE)
|
||||
|
||||
IF(UNIX)
|
||||
# Not sure what this will do on Cygwin and Msys
|
||||
@@ -152,22 +153,24 @@ IF(UNIX)
|
||||
FIND_PACKAGE(X11)
|
||||
# Some Unicies need explicit linkage to the Math library or the build fails.
|
||||
FIND_LIBRARY(MATH_LIBRARY m)
|
||||
|
||||
FIND_LIBRARY(DL_LIBRARY dl)
|
||||
IF( CMAKE_SYSTEM MATCHES "Linux" )
|
||||
FIND_LIBRARY( RT_LIBRARY rt )
|
||||
ENDIF( CMAKE_SYSTEM MATCHES "Linux" )
|
||||
ENDIF()
|
||||
IF(NOT DL_LIBRARY)
|
||||
SET(DL_LIBRARY "") # change from NOTFOUND to empty when passed to linker
|
||||
ENDIF()
|
||||
|
||||
ENDIF(UNIX)
|
||||
|
||||
# Make the headers visible to everything
|
||||
IF(NOT ${PROJECT_BINARY_DIR} EQUAL ${PROJECT_SOURCE_DIR})
|
||||
INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include)
|
||||
ENDIF(NOT ${PROJECT_BINARY_DIR} EQUAL ${PROJECT_SOURCE_DIR})
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${OpenSceneGraph_SOURCE_DIR}/include
|
||||
${OPENGL_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
# Make the headers visible to everything
|
||||
IF(NOT ${PROJECT_BINARY_DIR} EQUAL ${PROJECT_SOURCE_DIR})
|
||||
INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include)
|
||||
ENDIF()
|
||||
|
||||
# Common global definitions
|
||||
#ADD_DEFINITIONS(-D)
|
||||
# Platform specific definitions
|
||||
@@ -188,33 +191,17 @@ IF(WIN32)
|
||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd${warning}")
|
||||
# endforeach(warning)
|
||||
|
||||
# This option is to enable the /DYNAMICBASE switch
|
||||
# It is used to workaround a bug in Windows 7 when linking in release, which results in corrupt
|
||||
# binaries. See this page for details: http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/01/24/the-case-of-the-corrupt-pe-binaries.aspx
|
||||
OPTION(WIN32_USE_DYNAMICBASE "Set to ON to build OpenSceneGraph with the /DYNAMICBASE option to work around a bug when linking release executables on Windows 7." OFF)
|
||||
MARK_AS_ADVANCED(WIN32_USE_DYNAMICBASE)
|
||||
IF(WIN32_USE_DYNAMICBASE)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DYNAMICBASE")
|
||||
ENDIF(WIN32_USE_DYNAMICBASE)
|
||||
|
||||
# More MSVC specific compilation flags
|
||||
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
|
||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
|
||||
OPTION(MSVC_DISABLE_CHECKED_ITERATORS "Set to ON to disable Visual C++ checked iterators. If you do this you must ensure that every other project in your solution and all dependencies are compiled with _SECURE_SCL=0." OFF)
|
||||
MARK_AS_ADVANCED(MSVC_DISABLE_CHECKED_ITERATORS)
|
||||
IF(MSVC_DISABLE_CHECKED_ITERATORS)
|
||||
ADD_DEFINITIONS(-D_SECURE_SCL=0)
|
||||
ENDIF(MSVC_DISABLE_CHECKED_ITERATORS)
|
||||
ENDIF()
|
||||
ENDIF(MSVC)
|
||||
|
||||
#needed for net plugin
|
||||
SET (OSG_SOCKET_LIBS wsock32)
|
||||
# Both Cygwin and Msys need -DNOMINMAX ???
|
||||
IF(UNIX)
|
||||
ADD_DEFINITIONS(-DNOMINMAX)
|
||||
ENDIF()
|
||||
|
||||
ENDIF(UNIX)
|
||||
########################################################################################################
|
||||
# the following options are MSVC specific,
|
||||
# the first OSG_MSVC_VERSIONED_DLL activate a custom build-time layout that should allow to run examples and application
|
||||
@@ -231,7 +218,7 @@ IF(WIN32)
|
||||
MESSAGE("Warning: disabling versioned options 2.4.6 exibits inconsintencies in .pdb naming, at least under MSVC, suggested upgrading at least to 2.4.7")
|
||||
SET(OSG_MSVC_VERSIONED_DLL OFF)
|
||||
SET(OSG_MSVC_DEBUG_INCREMENTAL_LINK ON)
|
||||
ELSE()
|
||||
ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
|
||||
OPTION(OSG_MSVC_VERSIONED_DLL "Set to ON to build OpenSceneGraph with versioned dll names" ON)
|
||||
MARK_AS_ADVANCED(OSG_MSVC_VERSIONED_DLL)
|
||||
OPTION(OSG_MSVC_DEBUG_INCREMENTAL_LINK "Set to OFF to build OpenSceneGraph without incremental linking in debug (release is off by default)" ON)
|
||||
@@ -241,7 +228,7 @@ IF(WIN32)
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
|
||||
ENDIF(NOT OSG_MSVC_DEBUG_INCREMENTAL_LINK)
|
||||
ENDIF()
|
||||
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
|
||||
ENDIF(MSVC)
|
||||
ENDIF(WIN32)
|
||||
|
||||
@@ -264,7 +251,7 @@ ENDIF(WIN32)
|
||||
#luigi#ENDIF(UNIX)
|
||||
########################################################################################################
|
||||
|
||||
OPTION(OSG_NOTIFY_DISABLED "Set to ON to build OpenSceneGraph with the noitfy() disabled." OFF)
|
||||
OPTION(OSG_NOTIFY_DISABLED "Set to ON to build OpenSceneGraph with the notify() disabled." OFF)
|
||||
|
||||
OPTION(OSG_USE_FLOAT_MATRIX "Set to ON to build OpenSceneGraph with float Matrix instead of double." OFF)
|
||||
MARK_AS_ADVANCED(OSG_USE_FLOAT_MATRIX)
|
||||
@@ -286,27 +273,6 @@ MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS)
|
||||
|
||||
OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON)
|
||||
|
||||
OPTION(OSG_GLU_AVAILABLE "Set to OFF to disable use of OpenGL GLU library." ${OPENGL_GLU_FOUND})
|
||||
OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON)
|
||||
OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." ON)
|
||||
OPTION(OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." OFF)
|
||||
OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." OFF)
|
||||
OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." OFF)
|
||||
|
||||
SET(OPENGL_egl_LIBRARY CACHE STRING "Set the OpenGL egl library.")
|
||||
|
||||
# SET(OSG_GL_DISPLAYLISTS_AVAILABLE ${OSG_GL1_AVAILABLE})
|
||||
# SET(OSG_GL_MATRICES_AVAILABLE ${OSG_GL1_AVAILABLE})
|
||||
# SET(OSG_GL_VERTEX_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE})
|
||||
# SET(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE})
|
||||
# SET(OSG_GL_FIXED_FUNCTION_AVAILABLE ${OSG_GL1_AVAILABLE})
|
||||
|
||||
OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." ${OSG_GL1_AVAILABLE})
|
||||
OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ${OSG_GL1_AVAILABLE})
|
||||
OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ${OSG_GL1_AVAILABLE})
|
||||
OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ${OSG_GL1_AVAILABLE})
|
||||
OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ${OSG_GL1_AVAILABLE})
|
||||
|
||||
OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON)
|
||||
|
||||
################################################################################
|
||||
@@ -315,23 +281,9 @@ OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG compon
|
||||
SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config")
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
|
||||
"${OPENSCENEGRAPH_CONFIG_HEADER}")
|
||||
|
||||
SET(OPENSCENEGRAPH_VERSION_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/osg/Version")
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Version.in"
|
||||
"${OPENSCENEGRAPH_VERSION_HEADER}")
|
||||
|
||||
# INSTALL_FILES(/include/osg/ FILES "${OPENSCENEGRAPH_CONFIG_HEADER}")
|
||||
|
||||
|
||||
################################################################################
|
||||
# Set Version Info resource file
|
||||
|
||||
IF(MSVC)
|
||||
SET(OPENSCENEGRAPH_VERSIONINFO_RC "${PROJECT_BINARY_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc")
|
||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc.in"
|
||||
"${OPENSCENEGRAPH_VERSIONINFO_RC}")
|
||||
ENDIF()
|
||||
|
||||
################################################################################
|
||||
# Optional build components
|
||||
|
||||
@@ -345,7 +297,7 @@ OPTION(BUILD_OSG_EXAMPLES "Enable to build OSG Examples" OFF)
|
||||
# 3rd Party Dependency Stuff
|
||||
IF(WIN32)
|
||||
INCLUDE(Find3rdPartyDependencies)
|
||||
ENDIF()
|
||||
ENDIF(WIN32)
|
||||
|
||||
# Common to all platforms:
|
||||
FIND_PACKAGE(FreeType)
|
||||
@@ -366,28 +318,9 @@ FIND_PACKAGE(OurDCMTK)
|
||||
FIND_PACKAGE(OpenAL)
|
||||
FIND_PACKAGE(XUL)
|
||||
FIND_PACKAGE(FFmpeg)
|
||||
FIND_PACKAGE(DirectShow)
|
||||
FIND_PACKAGE(SDL)
|
||||
|
||||
# To select a specific version of QT define DESIRED_QT_VERSION
|
||||
# via cmake -DDESIRED_QT_VERSION=4
|
||||
IF (DESIRED_QT_VERSION)
|
||||
|
||||
IF (DESIRED_QT_VERSION MATCHES 4)
|
||||
FIND_PACKAGE(Qt4)
|
||||
ELSE()
|
||||
FIND_PACKAGE(Qt3)
|
||||
ENDIF()
|
||||
|
||||
ELSE()
|
||||
|
||||
FIND_PACKAGE(Qt4)
|
||||
|
||||
IF (NOT QT4_FOUND)
|
||||
FIND_PACKAGE(Qt3)
|
||||
ENDIF()
|
||||
|
||||
ENDIF()
|
||||
# Include macro utilities here
|
||||
INCLUDE(OsgMacroUtils)
|
||||
|
||||
#use pkg-config to find various modues
|
||||
INCLUDE(FindPkgConfig OPTIONAL)
|
||||
@@ -400,16 +333,15 @@ IF(PKG_CONFIG_FOUND)
|
||||
|
||||
IF(WIN32)
|
||||
PKG_CHECK_MODULES(GTKGL gtkglext-win32-1.0)
|
||||
ELSE()
|
||||
ELSE(WIN32)
|
||||
PKG_CHECK_MODULES(GTKGL gtkglext-x11-1.0)
|
||||
ENDIF()
|
||||
ENDIF(WIN32)
|
||||
|
||||
PKG_CHECK_MODULES(RSVG librsvg-2.0)
|
||||
PKG_CHECK_MODULES(CAIRO cairo)
|
||||
PKG_CHECK_MODULES(POPPLER poppler-glib)
|
||||
|
||||
ENDIF()
|
||||
|
||||
ENDIF(PKG_CONFIG_FOUND)
|
||||
|
||||
#optional example related dependencies
|
||||
IF (BUILD_OSG_EXAMPLES)
|
||||
@@ -417,11 +349,32 @@ IF (BUILD_OSG_EXAMPLES)
|
||||
|
||||
FIND_PACKAGE(FLTK)
|
||||
FIND_PACKAGE(GLUT)
|
||||
FIND_PACKAGE(SDL)
|
||||
FIND_PACKAGE(FOX)
|
||||
|
||||
SET(wxWidgets_USE_LIBS base core gl net)
|
||||
FIND_PACKAGE(wxWidgets)
|
||||
|
||||
# To select a specific version of QT define DESIRED_QT_VERSION
|
||||
# via cmake -DDESIRED_QT_VERSION=4
|
||||
IF (DESIRED_QT_VERSION)
|
||||
|
||||
IF (DESIRED_QT_VERSION MATCHES 4)
|
||||
FIND_PACKAGE(Qt4)
|
||||
ELSE(DESIRED_QT_VERSION MATCHES 4)
|
||||
FIND_PACKAGE(Qt3)
|
||||
ENDIF(DESIRED_QT_VERSION MATCHES 4)
|
||||
|
||||
ELSE(DESIRED_QT_VERSION)
|
||||
|
||||
FIND_PACKAGE(Qt4)
|
||||
|
||||
IF (NOT QT4_FOUND)
|
||||
FIND_PACKAGE(Qt3)
|
||||
ENDIF(NOT QT4_FOUND)
|
||||
|
||||
ENDIF(DESIRED_QT_VERSION)
|
||||
|
||||
ENDIF(BUILD_OSG_EXAMPLES)
|
||||
|
||||
|
||||
@@ -439,7 +392,7 @@ IF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
|
||||
# form.
|
||||
SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT false)
|
||||
|
||||
ELSE()
|
||||
ELSE(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
|
||||
# For other platforms perform the check
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
@@ -459,8 +412,8 @@ IF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
|
||||
SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT
|
||||
${GLU_Tesselator_Needs_Variable_Parameter_Callback_Convention_Failure_Means_No})
|
||||
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
ENDIF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
|
||||
|
||||
OPTION(OSG_GLU_TESS_CALLBACK_TRIPLEDOT "Set to ON to build with variable parameter (...) version of GLU tesselator callback" ${DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT})
|
||||
IF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT)
|
||||
@@ -490,47 +443,47 @@ IF(NOT APPLE)
|
||||
# QuickTime is required for OS X, but optional for Windows.
|
||||
IF(WIN32)
|
||||
FIND_PACKAGE(QuickTime)
|
||||
ENDIF()
|
||||
ENDIF(WIN32)
|
||||
|
||||
ELSE()
|
||||
ELSE(NOT APPLE)
|
||||
FIND_PACKAGE(QuickTime)
|
||||
ENDIF()
|
||||
ENDIF(NOT APPLE)
|
||||
|
||||
################################################################################
|
||||
# Create bin and lib directories if required
|
||||
|
||||
IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin ${CMAKE_BINARY_DIR}/lib ${CMAKE_BINARY_DIR}/lib/${OSG_PLUGINS})
|
||||
ENDIF()
|
||||
ENDIF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
||||
|
||||
|
||||
################################################################################
|
||||
# Installation stuff
|
||||
|
||||
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
|
||||
SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
|
||||
SET(CMAKE_RELWITHDEBINFO_POSTFIX "rd" CACHE STRING "add a postfix, usually empty on windows")
|
||||
SET(CMAKE_MINSIZEREL_POSTFIX "s" CACHE STRING "add a postfix, usually empty on windows")
|
||||
ADD_DEFINITIONS(-DOSG_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX})
|
||||
|
||||
IF(UNIX AND NOT WIN32)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
|
||||
ENDIF()
|
||||
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
ADD_DEFINITIONS("-D_DEBUG")
|
||||
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
ENDIF(UNIX AND NOT WIN32)
|
||||
|
||||
IF(CYGWIN)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
|
||||
ENDIF()
|
||||
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
ADD_DEFINITIONS("-D_DEBUG")
|
||||
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
ENDIF(CYGWIN)
|
||||
|
||||
IF(UNIX AND NOT WIN32 AND NOT APPLE)
|
||||
IF(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||
SET(LIB_POSTFIX "64" CACHE STRING "suffix for 32/64 dir placement")
|
||||
MARK_AS_ADVANCED(LIB_POSTFIX)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||
ENDIF(UNIX AND NOT WIN32 AND NOT APPLE)
|
||||
IF(NOT DEFINED LIB_POSTFIX)
|
||||
SET(LIB_POSTFIX "")
|
||||
ENDIF()
|
||||
ENDIF(NOT DEFINED LIB_POSTFIX)
|
||||
|
||||
# Here we apparantly do some funky stuff with making the bin/ and lib/
|
||||
# folders which is probably needed to work around a very old CMake bug?
|
||||
@@ -545,17 +498,22 @@ ENDIF(MSVC AND NOT MSVC_IDE)
|
||||
#SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME})
|
||||
SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib)
|
||||
MAKE_DIRECTORY(${OUTPUT_LIBDIR})
|
||||
IF(NOT MSVC OR MSVC_IDE)
|
||||
IF(NOT MSVC)
|
||||
MAKE_DIRECTORY(${OUTPUT_LIBDIR}/${OSG_PLUGINS})
|
||||
ENDIF(NOT MSVC OR MSVC_IDE)
|
||||
ENDIF(NOT MSVC)
|
||||
|
||||
# On CMake 2.4.x use EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH and later
|
||||
# we work around the DLL placement by use of the PREFIX target property hack
|
||||
#
|
||||
# On CMake 2.6.x use the newly minted CMAKE_LIBRARY_OUTPUT_DIRECTORY,
|
||||
# CMAKE_ARCHIVE_OUTPUT_DIRECTORY & CMAKE_RUNTIME_OUTPUT_DIRECTORY
|
||||
|
||||
#
|
||||
# CMake >= 2.8.1 changed the output directory algorithm (See doc).
|
||||
# Here we also set per-configuration directories (CMAKE_*_OUTPUT_DIRECTORY_<CONFIG>), or else binaries are generated in /bin/Debug and /bin/Release, etc. with MSVC and Xcode.
|
||||
# (Doc reads "multi-configuration generators (VS, Xcode) do NOT append a per-configuration subdirectory to the specified directory").
|
||||
# The workaround for 2.6.x (adding "../" as an output prefix for each target) seem to have no effect in >=2.8.1, so there is no need to change this.
|
||||
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 5)
|
||||
# If CMake < 2.6.0
|
||||
SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR})
|
||||
SET(LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR})
|
||||
ELSE()
|
||||
@@ -567,6 +525,21 @@ ELSE()
|
||||
ELSE(WIN32)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
|
||||
ENDIF(WIN32)
|
||||
|
||||
# Testing CMAKE_VERSION is possible in >= 2.6.4 only
|
||||
BUILDER_VERSION_GREATER(2 8 0)
|
||||
IF(VALID_BUILDER_VERSION) # If CMake >= 2.8.1
|
||||
FOREACH(CONF ${CMAKE_CONFIGURATION_TYPES}) # For each configuration (Debug, Release, MinSizeRel... and/or anything the user chooses)
|
||||
STRING(TOUPPER "${CONF}" CONF) # Go uppercase (DEBUG, RELEASE...)
|
||||
SET("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_LIBDIR}")
|
||||
SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_BINDIR}")
|
||||
IF(WIN32)
|
||||
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_BINDIR}")
|
||||
ELSE()
|
||||
SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_LIBDIR}")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDIF(VALID_BUILDER_VERSION)
|
||||
ENDIF()
|
||||
|
||||
#SET(INSTALL_BINDIR OpenSceneGraph/bin)
|
||||
@@ -617,7 +590,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Previous included -Wformat=2 in OSG_AGGRESSIVE_WARNING_FLAGS but had to remove it due to standard library errors
|
||||
|
||||
|
||||
ELSE()
|
||||
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
||||
IF(MSVC)
|
||||
# FIXME: What are good aggressive warning flags for Visual Studio?
|
||||
# And do we need to further subcase this for different versions of VS?
|
||||
@@ -625,12 +598,12 @@ ELSE()
|
||||
SET(OSG_AGGRESSIVE_WARNING_FLAGS /W4 /wd4706 /wd4127 /wd4100)
|
||||
|
||||
|
||||
ELSE()
|
||||
ELSE(MSVC)
|
||||
# CMake lacks an elseif, so other non-gcc, non-VS compilers need
|
||||
# to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should
|
||||
# remain unset.
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF(MSVC)
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
# This part is for the CMake menu option to toggle the warnings on/off.
|
||||
# This will only be made available if we set values for OSG_AGGRESSIVE_WARNING_FLAGS.
|
||||
@@ -638,9 +611,9 @@ IF(OSG_AGGRESSIVE_WARNING_FLAGS)
|
||||
|
||||
IF (APPLE)
|
||||
SET(DEFAULT_USE_AGGRESSIVE_WARNINGS OFF)
|
||||
ELSE()
|
||||
ELSE(APPLE)
|
||||
SET(DEFAULT_USE_AGGRESSIVE_WARNINGS ON)
|
||||
ENDIF()
|
||||
ENDIF(APPLE)
|
||||
|
||||
OPTION(OSG_USE_AGGRESSIVE_WARNINGS "Enable to activate aggressive warnings" ${DEFAULT_USE_AGGRESSIVE_WARNINGS})
|
||||
MARK_AS_ADVANCED(OSG_USE_AGGRESSIVE_WARNINGS)
|
||||
@@ -650,36 +623,36 @@ IF(OSG_AGGRESSIVE_WARNING_FLAGS)
|
||||
FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
|
||||
IF(NOT CMAKE_CXX_FLAGS MATCHES "${flag}")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ELSE()
|
||||
ENDIF(NOT CMAKE_CXX_FLAGS MATCHES "${flag}")
|
||||
ENDFOREACH(flag)
|
||||
ELSE(OSG_USE_AGGRESSIVE_WARNINGS)
|
||||
# Remove all flags considered aggresive
|
||||
FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
|
||||
STRING(REGEX REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH(flag)
|
||||
ENDIF(OSG_USE_AGGRESSIVE_WARNINGS)
|
||||
ENDIF(OSG_AGGRESSIVE_WARNING_FLAGS)
|
||||
|
||||
|
||||
# Dynamic vs Static Linking
|
||||
OPTION(DYNAMIC_OPENSCENEGRAPH "Set to ON to build OpenSceneGraph for dynamic linking. Use OFF for static." ON)
|
||||
IF (DYNAMIC_OPENSCENEGRAPH)
|
||||
SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED")
|
||||
ELSE ()
|
||||
ELSE (DYNAMIC_OPENSCENEGRAPH)
|
||||
SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC")
|
||||
ENDIF()
|
||||
ENDIF(DYNAMIC_OPENSCENEGRAPH)
|
||||
|
||||
|
||||
INCLUDE(OsgMacroUtils)
|
||||
# OSG Core
|
||||
ADD_SUBDIRECTORY(src)
|
||||
|
||||
IF (BUILD_OSG_APPLICATIONS)
|
||||
ADD_SUBDIRECTORY(applications)
|
||||
ENDIF()
|
||||
ENDIF(BUILD_OSG_APPLICATIONS)
|
||||
|
||||
IF (BUILD_OSG_EXAMPLES)
|
||||
ADD_SUBDIRECTORY(examples)
|
||||
ENDIF()
|
||||
ENDIF(BUILD_OSG_EXAMPLES)
|
||||
|
||||
|
||||
# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
|
||||
@@ -696,26 +669,23 @@ IF(APPLE)
|
||||
# version information we need. (Darwin versions can be changed
|
||||
# independently of OS X versions.)
|
||||
# It does look like CMake handles the CMAKE_OSX_SYSROOT automatically.
|
||||
IF(EXISTS /Developer/SDKs/MacOSX10.6.sdk)
|
||||
SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.6 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
||||
SET(OSG_WINDOWING_SYSTEM "Cocoa" CACHE STRING "Forced Cocoa windowing system in 64 bits snow leopard" FORCE)
|
||||
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio " CACHE STRING "Forced imageio default image plugin for OSX in 64 bits snow leopard" FORCE)
|
||||
ELSEIF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
|
||||
IF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
|
||||
# 64-bit compiles are not supported with Carbon. We should enable
|
||||
# 64-bit compilation by default once osgviewer has been
|
||||
# rewritten with Cocoa.
|
||||
#SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
|
||||
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
||||
ELSEIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
|
||||
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
||||
ELSE()
|
||||
# No Universal Binary support
|
||||
# Should break down further to set the -mmacosx-version-min,
|
||||
# but the SDK detection is too unreliable here.
|
||||
ENDIF()
|
||||
ELSE(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
|
||||
IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
|
||||
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
||||
ELSE(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
|
||||
# No Universal Binary support
|
||||
# Should break down further to set the -mmacosx-version-min,
|
||||
# but the SDK detection is too unreliable here.
|
||||
ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
|
||||
ENDIF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
|
||||
ENDIF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
|
||||
|
||||
OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF)
|
||||
@@ -729,8 +699,8 @@ ENDIF(APPLE)
|
||||
SET(GENWRAPPER genwrapper)
|
||||
|
||||
ADD_CUSTOM_TARGET(wrappers
|
||||
COMMAND ${GENWRAPPER} -c ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/introspection/genwrapper.conf -t ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/introspection/Doxyfile.template -d ${OpenSceneGraph_SOURCE_DIR} | doxygen -
|
||||
COMMAND ${GENWRAPPER} -c ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/introspection/genwrapper.conf -l ${OpenSceneGraph_SOURCE_DIR}
|
||||
COMMAND ${GENWRAPPER} -c ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/genwrapper.conf -t ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/Doxyfile.template -d ${OpenSceneGraph_SOURCE_DIR} | doxygen -
|
||||
COMMAND ${GENWRAPPER} -c ${OpenSceneGraph_SOURCE_DIR}/src/osgWrappers/genwrapper.conf -l ${OpenSceneGraph_SOURCE_DIR}
|
||||
)
|
||||
|
||||
# For Doxygen
|
||||
@@ -744,22 +714,22 @@ IF(BUILD_DOCUMENTATION)
|
||||
OPTION(BUILD_REF_DOCS_SEARCHENGINE "Enable doxygen's search engine (requires that documentation to be installed on a php enabled web server)" OFF)
|
||||
IF(BUILD_REF_DOCS_SEARCHENGINE)
|
||||
SET(SEARCHENGINE YES)
|
||||
ELSE()
|
||||
ELSE(BUILD_REF_DOCS_SEARCHENGINE)
|
||||
SET(SEARCHENGINE NO)
|
||||
ENDIF()
|
||||
ENDIF(BUILD_REF_DOCS_SEARCHENGINE)
|
||||
|
||||
OPTION(BUILD_REF_DOCS_TAGFILE "Generate a tag file named osg.tag on the documentation web server" OFF)
|
||||
IF(BUILD_REF_DOCS_TAGFILE)
|
||||
SET(GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs/osg.tag")
|
||||
ELSE()
|
||||
ELSE(BUILD_REF_DOCS_TAGFILE)
|
||||
SET(GENERATE_TAGFILE "")
|
||||
ENDIF()
|
||||
ENDIF(BUILD_REF_DOCS_TAGFILE)
|
||||
|
||||
IF(DOT)
|
||||
SET(HAVE_DOT YES)
|
||||
ELSE()
|
||||
ELSE(DOT)
|
||||
SET(HAVE_DOT NO)
|
||||
ENDIF()
|
||||
ENDIF(DOT)
|
||||
|
||||
# If html help generation was requested. DOCUMENTATION_HTML_HELP is defined by Documentation.cmake
|
||||
SET(GENERATE_HTMLHELP "NO")
|
||||
@@ -768,10 +738,10 @@ IF(BUILD_DOCUMENTATION)
|
||||
IF(NOT WIN32)
|
||||
SET(HTML_HELP_COMPILER "" CACHE FILEPATH "Enter location of the HTML help compiler to let doxygen compile html")
|
||||
MARK_AS_ADVANCED(HTML_HELP_COMPILER)
|
||||
ENDIF()
|
||||
ENDIF(NOT WIN32)
|
||||
# this var sets a proper value in .doxygen files when coniguring them below
|
||||
SET(GENERATE_HTMLHELP "YES")
|
||||
endif()
|
||||
endif(DOCUMENTATION_HTML_HELP)
|
||||
|
||||
# This processes our doxyfile.cmake and substitutes paths to generate
|
||||
# a final Doxyfile
|
||||
@@ -788,7 +758,7 @@ IF(BUILD_DOCUMENTATION)
|
||||
# now set up openthreads documentation generation
|
||||
IF(BUILD_REF_DOCS_TAGFILE)
|
||||
SET(GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenThreadsReferenceDocs/ot.tag")
|
||||
ENDIF()
|
||||
ENDIF(BUILD_REF_DOCS_TAGFILE)
|
||||
|
||||
# This processes our openthreads.doxyfile.cmake and generate a final doxyfile
|
||||
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/openthreads.doxyfile.cmake
|
||||
@@ -828,54 +798,34 @@ IF(BUILD_DASHBOARD_REPORTS)
|
||||
# The following are required to uses Dart and the Cdash dashboard
|
||||
# viewable here : http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph
|
||||
INCLUDE(Dart)
|
||||
ENDIF()
|
||||
ENDIF(BUILD_DASHBOARD_REPORTS)
|
||||
|
||||
# present the packaging option only if we have the cpack command defined (effectively >= 2.6.0)
|
||||
IF(CMAKE_CPACK_COMMAND)
|
||||
OPTION(BUILD_OSG_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF)
|
||||
IF(BUILD_OSG_PACKAGES)
|
||||
INCLUDE(OsgCPack)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF(BUILD_OSG_PACKAGES)
|
||||
ENDIF(CMAKE_CPACK_COMMAND)
|
||||
|
||||
# Generate pkg-config configuration files
|
||||
# Generate pkg-config configuration file
|
||||
|
||||
SET(PKGCONFIG_FILES
|
||||
openscenegraph
|
||||
openscenegraph-osg
|
||||
openscenegraph-osgDB
|
||||
openscenegraph-osgFX
|
||||
openscenegraph-osgGA
|
||||
openscenegraph-osgParticle
|
||||
openscenegraph-osgSim
|
||||
openscenegraph-osgText
|
||||
openscenegraph-osgUtil
|
||||
openscenegraph-osgTerrain
|
||||
openscenegraph-osgManipulator
|
||||
openscenegraph-osgViewer
|
||||
openscenegraph-osgWidget
|
||||
openscenegraph-osgShadow
|
||||
openscenegraph-osgAnimation
|
||||
openscenegraph-osgVolume
|
||||
openscenegraph-osgIntrospection
|
||||
)
|
||||
|
||||
FOREACH(PKGCONFIG_FILE ${PKGCONFIG_FILES})
|
||||
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc.in
|
||||
${PROJECT_BINARY_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc
|
||||
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/openscenegraph.pc.in
|
||||
${PROJECT_BINARY_DIR}/packaging/pkgconfig/openscenegraph.pc
|
||||
@ONLY
|
||||
)
|
||||
INSTALL(FILES ${PROJECT_BINARY_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc DESTINATION lib${LIB_POSTFIX}/pkgconfig COMPONENT libopenscenegraph-dev)
|
||||
ENDFOREACH(PKGCONFIG_FILE)
|
||||
|
||||
INSTALL(FILES ${PROJECT_BINARY_DIR}/packaging/pkgconfig/openscenegraph.pc DESTINATION lib${LIB_POSTFIX}/pkgconfig COMPONENT libopenscenegraph-dev)
|
||||
|
||||
# Run this as late as possible so users can easier spot the message
|
||||
IF (NOT DEFINED REQUIRES_LIBPATH_MESSAGE AND ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
|
||||
SET(REQUIRES_LIBPATH_MESSAGE ON)
|
||||
ENDIF()
|
||||
IF (${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
|
||||
SET(REQUIRES_LIBPATH_MESSAGE ON)
|
||||
ENDIF(${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
|
||||
|
||||
IF(REQUIRES_LIBPATH_MESSAGE)
|
||||
|
||||
IF (NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE)
|
||||
|
||||
SET(OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether the libpath message has been reported before")
|
||||
|
||||
MESSAGE("\nThe build system is configured to instal libraries to ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}\n"
|
||||
@@ -896,29 +846,31 @@ IF(REQUIRES_LIBPATH_MESSAGE)
|
||||
COMMAND ldconfig
|
||||
COMMENT "Copying openscenegraph.conf to /etc/ld.so.conf.d and running ldconfig"
|
||||
)
|
||||
ELSE()
|
||||
ELSE(IS_DIRECTORY /etc/ld.so.conf.d)
|
||||
IF(EXISTS /etc/ld.so.conf)
|
||||
MESSAGE("You have an ld.so.conf file in /etc, if you wish to ensure \n"
|
||||
"that applications find the installed osg libraries, system wide, you\n"
|
||||
"could add ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX} to it.")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF(EXISTS /etc/ld.so.conf)
|
||||
ENDIF(IS_DIRECTORY /etc/ld.so.conf.d)
|
||||
|
||||
# emit a message during installation.
|
||||
INSTALL(CODE "MESSAGE(\"Libraries were installed to ${CMAKE_INSTALL_PREFIX}lib${LIB_POSTFIX}.\\nYou may need to update your ld.so configuration. \")")
|
||||
|
||||
ENDIF(NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE)
|
||||
|
||||
ELSE()
|
||||
ELSE(REQUIRES_LIBPATH_MESSAGE)
|
||||
|
||||
SET(OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 0 CACHE INTERNAL "Flag to track whether the libpath message has been reported before")
|
||||
ENDIF()
|
||||
|
||||
ENDIF(REQUIRES_LIBPATH_MESSAGE)
|
||||
|
||||
|
||||
# This needs to be run very last so other parts of the scripts can take
|
||||
# advantage of this.
|
||||
IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
|
||||
SET(OSG_CONFIG_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether this is the first time running CMake or if CMake has been configured before")
|
||||
ENDIF()
|
||||
ENDIF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
### uninstall target
|
||||
|
||||
@@ -113,10 +113,6 @@ int main()
|
||||
" _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
||||
|
||||
|
||||
IF(NOT _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND
|
||||
NOT _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS AND
|
||||
NOT _OPENTHREADS_ATOMIC_USE_SUN AND
|
||||
NOT _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED AND
|
||||
NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
||||
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
|
||||
ENDIF()
|
||||
IF(NOT _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND NOT _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS AND NOT _OPENTHREADS_ATOMIC_USE_SUN AND NOT _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED AND NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
||||
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
|
||||
ENDIF(NOT _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND NOT _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS AND NOT _OPENTHREADS_ATOMIC_USE_SUN AND NOT _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED AND NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
# all the paramenter are required, in case of lists, use "" in calling
|
||||
################################################################################################
|
||||
|
||||
MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX EXSUFFIX)
|
||||
MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES SEARCHPATHLIST DEBUGSUFFIX)
|
||||
|
||||
MESSAGE(STATUS "searching ${DEPNAME} -->${INCLUDEFILE}<-->${LIBRARY_NAMES_BASE}<-->${SEARCHPATHLIST}<--")
|
||||
MESSAGE(STATUS "searching ${DEPNAME} -->${INCLUDEFILE}<-->${LIBRARY_NAMES}<-->${SEARCHPATHLIST}<--")
|
||||
|
||||
SET(MY_PATH_INCLUDE )
|
||||
SET(MY_PATH_LIB )
|
||||
@@ -22,18 +22,14 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBU
|
||||
MARK_AS_ADVANCED("${DEPNAME}_INCLUDE_DIR")
|
||||
#MESSAGE( " ${DEPNAME}_INCLUDE_DIR --> ${${DEPNAME}_INCLUDE_DIR}<--")
|
||||
|
||||
SET(LIBRARY_NAMES "")
|
||||
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
|
||||
LIST(APPEND LIBRARY_NAMES "${LIBNAME}${EXSUFFIX}")
|
||||
ENDFOREACH(LIBNAME)
|
||||
FIND_LIBRARY("${DEPNAME}_LIBRARY"
|
||||
FIND_LIBRARY("${DEPNAME}_LIBRARY"
|
||||
NAMES ${LIBRARY_NAMES}
|
||||
PATHS ${MY_PATH_LIB}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
SET(LIBRARY_NAMES_DEBUG "")
|
||||
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
|
||||
LIST(APPEND LIBRARY_NAMES_DEBUG "${LIBNAME}${DEBUGSUFFIX}${EXSUFFIX}")
|
||||
FOREACH(LIBNAME ${LIBRARY_NAMES})
|
||||
LIST(APPEND LIBRARY_NAMES_DEBUG "${LIBNAME}${DEBUGSUFFIX}")
|
||||
ENDFOREACH(LIBNAME)
|
||||
FIND_LIBRARY("${DEPNAME}_LIBRARY_DEBUG"
|
||||
NAMES ${LIBRARY_NAMES_DEBUG}
|
||||
@@ -50,7 +46,7 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBU
|
||||
SET(${DEPNAME}_LIBRARY_DEBUG "${${DEPNAME}_LIBRARY}")
|
||||
ENDIF(NOT ${DEPNAME}_LIBRARY_DEBUG)
|
||||
ENDIF(${DEPNAME}_INCLUDE_DIR AND ${DEPNAME}_LIBRARY)
|
||||
ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX)
|
||||
ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES SEARCHPATHLIST DEBUGSUFFIX)
|
||||
|
||||
|
||||
################################################################################################
|
||||
@@ -58,8 +54,8 @@ ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST D
|
||||
################################################################################################
|
||||
|
||||
MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
||||
FIND_DEPENDENCY(TIFF tiff.h libtiff ${OSG_3RDPARTY_BIN} "D" "_i")
|
||||
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype234;freetype234MT;freetype235;freetype237;freetype238" ${OSG_3RDPARTY_BIN} "d" "")
|
||||
FIND_DEPENDENCY(TIFF tiff.h libtiff ${OSG_3RDPARTY_BIN} "D")
|
||||
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype234;freetype234MT;freetype235;freetype237" ${OSG_3RDPARTY_BIN} "_D")
|
||||
IF(FREETYPE_FOUND)
|
||||
#forcing subsequent FindFreeType stuff to not search for other variables.... kind of a hack
|
||||
SET(FREETYPE_INCLUDE_DIR_ft2build ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
|
||||
@@ -67,19 +63,19 @@ MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
||||
MARK_AS_ADVANCED(FREETYPE_INCLUDE_DIR_ft2build FREETYPE_INCLUDE_DIR_freetype2)
|
||||
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
|
||||
ENDIF(FREETYPE_FOUND)
|
||||
FIND_DEPENDENCY(CURL curl/curl.h "libcurl;curllib" ${OSG_3RDPARTY_BIN} "D" "")
|
||||
FIND_DEPENDENCY(JPEG jpeglib.h libjpeg ${OSG_3RDPARTY_BIN} "D" "")
|
||||
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(CURL curl/curl.h "libcurl;curllib" ${OSG_3RDPARTY_BIN} "D")
|
||||
FIND_DEPENDENCY(JPEG jpeglib.h libjpeg ${OSG_3RDPARTY_BIN} "D")
|
||||
#FIND_DEPENDENCY(GDAL gdal.h "gdal;gdal_i" ${OSG_3RDPARTY_BIN})
|
||||
FIND_DEPENDENCY(GLUT GL/glut.h glut32 ${OSG_3RDPARTY_BIN} "D")
|
||||
IF(GLUT_FOUND)
|
||||
#forcing subsequent FindGlut stuff to not search for other variables.... kind of a hack
|
||||
SET(GLUT_glut_LIBRARY ${GLUT_LIBRARY} CACHE FILEPATH "")
|
||||
MARK_AS_ADVANCED(GLUT_glut_LIBRARY)
|
||||
ENDIF(GLUT_FOUND)
|
||||
FIND_DEPENDENCY(GIFLIB gif_lib.h "ungif;libungif" ${OSG_3RDPARTY_BIN} "D" "")
|
||||
FIND_DEPENDENCY(ZLIB zlib.h "z;zlib;zlib1" ${OSG_3RDPARTY_BIN} "D" "")
|
||||
FIND_DEPENDENCY(GIFLIB gif_lib.h "ungif;libungif" ${OSG_3RDPARTY_BIN} "D")
|
||||
FIND_DEPENDENCY(ZLIB zlib.h "z;zlib;zlib1" ${OSG_3RDPARTY_BIN} "D")
|
||||
IF(ZLIB_FOUND)
|
||||
FIND_DEPENDENCY(PNG png.h "libpng;libpng13" ${OSG_3RDPARTY_BIN} "D" "")
|
||||
FIND_DEPENDENCY(PNG png.h "libpng;libpng13" ${OSG_3RDPARTY_BIN} "D")
|
||||
IF(PNG_FOUND)
|
||||
#forcing subsequent FindPNG stuff to not search for other variables.... kind of a hack
|
||||
SET(PNG_PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE FILEPATH "")
|
||||
@@ -99,17 +95,7 @@ ENDMACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
||||
OPTION(USE_3DPARTY_BIN "Set to ON to use Mike prebuilt dependencies situated side of OpenSceneGraph source. Use OFF for avoiding." ON)
|
||||
IF(USE_3DPARTY_BIN)
|
||||
GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_SOURCE_DIR} PATH)
|
||||
SET(TEST_3DPARTY_DIR "${PARENT_DIR}/3rdparty")
|
||||
IF(NOT EXISTS ${TEST_3DPARTY_DIR})
|
||||
IF(MSVC71)
|
||||
SET(TEST_3DPARTY_DIR "${PARENT_DIR}/3rdParty_win32binaries_vs71")
|
||||
ELSEIF(MSVC80)
|
||||
SET(TEST_3DPARTY_DIR "${PARENT_DIR}/3rdParty_win32binaries_vs80sp1")
|
||||
ELSEIF(MSVC90)
|
||||
SET(TEST_3DPARTY_DIR "${PARENT_DIR}/3rdParty_win32binaries_vs90sp1")
|
||||
ENDIF()
|
||||
ENDIF(NOT EXISTS ${TEST_3DPARTY_DIR})
|
||||
SET(ACTUAL_3DPARTY_DIR "${TEST_3DPARTY_DIR}" CACHE PATH "Location of 3rdparty dependencies")
|
||||
SET(ACTUAL_3DPARTY_DIR "${PARENT_DIR}/3rdparty" CACHE PATH "Location of 3rdparty dependencies")
|
||||
IF(EXISTS ${ACTUAL_3DPARTY_DIR})
|
||||
SEARCH_3RDPARTY(${ACTUAL_3DPARTY_DIR})
|
||||
ENDIF(EXISTS ${ACTUAL_3DPARTY_DIR})
|
||||
|
||||
@@ -30,6 +30,9 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
|
||||
${COLLADA_DOM_ROOT}/include
|
||||
$ENV{COLLADA_DIR}/include
|
||||
$ENV{COLLADA_DIR}
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
@@ -40,6 +43,7 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
@@ -51,6 +55,9 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
|
||||
$ENV{COLLADA_DIR}/lib
|
||||
$ENV{COLLADA_DIR}/lib-dbg
|
||||
$ENV{COLLADA_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -61,6 +68,7 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
@@ -72,6 +80,9 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
|
||||
$ENV{COLLADA_DIR}/lib
|
||||
$ENV{COLLADA_DIR}/lib-dbg
|
||||
$ENV{COLLADA_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -82,6 +93,7 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
@@ -93,6 +105,9 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY
|
||||
$ENV{COLLADA_DIR}/lib
|
||||
$ENV{COLLADA_DIR}/lib-dbg
|
||||
$ENV{COLLADA_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -103,6 +118,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
@@ -114,6 +130,9 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
||||
$ENV{COLLADA_DIR}/lib
|
||||
$ENV{COLLADA_DIR}/lib-dbg
|
||||
$ENV{COLLADA_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -124,6 +143,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
# Locate directshow
|
||||
# This module defines
|
||||
# DIRECTSHOW_LIBRARIES
|
||||
# DIRECTSHOW_FOUND, if false, do not try to link to directshow
|
||||
# DIRECTSHOW_INCLUDE_DIR, where to find the headers
|
||||
#
|
||||
# $DIRECTSHOW_DIR is an environment variable that would
|
||||
# point to the this path in the plateform devkit (Samples\Multimedia\DirectShow)
|
||||
#
|
||||
# Created by Cedric Pinson.
|
||||
#
|
||||
|
||||
|
||||
SET(DIRECTSHOW_FOUND "NO")
|
||||
SET(DIRECTSHOW_SAMPLE_ROOT "$ENV{DIRECTSHOW_DIR}" CACHE PATH "Location of DirectShow sample in devkit")
|
||||
|
||||
IF(WIN32)
|
||||
FIND_PATH(DIRECTSHOW_STRMBASE_INCLUDE_DIRS renbase.h
|
||||
PATHS
|
||||
${DIRECTSHOW_SAMPLE_ROOT}/BaseClasses/
|
||||
$ENV{DIRECTSHOW_SAMPLE_ROOT}/BaseClasses/
|
||||
DOC "Location of DirectShow Base include on the windows devkit"
|
||||
)
|
||||
|
||||
FIND_LIBRARY(DIRECTSHOW_STRMBASE_LIBRARY_RELEASE strmbase
|
||||
PATHS
|
||||
${DIRECTSHOW_SAMPLE_ROOT}/BaseClasses/Release_MBCS/ # sdk 6.1
|
||||
$ENV{DIRECTSHOW_SAMPLE_ROOT}/BaseClasses/Release_MBCS/ # sdk 6.1
|
||||
${DIRECTSHOW_SAMPLE_ROOT}/BaseClasses/Release/ # sdk 2003
|
||||
$ENV{DIRECTSHOW_SAMPLE_ROOT}/BaseClasses/Release/ # sdk 2003
|
||||
DOC "Location of DirectShow Base library on the windows devkit"
|
||||
)
|
||||
|
||||
FIND_LIBRARY(DIRECTSHOW_STRMBASE_LIBRARY_DEBUG strmbasd
|
||||
PATHS
|
||||
${DIRECTSHOW_SAMPLE_ROOT}/BaseClasses/Debug_MBCS/ # sdk 6.1
|
||||
$ENV{DIRECTSHOW_SAMPLE_ROOT}/BaseClasses/Debug_MBCS/ # sdk 6.1
|
||||
${DIRECTSHOW_SAMPLE_ROOT}/BaseClasses/Debug/ # sdk 2003
|
||||
$ENV{DIRECTSHOW_SAMPLE_ROOT}/BaseClasses/Debug/ # sdk 2003
|
||||
DOC "Location of DirectShow Base library on the windows devkit"
|
||||
)
|
||||
|
||||
IF (DIRECTSHOW_STRMBASE_INCLUDE_DIRS AND DIRECTSHOW_STRMBASE_LIBRARY_RELEASE)
|
||||
SET(WIN_LIBS winmm d3d9 d3dx9 kernel32 user32 gdi32 winspool shell32 ole32 oleaut32 uuid comdlg32 advapi32)
|
||||
SET(DIRECTSHOW_FOUND "YES")
|
||||
SET(DIRECTSHOW_LIBRARY_DEBUG
|
||||
${DIRECTSHOW_STRMBASE_LIBRARY_DEBUG}
|
||||
)
|
||||
SET(DIRECTSHOW_LIBRARY
|
||||
${DIRECTSHOW_STRMBASE_LIBRARY_RELEASE}
|
||||
)
|
||||
SET(DIRECTSHOW_INLUDE_DIRS
|
||||
${DIRECTSHOW_STRMBASE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
ENDIF()
|
||||
|
||||
ENDIF()
|
||||
@@ -12,6 +12,9 @@
|
||||
FIND_PATH(FLTK_INCLUDE_DIR Fl/Fl.H Fl/Fl.h
|
||||
$ENV{FLTK_DIR}/include
|
||||
$ENV{FLTK_DIR}
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
@@ -20,6 +23,7 @@ FIND_PATH(FLTK_INCLUDE_DIR Fl/Fl.H Fl/Fl.h
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
@@ -30,6 +34,9 @@ MACRO(FIND_FLTK_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
PATHS
|
||||
$ENV{FLTK_DIR}/lib
|
||||
$ENV{FLTK_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -38,6 +45,7 @@ MACRO(FIND_FLTK_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
FIND_PATH(FOX_INCLUDE_DIR fx.h
|
||||
$ENV{FOX_DIR}/include/fox-1.6
|
||||
$ENV{FOX_DIR}/fox-1.6
|
||||
$ENV{OSGDIR}/include/fox-1.6
|
||||
$ENV{OSGDIR}/fox-1.6
|
||||
$ENV{OSG_ROOT}/include/fox-1.6
|
||||
~/Library/Frameworks/fox-1.6
|
||||
/Library/Frameworks/fox-1.6
|
||||
/usr/local/include/fox-1.6
|
||||
@@ -20,9 +23,13 @@ FIND_PATH(FOX_INCLUDE_DIR fx.h
|
||||
/opt/local/include/fox-1.6 # DarwinPorts
|
||||
/opt/csw/include/fox-1.6 # Blastwave
|
||||
/opt/include/fox-1.6
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/fox-1.6
|
||||
/usr/freeware/include/fox-1.6
|
||||
$ENV{FOX_DIR}/include
|
||||
$ENV{FOX_DIR}
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
@@ -31,6 +38,7 @@ FIND_PATH(FOX_INCLUDE_DIR fx.h
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
@@ -41,6 +49,9 @@ MACRO(FIND_FOX_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
PATHS
|
||||
$ENV{FOX_DIR}/lib
|
||||
$ENV{FOX_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -49,6 +60,7 @@ MACRO(FIND_FOX_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ FIND_PATH(GIFLIB_INCLUDE_DIR gif_lib.h
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
@@ -60,6 +61,7 @@ FIND_LIBRARY(GIFLIB_LIBRARY
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]
|
||||
/usr/freeware
|
||||
PATH_SUFFIXES lib64 lib
|
||||
)
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h
|
||||
$ENV{JASPER_DIR}/include
|
||||
$ENV{JASPER_DIR}
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
@@ -20,6 +23,7 @@ FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
@@ -28,6 +32,9 @@ FIND_LIBRARY(JASPER_LIBRARY
|
||||
PATHS
|
||||
$ENV{JASPER_DIR}/lib
|
||||
$ENV{JASPER_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -36,6 +43,7 @@ FIND_LIBRARY(JASPER_LIBRARY
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
FIND_PATH(LIBVNCSERVER_INCLUDE_DIR rfb/rfb.h
|
||||
$ENV{LIBVNCSERVER_DIR}/include
|
||||
$ENV{LIBVNCSERVER_DIR}
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
@@ -19,6 +22,7 @@ FIND_PATH(LIBVNCSERVER_INCLUDE_DIR rfb/rfb.h
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
@@ -27,6 +31,9 @@ FIND_LIBRARY(LIBVNCCLIENT_LIBRARY
|
||||
PATHS
|
||||
$ENV{LIBVNCSERVER_DIR}/lib
|
||||
$ENV{LIBVNCSERVER_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -35,6 +42,7 @@ FIND_LIBRARY(LIBVNCCLIENT_LIBRARY
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
@@ -43,6 +51,9 @@ FIND_LIBRARY(LIBVNCSERVER_LIBRARY
|
||||
PATHS
|
||||
$ENV{LIBVNCSERVER_DIR}/lib
|
||||
$ENV{LIBVNCSERVER_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -51,6 +62,7 @@ FIND_LIBRARY(LIBVNCSERVER_LIBRARY
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
|
||||
@@ -27,19 +27,13 @@ MACRO(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
NAMES "${MYLIBRARYNAME}${CMAKE_DEBUG_POSTFIX}"
|
||||
PATHS
|
||||
${OSG_DIR}/lib/Debug
|
||||
${OSG_DIR}/lib64/Debug
|
||||
${OSG_DIR}/lib
|
||||
${OSG_DIR}/lib64
|
||||
$ENV{OSG_DIR}/lib/debug
|
||||
$ENV{OSG_DIR}/lib64/debug
|
||||
$ENV{OSG_DIR}/lib
|
||||
$ENV{OSG_DIR}/lib64
|
||||
$ENV{OSG_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}/lib64
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
$ENV{OSG_ROOT}/lib64
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
@@ -61,27 +55,21 @@ MACRO(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
)
|
||||
|
||||
FIND_LIBRARY(${MYLIBRARY}
|
||||
NAMES "${MYLIBRARYNAME}${CMAKE_RELEASE_POSTFIX}"
|
||||
NAMES ${MYLIBRARYNAME}
|
||||
PATHS
|
||||
${OSG_DIR}/lib/Release
|
||||
${OSG_DIR}/lib64/Release
|
||||
${OSG_DIR}/lib
|
||||
${OSG_DIR}/lib64
|
||||
$ENV{OSG_DIR}/lib/Release
|
||||
$ENV{OSG_DIR}/lib64/Release
|
||||
$ENV{OSG_DIR}/lib
|
||||
$ENV{OSG_DIR}/lib64
|
||||
$ENV{OSG_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}/lib64
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
$ENV{OSG_ROOT}/lib64
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(${MYLIBRARY}
|
||||
NAMES "${MYLIBRARYNAME}${CMAKE_RELEASE_POSTFIX}"
|
||||
NAMES ${MYLIBRARYNAME}
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h
|
||||
$ENV{OPENEXR_DIR}/include
|
||||
$ENV{OPENEXR_DIR}
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
@@ -20,6 +23,7 @@ FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
@@ -28,6 +32,9 @@ FIND_LIBRARY(OPENEXR_IlmIlf_LIBRARY
|
||||
PATHS
|
||||
$ENV{OPENEXR_DIR}/lib
|
||||
$ENV{OPENEXR_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -36,6 +43,7 @@ FIND_LIBRARY(OPENEXR_IlmIlf_LIBRARY
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
@@ -44,6 +52,9 @@ FIND_LIBRARY(OPENEXR_Half_LIBRARY
|
||||
PATHS
|
||||
$ENV{OPENEXR_DIR}/lib
|
||||
$ENV{OPENEXR_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -52,6 +63,7 @@ FIND_LIBRARY(OPENEXR_Half_LIBRARY
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
|
||||
@@ -10,9 +10,12 @@
|
||||
# Created by Robert Osfield.
|
||||
# Modified for the debug library by Jean-S<>bastien Guay.
|
||||
|
||||
FIND_PATH(OPENVRML_INCLUDE_DIR openvrml/openvrml-common.h
|
||||
FIND_PATH(OPENVRML_INCLUDE_DIR openvrml/openvrml/common.h
|
||||
$ENV{OPENVRML_DIR}/include
|
||||
$ENV{OPENVRML_DIR}
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
@@ -21,6 +24,7 @@ FIND_PATH(OPENVRML_INCLUDE_DIR openvrml/openvrml-common.h
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
@@ -29,6 +33,9 @@ FIND_LIBRARY(OPENVRML_LIBRARY
|
||||
PATHS
|
||||
$ENV{OPENVRML_DIR}/lib
|
||||
$ENV{OPENVRML_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -37,6 +44,7 @@ FIND_LIBRARY(OPENVRML_LIBRARY
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
@@ -45,6 +53,9 @@ FIND_LIBRARY(OPENVRML_LIBRARY_DEBUG
|
||||
PATHS
|
||||
$ENV{OPENVRML_DIR}/lib
|
||||
$ENV{OPENVRML_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -53,6 +64,7 @@ FIND_LIBRARY(OPENVRML_LIBRARY_DEBUG
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
FIND_PATH( DCMTK_ROOT_INCLUDE_DIR dcmtk/config/osconfig.h
|
||||
${DCMTK_DIR}/config/include
|
||||
${DCMTK_DIR}/include
|
||||
/usr/local/dicom/include
|
||||
/usr/local/include/
|
||||
/usr/include/
|
||||
/usr/local/dicom/include/
|
||||
@@ -27,7 +26,6 @@ FIND_PATH( DCMTK_config_INCLUDE_DIR osconfig.h
|
||||
${DCMTK_ROOT_INCLUDE_DIR}/dcmtk/config
|
||||
${DCMTK_DIR}/config/include
|
||||
${DCMTK_DIR}/include
|
||||
/usr/local/dicom/include
|
||||
/usr/local/include/dcmtk/config
|
||||
/usr/include/dcmtk/config
|
||||
/usr/local/dicom/include/dcmtk/config
|
||||
@@ -37,7 +35,6 @@ FIND_PATH( DCMTK_ofstd_INCLUDE_DIR ofstdinc.h
|
||||
${DCMTK_ROOT_INCLUDE_DIR}/dcmtk/ofstd
|
||||
${DCMTK_DIR}/ofstd/include
|
||||
${DCMTK_DIR}/include/ofstd
|
||||
/usr/local/dicom/include/dcmtk/ofstd
|
||||
/usr/local/include/dcmtk/ofstd
|
||||
/usr/include/dcmtk/ofstd
|
||||
/usr/local/dicom/include/dcmtk/ofstd
|
||||
@@ -50,7 +47,6 @@ FIND_LIBRARY( DCMTK_ofstd_LIBRARY ofstd
|
||||
${DCMTK_DIR}/ofstd/Release
|
||||
${DCMTK_DIR}/ofstd/Debug
|
||||
${DCMTK_DIR}/lib
|
||||
/usr/local/dicom/lib
|
||||
/usr/local/lib64
|
||||
/usr/lib64
|
||||
/usr/local/lib
|
||||
@@ -63,7 +59,6 @@ FIND_PATH( DCMTK_dcmdata_INCLUDE_DIR dctypes.h
|
||||
${DCMTK_ROOT_INCLUDE_DIR}/dcmtk/dcmdata
|
||||
${DCMTK_DIR}/dcmdata/include
|
||||
${DCMTK_DIR}/include/dcmdata
|
||||
/usr/local/dicom/include/dcmtk/dcmdata
|
||||
/usr/local/include/dcmtk/dcmdata
|
||||
/usr/include/dcmtk/dcmdata
|
||||
/usr/local/dicom/include/dcmtk/dcmdata
|
||||
@@ -76,7 +71,6 @@ FIND_LIBRARY( DCMTK_dcmdata_LIBRARY dcmdata
|
||||
${DCMTK_DIR}/dcmdata/Release
|
||||
${DCMTK_DIR}/dcmdata/Debug
|
||||
${DCMTK_DIR}/lib
|
||||
/usr/local/dicom/lib
|
||||
/usr/local/lib64
|
||||
/usr/lib64
|
||||
/usr/local/lib
|
||||
@@ -89,7 +83,6 @@ FIND_PATH( DCMTK_dcmimgle_INCLUDE_DIR dcmimage.h
|
||||
${DCMTK_ROOT_INCLUDE_DIR}/dcmtk/dcmimgle
|
||||
${DCMTK_DIR}/dcmimgle/include
|
||||
${DCMTK_DIR}/include/dcmimgle
|
||||
/usr/local/dicom/include/dcmtk/dcmimgle
|
||||
/usr/local/include/dcmtk/dcmimgle
|
||||
/usr/include/dcmtk/dcmimgle
|
||||
/usr/local/dicom/include/dcmtk/dcmimgle
|
||||
@@ -102,7 +95,6 @@ FIND_LIBRARY( DCMTK_dcmimgle_LIBRARY dcmimgle
|
||||
${DCMTK_DIR}/dcmimgle/Release
|
||||
${DCMTK_DIR}/dcmimgle/Debug
|
||||
${DCMTK_DIR}/lib
|
||||
/usr/local/dicom/lib
|
||||
/usr/local/lib64
|
||||
/usr/lib64
|
||||
/usr/local/lib
|
||||
@@ -114,7 +106,6 @@ FIND_LIBRARY(DCMTK_imagedb_LIBRARY imagedb
|
||||
${DCMTK_DIR}/imagectn/libsrc/Release
|
||||
${DCMTK_DIR}/imagectn/libsrc/
|
||||
${DCMTK_DIR}/imagectn/libsrc/Debug
|
||||
/usr/local/dicom/lib
|
||||
/usr/local/lib64
|
||||
/usr/lib64
|
||||
/usr/local/lib
|
||||
@@ -126,7 +117,6 @@ FIND_LIBRARY(DCMTK_dcmnet_LIBRARY dcmnet
|
||||
${DCMTK_DIR}/dcmnet/libsrc/Release
|
||||
${DCMTK_DIR}/dcmnet/libsrc/Debug
|
||||
${DCMTK_DIR}/dcmnet/libsrc/
|
||||
/usr/local/dicom/lib
|
||||
/usr/local/lib64
|
||||
/usr/lib64
|
||||
/usr/local/lib
|
||||
|
||||
@@ -14,6 +14,9 @@ FIND_PATH(PERFORMER_INCLUDE_DIR Performer/pfdu.h
|
||||
$ENV{PFROOT}
|
||||
$ENV{PERFORMER_DIR}/include
|
||||
$ENV{PERFORMER_DIR}
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
@@ -22,6 +25,7 @@ FIND_PATH(PERFORMER_INCLUDE_DIR Performer/pfdu.h
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
@@ -35,6 +39,7 @@ IF(MSVC)
|
||||
$ENV{PERFORMER_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -43,6 +48,7 @@ IF(MSVC)
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
ELSE(MSVC)
|
||||
@@ -53,6 +59,9 @@ ELSE(MSVC)
|
||||
$ENV{PFROOT}
|
||||
$ENV{PERFORMER_DIR}/lib
|
||||
$ENV{PERFORMER_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -61,6 +70,7 @@ ELSE(MSVC)
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
ENDIF(MSVC)
|
||||
|
||||
@@ -26,6 +26,16 @@ ENDIF(PKG_CONFIG_FOUND)
|
||||
# Added check to make sure that nsIBaseWindow.h is available, as it's not a standard part the of 1.8.x SDK
|
||||
FIND_PATH(NSIBASEWINDOW_INCLUDE_DIR widget/nsIBaseWindow.h
|
||||
PATHS ${XULRUNNER_XPCOM_INCLUDE_DIRS}
|
||||
$ENV{OSG_DIR}/include/xulrunner
|
||||
$ENV{OSG_DIR}/include
|
||||
$ENV{OSG_DIR}/xulrunner
|
||||
$ENV{OSG_DIR}
|
||||
$ENV{OSGDIR}/include/xulrunner
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}/xulrunner
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include/xulrunner
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include/xulrunner
|
||||
@@ -40,12 +50,24 @@ FIND_PATH(NSIBASEWINDOW_INCLUDE_DIR widget/nsIBaseWindow.h
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include/xulrunner
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/xulrunner
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include/xulrunner
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
FIND_PATH(XUL_INCLUDE_DIR nsEmbedAPI.h
|
||||
PATHS ${XULRUNNER_XPCOM_INCLUDE_DIRS}
|
||||
$ENV{OSG_DIR}/include/xulrunner
|
||||
$ENV{OSG_DIR}/include
|
||||
$ENV{OSG_DIR}/xulrunner
|
||||
$ENV{OSG_DIR}
|
||||
$ENV{OSGDIR}/include/xulrunner
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}/xulrunner
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include/xulrunner
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include/xulrunner
|
||||
@@ -60,12 +82,24 @@ FIND_PATH(XUL_INCLUDE_DIR nsEmbedAPI.h
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include/xulrunner
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/xulrunner
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include/xulrunner
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
FIND_PATH(NSPR_INCLUDE_DIR prtypes.h
|
||||
PATHS ${XULRUNNER_NSPR_INCLUDE_DIRS}
|
||||
$ENV{OSG_DIR}/include/nspr
|
||||
$ENV{OSG_DIR}/include
|
||||
$ENV{OSG_DIR}/nspr
|
||||
$ENV{OSG_DIR}
|
||||
$ENV{OSGDIR}/include/nspr
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}/nspr
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include/nspr
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include/nspr
|
||||
@@ -80,12 +114,24 @@ FIND_PATH(NSPR_INCLUDE_DIR prtypes.h
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include/nspr
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/nspr
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include/nspr
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
FIND_PATH(MOZJS_INCLUDE_DIR jsapi.h
|
||||
PATHS ${XULRUNNER_JS_INCLUDE_DIRS}
|
||||
$ENV{OSG_DIR}/include/mozjs
|
||||
$ENV{OSG_DIR}/include
|
||||
$ENV{OSG_DIR}/mozjs
|
||||
$ENV{OSG_DIR}
|
||||
$ENV{OSGDIR}/include/mozjs
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}/mozjs
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include/mozjs
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include/mozjs
|
||||
@@ -100,6 +146,8 @@ FIND_PATH(MOZJS_INCLUDE_DIR jsapi.h
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include/mozjs
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/mozjs
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include/mozjs
|
||||
/usr/freeware/include
|
||||
)
|
||||
@@ -107,6 +155,11 @@ FIND_PATH(MOZJS_INCLUDE_DIR jsapi.h
|
||||
FIND_PATH(XUL_DIR
|
||||
NAMES components/appshell.xpt
|
||||
PATHS
|
||||
$ENV{OSG_DIR}/lib
|
||||
$ENV{OSG_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib/xulrunner
|
||||
@@ -121,6 +174,7 @@ FIND_PATH(XUL_DIR
|
||||
/opt/csw/lib
|
||||
/opt/lib/xulrunner
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64/xulrunner
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
@@ -134,6 +188,11 @@ MACRO(FIND_XUL_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
PATHS ${XULRUNNER_NSS_LIBRARY_DIRS}
|
||||
NAMES ${MYLIBRARYNAME}
|
||||
PATHS
|
||||
$ENV{OSG_DIR}/lib
|
||||
$ENV{OSG_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib/xulrunner
|
||||
@@ -148,6 +207,7 @@ MACRO(FIND_XUL_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||
/opt/csw/lib
|
||||
/opt/lib/xulrunner
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64/xulrunner
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
FIND_PATH(XINE_INCLUDE_DIR xine.h
|
||||
$ENV{XINE_DIR}/include
|
||||
$ENV{XINE_DIR}
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
@@ -20,6 +23,7 @@ FIND_PATH(XINE_INCLUDE_DIR xine.h
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
@@ -28,6 +32,9 @@ FIND_LIBRARY(XINE_LIBRARY
|
||||
PATHS
|
||||
$ENV{XINE_DIR}/lib
|
||||
$ENV{XINE_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -36,6 +43,7 @@ FIND_LIBRARY(XINE_LIBRARY
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
|
||||
$ENV{ZLIB_DIR}/include
|
||||
$ENV{ZLIB_DIR}
|
||||
$ENV{OSGDIR}/include
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/include
|
||||
@@ -21,6 +24,7 @@ FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
|
||||
/opt/local/include # DarwinPorts
|
||||
/opt/csw/include # Blastwave
|
||||
/opt/include
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
|
||||
/usr/freeware/include
|
||||
)
|
||||
|
||||
@@ -29,6 +33,9 @@ FIND_LIBRARY(ZLIB_LIBRARY
|
||||
PATHS
|
||||
$ENV{ZLIB_DIR}/lib
|
||||
$ENV{ZLIB_DIR}
|
||||
$ENV{OSGDIR}/lib
|
||||
$ENV{OSGDIR}
|
||||
$ENV{OSG_ROOT}/lib
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local/lib
|
||||
@@ -37,6 +44,7 @@ FIND_LIBRARY(ZLIB_LIBRARY
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||
/usr/freeware/lib64
|
||||
)
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ SET(INSTALL_BINDIR bin)
|
||||
IF(WIN32)
|
||||
SET(INSTALL_LIBDIR bin)
|
||||
SET(INSTALL_ARCHIVEDIR lib)
|
||||
ELSE()
|
||||
ELSE(WIN32)
|
||||
SET(INSTALL_LIBDIR lib${LIB_POSTFIX})
|
||||
SET(INSTALL_ARCHIVEDIR lib${LIB_POSTFIX})
|
||||
ENDIF()
|
||||
ENDIF(WIN32)
|
||||
|
||||
SET(HEADERS_GROUP "Header Files")
|
||||
|
||||
@@ -23,7 +23,7 @@ SOURCE_GROUP(
|
||||
|
||||
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
||||
HANDLE_MSVC_DLL()
|
||||
ENDIF()
|
||||
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
||||
|
||||
INSTALL(
|
||||
TARGETS ${LIB_NAME}
|
||||
|
||||
@@ -1,74 +1,81 @@
|
||||
# - If Visual Studio is being used, this script sets the variable OSG_COMPILER
|
||||
# The principal reason for this is due to MSVC 8.0 SP0 vs SP1 builds.
|
||||
# - Figure out what compiler (and version) cmake is generating for
|
||||
# Once done this will define:
|
||||
#
|
||||
# Variable:
|
||||
# OSG_COMPILER
|
||||
#
|
||||
|
||||
# Not currently used...
|
||||
#IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# EXEC_PROGRAM(
|
||||
# ${CMAKE_CXX_COMPILER}
|
||||
# ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||
# OUTPUT_VARIABLE gcc_compiler_version
|
||||
# )
|
||||
# #MESSAGE("GCC Version: ${gcc_compiler_version}")
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
IF(MSVC60)
|
||||
SET(OSG_COMPILER "vc60")
|
||||
ELSEIF(MSVC70)
|
||||
SET(OSG_COMPILER "vc70")
|
||||
ELSEIF(MSVC71)
|
||||
SET(OSG_COMPILER "vc71")
|
||||
ELSEIF(MSVC80)
|
||||
SET(OSG_COMPILER "vc80")
|
||||
ELSEIF(MSVC90)
|
||||
SET(OSG_COMPILER "vc90")
|
||||
ENDIF()
|
||||
EXEC_PROGRAM(
|
||||
${CMAKE_CXX_COMPILER}
|
||||
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||
OUTPUT_VARIABLE gcc_compiler_version
|
||||
)
|
||||
#MESSAGE("GCC Version: ${gcc_compiler_version}")
|
||||
|
||||
|
||||
IF(MSVC80)
|
||||
MESSAGE(STATUS "Checking if compiler has service pack 1 installed...")
|
||||
FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" "int main() {return 0;}\n")
|
||||
|
||||
TRY_COMPILE(_TRY_RESULT
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
|
||||
CMAKE_FLAGS -D CMAKE_VERBOSE_MAKEFILE=ON
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
)
|
||||
|
||||
IF(_TRY_RESULT)
|
||||
# parse for exact compiler version
|
||||
STRING(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+" vc_compiler_version "${OUTPUT}")
|
||||
IF(vc_compiler_version)
|
||||
#MESSAGE("${vc_compiler_version}")
|
||||
STRING(REGEX MATCHALL "[0-9]+" CL_VERSION_LIST "${vc_compiler_version}")
|
||||
LIST(GET CL_VERSION_LIST 0 CL_MAJOR_VERSION)
|
||||
LIST(GET CL_VERSION_LIST 1 CL_MINOR_VERSION)
|
||||
LIST(GET CL_VERSION_LIST 2 CL_PATCH_VERSION)
|
||||
LIST(GET CL_VERSION_LIST 3 CL_EXTRA_VERSION)
|
||||
ENDIF(vc_compiler_version)
|
||||
|
||||
# Standard vc80 is 14.00.50727.42, sp1 14.00.50727.762, sp2?
|
||||
# Standard vc90 is 9.0.30729.1, sp1 ?
|
||||
IF(CL_EXTRA_VERSION EQUAL 762)
|
||||
SET(OSG_COMPILER "vc80sp1")
|
||||
ELSE(CL_EXTRA_VERSION EQUAL 762)
|
||||
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
||||
IF(MSVC)
|
||||
IF(MSVC60)
|
||||
SET(OSG_COMPILER "vc60")
|
||||
ENDIF(MSVC60)
|
||||
IF(MSVC70)
|
||||
SET(OSG_COMPILER "vc70")
|
||||
ENDIF(MSVC70)
|
||||
IF(MSVC71)
|
||||
SET(OSG_COMPILER "vc71")
|
||||
ENDIF(MSVC71)
|
||||
IF(MSVC80)
|
||||
SET(OSG_COMPILER "vc80")
|
||||
ENDIF(CL_EXTRA_VERSION EQUAL 762)
|
||||
ENDIF(MSVC80)
|
||||
IF(MSVC90)
|
||||
SET(OSG_COMPILER "vc90")
|
||||
ENDIF(MSVC90)
|
||||
|
||||
# parse for exact visual studio version
|
||||
#IF(MSVC_IDE)
|
||||
# string(REGEX MATCH "Visual Studio Version [0-9]+.[0-9]+.[0-9]+.[0-9]+" vs_version "${OUTPUT}")
|
||||
# IF(vs_version)
|
||||
# MESSAGE("${vs_version}")
|
||||
# string(REGEX MATCHALL "[0-9]+" VS_VERSION_LIST "${vs_version}")
|
||||
# list(GET VS_VERSION_LIST 0 VS_MAJOR_VERSION)
|
||||
# list(GET VS_VERSION_LIST 1 VS_MINOR_VERSION)
|
||||
# list(GET VS_VERSION_LIST 2 VS_PATCH_VERSION)
|
||||
# list(GET VS_VERSION_LIST 3 VS_EXTRA_VERSION)
|
||||
# ENDIF(vs_version)
|
||||
#ENDIF(MSVC_IDE)
|
||||
ENDIF(_TRY_RESULT)
|
||||
ENDIF(MSVC80)
|
||||
IF(MSVC80)
|
||||
MESSAGE(STATUS "Checking if compiler has service pack 1 installed...")
|
||||
FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" "int main() {return 0;}\n")
|
||||
|
||||
TRY_COMPILE(_TRY_RESULT
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
|
||||
CMAKE_FLAGS -D CMAKE_VERBOSE_MAKEFILE=ON
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
)
|
||||
|
||||
IF(_TRY_RESULT)
|
||||
# parse for exact compiler version
|
||||
STRING(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+" vc_compiler_version "${OUTPUT}")
|
||||
IF(vc_compiler_version)
|
||||
#MESSAGE("${vc_compiler_version}")
|
||||
STRING(REGEX MATCHALL "[0-9]+" CL_VERSION_LIST "${vc_compiler_version}")
|
||||
LIST(GET CL_VERSION_LIST 0 CL_MAJOR_VERSION)
|
||||
LIST(GET CL_VERSION_LIST 1 CL_MINOR_VERSION)
|
||||
LIST(GET CL_VERSION_LIST 2 CL_PATCH_VERSION)
|
||||
LIST(GET CL_VERSION_LIST 3 CL_EXTRA_VERSION)
|
||||
ENDIF(vc_compiler_version)
|
||||
|
||||
# Standard vc80 is 14.00.50727.42, sp1 14.00.50727.762, sp2?
|
||||
# Standard vc90 is 9.0.30729.1, sp1 ?
|
||||
IF(CL_EXTRA_VERSION EQUAL 762)
|
||||
SET(OSG_COMPILER "vc80sp1")
|
||||
ELSE(CL_EXTRA_VERSION EQUAL 762)
|
||||
SET(OSG_COMPILER "vc80")
|
||||
ENDIF(CL_EXTRA_VERSION EQUAL 762)
|
||||
|
||||
# parse for exact visual studio version
|
||||
#IF(MSVC_IDE)
|
||||
# string(REGEX MATCH "Visual Studio Version [0-9]+.[0-9]+.[0-9]+.[0-9]+" vs_version "${OUTPUT}")
|
||||
# IF(vs_version)
|
||||
# MESSAGE("${vs_version}")
|
||||
# string(REGEX MATCHALL "[0-9]+" VS_VERSION_LIST "${vs_version}")
|
||||
# list(GET VS_VERSION_LIST 0 VS_MAJOR_VERSION)
|
||||
# list(GET VS_VERSION_LIST 1 VS_MINOR_VERSION)
|
||||
# list(GET VS_VERSION_LIST 2 VS_PATCH_VERSION)
|
||||
# list(GET VS_VERSION_LIST 3 VS_EXTRA_VERSION)
|
||||
# ENDIF(vs_version)
|
||||
#ENDIF(MSVC_IDE)
|
||||
ENDIF(_TRY_RESULT)
|
||||
ENDIF(MSVC80)
|
||||
ENDIF(MSVC)
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
@@ -4,11 +4,41 @@
|
||||
# full path of the library name. in order to differentiate release and debug, this macro get the
|
||||
# NAME of the variables, so the macro gets as arguments the target name and the following list of parameters
|
||||
# is intended as a list of variable names each one containing the path of the libraries to link to
|
||||
# The existance of a variable name with _DEBUG appended is tested and, in case it' s value is used
|
||||
# The existance of a varibale name with _DEBUG appended is tested and, in case it' s value is used
|
||||
# for linking to when in debug mode
|
||||
# the content of this library for linking when in debugging
|
||||
#######################################################################################################
|
||||
|
||||
# VALID_BUILDER_VERSION: used for replacing CMAKE_VERSION (available in v2.6.3 RC9) and VERSION_GREATER/VERSION_LESS (available in 2.6.2 RC4).
|
||||
# This can be replaced by "IF(${CMAKE_VERSION} VERSION_LESS "x.y.z")" from 2.6.4.
|
||||
SET(VALID_BUILDER_VERSION OFF)
|
||||
MACRO(BUILDER_VERSION_GREATER MAJOR_VER MINOR_VER PATCH_VER)
|
||||
SET(VALID_BUILDER_VERSION OFF)
|
||||
IF(CMAKE_MAJOR_VERSION GREATER ${MAJOR_VER})
|
||||
SET(VALID_BUILDER_VERSION ON)
|
||||
ELSEIF(CMAKE_MAJOR_VERSION EQUAL ${MAJOR_VER})
|
||||
IF(CMAKE_MINOR_VERSION GREATER ${MINOR_VER})
|
||||
SET(VALID_BUILDER_VERSION ON)
|
||||
ELSEIF(CMAKE_MINOR_VERSION EQUAL ${MINOR_VER})
|
||||
IF(CMAKE_PATCH_VERSION GREATER ${PATCH_VER})
|
||||
SET(VALID_BUILDER_VERSION ON)
|
||||
ENDIF(CMAKE_PATCH_VERSION GREATER ${PATCH_VER})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO(BUILDER_VERSION_GREATER MAJOR_VER MINOR_VER PATCH_VER)
|
||||
|
||||
# CMAKE24: if CMake version is <2.6.0.
|
||||
SET(CMAKE24 OFF)
|
||||
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} LESS 5)
|
||||
SET(CMAKE24 ON)
|
||||
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} LESS 5)
|
||||
|
||||
# CMAKE_VERSION_TEST: Define whether "IF(${CMAKE_VERSION} VERSION_LESS "x.y.z")" can be used or not.
|
||||
BUILDER_VERSION_GREATER(2 6 3)
|
||||
SET(CMAKE_VERSION_TEST ${VALID_BUILDER_VERSION}) # >= 2.6.4
|
||||
|
||||
SET(VALID_BUILDER_VERSION OFF)
|
||||
|
||||
|
||||
MACRO(LINK_WITH_VARIABLES TRGTNAME)
|
||||
FOREACH(varname ${ARGN})
|
||||
@@ -21,22 +51,22 @@ MACRO(LINK_WITH_VARIABLES TRGTNAME)
|
||||
ENDMACRO(LINK_WITH_VARIABLES TRGTNAME)
|
||||
|
||||
MACRO(LINK_INTERNAL TRGTNAME)
|
||||
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
|
||||
IF(NOT CMAKE24)
|
||||
TARGET_LINK_LIBRARIES(${TRGTNAME} ${ARGN})
|
||||
ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
|
||||
ELSE(NOT CMAKE24)
|
||||
FOREACH(LINKLIB ${ARGN})
|
||||
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
||||
#when using versioned names, the .dll name differ from .lib name, there is a problem with that:
|
||||
#CMake 2.4.7, at least seem to use PREFIX instead of IMPORT_PREFIX for computing linkage info to use into projects,
|
||||
# so we full path name to specify linkage, this prevent automatic inferencing of dependencies, so we add explicit depemdencies
|
||||
#to library targets used
|
||||
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_RELEASE_POSTFIX}.lib" debug "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_DEBUG_POSTFIX}.lib")
|
||||
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${OUTPUT_LIBDIR}/${LINKLIB}.lib" debug "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_DEBUG_POSTFIX}.lib")
|
||||
ADD_DEPENDENCIES(${TRGTNAME} ${LINKLIB})
|
||||
ELSE(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
||||
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${LINKLIB}${CMAKE_RELEASE_POSTFIX}" debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
|
||||
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${LINKLIB}" debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
|
||||
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
||||
ENDFOREACH(LINKLIB)
|
||||
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
|
||||
ENDIF(NOT CMAKE24)
|
||||
ENDMACRO(LINK_INTERNAL TRGTNAME)
|
||||
|
||||
MACRO(LINK_EXTERNAL TRGTNAME)
|
||||
@@ -51,12 +81,7 @@ ENDMACRO(LINK_EXTERNAL TRGTNAME)
|
||||
#######################################################################################################
|
||||
|
||||
MACRO(LINK_CORELIB_DEFAULT CORELIB_NAME)
|
||||
SET(ALL_GL_LIBRARIES ${OPENGL_LIBRARIES})
|
||||
IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE)
|
||||
SET(ALL_GL_LIBRARIES ${ALL_GL_LIBRARIES} ${OPENGL_egl_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
LINK_EXTERNAL(${CORELIB_NAME} ${ALL_GL_LIBRARIES})
|
||||
LINK_EXTERNAL(${CORELIB_NAME} ${OPENGL_LIBRARIES})
|
||||
LINK_WITH_VARIABLES(${CORELIB_NAME} OPENTHREADS_LIBRARY)
|
||||
IF(OPENSCENEGRAPH_SONAMES)
|
||||
SET_TARGET_PROPERTIES(${CORELIB_NAME} PROPERTIES VERSION ${OPENSCENEGRAPH_VERSION} SOVERSION ${OPENSCENEGRAPH_SOVERSION})
|
||||
@@ -100,25 +125,19 @@ MACRO(SETUP_LINK_LIBRARIES)
|
||||
ENDIF(TO_INSERT)
|
||||
ENDFOREACH(LINKLIB)
|
||||
|
||||
SET(ALL_GL_LIBRARIES ${OPENGL_LIBRARIES})
|
||||
IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE)
|
||||
SET(ALL_GL_LIBRARIES ${ALL_GL_LIBRARIES} ${OPENGL_egl_LIBRARY})
|
||||
ENDIF()
|
||||
|
||||
# FOREACH(LINKLIB ${TARGET_LIBRARIES})
|
||||
# TARGET_LINK_LIBRARIES(${TARGET_TARGETNAME} optimized ${LINKLIB} debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
|
||||
# ENDFOREACH(LINKLIB)
|
||||
LINK_INTERNAL(${TARGET_TARGETNAME} ${TARGET_LIBRARIES})
|
||||
# FOREACH(LINKLIB ${TARGET_EXTERNAL_LIBRARIES})
|
||||
# TARGET_LINK_LIBRARIES(${TARGET_TARGETNAME} ${LINKLIB})
|
||||
# ENDFOREACH(LINKLIB)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_TARGETNAME} ${TARGET_EXTERNAL_LIBRARIES})
|
||||
FOREACH(LINKLIB ${TARGET_EXTERNAL_LIBRARIES})
|
||||
TARGET_LINK_LIBRARIES(${TARGET_TARGETNAME} ${LINKLIB})
|
||||
ENDFOREACH(LINKLIB)
|
||||
IF(TARGET_LIBRARIES_VARS)
|
||||
LINK_WITH_VARIABLES(${TARGET_TARGETNAME} ${TARGET_LIBRARIES_VARS})
|
||||
ENDIF(TARGET_LIBRARIES_VARS)
|
||||
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
||||
#when using full path name to specify linkage, it seems that already linked libs must be specified
|
||||
LINK_EXTERNAL(${TARGET_TARGETNAME} ${ALL_GL_LIBRARIES})
|
||||
LINK_EXTERNAL(${TARGET_TARGETNAME} ${OPENGL_LIBRARIES})
|
||||
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
||||
|
||||
ENDMACRO(SETUP_LINK_LIBRARIES)
|
||||
@@ -127,6 +146,44 @@ ENDMACRO(SETUP_LINK_LIBRARIES)
|
||||
# this is the common set of command for all the plugins
|
||||
#
|
||||
|
||||
# Sets the output directory property for CMake >= 2.6.0, giving an output path RELATIVE to default one
|
||||
MACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR)
|
||||
BUILDER_VERSION_GREATER(2 8 0)
|
||||
IF(NOT VALID_BUILDER_VERSION)
|
||||
# If CMake <= 2.8.0 (Testing CMAKE_VERSION is possible in >= 2.6.4)
|
||||
IF(MSVC_IDE)
|
||||
# Using the "prefix" hack
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../${RELATIVE_OUTDIR}/")
|
||||
ELSE(MSVC_IDE)
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "${RELATIVE_OUTDIR}/")
|
||||
ENDIF(MSVC_IDE)
|
||||
ELSE(NOT VALID_BUILDER_VERSION)
|
||||
# Using the output directory properties
|
||||
|
||||
# Global properties (All generators but VS & Xcode)
|
||||
FILE(TO_CMAKE_PATH TMPVAR "CMAKE_ARCHIVE_OUTPUT_DIRECTORY/${RELATIVE_OUTDIR}")
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${TMPVAR}")
|
||||
FILE(TO_CMAKE_PATH TMPVAR "CMAKE_RUNTIME_OUTPUT_DIRECTORY/${RELATIVE_OUTDIR}")
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TMPVAR}")
|
||||
FILE(TO_CMAKE_PATH TMPVAR "CMAKE_LIBRARY_OUTPUT_DIRECTORY/${RELATIVE_OUTDIR}")
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${TMPVAR}")
|
||||
|
||||
# Per-configuration property (VS, Xcode)
|
||||
FOREACH(CONF ${CMAKE_CONFIGURATION_TYPES}) # For each configuration (Debug, Release, MinSizeRel... and/or anything the user chooses)
|
||||
STRING(TOUPPER "${CONF}" CONF) # Go uppercase (DEBUG, RELEASE...)
|
||||
|
||||
# We use "FILE(TO_CMAKE_PATH", to create nice looking paths
|
||||
FILE(TO_CMAKE_PATH "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONF}}/${RELATIVE_OUTDIR}" TMPVAR)
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES "ARCHIVE_OUTPUT_DIRECTORY_${CONF}" "${TMPVAR}")
|
||||
FILE(TO_CMAKE_PATH "${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONF}}/${RELATIVE_OUTDIR}" TMPVAR)
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES "RUNTIME_OUTPUT_DIRECTORY_${CONF}" "${TMPVAR}")
|
||||
FILE(TO_CMAKE_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}}/${RELATIVE_OUTDIR}" TMPVAR)
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES "LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${TMPVAR}")
|
||||
ENDFOREACH(CONF ${CMAKE_CONFIGURATION_TYPES})
|
||||
ENDIF(NOT VALID_BUILDER_VERSION)
|
||||
ENDMACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR)
|
||||
|
||||
|
||||
MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
||||
|
||||
SET(TARGET_NAME ${PLUGIN_NAME} )
|
||||
@@ -148,9 +205,6 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
||||
ELSE(${ARGC} GREATER 1)
|
||||
SET(PACKAGE_COMPONENT libopenscenegraph)
|
||||
ENDIF(${ARGC} GREATER 1)
|
||||
|
||||
# Add the VisualStudio versioning info
|
||||
SET(TARGET_SRC ${TARGET_SRC} ${OPENSCENEGRAPH_VERSIONINFO_RC})
|
||||
|
||||
# here we use the command to generate the library
|
||||
|
||||
@@ -166,13 +220,10 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "")
|
||||
ENDIF(NOT UNIX)
|
||||
ELSE(NOT MSVC)
|
||||
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
|
||||
IF(NOT MSVC_IDE)
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "${OSG_PLUGINS}/")
|
||||
ELSE(NOT MSVC_IDE)
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../${OSG_PLUGINS}/")
|
||||
ENDIF(NOT MSVC_IDE)
|
||||
ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
|
||||
IF(NOT CMAKE24)
|
||||
SET_OUTPUT_DIR_PROPERTY_260(${TARGET_TARGETNAME} "${OSG_PLUGINS}") # Sets the ouput to be /osgPlugin-X.X.X ; also ensures the /Debug /Release are removed
|
||||
ELSE(NOT CMAKE24)
|
||||
|
||||
IF(OSG_MSVC_VERSIONED_DLL)
|
||||
|
||||
#this is a hack... the build place is set to lib/<debug or release> by LIBARARY_OUTPUT_PATH equal to OUTPUT_LIBDIR
|
||||
@@ -195,7 +246,8 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
||||
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "${OSG_PLUGINS}/")
|
||||
ENDIF(OSG_MSVC_VERSIONED_DLL)
|
||||
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
|
||||
|
||||
ENDIF(NOT CMAKE24)
|
||||
ENDIF(NOT MSVC)
|
||||
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
|
||||
@@ -267,14 +319,11 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
|
||||
ENDIF(${IS_COMMANDLINE_APP})
|
||||
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES OUTPUT_NAME ${TARGET_NAME})
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_OUTPUT_NAME "${TARGET_NAME}${CMAKE_DEBUG_POSTFIX}")
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES RELEASE_OUTPUT_NAME "${TARGET_NAME}${CMAKE_RELEASE_POSTFIX}")
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES RELWITHDEBINFO_OUTPUT_NAME "${TARGET_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}")
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES MINSIZEREL_OUTPUT_NAME "${TARGET_NAME}${CMAKE_MINSIZEREL_POSTFIX}")
|
||||
|
||||
IF(MSVC_IDE AND OSG_MSVC_VERSIONED_DLL)
|
||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../")
|
||||
SET_OUTPUT_DIR_PROPERTY_260(${TARGET_TARGETNAME} "") # Ensure the /Debug /Release are removed
|
||||
ENDIF(MSVC_IDE AND OSG_MSVC_VERSIONED_DLL)
|
||||
|
||||
SETUP_LINK_LIBRARIES()
|
||||
@@ -358,10 +407,19 @@ MACRO(HANDLE_MSVC_DLL)
|
||||
ELSE(${ARGC} GREATER 1)
|
||||
SET(LIB_SOVERSION ${OPENSCENEGRAPH_SOVERSION})
|
||||
ENDIF(${ARGC} GREATER 1)
|
||||
|
||||
|
||||
SET_OUTPUT_DIR_PROPERTY_260(${LIB_NAME} "") # Ensure the /Debug /Release are removed
|
||||
IF(NOT MSVC_IDE)
|
||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../bin/${LIB_PREFIX}${LIB_SOVERSION}-")
|
||||
IF (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
|
||||
IF (NOT CMAKE24)
|
||||
BUILDER_VERSION_GREATER(2 8 0)
|
||||
IF(NOT VALID_BUILDER_VERSION)
|
||||
# If CMake < 2.8.1
|
||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
|
||||
ELSE(NOT VALID_BUILDER_VERSION)
|
||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "${LIB_PREFIX}${LIB_SOVERSION}-")
|
||||
ENDIF(NOT VALID_BUILDER_VERSION)
|
||||
ELSE (NOT CMAKE24)
|
||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
|
||||
SET(NEW_LIB_NAME "${OUTPUT_BINDIR}/${LIB_PREFIX}${LIB_SOVERSION}-${LIB_NAME}")
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET ${LIB_NAME}
|
||||
@@ -371,9 +429,19 @@ MACRO(HANDLE_MSVC_DLL)
|
||||
COMMAND ${CMAKE_COMMAND} -E remove "${NEW_LIB_NAME}.lib"
|
||||
COMMAND ${CMAKE_COMMAND} -E remove "${NEW_LIB_NAME}.exp"
|
||||
)
|
||||
ENDIF (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
|
||||
ELSE(NOT MSVC_IDE)
|
||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
|
||||
ENDIF (NOT CMAKE24)
|
||||
ELSE(NOT MSVC_IDE)
|
||||
IF (NOT CMAKE24)
|
||||
BUILDER_VERSION_GREATER(2 8 0)
|
||||
IF(NOT VALID_BUILDER_VERSION)
|
||||
# If CMake < 2.8.1
|
||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
|
||||
ELSE(NOT VALID_BUILDER_VERSION)
|
||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "${LIB_PREFIX}${LIB_SOVERSION}-")
|
||||
ENDIF(NOT VALID_BUILDER_VERSION)
|
||||
ELSE (NOT CMAKE24)
|
||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
|
||||
ENDIF (NOT CMAKE24)
|
||||
ENDIF(NOT MSVC_IDE)
|
||||
|
||||
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/osg${OPENSCENEGRAPH_SOVERSION}-")
|
||||
|
||||
@@ -1,220 +1,180 @@
|
||||
|
||||
INCLUDE(ListHandle)
|
||||
|
||||
#---------------------------------------------------
|
||||
# Macro: FILTER_OUT FILTERS INPUTS OUTPUT
|
||||
#
|
||||
# Mimicks Gnu Make's $(filter-out) which removes elements
|
||||
# from a list that match the pattern.
|
||||
# Arguments:
|
||||
# FILTERS - list of patterns that need to be removed
|
||||
# INPUTS - list of inputs that will be worked on
|
||||
# OUTPUT - the filtered list to be returned
|
||||
#
|
||||
# Example:
|
||||
# SET(MYLIST this that and the other)
|
||||
# SET(FILTS this that)
|
||||
#
|
||||
# FILTER_OUT("${FILTS}" "${MYLIST}" OUT)
|
||||
# MESSAGE("OUTPUT = ${OUT}")
|
||||
#
|
||||
# The output -
|
||||
# OUTPUT = and;the;other
|
||||
#
|
||||
#---------------------------------------------------
|
||||
MACRO(FILTER_OUT FILTERS INPUTS OUTPUT)
|
||||
SET(FOUT "")
|
||||
FOREACH(INP ${INPUTS})
|
||||
SET(FILTERED 0)
|
||||
|
||||
FOREACH(FILT ${FILTERS})
|
||||
IF(${FILTERED} EQUAL 0)
|
||||
IF("${FILT}" STREQUAL "${INP}")
|
||||
SET(FILTERED 1)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
MACRO(FILTER_OUT FILTERS INPUTS OUTPUT)
|
||||
# Mimicks Gnu Make's $(filter-out) which removes elements
|
||||
# from a list that match the pattern.
|
||||
# Arguments:
|
||||
# FILTERS - list of patterns that need to be removed
|
||||
# INPUTS - list of inputs that will be worked on
|
||||
# OUTPUT - the filtered list to be returned
|
||||
#
|
||||
# Example:
|
||||
# SET(MYLIST this that and the other)
|
||||
# SET(FILTS this that)
|
||||
#
|
||||
# FILTER_OUT("${FILTS}" "${MYLIST}" OUT)
|
||||
# MESSAGE("OUTPUT = ${OUT}")
|
||||
#
|
||||
# The output -
|
||||
# OUTPUT = and;the;other
|
||||
#
|
||||
SET(FOUT "")
|
||||
FOREACH(INP ${INPUTS})
|
||||
SET(FILTERED 0)
|
||||
FOREACH(FILT ${FILTERS})
|
||||
IF(${FILTERED} EQUAL 0)
|
||||
IF("${FILT}" STREQUAL "${INP}")
|
||||
SET(FILTERED 1)
|
||||
ENDIF("${FILT}" STREQUAL "${INP}")
|
||||
ENDIF(${FILTERED} EQUAL 0)
|
||||
ENDFOREACH(FILT ${FILTERS})
|
||||
IF(${FILTERED} EQUAL 0)
|
||||
SET(FOUT ${FOUT} ${INP})
|
||||
ENDIF(${FILTERED} EQUAL 0)
|
||||
ENDFOREACH(INP ${INPUTS})
|
||||
SET(${OUTPUT} ${FOUT})
|
||||
ENDMACRO(FILTER_OUT FILTERS INPUTS OUTPUT)
|
||||
|
||||
IF(${FILTERED} EQUAL 0)
|
||||
SET(FOUT ${FOUT} ${INP})
|
||||
ENDIF()
|
||||
|
||||
ENDFOREACH(INP ${INPUTS})
|
||||
SET(${OUTPUT} ${FOUT})
|
||||
ENDMACRO()
|
||||
|
||||
#---------------------------------------------------
|
||||
# Macro: GET_HEADERS_EXTENSIONLESS DIR GLOB_PATTERN OUTPUT
|
||||
#
|
||||
#---------------------------------------------------
|
||||
MACRO(GET_HEADERS_EXTENSIONLESS DIR GLOB_PATTERN OUTPUT)
|
||||
FILE(GLOB TMP "${DIR}/${GLOB_PATTERN}" )
|
||||
#FOREACH(F ${TMP})
|
||||
# MESSAGE(STATUS "header-->${F}<--")
|
||||
#ENDFOREACH(F ${TMP})
|
||||
FILTER_OUT("${DIR}/CVS" "${TMP}" TMP)
|
||||
FILTER_OUT("${DIR}/cvs" "${TMP}" ${OUTPUT})
|
||||
FILTER_OUT("${DIR}/.svn" "${TMP}" ${OUTPUT})
|
||||
ENDMACRO()
|
||||
|
||||
#---------------------------------------------------
|
||||
# Macro: ADD_DIRS_TO_ENV_VAR _VARNAME
|
||||
#
|
||||
#---------------------------------------------------
|
||||
MACRO(GET_HEADERS_EXTENSIONLESS DIR GLOB_PATTERN OUTPUT)
|
||||
FILE(GLOB TMP "${DIR}/${GLOB_PATTERN}" )
|
||||
#FOREACH(F ${TMP})
|
||||
# MESSAGE(STATUS "header-->${F}<--")
|
||||
#ENDFOREACH(F ${TMP})
|
||||
FILTER_OUT("${DIR}/CVS" "${TMP}" TMP)
|
||||
FILTER_OUT("${DIR}/cvs" "${TMP}" ${OUTPUT})
|
||||
FILTER_OUT("${DIR}/.svn" "${TMP}" ${OUTPUT})
|
||||
ENDMACRO(GET_HEADERS_EXTENSIONLESS DIR GLOB_PATTERN OUTPUT)
|
||||
|
||||
MACRO(ADD_DIRS_TO_ENV_VAR _VARNAME )
|
||||
FOREACH(_ADD_PATH ${ARGN})
|
||||
FILE(TO_NATIVE_PATH ${_ADD_PATH} _ADD_NATIVE)
|
||||
#SET(_CURR_ENV_PATH $ENV{PATH})
|
||||
#LIST(SET _CURR_ENV_PATH ${_ADD_PATH})
|
||||
#SET(ENV{PATH} ${_CURR_ENV_PATH})${_FILE}
|
||||
IF(WIN32)
|
||||
SET(ENV{${_VARNAME}} "$ENV{${_VARNAME}};${_ADD_NATIVE}")
|
||||
ELSE()
|
||||
SET(ENV{${_VARNAME}} "$ENV{${_VARNAME}}:${_ADD_NATIVE}")
|
||||
ENDIF()
|
||||
#MESSAGE(" env ${_VARNAME} --->$ENV{${_VARNAME}}<---")
|
||||
ENDFOREACH()
|
||||
ENDMACRO()
|
||||
FOREACH(_ADD_PATH ${ARGN})
|
||||
FILE(TO_NATIVE_PATH ${_ADD_PATH} _ADD_NATIVE)
|
||||
#SET(_CURR_ENV_PATH $ENV{PATH})
|
||||
#LIST(SET _CURR_ENV_PATH ${_ADD_PATH})
|
||||
#SET(ENV{PATH} ${_CURR_ENV_PATH})${_FILE}
|
||||
IF(WIN32)
|
||||
SET(ENV{${_VARNAME}} "$ENV{${_VARNAME}};${_ADD_NATIVE}")
|
||||
ELSE(WIN32)
|
||||
SET(ENV{${_VARNAME}} "$ENV{${_VARNAME}}:${_ADD_NATIVE}")
|
||||
ENDIF(WIN32)
|
||||
#MESSAGE(" env ${_VARNAME} --->$ENV{${_VARNAME}}<---")
|
||||
ENDFOREACH(_ADD_PATH)
|
||||
ENDMACRO(ADD_DIRS_TO_ENV_VAR _VARNAME )
|
||||
|
||||
#---------------------------------------------------
|
||||
# Macro: CORRECT_PATH VAR PATH
|
||||
#
|
||||
# Corrects slashes in PATH to be cmake conformous ( / )
|
||||
# MACRO CORRECT_PATH VAR PATH
|
||||
# corrects slashes in PATH to be cmake conformous ( / )
|
||||
# and puts result in VAR
|
||||
#---------------------------------------------------
|
||||
|
||||
MACRO(CORRECT_PATH VAR PATH)
|
||||
SET(${VAR} ${PATH})
|
||||
IF(WIN32)
|
||||
STRING(REGEX REPLACE "/" "\\\\" ${VAR} "${PATH}")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
#---------------------------------------------------
|
||||
# Macro: TARGET_LOCATIONS_SET_FILE FILE
|
||||
# TODO: Ok, this seems a bit ridiculuous.
|
||||
#---------------------------------------------------
|
||||
IF(WIN32)
|
||||
STRING(REGEX REPLACE "/" "\\\\" ${VAR} "${PATH}")
|
||||
ENDIF(WIN32)
|
||||
ENDMACRO(CORRECT_PATH)
|
||||
|
||||
MACRO(TARGET_LOCATIONS_SET_FILE FILE)
|
||||
SET(ACCUM_FILE_TARGETS ${FILE})
|
||||
FILE(WRITE ${ACCUM_FILE_TARGETS} "")
|
||||
ENDMACRO()
|
||||
|
||||
#---------------------------------------------------
|
||||
# Macro: TARGET_LOCATIONS_ACCUM TARGET_NAME
|
||||
#
|
||||
#---------------------------------------------------
|
||||
SET(ACCUM_FILE_TARGETS ${FILE})
|
||||
FILE(WRITE ${ACCUM_FILE_TARGETS} "")
|
||||
ENDMACRO(TARGET_LOCATIONS_SET_FILE FILE)
|
||||
|
||||
MACRO(TARGET_LOCATIONS_ACCUM TARGET_NAME)
|
||||
IF(ACCUM_FILE_TARGETS)
|
||||
IF(EXISTS ${ACCUM_FILE_TARGETS})
|
||||
GET_TARGET_PROPERTY(_FILE_LOCATION ${TARGET_NAME} LOCATION)
|
||||
FILE(APPEND ${ACCUM_FILE_TARGETS} "${_FILE_LOCATION};")
|
||||
#SET(_TARGETS_LIST ${_TARGETS_LIST} "${_FILE_LOCATION}" CACHE INTERNAL "lista dll")
|
||||
#MESSAGE("adding target -->${TARGET_NAME}<-- file -->${_FILE_LOCATION}<-- to list -->${_TARGETS_LIST}<--")
|
||||
#SET(ACCUM_FILE_TARGETS ${ACCUM_FILE_TARGETS} ${_FILE_LOCATION})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
#---------------------------------------------------
|
||||
# Macro: TARGET_LOCATIONS_GET_LIST _VAR
|
||||
#
|
||||
#---------------------------------------------------
|
||||
IF(ACCUM_FILE_TARGETS)
|
||||
IF(EXISTS ${ACCUM_FILE_TARGETS})
|
||||
GET_TARGET_PROPERTY(_FILE_LOCATION ${TARGET_NAME} LOCATION)
|
||||
FILE(APPEND ${ACCUM_FILE_TARGETS} "${_FILE_LOCATION};")
|
||||
#SET(_TARGETS_LIST ${_TARGETS_LIST} "${_FILE_LOCATION}" CACHE INTERNAL "lista dll")
|
||||
#MESSAGE("adding target -->${TARGET_NAME}<-- file -->${_FILE_LOCATION}<-- to list -->${_TARGETS_LIST}<--")
|
||||
#SET(ACCUM_FILE_TARGETS ${ACCUM_FILE_TARGETS} ${_FILE_LOCATION})
|
||||
ENDIF(EXISTS ${ACCUM_FILE_TARGETS})
|
||||
ENDIF(ACCUM_FILE_TARGETS)
|
||||
ENDMACRO(TARGET_LOCATIONS_ACCUM TARGET_NAME)
|
||||
|
||||
MACRO(TARGET_LOCATIONS_GET_LIST _VAR)
|
||||
IF(ACCUM_FILE_TARGETS)
|
||||
IF(EXISTS ${ACCUM_FILE_TARGETS})
|
||||
FILE(READ ${ACCUM_FILE_TARGETS} ${_VAR})
|
||||
ENDIF(EXISTS ${ACCUM_FILE_TARGETS})
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
IF(ACCUM_FILE_TARGETS)
|
||||
IF(EXISTS ${ACCUM_FILE_TARGETS})
|
||||
FILE(READ ${ACCUM_FILE_TARGETS} ${_VAR})
|
||||
ENDIF(EXISTS ${ACCUM_FILE_TARGETS})
|
||||
ENDIF(ACCUM_FILE_TARGETS)
|
||||
ENDMACRO(TARGET_LOCATIONS_GET_LIST _VAR)
|
||||
|
||||
#---------------------------------------------------
|
||||
# Macro: FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY SEARCHPATHLIST
|
||||
#
|
||||
#---------------------------------------------------
|
||||
|
||||
MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY SEARCHPATHLIST)
|
||||
MESSAGE(STATUS "searching ${DEPNAME} -->${INCLUDEFILE}<-->${LIBRARY}<-->${SEARCHPATHLIST}<--")
|
||||
|
||||
SET(MY_PATH_INCLUDE )
|
||||
SET(MY_PATH_LIB )
|
||||
SET(MY_PATH_BIN )
|
||||
MESSAGE(STATUS "searching ${DEPNAME} -->${INCLUDEFILE}<-->${LIBRARY}<-->${SEARCHPATHLIST}<--")
|
||||
|
||||
FOREACH( MYPATH ${SEARCHPATHLIST} )
|
||||
SET(MY_PATH_INCLUDE ${MY_PATH_INCLUDE} ${MYPATH}/include)
|
||||
SET(MY_PATH_LIB ${MY_PATH_LIB} ${MYPATH}/lib)
|
||||
SET(MY_PATH_BIN ${MY_PATH_BIN} ${MYPATH}/bin)
|
||||
ENDFOREACH()
|
||||
SET(MY_PATH_INCLUDE )
|
||||
SET(MY_PATH_LIB )
|
||||
SET(MY_PATH_BIN )
|
||||
|
||||
SET(MYLIBRARY "${LIBRARY}")
|
||||
SEPARATE_ARGUMENTS(MYLIBRARY)
|
||||
FOREACH( MYPATH ${SEARCHPATHLIST} )
|
||||
SET(MY_PATH_INCLUDE ${MY_PATH_INCLUDE} ${MYPATH}/include)
|
||||
SET(MY_PATH_LIB ${MY_PATH_LIB} ${MYPATH}/lib)
|
||||
SET(MY_PATH_BIN ${MY_PATH_BIN} ${MYPATH}/bin)
|
||||
ENDFOREACH( MYPATH ${SEARCHPATHLIST} )
|
||||
|
||||
#MESSAGE( " include paths: -->${MY_PATH_INCLUDE}<--")
|
||||
SET(MYLIBRARY "${LIBRARY}")
|
||||
SEPARATE_ARGUMENTS(MYLIBRARY)
|
||||
|
||||
#MESSAGE( " ${DEPNAME}_INCLUDE_DIR --> ${${DEPNAME}_INCLUDE_DIR}<--")
|
||||
#MESSAGE( " include paths: -->${MY_PATH_INCLUDE}<--")
|
||||
|
||||
FIND_PATH("${DEPNAME}_INCLUDE_DIR" ${INCLUDEFILE}
|
||||
${MY_PATH_INCLUDE}
|
||||
)
|
||||
MARK_AS_ADVANCED("${DEPNAME}_INCLUDE_DIR")
|
||||
#MESSAGE( " ${DEPNAME}_INCLUDE_DIR --> ${${DEPNAME}_INCLUDE_DIR}<--")
|
||||
#MESSAGE( " ${DEPNAME}_INCLUDE_DIR --> ${${DEPNAME}_INCLUDE_DIR}<--")
|
||||
|
||||
FIND_PATH("${DEPNAME}_INCLUDE_DIR" ${INCLUDEFILE}
|
||||
${MY_PATH_INCLUDE}
|
||||
)
|
||||
MARK_AS_ADVANCED("${DEPNAME}_INCLUDE_DIR")
|
||||
#MESSAGE( " ${DEPNAME}_INCLUDE_DIR --> ${${DEPNAME}_INCLUDE_DIR}<--")
|
||||
|
||||
FIND_LIBRARY("${DEPNAME}_LIBRARY"
|
||||
NAMES ${MYLIBRARY}
|
||||
PATHS ${MY_PATH_LIB}
|
||||
)
|
||||
IF(${DEPNAME}_LIBRARY)
|
||||
GET_FILENAME_COMPONENT(MYLIBNAME ${${DEPNAME}_LIBRARY} NAME_WE)
|
||||
GET_FILENAME_COMPONENT(MYBINPATH ${${DEPNAME}_LIBRARY} PATH)
|
||||
GET_FILENAME_COMPONENT(MYBINPATH ${MYBINPATH} PATH)
|
||||
SET(MYBINPATH "${MYBINPATH}/bin")
|
||||
IF(EXISTS ${MYBINPATH})
|
||||
SET(MYFOUND 0)
|
||||
FOREACH(MYPATH ${MY_ACCUM_BINARY_DEP})
|
||||
IF(MYPATH MATCHES ${MYBINPATH})
|
||||
SET(MYFOUND 1)
|
||||
#MESSAGE("found -->${MYPATH}<-->${MYBINPATH}<--")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
IF(MYFOUND EQUAL 0)
|
||||
SET(MY_ACCUM_BINARY_DEP ${MY_ACCUM_BINARY_DEP} ${MYBINPATH})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
#MESSAGE("${DEPNAME}_BINDEP searching -->${MYLIBNAME}${CMAKE_SHARED_MODULE_SUFFIX}<--in-->${MY_PATH_BIN}<--")
|
||||
# FIND_FILE("${DEPNAME}_BINDEP"
|
||||
# ${MYLIBNAME}${CMAKE_SHARED_MODULE_SUFFIX}
|
||||
# PATHS ${MY_PATH_BIN}
|
||||
# )
|
||||
# FIND_LIBRARY("${DEPNAME}_BINDEP"
|
||||
# NAMES ${MYLIBRARY}
|
||||
# PATHS ${MY_PATH_BIN}
|
||||
# )
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED("${DEPNAME}_LIBRARY")
|
||||
#MESSAGE( " ${DEPNAME}_LIBRARY --> ${${DEPNAME}_LIBRARY}<--")
|
||||
IF(${DEPNAME}_INCLUDE_DIR)
|
||||
IF(${DEPNAME}_LIBRARY)
|
||||
SET( ${DEPNAME}_FOUND "YES" )
|
||||
SET( ${DEPNAME}_LIBRARIES ${${DEPNAME}_LIBRARY} )
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
#---------------------------------------------------
|
||||
# Macro: MACRO_MESSAGE MYTEXT
|
||||
#
|
||||
#---------------------------------------------------
|
||||
FIND_LIBRARY("${DEPNAME}_LIBRARY"
|
||||
NAMES ${MYLIBRARY}
|
||||
PATHS ${MY_PATH_LIB}
|
||||
)
|
||||
IF(${DEPNAME}_LIBRARY)
|
||||
GET_FILENAME_COMPONENT(MYLIBNAME ${${DEPNAME}_LIBRARY} NAME_WE)
|
||||
GET_FILENAME_COMPONENT(MYBINPATH ${${DEPNAME}_LIBRARY} PATH)
|
||||
GET_FILENAME_COMPONENT(MYBINPATH ${MYBINPATH} PATH)
|
||||
SET(MYBINPATH "${MYBINPATH}/bin")
|
||||
IF(EXISTS ${MYBINPATH})
|
||||
SET(MYFOUND 0)
|
||||
FOREACH(MYPATH ${MY_ACCUM_BINARY_DEP})
|
||||
IF(MYPATH MATCHES ${MYBINPATH})
|
||||
SET(MYFOUND 1)
|
||||
#MESSAGE("found -->${MYPATH}<-->${MYBINPATH}<--")
|
||||
ENDIF(MYPATH MATCHES ${MYBINPATH})
|
||||
ENDFOREACH(MYPATH )
|
||||
IF(MYFOUND EQUAL 0)
|
||||
SET(MY_ACCUM_BINARY_DEP ${MY_ACCUM_BINARY_DEP} ${MYBINPATH})
|
||||
ENDIF(MYFOUND EQUAL 0)
|
||||
ENDIF(EXISTS ${MYBINPATH})
|
||||
#MESSAGE("${DEPNAME}_BINDEP searching -->${MYLIBNAME}${CMAKE_SHARED_MODULE_SUFFIX}<--in-->${MY_PATH_BIN}<--")
|
||||
# FIND_FILE("${DEPNAME}_BINDEP"
|
||||
# ${MYLIBNAME}${CMAKE_SHARED_MODULE_SUFFIX}
|
||||
# PATHS ${MY_PATH_BIN}
|
||||
# )
|
||||
# FIND_LIBRARY("${DEPNAME}_BINDEP"
|
||||
# NAMES ${MYLIBRARY}
|
||||
# PATHS ${MY_PATH_BIN}
|
||||
# )
|
||||
ENDIF(${DEPNAME}_LIBRARY)
|
||||
MARK_AS_ADVANCED("${DEPNAME}_LIBRARY")
|
||||
#MESSAGE( " ${DEPNAME}_LIBRARY --> ${${DEPNAME}_LIBRARY}<--")
|
||||
IF(${DEPNAME}_INCLUDE_DIR)
|
||||
IF(${DEPNAME}_LIBRARY)
|
||||
SET( ${DEPNAME}_FOUND "YES" )
|
||||
SET( ${DEPNAME}_LIBRARIES ${${DEPNAME}_LIBRARY} )
|
||||
ENDIF(${DEPNAME}_LIBRARY)
|
||||
ENDIF(${DEPNAME}_INCLUDE_DIR)
|
||||
ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY SEARCHPATHLIST)
|
||||
|
||||
#SET(MACRO_MESSAGE_DEBUG TRUE)
|
||||
MACRO(MACRO_MESSAGE MYTEXT)
|
||||
IF(MACRO_MESSAGE_DEBUG)
|
||||
MESSAGE("in file -->${CMAKE_CURRENT_LIST_FILE}<-- line -->${CMAKE_CURRENT_LIST_LINE}<-- message ${MYTEXT}")
|
||||
ELSE()
|
||||
ELSE(MACRO_MESSAGE_DEBUG)
|
||||
MESSAGE(STATUS "in file -->${CMAKE_CURRENT_LIST_FILE}<-- line -->${CMAKE_CURRENT_LIST_LINE}<-- message ${MYTEXT}")
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
ENDIF(MACRO_MESSAGE_DEBUG)
|
||||
ENDMACRO(MACRO_MESSAGE MYTEXT)
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||
ENDIF()
|
||||
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
STRING(REGEX REPLACE "\n" ";" files "${files}")
|
||||
|
||||
FOREACH(file ${files})
|
||||
MESSAGE(STATUS "Uninstalling \"${file}\"")
|
||||
IF(EXISTS "${file}")
|
||||
EXEC_PROGRAM(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
IF(NOT "${rm_retval}" STREQUAL 0)
|
||||
MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(STATUS "File \"${file}\" does not exist.")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
MESSAGE(STATUS "Uninstalling \"${file}\"")
|
||||
IF(EXISTS "${file}")
|
||||
EXEC_PROGRAM(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
IF("${rm_retval}" STREQUAL 0)
|
||||
ELSE("${rm_retval}" STREQUAL 0)
|
||||
MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"")
|
||||
ENDIF("${rm_retval}" STREQUAL 0)
|
||||
ELSE(EXISTS "${file}")
|
||||
MESSAGE(STATUS "File \"${file}\" does not exist.")
|
||||
ENDIF(EXISTS "${file}")
|
||||
ENDFOREACH(file)
|
||||
145
NEWS.txt
145
NEWS.txt
@@ -1,14 +1,151 @@
|
||||
OSG News
|
||||
========
|
||||
|
||||
= !OpenSceneGraph 2.8 release adds osgAnimation and osgVolume libraries, DICOM support, LispSM shadowing and much more. =
|
||||
= !OpenSceneGraph 2.8.2 release - bug fix release =
|
||||
|
||||
PERTHSHIRE, Scotland - 12th February 2009 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 2.8, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 2.8 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. !OpenSceneGraph 2.8 runs on all Microsoft Windows platforms, Apple OS/X, GNU/Linux, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
|
||||
PERTHSHIRE, Scotland - 28th July 2009 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 2.8.2, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 2.8 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. !OpenSceneGraph 2.8 runs on all Microsoft Windows platforms, Apple OS/X, GNU/Linux, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
|
||||
|
||||
=== Open-source development delivers industry-leading features and performance ===
|
||||
The !OpenSceneGraph 2.8 release is the culmination of 10 years of work by the lead developers and the open-source community that has grown up around the project. The real-time graphics industry and academia embraced it from the very beginning, deploying it in real-world applications, and actively participating in its development, testing and refinement. The end result is a high-quality library with a feature set relevant to application developers' needs.
|
||||
The !OpenSceneGraph 2.8.2 release is the culmination of 10 years of work by the lead developers and the open-source community that has grown up around the project. The real-time graphics industry and academia embraced it from the very beginning, deploying it in real-world applications, and actively participating in its development, testing and refinement. The end result is a high-quality library with a feature set relevant to application developers' needs.
|
||||
|
||||
=== Updates include: ===
|
||||
=== Updates between 2.8.2 and 2.8.1 releases include: ===
|
||||
|
||||
* Build fixes for:
|
||||
* !RedHat Enterprise Linux
|
||||
* Building of dicom plugin with ITK under Linux
|
||||
* Crash fixes to:
|
||||
* crash during window destruction under Windows when using closing a MFC based !GraphicsWindow
|
||||
* deadlock under Windows due threading issues with atomic operations in Win32 Barrier implementation
|
||||
* !OpenFlight plugin crashed due to not handling spaces at the end of option strings
|
||||
* !OpenFlight plugin crashed when exported scene graphs contain no TexEnv objects
|
||||
* osganimationtimeline crashed when example model was not found
|
||||
* Bug fixes to :
|
||||
* vertical anchor in osgWidget::Widow was inverted
|
||||
* bsp an mdl plugins to better handling transparency and lighting
|
||||
* computation of sector range in osgSim::!LightPoint
|
||||
* extension checking of FBO packed stencil support
|
||||
* position of tabs at corners of manipulators
|
||||
* threading bug in .osg plugin that occurred during multi-threaded initialization
|
||||
* alignment of Text what setting alignment after assign text string
|
||||
* loading of compressed texture arrays
|
||||
* texture generate mipmap for non power of two textures
|
||||
* regression in X11 key symbol remapping, improved support for Russian keyboards
|
||||
* regression of !StencilMask setting in !RenderStage
|
||||
* small memory leak in X11 usage
|
||||
* Transform::computeBound() double !BoundingSphere support
|
||||
* Resize handling when master and slave Cameras share the same !GraphicsContext
|
||||
* Handling of locale in plugins and env var parsing so it always follows the '.' decimal place convention regardless of the desktop/application locale.
|
||||
|
||||
=== Updates between 2.8.1 and 2.8.0 releases include: ===
|
||||
|
||||
* Build fixes under FreeBSD and IBM AIX, and RedHat Enterprise Linux
|
||||
* Improved compatibility with SWIG wrapper building
|
||||
* Crash fixes in osg::State, osg::Geometry and osgWidget
|
||||
* Bug fixes to :
|
||||
* draw instanced support
|
||||
* Optimizer - MergeGeometryVisitor, RemoveLoadedProxyNodesVisitor and SpatializeGroupsVistor
|
||||
* hdr image loader
|
||||
* handling of opacity maps in 3ds loader
|
||||
* dxf loader
|
||||
* frame buffer object
|
||||
* cursor/event handling in windows
|
||||
* windows threading
|
||||
* memory leak in Collada loader
|
||||
* fixes to display lists/vbo creation that prevent crash under ATI drivers
|
||||
* subface PolygonOffset setting in OpenFlight
|
||||
* osgconv --formats under OSX
|
||||
* osgTerrain::Layer bounding volume calculation
|
||||
|
||||
=== Updates between 2.8 and 2.6 include: ===
|
||||
|
||||
* New osgVolume library for volume rendering, with support for:
|
||||
* High quality GPU based Ray tracing
|
||||
* Transfer functions
|
||||
* Per pixel lighting
|
||||
* Iso surface rendering
|
||||
* Maximum Intensity Projection rendering
|
||||
* Non-power-of-two 3D textures, and 3D texture compression
|
||||
* DICOM loading for reading dicom medical data
|
||||
* New osgAnimation library for character and scene animation.
|
||||
* New plugin for reading Biovision hierarchical files (.BVH) to generate character motion animations.
|
||||
* New osgShadow support for Light Space Perspective Shadow Maps (LispSM).
|
||||
* Three new scene graph widgets for placing traditional 2D capability into fully interactive 3D scenes:
|
||||
* PDF widget (based on libPoppler)
|
||||
* VNC client widget (based on libVNCServer)
|
||||
* Internet browser client widget (based on Gecko/UBrowser)
|
||||
* New plugins for loading Half-Life 2 maps and models.
|
||||
* New plugin for loading EXR, high dynamic range imagery
|
||||
* Improvements to !DatabasePager, tailored for low latency paging.
|
||||
* Improved runtime stats collection and on screen reporting.
|
||||
* Performance improvements through optimization of matrix operations.
|
||||
* Support for the OpenGL "draw instanced" extension.
|
||||
* Support for zlib compressed native .ive and .gz files
|
||||
* Improvements to COLLADA support.
|
||||
* Build reporting using CDash
|
||||
* New packaging support using CPack
|
||||
* A wide range of build and bug fixes
|
||||
|
||||
=== Downloads and Licensing ===
|
||||
!OpenSceneGraph is open-source, so full source code is provided, and can be copied, modified and used free of charge for commercial and non-commercial use. Access to the source allows end users greater flexibility in how they develop, debug and deploy their applications. They gain productivity and freedom by being able to leverage the tool chain in accordance with their own release cycles. Downloads of binaries and source can be found in the [http://www.openscenegraph.org/projects/osg/wiki/Downloads Downloads] section of the openscenegraph.org website.
|
||||
|
||||
!OpenSceneGraph is released under the [http://www.openscenegraph.org/projects/osg/wiki/Legal OpenSceneGraph Public License], which is based on the Lesser GNU Public License (LGPL), permitting the software to be used free of charge across the full spectrum of commercial and open-source applications. Furthermore, it allows both static and dynamic linking of the !OpenSceneGraph libraries without restricting the licensing of the user's software.
|
||||
|
||||
=== !OpenSceneGraph Books now available ===
|
||||
|
||||
The !OpenSceneGraph Quick Start Guide is now available in Chinese as well as English, and alongside the Reference Manual, books can be found at [http://www.osgbooks.com OsgBooks].
|
||||
|
||||
=== Professional support and services ===
|
||||
!OpenSceneGraph project is backed up with professional services by [http://www.openscenegraph.com OpenSceneGraph Professional Services], based in Scotland, and [http://www.skew-matrix.com Skew-Matrix] and [http://www.blue-newt.com Blue-Newt Software] both based in the USA, and a range of [wiki:Community/Contractors Contractors] from around the world. Services available include:
|
||||
|
||||
* Confidential Professional Support
|
||||
* Bespoke development
|
||||
* Consultancy
|
||||
* Training
|
||||
|
||||
=== Community support and contributions ===
|
||||
The diverse and growing community of over 2000 developers is centred around the public osg-users mailing list, where members discuss how best to use !OpenSceneGraph, provide mutual support, and coordinate development of new features and bug fixes. Members of this community come from many different countries with backgrounds ranging from some of the world's largest aerospace companies, game companies, and visual simulation specialists to university researchers, students and hobbyists.
|
||||
|
||||
The !OpenSceneGraph project owes a great deal to the community for its development and support, in particular we wish to thank the [http://www.openscenegraph.org/projects/osg/wiki/Support/Contributors/TwoPointEight 365 individuals] from around the world that have directly contributed to the development and refinement of the !OpenSceneGraph code base.
|
||||
|
||||
----
|
||||
|
||||
About !OpenSceneGraph: [[BR]]
|
||||
The !OpenSceneGraph Project was founded in September 1999 by Don Burns and Robert Osfield.
|
||||
Further information, screenshots, downloads, documentation, and support links can be found on the !OpenSceneGraph project website http://www.openscenegraph.org.
|
||||
|
||||
About !OpenSceneGraph Professional Services:[[BR]]
|
||||
!OpenSceneGraph Professional Services, founded by project lead Robert Osfield in April 2001, is based in Callander, Perhshire, Scotland, and provides professional services on top of !OpenSceneGraph. Further information about the services it provides can be found at http://www.openscenegraph.com.
|
||||
|
||||
----------------------------------------------------------------------------------------
|
||||
|
||||
= !OpenSceneGraph 2.8.1 release - bug fix release =
|
||||
|
||||
PERTHSHIRE, Scotland - 19th May 2009 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 2.8.1, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 2.8 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. !OpenSceneGraph 2.8 runs on all Microsoft Windows platforms, Apple OS/X, GNU/Linux, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
|
||||
|
||||
=== Open-source development delivers industry-leading features and performance ===
|
||||
The !OpenSceneGraph 2.8.1 release is the culmination of 10 years of work by the lead developers and the open-source community that has grown up around the project. The real-time graphics industry and academia embraced it from the very beginning, deploying it in real-world applications, and actively participating in its development, testing and refinement. The end result is a high-quality library with a feature set relevant to application developers' needs.
|
||||
|
||||
=== Updates between 2.8.1 and 2.8.0 releases include: ===
|
||||
|
||||
* Build fixes under FreeBSD and IBM AIX, and RedHat Enterprise Linux.
|
||||
* Improved compatibility with SWIG wrapper building
|
||||
* Crash fixes in osg::State, osg::Geometry and osgWidget.
|
||||
* Bug fixes to :
|
||||
* draw instanced support
|
||||
* Optimizer - MergeGeometryVisitor, RemoveLoadedProxyNodesVisitor and SpatializeGroupsVistor
|
||||
* hdr image loader
|
||||
* handling of opacity maps in 3ds loader
|
||||
* dxf loader
|
||||
* frame buffer object
|
||||
* cursor/event handling in windows
|
||||
* windows threading
|
||||
* memory leak in Collada loader
|
||||
* fixes to display lists/vbo creation that prevent crash under ATI drivers
|
||||
* subface PolygonOffset setting in OpenFlight
|
||||
* osgconv --formats under OSX
|
||||
* osgTerrain::Layer bounding volume calculation.
|
||||
|
||||
=== Updates between 2.8 and 2.6 include: ===
|
||||
|
||||
* New osgVolume library for volume rendering, with support for:
|
||||
* High quality GPU based Ray tracing
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
1 VERSIONINFO
|
||||
FILEVERSION ${OPENSCENEGRAPH_MAJOR_VERSION}, ${OPENSCENEGRAPH_MINOR_VERSION}, ${OPENSCENEGRAPH_PATCH_VERSION}, ${OPENSCENEGRAPH_SOVERSION}
|
||||
PRODUCTVERSION ${OPENSCENEGRAPH_MAJOR_VERSION}, ${OPENSCENEGRAPH_MINOR_VERSION}, ${OPENSCENEGRAPH_PATCH_VERSION}, ${OPENSCENEGRAPH_SOVERSION}
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x0L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "OpenSceneGraph Binary"
|
||||
VALUE "FileVersion", "${OPENSCENEGRAPH_MAJOR_VERSION}, ${OPENSCENEGRAPH_MINOR_VERSION}, ${OPENSCENEGRAPH_PATCH_VERSION}, ${OPENSCENEGRAPH_SOVERSION}"
|
||||
VALUE "InternalName", "OSG"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2009"
|
||||
VALUE "OriginalFilename", ""
|
||||
VALUE "ProductName", "OpenSceneGraph"
|
||||
VALUE "ProductVersion", "${OPENSCENEGRAPH_MAJOR_VERSION}, ${OPENSCENEGRAPH_MINOR_VERSION}, ${OPENSCENEGRAPH_PATCH_VERSION}, ${OPENSCENEGRAPH_SOVERSION}"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
@@ -1,31 +0,0 @@
|
||||
1 VERSIONINFO
|
||||
FILEVERSION ${OPENTHREADS_MAJOR_VERSION}, ${OPENTHREADS_MINOR_VERSION}, ${OPENTHREADS_PATCH_VERSION}, ${OPENTHREADS_SOVERSION}
|
||||
PRODUCTVERSION ${OPENTHREADS_MAJOR_VERSION}, ${OPENTHREADS_MINOR_VERSION}, ${OPENTHREADS_PATCH_VERSION}, ${OPENTHREADS_SOVERSION}
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x0L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "OPENTHREADS Binary"
|
||||
VALUE "FileVersion", "${OPENTHREADS_MAJOR_VERSION}, ${OPENTHREADS_MINOR_VERSION}, ${OPENTHREADS_PATCH_VERSION}, ${OPENTHREADS_SOVERSION}"
|
||||
VALUE "InternalName", "OSG"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2009"
|
||||
VALUE "OriginalFilename", ""
|
||||
VALUE "ProductName", "OPENTHREADS"
|
||||
VALUE "ProductVersion", "${OPENTHREADS_MAJOR_VERSION}, ${OPENTHREADS_MINOR_VERSION}, ${OPENTHREADS_PATCH_VERSION}, ${OPENTHREADS_SOVERSION}"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
@@ -12,10 +12,9 @@ subscribe to our public mailing list:
|
||||
http://www.openscenegraph.org/projects/osg/wiki/MailingLists
|
||||
|
||||
|
||||
|
||||
Robert Osfield.
|
||||
Project Lead.
|
||||
10th December 2009.
|
||||
28th July 2009.
|
||||
|
||||
--
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf430
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf949
|
||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 Courier;\f2\fnil\fcharset0 Monaco;
|
||||
}
|
||||
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid1}
|
||||
{\list\listtemplateid2\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid2}
|
||||
{\list\listtemplateid3\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc2\leveljcn2\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid0\'02\'05.;}{\levelnumbers\'01;}}{\listname ;}\listid3}}
|
||||
{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}{\listoverride\listid3\listoverridecount0\ls3}}
|
||||
\margl1440\margr1440\vieww12820\viewh18900\viewkind0
|
||||
\margl1440\margr1440\vieww11520\viewh13720\viewkind0
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
|
||||
\f0\b\fs24 \cf0 OpenSceneGraph on Mac OS X
|
||||
@@ -27,10 +27,12 @@ Screencasts of how to install and get going with OSG for Mac OS X can be found h
|
||||
\cf0 \
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
\cf0 \
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
|
||||
\b Special Notes for Leopard:\
|
||||
\b \cf0 Special Notes for Leopard:\
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
|
||||
\b0 (See {\field{\*\fldinst{HYPERLINK "http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/MacOSX10.5"}}{\fldrslt http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/MacOSX10.5}} for up-to-date information.)\
|
||||
\b0 \cf0 (See {\field{\*\fldinst{HYPERLINK "http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/MacOSX10.5"}}{\fldrslt http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/MacOSX10.5}} for up-to-date information.)\
|
||||
\
|
||||
|
||||
\b Broken Binary Compatibility:
|
||||
@@ -77,10 +79,8 @@ collect2: ld returned 1 exit status\
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
\cf0 \
|
||||
Apple has a posted a Technical Q&A (QA1567) on this entitled "Compiling X11 / OpenGL applications on Mac OS X v.10.5 Leopard"\
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
{\field{\*\fldinst{HYPERLINK "http://developer.apple.com/qa/qa2007/qa1567.html"}}{\fldrslt \cf0 http://developer.apple.com/qa/qa2007/qa1567.html\
|
||||
}}\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
\cf0 \
|
||||
{\field{\*\fldinst{HYPERLINK "http://developer.apple.com/qa/qa2007/qa1567.html"}}{\fldrslt http://developer.apple.com/qa/qa2007/qa1567.html\
|
||||
}}\
|
||||
Some people have reported a problem similar to this and/or used the solution posted in this Q&A to resolve a problem building the osgdb_freetype plugin. However, I believe this is the wrong solution to this specific problem. In the osgdb_freetype case, the problem was one of two things:\
|
||||
1) The wrong libfreetype.dylib was being used (wrong SDK)\
|
||||
2) The libfreetype.dylib was not found (wrong path)\
|
||||
@@ -105,21 +105,24 @@ This is now fixed in the Xcode project in Subversion.\
|
||||
|
||||
\b 64-bit:\
|
||||
|
||||
\b0 OSG for OS X 64-bit is now 64bit ready.\
|
||||
\b0 OSG for OS X 64-bit is not ready. There are two major obstacles:\
|
||||
1) osgViewer\
|
||||
2) osgdb_qt\
|
||||
\
|
||||
If you are using CMake:\
|
||||
The osgViewer backend is written in Carbon and as far as I know, uses some deprecated APIs that are not available in 64-bit. I do not know if this can be easily cleaned up or not. However, I still believe the better long term solution is for a Cocoa based osgViewer backend to be written. However, nothing yet has been written for this as far as I know.\
|
||||
\
|
||||
set OSG_WINDOWING_SYSTEM to Cocoa\
|
||||
set OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX to imageio\
|
||||
The example, osgviewerCocoa is close to if not already 64-bit clean. However, because the example uses osgViewer::GraphicsWindowEmbedded which needlessly pulls in all the osgViewer Carbon backend dependencies, you will be unable to actually build osgviewerCocoa as 64-bit. But if you are in a hurry to get 64-bit on OS X, this might be where you want to start. Either strip away the Carbon dependencies from osgViewer, or take osgviewerCocoa and transform it into a Cocoa backend for osgViewer.\
|
||||
\
|
||||
this will instruct CMake to use the Cocoa backend and the imageio-plugin for images. The quicktime-plugin (which is not 64bit ready) will be discarded.\
|
||||
\
|
||||
If you are using the XCode-projects:\
|
||||
osgdb_qt is a QuickTime based plugin that handles all image handling and movie handling on OS X. However, it is based on the old QuickTime API which has been marked deprecated and will not survive the 64-bit transition. Thus this plugin needs to be replaced.\
|
||||
\
|
||||
Open the project-settings: use the build configuration "Development 64bit Cocoa" or "Deployment 64bit Cocoa". This will set\
|
||||
I have already submitted a new plugin called osgdb_ImageIO to osgSubmissions which attempts to assume all the image handling duties. This plugin is based on Apple's ImageIO framework which is the new low-level entry point to deal with all image types handled by the platform. Thus this plugin should handle a lot more image formats than the old QuickTime plugin (e.g. JPEG2000, RAW, etc) and will get more as Apple adds support their system. It also adds support for C++ stream support which was missing from the QuickTime plugin. ImageIO is available on 10.4 and 10.5.\
|
||||
\
|
||||
\cf2 \CocoaLigature0 USE_DARWIN_COCOA_IMPLEMENTATION to 1 and compile the cocoa-backend.\cf0 \CocoaLigature1 \
|
||||
However, the osgdb_ImageIO plugin does not handle movies unlike the old QuickTime plugin. The current plan is to introduce a second plugin (osgdb_QTKit), which is based on the new QuickTime Kit framework (10.4 and 10.5). This plugin will replace the movie handling capabilities of the old QuickTime plugin. \
|
||||
\
|
||||
Once both new plugins are in place and osgViewer is sorted out, we should be able to build a 32-bit/64-bit Universal Binary of OSG for OS X.\
|
||||
\
|
||||
Mac OS X 10.3 and earlier users and QuickTime for Windows users will still need to use the old QuickTime plugin.\
|
||||
\
|
||||
|
||||
\b Xcode Project Templates:\
|
||||
@@ -146,16 +149,18 @@ Also note you may place it in per-user locations, e.g.\
|
||||
\cf0 \
|
||||
\
|
||||
\
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
|
||||
\b What's New in this release (2.2):
|
||||
\b \cf0 What's New in this release (2.2):
|
||||
\b0 \
|
||||
\pard\tx220\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li720\fi-720\ql\qnatural\pardirnatural
|
||||
\ls1\ilvl0\cf0 (Sorry, no OS X specific notes.)\
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
\cf0 \
|
||||
\
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
|
||||
\b Notes for 2.0 release:\
|
||||
\b \cf0 Notes for 2.0 release:\
|
||||
\pard\tx220\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li720\fi-720\ql\qnatural\pardirnatural
|
||||
\ls2\ilvl0
|
||||
\b0 \cf0 {\listtext \'95 }OpenThreads now uses Subversion 'externals' to make it look like part of the OSG source distribution.\
|
||||
@@ -178,10 +183,12 @@ With Leopard on the horizon, the need to deal with 64-bit readiness and deprecat
|
||||
\
|
||||
\
|
||||
\
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
|
||||
\b Notes for 1.2 release:\
|
||||
\b \cf0 Notes for 1.2 release:\
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
|
||||
\b0 1.2 was originally intended as a bug fix release for 1.1 (going for 1.1.1), but OSG broke ABI again so the number was bumped to 1.2. There are no significant changes to the Xcode projects or significant OS X specific changes.\
|
||||
\b0 \cf0 1.2 was originally intended as a bug fix release for 1.1 (going for 1.1.1), but OSG broke ABI again so the number was bumped to 1.2. There are no significant changes to the Xcode projects or significant OS X specific changes.\
|
||||
\
|
||||
Since the 1.1 release, we have learned of serious problems (freezing of the window manager) on the (Intel) MacBook Pros using osgText. We believe the problem is with a serious driver bug for ATI in OS X 10.4.7. We believe the bug affects the ATI Radeon X1600. (You can get this string by calling glGetString(GL_RENDERER) when you have a valid OpenGL Context. The string returned to us on affected MacBook Pros is "ATI Radeon X1600 OpenGL Engine".)\
|
||||
\
|
||||
@@ -255,8 +262,9 @@ If you are affected by this, please file a bug report at {\field{\*\fldinst{HYPE
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
|
||||
\b \cf0 Notes for 1.1 release:\
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
|
||||
\b0 We are now distributing Universal Binaries. These binaries were built using Xcode 2.3 and gcc 4.0.1.\
|
||||
\b0 \cf0 We are now distributing Universal Binaries. These binaries were built using Xcode 2.3 and gcc 4.0.1.\
|
||||
The Xcode projects are also set to build as Universal Binaries for both Development and Deployment\
|
||||
targets. If you do not need this and want to save build time, you should change the architecture option\
|
||||
to your desired setting (most likely to $(NATIVE_ARCH)). It is overridden in the top-level "OpenSceneGraph" project in the Group & Files panel. Don't forget to change OpenThreads \
|
||||
@@ -277,8 +285,9 @@ PlugIns, the file size shrunk from about 1GB to about 100MB.\
|
||||
We have stopped maintaining the Xcode 1.5/2.0 projects.\
|
||||
\
|
||||
\
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
|
||||
\b Notes for 1.0 release:
|
||||
\b \cf0 Notes for 1.0 release:
|
||||
\b0 \
|
||||
These projects were primarily developed with gcc 4.0.1 under Tiger 10.4.3 using Xcode 2.2. Starting with gcc 4.0, Apple no longer statically links in the C++ runtime. Apple has made available the g++ 4.0 dynamic runtime for Panther under the 10.3.9 release. To run under Panther, your system must have this update (or you must recompile the binaries for your system).\
|
||||
\
|
||||
@@ -378,8 +387,9 @@ Also remember that OSG will still respond to standard OSG environmental variable
|
||||
\
|
||||
|
||||
\b Prebinding Addresses:\
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
|
||||
\b0 \
|
||||
\b0 \cf0 \
|
||||
These are now obsolete. Prebinding is now disabled. The old addresses were:\
|
||||
\
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
@@ -480,8 +490,9 @@ If you are compiling under Xcode 1.5 and are using our Xcode 1.5/2.0 projects, t
|
||||
{\listtext \'95 }I noticed that for some reason, Xcode has problems compiling the Carbon header with the OpenThreads framework when autovectorization and precompiled headers were enabled. You might try disabling precompiled headers if it is not already. If the problem persists, you may also need to delete the entry that enables autovectorization. In the Groups and Files panel (left side panel), open the Info inspector for the project (top item) and click on the Build tab. Scroll down to the bottom, and remove the autovectorization option. \
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
\cf0 \
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
|
||||
\b Universal Binaries:
|
||||
\b \cf0 Universal Binaries:
|
||||
\b0 \
|
||||
\
|
||||
Be aware, when building you're own Universal Binaries and you use the 10.4 SDK, you must explicitly\
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
#if defined(MAC_OS_X_VERSION_10_5)
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
||||
#define _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC
|
||||
#undef _OPENTHREADS_ATOMIC_USE_MUTEX
|
||||
#undef _OPENTHREADS_ATOMIC_USE_MUTEX
|
||||
#endif
|
||||
#endif
|
||||
/* #undef _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS */
|
||||
|
||||
@@ -5,20 +5,6 @@
|
||||
/* #undef OSG_USE_FLOAT_PLANE */
|
||||
#define OSG_USE_FLOAT_BOUNDINGSPHERE
|
||||
#define OSG_USE_FLOAT_BOUNDINGBOX
|
||||
#define OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION
|
||||
/* #undef OSG_USE_UTF8_FILENAME */
|
||||
#define OSG_DISABLE_MSVC_WARNINGS
|
||||
|
||||
#define OSG_GLU_AVAILABLE
|
||||
#define OSG_GL1_AVAILABLE
|
||||
#define OSG_GL2_AVAILABLE
|
||||
/* #undef OSG_GL3_AVAILABLE */
|
||||
/* #undef OSG_GLES1_AVAILABLE */
|
||||
/* #undef OSG_GLES2_AVAILABLE */
|
||||
#define OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
#define OSG_GL_MATRICES_AVAILABLE
|
||||
#define OSG_GL_VERTEX_FUNCS_AVAILABLE
|
||||
#define OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE
|
||||
#define OSG_GL_FIXED_FUNCTION_AVAILABLE
|
||||
/* #undef OSG_ENFORCE_THREADSAFE */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>osgViewer</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.OpenSceneGraph.osgViewer</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string></string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.2.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,6 +1,6 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf350
|
||||
{\fonttbl\f0\fnil\fcharset0 LucidaGrande;\f1\fswiss\fcharset0 ArialMT;\f2\fmodern\fcharset0 Courier;
|
||||
\f3\fswiss\fcharset0 Helvetica;}
|
||||
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf230
|
||||
{\fonttbl\f0\fnil\fcharset77 LucidaGrande-Bold;\f1\fswiss\fcharset77 ArialMT;\f2\fmodern\fcharset77 Courier;
|
||||
\f3\fnil\fcharset77 LucidaGrande;\f4\fswiss\fcharset77 Helvetica;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\margl1440\margr1440\vieww11980\viewh13540\viewkind0
|
||||
\deftab720
|
||||
@@ -31,13 +31,21 @@
|
||||
\pard\pardeftab720\sa260\ql\qnatural
|
||||
|
||||
\f2\fs21\fsmilli10563 \cf0 SomeDirectory/
|
||||
\f0 \uc0\u8232 \'a0\'a0
|
||||
\f3 \uc0\u8232 \'ca\'ca
|
||||
\f2 OpenThreads/
|
||||
\f3 \uc0\u8232 \'ca\'ca\'ca\'ca
|
||||
\f2 Xcode/
|
||||
\f3 \uc0\u8232 \'ca\'ca\'ca\'ca\'ca\'ca
|
||||
\f2 OpenThreads/
|
||||
\f3 \uc0\u8232 \'ca\'ca\'ca\'ca\'ca\'ca\'ca\'ca
|
||||
\f2 OpenThreads.xcodeproj
|
||||
\f3 \uc0\u8232 \'ca\'ca
|
||||
\f2 OpenSceneGraph/
|
||||
\f0 \uc0\u8232 \'a0\'a0\'a0\'a0
|
||||
\f3 \uc0\u8232 \'ca\'ca\'ca\'ca
|
||||
\f2 Xcode/
|
||||
\f0 \uc0\u8232 \'a0\'a0\'a0\'a0\'a0\'a0
|
||||
\f3 \uc0\u8232 \'ca\'ca\'ca\'ca\'ca\'ca
|
||||
\f2 OpenSceneGraph/
|
||||
\f0 \uc0\u8232 \'a0\'a0\'a0\'a0\'a0\'a0\'a0\'a0
|
||||
\f3 \uc0\u8232 \'ca\'ca\'ca\'ca\'ca\'ca\'ca\'ca
|
||||
\f2 OpenSceneGraph.xcodeproj
|
||||
\f1\fs26 \
|
||||
\pard\pardeftab720\sa200\ql\qnatural
|
||||
@@ -45,7 +53,8 @@
|
||||
\f0\b\fs20 \cf0 Step 3 - Build it\
|
||||
\pard\pardeftab720\sa260\ql\qnatural
|
||||
|
||||
\f1\b0\fs26 \cf0 Now use Xcode to build each of the projects. You may want to set the build style to Deployment depending on what you are doing. The OpenSceneGraph project gives you multiple targets to select from so you may build everything, or just pieces you want.\
|
||||
\f1\b0\fs26 \cf0 Now use Xcode to build each of the projects. You should build OpenThreads first and OpenSceneGraph last. If you are using the Xcode 2.1+ projects, there is a cross-project dependency rule already setup for you in the OpenSceneGraph.xcodeproj called "AllStandardTargets" target. If you use this target, you can skip going to the other two projects and just go directly to OpenSceneGraph and it will build OpenThreads for you automatically.\
|
||||
You may want to set the build style to Deployment depending on what you are doing. The OpenSceneGraph project gives you multiple targets to select from so you may build everything, or just pieces you want.\
|
||||
The binaries will be written to the Xcode build subdirectory (following standard Xcode behavior).\
|
||||
To "Install" the Frameworks, you may move the Frameworks to a standard location.\uc0\u8232 ~/Library/Frameworks (for a single user)\u8232 /Library/Frameworks (for system wide installation)\u8232 /Network/Library/Frameworks (for those who understand when this should be used)\u8232 Or you may place them inside your application bundle e.g.\u8232 YourApp.app/Contents/Frameworks\u8232 Simply drag and drop the frameworks to the desired location.\u8232 \u8232 Similarly, to "Install" the Plugins, move the .so files to\u8232 ~/Library/Application Support/OpenSceneGraph/PlugIns\u8232 /Library/Application Support/OpenSceneGraph/PlugIns\u8232 /Network/Library/Application Support/OpenSceneGraph/PlugIns\u8232 Or you may place the ones you need inside your application bundle e.g.\u8232 YourApp.app/Contents/PlugIns\
|
||||
\pard\pardeftab720\sa200\ql\qnatural
|
||||
@@ -55,12 +64,12 @@ To "Install" the Frameworks, you may move the Frameworks to a standard location.
|
||||
|
||||
\f1\b0\fs26 \cf0 That's it! Just remember to link using -framework instead of -l, e.g. \uc0\u8232
|
||||
\f2\fs21\fsmilli10563 -framework osg -framework osgUtil -framework OpenThreads
|
||||
\f0 \uc0\u8232
|
||||
\f3 \uc0\u8232
|
||||
\f1\fs26 instead of \uc0\u8232
|
||||
\f2\fs21\fsmilli10563 -losg -losgUtil -lOpenThreads\
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardeftab720\ql\qnatural\pardirnatural
|
||||
|
||||
\f3\fs24 \cf0 Also be aware that if using the 10.4 Universal SDK, you may have to explicitly set the Framework search paths (its an option/field in the build settings for your Target) due to the way Apple modifies the standard search paths when using an SDK.\
|
||||
\f4\fs24 \cf0 Also be aware that if using the 10.4 Universal SDK, you may have to explicitly set the Framework search paths (its an option/field in the build settings for your Target) due to the way Apple modifies the standard search paths when using an SDK.\
|
||||
|
||||
\f1\fs26 \
|
||||
\pard\pardeftab720\sa200\ql\qnatural
|
||||
@@ -102,4 +111,4 @@ osgTerrain -seg1addr 0x20c40000\
|
||||
\pard\pardeftab720\sa260\ql\qnatural
|
||||
|
||||
\f1\fs26 \cf0 These values work under Xcode 2.2 with autovectorization and -O3 so in theory, there should be some leeway if you use smaller build options. However, we encountered some strangeness under Xcode 2.0/gcc 4.0 where the binaries were even larger, but using -Os. This did not happen under the OSG 0.9.9 release. But we're hopeful that under Xcode 1.5/gcc 3.3, these addresses will just work.\
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ PROJECT(OSG_APPLICATIONS)
|
||||
SET(OSGCORE_BUNDLED TRUE)
|
||||
|
||||
IF(NOT OSGCORE_BUNDLED)
|
||||
FIND_PACKAGE(OSGCORE)
|
||||
IF(OSGCORE_FOUND)
|
||||
INCLUDE(${OSGCORE_USE_FILE})
|
||||
ELSE()
|
||||
MESSAGE(ERROR "OSGCORE neeeded but NOT FOUND")
|
||||
ENDIF()
|
||||
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../Macros)
|
||||
ENDIF()
|
||||
FIND_PACKAGE(OSGCORE)
|
||||
IF(OSGCORE_FOUND)
|
||||
INCLUDE(${OSGCORE_USE_FILE})
|
||||
ELSE(OSGCORE_FOUND)
|
||||
MESSAGE(ERROR "OSGCORE neeeded but NOT FOUND")
|
||||
ENDIF(OSGCORE_FOUND)
|
||||
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../../Macros)
|
||||
ENDIF(NOT OSGCORE_BUNDLED)
|
||||
SET(OPENSCENEGRAPH_APPLICATION_DIR ${PROJECT_SOURCE_DIR})
|
||||
|
||||
|
||||
@@ -27,17 +27,19 @@ SET(TARGET_COMMON_LIBRARIES
|
||||
)
|
||||
|
||||
IF(DYNAMIC_OPENSCENEGRAPH)
|
||||
|
||||
ADD_SUBDIRECTORY(osgviewer)
|
||||
ADD_SUBDIRECTORY(osgarchive)
|
||||
ADD_SUBDIRECTORY(osgconv)
|
||||
ADD_SUBDIRECTORY(osgfilecache)
|
||||
ADD_SUBDIRECTORY(osgversion)
|
||||
ADD_SUBDIRECTORY(present3D)
|
||||
ELSE()
|
||||
|
||||
ELSE(DYNAMIC_OPENSCENEGRAPH)
|
||||
|
||||
# need to define this on win32 or linker cries about _declspecs
|
||||
ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
|
||||
|
||||
ADD_SUBDIRECTORY(osgversion)
|
||||
ADD_SUBDIRECTORY(present3D)
|
||||
ENDIF()
|
||||
|
||||
ENDIF(DYNAMIC_OPENSCENEGRAPH)
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
SET(TARGET_SRC osgarchive.cpp )
|
||||
#this file is automatically generated
|
||||
|
||||
|
||||
SET(TARGET_SRC osgarchive.cpp )
|
||||
#### end var setup ###
|
||||
SETUP_APPLICATION(osgarchive)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#this file is automatically generated
|
||||
|
||||
|
||||
SET(TARGET_SRC
|
||||
OrientationConverter.cpp
|
||||
osgconv.cpp
|
||||
@@ -6,4 +9,5 @@ SET(TARGET_H
|
||||
OrientationConverter.h
|
||||
)
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_APPLICATION(osgconv)
|
||||
|
||||
@@ -12,6 +12,7 @@ OrientationConverter::OrientationConverter( void )
|
||||
R.makeIdentity();
|
||||
T.makeIdentity();
|
||||
_trans_set = false;
|
||||
_use_world_frame = false;
|
||||
S.makeIdentity();
|
||||
}
|
||||
|
||||
@@ -36,21 +37,35 @@ void OrientationConverter::setScale( const Vec3 &scale )
|
||||
S = Matrix::scale(scale);
|
||||
}
|
||||
|
||||
void OrientationConverter::useWorldFrame( bool worldFrame )
|
||||
{
|
||||
_use_world_frame = worldFrame;
|
||||
}
|
||||
|
||||
Node* OrientationConverter::convert( Node *node )
|
||||
{
|
||||
// Order of operations here is :
|
||||
// 1. Translate to world origin (0,0,0)
|
||||
// 1. If world frame option not set, translate to world origin (0,0,0)
|
||||
// 2. Rotate to new orientation
|
||||
// 3. Scale in new orientation coordinates
|
||||
// 4. If an absolute translation was specified then
|
||||
// - translate to absolute translation in world coordinates
|
||||
// else
|
||||
// - translate back to model's original origin.
|
||||
// else if world frame option not set,
|
||||
// - translate back to model's original origin.
|
||||
BoundingSphere bs = node->getBound();
|
||||
Matrix C = Matrix::translate( -bs.center() );
|
||||
if( _trans_set == false )
|
||||
T = Matrix::translate( bs.center() );
|
||||
Matrix C;
|
||||
|
||||
if (_use_world_frame)
|
||||
{
|
||||
C.makeIdentity();
|
||||
}
|
||||
else
|
||||
{
|
||||
C = Matrix::translate( -bs.center() );
|
||||
|
||||
if( !_trans_set )
|
||||
T = Matrix::translate( bs.center() );
|
||||
}
|
||||
|
||||
osg::Group* root = new osg::Group;
|
||||
osg::MatrixTransform* transform = new osg::MatrixTransform;
|
||||
@@ -60,10 +75,8 @@ Node* OrientationConverter::convert( Node *node )
|
||||
|
||||
if (!S.isIdentity())
|
||||
{
|
||||
#if !defined(OSG_GLES2_AVAILABLE)
|
||||
// Add a normalize state. This will be removed if the FlattenStaticTransformsVisitor works
|
||||
transform->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
|
||||
#endif
|
||||
// Add a normalize state. This will be removed if the FlattenStaticTransformsVisitor works
|
||||
transform->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
|
||||
}
|
||||
|
||||
root->addChild(transform);
|
||||
|
||||
@@ -14,6 +14,7 @@ class OrientationConverter {
|
||||
void setRotation( float degrees, const osg::Vec3 &axis );
|
||||
void setTranslation( const osg::Vec3 &trans);
|
||||
void setScale( const osg::Vec3 &trans);
|
||||
void useWorldFrame( bool worldFrame );
|
||||
|
||||
/** return the root of the updated subgraph as the subgraph
|
||||
* the node passed in my flatten during optimization.*/
|
||||
@@ -25,6 +26,7 @@ class OrientationConverter {
|
||||
|
||||
osg::Matrix R, T, S;
|
||||
bool _trans_set;
|
||||
bool _use_world_frame;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -191,30 +191,6 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void write(const std::string &dir)
|
||||
{
|
||||
for(TextureSet::iterator itr=_textureSet.begin();
|
||||
itr!=_textureSet.end();
|
||||
++itr)
|
||||
{
|
||||
osg::Texture* texture = const_cast<osg::Texture*>(itr->get());
|
||||
|
||||
osg::Texture2D* texture2D = dynamic_cast<osg::Texture2D*>(texture);
|
||||
osg::Texture3D* texture3D = dynamic_cast<osg::Texture3D*>(texture);
|
||||
|
||||
osg::ref_ptr<osg::Image> image = texture2D ? texture2D->getImage() : (texture3D ? texture3D->getImage() : 0);
|
||||
if (image.valid())
|
||||
{
|
||||
std::string name = osgDB::getStrippedName(image->getFileName());
|
||||
name += ".dds";
|
||||
image->setFileName(name);
|
||||
std::string path = dir.empty() ? name : osgDB::concatPaths(dir, name);
|
||||
osgDB::writeImageFile(*image, path);
|
||||
osg::notify(osg::NOTICE) << "Image written to '" << path << "'." << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef std::set< osg::ref_ptr<osg::Texture> > TextureSet;
|
||||
TextureSet _textureSet;
|
||||
@@ -452,12 +428,14 @@ static void usage( const char *prog, const char *msg )
|
||||
osg::notify(osg::NOTICE)<<" --compressed-dxt3 - Enable the usage of S3TC DXT3 compressed textures"<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" --compressed-dxt5 - Enable the usage of S3TC DXT5 compressed textures"<< std::endl;
|
||||
osg::notify(osg::NOTICE)<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" --fix-transparency - fix stateset which are curerntly declared as transprent,"<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" but should be opaque. Defaults to using the "<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" fixTranspancyMode MAKE_OPAQUE_TEXTURE_STATESET_OPAQUE."<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" --fix-transparency-mode <mode_string> - fix stateset which are curerntly declared as"<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" transprent but should be opaque. The mode_string determines"<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" algorithm is used to fix the transparency, options are: "<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" --fix-transparency - fix statesets which are currently"<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" declared as transparent, but should be opaque."<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" Defaults to using the fixTranspancyMode"<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" MAKE_OPAQUE_TEXTURE_STATESET_OPAQUE."<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" --fix-transparency-mode <mode_string> - fix statesets which are currently"<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" declared as transparent but should be opaque."<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" The mode_string determines which algorithm is used"<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" to fix the transparency, options are:"<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" MAKE_OPAQUE_TEXTURE_STATESET_OPAQUE,"<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<" MAKE_ALL_STATESET_OPAQUE."<<std::endl;
|
||||
|
||||
@@ -481,10 +459,11 @@ static void usage( const char *prog, const char *msg )
|
||||
"\n"
|
||||
" where X1,Y1,Z1 represent the UP vector in the input\n"
|
||||
" files and X2,Y2,Z2 represent the UP vector of the\n"
|
||||
" output file, or degrees is the rotation angle in degrees\n"
|
||||
" around axis (A0,A1,A2). For example, to convert a model\n"
|
||||
" built in a Y-Up coordinate system to a model with a Z-up\n"
|
||||
" coordinate system, the argument may look like\n"
|
||||
" output file, or degrees is the rotation angle in\n"
|
||||
" degrees around axis (A0,A1,A2). For example, to\n"
|
||||
" convert a model built in a Y-Up coordinate system to a\n"
|
||||
" model with a Z-up coordinate system, the argument may\n"
|
||||
" look like\n"
|
||||
"\n"
|
||||
" 0,1,0-0,0,1"
|
||||
"\n"
|
||||
@@ -499,9 +478,14 @@ static void usage( const char *prog, const char *msg )
|
||||
" where X, Y, and Z represent the coordinates of the\n"
|
||||
" absolute position in world space\n"
|
||||
<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" --simplify n - Run simplifier on prior to output. Argument must be a" << std::endl
|
||||
<<" normalized value for the resultant percentage reduction." << std::endl
|
||||
<<" Example: --simplify .5 will produce an 50 reduced model." << std::endl
|
||||
osg::notify(osg::NOTICE)<<" --use-world-frame - Perform transformations in the world frame, rather\n"
|
||||
" than relative to the center of the bounding sphere.\n"
|
||||
<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" --simplify n - Run simplifier prior to output. Argument must be a" << std::endl
|
||||
<<" normalized value for the resultant percentage" << std::endl
|
||||
<<" reduction." << std::endl
|
||||
<<" Example: --simplify .5" << std::endl
|
||||
<<" will produce a 50% reduced model." << std::endl
|
||||
<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" -s scale - Scale size of model. Scale argument must be the \n"
|
||||
" following :\n"
|
||||
@@ -509,26 +493,26 @@ static void usage( const char *prog, const char *msg )
|
||||
" SX,SY,SZ\n"
|
||||
"\n"
|
||||
" where SX, SY, and SZ represent the scale factors\n"
|
||||
" Caution: Scaling will be done in destination orientation\n"
|
||||
" Caution: Scaling is done in destination orientation\n"
|
||||
<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" --smooth - Smooth the surface by regenerating surface normals on\n"
|
||||
" all geometry"<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" --addMissingColors - Adding a white color value to all geometry that don't have\n"
|
||||
" their own color values (--addMissingColours also accepted)."<< std::endl;
|
||||
" all geometry nodes"<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" --addMissingColors - Add a white color value to all geometry nodes\n"
|
||||
" that don't have their own color values\n"
|
||||
" (--addMissingColours also accepted)."<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" --overallNormal - Replace normals with a single overall normal."<< std::endl;
|
||||
osg::notify(osg::NOTICE)<<" --enable-object-cache - Enable caching of objects, images, etc."<< std::endl;
|
||||
|
||||
osg::notify( osg::NOTICE ) << std::endl;
|
||||
osg::notify( osg::NOTICE ) <<
|
||||
" --formats - Lists all supported formats and their supported options." << std::endl;
|
||||
" --formats - List all supported formats and their supported options." << std::endl;
|
||||
osg::notify( osg::NOTICE ) <<
|
||||
" --format <format> - Displays information about the spefied <format>, where <format>\n"
|
||||
" is the file extension, such as \"flt\"." << std::endl;
|
||||
" --format <format> - Display information about the specified <format>,\n"
|
||||
" where <format> is the file extension, such as \"flt\"." << std::endl;
|
||||
osg::notify( osg::NOTICE ) <<
|
||||
" --plugins - Lists all supported plugin files." << std::endl;
|
||||
" --plugins - List all supported plugin files." << std::endl;
|
||||
osg::notify( osg::NOTICE ) <<
|
||||
" --plugin >plugin> - Displays information about the spefied <plugin>, where <plugin>\n"
|
||||
" is the plugin's full path and file name." << std::endl;
|
||||
" --plugin <plugin> - Display information about the specified <plugin>,\n"
|
||||
" where <plugin> is the plugin's full path and file name." << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -610,6 +594,11 @@ int main( int argc, char **argv )
|
||||
OrientationConverter oc;
|
||||
bool do_convert = false;
|
||||
|
||||
if (arguments.read("--use-world-frame"))
|
||||
{
|
||||
oc.useWorldFrame(true);
|
||||
}
|
||||
|
||||
std::string str;
|
||||
while (arguments.read("-O",str))
|
||||
{
|
||||
@@ -681,7 +670,7 @@ int main( int argc, char **argv )
|
||||
if( sscanf( str.c_str(), "%f",
|
||||
&nsimp ) != 1 )
|
||||
{
|
||||
usage( argv[0], "Scale argument format incorrect." );
|
||||
usage( argv[0], "Simplify argument format incorrect." );
|
||||
return 1;
|
||||
}
|
||||
std::cout << str << " " << nsimp << std::endl;
|
||||
@@ -732,9 +721,6 @@ int main( int argc, char **argv )
|
||||
bool do_overallNormal = false;
|
||||
while(arguments.read("--overallNormal") || arguments.read("--overallNormal")) { do_overallNormal = true; }
|
||||
|
||||
bool enableObjectCache = false;
|
||||
while(arguments.read("--enable-object-cache")) { enableObjectCache = true; }
|
||||
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
@@ -753,11 +739,6 @@ int main( int argc, char **argv )
|
||||
}
|
||||
}
|
||||
|
||||
if (enableObjectCache)
|
||||
{
|
||||
if (osgDB::Registry::instance()->getOptions()==0) osgDB::Registry::instance()->setOptions(new osgDB::Options());
|
||||
osgDB::Registry::instance()->getOptions()->setObjectCacheHint(osgDB::Options::CACHE_ALL);
|
||||
}
|
||||
|
||||
std::string fileNameOut("converted.osg");
|
||||
if (fileNames.size()>1)
|
||||
@@ -814,14 +795,15 @@ int main( int argc, char **argv )
|
||||
if (internalFormatMode != osg::Texture::USE_IMAGE_DATA_FORMAT)
|
||||
{
|
||||
std::string ext = osgDB::getFileExtension(fileNameOut);
|
||||
CompressTexturesVisitor ctv(internalFormatMode);
|
||||
root->accept(ctv);
|
||||
ctv.compress();
|
||||
|
||||
osgDB::ReaderWriter::Options *options = osgDB::Registry::instance()->getOptions();
|
||||
if (ext!="ive" || (options && options->getOptionString().find("noTexturesInIVEFile")!=std::string::npos))
|
||||
if (ext=="ive")
|
||||
{
|
||||
ctv.write(osgDB::getFilePath(fileNameOut));
|
||||
CompressTexturesVisitor ctv(internalFormatMode);
|
||||
root->accept(ctv);
|
||||
ctv.compress();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout<<"Warning: compressing texture only supported when outputing to .ive"<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
|
||||
SET(TARGET_SRC osgfilecache.cpp )
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgTerrain )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_APPLICATION(osgfilecache)
|
||||
|
||||
@@ -3,7 +3,7 @@ SET(TARGET_SRC osgversion.cpp )
|
||||
IF (OSG_MAINTAINER)
|
||||
SET(TARGET_SRC ${TARGET_SRC} Contributors.cpp )
|
||||
ADD_DEFINITIONS("-DBUILD_CONTRIBUTORS")
|
||||
ENDIF()
|
||||
ENDIF(OSG_MAINTAINER)
|
||||
|
||||
SET(TARGET_COMMON_LIBRARIES
|
||||
OpenThreads
|
||||
|
||||
@@ -100,7 +100,6 @@ const char* invalidNames[] =
|
||||
"GraphicsContextImplementation",
|
||||
"GraphicsThread",
|
||||
"GraphicsWindowX11",
|
||||
"GraphicsHandleX11",
|
||||
"Group",
|
||||
"Image",
|
||||
"ImageOptions",
|
||||
@@ -169,7 +168,6 @@ const char* invalidNames[] =
|
||||
"Quake3",
|
||||
"Quicktime",
|
||||
"ReaderWriters",
|
||||
"ReaderWriterTXP",
|
||||
"ReentrantMutex",
|
||||
"Referenced",
|
||||
"ReferenceFrame",
|
||||
@@ -190,7 +188,6 @@ const char* invalidNames[] =
|
||||
"State",
|
||||
"StateAttribute",
|
||||
"Stats",
|
||||
"StateSet",
|
||||
"StatsVisitor",
|
||||
"Studio",
|
||||
"Support",
|
||||
@@ -234,11 +231,7 @@ const char* invalidNames[] =
|
||||
"Windows",
|
||||
"X",
|
||||
"Xcode",
|
||||
"GraphicsWindowWin32",
|
||||
"ImageLayer",
|
||||
"Xml",
|
||||
"Y",
|
||||
"UpdateSkeleton"
|
||||
"Y"
|
||||
};
|
||||
|
||||
|
||||
@@ -298,7 +291,6 @@ TypoCorrection typoCorrections[] =
|
||||
{"Heirtlein", "Hertlein"},
|
||||
{"Heirtlein", "Hertlein"},
|
||||
{"Hertleinm", "Hertlein"},
|
||||
{"Happalahti", "Haapalahti"},
|
||||
{"Hertlien", "Hertlein"},
|
||||
{"Hi", "He"},
|
||||
{"Hooper", "Hopper"},
|
||||
@@ -318,7 +310,6 @@ TypoCorrection typoCorrections[] =
|
||||
{"J", "Jos<EFBFBD>"},
|
||||
{"Keuhne", "Kuehne"},
|
||||
{"Kheune", "Kuehne"},
|
||||
{"Krulthof", "Kruithof"},
|
||||
{"Lagrade", "Lagarde"},
|
||||
{"Largade", "Lagarde"},
|
||||
{"Larshkari", "Lashkari"},
|
||||
@@ -328,9 +319,7 @@ TypoCorrection typoCorrections[] =
|
||||
{"Laskari", "Lashkari"},
|
||||
{"Leandowski", "Lewandowski"},
|
||||
{"Lawandowski", "Lewandowski"},
|
||||
{"Luacas", "Luaces"},
|
||||
{"Luacas", "Luaces"},
|
||||
{"Liech", "Leich"},
|
||||
{"Lucas", "Luaces"},
|
||||
{"Lugi", "Luigi"},
|
||||
{"Lweandowski", "Lewandowski"},
|
||||
{"Maceij", "Maciej"},
|
||||
@@ -357,7 +346,6 @@ TypoCorrection typoCorrections[] =
|
||||
{"Narache", "Marache"},
|
||||
{"Nicklov", "Nikolov"},
|
||||
{"Nickolov", "Nikolov"},
|
||||
{"Nilson", "Nilsson"},
|
||||
{"Olad", "Olaf"},
|
||||
{"Olar", "Olaf"},
|
||||
{"Oritz", "Ortiz"},
|
||||
@@ -369,7 +357,6 @@ TypoCorrection typoCorrections[] =
|
||||
{"Robet", "Robert"},
|
||||
{"Rodger", "Roger"},
|
||||
{"Rolad", "Roland"},
|
||||
{"Riddel", "Riddell"},
|
||||
{"Rucard", "Richard"},
|
||||
{"Sekender", "Sukender"},
|
||||
{"Sewel", "Sewell"},
|
||||
@@ -378,7 +365,6 @@ TypoCorrection typoCorrections[] =
|
||||
{"Sjolie", "Sj<EFBFBD>lie"},
|
||||
{"Sjölie", "Sj<EFBFBD>lie"},
|
||||
{"Skinnder", "Skinner"},
|
||||
{"Seberion", "Seberino"},
|
||||
{"Sokolosky", "Sokolowsky"},
|
||||
{"Sokolowky", "Sokolowsky"},
|
||||
{"Sokolowki", "Sokolowsky"},
|
||||
@@ -406,9 +392,7 @@ TypoCorrection typoCorrections[] =
|
||||
{"Wojiech", "Wojciech"},
|
||||
{"Xennon", "Hanson"},
|
||||
{"Yefrei", "Yefei"},
|
||||
{"Yfei", "Yefei"},
|
||||
{"Gurhrie", "Guthrie"},
|
||||
{"Byran", "Bryan"}
|
||||
{"Yfei", "Yefei"}
|
||||
};
|
||||
|
||||
|
||||
@@ -422,22 +406,8 @@ struct NameCorrection
|
||||
|
||||
NameCorrection nameCorrections[] =
|
||||
{
|
||||
{"Thom", "Carlo",
|
||||
"Thom", "DeCarlo"},
|
||||
{"Stephan", "Lamoliatte",
|
||||
"Stephane", "Lamoliatte"},
|
||||
{"Ronald", "van",
|
||||
"Ronald", "van Maarseveen"},
|
||||
{"Lee", "Bulter",
|
||||
"Lee", "Butler"},
|
||||
{"Tery", "Welsh",
|
||||
"Terry", "Welsh"},
|
||||
{"Cesar", "L",
|
||||
"C<EFBFBD>sar", "L. B. Silveira"},
|
||||
{"Marc", "Sciabica",
|
||||
"Mark", "Sciabica"},
|
||||
{"Tom", "Moore",
|
||||
"Tim", "Moore"},
|
||||
{"Jean", "Sebastien",
|
||||
"Jean-Sebastien", "Guay"},
|
||||
{"Michale", "Platings",
|
||||
@@ -522,8 +492,6 @@ NameCorrection nameCorrections[] =
|
||||
"Trajce", "Nikolov"},
|
||||
{"Frauciel", "Luc",
|
||||
"Luc", "Frauciel"},
|
||||
{"Alberto", "Lucas",
|
||||
"Alberto", "Luaces"},
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
SET(TARGET_SRC osgviewer.cpp )
|
||||
#this file is automatically generated
|
||||
|
||||
|
||||
SET(TARGET_SRC osgviewer.cpp )
|
||||
#### end var setup ###
|
||||
SETUP_APPLICATION(osgviewer)
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <osgGA/StateSetManipulator>
|
||||
#include <osgGA/AnimationPathManipulator>
|
||||
#include <osgGA/TerrainManipulator>
|
||||
#include <osgGA/SphericalManipulator>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -50,14 +49,14 @@ int main(int argc, char** argv)
|
||||
arguments.getApplicationUsage()->write(std::cout, helpType);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (arguments.argc()<=1)
|
||||
{
|
||||
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
||||
@@ -85,10 +84,9 @@ int main(int argc, char** argv)
|
||||
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
|
||||
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
|
||||
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
|
||||
keyswitchManipulator->addMatrixManipulator( '5', "Spherical", new osgGA::SphericalManipulator() );
|
||||
|
||||
std::string pathfile;
|
||||
char keyForAnimationPath = '6';
|
||||
char keyForAnimationPath = '5';
|
||||
while (arguments.read("-p",pathfile))
|
||||
{
|
||||
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||
@@ -106,13 +104,13 @@ int main(int argc, char** argv)
|
||||
|
||||
// add the state manipulator
|
||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||
|
||||
|
||||
// add the thread model handler
|
||||
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
||||
|
||||
// add the window size toggle handler
|
||||
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
||||
|
||||
|
||||
// add the stats handler
|
||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
SET(TARGET_SRC
|
||||
Cluster.cpp
|
||||
ExportHTML.cpp
|
||||
PointsEventHandler.cpp
|
||||
present3D.cpp
|
||||
ReadShowFile.cpp
|
||||
ShowEventHandler.cpp
|
||||
)
|
||||
|
||||
SET(TARGET_H
|
||||
Cluster.h
|
||||
ExportHTML.h
|
||||
PointsEventHandler.h
|
||||
ReadShowFile.h
|
||||
ShowEventHandler.h
|
||||
)
|
||||
|
||||
IF (SDL_FOUND)
|
||||
|
||||
OPTION(BUILD_PRESENT3D_WITH_SDL "Set to ON to build Present3D with SDL for joystick support." OFF)
|
||||
|
||||
IF (BUILD_PRESENT3D_WITH_SDL)
|
||||
|
||||
SET(TARGET_EXTERNAL_LIBRARIES ${SDL_LIBRARY} )
|
||||
INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR} )
|
||||
|
||||
SET(TARGET_SRC
|
||||
${TARGET_SRC}
|
||||
SDLIntegration.cpp
|
||||
)
|
||||
|
||||
SET(TARGET_H
|
||||
${TARGET_H}
|
||||
SDLIntegration.h
|
||||
)
|
||||
|
||||
ADD_DEFINITIONS(-DUSE_SDL)
|
||||
|
||||
ENDIF()
|
||||
|
||||
ENDIF()
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgVolume osgFX osgPresentation)
|
||||
|
||||
IF (NOT DYNAMIC_OPENSCENEGRAPH)
|
||||
SET(TARGET_ADDED_LIBRARIES
|
||||
${TARGET_ADDED_LIBRARIES}
|
||||
osgdb_ive
|
||||
osgdb_osg
|
||||
osgdb_p3d
|
||||
|
||||
osgdb_freetype
|
||||
osgdb_pdf
|
||||
osgdb_rgb
|
||||
osgdb_jpeg
|
||||
osgdb_png
|
||||
|
||||
osgdb_ffmpeg
|
||||
|
||||
osgdb_openflight
|
||||
osgdb_obj
|
||||
|
||||
osgdb_curl
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
IF (WIN32)
|
||||
# to support cluster code
|
||||
SET(TARGET_EXTERNAL_LIBRARIES ${TARGET_EXTERNAL_LIBRARIES} ws2_32)
|
||||
ENDIF()
|
||||
|
||||
|
||||
SETUP_APPLICATION(present3D)
|
||||
@@ -1,523 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include "Cluster.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if !defined (WIN32) || defined(__CYGWIN__)
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/time.h>
|
||||
#include <net/if.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__linux)
|
||||
#include <unistd.h>
|
||||
#include <linux/sockios.h>
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <unistd.h>
|
||||
#include <sys/sockio.h>
|
||||
#elif defined(__sgi)
|
||||
#include <unistd.h>
|
||||
#include <net/soioctl.h>
|
||||
#elif defined(__CYGWIN__)
|
||||
#include <unistd.h>
|
||||
#elif defined(__sun)
|
||||
#include <unistd.h>
|
||||
#include <sys/sockio.h>
|
||||
#elif defined (__APPLE__)
|
||||
#include <unistd.h>
|
||||
#include <sys/sockio.h>
|
||||
#elif defined (WIN32)
|
||||
#include <winsock.h>
|
||||
#include <stdio.h>
|
||||
#elif defined (__hpux)
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#error Teach me how to build on this system
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
#include <osg/io_utils>
|
||||
#include <iostream>
|
||||
|
||||
const unsigned int CameraPacket::MAX_NUM_EVENTS = 10;
|
||||
const unsigned int CameraPacket::SWAP_BYTES_COMPARE = 0x12345678;
|
||||
|
||||
void DataConverter::write(const osg::FrameStamp& fs)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"writeFramestamp = "<<fs.getFrameNumber()<<" "<<fs.getReferenceTime()<<std::endl;
|
||||
|
||||
writeUInt(fs.getFrameNumber());
|
||||
writeDouble(fs.getReferenceTime());
|
||||
}
|
||||
|
||||
void DataConverter::read(osg::FrameStamp& fs)
|
||||
{
|
||||
fs.setFrameNumber(readUInt());
|
||||
fs.setReferenceTime(readDouble());
|
||||
|
||||
osg::notify(osg::NOTICE)<<"readFramestamp = "<<fs.getFrameNumber()<<" "<<fs.getReferenceTime()<<std::endl;
|
||||
}
|
||||
|
||||
void DataConverter::write(const osg::Matrix& matrix)
|
||||
{
|
||||
writeDouble(matrix(0,0));
|
||||
writeDouble(matrix(0,1));
|
||||
writeDouble(matrix(0,2));
|
||||
writeDouble(matrix(0,3));
|
||||
|
||||
writeDouble(matrix(1,0));
|
||||
writeDouble(matrix(1,1));
|
||||
writeDouble(matrix(1,2));
|
||||
writeDouble(matrix(1,3));
|
||||
|
||||
writeDouble(matrix(2,0));
|
||||
writeDouble(matrix(2,1));
|
||||
writeDouble(matrix(2,2));
|
||||
writeDouble(matrix(2,3));
|
||||
|
||||
writeDouble(matrix(3,0));
|
||||
writeDouble(matrix(3,1));
|
||||
writeDouble(matrix(3,2));
|
||||
writeDouble(matrix(3,3));
|
||||
|
||||
osg::notify(osg::NOTICE)<<"writeMatrix = "<<matrix<<std::endl;
|
||||
|
||||
}
|
||||
|
||||
void DataConverter::read(osg::Matrix& matrix)
|
||||
{
|
||||
matrix(0,0) = readDouble();
|
||||
matrix(0,1) = readDouble();
|
||||
matrix(0,2) = readDouble();
|
||||
matrix(0,3) = readDouble();
|
||||
|
||||
matrix(1,0) = readDouble();
|
||||
matrix(1,1) = readDouble();
|
||||
matrix(1,2) = readDouble();
|
||||
matrix(1,3) = readDouble();
|
||||
|
||||
matrix(2,0) = readDouble();
|
||||
matrix(2,1) = readDouble();
|
||||
matrix(2,2) = readDouble();
|
||||
matrix(2,3) = readDouble();
|
||||
|
||||
matrix(3,0) = readDouble();
|
||||
matrix(3,1) = readDouble();
|
||||
matrix(3,2) = readDouble();
|
||||
matrix(3,3) = readDouble();
|
||||
|
||||
osg::notify(osg::NOTICE)<<"readMatrix = "<<matrix<<std::endl;
|
||||
|
||||
}
|
||||
|
||||
void DataConverter::write(const osgGA::GUIEventAdapter& event)
|
||||
{
|
||||
writeUInt(event.getEventType());
|
||||
writeUInt(event.getKey());
|
||||
writeUInt(event.getButton());
|
||||
writeInt(event.getWindowX());
|
||||
writeInt(event.getWindowY());
|
||||
writeUInt(event.getWindowWidth());
|
||||
writeUInt(event.getWindowHeight());
|
||||
writeFloat(event.getXmin());
|
||||
writeFloat(event.getYmin());
|
||||
writeFloat(event.getXmax());
|
||||
writeFloat(event.getYmax());
|
||||
writeFloat(event.getX());
|
||||
writeFloat(event.getY());
|
||||
writeUInt(event.getButtonMask());
|
||||
writeUInt(event.getModKeyMask());
|
||||
writeDouble(event.getTime());
|
||||
}
|
||||
|
||||
void DataConverter::read(osgGA::GUIEventAdapter& event)
|
||||
{
|
||||
event.setEventType((osgGA::GUIEventAdapter::EventType)readUInt());
|
||||
event.setKey(readUInt());
|
||||
event.setButton(readUInt());
|
||||
int x = readInt();
|
||||
int y = readInt();
|
||||
int width = readUInt();
|
||||
int height = readUInt();
|
||||
event.setWindowRectangle(x,y,width,height);
|
||||
float xmin = readFloat();
|
||||
float ymin = readFloat();
|
||||
float xmax = readFloat();
|
||||
float ymax = readFloat();
|
||||
event.setInputRange(xmin,ymin,xmax,ymax);
|
||||
event.setX(readFloat());
|
||||
event.setY(readFloat());
|
||||
event.setButtonMask(readUInt());
|
||||
event.setModKeyMask(readUInt());
|
||||
event.setTime(readDouble());
|
||||
}
|
||||
|
||||
void DataConverter::write(CameraPacket& cameraPacket)
|
||||
{
|
||||
writeUInt(cameraPacket._byte_order);
|
||||
|
||||
writeUInt(cameraPacket._masterKilled);
|
||||
|
||||
write(cameraPacket._matrix);
|
||||
write(cameraPacket._frameStamp);
|
||||
|
||||
writeUInt(cameraPacket._events.size());
|
||||
for(osgGA::EventQueue::Events::iterator itr = cameraPacket._events.begin();
|
||||
itr != cameraPacket._events.end();
|
||||
++itr)
|
||||
{
|
||||
write(*(*itr));
|
||||
}
|
||||
}
|
||||
|
||||
void DataConverter::read(CameraPacket& cameraPacket)
|
||||
{
|
||||
cameraPacket._byte_order = readUInt();
|
||||
if (cameraPacket._byte_order != CameraPacket::SWAP_BYTES_COMPARE)
|
||||
{
|
||||
_swapBytes = !_swapBytes;
|
||||
}
|
||||
|
||||
cameraPacket._masterKilled = readUInt()!=0;
|
||||
|
||||
read(cameraPacket._matrix);
|
||||
read(cameraPacket._frameStamp);
|
||||
|
||||
cameraPacket._events.clear();
|
||||
unsigned int numEvents = readUInt();
|
||||
for(unsigned int i=0;i<numEvents;++i)
|
||||
{
|
||||
osgGA::GUIEventAdapter* event = new osgGA::GUIEventAdapter;
|
||||
read(*(event));
|
||||
cameraPacket._events.push_back(event);
|
||||
}
|
||||
}
|
||||
|
||||
void CameraPacket::readEventQueue(osgViewer::Viewer& viewer)
|
||||
{
|
||||
_events.clear();
|
||||
|
||||
viewer.getEventQueue()->copyEvents(_events);
|
||||
|
||||
osg::notify(osg::INFO)<<"written events = "<<_events.size()<<std::endl;
|
||||
}
|
||||
|
||||
void CameraPacket::writeEventQueue(osgViewer::Viewer& viewer)
|
||||
{
|
||||
osg::notify(osg::INFO)<<"recieved events = "<<_events.size()<<std::endl;
|
||||
|
||||
// copy the events to osgProducer style events.
|
||||
viewer.getEventQueue()->appendEvents(_events);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Reciever
|
||||
//
|
||||
Receiver::Receiver( void )
|
||||
{
|
||||
_port = 0;
|
||||
_initialized = false;
|
||||
_buffer = 0L;
|
||||
}
|
||||
|
||||
Receiver::~Receiver( void )
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
closesocket( _so);
|
||||
#else
|
||||
close( _so );
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Receiver::init( void )
|
||||
{
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
WORD version = MAKEWORD(1,1);
|
||||
WSADATA wsaData;
|
||||
// First, we start up Winsock
|
||||
WSAStartup(version, &wsaData);
|
||||
#endif
|
||||
|
||||
if( _port == 0 )
|
||||
{
|
||||
fprintf( stderr, "Receiver::init() - port not defined\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( (_so = socket( AF_INET, SOCK_DGRAM, 0 )) < 0 )
|
||||
{
|
||||
perror( "Socket" );
|
||||
return false;
|
||||
}
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
// const BOOL on = TRUE;
|
||||
// setsockopt( _so, SOL_SOCKET, SO_REUSEADDR, (const char*) &on, sizeof(int));
|
||||
#else
|
||||
int on = 1;
|
||||
setsockopt( _so, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
|
||||
#endif
|
||||
|
||||
// struct sockaddr_in saddr;
|
||||
saddr.sin_family = AF_INET;
|
||||
saddr.sin_port = htons( _port );
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
saddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
#else
|
||||
saddr.sin_addr.s_addr = 0;
|
||||
#endif
|
||||
|
||||
if( bind( _so, (struct sockaddr *)&saddr, sizeof( saddr )) < 0 )
|
||||
{
|
||||
perror( "bind" );
|
||||
return false;
|
||||
}
|
||||
|
||||
_initialized = true;
|
||||
return _initialized;
|
||||
}
|
||||
|
||||
|
||||
void Receiver::setPort( const short port )
|
||||
{
|
||||
_port = port;
|
||||
}
|
||||
|
||||
void Receiver::setBuffer( void *buffer, const unsigned int size )
|
||||
{
|
||||
_buffer = buffer;
|
||||
_buffer_size = size;
|
||||
}
|
||||
|
||||
void Receiver::sync( void )
|
||||
{
|
||||
if(!_initialized) init();
|
||||
|
||||
if( _buffer == 0L )
|
||||
{
|
||||
fprintf( stderr, "Receiver::sync() - No buffer\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ )
|
||||
socklen_t
|
||||
#else
|
||||
int
|
||||
#endif
|
||||
size = sizeof( struct sockaddr_in );
|
||||
|
||||
fd_set fdset;
|
||||
FD_ZERO( &fdset );
|
||||
FD_SET( _so, &fdset );
|
||||
|
||||
struct timeval tv;
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
// saddr.sin_port = htons( _port );
|
||||
recvfrom( _so, (char *)_buffer, _buffer_size, 0, (sockaddr*)&saddr, &size );
|
||||
// recvfrom(sock_Receive, szMessage, 256, 0, (sockaddr*)&addr_Cli, &clilen)
|
||||
//int err = WSAGetLastError ();
|
||||
//int *dum = (int*) _buffer;
|
||||
|
||||
while( select( _so+1, &fdset, 0L, 0L, &tv ) )
|
||||
{
|
||||
if( FD_ISSET( _so, &fdset ) )
|
||||
{
|
||||
recvfrom( _so, (char *)_buffer, _buffer_size, 0, (sockaddr*)&saddr, &size );
|
||||
}
|
||||
}
|
||||
#else
|
||||
recvfrom( _so, (caddr_t)_buffer, _buffer_size, 0, 0, &size );
|
||||
while( select( _so+1, &fdset, 0L, 0L, &tv ) )
|
||||
{
|
||||
if( FD_ISSET( _so, &fdset ) )
|
||||
{
|
||||
recvfrom( _so, (caddr_t)_buffer, _buffer_size, 0, 0, &size );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Broadcaster
|
||||
//
|
||||
Broadcaster::Broadcaster( void )
|
||||
{
|
||||
_port = 0;
|
||||
_initialized = false;
|
||||
_buffer = 0L;
|
||||
_address = 0;
|
||||
}
|
||||
|
||||
Broadcaster::~Broadcaster( void )
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
closesocket( _so);
|
||||
#else
|
||||
close( _so );
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Broadcaster::init( void )
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
WORD version = MAKEWORD(1,1);
|
||||
WSADATA wsaData;
|
||||
// First, we start up Winsock
|
||||
WSAStartup(version, &wsaData);
|
||||
#endif
|
||||
|
||||
if( _port == 0 )
|
||||
{
|
||||
fprintf( stderr, "Broadcaster::init() - port not defined\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( (_so = socket( AF_INET, SOCK_DGRAM, 0 )) < 0 )
|
||||
{
|
||||
perror( "Socket" );
|
||||
return false;
|
||||
}
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
const BOOL on = TRUE;
|
||||
#else
|
||||
int on = 1;
|
||||
#endif
|
||||
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
setsockopt( _so, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, sizeof(int));
|
||||
#else
|
||||
setsockopt( _so, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
|
||||
#endif
|
||||
|
||||
saddr.sin_family = AF_INET;
|
||||
saddr.sin_port = htons( _port );
|
||||
if( _address == 0 )
|
||||
{
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
setsockopt( _so, SOL_SOCKET, SO_BROADCAST, (const char *) &on, sizeof(int));
|
||||
#else
|
||||
setsockopt( _so, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
|
||||
#endif
|
||||
|
||||
#if !defined (WIN32) || defined(__CYGWIN__)
|
||||
struct ifreq ifr;
|
||||
#endif
|
||||
#if defined (__linux) || defined(__CYGWIN__)
|
||||
strcpy( ifr.ifr_name, "eth0" );
|
||||
#elif defined(__sun)
|
||||
strcpy( ifr.ifr_name, "hme0" );
|
||||
#elif !defined (WIN32)
|
||||
strcpy( ifr.ifr_name, "ef0" );
|
||||
#endif
|
||||
#if defined (WIN32) // get the server address
|
||||
saddr.sin_addr.s_addr = htonl(INADDR_BROADCAST);
|
||||
}
|
||||
#else
|
||||
if( (ioctl( _so, SIOCGIFBRDADDR, &ifr)) < 0 )
|
||||
{
|
||||
perror( "Broadcaster::init() Cannot get Broadcast Address" );
|
||||
return false;
|
||||
}
|
||||
saddr.sin_addr.s_addr = (((sockaddr_in *)&ifr.ifr_broadaddr)->sin_addr.s_addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
saddr.sin_addr.s_addr = _address;
|
||||
}
|
||||
#endif
|
||||
#define _VERBOSE 1
|
||||
#ifdef _VERBOSE
|
||||
unsigned char *ptr = (unsigned char *)&saddr.sin_addr.s_addr;
|
||||
printf( "Broadcast address : %u.%u.%u.%u\n", ptr[0], ptr[1], ptr[2], ptr[3] );
|
||||
#endif
|
||||
|
||||
_initialized = true;
|
||||
return _initialized;
|
||||
}
|
||||
|
||||
void Broadcaster::setHost( const char *hostname )
|
||||
{
|
||||
struct hostent *h;
|
||||
if( (h = gethostbyname( hostname )) == 0L )
|
||||
{
|
||||
fprintf( stderr, "Broadcaster::setHost() - Cannot resolv an address for \"%s\".\n", hostname );
|
||||
_address = 0;
|
||||
}
|
||||
else
|
||||
_address = *(( unsigned long *)h->h_addr);
|
||||
}
|
||||
|
||||
void Broadcaster::setPort( const short port )
|
||||
{
|
||||
_port = port;
|
||||
}
|
||||
|
||||
void Broadcaster::setBuffer( void *buffer, const unsigned int size )
|
||||
{
|
||||
_buffer = buffer;
|
||||
_buffer_size = size;
|
||||
}
|
||||
|
||||
void Broadcaster::sync( void )
|
||||
{
|
||||
if(!_initialized) init();
|
||||
|
||||
if( _buffer == 0L )
|
||||
{
|
||||
fprintf( stderr, "Broadcaster::sync() - No buffer\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
unsigned int size = sizeof( SOCKADDR_IN );
|
||||
sendto( _so, (const char *)_buffer, _buffer_size, 0, (struct sockaddr *)&saddr, size );
|
||||
// int err = WSAGetLastError ();
|
||||
// int *dum = (int*) _buffer;
|
||||
#else
|
||||
unsigned int size = sizeof( struct sockaddr_in );
|
||||
sendto( _so, (const void *)_buffer, _buffer_size, 0, (struct sockaddr *)&saddr, size );
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -1,334 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#ifndef CLUSTER_H
|
||||
#define CLUSTER_H
|
||||
|
||||
#include <osg/Matrix>
|
||||
#include <osg/FrameStamp>
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
#if !defined(WIN32) || defined(__CYGWIN__)
|
||||
#include <netinet/in.h>
|
||||
#else
|
||||
#include "winsock.h"
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Receiver.h
|
||||
//
|
||||
// Class definition for the recipient of a broadcasted message
|
||||
//
|
||||
class Receiver
|
||||
{
|
||||
public :
|
||||
|
||||
Receiver();
|
||||
~Receiver();
|
||||
|
||||
// setBuffer defines the buffer into which the broadcasted
|
||||
// message will be received.
|
||||
void setBuffer( void *buffer, const unsigned int size );
|
||||
|
||||
// Define what port to listen and bind to
|
||||
void setPort( const short port );
|
||||
|
||||
// Sync does a blocking wait to recieve next message
|
||||
void sync( void );
|
||||
|
||||
private :
|
||||
bool init( void );
|
||||
|
||||
private :
|
||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||
SOCKET _so;
|
||||
SOCKADDR_IN saddr;
|
||||
#else
|
||||
int _so;
|
||||
struct sockaddr_in saddr;
|
||||
#endif
|
||||
bool _initialized;
|
||||
short _port;
|
||||
void *_buffer;
|
||||
unsigned int _buffer_size;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Broadcaster.h
|
||||
//
|
||||
// Class definition for broadcasting a buffer to a LAN
|
||||
//
|
||||
class Broadcaster
|
||||
{
|
||||
public :
|
||||
|
||||
Broadcaster( void );
|
||||
~Broadcaster( void );
|
||||
|
||||
// Set the broadcast port
|
||||
void setPort( const short port );
|
||||
|
||||
// Set the buffer to be broadcast
|
||||
void setBuffer( void *buffer, const unsigned int buffer_size );
|
||||
|
||||
// Set a recipient host. If this is used, the Broadcaster
|
||||
// no longer broadcasts, but rather directs UDP packets at
|
||||
// host.
|
||||
void setHost( const char *hostname );
|
||||
|
||||
// Sync broadcasts the buffer
|
||||
void sync( void );
|
||||
|
||||
private :
|
||||
bool init( void );
|
||||
|
||||
private :
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
SOCKET _so;
|
||||
#else
|
||||
int _so;
|
||||
#endif
|
||||
bool _initialized;
|
||||
short _port;
|
||||
void *_buffer;
|
||||
unsigned int _buffer_size;
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
SOCKADDR_IN saddr;
|
||||
#else
|
||||
struct sockaddr_in saddr;
|
||||
#endif
|
||||
unsigned long _address;
|
||||
};
|
||||
|
||||
class CameraPacket {
|
||||
public:
|
||||
|
||||
static const unsigned int MAX_NUM_EVENTS;
|
||||
static const unsigned int SWAP_BYTES_COMPARE;
|
||||
|
||||
CameraPacket():_masterKilled(false)
|
||||
{
|
||||
_byte_order = SWAP_BYTES_COMPARE;
|
||||
}
|
||||
|
||||
void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp)
|
||||
{
|
||||
_matrix = matrix;
|
||||
if (frameStamp)
|
||||
{
|
||||
_frameStamp = *frameStamp;
|
||||
}
|
||||
}
|
||||
|
||||
void getModelView(osg::Matrix& matrix,float angle_offset=0.0f)
|
||||
{
|
||||
|
||||
matrix = _matrix * osg::Matrix::rotate(osg::DegreesToRadians(angle_offset),0.0f,1.0f,0.0f);
|
||||
}
|
||||
|
||||
void readEventQueue(osgViewer::Viewer& viewer);
|
||||
|
||||
void writeEventQueue(osgViewer::Viewer& viewer);
|
||||
|
||||
void setMasterKilled(const bool flag) { _masterKilled = flag; }
|
||||
const bool getMasterKilled() const { return _masterKilled; }
|
||||
|
||||
unsigned int _byte_order;
|
||||
bool _masterKilled;
|
||||
osg::Matrix _matrix;
|
||||
|
||||
// note don't use a ref_ptr as used elsewhere for FrameStamp
|
||||
// since we don't want to copy the pointer - but the memory.
|
||||
// FrameStamp doesn't have a private destructor to allow
|
||||
// us to do this, even though its a reference counted object.
|
||||
osg::FrameStamp _frameStamp;
|
||||
|
||||
osgGA::EventQueue::Events _events;
|
||||
|
||||
};
|
||||
|
||||
class DataConverter
|
||||
{
|
||||
public:
|
||||
|
||||
DataConverter(unsigned int numBytes):
|
||||
_startPtr(0),
|
||||
_endPtr(0),
|
||||
_swapBytes(false),
|
||||
_currentPtr(0)
|
||||
{
|
||||
_currentPtr = _startPtr = new char[numBytes];
|
||||
_endPtr = _startPtr+numBytes;
|
||||
_numBytes = numBytes;
|
||||
}
|
||||
|
||||
char* _startPtr;
|
||||
char* _endPtr;
|
||||
unsigned int _numBytes;
|
||||
bool _swapBytes;
|
||||
|
||||
char* _currentPtr;
|
||||
|
||||
void reset()
|
||||
{
|
||||
_currentPtr = _startPtr;
|
||||
}
|
||||
|
||||
inline void write1(char* ptr)
|
||||
{
|
||||
if (_currentPtr+1>=_endPtr) return;
|
||||
|
||||
*(_currentPtr++) = *(ptr);
|
||||
}
|
||||
|
||||
inline void read1(char* ptr)
|
||||
{
|
||||
if (_currentPtr+1>=_endPtr) return;
|
||||
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
|
||||
inline void write2(char* ptr)
|
||||
{
|
||||
if (_currentPtr+2>=_endPtr) return;
|
||||
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr);
|
||||
}
|
||||
|
||||
inline void read2(char* ptr)
|
||||
{
|
||||
if (_currentPtr+2>=_endPtr) return;
|
||||
|
||||
if (_swapBytes)
|
||||
{
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
else
|
||||
{
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
}
|
||||
|
||||
inline void write4(char* ptr)
|
||||
{
|
||||
if (_currentPtr+4>=_endPtr) return;
|
||||
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr);
|
||||
}
|
||||
|
||||
inline void read4(char* ptr)
|
||||
{
|
||||
if (_currentPtr+4>=_endPtr) return;
|
||||
|
||||
if (_swapBytes)
|
||||
{
|
||||
*(ptr+3) = *(_currentPtr++);
|
||||
*(ptr+2) = *(_currentPtr++);
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
else
|
||||
{
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
}
|
||||
|
||||
inline void write8(char* ptr)
|
||||
{
|
||||
if (_currentPtr+8>=_endPtr) return;
|
||||
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr++);
|
||||
*(_currentPtr++) = *(ptr);
|
||||
}
|
||||
|
||||
inline void read8(char* ptr)
|
||||
{
|
||||
char* endPtr = _currentPtr+8;
|
||||
if (endPtr>=_endPtr) return;
|
||||
|
||||
if (_swapBytes)
|
||||
{
|
||||
*(ptr+7) = *(_currentPtr++);
|
||||
*(ptr+6) = *(_currentPtr++);
|
||||
*(ptr+5) = *(_currentPtr++);
|
||||
*(ptr+4) = *(_currentPtr++);
|
||||
|
||||
*(ptr+3) = *(_currentPtr++);
|
||||
*(ptr+2) = *(_currentPtr++);
|
||||
*(ptr+1) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
else
|
||||
{
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr++) = *(_currentPtr++);
|
||||
*(ptr) = *(_currentPtr++);
|
||||
}
|
||||
}
|
||||
|
||||
inline void writeChar(char c) { write1(&c); }
|
||||
inline void writeUChar(unsigned char c) { write1((char*)&c); }
|
||||
inline void writeShort(short c) { write2((char*)&c); }
|
||||
inline void writeUShort(unsigned short c) { write2((char*)&c); }
|
||||
inline void writeInt(int c) { write4((char*)&c); }
|
||||
inline void writeUInt(unsigned int c) { write4((char*)&c); }
|
||||
inline void writeFloat(float c) { write4((char*)&c); }
|
||||
inline void writeDouble(double c) { write8((char*)&c); }
|
||||
|
||||
inline char readChar() { char c; read1(&c); return c; }
|
||||
inline unsigned char readUChar() { unsigned char c; read1((char*)&c); return c; }
|
||||
inline short readShort() { short c; read2((char*)&c); return c; }
|
||||
inline unsigned short readUShort() { unsigned short c; read2((char*)&c); return c; }
|
||||
inline int readInt() { int c; read4((char*)&c); return c; }
|
||||
inline unsigned int readUInt() { unsigned int c; read4((char*)&c); return c; }
|
||||
inline float readFloat() { float c; read4((char*)&c); return c; }
|
||||
inline double readDouble() { double c; read8((char*)&c); return c; }
|
||||
|
||||
void write(const osg::FrameStamp& fs);
|
||||
void read(osg::FrameStamp& fs);
|
||||
|
||||
void write(const osg::Matrix& matrix);
|
||||
void read(osg::Matrix& matrix);
|
||||
|
||||
void write(const osgGA::GUIEventAdapter& event);
|
||||
void read(osgGA::GUIEventAdapter& event);
|
||||
|
||||
void write(CameraPacket& cameraPacket);
|
||||
void read(CameraPacket& cameraPacket);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,188 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include "ExportHTML.h"
|
||||
#include <osgDB/FileNameUtils>
|
||||
#include <osgDB/WriteFile>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
template<typename A, typename B, typename C>
|
||||
std::string createString(const A& a, const B& b, const C& c)
|
||||
{
|
||||
std::ostringstream hos;
|
||||
hos << a << b << c;
|
||||
return hos.str();
|
||||
}
|
||||
|
||||
template<typename A, typename B, typename C, typename D>
|
||||
std::string createString(const A& a, const B& b, const C& c, const D& d)
|
||||
{
|
||||
std::ostringstream hos;
|
||||
hos << a << b << c << d;
|
||||
return hos.str();
|
||||
}
|
||||
|
||||
class SnapImageDrawCallback : public osg::Camera::DrawCallback
|
||||
{
|
||||
public:
|
||||
|
||||
SnapImageDrawCallback():
|
||||
_snapImageOnNextFrame(false)
|
||||
{
|
||||
}
|
||||
|
||||
void setFileName(const std::string& filename) { _filename = filename; }
|
||||
const std::string& getFileName() const { return _filename; }
|
||||
|
||||
void setSnapImageOnNextFrame(bool flag) { _snapImageOnNextFrame = flag; }
|
||||
bool getSnapImageOnNextFrame() const { return _snapImageOnNextFrame; }
|
||||
|
||||
virtual void operator () (const osg::Camera& camera) const
|
||||
{
|
||||
if (!_snapImageOnNextFrame) return;
|
||||
|
||||
int x = static_cast<int>(camera.getViewport()->x());
|
||||
int y = static_cast<int>(camera.getViewport()->y());
|
||||
unsigned int width = static_cast<unsigned int>(camera.getViewport()->width());
|
||||
unsigned int height = static_cast<unsigned int>(camera.getViewport()->height());
|
||||
|
||||
osg::ref_ptr<osg::Image> image = new osg::Image;
|
||||
image->readPixels(x,y,width,height,
|
||||
GL_RGB,GL_UNSIGNED_BYTE);
|
||||
|
||||
if (osgDB::writeImageFile(*image,_filename))
|
||||
{
|
||||
osg::notify(osg::NOTICE) << "Saved screen image to `"<<_filename<<"`"<< std::endl;
|
||||
}
|
||||
|
||||
_snapImageOnNextFrame = false;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
std::string _filename;
|
||||
mutable bool _snapImageOnNextFrame;
|
||||
|
||||
|
||||
};
|
||||
|
||||
std::string ExportHTML::createFileName(const std::string& basename, unsigned int page, const std::string& ext)
|
||||
{
|
||||
if (page==0) return basename+ext;
|
||||
else return createString(basename,'_', page, ext);
|
||||
}
|
||||
|
||||
bool ExportHTML::write(osgPresentation::SlideEventHandler* seh, osgViewer::Viewer& viewer, const std::string& filename)
|
||||
{
|
||||
std::string image_basename;
|
||||
std::string image_ext;
|
||||
std::string html_basename;
|
||||
std::string html_ext;
|
||||
|
||||
std::string ext = osgDB::getFileExtension(filename);
|
||||
if (ext=="html" || ext=="htm")
|
||||
{
|
||||
image_basename = osgDB::getNameLessExtension(filename);
|
||||
image_ext = ".jpg";
|
||||
html_basename = osgDB::getNameLessExtension(filename);
|
||||
html_ext = std::string(".")+ext;
|
||||
}
|
||||
else
|
||||
{
|
||||
image_basename = osgDB::getNameLessExtension(filename);
|
||||
image_ext = ".jpg";
|
||||
}
|
||||
|
||||
std::cout<<"Writing slides to "<<image_basename<<"_[slidenumber]"<<image_ext<<std::endl;
|
||||
|
||||
osg::ref_ptr<SnapImageDrawCallback> sidc = new SnapImageDrawCallback;
|
||||
|
||||
osgViewer::Viewer::Cameras cameras;
|
||||
viewer.getCameras(cameras);
|
||||
|
||||
for(osgViewer::Viewer::Cameras::iterator itr = cameras.begin();
|
||||
itr != cameras.end();
|
||||
++itr)
|
||||
{
|
||||
(*itr)->setPostDrawCallback(sidc.get());
|
||||
}
|
||||
|
||||
std::string home_file = createFileName(html_basename, 0, html_ext);
|
||||
|
||||
unsigned int i;
|
||||
for(i=0; i<seh->getNumSlides(); ++i)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << image_basename <<"_"<<i<<image_ext;
|
||||
|
||||
sidc->setFileName(os.str());
|
||||
sidc->setSnapImageOnNextFrame(true);
|
||||
|
||||
if (!html_basename.empty())
|
||||
{
|
||||
std::string htmlFileName = createFileName(html_basename, i, html_ext);
|
||||
|
||||
std::ofstream fout(htmlFileName.c_str());
|
||||
if (fout)
|
||||
{
|
||||
std::string previous_file = i>0 ? createFileName(html_basename,i-1,html_ext) : "";
|
||||
std::string next_file = i<seh->getNumSlides()-1 ? createFileName(html_basename,i+1,html_ext) : "";
|
||||
|
||||
std::cout<<"Writing html slides "<<htmlFileName<<std::endl;
|
||||
|
||||
fout<<"<html>"<<std::endl;
|
||||
fout<<"<table width=\"100%\">"<<std::endl;
|
||||
fout<<"<tr>"<<std::endl;
|
||||
if (!previous_file.empty())
|
||||
{
|
||||
fout<<"<td align=\"left\" width=\"33%\"><a href=\""<<osgDB::getSimpleFileName(previous_file)<<"\"> Previous </a></td>"<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
fout<<"<td align=\"left\" width=\"33%\"></td>"<<std::endl;
|
||||
}
|
||||
if (i != 0)
|
||||
{
|
||||
fout<<"<td align=\"center\" width=\"33%\"><a href=\""<<osgDB::getSimpleFileName(home_file)<<"\"> Home </a></td>"<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
fout<<"<td align=\"center\" width=\"33%\"></td>"<<std::endl;
|
||||
}
|
||||
if (!next_file.empty())
|
||||
{
|
||||
fout<<"<td align=\"right\" width=\"33%\"><a href=\""<<osgDB::getSimpleFileName(next_file)<<"\"> Next </a></td>"<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
fout<<"<td align=\"right\" width=\"33%\"></td>"<<std::endl;
|
||||
}
|
||||
fout<<"</tr>"<<std::endl;
|
||||
fout<<"</table>"<<std::endl;
|
||||
fout<<"<img src=\""<<osgDB::getSimpleFileName(os.str())<<"\">"<<std::endl;
|
||||
fout<<"</html>"<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout<<"Could not open '"<<filename<<"' for writing."<<std::endl;
|
||||
}
|
||||
}
|
||||
// wait for all cull and draw threads to complete.
|
||||
|
||||
seh->selectSlide(i, osgPresentation::SlideEventHandler::LAST_POSITION);
|
||||
|
||||
// fire off the cull and draw traversals of the scene.
|
||||
viewer.frame();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#ifndef EXPORTHTML_H
|
||||
#define EXPORTHTML_H 1
|
||||
|
||||
#include <osgPresentation/SlideEventHandler>
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
class ExportHTML
|
||||
{
|
||||
public:
|
||||
static bool write(osgPresentation::SlideEventHandler* seh, osgViewer::Viewer& viewer, const std::string& filename);
|
||||
|
||||
static std::string createFileName(const std::string& basename, unsigned int page, const std::string& ext);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,101 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include "PointsEventHandler.h"
|
||||
|
||||
#include <osg/Notify>
|
||||
|
||||
PointsEventHandler::PointsEventHandler()
|
||||
{
|
||||
_point = new osg::Point;
|
||||
//_point->setDistanceAttenuation(osg::Vec3(0.0,0.0000,0.05f));
|
||||
}
|
||||
|
||||
bool PointsEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
||||
{
|
||||
switch(ea.getEventType())
|
||||
{
|
||||
case(osgGA::GUIEventAdapter::KEYDOWN):
|
||||
{
|
||||
if (ea.getKey()=='+' || ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Add)
|
||||
{
|
||||
changePointSize(1.0f);
|
||||
return true;
|
||||
}
|
||||
else if (ea.getKey()=='-' || ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Subtract)
|
||||
{
|
||||
changePointSize(-1.0f);
|
||||
return true;
|
||||
}
|
||||
else if (ea.getKey()=='<')
|
||||
{
|
||||
changePointAttenuation(1.1f);
|
||||
return true;
|
||||
}
|
||||
else if (ea.getKey()=='>')
|
||||
{
|
||||
changePointAttenuation(1.0f/1.1f);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void PointsEventHandler::accept(osgGA::GUIEventHandlerVisitor& v)
|
||||
{
|
||||
v.visit(*this);
|
||||
}
|
||||
|
||||
void PointsEventHandler::getUsage(osg::ApplicationUsage& usage) const
|
||||
{
|
||||
usage.addKeyboardMouseBinding("+","Increase point size");
|
||||
usage.addKeyboardMouseBinding("-","Reduce point size");
|
||||
usage.addKeyboardMouseBinding(">","Increase point size");
|
||||
usage.addKeyboardMouseBinding("<","Reduce point size");
|
||||
}
|
||||
|
||||
float PointsEventHandler::getPointSize() const
|
||||
{
|
||||
return _point->getSize();
|
||||
}
|
||||
|
||||
void PointsEventHandler::setPointSize(float psize)
|
||||
{
|
||||
if (psize>0.0)
|
||||
{
|
||||
_point->setSize(psize);
|
||||
_stateset->setAttribute(_point.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
_stateset->setAttribute(_point.get(),osg::StateAttribute::INHERIT);
|
||||
}
|
||||
osg::notify(osg::INFO)<<"Point size "<<psize<<std::endl;
|
||||
}
|
||||
|
||||
void PointsEventHandler::changePointSize(float delta)
|
||||
{
|
||||
setPointSize(getPointSize()+delta);
|
||||
}
|
||||
|
||||
void PointsEventHandler::changePointAttenuation(float scale)
|
||||
{
|
||||
if (_point.valid())
|
||||
{
|
||||
_point->setDistanceAttenuation(_point->getDistanceAttenuation()*scale);
|
||||
if (_stateset.valid()) _stateset->setAttribute(_point.get());
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#ifndef POINTSEVENTHANDLER
|
||||
#define POINTSEVENTHANDLER 1
|
||||
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Point>
|
||||
|
||||
#include <osgGA/GUIEventHandler>
|
||||
|
||||
class PointsEventHandler : public osgGA::GUIEventHandler
|
||||
{
|
||||
public:
|
||||
PointsEventHandler();
|
||||
|
||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
|
||||
|
||||
virtual void accept(osgGA::GUIEventHandlerVisitor& v);
|
||||
|
||||
void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
void setStateSet(osg::StateSet* stateset) { _stateset=stateset; }
|
||||
|
||||
osg::StateSet* getStateSet() { return _stateset.get(); }
|
||||
|
||||
const osg::StateSet* getStateSet() const { return _stateset.get(); }
|
||||
|
||||
void setPointSize(float psize);
|
||||
|
||||
float getPointSize() const;
|
||||
|
||||
void changePointSize(float delta);
|
||||
|
||||
void changePointAttenuation(float scale);
|
||||
|
||||
osg::ref_ptr<osg::StateSet> _stateset;
|
||||
osg::ref_ptr<osg::Point> _point;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,294 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include "ReadShowFile.h"
|
||||
#include "ShowEventHandler.h"
|
||||
|
||||
#include <osgPresentation/SlideEventHandler>
|
||||
|
||||
#include <osg/ImageStream>
|
||||
#include <osg/Shape>
|
||||
#include <osg/ShapeDrawable>
|
||||
#include <osg/Switch>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/FileNameUtils>
|
||||
#include <osgDB/FileUtils>
|
||||
|
||||
#include <osgVolume/VolumeTile>
|
||||
|
||||
#include <osgDB/XmlParser>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
class AddVolumeEditingCallbackVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
AddVolumeEditingCallbackVisitor():
|
||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||
|
||||
void apply(osg::Group& group)
|
||||
{
|
||||
osgVolume::VolumeTile* volumeTile = dynamic_cast<osgVolume::VolumeTile*>(&group);
|
||||
if (volumeTile)
|
||||
{
|
||||
volumeTile->addEventCallback(new osgVolume::PropertyAdjustmentCallback());
|
||||
}
|
||||
else
|
||||
{
|
||||
traverse(group);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, FileNameList& normalFiles)
|
||||
{
|
||||
// note currently doesn't delete the loaded file entries from the command line yet...
|
||||
for(int pos=1;pos<arguments.argc();++pos)
|
||||
{
|
||||
if (!arguments.isOption(pos))
|
||||
{
|
||||
std::string ext = osgDB::getFileExtension(arguments[pos]);
|
||||
if (osgDB::equalCaseInsensitive(ext,"xml") || osgDB::equalCaseInsensitive(ext,"p3d"))
|
||||
{
|
||||
xmlFiles.push_back(arguments[pos]);
|
||||
}
|
||||
else
|
||||
{
|
||||
normalFiles.push_back(arguments[pos]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (!xmlFiles.empty() || !normalFiles.empty());
|
||||
}
|
||||
|
||||
bool p3d::readEnvVars(osg::ArgumentParser& arguments)
|
||||
{
|
||||
bool readVars = false;
|
||||
|
||||
for(int i=1; i<arguments.argc(); ++i)
|
||||
{
|
||||
if (!arguments.isOption(i))
|
||||
{
|
||||
std::string ext = osgDB::getLowerCaseFileExtension(arguments[i]);
|
||||
if (ext=="xml" || ext=="p3d")
|
||||
{
|
||||
std::string file = osgDB::findDataFile(arguments[i]);
|
||||
if (!file.empty())
|
||||
{
|
||||
std::string path = osgDB::getFilePath(file);
|
||||
if (!path.empty())
|
||||
{
|
||||
osgDB::getDataFilePathList().push_front(path);
|
||||
}
|
||||
|
||||
if (p3d::readEnvVars(file)) readVars = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return readVars;
|
||||
}
|
||||
|
||||
bool p3d::readEnvVars(const std::string& fileName)
|
||||
{
|
||||
std::string ext = osgDB::getFileExtension(fileName);
|
||||
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
|
||||
!osgDB::equalCaseInsensitive(ext,"p3d")) return false;
|
||||
|
||||
|
||||
osg::ref_ptr<osgDB::XmlNode> doc = new osgDB::XmlNode;
|
||||
osgDB::XmlNode* root = 0;
|
||||
|
||||
osgDB::XmlNode::Input input;
|
||||
input.open(fileName);
|
||||
input.readAllDataIntoBuffer();
|
||||
|
||||
doc->read(input);
|
||||
|
||||
if (doc == NULL )
|
||||
{
|
||||
fprintf(stderr,"Document not parsed successfully. \n");
|
||||
return false;
|
||||
}
|
||||
|
||||
for(osgDB::XmlNode::Children::iterator itr = doc->children.begin();
|
||||
itr != doc->children.end() && !root;
|
||||
++itr)
|
||||
{
|
||||
if ((*itr)->name=="presentation") root = itr->get();
|
||||
}
|
||||
|
||||
if (root == NULL)
|
||||
{
|
||||
fprintf(stderr,"empty document\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (root->name!="presentation")
|
||||
{
|
||||
fprintf(stderr,"document of the wrong type, root node != presentation");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool readVars = false;
|
||||
|
||||
for(osgDB::XmlNode::Children::iterator itr = root->children.begin();
|
||||
itr != root->children.end();
|
||||
++itr)
|
||||
{
|
||||
osgDB::XmlNode* cur = itr->get();
|
||||
|
||||
if (cur->name=="env")
|
||||
{
|
||||
char* str = strdup(cur->contents.c_str());
|
||||
osg::notify(osg::INFO)<<"putenv("<<str<<")"<<std::endl;
|
||||
putenv(str);
|
||||
readVars = true;
|
||||
}
|
||||
}
|
||||
|
||||
return readVars;
|
||||
}
|
||||
|
||||
osgDB::Options* createOptions(const osgDB::ReaderWriter::Options* options)
|
||||
{
|
||||
osg::ref_ptr<osgDB::Options> local_options = options ? options->cloneOptions() : 0;
|
||||
if (!local_options)
|
||||
{
|
||||
local_options = osgDB::Registry::instance()->getOptions() ?
|
||||
osgDB::Registry::instance()->getOptions()->cloneOptions() :
|
||||
new osgDB::Options;
|
||||
}
|
||||
|
||||
local_options->setPluginStringData("P3D_EVENTHANDLER","none");
|
||||
return local_options.release();
|
||||
}
|
||||
|
||||
osg::Node* p3d::readHoldingSlide(const std::string& filename)
|
||||
{
|
||||
std::string ext = osgDB::getFileExtension(filename);
|
||||
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
|
||||
!osgDB::equalCaseInsensitive(ext,"p3d")) return 0;
|
||||
|
||||
osg::ref_ptr<osgDB::ReaderWriter::Options> options = createOptions(0);
|
||||
options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_NONE);
|
||||
options->setOptionString("preview");
|
||||
|
||||
return osgDB::readNodeFile(filename, options.get());
|
||||
}
|
||||
|
||||
osg::Node* p3d::readPresentation(const std::string& filename,const osgDB::ReaderWriter::Options* options)
|
||||
{
|
||||
std::string ext = osgDB::getFileExtension(filename);
|
||||
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
|
||||
!osgDB::equalCaseInsensitive(ext,"p3d")) return 0;
|
||||
|
||||
osg::ref_ptr<osgDB::Options> local_options = createOptions(options);
|
||||
local_options->setOptionString("main");
|
||||
|
||||
return osgDB::readNodeFile(filename, local_options.get());
|
||||
}
|
||||
|
||||
osg::Node* p3d::readShowFiles(osg::ArgumentParser& arguments,const osgDB::ReaderWriter::Options* options)
|
||||
{
|
||||
osg::ref_ptr<osgDB::Options> local_options = createOptions(options);
|
||||
local_options->setOptionString("main");
|
||||
|
||||
typedef std::vector< osg::ref_ptr<osg::Node> > NodeList;
|
||||
NodeList nodeList;
|
||||
|
||||
std::string filename;
|
||||
while (arguments.read("--image",filename))
|
||||
{
|
||||
osg::ref_ptr<osg::Image> image = readImageFile(filename.c_str(), local_options.get());
|
||||
if (image.valid()) nodeList.push_back(osg::createGeodeForImage(image.get()));
|
||||
}
|
||||
|
||||
while (arguments.read("--movie",filename))
|
||||
{
|
||||
osg::ref_ptr<osg::Image> image = readImageFile(filename.c_str(), local_options.get());
|
||||
osg::ref_ptr<osg::ImageStream> imageStream = dynamic_cast<osg::ImageStream*>(image.get());
|
||||
if (image.valid())
|
||||
{
|
||||
imageStream->play();
|
||||
nodeList.push_back(osg::createGeodeForImage(imageStream.get()));
|
||||
}
|
||||
}
|
||||
|
||||
while (arguments.read("--dem",filename))
|
||||
{
|
||||
osg::HeightField* hf = readHeightFieldFile(filename.c_str(), local_options.get());
|
||||
if (hf)
|
||||
{
|
||||
osg::Geode* geode = new osg::Geode;
|
||||
geode->addDrawable(new osg::ShapeDrawable(hf));
|
||||
nodeList.push_back(geode);
|
||||
}
|
||||
}
|
||||
|
||||
// note currently doesn't delete the loaded file entries from the command line yet...
|
||||
for(int pos=1;pos<arguments.argc();++pos)
|
||||
{
|
||||
if (!arguments.isOption(pos))
|
||||
{
|
||||
// not an option so assume string is a filename.
|
||||
osg::Node *node = osgDB::readNodeFile( arguments[pos], local_options.get());
|
||||
|
||||
if(node)
|
||||
{
|
||||
if (node->getName().empty()) node->setName( arguments[pos] );
|
||||
nodeList.push_back(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nodeList.empty())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Node> root;
|
||||
|
||||
if (nodeList.size()==1)
|
||||
{
|
||||
root = nodeList.front().get();
|
||||
}
|
||||
else // size >1
|
||||
{
|
||||
|
||||
osg::Switch* sw = new osg::Switch;
|
||||
for(NodeList::iterator itr=nodeList.begin();
|
||||
itr!=nodeList.end();
|
||||
++itr)
|
||||
{
|
||||
sw->addChild((*itr).get());
|
||||
}
|
||||
sw->setSingleChildOn(0);
|
||||
|
||||
sw->setEventCallback(new p3d::ShowEventHandler());
|
||||
|
||||
root = sw;
|
||||
}
|
||||
|
||||
if (root.valid())
|
||||
{
|
||||
osg::notify(osg::INFO)<<"Got node now adding callback"<<std::endl;
|
||||
|
||||
AddVolumeEditingCallbackVisitor avecv;
|
||||
root->accept(avecv);
|
||||
}
|
||||
|
||||
return root.release();
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#ifndef P3D_READFILE
|
||||
#define P3D_READFILE 1
|
||||
|
||||
#include <osg/ArgumentParser>
|
||||
#include <osgDB/ReaderWriter>
|
||||
|
||||
namespace p3d {
|
||||
|
||||
typedef std::vector<std::string> FileNameList;
|
||||
|
||||
bool getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, FileNameList& normalFiles);
|
||||
|
||||
bool readEnvVars(osg::ArgumentParser& arguments);
|
||||
|
||||
bool readEnvVars(const std::string& filename);
|
||||
|
||||
osg::Node* readHoldingSlide(const std::string& filename);
|
||||
|
||||
osg::Node* readPresentation(const std::string& filename,const osgDB::ReaderWriter::Options* options);
|
||||
|
||||
osg::Node* readShowFiles(osg::ArgumentParser& arguments,const osgDB::ReaderWriter::Options* options);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,254 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReaderWriter>
|
||||
#include <osgDB/FileNameUtils>
|
||||
#include <osgDB/FileUtils>
|
||||
#include <osgDB/Registry>
|
||||
|
||||
#include <osgWidget/PdfReader>
|
||||
|
||||
#include <osgPresentation/SlideShowConstructor>
|
||||
#include <osgPresentation/AnimationMaterial>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <osgDB/XmlParser>
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
/**
|
||||
* OpenSceneGraph plugin wrapper/converter.
|
||||
*/
|
||||
class ReaderWriterPaths : public osgDB::ReaderWriter
|
||||
{
|
||||
public:
|
||||
ReaderWriterPaths()
|
||||
{
|
||||
supportsExtension("material","Material animation Ascii file format");
|
||||
supportsExtension("path","Animation path Ascii file format");
|
||||
supportsExtension("pivot_path","Animation pivot path Ascii file format");
|
||||
supportsExtension("rotation_path","Animation rotation path Ascii file format");
|
||||
}
|
||||
|
||||
virtual const char* className() const
|
||||
{
|
||||
return "Path Reader/Writer";
|
||||
}
|
||||
|
||||
virtual bool acceptsExtension(const std::string& extension) const
|
||||
{
|
||||
return osgDB::equalCaseInsensitive(extension,"material") ||
|
||||
osgDB::equalCaseInsensitive(extension,"path") ||
|
||||
osgDB::equalCaseInsensitive(extension,"pivot_path") ||
|
||||
osgDB::equalCaseInsensitive(extension,"rotation_path");
|
||||
}
|
||||
|
||||
virtual osgDB::ReaderWriter::ReadResult readObject(const std::string& fileName, const osgDB::Options* options) const;
|
||||
|
||||
virtual osgDB::ReaderWriter::ReadResult readObject(std::istream& fin, const osgDB::Options* options) const;
|
||||
|
||||
virtual osgDB::ReaderWriter::ReadResult read_material(std::istream& fin, const osgDB::Options* options) const;
|
||||
virtual osgDB::ReaderWriter::ReadResult read_path(std::istream& fin, const osgDB::Options* options) const;
|
||||
virtual osgDB::ReaderWriter::ReadResult read_pivot_path(std::istream& fin, const osgDB::Options* options) const;
|
||||
virtual osgDB::ReaderWriter::ReadResult read_rotation_path(std::istream& fin, const osgDB::Options* options) const;
|
||||
};
|
||||
|
||||
// now register with Registry to instantiate the above
|
||||
// reader/writer.
|
||||
REGISTER_OSGPLUGIN(paths, ReaderWriterPaths)
|
||||
|
||||
|
||||
osgDB::ReaderWriter::ReadResult ReaderWriterPaths::readObject(const std::string& file, const osgDB::Options* options) const
|
||||
{
|
||||
|
||||
|
||||
std::string ext = osgDB::getLowerCaseFileExtension(file);
|
||||
if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED;
|
||||
|
||||
osg::notify(osg::INFO)<<"ReaderWriterPaths::readObject("<<file<<")"<<std::endl;
|
||||
|
||||
std::string fileName = osgDB::findDataFile( file, options );
|
||||
if (fileName.empty()) return ReadResult::FILE_NOT_FOUND;
|
||||
|
||||
osg::notify(osg::INFO)<<" Found path file :"<<fileName<<std::endl;
|
||||
|
||||
// code for setting up the database path so that internally referenced file are searched for on relative paths.
|
||||
osg::ref_ptr<osgDB::ReaderWriter::Options> local_opt = options ? static_cast<osgDB::ReaderWriter::Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options;
|
||||
local_opt->setPluginStringData("filename",fileName);
|
||||
|
||||
std::ifstream input(fileName.c_str());
|
||||
|
||||
return readObject(input, local_opt.get());
|
||||
}
|
||||
|
||||
osgDB::ReaderWriter::ReadResult ReaderWriterPaths::readObject(std::istream& fin, const osgDB::Options* options) const
|
||||
{
|
||||
osg::notify(osg::INFO)<<"ReaderWriterPaths::readObject(std::istream& fin"<<std::endl;
|
||||
|
||||
if (!options) return ReadResult::FILE_NOT_HANDLED;
|
||||
if (!fin) return ReadResult::ERROR_IN_READING_FILE;
|
||||
|
||||
|
||||
std::string filename = options->getPluginStringData("filename");
|
||||
|
||||
std::string ext = osgDB::getLowerCaseFileExtension(filename);
|
||||
|
||||
osg::notify(osg::INFO)<<" filename found in options: "<<filename<<" extension="<<ext<<std::endl;
|
||||
|
||||
|
||||
if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED;
|
||||
|
||||
|
||||
if (ext=="path") return read_path(fin, options);
|
||||
else if (ext=="material") return read_material(fin, options);
|
||||
else if (ext=="pivot_path") return read_pivot_path(fin, options);
|
||||
else if (ext=="rotation_path") return read_rotation_path(fin, options);
|
||||
|
||||
return ReadResult::FILE_NOT_HANDLED;
|
||||
}
|
||||
|
||||
osgDB::ReaderWriter::ReadResult ReaderWriterPaths::read_material(std::istream& fin, const osgDB::Options* options) const
|
||||
{
|
||||
osg::ref_ptr<ss3d::AnimationMaterial> animationMaterial = new ss3d::AnimationMaterial;
|
||||
animationMaterial->read(fin);
|
||||
|
||||
return animationMaterial.get();
|
||||
}
|
||||
|
||||
osgDB::ReaderWriter::ReadResult ReaderWriterPaths::read_path(std::istream& fin, const osgDB::Options* options) const
|
||||
{
|
||||
osg::ref_ptr<osg::AnimationPath> animation = new osg::AnimationPath;
|
||||
animation->read(fin);
|
||||
return animation.get();
|
||||
}
|
||||
|
||||
osgDB::ReaderWriter::ReadResult ReaderWriterPaths::read_pivot_path(std::istream& fin, const osgDB::Options* options) const
|
||||
{
|
||||
osg::ref_ptr<osg::AnimationPath> animation = new osg::AnimationPath;
|
||||
|
||||
while (!fin.eof())
|
||||
{
|
||||
double time;
|
||||
osg::Vec3 pivot;
|
||||
osg::Vec3 position;
|
||||
float scale;
|
||||
osg::Quat rotation;
|
||||
fin >> time >> pivot.x() >> pivot.y() >> pivot.z() >> position.x() >> position.y() >> position.z() >> rotation.x() >> rotation.y() >> rotation.z() >> rotation.w() >> scale;
|
||||
if(!fin.eof())
|
||||
{
|
||||
osg::Matrix SR = osg::Matrix::scale(scale,scale,scale)*
|
||||
osg::Matrixf::rotate(rotation);
|
||||
|
||||
osg::Matrix invSR;
|
||||
invSR.invert(SR);
|
||||
|
||||
position += (invSR*pivot)*SR;
|
||||
|
||||
animation->insert(time,osg::AnimationPath::ControlPoint(position,rotation,osg::Vec3(scale,scale,scale)));
|
||||
}
|
||||
}
|
||||
|
||||
return animation.get();
|
||||
}
|
||||
|
||||
struct RotationPathData
|
||||
{
|
||||
RotationPathData():
|
||||
time(0.0),
|
||||
scale(1.0f),
|
||||
azim(0.0f),
|
||||
elevation(0.0f) {}
|
||||
|
||||
double time;
|
||||
osg::Vec3 pivot;
|
||||
osg::Vec3 position;
|
||||
float scale;
|
||||
float azim;
|
||||
float elevation;
|
||||
|
||||
void addToPath(osg::AnimationPath* animation) const
|
||||
{
|
||||
osg::Quat Rx, Rz, rotation;
|
||||
|
||||
Rx.makeRotate(osg::DegreesToRadians(elevation),1.0f,0.0f,0.0f);
|
||||
Rz.makeRotate(osg::DegreesToRadians(azim),0.0f,0.0f,1.0f);
|
||||
rotation = Rz * Rx; // note, I believe this is the wrong way round, but I had to put it in this order to fix the Quat properly.
|
||||
|
||||
osg::Matrix SR = osg::Matrix::scale(scale,scale,scale)*
|
||||
osg::Matrixf::rotate(rotation);
|
||||
|
||||
osg::Matrix invSR;
|
||||
invSR.invert(SR);
|
||||
|
||||
osg::Vec3 local_position = position + (invSR*pivot)*SR;
|
||||
|
||||
animation->insert(time,osg::AnimationPath::ControlPoint(local_position,rotation,osg::Vec3(scale,scale,scale)));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
osgDB::ReaderWriter::ReadResult ReaderWriterPaths::read_rotation_path(std::istream& fin, const osgDB::Options* options) const
|
||||
{
|
||||
osg::ref_ptr<osg::AnimationPath> animation = new osg::AnimationPath;
|
||||
|
||||
RotationPathData prevValue;
|
||||
bool first = true;
|
||||
while (!fin.eof())
|
||||
{
|
||||
RotationPathData currValue;
|
||||
fin >> currValue.time >> currValue.pivot.x() >> currValue.pivot.y() >> currValue.pivot.z() >> currValue.position.x() >> currValue.position.y() >> currValue.position.z() >> currValue.azim >> currValue.elevation >> currValue.scale;
|
||||
|
||||
if(!fin.eof())
|
||||
{
|
||||
|
||||
if (!first)
|
||||
{
|
||||
|
||||
unsigned int num = 20;
|
||||
float dr = 1.0f/(float)num;
|
||||
float r=dr;
|
||||
for(unsigned int i=0;
|
||||
i<num;
|
||||
++i, r+=dr)
|
||||
{
|
||||
RotationPathData localValue;
|
||||
localValue.time = currValue.time *r + prevValue.time * (1.0f-r);
|
||||
localValue.pivot = currValue.pivot *r + prevValue.pivot * (1.0f-r);
|
||||
localValue.position = currValue.position *r + prevValue.position * (1.0f-r);
|
||||
localValue.scale = currValue.scale *r + prevValue.scale * (1.0f-r);
|
||||
localValue.azim = currValue.azim *r + prevValue.azim * (1.0f-r);
|
||||
localValue.elevation = currValue.elevation *r + prevValue.elevation * (1.0f-r);
|
||||
|
||||
localValue.addToPath(animation.get());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currValue.addToPath(animation.get());
|
||||
}
|
||||
prevValue = currValue;
|
||||
first = false;
|
||||
}
|
||||
|
||||
}
|
||||
osg::notify(osg::NOTICE)<<"finished"<<std::endl;
|
||||
|
||||
return animation.get();
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
#include "SDLIntegration.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_events.h>
|
||||
#include <SDL_joystick.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
SDLIntegration::SDLIntegration()
|
||||
{
|
||||
_verbose = false;
|
||||
|
||||
// init SDL
|
||||
if ( SDL_Init(SDL_INIT_JOYSTICK) < 0 )
|
||||
{
|
||||
fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
atexit(SDL_Quit);
|
||||
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
|
||||
if (_verbose)
|
||||
{
|
||||
std::cout<<"number of joysticks "<<numJoysticks<<std::endl;
|
||||
for(int i=0; i<numJoysticks; ++i)
|
||||
{
|
||||
std::cout<<"Joystick name '"<<SDL_JoystickName(i)<<"'"<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
_joystick = numJoysticks>0 ? SDL_JoystickOpen(0) : 0;
|
||||
|
||||
_numAxes = _joystick ? SDL_JoystickNumAxes(_joystick) : 0;
|
||||
_numBalls = _joystick ? SDL_JoystickNumBalls(_joystick) : 0;
|
||||
_numHats = _joystick ? SDL_JoystickNumHats(_joystick) : 0;
|
||||
_numButtons = _joystick ? SDL_JoystickNumButtons(_joystick) : 0;
|
||||
|
||||
if (_verbose)
|
||||
{
|
||||
std::cout<<"numAxes = "<<_numAxes<<std::endl;
|
||||
std::cout<<"numBalls = "<<_numBalls<<std::endl;
|
||||
std::cout<<"numHats = "<<_numHats<<std::endl;
|
||||
std::cout<<"numButtons = "<<_numButtons<<std::endl;
|
||||
}
|
||||
|
||||
addMouseButtonMapping(4, 1); // left
|
||||
addMouseButtonMapping(5, 3); // right
|
||||
addMouseButtonMapping(6, 2); // middle
|
||||
|
||||
addKeyMapping(10, ' '); // R2
|
||||
|
||||
addKeyMapping(0, '1'); // 1
|
||||
addKeyMapping(1, '2'); // 2
|
||||
addKeyMapping(2, '3'); // 3
|
||||
addKeyMapping(4, '4'); // 4
|
||||
|
||||
addKeyMapping(7, ' '); // home
|
||||
|
||||
addKeyMapping(8, osgGA::GUIEventAdapter::KEY_Page_Up); // Start
|
||||
addKeyMapping(9, osgGA::GUIEventAdapter::KEY_Page_Down); // Start
|
||||
addKeyMapping(10, osgGA::GUIEventAdapter::KEY_Home); // Start
|
||||
|
||||
|
||||
capture(_axisValues, _buttonValues);
|
||||
}
|
||||
|
||||
SDLIntegration::~SDLIntegration()
|
||||
{
|
||||
}
|
||||
|
||||
void SDLIntegration::capture(ValueList& axisValues, ValueList& buttonValues) const
|
||||
{
|
||||
if (_joystick)
|
||||
{
|
||||
SDL_JoystickUpdate();
|
||||
|
||||
axisValues.resize(_numAxes);
|
||||
for(int ai=0; ai<_numAxes; ++ai)
|
||||
{
|
||||
axisValues[ai] = SDL_JoystickGetAxis(_joystick, ai);
|
||||
}
|
||||
|
||||
buttonValues.resize(_numButtons);
|
||||
for(int bi=0; bi<_numButtons; ++bi)
|
||||
{
|
||||
buttonValues[bi] = SDL_JoystickGetButton(_joystick, bi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SDLIntegration::update(osgViewer::Viewer& viewer)
|
||||
{
|
||||
if (_joystick)
|
||||
{
|
||||
|
||||
ValueList newAxisValues;
|
||||
ValueList newButtonValues;
|
||||
|
||||
capture(newAxisValues, newButtonValues);
|
||||
|
||||
unsigned int mouseXaxis = 0;
|
||||
unsigned int mouseYaxis = 1;
|
||||
|
||||
float prev_mx = (float)_axisValues[mouseXaxis]/32767.0f;
|
||||
float prev_my = -(float)_axisValues[mouseYaxis]/32767.0f;
|
||||
|
||||
float mx = (float)newAxisValues[mouseXaxis]/32767.0f;
|
||||
float my = -(float)newAxisValues[mouseYaxis]/32767.0f;
|
||||
|
||||
|
||||
osgGA::EventQueue* eq = viewer.getEventQueue();
|
||||
double time = eq ? eq->getTime() : 0.0;
|
||||
osgGA::GUIEventAdapter* previous_event = eq->getCurrentEventState();
|
||||
float projected_mx = previous_event->getXmin() + (mx+1.0)*0.5*(previous_event->getXmax()-previous_event->getXmin());
|
||||
float projected_my = previous_event->getYmin() + (my+1.0)*0.5*(previous_event->getYmax()-previous_event->getYmin());
|
||||
|
||||
if (mx!=prev_mx || my!=prev_my)
|
||||
{
|
||||
eq->mouseMotion(projected_mx, projected_my, time);
|
||||
}
|
||||
|
||||
|
||||
if (_verbose)
|
||||
{
|
||||
for(int ai=0; ai<_numAxes; ++ai)
|
||||
{
|
||||
if (newAxisValues[ai]!=_axisValues[ai])
|
||||
{
|
||||
std::cout<<"axis "<<ai<<" moved to "<<newAxisValues[ai]<<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int bi=0; bi<_numButtons; ++bi)
|
||||
{
|
||||
if (newButtonValues[bi]!=_buttonValues[bi])
|
||||
{
|
||||
if (_verbose)
|
||||
{
|
||||
std::cout<<"button "<<bi<<" changed to "<<newButtonValues[bi]<<std::endl;
|
||||
}
|
||||
|
||||
int key = getKeyMapping(bi);
|
||||
int mouseButton = getMouseButtonMapping(bi);
|
||||
|
||||
if (mouseButton>0)
|
||||
{
|
||||
if (newButtonValues[bi]==0) eq->mouseButtonRelease(projected_mx,projected_my,mouseButton,time);
|
||||
else eq->mouseButtonPress(projected_mx,projected_my,mouseButton,time);
|
||||
}
|
||||
else if (key>0)
|
||||
{
|
||||
|
||||
if (newButtonValues[bi]==0) eq->keyRelease(key,time);
|
||||
else eq->keyPress(key,time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_axisValues.swap(newAxisValues);
|
||||
_buttonValues.swap(newButtonValues);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#ifndef SDLINTEGRATION
|
||||
#define SDLINTEGRATION
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_events.h>
|
||||
#include <SDL_joystick.h>
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
class SDLIntegration
|
||||
{
|
||||
public:
|
||||
|
||||
SDLIntegration();
|
||||
~SDLIntegration();
|
||||
|
||||
typedef std::vector<int> ValueList;
|
||||
typedef std::map<int, int> ButtonMap;
|
||||
|
||||
void update(osgViewer::Viewer& viewer);
|
||||
|
||||
void addMouseButtonMapping(int joystickButton, int mouseButton)
|
||||
{
|
||||
_mouseButtonMap[joystickButton] = mouseButton;
|
||||
}
|
||||
|
||||
int getMouseButtonMapping(int joystickButton)
|
||||
{
|
||||
ButtonMap::const_iterator itr = _mouseButtonMap.find(joystickButton);
|
||||
if (itr != _mouseButtonMap.end()) return itr->second;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
void addKeyMapping(int joystickButton, int key)
|
||||
{
|
||||
_keyMap[joystickButton] = key;
|
||||
}
|
||||
|
||||
int getKeyMapping(int joystickButton)
|
||||
{
|
||||
ButtonMap::const_iterator itr = _keyMap.find(joystickButton);
|
||||
if (itr != _keyMap.end()) return itr->second;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void capture(ValueList& axisValues, ValueList& buttonValues) const;
|
||||
|
||||
SDL_Joystick* _joystick;
|
||||
int _numAxes;
|
||||
int _numBalls;
|
||||
int _numHats;
|
||||
int _numButtons;
|
||||
bool _verbose;
|
||||
|
||||
ValueList _axisValues;
|
||||
ValueList _buttonValues;
|
||||
ButtonMap _mouseButtonMap;
|
||||
ButtonMap _keyMap;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,64 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include "ShowEventHandler.h"
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osg/Notify>
|
||||
|
||||
using namespace p3d;
|
||||
|
||||
ShowEventHandler::ShowEventHandler()
|
||||
{
|
||||
}
|
||||
|
||||
bool ShowEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& /*aa*/, osg::Object* object, osg::NodeVisitor* /*nv*/)
|
||||
{
|
||||
switch(ea.getEventType())
|
||||
{
|
||||
case(osgGA::GUIEventAdapter::KEYUP):
|
||||
{
|
||||
osg::notify(osg::INFO)<<"ShowEventHandler KEYUP "<<(int)ea.getKey()<<std::endl;
|
||||
if (ea.getKey()>=osgGA::GUIEventAdapter::KEY_F1 &&
|
||||
ea.getKey()<=osgGA::GUIEventAdapter::KEY_F8)
|
||||
{
|
||||
unsigned int child = ea.getKey()-osgGA::GUIEventAdapter::KEY_F1;
|
||||
osg::notify(osg::INFO)<<" Select "<<child<<std::endl;
|
||||
osg::Switch* showSwitch = dynamic_cast<osg::Switch*>(object);
|
||||
if (showSwitch)
|
||||
{
|
||||
if (child<showSwitch->getNumChildren())
|
||||
{
|
||||
osg::notify(osg::INFO)<<" Switched "<<child<<std::endl;
|
||||
showSwitch->setSingleChildOn(child);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void ShowEventHandler::accept(osgGA::GUIEventHandlerVisitor& v)
|
||||
{
|
||||
v.visit(*this);
|
||||
}
|
||||
|
||||
void ShowEventHandler::getUsage(osg::ApplicationUsage& /*usage*/) const
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#ifndef SHOWEVENTHANDLER
|
||||
#define SHOWEVENTHANDLER 1
|
||||
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Point>
|
||||
|
||||
#include <osgGA/GUIEventHandler>
|
||||
|
||||
namespace p3d
|
||||
{
|
||||
|
||||
class ShowEventHandler : public osgGA::GUIEventHandler
|
||||
{
|
||||
public:
|
||||
|
||||
ShowEventHandler();
|
||||
|
||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv);
|
||||
|
||||
virtual void accept(osgGA::GUIEventHandlerVisitor& v);
|
||||
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,905 +0,0 @@
|
||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||
*
|
||||
* This software is open source and may be redistributed and/or modified under
|
||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||
* The full license is in LICENSE.txt file included with this distribution,.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* include LICENSE.txt for more details.
|
||||
*/
|
||||
|
||||
#include <osg/Geometry>
|
||||
#include <osg/CameraNode>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/AutoTransform>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/WriteFile>
|
||||
#include <osgDB/FileNameUtils>
|
||||
#include <osgUtil/Optimizer>
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
|
||||
#include <OpenThreads/Thread>
|
||||
|
||||
#include <osgGA/TrackballManipulator>
|
||||
#include <osgGA/FlightManipulator>
|
||||
#include <osgGA/DriveManipulator>
|
||||
#include <osgGA/KeySwitchMatrixManipulator>
|
||||
#include <osgGA/AnimationPathManipulator>
|
||||
#include <osgGA/TerrainManipulator>
|
||||
#include <osgGA/AnimationPathManipulator>
|
||||
#include <osgGA/StateSetManipulator>
|
||||
|
||||
#include <osgPresentation/SlideEventHandler>
|
||||
#include <osgPresentation/SlideShowConstructor>
|
||||
|
||||
#include "ReadShowFile.h"
|
||||
#include "PointsEventHandler.h"
|
||||
#include "Cluster.h"
|
||||
#include "ExportHTML.h"
|
||||
|
||||
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef USE_SDL
|
||||
#include "SDLIntegration.h"
|
||||
#endif
|
||||
|
||||
#if OSG_LIBRARY_STATIC
|
||||
|
||||
// include the plugins we need
|
||||
USE_OSGPLUGIN(ive)
|
||||
USE_OSGPLUGIN(osg)
|
||||
USE_OSGPLUGIN(p3d)
|
||||
USE_OSGPLUGIN(paths)
|
||||
|
||||
USE_OSGPLUGIN(freetype)
|
||||
USE_OSGPLUGIN(rgb)
|
||||
USE_OSGPLUGIN(png)
|
||||
USE_OSGPLUGIN(jpeg)
|
||||
|
||||
USE_OSGPLUGIN(ffmpeg)
|
||||
USE_OSGPLUGIN(pdf)
|
||||
|
||||
USE_OSGPLUGIN(OpenFlight)
|
||||
USE_OSGPLUGIN(obj)
|
||||
|
||||
USE_OSGPLUGIN(curl)
|
||||
|
||||
|
||||
// include the platform specific GraphicsWindow implementation.
|
||||
USE_GRAPHICSWINDOW()
|
||||
|
||||
#endif
|
||||
|
||||
static const char* s_version = "1.4 beta";
|
||||
|
||||
void setViewer(osgViewer::Viewer& viewer, float width, float height, float distance)
|
||||
{
|
||||
double vfov = osg::RadiansToDegrees(atan2(height/2.0f,distance)*2.0);
|
||||
// double hfov = osg::RadiansToDegrees(atan2(width/2.0f,distance)*2.0);
|
||||
|
||||
viewer.getCamera()->setProjectionMatrixAsPerspective( vfov, width/height, 0.1, 1000.0);
|
||||
}
|
||||
|
||||
#if 1
|
||||
|
||||
class RayFollowsMouseCallback : public osg::Drawable::EventCallback
|
||||
{
|
||||
RayFollowsMouseCallback() {}
|
||||
|
||||
/** do customized Event code. */
|
||||
virtual void event(osg::NodeVisitor* nv, osg::Drawable* drawable)
|
||||
{
|
||||
osg::Geometry* geometry = drawable->asGeometry();
|
||||
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
|
||||
|
||||
if (!ev || !geometry) return;
|
||||
|
||||
osgGA::GUIActionAdapter* aa = ev->getActionAdapter();
|
||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(aa);
|
||||
if (!view) return;
|
||||
|
||||
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(geometry->getVertexArray());
|
||||
if (!vertices) return;
|
||||
|
||||
osg::Camera* camera = view->getCamera();
|
||||
osg::Matrix VP = camera->getViewMatrix() * camera->getProjectionMatrix();
|
||||
|
||||
osg::Matrix inverse_VP;
|
||||
inverse_VP.invert(VP);
|
||||
|
||||
osgGA::EventQueue::Events& events = ev->getEvents();
|
||||
for(osgGA::EventQueue::Events::iterator itr = events.begin();
|
||||
itr != events.end();
|
||||
++itr)
|
||||
{
|
||||
handle(inverse_VP, *(*itr), vertices);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void handle(const osg::Matrix& inverse_VP, osgGA::GUIEventAdapter& ea, osg::Vec3Array* vertices)
|
||||
{
|
||||
osg::Vec3d start_eye(ea.getXnormalized(), ea.getYnormalized(), 0.0);
|
||||
osg::Vec3d end_eye(ea.getXnormalized(), ea.getYnormalized(), 1.0);
|
||||
|
||||
osg::Vec3d start_world = start_eye * inverse_VP;
|
||||
osg::Vec3d end_world = start_eye * inverse_VP;
|
||||
|
||||
osg::notify(osg::NOTICE)<<"start_world="<<start_world<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"end_world="<<end_world<<std::endl;
|
||||
|
||||
(*vertices)[0] = start_world;
|
||||
(*vertices)[1] = end_world;
|
||||
}
|
||||
};
|
||||
|
||||
class FollowMouseCallback: public osgGA::GUIEventHandler
|
||||
{
|
||||
public:
|
||||
|
||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv)
|
||||
{
|
||||
osg::AutoTransform* transform = dynamic_cast<osg::AutoTransform*>(object);
|
||||
if (!transform) return false;
|
||||
|
||||
switch(ea.getEventType())
|
||||
{
|
||||
case(osgGA::GUIEventAdapter::FRAME):
|
||||
//case(osgGA::GUIEventAdapter::MOVE):
|
||||
//case(osgGA::GUIEventAdapter::DRAG):
|
||||
{
|
||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
|
||||
|
||||
transform->setNodeMask(0x0);
|
||||
|
||||
osg::notify(osg::NOTICE)<<std::endl<<"ea.getGraphicsContext()="<<ea.getGraphicsContext()<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"ea.getWindowWidth()="<<ea.getWindowWidth()<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"ea.getWindowHeight()="<<ea.getWindowHeight()<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"ea.getX()="<<ea.getX()<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"ea.getXin()="<<ea.getXmin()<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"ea.getXmax()="<<ea.getXmax()<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"ea.getY()="<<ea.getY()<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"ea.getYin()="<<ea.getYmin()<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"ea.getYmax()="<<ea.getYmax()<<std::endl;
|
||||
|
||||
osg::Camera* camera = view->getCamera();
|
||||
osg::Matrix VP = camera->getViewMatrix() * camera->getProjectionMatrix();
|
||||
|
||||
osg::Matrix inverse_VP;
|
||||
inverse_VP.invert(VP);
|
||||
|
||||
osg::Vec3d start_eye(ea.getXnormalized(), ea.getYnormalized(), 0.0);
|
||||
osg::Vec3d end_eye(ea.getXnormalized(), ea.getYnormalized(), 1.0);
|
||||
|
||||
osg::Vec3d start_world = start_eye * inverse_VP;
|
||||
osg::Vec3d end_world = start_eye * inverse_VP;
|
||||
|
||||
osg::notify(osg::NOTICE)<<"start_world="<<start_world<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"end_world="<<end_world<<std::endl;
|
||||
|
||||
transform->setPosition(end_world);
|
||||
|
||||
transform->setNodeMask(0xffffffff);
|
||||
|
||||
break;
|
||||
}
|
||||
case(osgGA::GUIEventAdapter::KEYDOWN):
|
||||
{
|
||||
if (ea.getKey()=='c')
|
||||
{
|
||||
for(unsigned int i=0; i< transform->getNumChildren(); ++i)
|
||||
{
|
||||
osg::Node* node = transform->getChild(i);
|
||||
node->setNodeMask(
|
||||
node->getNodeMask()!=0 ?
|
||||
0 :
|
||||
0xffffff);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void accept(osgGA::GUIEventHandlerVisitor& v)
|
||||
{
|
||||
v.visit(*this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
osg::Node* createCursorSubgraph(const std::string& filename, float size)
|
||||
{
|
||||
osg::Geode* geode = new osg::Geode;
|
||||
|
||||
size = 20.0f;
|
||||
|
||||
osg::Geometry* geom = osg::createTexturedQuadGeometry(osg::Vec3(-size*0.5f,-size*0.5f,0.0f),osg::Vec3(size,0.0f,0.0f),osg::Vec3(0.0f,size,0.0f));
|
||||
|
||||
osg::Image* image = osgDB::readImageFile(osgDB::findDataFile(filename));
|
||||
if (image)
|
||||
{
|
||||
osg::StateSet* stateset = geom->getOrCreateStateSet();
|
||||
stateset->setTextureAttributeAndModes(0, new osg::Texture2D(image),osg::StateAttribute::ON);
|
||||
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
|
||||
// stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
|
||||
stateset->setRenderBinDetails(1000, "DepthSortedBin");
|
||||
}
|
||||
|
||||
geode->addDrawable(geom);
|
||||
|
||||
osg::AutoTransform* transform = new osg::AutoTransform;
|
||||
transform->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_CAMERA);
|
||||
transform->setAutoScaleToScreen(true);
|
||||
|
||||
transform->addChild(geode);
|
||||
|
||||
transform->setEventCallback(new FollowMouseCallback());
|
||||
|
||||
return transform;
|
||||
|
||||
}
|
||||
#else
|
||||
class FollowMouseCallback: public osgGA::GUIEventHandler
|
||||
{
|
||||
public:
|
||||
|
||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&, osg::Object* object, osg::NodeVisitor*)
|
||||
{
|
||||
|
||||
switch(ea.getEventType())
|
||||
{
|
||||
case(osgGA::GUIEventAdapter::MOVE):
|
||||
case(osgGA::GUIEventAdapter::DRAG):
|
||||
{
|
||||
osg::Camera* camera = dynamic_cast<osg::Camera*>(object);
|
||||
if (camera)
|
||||
{
|
||||
double x = ea.getXnormalized();
|
||||
double y = ea.getYnormalized();
|
||||
|
||||
camera->setViewMatrix(osg::Matrixd::translate(x,y,0.0));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case(osgGA::GUIEventAdapter::KEYDOWN):
|
||||
{
|
||||
if (ea.getKey()=='c')
|
||||
{
|
||||
osg::Camera* camera = dynamic_cast<osg::Camera*>(object);
|
||||
if (camera)
|
||||
{
|
||||
for(unsigned int i=0; i< camera->getNumChildren(); ++i)
|
||||
{
|
||||
osg::Node* node = camera->getChild(i);
|
||||
node->setNodeMask(
|
||||
node->getNodeMask()!=0 ?
|
||||
0 :
|
||||
0xffffff);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void accept(osgGA::GUIEventHandlerVisitor& v)
|
||||
{
|
||||
v.visit(*this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
osg::Node* createCursorSubgraph(const std::string& filename, float size)
|
||||
{
|
||||
osg::Geode* geode = new osg::Geode;
|
||||
|
||||
osg::Geometry* geom = osg::createTexturedQuadGeometry(osg::Vec3(-size*0.5f,-size*0.5f,0.0f),osg::Vec3(size,0.0f,0.0f),osg::Vec3(0.0f,size,0.0f));
|
||||
|
||||
osg::Image* image = osgDB::readImageFile(osgDB::findDataFile(filename));
|
||||
if (image)
|
||||
{
|
||||
osg::StateSet* stateset = geom->getOrCreateStateSet();
|
||||
stateset->setTextureAttributeAndModes(0, new osg::Texture2D(image),osg::StateAttribute::ON);
|
||||
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
|
||||
stateset->setRenderBinDetails(1000, "DepthSortedBin");
|
||||
}
|
||||
|
||||
geode->addDrawable(geom);
|
||||
|
||||
osg::Camera* camera = new osg::Camera;
|
||||
|
||||
// set the projection matrix
|
||||
camera->setProjectionMatrix(osg::Matrix::ortho2D(-1,1,-1,1));
|
||||
|
||||
// set the view matrix
|
||||
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||
camera->setViewMatrix(osg::Matrix::identity());
|
||||
|
||||
// only clear the depth buffer
|
||||
camera->setClearMask(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// draw subgraph after main camera view.
|
||||
camera->setRenderOrder(osg::CameraNode::NESTED_RENDER);
|
||||
|
||||
camera->addChild(geode);
|
||||
|
||||
camera->setEventCallback(new FollowMouseCallback());
|
||||
|
||||
return camera;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
enum P3DApplicationType
|
||||
{
|
||||
VIEWER,
|
||||
MASTER,
|
||||
SLAVE
|
||||
};
|
||||
|
||||
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
// use an ArgumentParser object to manage the program arguments.
|
||||
osg::ArgumentParser arguments(&argc,argv);
|
||||
|
||||
// set up the usage document, in case we need to print out how to use this program.
|
||||
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the application for presenting 3D interactive slide shows.");
|
||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-a","Turn auto stepping on by default");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-d <float>","Time duration in seconds between layers/slides");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-s <float> <float> <float>","width, height, distance and of the screen away from the viewer");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--viewer","Start Present3D as the viewer version.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--authoring","Start Presen3D as the authoring version, license required.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--master","Start Present3D as the master version, license required.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--slave","Start Present3D as the slave version, license required.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--publishing","Start Present3D as the publishing version, license required.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--timeDelayOnNewSlideWithMovies","Set the time delay on new slide with movies, done to allow movie threads to get in sync with rendering thread.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--targetFrameRate","Set the target frame rate, defaults to 80Hz.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--version","Report the Present3D version.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--print <filename>","Print out slides to a series of image files.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--html <filename>","Print out slides to a series of html & image files.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--loop","Switch on looping of presentation.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--devices","Print the Video input capability via QuickTime and exit.");
|
||||
|
||||
// add alias from xml to p3d to provide backwards compatibility for old p3d files.
|
||||
osgDB::Registry::instance()->addFileExtensionAlias("xml","p3d");
|
||||
|
||||
// if user requests devices video capability.
|
||||
if (arguments.read("-devices") || arguments.read("--devices"))
|
||||
{
|
||||
// Force load QuickTime plugin, probe video capability, exit
|
||||
osgDB::readImageFile("devices.live");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// read any env vars from presentations before we create viewer to make sure the viewer
|
||||
// utilises these env vars
|
||||
if (p3d::readEnvVars(arguments))
|
||||
{
|
||||
osg::DisplaySettings::instance()->readEnvironmentalVariables();
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_SDL
|
||||
SDLIntegration sdlIntegration;
|
||||
|
||||
osg::notify(osg::INFO)<<"USE_SDL"<<std::endl;
|
||||
#endif
|
||||
|
||||
bool doSetViewer = true;
|
||||
std::string configurationFile;
|
||||
|
||||
// check env vars for configuration file
|
||||
const char* str = getenv("PRESENT3D_CONFIG_FILE");
|
||||
if (!str) str = getenv("OSG_CONFIG_FILE");
|
||||
if (str) configurationFile = str;
|
||||
|
||||
// check command line parameters for configuration file.
|
||||
while (arguments.read("-c",configurationFile)) {}
|
||||
|
||||
osg::Vec4 clearColor(0.0f,0.0f,0.0f,0.0f);
|
||||
|
||||
while (arguments.read("--clear-color",clearColor[0],clearColor[1],clearColor[2],clearColor[3])) {}
|
||||
|
||||
// construct the viewer.
|
||||
osgViewer::Viewer viewer(arguments);
|
||||
|
||||
// set clear colour to black by default.
|
||||
viewer.getCamera()->setClearColor(clearColor);
|
||||
|
||||
if (!configurationFile.empty())
|
||||
{
|
||||
viewer.readConfiguration(configurationFile);
|
||||
doSetViewer = false;
|
||||
}
|
||||
|
||||
// set up stereo masks
|
||||
viewer.getCamera()->setCullMask(0xffffffff);
|
||||
viewer.getCamera()->setCullMaskLeft(0x00000001);
|
||||
viewer.getCamera()->setCullMaskRight(0x00000002);
|
||||
|
||||
// set up the camera manipulators.
|
||||
{
|
||||
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
|
||||
|
||||
keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
|
||||
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
|
||||
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
|
||||
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
|
||||
|
||||
std::string pathfile;
|
||||
char keyForAnimationPath = '5';
|
||||
while (arguments.read("-p",pathfile))
|
||||
{
|
||||
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||
if (apm || !apm->valid())
|
||||
{
|
||||
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
||||
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
||||
keyswitchManipulator->selectMatrixManipulator(num);
|
||||
++keyForAnimationPath;
|
||||
}
|
||||
}
|
||||
|
||||
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
||||
}
|
||||
|
||||
// add the state manipulator
|
||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||
|
||||
// add the state manipulator
|
||||
viewer.addEventHandler( new osgViewer::StatsHandler() );
|
||||
|
||||
viewer.addEventHandler( new osgViewer::WindowSizeHandler() );
|
||||
|
||||
// neeed to address.
|
||||
// viewer.getScene()->getUpdateVisitor()->setTraversalMode(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN);
|
||||
|
||||
|
||||
const char* p3dCursor = getenv("P3D_CURSOR");
|
||||
std::string cursorFileName( p3dCursor ? p3dCursor : "");
|
||||
while (arguments.read("--cursor",cursorFileName)) {}
|
||||
|
||||
|
||||
while (arguments.read("--set-viewer")) { doSetViewer = true; }
|
||||
|
||||
while (arguments.read("--no-set-viewer")) { doSetViewer = false; }
|
||||
|
||||
|
||||
// cluster related entries.
|
||||
int socketNumber=8100;
|
||||
while (arguments.read("-n",socketNumber)) {}
|
||||
|
||||
float camera_fov=-1.0f;
|
||||
while (arguments.read("-f",camera_fov)) {}
|
||||
|
||||
float camera_offset=45.0f;
|
||||
while (arguments.read("-o",camera_offset)) {}
|
||||
|
||||
|
||||
std::string exportName;
|
||||
while (arguments.read("--print",exportName)) {}
|
||||
|
||||
while (arguments.read("--html",exportName)) {}
|
||||
|
||||
// read any time delay argument.
|
||||
float timeDelayBetweenSlides = 1.0f;
|
||||
while (arguments.read("-d",timeDelayBetweenSlides)) {}
|
||||
|
||||
bool autoSteppingActive = false;
|
||||
while (arguments.read("-a")) autoSteppingActive = true;
|
||||
|
||||
bool loopPresentation = false;
|
||||
while (arguments.read("--loop")) loopPresentation = true;
|
||||
|
||||
|
||||
// register the slide event handler - which moves the presentation from slide to slide, layer to layer.
|
||||
osgPresentation::SlideEventHandler* seh = new osgPresentation::SlideEventHandler(&viewer);
|
||||
viewer.addEventHandler(seh);
|
||||
|
||||
seh->setAutoSteppingActive(autoSteppingActive);
|
||||
seh->setTimeDelayBetweenSlides(timeDelayBetweenSlides);
|
||||
seh->setLoopPresentation(loopPresentation);
|
||||
|
||||
double targetFrameRate = 80.0;
|
||||
while (arguments.read("--targetFrameRate",targetFrameRate)) {}
|
||||
|
||||
|
||||
// set the time delay
|
||||
float timeDelayOnNewSlideWithMovies = 0.4f;
|
||||
while (arguments.read("--timeDelayOnNewSlideWithMovies",timeDelayOnNewSlideWithMovies)) {}
|
||||
seh->setTimeDelayOnNewSlideWithMovies(timeDelayOnNewSlideWithMovies);
|
||||
|
||||
// set up optimizer options
|
||||
unsigned int optimizer_options = osgUtil::Optimizer::DEFAULT_OPTIMIZATIONS;
|
||||
bool relase_and_compile = false;
|
||||
while (arguments.read("--release-and-compile"))
|
||||
{
|
||||
relase_and_compile = true;
|
||||
}
|
||||
seh->setReleaseAndCompileOnEachNewSlide(relase_and_compile);
|
||||
if (relase_and_compile)
|
||||
{
|
||||
// make sure that imagery stays around after being applied to textures.
|
||||
viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false);
|
||||
optimizer_options &= ~osgUtil::Optimizer::OPTIMIZE_TEXTURE_SETTINGS;
|
||||
}
|
||||
//
|
||||
// osgDB::Registry::instance()->getOrCreateDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false);
|
||||
// optimizer_options &= ~osgUtil::Optimizer::OPTIMIZE_TEXTURE_SETTINGS;
|
||||
// osg::Texture::getTextureObjectManager()->setExpiryDelay(0.0f);
|
||||
// osgDB::Registry::instance()->getOrCreateDatabasePager()->setExpiryDelay(1.0f);
|
||||
|
||||
// register the handler for modifying the point size
|
||||
PointsEventHandler* peh = new PointsEventHandler;
|
||||
viewer.addEventHandler(peh);
|
||||
|
||||
// osg::DisplaySettings::instance()->setSplitStereoAutoAjustAspectRatio(false);
|
||||
|
||||
float width = osg::DisplaySettings::instance()->getScreenWidth();
|
||||
float height = osg::DisplaySettings::instance()->getScreenHeight();
|
||||
float distance = osg::DisplaySettings::instance()->getScreenDistance();
|
||||
bool sizesSpecified = false;
|
||||
while (arguments.read("-s", width, height, distance))
|
||||
{
|
||||
sizesSpecified = true;
|
||||
|
||||
osg::DisplaySettings::instance()->setScreenDistance(distance);
|
||||
osg::DisplaySettings::instance()->setScreenHeight(height);
|
||||
osg::DisplaySettings::instance()->setScreenWidth(width);
|
||||
}
|
||||
|
||||
std::string outputFileName;
|
||||
while(arguments.read("--output",outputFileName)) {}
|
||||
|
||||
|
||||
// get details on keyboard and mouse bindings used by the viewer.
|
||||
viewer.getUsage(*arguments.getApplicationUsage());
|
||||
|
||||
// if user request help write it out to cout.
|
||||
if (arguments.read("-h") || arguments.read("--help"))
|
||||
{
|
||||
arguments.getApplicationUsage()->write(osg::notify(osg::NOTICE));
|
||||
return 1;
|
||||
}
|
||||
|
||||
P3DApplicationType P3DApplicationType = VIEWER;
|
||||
|
||||
str = getenv("PRESENT3D_TYPE");
|
||||
if (str)
|
||||
{
|
||||
if (strcmp(str,"viewer")==0) P3DApplicationType = VIEWER;
|
||||
else if (strcmp(str,"master")==0) P3DApplicationType = MASTER;
|
||||
else if (strcmp(str,"slave")==0) P3DApplicationType = SLAVE;
|
||||
}
|
||||
|
||||
while (arguments.read("--viewer")) { P3DApplicationType = VIEWER; }
|
||||
while (arguments.read("--master")) { P3DApplicationType = MASTER; }
|
||||
while (arguments.read("--slave")) { P3DApplicationType = SLAVE; }
|
||||
|
||||
while (arguments.read("--version"))
|
||||
{
|
||||
std::string appTypeName = "invalid";
|
||||
switch(P3DApplicationType)
|
||||
{
|
||||
case(VIEWER): appTypeName = "viewer"; break;
|
||||
case(MASTER): appTypeName = "master"; break;
|
||||
case(SLAVE): appTypeName = "slave"; break;
|
||||
}
|
||||
|
||||
osg::notify(osg::NOTICE)<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"Present3D "<<appTypeName<<" version : "<<s_version<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// any option left unread are converted into errors to write out later.
|
||||
//arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have ocured when parsing the program aguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(osg::notify(osg::INFO));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// read files name from arguments.
|
||||
p3d::FileNameList xmlFiles, normalFiles;
|
||||
if (!p3d::getFileNames(arguments, xmlFiles, normalFiles))
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"No file specified, please specify and file to load."<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool viewerInitialized = false;
|
||||
if (!xmlFiles.empty())
|
||||
{
|
||||
osg::ref_ptr<osg::Node> holdingModel = p3d::readHoldingSlide(xmlFiles.front());
|
||||
|
||||
if (holdingModel.valid())
|
||||
{
|
||||
viewer.setSceneData(holdingModel.get());
|
||||
|
||||
seh->selectSlide(0);
|
||||
|
||||
if (!viewerInitialized)
|
||||
{
|
||||
// pass the global stateset to the point event handler so that it can
|
||||
// alter the point size of all points in the scene.
|
||||
peh->setStateSet(viewer.getCamera()->getOrCreateStateSet());
|
||||
|
||||
// create the windows and run the threads.
|
||||
viewer.realize();
|
||||
|
||||
if (doSetViewer) setViewer(viewer, width, height, distance);
|
||||
|
||||
viewerInitialized = true;
|
||||
}
|
||||
|
||||
seh->home();
|
||||
|
||||
// render a frame
|
||||
viewer.frame();
|
||||
}
|
||||
}
|
||||
|
||||
osg::Timer timer;
|
||||
osg::Timer_t start_tick = timer.tick();
|
||||
|
||||
|
||||
osg::ref_ptr<osgDB::ReaderWriter::Options> cacheAllOption = new osgDB::ReaderWriter::Options;
|
||||
cacheAllOption->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_ALL);
|
||||
|
||||
osgDB::Registry::instance()->setOptions(cacheAllOption.get());
|
||||
|
||||
// read the scene from the list of file specified commandline args.
|
||||
osg::ref_ptr<osg::Node> loadedModel = p3d::readShowFiles(arguments,cacheAllOption.get()); // osgDB::readNodeFiles(arguments, cacheAllOption.get());
|
||||
|
||||
|
||||
osgDB::Registry::instance()->setOptions( 0 );
|
||||
|
||||
|
||||
// if no model has been successfully loaded report failure.
|
||||
if (!loadedModel)
|
||||
{
|
||||
osg::notify(osg::INFO) << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
osg::Timer_t end_tick = timer.tick();
|
||||
|
||||
osg::notify(osg::INFO) << "Time to load = "<<timer.delta_s(start_tick,end_tick)<<std::endl;
|
||||
|
||||
|
||||
if (loadedModel->getNumDescriptions()>0)
|
||||
{
|
||||
for(unsigned int i=0; i<loadedModel->getNumDescriptions(); ++i)
|
||||
{
|
||||
const std::string& desc = loadedModel->getDescription(i);
|
||||
if (desc=="loop")
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Enabling looping"<<std::endl;
|
||||
seh->setLoopPresentation(true);
|
||||
}
|
||||
else if (desc=="auto")
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Enabling auto run"<<std::endl;
|
||||
seh->setAutoSteppingActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
|
||||
// add back in enabling of the GL_ALPHA_TEST to get around the core OSG no longer setting it by default for opaque bins.
|
||||
// the alpha test is required for the volume rendering alpha clipping to work.
|
||||
loadedModel->getOrCreateStateSet()->setMode(GL_ALPHA_TEST, osg::StateAttribute::ON);
|
||||
#endif
|
||||
|
||||
|
||||
// optimize the scene graph, remove rendundent nodes and state etc.
|
||||
osgUtil::Optimizer optimizer;
|
||||
optimizer.optimize(loadedModel.get(), optimizer_options);
|
||||
|
||||
if (!cursorFileName.empty())
|
||||
{
|
||||
osg::ref_ptr<osg::Group> group = new osg::Group;
|
||||
group->addChild(loadedModel.get());
|
||||
group->addChild(createCursorSubgraph(cursorFileName, 0.05f));
|
||||
|
||||
loadedModel = group.get();
|
||||
}
|
||||
|
||||
// set the scene to render
|
||||
viewer.setSceneData(loadedModel.get());
|
||||
|
||||
if (!viewerInitialized)
|
||||
{
|
||||
// pass the global stateset to the point event handler so that it can
|
||||
// alter the point size of all points in the scene.
|
||||
peh->setStateSet(viewer.getCamera()->getOrCreateStateSet());
|
||||
|
||||
// create the windows and run the threads.
|
||||
viewer.realize();
|
||||
|
||||
if (doSetViewer) setViewer(viewer, width, height, distance);
|
||||
|
||||
viewerInitialized = true;
|
||||
}
|
||||
|
||||
if (!cursorFileName.empty())
|
||||
{
|
||||
// have to add a frame in here to avoid problems with X11 threading issue on switching off the cursor
|
||||
// not yet sure why it makes a difference, but it at least fixes the crash that would otherwise occur
|
||||
// under X11.
|
||||
viewer.frame();
|
||||
|
||||
// switch off the cursor
|
||||
osgViewer::Viewer::Windows windows;
|
||||
viewer.getWindows(windows);
|
||||
for(osgViewer::Viewer::Windows::iterator itr = windows.begin();
|
||||
itr != windows.end();
|
||||
++itr)
|
||||
{
|
||||
(*itr)->useCursor(false);
|
||||
}
|
||||
}
|
||||
|
||||
// pass the model to the slide event handler so it knows which to manipulate.
|
||||
seh->set(loadedModel.get());
|
||||
seh->selectSlide(0);
|
||||
|
||||
seh->home();
|
||||
|
||||
if (!outputFileName.empty())
|
||||
{
|
||||
osgDB::writeNodeFile(*loadedModel,outputFileName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
osg::Timer_t startOfFrameTick = osg::Timer::instance()->tick();
|
||||
double targetFrameTime = 1.0/targetFrameRate;
|
||||
|
||||
if (exportName.empty())
|
||||
{
|
||||
// objects for managing the broadcasting and recieving of camera packets.
|
||||
CameraPacket cp;
|
||||
Broadcaster bc;
|
||||
Receiver rc;
|
||||
bc.setPort(static_cast<short int>(socketNumber));
|
||||
rc.setPort(static_cast<short int>(socketNumber));
|
||||
|
||||
bool masterKilled = false;
|
||||
DataConverter scratchPad(1024);
|
||||
|
||||
while( !viewer.done() && !masterKilled)
|
||||
{
|
||||
// wait for all cull and draw threads to complete.
|
||||
viewer.advance();
|
||||
|
||||
osg::Timer_t currentTick = osg::Timer::instance()->tick();
|
||||
double deltaTime = osg::Timer::instance()->delta_s(startOfFrameTick, currentTick);
|
||||
|
||||
|
||||
if (deltaTime<targetFrameTime)
|
||||
{
|
||||
OpenThreads::Thread::microSleep(static_cast<unsigned int>((targetFrameTime-deltaTime)*1000000.0));
|
||||
}
|
||||
|
||||
startOfFrameTick = osg::Timer::instance()->tick();
|
||||
|
||||
#if 0
|
||||
if (kmcb)
|
||||
{
|
||||
double time = kmcb->getTime();
|
||||
viewer.getFrameStamp()->setReferenceTime(time);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_SDL
|
||||
sdlIntegration.update(viewer);
|
||||
#endif
|
||||
|
||||
if (P3DApplicationType==MASTER)
|
||||
{
|
||||
// take camera zero as the guide.
|
||||
osg::Matrix modelview(viewer.getCamera()->getViewMatrix());
|
||||
|
||||
cp.setPacket(modelview,viewer.getFrameStamp());
|
||||
|
||||
// cp.readEventQueue(viewer);
|
||||
|
||||
scratchPad.reset();
|
||||
scratchPad.write(cp);
|
||||
|
||||
scratchPad.reset();
|
||||
scratchPad.read(cp);
|
||||
|
||||
bc.setBuffer(scratchPad._startPtr, scratchPad._numBytes);
|
||||
|
||||
std::cout << "bc.sync()"<<scratchPad._numBytes<<std::endl;
|
||||
|
||||
bc.sync();
|
||||
}
|
||||
else if (P3DApplicationType==SLAVE)
|
||||
{
|
||||
rc.setBuffer(scratchPad._startPtr, scratchPad._numBytes);
|
||||
|
||||
rc.sync();
|
||||
|
||||
scratchPad.reset();
|
||||
scratchPad.read(cp);
|
||||
|
||||
// cp.writeEventQueue(viewer);
|
||||
|
||||
if (cp.getMasterKilled())
|
||||
{
|
||||
std::cout << "Received master killed."<<std::endl;
|
||||
// break out of while (!done) loop since we've now want to shut down.
|
||||
masterKilled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// update the scene by traversing it with the the update visitor which will
|
||||
// call all node update callbacks and animations.
|
||||
viewer.eventTraversal();
|
||||
|
||||
// update the scene by traversing it with the the update visitor which will
|
||||
// call all node update callbacks and animations.
|
||||
viewer.updateTraversal();
|
||||
|
||||
if (P3DApplicationType==SLAVE)
|
||||
{
|
||||
osg::Matrix modelview;
|
||||
cp.getModelView(modelview,camera_offset);
|
||||
|
||||
viewer.getCamera()->setViewMatrix(modelview);
|
||||
}
|
||||
|
||||
// fire off the cull and draw traversals of the scene.
|
||||
if(!masterKilled)
|
||||
viewer.renderingTraversals();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ExportHTML::write(seh, viewer, exportName);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ SET(TARGET_COMMON_LIBRARIES
|
||||
osgText
|
||||
)
|
||||
|
||||
|
||||
IF(DYNAMIC_OPENSCENEGRAPH)
|
||||
|
||||
ADD_SUBDIRECTORY(osg2cpp)
|
||||
@@ -32,7 +31,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
||||
ADD_SUBDIRECTORY(osgcubemap)
|
||||
ADD_SUBDIRECTORY(osgdelaunay)
|
||||
ADD_SUBDIRECTORY(osgcluster)
|
||||
ADD_SUBDIRECTORY(osgdatabaserevisions)
|
||||
ADD_SUBDIRECTORY(osgdepthpartition)
|
||||
ADD_SUBDIRECTORY(osgdepthpeeling)
|
||||
ADD_SUBDIRECTORY(osgdrawinstanced)
|
||||
@@ -41,7 +39,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
||||
ADD_SUBDIRECTORY(osgfont)
|
||||
ADD_SUBDIRECTORY(osgforest)
|
||||
ADD_SUBDIRECTORY(osgfxbrowser)
|
||||
ADD_SUBDIRECTORY(osgoutline)
|
||||
ADD_SUBDIRECTORY(osggameoflife)
|
||||
ADD_SUBDIRECTORY(osggeodemo)
|
||||
ADD_SUBDIRECTORY(osggeometry)
|
||||
@@ -59,13 +56,12 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
||||
ADD_SUBDIRECTORY(osglightpoint)
|
||||
ADD_SUBDIRECTORY(osglogicop)
|
||||
ADD_SUBDIRECTORY(osglogo)
|
||||
ADD_SUBDIRECTORY(osggpx)
|
||||
ADD_SUBDIRECTORY(osgmanipulator)
|
||||
ADD_SUBDIRECTORY(osgmotionblur)
|
||||
ADD_SUBDIRECTORY(osgmovie)
|
||||
ADD_SUBDIRECTORY(osgmultiplerendertargets)
|
||||
ADD_SUBDIRECTORY(osgmultitexture)
|
||||
ADD_SUBDIRECTORY(osgmultitexturecontrol)
|
||||
ADD_SUBDIRECTORY(osgmultiviewpaging)
|
||||
ADD_SUBDIRECTORY(osgoccluder)
|
||||
ADD_SUBDIRECTORY(osgocclusionquery)
|
||||
ADD_SUBDIRECTORY(osgpackeddepthstencil)
|
||||
@@ -73,6 +69,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
||||
ADD_SUBDIRECTORY(osgparametric)
|
||||
ADD_SUBDIRECTORY(osgparticle)
|
||||
ADD_SUBDIRECTORY(osgparticleeffects)
|
||||
ADD_SUBDIRECTORY(osgphotoalbum)
|
||||
ADD_SUBDIRECTORY(osgpick)
|
||||
ADD_SUBDIRECTORY(osgplanets)
|
||||
ADD_SUBDIRECTORY(osgpoints)
|
||||
@@ -83,12 +80,11 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
||||
ADD_SUBDIRECTORY(osgreflect)
|
||||
ADD_SUBDIRECTORY(osgrobot)
|
||||
ADD_SUBDIRECTORY(osgscalarbar)
|
||||
ADD_SUBDIRECTORY(osgscreencapture)
|
||||
ADD_SUBDIRECTORY(osgscribe)
|
||||
ADD_SUBDIRECTORY(osgsequence)
|
||||
ADD_SUBDIRECTORY(osgshaders)
|
||||
ADD_SUBDIRECTORY(osgshadergen)
|
||||
ADD_SUBDIRECTORY(osgshaderterrain)
|
||||
ADD_SUBDIRECTORY(osgshadercompositor)
|
||||
ADD_SUBDIRECTORY(osgshadow)
|
||||
ADD_SUBDIRECTORY(osgshape)
|
||||
ADD_SUBDIRECTORY(osgsharedarray)
|
||||
@@ -101,28 +97,26 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
||||
ADD_SUBDIRECTORY(osgspotlight)
|
||||
ADD_SUBDIRECTORY(osgstereoimage)
|
||||
ADD_SUBDIRECTORY(osgstereomatch)
|
||||
ADD_SUBDIRECTORY(osgteapot)
|
||||
ADD_SUBDIRECTORY(osgterrain)
|
||||
ADD_SUBDIRECTORY(osgtessellate)
|
||||
ADD_SUBDIRECTORY(osgtext)
|
||||
ADD_SUBDIRECTORY(osgtext3D)
|
||||
ADD_SUBDIRECTORY(osgtexture1D)
|
||||
ADD_SUBDIRECTORY(osgtexture2D)
|
||||
ADD_SUBDIRECTORY(osgtexture3D)
|
||||
ADD_SUBDIRECTORY(osgtexturerectangle)
|
||||
ADD_SUBDIRECTORY(osgtexturecompression)
|
||||
ADD_SUBDIRECTORY(osgthirdpersonview)
|
||||
ADD_SUBDIRECTORY(osgvertexprogram)
|
||||
ADD_SUBDIRECTORY(osgvertexattributes)
|
||||
ADD_SUBDIRECTORY(osgvolume)
|
||||
ADD_SUBDIRECTORY(osgwindows)
|
||||
ADD_SUBDIRECTORY(osganimationhardware)
|
||||
ADD_SUBDIRECTORY(osganimationtimeline)
|
||||
ADD_SUBDIRECTORY(osganimationnode)
|
||||
ADD_SUBDIRECTORY(osganimationmakepath)
|
||||
ADD_SUBDIRECTORY(osganimationmorph)
|
||||
ADD_SUBDIRECTORY(osganimationskinning)
|
||||
ADD_SUBDIRECTORY(osganimationsolid)
|
||||
ADD_SUBDIRECTORY(osganimationviewer)
|
||||
ADD_SUBDIRECTORY(osganimationeasemotion)
|
||||
ADD_SUBDIRECTORY(osgbrowser)
|
||||
ADD_SUBDIRECTORY(osgwidgetaddremove)
|
||||
ADD_SUBDIRECTORY(osgwidgetbox)
|
||||
@@ -145,17 +139,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
||||
ADD_SUBDIRECTORY(osgmemorytest)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE AND NOT OSG_GL3_AVAILABLE)
|
||||
ADD_SUBDIRECTORY(osgscreencapture)
|
||||
ADD_SUBDIRECTORY(osgmotionblur)
|
||||
ADD_SUBDIRECTORY(osgteapot)
|
||||
ENDIF()
|
||||
|
||||
IF(OSG_GLU_AVAILABLE)
|
||||
ADD_SUBDIRECTORY(osgphotoalbum)
|
||||
ADD_SUBDIRECTORY(osgtessellate)
|
||||
ENDIF()
|
||||
|
||||
ADD_SUBDIRECTORY(osgpdf)
|
||||
|
||||
IF (BUILD_OSG_WRAPPERS)
|
||||
@@ -188,14 +171,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
||||
IF (BUILD_QT_EXAMPLES AND QT_QTOPENGL_LIBRARY)
|
||||
ADD_SUBDIRECTORY(osgviewerQT)
|
||||
ENDIF()
|
||||
|
||||
IF (BUILD_QT_EXAMPLES AND QT4_FOUND)
|
||||
ADD_SUBDIRECTORY(osgviewerQtWidget)
|
||||
|
||||
IF (QT_QTWEBKIT_FOUND)
|
||||
ADD_SUBDIRECTORY(osgQtBrowser)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF (FLTK_FOUND)
|
||||
|
||||
@@ -7,16 +7,6 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// Search in str for all occurences of spat and replace them with rpat.
|
||||
void searchAndReplace(std::string& str, const std::string& spat, const std::string& rpat)
|
||||
{
|
||||
std::string::size_type pos = 0;
|
||||
while ((pos = str.find(spat, pos)) != std::string::npos)
|
||||
{
|
||||
str.replace(pos, spat.length(), rpat);
|
||||
}
|
||||
}
|
||||
|
||||
void writeShader(osg::Shader* shader, const std::string& cppFileName, const std::string& variableName)
|
||||
{
|
||||
osgDB::ofstream fout(cppFileName.c_str());
|
||||
@@ -26,8 +16,6 @@ void writeShader(osg::Shader* shader, const std::string& cppFileName, const std:
|
||||
}
|
||||
|
||||
std::string shaderSource = shader->getShaderSource();
|
||||
searchAndReplace(shaderSource, "\r\n", "\n");
|
||||
searchAndReplace(shaderSource, "\r", "\n");
|
||||
|
||||
std::string variableString = std::string("char ")+variableName+std::string("[] = ");
|
||||
|
||||
@@ -83,7 +71,6 @@ int main( int argc, char **argv )
|
||||
if (shader.valid())
|
||||
{
|
||||
std::string name = osgDB::getStrippedName(filename);
|
||||
std::string path = osgDB::getFilePath(filename);
|
||||
std::string invalidCharacters = "-+/\\*=(){}[]:;<>,.?@'~#`!\"";
|
||||
std::string numbericCharacters = "0123456789";
|
||||
std::string::size_type pos = name.find_first_of(invalidCharacters);
|
||||
@@ -94,7 +81,7 @@ int main( int argc, char **argv )
|
||||
}
|
||||
|
||||
std::string ext = osgDB::getFileExtension(filename);
|
||||
std::string cppFileName = osgDB::concatPaths(path, name + "_" + ext + ".cpp");
|
||||
std::string cppFileName = name + "_" + ext + ".cpp";
|
||||
std::string variableName = name + "_" + ext;
|
||||
writeShader(shader.get(), cppFileName, variableName);
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
SET(TARGET_SRC
|
||||
osgQtBrowser.cpp
|
||||
)
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Remove -pedantic flag as it barfs on Qt headers
|
||||
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
ENDIF()
|
||||
|
||||
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${QT_QTWEBKIT_LIBRARY})
|
||||
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR})
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgWidget osgQt)
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_EXAMPLE(osgQtBrowser)
|
||||
@@ -1,138 +0,0 @@
|
||||
/* OpenSceneGraph example, osgcompositeviewer.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osg/ArgumentParser>
|
||||
#include <osgDB/WriteFile>
|
||||
#include <osgGA/TrackballManipulator>
|
||||
#include <osgGA/StateSetManipulator>
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
#include <osgWidget/Browser>
|
||||
|
||||
|
||||
#include <QtWebKit/QWebSettings>
|
||||
#include <QtWebKit/QtWebKit>
|
||||
#include <QtGui/QGraphicsScene>
|
||||
#include <QtGui/QGraphicsView>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QtEvents>
|
||||
|
||||
#include <osgQt/QGraphicsViewAdapter>
|
||||
#include <osgQt/QWebViewImage>
|
||||
|
||||
|
||||
// Thread that runs the viewer's frame loop as we can't run Qt in the background...
|
||||
class ViewerFrameThread : public OpenThreads::Thread
|
||||
{
|
||||
public:
|
||||
|
||||
ViewerFrameThread(osgViewer::ViewerBase* viewerBase, bool doQApplicationExit):
|
||||
_viewerBase(viewerBase),
|
||||
_doQApplicationExit(doQApplicationExit) {}
|
||||
|
||||
~ViewerFrameThread()
|
||||
{
|
||||
cancel();
|
||||
while(isRunning())
|
||||
{
|
||||
OpenThreads::Thread::YieldCurrentThread();
|
||||
}
|
||||
}
|
||||
|
||||
int cancel()
|
||||
{
|
||||
_viewerBase->setDone(true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void run()
|
||||
{
|
||||
int result = _viewerBase->run();
|
||||
|
||||
if (_doQApplicationExit) QApplication::exit(result);
|
||||
}
|
||||
|
||||
osg::ref_ptr<osgViewer::ViewerBase> _viewerBase;
|
||||
bool _doQApplicationExit;
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// Qt requires that we construct the global QApplication before creating any widgets.
|
||||
QApplication app(argc, argv);
|
||||
|
||||
// use an ArgumentParser object to manage the program arguments.
|
||||
osg::ArgumentParser arguments(&argc,argv);
|
||||
|
||||
bool useFrameLoopThread = true;
|
||||
if (arguments.read("--no-frame-thread")) useFrameLoopThread = false;
|
||||
|
||||
osg::ref_ptr<osgQt::QWebViewImage> image = new osgQt::QWebViewImage;
|
||||
|
||||
if (arguments.argc()>1) image->navigateTo((arguments[1]));
|
||||
else image->navigateTo("http://www.youtube.com/");
|
||||
|
||||
osgWidget::GeometryHints hints(osg::Vec3(0.0f,0.0f,0.0f),
|
||||
osg::Vec3(1.0f,0.0f,0.0f),
|
||||
osg::Vec3(0.0f,0.0f,1.0f),
|
||||
osg::Vec4(1.0f,1.0f,1.0f,1.0f),
|
||||
osgWidget::GeometryHints::RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO);
|
||||
|
||||
|
||||
osg::ref_ptr<osgWidget::Browser> browser = new osgWidget::Browser;
|
||||
browser->assign(image.get(), hints);
|
||||
|
||||
// image->focusBrowser(true);
|
||||
|
||||
osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer(arguments);
|
||||
viewer->setSceneData(browser.get());
|
||||
viewer->setCameraManipulator(new osgGA::TrackballManipulator());
|
||||
viewer->addEventHandler(new osgViewer::StatsHandler);
|
||||
viewer->addEventHandler(new osgViewer::WindowSizeHandler);
|
||||
|
||||
if (useFrameLoopThread)
|
||||
{
|
||||
// create a thread to run the viewer's frame loop
|
||||
ViewerFrameThread viewerThread(viewer.get(), true);
|
||||
viewerThread.startThread();
|
||||
|
||||
// now start the standard Qt event loop, then exists when the viewerThead sends the QApplication::exit() signal.
|
||||
return QApplication::exec();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// run the frame loop, interleaving Qt and the main OSG frame loop
|
||||
while(!viewer->done())
|
||||
{
|
||||
// process Qt events - this handles both events and paints the browser image
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
|
||||
viewer->frame();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
SET(TARGET_SRC osganimationeasemotion.cpp )
|
||||
SET(TARGET_ADDED_LIBRARIES osgAnimation osgWidget)
|
||||
SETUP_EXAMPLE(osganimationeasemotion)
|
||||
@@ -1,362 +0,0 @@
|
||||
/* -*-c++-*-
|
||||
* Copyright (C) 2010 Jeremy Moles <cubicool@gmail.com>
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include <osg/Geode>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/ShapeDrawable>
|
||||
#include <osgGA/TrackballManipulator>
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
#include <osgAnimation/EaseMotion>
|
||||
#include <osgWidget/WindowManager>
|
||||
#include <osgWidget/Box>
|
||||
#include <osgWidget/Table>
|
||||
#include <osgWidget/Label>
|
||||
|
||||
class EaseMotionSampler;
|
||||
|
||||
const unsigned int WINDOW_WIDTH = 800;
|
||||
const unsigned int WINDOW_HEIGHT = 600;
|
||||
const unsigned int MASK_2D = 0xF0000000;
|
||||
const unsigned int MASK_3D = 0x0F000000;
|
||||
const float M_START = 0.0f;
|
||||
const float M_DURATION = 2.0f;
|
||||
const float M_CHANGE = 1.0f;
|
||||
|
||||
EaseMotionSampler* EASE_MOTION_SAMPLER = 0;
|
||||
osg::Geode* EASE_MOTION_GEODE = 0;
|
||||
|
||||
osg::Geometry* createEaseMotionGeometry(osgAnimation::Motion* motion) {
|
||||
osg::Geometry* geom = new osg::Geometry();
|
||||
osg::Vec4Array* cols = new osg::Vec4Array();
|
||||
osg::Vec3Array* v = new osg::Vec3Array();
|
||||
|
||||
for(float i = 0.0f; i < M_DURATION; i += M_DURATION / 256.0f) v->push_back(
|
||||
osg::Vec3(i * 30.0f, motion->getValueAt(i) * 30.0f, 0.0f)
|
||||
);
|
||||
|
||||
cols->push_back(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
geom->setUseDisplayList(false);
|
||||
geom->setVertexArray(v);
|
||||
geom->setColorArray(cols);
|
||||
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, 0, v->size()));
|
||||
|
||||
return geom;
|
||||
}
|
||||
|
||||
struct EaseMotionSampler: public osg::NodeCallback {
|
||||
float _previous;
|
||||
osg::Vec3 _pos;
|
||||
|
||||
osg::ref_ptr<osgAnimation::Motion> _motion;
|
||||
|
||||
EaseMotionSampler(const osg::Vec3& pos):
|
||||
_previous (0.0f),
|
||||
_pos (pos) {
|
||||
}
|
||||
|
||||
void operator()(osg::Node* node, osg::NodeVisitor* nv) {
|
||||
if(!_motion.valid()) return;
|
||||
|
||||
osg::MatrixTransform* mt = dynamic_cast<osg::MatrixTransform*>(node);
|
||||
|
||||
if(!mt) return;
|
||||
|
||||
double t = nv->getFrameStamp()->getSimulationTime();
|
||||
|
||||
// This avoids a little glitch when the animation doesn't start right away
|
||||
// when the application is launched.
|
||||
if(_previous == 0.0f) _previous = t;
|
||||
|
||||
_motion->update(t - _previous);
|
||||
|
||||
_previous = t;
|
||||
|
||||
mt->setMatrix(osg::Matrix::translate(_pos * _motion->getValue()));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void setMotion() {
|
||||
_motion = new T(M_START, M_DURATION, M_CHANGE, osgAnimation::Motion::LOOP);
|
||||
|
||||
EASE_MOTION_GEODE->removeDrawables(0, EASE_MOTION_GEODE->getNumDrawables());
|
||||
EASE_MOTION_GEODE->addDrawable(createEaseMotionGeometry(_motion.get()));
|
||||
}
|
||||
};
|
||||
|
||||
struct ColorLabel: public osgWidget::Label {
|
||||
ColorLabel(const char* label):
|
||||
osgWidget::Label(label, "") {
|
||||
setFont("fonts/VeraMono.ttf");
|
||||
setFontSize(14);
|
||||
setFontColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
setColor(0.3f, 0.3f, 0.3f, 1.0f);
|
||||
setPadding(2.0f);
|
||||
setCanFill(true);
|
||||
|
||||
addSize(150.0f, 25.0f);
|
||||
|
||||
setLabel(label);
|
||||
setEventMask(osgWidget::EVENT_MOUSE_PUSH | osgWidget::EVENT_MASK_MOUSE_MOVE);
|
||||
}
|
||||
|
||||
bool mousePush(double, double, const osgWidget::WindowManager*) {
|
||||
osgWidget::Table* p = dynamic_cast<osgWidget::Table*>(_parent);
|
||||
|
||||
if(!p) return false;
|
||||
|
||||
p->hide();
|
||||
|
||||
const std::string& name = getName();
|
||||
|
||||
if(!name.compare("OutQuadMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::OutQuadMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InQuadMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InQuadMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InOutQuadMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InOutQuadMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("OutCubicMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::OutCubicMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InCubicMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InCubicMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InOutCubicMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InOutCubicMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("OutQuartMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::OutQuartMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InQuartMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InQuartMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InOutQuartMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InOutQuartMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("OutBounceMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::OutBounceMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InBounceMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InBounceMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InOutBounceMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InOutBounceMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("OutElasticMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::OutElasticMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InElasticMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InElasticMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InOutElasticMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InOutElasticMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("OutSineMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::OutSineMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InSineMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InSineMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InOutSineMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InOutSineMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("OutBackMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::OutBackMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InBackMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InBackMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InOutBackMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InOutBackMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("OutCircMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::OutCircMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InCircMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InCircMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InOutCircMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InOutCircMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("OutExpoMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::OutExpoMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InExpoMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InExpoMotion>()
|
||||
;
|
||||
|
||||
else if(!name.compare("InOutExpoMotion"))
|
||||
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InOutExpoMotion>()
|
||||
;
|
||||
|
||||
else EASE_MOTION_SAMPLER->setMotion<osgAnimation::LinearMotion>();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mouseEnter(double, double, const osgWidget::WindowManager*) {
|
||||
setColor(0.9f, 0.6f, 0.1f, 1.0f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mouseLeave(double, double, const osgWidget::WindowManager*) {
|
||||
setColor(0.3f, 0.3f, 0.3f, 1.0f);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class ColorLabelMenu: public ColorLabel {
|
||||
osg::ref_ptr<osgWidget::Table> _window;
|
||||
|
||||
public:
|
||||
ColorLabelMenu(const char* label):
|
||||
ColorLabel(label) {
|
||||
_window = new osgWidget::Table(std::string("Menu_") + label, 6, 5);
|
||||
|
||||
_window->addWidget(new ColorLabel("OutQuadMotion"), 0, 0);
|
||||
_window->addWidget(new ColorLabel("InQuadMotion"), 1, 0);
|
||||
_window->addWidget(new ColorLabel("InOutQuadMotion"), 2, 0);
|
||||
_window->addWidget(new ColorLabel("OutCubicMotion"), 3, 0);
|
||||
_window->addWidget(new ColorLabel("InCubicMotion"), 4, 0);
|
||||
_window->addWidget(new ColorLabel("InOutCubicMotion"), 5, 0);
|
||||
|
||||
_window->addWidget(new ColorLabel("OutQuartMotion"), 0, 1);
|
||||
_window->addWidget(new ColorLabel("InQuartMotion"), 1, 1);
|
||||
_window->addWidget(new ColorLabel("InOutQuartMotion"), 2, 1);
|
||||
_window->addWidget(new ColorLabel("OutBounceMotion"), 3, 1);
|
||||
_window->addWidget(new ColorLabel("InBounceMotion"), 4, 1);
|
||||
_window->addWidget(new ColorLabel("InOutBounceMotion"), 5, 1);
|
||||
|
||||
_window->addWidget(new ColorLabel("OutElasticMotion"), 0, 2);
|
||||
_window->addWidget(new ColorLabel("InElasticMotion"), 1, 2);
|
||||
_window->addWidget(new ColorLabel("InOutElasticMotion"), 2, 2);
|
||||
_window->addWidget(new ColorLabel("OutSineMotion"), 3, 2);
|
||||
_window->addWidget(new ColorLabel("InSineMotion"), 4, 2);
|
||||
_window->addWidget(new ColorLabel("InOutSineMotion"), 5, 2);
|
||||
|
||||
_window->addWidget(new ColorLabel("OutBackMotion"), 0, 3);
|
||||
_window->addWidget(new ColorLabel("InBackMotion"), 1, 3);
|
||||
_window->addWidget(new ColorLabel("InOutBackMotion"), 2, 3);
|
||||
_window->addWidget(new ColorLabel("OutCircMotion"), 3, 3);
|
||||
_window->addWidget(new ColorLabel("InCircMotion"), 4, 3);
|
||||
_window->addWidget(new ColorLabel("InOutCircMotion"), 5, 3);
|
||||
|
||||
_window->addWidget(new ColorLabel("OutExpoMotion"), 0, 4);
|
||||
_window->addWidget(new ColorLabel("InExpoMotion"), 1, 4);
|
||||
_window->addWidget(new ColorLabel("InOutExpoMotion"), 2, 4);
|
||||
_window->addWidget(new ColorLabel("Linear"), 3, 4);
|
||||
|
||||
_window->resize();
|
||||
}
|
||||
|
||||
void managed(osgWidget::WindowManager* wm) {
|
||||
osgWidget::Label::managed(wm);
|
||||
|
||||
wm->addChild(_window.get());
|
||||
|
||||
_window->hide();
|
||||
}
|
||||
|
||||
void positioned() {
|
||||
osgWidget::Label::positioned();
|
||||
|
||||
_window->setOrigin(_parent->getX(), _parent->getY() + _parent->getHeight());
|
||||
}
|
||||
|
||||
bool mousePush(double, double, const osgWidget::WindowManager*) {
|
||||
if(!_window->isVisible()) _window->show();
|
||||
|
||||
else _window->hide();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
osgViewer::Viewer viewer;
|
||||
|
||||
osgWidget::WindowManager* wm = new osgWidget::WindowManager(
|
||||
&viewer,
|
||||
WINDOW_WIDTH,
|
||||
WINDOW_HEIGHT,
|
||||
MASK_2D
|
||||
);
|
||||
|
||||
osgWidget::Window* menu = new osgWidget::Box("menu", osgWidget::Box::HORIZONTAL);
|
||||
|
||||
menu->addWidget(new ColorLabelMenu("Choose EaseMotion"));
|
||||
menu->getBackground()->setColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
menu->setPosition(15.0f, 15.0f, 0.0f);
|
||||
|
||||
wm->addChild(menu);
|
||||
|
||||
osg::Group* group = new osg::Group();
|
||||
osg::Geode* geode = new osg::Geode();
|
||||
osg::MatrixTransform* mt = new osg::MatrixTransform();
|
||||
|
||||
geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(), 4.0f)));
|
||||
|
||||
EASE_MOTION_SAMPLER = new EaseMotionSampler(osg::Vec3(50.0f, 0.0f, 0.0f));
|
||||
EASE_MOTION_GEODE = new osg::Geode();
|
||||
|
||||
mt->addChild(geode);
|
||||
mt->setUpdateCallback(EASE_MOTION_SAMPLER);
|
||||
mt->setNodeMask(MASK_3D);
|
||||
|
||||
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
|
||||
viewer.getCameraManipulator()->setHomePosition(
|
||||
osg::Vec3d(0.0f, 0.0f, 200.0f),
|
||||
osg::Vec3d(20.0f, 0.0f, 0.0f),
|
||||
osg::Vec3d(0.0f, 1.0f, 0.0f)
|
||||
);
|
||||
viewer.home();
|
||||
|
||||
group->addChild(mt);
|
||||
group->addChild(EASE_MOTION_GEODE);
|
||||
|
||||
return osgWidget::createExample(viewer, wm, group);
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
SET(TARGET_SRC osganimationmorph.cpp )
|
||||
SET(TARGET_ADDED_LIBRARIES osgAnimation )
|
||||
SETUP_EXAMPLE(osganimationmorph)
|
||||
@@ -1,127 +0,0 @@
|
||||
/* -*-c++-*-
|
||||
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Geode>
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
#include <osgGA/TrackballManipulator>
|
||||
#include <osgGA/StateSetManipulator>
|
||||
#include <osgUtil/SmoothingVisitor>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgAnimation/MorphGeometry>
|
||||
#include <osgAnimation/BasicAnimationManager>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/WriteFile>
|
||||
|
||||
struct GeometryFinder : public osg::NodeVisitor
|
||||
{
|
||||
osg::ref_ptr<osg::Geometry> _geom;
|
||||
GeometryFinder() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||
void apply(osg::Geode& geode)
|
||||
{
|
||||
if (_geom.valid())
|
||||
return;
|
||||
for (unsigned int i = 0; i < geode.getNumDrawables(); i++)
|
||||
{
|
||||
osg::Geometry* geom = dynamic_cast<osg::Geometry*>(geode.getDrawable(i));
|
||||
if (geom) {
|
||||
_geom = geom;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
osg::Geometry* getShape(const std::string& name)
|
||||
{
|
||||
osg::Node* shape0 = osgDB::readNodeFile(name);
|
||||
GeometryFinder finder;
|
||||
shape0->accept(finder);
|
||||
return finder._geom.get();
|
||||
}
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
osg::ArgumentParser arguments(&argc, argv);
|
||||
osgViewer::Viewer viewer(arguments);
|
||||
|
||||
osgAnimation::Animation* animation = new osgAnimation::Animation;
|
||||
osgAnimation::FloatLinearChannel* channel0 = new osgAnimation::FloatLinearChannel;
|
||||
channel0->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::FloatKeyframe(0,0.0));
|
||||
channel0->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::FloatKeyframe(1,1.0));
|
||||
channel0->setTargetName("MorphNodeCallback");
|
||||
channel0->setName("0");
|
||||
|
||||
animation->addChannel(channel0);
|
||||
animation->setName("Morph");
|
||||
animation->computeDuration();
|
||||
animation->setPlaymode(osgAnimation::Animation::PPONG);
|
||||
osgAnimation::BasicAnimationManager* bam = new osgAnimation::BasicAnimationManager;
|
||||
bam->registerAnimation(animation);
|
||||
|
||||
osg::Geometry* geom0 = getShape("morphtarget_shape0.osg");
|
||||
if (!geom0) {
|
||||
std::cerr << "can't read morphtarget_shape0.osg" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
osg::Geometry* geom1 = getShape("morphtarget_shape1.osg");
|
||||
if (!geom1) {
|
||||
std::cerr << "can't read morphtarget_shape1.osg" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// initialize with the first shape
|
||||
osgAnimation::MorphGeometry* morph = new osgAnimation::MorphGeometry(*geom0);
|
||||
morph->addMorphTarget(geom1);
|
||||
|
||||
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
|
||||
|
||||
|
||||
osg::Group* scene = new osg::Group;
|
||||
scene->addUpdateCallback(bam);
|
||||
|
||||
osg::Geode* geode = new osg::Geode;
|
||||
geode->addDrawable(morph);
|
||||
geode->addUpdateCallback(new osgAnimation::UpdateMorph("MorphNodeCallback"));
|
||||
scene->addChild(geode);
|
||||
|
||||
viewer.addEventHandler(new osgViewer::StatsHandler());
|
||||
viewer.addEventHandler(new osgViewer::WindowSizeHandler());
|
||||
viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));
|
||||
|
||||
// let's run !
|
||||
viewer.setSceneData( scene );
|
||||
viewer.realize();
|
||||
|
||||
bam->playAnimation(animation);
|
||||
|
||||
|
||||
while (!viewer.done())
|
||||
{
|
||||
viewer.frame();
|
||||
}
|
||||
|
||||
osgDB::writeNodeFile(*scene, "morph_scene.osg");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ int main(int argc, char** argv)
|
||||
{
|
||||
osg::ArgumentParser arguments(&argc, argv);
|
||||
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an example for viewing osgAnimation animations.");
|
||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is a 3d poker game client");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","List command line options.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--drawbone","draw helps to display bones.");
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
SET(TARGET_SRC osgautocapture.cpp )
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgTerrain )
|
||||
#### end var setup ###
|
||||
SETUP_EXAMPLE(osgautocapture)
|
||||
|
||||
@@ -79,11 +79,7 @@ public:
|
||||
|
||||
virtual void operator () (osg::RenderInfo& renderInfo) const
|
||||
{
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||
glReadBuffer(_readBuffer);
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Error: GLES unable to do glReadBuffer"<<std::endl;
|
||||
#endif
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
osg::GraphicsContext* gc = renderInfo.getState()->getGraphicsContext();
|
||||
@@ -95,22 +91,7 @@ public:
|
||||
pixelFormat = GL_RGBA;
|
||||
else
|
||||
pixelFormat = GL_RGB;
|
||||
|
||||
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
|
||||
if (pixelFormat == GL_RGB)
|
||||
{
|
||||
GLint value;
|
||||
#ifndef GL_IMPLEMENTATION_COLOR_READ_FORMAT
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
|
||||
#endif
|
||||
glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &value);
|
||||
if ( value != GL_RGB ||
|
||||
value != GL_UNSIGNED_BYTE )
|
||||
{
|
||||
pixelFormat = GL_RGBA;//always supported
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int width = gc->getTraits()->width;
|
||||
int height = gc->getTraits()->height;
|
||||
|
||||
@@ -193,7 +174,6 @@ int main( int argc, char **argv )
|
||||
usage->addCommandLineOption("--filename", "Filename for the captured image", "autocapture.jpg");
|
||||
usage->addCommandLineOption("--db-threads", "Number of DatabasePager threads to use", "2");
|
||||
usage->addCommandLineOption("--active", "Use active rendering instead of passive / lazy rendering");
|
||||
usage->addCommandLineOption("--pbuffer", "Render into a pbuffer, not into a window");
|
||||
|
||||
// Construct the viewer and register options arguments.
|
||||
osgViewer::Viewer viewer(arguments);
|
||||
@@ -204,7 +184,7 @@ int main( int argc, char **argv )
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Get user specified number of DatabaseThreads
|
||||
// Get user specified number of DatabaseThreads
|
||||
int dbThreads = 2;
|
||||
arguments.read("--db-threads", dbThreads);
|
||||
if (dbThreads < 1) dbThreads = 1;
|
||||
@@ -220,56 +200,6 @@ int main( int argc, char **argv )
|
||||
if (arguments.read("--active"))
|
||||
activeMode = true;
|
||||
|
||||
bool use_pbuffer = false;
|
||||
if (arguments.read("--pbuffer")) {
|
||||
if (!activeMode) {
|
||||
use_pbuffer = true;
|
||||
} else {
|
||||
osg::notify(osg::NOTICE)<<"ignoring --pbuffer because --active specified on commandline"<<std::endl;
|
||||
}
|
||||
}
|
||||
if (use_pbuffer) {
|
||||
osg::DisplaySettings* ds = osg::DisplaySettings::instance();
|
||||
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits(ds);
|
||||
|
||||
if (viewer.getCamera()->getGraphicsContext() && viewer.getCamera()->getGraphicsContext()->getTraits()) {
|
||||
//use viewer settings for window size
|
||||
osg::ref_ptr<const osg::GraphicsContext::Traits> src_traits = viewer.getCamera()->getGraphicsContext()->getTraits();
|
||||
traits->screenNum = src_traits->screenNum;
|
||||
traits->displayNum = src_traits->displayNum;
|
||||
traits->hostName = src_traits->hostName;
|
||||
traits->width = src_traits->width;
|
||||
traits->height = src_traits->height;
|
||||
traits->red = src_traits->red;
|
||||
traits->green = src_traits->green;
|
||||
traits->blue = src_traits->blue;
|
||||
traits->alpha = src_traits->alpha;
|
||||
traits->depth = src_traits->depth;
|
||||
traits->pbuffer = true;
|
||||
} else {
|
||||
//viewer would use fullscreen size (unknown here) pbuffer will use 4096 x4096 (or best avaiable)
|
||||
traits->width = 1 << 12;
|
||||
traits->height = 1 << 12;
|
||||
traits->pbuffer = true;
|
||||
}
|
||||
osg::ref_ptr<osg::GraphicsContext> pbuffer = osg::GraphicsContext::createGraphicsContext(traits.get());
|
||||
if (pbuffer.valid())
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Pixel buffer has been created successfully."<<std::endl;
|
||||
osg::ref_ptr<osg::Camera> camera = new osg::Camera(*viewer.getCamera());
|
||||
camera->setGraphicsContext(pbuffer.get());
|
||||
camera->setViewport(new osg::Viewport(0,0,traits->width,traits->height));
|
||||
GLenum buffer = pbuffer->getTraits()->doubleBuffer ? GL_BACK : GL_FRONT;
|
||||
camera->setDrawBuffer(buffer);
|
||||
camera->setReadBuffer(buffer);
|
||||
viewer.setCamera(camera.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Pixel buffer has not been created successfully."<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Read camera settings for screenshot
|
||||
double lat=50;
|
||||
double lon=10;
|
||||
@@ -389,16 +319,15 @@ int main( int argc, char **argv )
|
||||
osg::Timer_t afterLoadTick = osg::Timer::instance()->tick();
|
||||
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
|
||||
customRenderer->setCullOnly(false);
|
||||
|
||||
|
||||
//--- Capture the image!!! ---
|
||||
if (!activeMode)
|
||||
{
|
||||
// Do cull and draw to render the scene correctly
|
||||
customRenderer->setCullOnly(false);
|
||||
|
||||
// Add the WindowCaptureCallback now that we have full resolution
|
||||
GLenum buffer = viewer.getCamera()->getGraphicsContext()->getTraits()->doubleBuffer ? GL_BACK : GL_FRONT;
|
||||
viewer.getCamera()->setFinalDrawCallback(new WindowCaptureCallback(buffer, fileName));
|
||||
viewer.getCamera()->setFinalDrawCallback(new WindowCaptureCallback(GL_BACK, fileName));
|
||||
|
||||
osg::Timer_t beforeRenderTick = osg::Timer::instance()->tick();
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
osg::ArgumentParser arguments(&argc, argv);
|
||||
|
||||
|
||||
osgWidget::BrowserManager::instance()->init(arguments[0]);
|
||||
|
||||
osgViewer::Viewer viewer(arguments);
|
||||
@@ -25,9 +25,9 @@ int main(int argc,char** argv)
|
||||
{
|
||||
osg::ref_ptr<osgWidget::Browser> browser = new osgWidget::Browser;
|
||||
if (browser->open(arguments[i], hints))
|
||||
{
|
||||
{
|
||||
group->addChild(browser.get());
|
||||
|
||||
|
||||
hints.position.x() += 1.1f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ int main( int argc, char **argv )
|
||||
// use an ArgumentParser object to manage the program arguments.
|
||||
osg::ArgumentParser arguments(&argc,argv);
|
||||
|
||||
// set the osgDB::Registy read file callback to catch all requests for reading files.
|
||||
// set the osgDB::Registy the read file callback to catch all requests for reading files.
|
||||
osgDB::Registry::instance()->setReadFileCallback(new MyReadFileCallback());
|
||||
|
||||
// initialize the viewer.
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if 1
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/WriteFile>
|
||||
#include <osgViewer/Viewer>
|
||||
@@ -173,26 +175,6 @@ void multipleWindowMultipleCameras(osgViewer::Viewer& viewer, bool multipleScree
|
||||
}
|
||||
}
|
||||
|
||||
class EnableVBOVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
EnableVBOVisitor():
|
||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||
|
||||
void apply(osg::Geode& geode)
|
||||
{
|
||||
for(unsigned int i=0; i<geode.getNumDrawables();++i)
|
||||
{
|
||||
osg::Geometry* geom = geode.getDrawable(i)->asGeometry();
|
||||
if (geom)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Enabling VBO"<<std::endl;
|
||||
geom->setUseVertexBufferObjects(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
// use an ArgumentParser object to manage the program arguments.
|
||||
@@ -204,64 +186,6 @@ int main( int argc, char **argv )
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned int numRepeats = 2;
|
||||
if (arguments.read("--repeat",numRepeats) || arguments.read("-r",numRepeats) || arguments.read("--repeat") || arguments.read("-r"))
|
||||
{
|
||||
|
||||
bool sharedModel = arguments.read("--shared");
|
||||
bool enableVBO = arguments.read("--vbo");
|
||||
|
||||
osg::ref_ptr<osg::Node> model;
|
||||
if (sharedModel)
|
||||
{
|
||||
model = osgDB::readNodeFiles(arguments);
|
||||
if (!model) return 0;
|
||||
|
||||
if (enableVBO)
|
||||
{
|
||||
EnableVBOVisitor enableVBOs;
|
||||
model->accept(enableVBOs);
|
||||
}
|
||||
}
|
||||
|
||||
osgViewer::Viewer::ThreadingModel threadingModel = osgViewer::Viewer::AutomaticSelection;
|
||||
while (arguments.read("-s")) { threadingModel = osgViewer::Viewer::SingleThreaded; }
|
||||
while (arguments.read("-g")) { threadingModel = osgViewer::Viewer::CullDrawThreadPerContext; }
|
||||
while (arguments.read("-d")) { threadingModel = osgViewer::Viewer::DrawThreadPerContext; }
|
||||
while (arguments.read("-c")) { threadingModel = osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext; }
|
||||
|
||||
for(unsigned int i=0; i<numRepeats; ++i)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"+++++++++++++ New viewer ++++++++++++"<<std::endl;
|
||||
|
||||
{
|
||||
osgViewer::Viewer viewer;
|
||||
|
||||
viewer.setThreadingModel(threadingModel);
|
||||
|
||||
if (sharedModel) viewer.setSceneData(model.get());
|
||||
else
|
||||
{
|
||||
osg::ref_ptr<osg::Node> node = osgDB::readNodeFiles(arguments);
|
||||
if (!node) return 0;
|
||||
|
||||
if (enableVBO)
|
||||
{
|
||||
EnableVBOVisitor enableVBOs;
|
||||
node->accept(enableVBOs);
|
||||
}
|
||||
|
||||
viewer.setSceneData(node.get());
|
||||
}
|
||||
|
||||
viewer.run();
|
||||
}
|
||||
|
||||
osg::notify(osg::NOTICE)<<"------------ Viewer ended ----------"<<std::endl<<std::endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
std::string pathfile;
|
||||
osg::ref_ptr<osgGA::AnimationPathManipulator> apm = 0;
|
||||
@@ -353,3 +277,26 @@ int main( int argc, char **argv )
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/WriteFile>
|
||||
|
||||
int main( int, char **)
|
||||
{
|
||||
osg::ref_ptr<osg::Node> model = osgDB::readNodeFile("cow.osg");
|
||||
|
||||
for(unsigned int i=0; i<5; ++i)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"New frame *******************************"<<std::endl;
|
||||
|
||||
osgViewer::Viewer viewer;
|
||||
viewer.setSceneData(model.get());
|
||||
viewer.run();
|
||||
osg::notify(osg::NOTICE)<<std::endl<<std::endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1442,10 +1442,6 @@ int main( int argc, char **argv )
|
||||
|
||||
//osgDB::writeNodeFile(*rootNode,"test.osg");
|
||||
|
||||
// for some reason osgcatch is hanging on exit inside the new TextureObject clean up code when the it's
|
||||
// run as multi-threaded view, switching to SingleThreaded cures this.
|
||||
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
||||
|
||||
// set the scene to render
|
||||
viewer.setSceneData(rootNode.get());
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
#elif defined (WIN32)
|
||||
#include <winsock.h>
|
||||
#include <stdio.h>
|
||||
#elif defined (__hpux)
|
||||
#elif defined (__hpux__)
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#error Teach me how to build on this system
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
SET(TARGET_SRC osgdatabaserevisions.cpp )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_EXAMPLE(osgdatabaserevisions)
|
||||
@@ -1,159 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This application is open source and may be redistributed and/or modified
|
||||
* freely and without restriction, both in commericial and non commericial applications,
|
||||
* as long as this copyright notice is maintained.
|
||||
*
|
||||
* This application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgUtil/Optimizer>
|
||||
#include <osg/CoordinateSystemNode>
|
||||
|
||||
#include <osg/Switch>
|
||||
#include <osgText/Text>
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
|
||||
#include <osgGA/TrackballManipulator>
|
||||
#include <osgGA/FlightManipulator>
|
||||
#include <osgGA/DriveManipulator>
|
||||
#include <osgGA/KeySwitchMatrixManipulator>
|
||||
#include <osgGA/StateSetManipulator>
|
||||
#include <osgGA/AnimationPathManipulator>
|
||||
#include <osgGA/TerrainManipulator>
|
||||
#include <osgGA/SphericalManipulator>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// use an ArgumentParser object to manage the program arguments.
|
||||
osg::ArgumentParser arguments(&argc,argv);
|
||||
|
||||
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the standard OpenSceneGraph example which loads and visualises 3d models.");
|
||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--image <filename>","Load an image and render it on a quad");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--dem <filename>","Load an image/DEM and render it on a HeightField");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--login <url> <username> <password>","Provide authentication information for http file access.");
|
||||
|
||||
osgViewer::Viewer viewer(arguments);
|
||||
|
||||
unsigned int helpType = 0;
|
||||
if ((helpType = arguments.readHelpType()))
|
||||
{
|
||||
arguments.getApplicationUsage()->write(std::cout, helpType);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (arguments.argc()<=1)
|
||||
{
|
||||
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// set up the camera manipulators.
|
||||
{
|
||||
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
|
||||
|
||||
keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
|
||||
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
|
||||
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
|
||||
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
|
||||
keyswitchManipulator->addMatrixManipulator( '5', "Spherical", new osgGA::SphericalManipulator() );
|
||||
|
||||
std::string pathfile;
|
||||
char keyForAnimationPath = '6';
|
||||
while (arguments.read("-p",pathfile))
|
||||
{
|
||||
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||
if (apm || !apm->valid())
|
||||
{
|
||||
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
||||
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
||||
keyswitchManipulator->selectMatrixManipulator(num);
|
||||
++keyForAnimationPath;
|
||||
}
|
||||
}
|
||||
|
||||
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
||||
}
|
||||
|
||||
// add the state manipulator
|
||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||
|
||||
// add the thread model handler
|
||||
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
||||
|
||||
// add the window size toggle handler
|
||||
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
||||
|
||||
// add the stats handler
|
||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||
|
||||
// add the help handler
|
||||
viewer.addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage()));
|
||||
|
||||
// add the record camera path handler
|
||||
viewer.addEventHandler(new osgViewer::RecordCameraPathHandler);
|
||||
|
||||
// add the LOD Scale handler
|
||||
viewer.addEventHandler(new osgViewer::LODScaleHandler);
|
||||
|
||||
// add the screen capture handler
|
||||
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
|
||||
|
||||
std::string file = "http://www.openscenegraph.org/data/earth_bayarea/earth.ive";
|
||||
|
||||
osgDB::FileCache* fileCache = osgDB::Registry::instance()->getFileCache();
|
||||
if (fileCache)
|
||||
{
|
||||
fileCache->loadDatabaseRevisionsForFile(file);
|
||||
|
||||
// fileCache->loadDatabaseRevisionsForFile(file); // test to make sure that repeated loads of same revision file doesn't cause problems
|
||||
}
|
||||
|
||||
|
||||
// load the data
|
||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile(file);
|
||||
if (!loadedModel)
|
||||
{
|
||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
// report any errors if they have occurred when parsing the program arguments.
|
||||
if (arguments.errors())
|
||||
{
|
||||
arguments.writeErrorMessages(std::cout);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// optimize the scene graph, remove redundant nodes and state etc.
|
||||
osgUtil::Optimizer optimizer;
|
||||
optimizer.optimize(loadedModel.get());
|
||||
|
||||
viewer.setSceneData( loadedModel.get() );
|
||||
|
||||
viewer.realize();
|
||||
|
||||
return viewer.run();
|
||||
|
||||
}
|
||||
@@ -34,13 +34,9 @@ bool precedes(const DistanceAccumulator::DistancePair &a,
|
||||
else return false;
|
||||
}
|
||||
|
||||
/** Computes distance (in z direction) betwen a point and the viewer's eye,
|
||||
given by a view matrix */
|
||||
/** Computes distance betwen a point and the viewpoint of a matrix */
|
||||
double distance(const osg::Vec3 &coord, const osg::Matrix& matrix)
|
||||
{
|
||||
// Here we are taking only the z coordinate of the point transformed
|
||||
// by the matrix, ie coord*matrix. The negative sign is because we
|
||||
// want to consider into the screen as INCREASING distance.
|
||||
return -( coord[0]*matrix(0,2) + coord[1]*matrix(1,2) +
|
||||
coord[2]*matrix(2,2) + matrix(3,2) );
|
||||
}
|
||||
@@ -60,19 +56,19 @@ void CURRENT_CLASS::pushLocalFrustum()
|
||||
{
|
||||
osg::Matrix& currMatrix = _viewMatrices.back();
|
||||
|
||||
// Compute the frustum in local space
|
||||
osg::Polytope localFrustum;
|
||||
localFrustum.setToUnitFrustum(false, false);
|
||||
localFrustum.transformProvidingInverse(currMatrix*_projectionMatrices.back());
|
||||
_localFrusta.push_back(localFrustum);
|
||||
// Compute the frustum in local space
|
||||
osg::Polytope localFrustum;
|
||||
localFrustum.setToUnitFrustum(false, false);
|
||||
localFrustum.transformProvidingInverse(currMatrix*_projectionMatrices.back());
|
||||
_localFrusta.push_back(localFrustum);
|
||||
|
||||
// Compute new bounding box corners
|
||||
bbCornerPair corner;
|
||||
corner.second = (currMatrix(0,2)<=0?1:0) |
|
||||
(currMatrix(1,2)<=0?2:0) |
|
||||
(currMatrix(2,2)<=0?4:0);
|
||||
corner.first = (~corner.second)&7;
|
||||
_bbCorners.push_back(corner);
|
||||
// Compute new bounding box corners
|
||||
bbCornerPair corner;
|
||||
corner.second = (currMatrix(0,2)<=0?1:0) |
|
||||
(currMatrix(1,2)<=0?2:0) |
|
||||
(currMatrix(2,2)<=0?4:0);
|
||||
corner.first = (~corner.second)&7;
|
||||
_bbCorners.push_back(corner);
|
||||
}
|
||||
|
||||
void CURRENT_CLASS::pushDistancePair(double zNear, double zFar)
|
||||
@@ -103,57 +99,19 @@ bool CURRENT_CLASS::shouldContinueTraversal(osg::Node &node)
|
||||
// Allow traversal to continue if we haven't reached maximum depth.
|
||||
bool keepTraversing = (_currentDepth < _maxDepth);
|
||||
|
||||
osg::BoundingSphere bs = node.getBound();
|
||||
const osg::BoundingSphere &bs = node.getBound();
|
||||
double zNear = 0.0, zFar = 0.0;
|
||||
|
||||
// Make sure bounding sphere is valid
|
||||
// Make sure bounding sphere is valid and within viewing volume
|
||||
if(bs.valid())
|
||||
{
|
||||
// Make sure bounding sphere is within the viewing volume
|
||||
if(!_localFrusta.back().contains(bs)) keepTraversing = false;
|
||||
|
||||
else // Compute near and far planes for this node
|
||||
else
|
||||
{
|
||||
// Since the view matrix could involve complex transformations,
|
||||
// we need to determine a new BoundingSphere that would encompass
|
||||
// the transformed BoundingSphere.
|
||||
const osg::Matrix &l2w = _viewMatrices.back();
|
||||
|
||||
// Get the transformed x-axis of the BoundingSphere
|
||||
osg::Vec3d newX = bs._center;
|
||||
newX.x() += bs._radius; // Get X-edge of bounding sphere
|
||||
newX = newX * l2w;
|
||||
|
||||
// Get the transformed y-axis of the BoundingSphere
|
||||
osg::Vec3d newY = bs._center;
|
||||
newY.y() += bs._radius; // Get Y-edge of bounding sphere
|
||||
newY = newY * l2w;
|
||||
|
||||
// Get the transformed z-axis of the BoundingSphere
|
||||
osg::Vec3d newZ = bs._center;
|
||||
newZ.z() += bs._radius; // Get Z-edge of bounding sphere
|
||||
newZ = newZ * l2w;
|
||||
|
||||
// Get the transformed center of the BoundingSphere
|
||||
bs._center = bs._center * l2w;
|
||||
|
||||
// Compute lengths of transformed x, y, and z axes
|
||||
double newXLen = (newX - bs._center).length();
|
||||
double newYLen = (newY - bs._center).length();
|
||||
double newZLen = (newZ - bs._center).length();
|
||||
|
||||
// The encompassing radius is the max of the transformed lengths
|
||||
bs._radius = newXLen;
|
||||
if(newYLen > bs._radius) bs._radius = newYLen;
|
||||
if(newZLen > bs._radius) bs._radius = newZLen;
|
||||
|
||||
// Now we can compute the near & far planes, noting that for
|
||||
// complex view transformations (ie. involving scales) the new
|
||||
// BoundingSphere may be bigger than the original one.
|
||||
// Note that the negative sign on the bounding sphere center is
|
||||
// because we want distance to increase INTO the screen.
|
||||
zNear = -bs._center.z() - bs._radius;
|
||||
zFar = -bs._center.z() + bs._radius;
|
||||
// Compute near and far planes for this node
|
||||
zNear = distance(bs._center, _viewMatrices.back());
|
||||
zFar = zNear + bs._radius;
|
||||
zNear -= bs._radius;
|
||||
|
||||
// If near/far ratio is big enough, then we don't need to keep
|
||||
// traversing children of this node.
|
||||
@@ -172,9 +130,9 @@ void CURRENT_CLASS::apply(osg::Node &node)
|
||||
if(shouldContinueTraversal(node))
|
||||
{
|
||||
// Traverse this node
|
||||
++_currentDepth;
|
||||
_currentDepth++;
|
||||
traverse(node);
|
||||
--_currentDepth;
|
||||
_currentDepth--;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,9 +145,9 @@ void CURRENT_CLASS::apply(osg::Projection &proj)
|
||||
pushLocalFrustum();
|
||||
|
||||
// Traverse the group
|
||||
++_currentDepth;
|
||||
_currentDepth++;
|
||||
traverse(proj);
|
||||
--_currentDepth;
|
||||
_currentDepth--;
|
||||
|
||||
// Reload original matrix and frustum
|
||||
_localFrusta.pop_back();
|
||||
@@ -213,9 +171,9 @@ void CURRENT_CLASS::apply(osg::Transform &transform)
|
||||
pushLocalFrustum();
|
||||
}
|
||||
|
||||
++_currentDepth;
|
||||
_currentDepth++;
|
||||
traverse(transform);
|
||||
--_currentDepth;
|
||||
_currentDepth--;
|
||||
|
||||
if(pushMatrix)
|
||||
{
|
||||
@@ -237,7 +195,7 @@ void CURRENT_CLASS::apply(osg::Geode &geode)
|
||||
double zNear, zFar;
|
||||
|
||||
// Handle each drawable in this geode
|
||||
for(unsigned int i = 0; i < geode.getNumDrawables(); ++i)
|
||||
for(unsigned int i = 0; i < geode.getNumDrawables(); i++)
|
||||
{
|
||||
drawable = geode.getDrawable(i);
|
||||
|
||||
@@ -310,7 +268,7 @@ void CURRENT_CLASS::computeCameraPairs()
|
||||
// pairs (called combined pairs) will not overlap.
|
||||
PairList combinedPairs;
|
||||
DistancePair currPair = _distancePairs.front();
|
||||
for(i = _distancePairs.begin(); i != _distancePairs.end(); ++i)
|
||||
for(i = _distancePairs.begin(); i != _distancePairs.end(); i++)
|
||||
{
|
||||
// Current distance pair does not overlap current combined pair, so
|
||||
// save the current combined pair and start a new one.
|
||||
@@ -332,7 +290,7 @@ void CURRENT_CLASS::computeCameraPairs()
|
||||
double currNearLimit, numSegs, new_ratio;
|
||||
double ratio_invlog = 1.0/log(_nearFarRatio);
|
||||
unsigned int temp;
|
||||
for(i = combinedPairs.begin(); i != combinedPairs.end(); ++i)
|
||||
for(i = combinedPairs.begin(); i != combinedPairs.end(); i++)
|
||||
{
|
||||
currPair = *i; // Save current view segment
|
||||
|
||||
@@ -353,7 +311,7 @@ void CURRENT_CLASS::computeCameraPairs()
|
||||
}
|
||||
|
||||
// See if the closest view segment can absorb other combined pairs
|
||||
for(j = i+1; j != combinedPairs.end(); ++j)
|
||||
for(j = i+1; j != combinedPairs.end(); j++)
|
||||
{
|
||||
// No other distance pairs can be included
|
||||
if(j->first < currNearLimit) break;
|
||||
|
||||
@@ -38,88 +38,34 @@ osg::Node* createScene()
|
||||
// Create the Earth, in blue
|
||||
osg::ShapeDrawable *earth_sd = new osg::ShapeDrawable;
|
||||
osg::Sphere* earth_sphere = new osg::Sphere;
|
||||
earth_sphere->setName("EarthSphere");
|
||||
earth_sphere->setRadius(r_earth);
|
||||
earth_sd->setShape(earth_sphere);
|
||||
earth_sd->setColor(osg::Vec4(0, 0, 1.0, 1.0));
|
||||
|
||||
osg::Geode* earth_geode = new osg::Geode;
|
||||
earth_geode->setName("EarthGeode");
|
||||
earth_geode->addDrawable(earth_sd);
|
||||
|
||||
osg::Geode* earth = new osg::Geode;
|
||||
earth->setName("earth");
|
||||
earth->addDrawable(earth_sd);
|
||||
|
||||
// Create the Sun, in yellow
|
||||
osg::ShapeDrawable *sun_sd = new osg::ShapeDrawable;
|
||||
osg::Sphere* sun_sphere = new osg::Sphere;
|
||||
sun_sphere->setName("SunSphere");
|
||||
sun_sphere->setRadius(r_sun);
|
||||
sun_sd->setShape(sun_sphere);
|
||||
sun_sd->setColor(osg::Vec4(1.0, 0.0, 0.0, 1.0));
|
||||
|
||||
osg::Geode* sun_geode = new osg::Geode;
|
||||
sun_geode->setName("SunGeode");
|
||||
sun_geode->setName("sun");
|
||||
sun_geode->addDrawable(sun_sd);
|
||||
|
||||
// Move the sun behind the earth
|
||||
osg::PositionAttitudeTransform *pat = new osg::PositionAttitudeTransform;
|
||||
pat->setPosition(osg::Vec3d(0.0, AU, 0.0));
|
||||
pat->addChild(sun_geode);
|
||||
|
||||
osg::Geometry * unitCircle = new osg::Geometry();
|
||||
{
|
||||
osg::Vec4Array * colours = new osg::Vec4Array(1);
|
||||
(*colours)[0] = osg::Vec4d(1.0,1.0,1.0,1.0);
|
||||
unitCircle->setColorArray(colours);
|
||||
unitCircle->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
const unsigned int n_points = 1024;
|
||||
osg::Vec3Array * coords = new osg::Vec3Array(n_points);
|
||||
const double dx = 2.0*osg::PI/n_points;
|
||||
double s,c;
|
||||
for (unsigned int j=0; j<n_points; ++j) {
|
||||
s = sin(dx*j);
|
||||
c = cos(dx*j);
|
||||
(*coords)[j].set(osg::Vec3d(c,s,0.0));
|
||||
}
|
||||
unitCircle->setVertexArray(coords);
|
||||
unitCircle->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||
unitCircle->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,n_points));
|
||||
}
|
||||
|
||||
osg::Geometry *axes = new osg::Geometry;
|
||||
{
|
||||
osg::Vec4Array *colours = new osg::Vec4Array(1);
|
||||
(*colours)[0] = osg::Vec4d(1.0,0.0,0.0,1.0);
|
||||
axes->setColorArray(colours);
|
||||
axes->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
osg::Vec3Array *coords = new osg::Vec3Array(6);
|
||||
(*coords)[0].set(osg::Vec3d(0.0, 0.0, 0.0));
|
||||
(*coords)[1].set(osg::Vec3d(0.5, 0.0, 0.0));
|
||||
(*coords)[2].set(osg::Vec3d(0.0, 0.0, 0.0));
|
||||
(*coords)[3].set(osg::Vec3d(0.0, 0.5, 0.0));
|
||||
(*coords)[4].set(osg::Vec3d(0.0, 0.0, 0.0));
|
||||
(*coords)[5].set(osg::Vec3d(0.0, 0.0, 0.5));
|
||||
axes->setVertexArray(coords);
|
||||
axes->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||
axes->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
|
||||
}
|
||||
|
||||
// Earth orbit
|
||||
osg::Geode * earthOrbitGeode = new osg::Geode;
|
||||
earthOrbitGeode->addDrawable(unitCircle);
|
||||
earthOrbitGeode->addDrawable(axes);
|
||||
earthOrbitGeode->setName("EarthOrbitGeode");
|
||||
|
||||
osg::PositionAttitudeTransform * earthOrbitPAT = new osg::PositionAttitudeTransform;
|
||||
earthOrbitPAT->setScale(osg::Vec3d(AU,AU,AU));
|
||||
earthOrbitPAT->setPosition(osg::Vec3d(0.0, AU, 0.0));
|
||||
earthOrbitPAT->addChild(earthOrbitGeode);
|
||||
earthOrbitPAT->setName("EarthOrbitPAT");
|
||||
|
||||
osg::Group* scene = new osg::Group;
|
||||
scene->setName("SceneGroup");
|
||||
scene->addChild(earth_geode);
|
||||
scene->addChild(earth);
|
||||
scene->addChild(pat);
|
||||
scene->addChild(earthOrbitPAT);
|
||||
|
||||
pat->addChild(sun_geode);
|
||||
|
||||
return scene;
|
||||
}
|
||||
|
||||
@@ -156,7 +102,7 @@ int main( int argc, char **argv )
|
||||
|
||||
if (needToSetHomePosition)
|
||||
{
|
||||
viewer.getCameraManipulator()->setHomePosition(osg::Vec3d(0.0,-5.0*r_earth,0.0),osg::Vec3d(0.0,0.0,0.0),osg::Vec3d(0.0,0.0,1.0));
|
||||
viewer.getCameraManipulator()->setHomePosition(osg::Vec3d(0.0,-5.0*r_earth,0.0),osg::Vec3d(0.0,0.0,0.0),osg::Vec3d(0.0,0.0,1.0));
|
||||
}
|
||||
|
||||
// depth partion node is only supports single window/single threaded at present.
|
||||
|
||||
@@ -66,7 +66,7 @@ createStateSet()
|
||||
"{ \n"
|
||||
// Using the instance ID, generate "texture coords" for this instance.
|
||||
"vec2 tC; \n"
|
||||
"float r = float(gl_InstanceID) / 32.; \n"
|
||||
"const float r = gl_InstanceID / 32.; \n"
|
||||
"tC.s = fract( r ); tC.t = floor( r ) / 32.; \n"
|
||||
// Get the color from the OSG logo.
|
||||
"gl_FrontColor = texture2D( osgLogo, tC ); \n"
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
#include <osg/Switch>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/TexEnv>
|
||||
#include <osg/VertexProgram>
|
||||
#include <osg/FragmentProgram>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/FileUtils>
|
||||
@@ -50,7 +48,6 @@
|
||||
#include <osgGA/StateSetManipulator>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
// for the grid data..
|
||||
#include "../osghangglide/terrain_coords.h"
|
||||
@@ -330,7 +327,7 @@ bool ForestTechniqueManager::Cell::divide(bool xAxis, bool yAxis, bool zAxis)
|
||||
|
||||
void ForestTechniqueManager::Cell::bin()
|
||||
{
|
||||
// put trees in appropriate cells.
|
||||
// put trees in apprpriate cells.
|
||||
TreeList treesNotAssigned;
|
||||
for(TreeList::iterator titr=_trees.begin();
|
||||
titr!=_trees.end();
|
||||
@@ -802,7 +799,7 @@ class ShaderGeometry : public osg::Drawable
|
||||
itr != _trees.end();
|
||||
++itr)
|
||||
{
|
||||
renderInfo.getState()->Color((*itr)[0],(*itr)[1],(*itr)[2],(*itr)[3]);
|
||||
glColor4fv(itr->ptr());
|
||||
_geometry->draw(renderInfo);
|
||||
}
|
||||
}
|
||||
@@ -970,7 +967,6 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
|
||||
osg::StateSet *dstate = new osg::StateSet;
|
||||
{
|
||||
dstate->setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON );
|
||||
|
||||
dstate->setTextureAttribute(0, new osg::TexEnv );
|
||||
|
||||
dstate->setAttributeAndModes( new osg::BlendFunc, osg::StateAttribute::ON );
|
||||
@@ -1009,77 +1005,19 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
|
||||
std::cout<<"Creating osg::MatrixTransform based forest...";
|
||||
osg::Group* group = new osg::Group;
|
||||
group->addChild(createTransformGraph(cell.get(),dstate));
|
||||
group->addChild(createHUDWithText("Using osg::MatrixTransform's to create a forest\n\nPress left cursor key to select double quad based forest\nPress right cursor key to select osg::Vertex/FragmentProgram based forest"));
|
||||
group->addChild(createHUDWithText("Using osg::MatrixTransform's to create a forest\n\nPress left cursor key to select double quad based forest\nPress right cursor key to select OpenGL shader based forest"));
|
||||
_techniqueSwitch->addChild(group);
|
||||
std::cout<<"done."<<std::endl;
|
||||
}
|
||||
|
||||
{
|
||||
std::cout<<"Creating osg::Vertex/FragmentProgram based forest...";
|
||||
osg::Group* group = new osg::Group;
|
||||
|
||||
|
||||
osg::StateSet* stateset = new osg::StateSet(*dstate, osg::CopyOp::DEEP_COPY_ALL);
|
||||
osg::StateSet* stateset = new osg::StateSet;
|
||||
|
||||
{
|
||||
// vertex program
|
||||
std::ostringstream vp_oss;
|
||||
vp_oss <<
|
||||
"!!ARBvp1.0\n"
|
||||
|
||||
"ATTRIB vpos = vertex.position;\n"
|
||||
"ATTRIB vcol = vertex.color;\n"
|
||||
"ATTRIB tc = vertex.texcoord[" << 0 << "];"
|
||||
|
||||
"PARAM mvp[4] = { state.matrix.mvp };\n"
|
||||
"PARAM one = { 1.0, 1.0, 1.0, 1.0 };"
|
||||
|
||||
"TEMP position;\n"
|
||||
|
||||
// vec3 position = gl_Vertex.xyz * gl_Color.w + gl_Color.xyz;
|
||||
"MAD position, vpos, vcol.w, vcol;\n"
|
||||
|
||||
// gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0);
|
||||
"MOV position.w, one;\n"
|
||||
"DP4 result.position.x, mvp[0], position;\n"
|
||||
"DP4 result.position.y, mvp[1], position;\n"
|
||||
"DP4 result.position.z, mvp[2], position;\n"
|
||||
"DP4 result.position.w, mvp[3], position;\n"
|
||||
|
||||
// gl_FrontColor = vec4(1.0,1.0,1.0,1.0);
|
||||
"MOV result.color.front.primary, one;\n"
|
||||
|
||||
// texcoord = gl_MultiTexCoord0.st;
|
||||
"MOV result.texcoord, tc;\n"
|
||||
"END\n";
|
||||
|
||||
|
||||
// fragment program
|
||||
std::ostringstream fp_oss;
|
||||
fp_oss <<
|
||||
"!!ARBfp1.0\n"
|
||||
"TEX result.color, fragment.texcoord[" << 0 << "], texture[" << 0 << "], 2D;"
|
||||
"END\n";
|
||||
|
||||
osg::ref_ptr<osg::VertexProgram> vp = new osg::VertexProgram;
|
||||
vp->setVertexProgram(vp_oss.str());
|
||||
stateset->setAttributeAndModes(vp.get(), osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
||||
|
||||
osg::ref_ptr<osg::FragmentProgram> fp = new osg::FragmentProgram;
|
||||
fp->setFragmentProgram(fp_oss.str());
|
||||
stateset->setAttributeAndModes(fp.get(), osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
||||
}
|
||||
|
||||
group->addChild(createShaderGraph(cell.get(),stateset));
|
||||
group->addChild(createHUDWithText("Using osg::Vertex/FragmentProgram to create a forest\n\nPress left cursor key to select osg::MatrixTransform's based forest\nPress right cursor key to select OpenGL shader based forest"));
|
||||
_techniqueSwitch->addChild(group);
|
||||
std::cout<<"done."<<std::endl;
|
||||
}
|
||||
|
||||
{
|
||||
std::cout<<"Creating OpenGL shader based forest...";
|
||||
osg::Group* group = new osg::Group;
|
||||
|
||||
osg::StateSet* stateset = new osg::StateSet(*dstate, osg::CopyOp::DEEP_COPY_ALL);
|
||||
stateset->setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON );
|
||||
stateset->setRenderingHint( osg::StateSet::TRANSPARENT_BIN );
|
||||
|
||||
{
|
||||
osg::Program* program = new osg::Program;
|
||||
@@ -1131,8 +1069,9 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
|
||||
stateset->addUniform(baseTextureSampler);
|
||||
}
|
||||
|
||||
std::cout<<"Creating OpenGL shader based forest...";
|
||||
group->addChild(createShaderGraph(cell.get(),stateset));
|
||||
group->addChild(createHUDWithText("Using OpenGL Shader to create a forest\n\nPress left cursor key to select osg::Vertex/FragmentProgram based forest\nPress right cursor key to select osg::Billboard based forest"));
|
||||
group->addChild(createHUDWithText("Using OpenGL Shader to create a forest\n\nPress left cursor key to select osg::MatrixTransform based forest\nPress right cursor key to select osg::Billboard based forest"));
|
||||
_techniqueSwitch->addChild(group);
|
||||
std::cout<<"done."<<std::endl;
|
||||
}
|
||||
|
||||
@@ -320,12 +320,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
viewer.setThreadingModel(threading);
|
||||
|
||||
// setup stencil buffer for Outline f/x.
|
||||
osg::DisplaySettings::instance()->setMinimumNumStencilBits(1);
|
||||
unsigned int clearMask = viewer.getCamera()->getClearMask();
|
||||
viewer.getCamera()->setClearMask(clearMask | GL_STENCIL_BUFFER_BIT);
|
||||
viewer.getCamera()->setClearStencil(0);
|
||||
|
||||
// any option left unread are converted into errors to write out later.
|
||||
arguments.reportRemainingOptionsAsUnrecognized();
|
||||
|
||||
|
||||
@@ -513,11 +513,8 @@ osg::Node* createScene()
|
||||
// polygon stipple
|
||||
osg::StateSet* stateSet = new osg::StateSet();
|
||||
polyGeom->setStateSet(stateSet);
|
||||
|
||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
||||
osg::PolygonStipple* polygonStipple = new osg::PolygonStipple;
|
||||
stateSet->setAttributeAndModes(polygonStipple,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
||||
#endif
|
||||
|
||||
printTriangles("Triangles/Strip/Fan",*polyGeom);
|
||||
|
||||
@@ -617,8 +614,8 @@ osg::Node* createBackground()
|
||||
{
|
||||
0,
|
||||
1,
|
||||
3,
|
||||
2
|
||||
2,
|
||||
3
|
||||
};
|
||||
|
||||
int numIndices = sizeof(myIndices)/sizeof(unsigned short);
|
||||
@@ -627,7 +624,7 @@ osg::Node* createBackground()
|
||||
// contains unsigned char indices, UShortDrawElements which contains unsigned short indices,
|
||||
// and UIntDrawElements which contains ... unsigned int indices.
|
||||
// The first parameter to DrawElements is
|
||||
polyGeom->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP,numIndices,myIndices));
|
||||
polyGeom->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::QUADS,numIndices,myIndices));
|
||||
|
||||
// new we need to add the texture to the Drawable, we do so by creating a
|
||||
// StateSet to contain the Texture2D StateAttribute.
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
|
||||
SET(TARGET_SRC osggpx.cpp )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_EXAMPLE(osggpx)
|
||||
@@ -1,541 +0,0 @@
|
||||
/* OpenSceneGraph example, osggpx.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <osg/Node>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Notify>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/DrawPixels>
|
||||
#include <osg/PolygonOffset>
|
||||
#include <osg/Geode>
|
||||
#include <osg/CoordinateSystemNode>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/FileUtils>
|
||||
#include <osgDB/FileNameUtils>
|
||||
#include <osgDB/XmlParser>
|
||||
|
||||
#include <osgText/Text>
|
||||
|
||||
#include <osgGA/TerrainManipulator>
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
class TrackSegment : public osg::Object
|
||||
{
|
||||
public:
|
||||
TrackSegment() {}
|
||||
|
||||
TrackSegment(const TrackSegment& ts, const osg::CopyOp=osg::CopyOp::SHALLOW_COPY) {}
|
||||
|
||||
META_Object(osg, TrackSegment)
|
||||
|
||||
struct TrackPoint
|
||||
{
|
||||
TrackPoint():
|
||||
latitude(0.0),
|
||||
longitude(0.0),
|
||||
elevation(0.0),
|
||||
time(0.0) {}
|
||||
|
||||
double latitude;
|
||||
double longitude;
|
||||
double elevation;
|
||||
double time;
|
||||
};
|
||||
|
||||
typedef std::vector< TrackPoint > TrackPoints;
|
||||
|
||||
void addTrackPoint(const TrackPoint& trackPoint) { _trackPoints.push_back(trackPoint); }
|
||||
|
||||
TrackPoints& getTrackPoints() { return _trackPoints; }
|
||||
const TrackPoints& getTrackPoints() const { return _trackPoints; }
|
||||
|
||||
protected:
|
||||
virtual ~TrackSegment() {}
|
||||
|
||||
TrackPoints _trackPoints;
|
||||
};
|
||||
|
||||
class Track : public osg::Object
|
||||
{
|
||||
public:
|
||||
Track() {}
|
||||
|
||||
Track(const Track& track, const osg::CopyOp=osg::CopyOp::SHALLOW_COPY) {}
|
||||
|
||||
META_Object(osg, Track)
|
||||
|
||||
typedef std::vector< osg::ref_ptr<TrackSegment> > TrackSegments;
|
||||
|
||||
void addTrackSegment(TrackSegment* trackSegment) { _trackSegments.push_back(trackSegment); }
|
||||
|
||||
TrackSegments& getTrackSegments() { return _trackSegments; }
|
||||
const TrackSegments& getTrackSegments() const { return _trackSegments; }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~Track() {}
|
||||
|
||||
TrackSegments _trackSegments;
|
||||
};
|
||||
|
||||
double convertTime(const std::string& timestr)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<" time = "<<timestr<<std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Track* readTrack(const std::string& filename)
|
||||
{
|
||||
std::string foundFilename = osgDB::findDataFile(filename);
|
||||
if (foundFilename.empty()) return 0;
|
||||
|
||||
std::string ext = osgDB::getFileExtension(foundFilename);
|
||||
if (ext!="gpx") return 0;
|
||||
|
||||
osgDB::XmlNode::Input input;
|
||||
input.open(foundFilename);
|
||||
input.readAllDataIntoBuffer();
|
||||
|
||||
osg::ref_ptr<osgDB::XmlNode> doc = new osgDB::XmlNode;
|
||||
doc->read(input);
|
||||
|
||||
osgDB::XmlNode* root = 0;
|
||||
for(osgDB::XmlNode::Children::iterator itr = doc->children.begin();
|
||||
itr != doc->children.end() && !root;
|
||||
++itr)
|
||||
{
|
||||
if ((*itr)->name=="gpx") root = itr->get();
|
||||
}
|
||||
|
||||
if (!root) return 0;
|
||||
|
||||
std::string latitude("lat");
|
||||
std::string longitude("lon");
|
||||
|
||||
for(osgDB::XmlNode::Children::iterator itr = root->children.begin();
|
||||
itr != root->children.end();
|
||||
++itr)
|
||||
{
|
||||
if ((*itr)->name=="trk")
|
||||
{
|
||||
osg::ref_ptr<Track> track = new Track;
|
||||
track->setName(filename);
|
||||
|
||||
for(osgDB::XmlNode::Children::iterator citr = (*itr)->children.begin();
|
||||
citr != (*itr)->children.end();
|
||||
++citr)
|
||||
{
|
||||
if ((*citr)->name=="trkseg")
|
||||
{
|
||||
osg::ref_ptr<TrackSegment> trackSegment = new TrackSegment;
|
||||
for(osgDB::XmlNode::Children::iterator sitr = (*citr)->children.begin();
|
||||
sitr != (*citr)->children.end();
|
||||
++sitr)
|
||||
{
|
||||
if ((*sitr)->name=="trkpt")
|
||||
{
|
||||
osgDB::XmlNode* trkpt = sitr->get();
|
||||
TrackSegment::TrackPoint point;
|
||||
bool valid = false;
|
||||
if (trkpt->properties.count(latitude)!=0)
|
||||
{
|
||||
valid = true;
|
||||
point.latitude = osg::asciiToDouble(trkpt->properties[latitude].c_str());
|
||||
}
|
||||
if (trkpt->properties.count(longitude)!=0)
|
||||
{
|
||||
valid = true;
|
||||
point.longitude = osg::asciiToDouble(trkpt->properties[longitude].c_str());
|
||||
}
|
||||
|
||||
for(osgDB::XmlNode::Children::iterator pitr = trkpt->children.begin();
|
||||
pitr != trkpt->children.end();
|
||||
++pitr)
|
||||
{
|
||||
if ((*pitr)->name=="ele") point.elevation = osg::asciiToDouble((*pitr)->contents.c_str());
|
||||
else if ((*pitr)->name=="time") point.time = convertTime((*pitr)->contents);
|
||||
}
|
||||
|
||||
if (valid)
|
||||
{
|
||||
// osg::notify(osg::NOTICE)<<" point.latitude="<<point.latitude<<", longitude="<<point.longitude<<", elev="<<point.elevation<<", time="<<point.time<<std::endl;
|
||||
trackSegment->addTrackPoint(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!trackSegment->getTrackPoints().empty())
|
||||
{
|
||||
track->addTrackSegment(trackSegment.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return track.release();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
TrackSegment* computeSmoothedTrackSegment(TrackSegment* ts)
|
||||
{
|
||||
if (!ts) return 0;
|
||||
|
||||
const TrackSegment::TrackPoints& orig_points = ts->getTrackPoints();
|
||||
|
||||
if (orig_points.size()>2)
|
||||
{
|
||||
// only do smoothing if we have more than two points.
|
||||
osg::ref_ptr<TrackSegment> new_ts = new TrackSegment;
|
||||
|
||||
TrackSegment::TrackPoints& new_points = new_ts->getTrackPoints();
|
||||
new_points.resize(orig_points.size());
|
||||
|
||||
new_points[0] = orig_points[0];
|
||||
new_points[orig_points.size()-1] = orig_points[orig_points.size()-1];
|
||||
|
||||
for(unsigned int i=1; i<orig_points.size()-1; ++i)
|
||||
{
|
||||
new_points[i].latitude = (orig_points[i-1].latitude+orig_points[i].latitude+orig_points[i+1].latitude)/3.0;
|
||||
new_points[i].longitude = (orig_points[i-1].longitude+orig_points[i].longitude+orig_points[i+1].longitude)/3.0;
|
||||
new_points[i].elevation = (orig_points[i-1].elevation+orig_points[i].elevation+orig_points[i+1].elevation)/3.0;
|
||||
new_points[i].time = (orig_points[i-1].time+orig_points[i].time+orig_points[i+1].time)/3.0;
|
||||
}
|
||||
return new_ts.release();
|
||||
}
|
||||
else
|
||||
{
|
||||
// we have two or less points and can't do smoothing, so will just return original TrackSegment
|
||||
return ts;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TrackSegment* computeAveragedSpeedTrackSegment(TrackSegment* ts)
|
||||
{
|
||||
if (!ts) return 0;
|
||||
|
||||
osg::ref_ptr<osg::EllipsoidModel> em = new osg::EllipsoidModel;
|
||||
const TrackSegment::TrackPoints& orig_points = ts->getTrackPoints();
|
||||
|
||||
if (orig_points.size()>2)
|
||||
{
|
||||
// only do smoothing if we have more than two points.
|
||||
osg::ref_ptr<TrackSegment> new_ts = new TrackSegment;
|
||||
|
||||
|
||||
// compute overall distance
|
||||
double total_distance = 0;
|
||||
for(unsigned int i=1; i<orig_points.size()-1; ++i)
|
||||
{
|
||||
osg::Vec3d point_a, point_b;
|
||||
em->convertLatLongHeightToXYZ(osg::DegreesToRadians(orig_points[i].latitude), osg::DegreesToRadians(orig_points[i].longitude), orig_points[i].elevation,
|
||||
point_a.x(), point_a.y(), point_a.z());
|
||||
em->convertLatLongHeightToXYZ(osg::DegreesToRadians(orig_points[i+1].latitude), osg::DegreesToRadians(orig_points[i+1].longitude), orig_points[i+1].elevation,
|
||||
point_b.x(), point_b.y(), point_b.z());
|
||||
total_distance += (point_b-point_a).length();
|
||||
}
|
||||
|
||||
double total_time = orig_points[orig_points.size()-1].time - orig_points[0].time;
|
||||
double average_speed = total_distance/total_time;
|
||||
|
||||
OSG_NOTICE<<"total_time = "<<total_time<<std::endl;
|
||||
OSG_NOTICE<<"total_distance = "<<total_distance<<std::endl;
|
||||
OSG_NOTICE<<"average_speed = "<<average_speed<<std::endl;
|
||||
|
||||
TrackSegment::TrackPoints& new_points = new_ts->getTrackPoints();
|
||||
new_points.resize(orig_points.size());
|
||||
new_points[0] = orig_points[0];
|
||||
|
||||
double accumulated_distance = 0.0;
|
||||
for(unsigned int i=0; i<orig_points.size()-1; ++i)
|
||||
{
|
||||
osg::Vec3d point_a, point_b;
|
||||
em->convertLatLongHeightToXYZ(osg::DegreesToRadians(orig_points[i].latitude), osg::DegreesToRadians(orig_points[i].longitude), orig_points[i].elevation,
|
||||
point_a.x(), point_a.y(), point_a.z());
|
||||
em->convertLatLongHeightToXYZ(osg::DegreesToRadians(orig_points[i+1].latitude), osg::DegreesToRadians(orig_points[i+1].longitude), orig_points[i+1].elevation,
|
||||
point_b.x(), point_b.y(), point_b.z());
|
||||
|
||||
accumulated_distance += (point_b-point_a).length();
|
||||
|
||||
new_points[i+1] = orig_points[i+1];
|
||||
new_points[i+1].time = accumulated_distance / average_speed;
|
||||
}
|
||||
return new_ts.release();
|
||||
}
|
||||
else
|
||||
{
|
||||
// we have two or less points and can't do smoothing, so will just return original TrackSegment
|
||||
return ts;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Track* computeAveragedSpeedTrack(Track* track)
|
||||
{
|
||||
osg::ref_ptr<Track> new_track = new Track;
|
||||
|
||||
for(Track::TrackSegments::iterator itr = track->getTrackSegments().begin();
|
||||
itr != track->getTrackSegments().end();
|
||||
++itr)
|
||||
{
|
||||
new_track->addTrackSegment(computeAveragedSpeedTrackSegment(itr->get()));
|
||||
}
|
||||
|
||||
return new_track.release();
|
||||
}
|
||||
|
||||
|
||||
Track* computeSmoothedTrack(Track* track)
|
||||
{
|
||||
osg::ref_ptr<Track> new_track = new Track;
|
||||
|
||||
for(Track::TrackSegments::iterator itr = track->getTrackSegments().begin();
|
||||
itr != track->getTrackSegments().end();
|
||||
++itr)
|
||||
{
|
||||
new_track->addTrackSegment(computeSmoothedTrackSegment(itr->get()));
|
||||
}
|
||||
|
||||
return new_track.release();
|
||||
}
|
||||
|
||||
osg::Node* createTrackModel(Track* track, const osg::Vec4& colour)
|
||||
{
|
||||
osg::ref_ptr<osg::EllipsoidModel> em = new osg::EllipsoidModel;
|
||||
|
||||
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
||||
|
||||
for(Track::TrackSegments::iterator itr = track->getTrackSegments().begin();
|
||||
itr != track->getTrackSegments().end();
|
||||
++itr)
|
||||
{
|
||||
const TrackSegment::TrackPoints& points = (*itr)->getTrackPoints();
|
||||
if (points.size()<2) continue;
|
||||
|
||||
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
|
||||
osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array;
|
||||
geometry->setVertexArray(vertices.get());
|
||||
vertices->resize(points.size());
|
||||
for(unsigned int i=0; i<points.size(); ++i)
|
||||
{
|
||||
osg::Vec3d point;
|
||||
em->convertLatLongHeightToXYZ(osg::DegreesToRadians(points[i].latitude), osg::DegreesToRadians(points[i].longitude), points[i].elevation,
|
||||
point.x(), point.y(), point.z());
|
||||
|
||||
(*vertices)[i] = point;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Vec4Array> colours = new osg::Vec4Array;
|
||||
colours->push_back(colour);
|
||||
geometry->setColorArray(colours.get());
|
||||
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
|
||||
geometry->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP, 0, points.size()));
|
||||
|
||||
geode->addDrawable(geometry.get());
|
||||
}
|
||||
|
||||
geode->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||
|
||||
return geode.release();
|
||||
}
|
||||
|
||||
int main(int argv, char **argc)
|
||||
{
|
||||
osg::ArgumentParser arguments(&argv, argc);
|
||||
|
||||
typedef std::list< osg::ref_ptr<Track> > Tracks;
|
||||
Tracks tracks;
|
||||
|
||||
bool average = false;
|
||||
while (arguments.read("-a") || arguments.read("--average")) average = true;
|
||||
|
||||
bool smooth = false;
|
||||
while (arguments.read("-s") || arguments.read("--smooth")) smooth = true;
|
||||
|
||||
std::string outputFilename;
|
||||
while (arguments.read("-o",outputFilename)) {}
|
||||
|
||||
std::string trackFilename;
|
||||
while (arguments.read("-t",trackFilename))
|
||||
{
|
||||
osg::ref_ptr<Track> track = readTrack(trackFilename);
|
||||
if (track.valid()) tracks.push_back(track.get());
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::EllipsoidModel> em = new osg::EllipsoidModel;
|
||||
|
||||
osg::ref_ptr<osg::Group> group = new osg::Group;
|
||||
|
||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
||||
if (loadedModel.valid()) group->addChild(loadedModel.get());
|
||||
|
||||
for(Tracks::iterator itr = tracks.begin();
|
||||
itr != tracks.end();
|
||||
++itr)
|
||||
{
|
||||
Track* track = itr->get();
|
||||
|
||||
group->addChild(createTrackModel(track, osg::Vec4(1.0,1.0,1.0,1.0)));
|
||||
|
||||
// smooth the track
|
||||
if (average)
|
||||
{
|
||||
for(Track::TrackSegments::iterator itr = track->getTrackSegments().begin();
|
||||
itr != track->getTrackSegments().end();
|
||||
++itr)
|
||||
{
|
||||
*itr = computeAveragedSpeedTrackSegment(itr->get());
|
||||
}
|
||||
}
|
||||
|
||||
// smooth the track
|
||||
if (smooth)
|
||||
{
|
||||
for(Track::TrackSegments::iterator itr = track->getTrackSegments().begin();
|
||||
itr != track->getTrackSegments().end();
|
||||
++itr)
|
||||
{
|
||||
*itr = computeSmoothedTrackSegment(itr->get());
|
||||
}
|
||||
|
||||
for(Track::TrackSegments::iterator itr = track->getTrackSegments().begin();
|
||||
itr != track->getTrackSegments().end();
|
||||
++itr)
|
||||
{
|
||||
*itr = computeSmoothedTrackSegment(itr->get());
|
||||
}
|
||||
|
||||
for(Track::TrackSegments::iterator itr = track->getTrackSegments().begin();
|
||||
itr != track->getTrackSegments().end();
|
||||
++itr)
|
||||
{
|
||||
*itr = computeSmoothedTrackSegment(itr->get());
|
||||
}
|
||||
|
||||
for(Track::TrackSegments::iterator itr = track->getTrackSegments().begin();
|
||||
itr != track->getTrackSegments().end();
|
||||
++itr)
|
||||
{
|
||||
*itr = computeSmoothedTrackSegment(itr->get());
|
||||
}
|
||||
}
|
||||
|
||||
double totalDistance = 0.0;
|
||||
double totalAscent = 0.0;
|
||||
double totalDescent = 0.0;
|
||||
|
||||
osg::notify(osg::NOTICE)<<"Track read "<<track->getName()<<std::endl;
|
||||
for(Track::TrackSegments::iterator itr = track->getTrackSegments().begin();
|
||||
itr != track->getTrackSegments().end();
|
||||
++itr)
|
||||
{
|
||||
TrackSegment* ts = itr->get();
|
||||
|
||||
const TrackSegment::TrackPoints& points = ts->getTrackPoints();
|
||||
if (points.size()>1)
|
||||
{
|
||||
TrackSegment::TrackPoints::iterator pitr = ts->getTrackPoints().begin();
|
||||
osg::Vec3d previousPos;
|
||||
double previousElevation = pitr->elevation;
|
||||
em->convertLatLongHeightToXYZ(osg::DegreesToRadians(pitr->latitude), osg::DegreesToRadians(pitr->longitude), 0.0,
|
||||
previousPos.x(), previousPos.y(), previousPos.z());
|
||||
++pitr;
|
||||
|
||||
for(;
|
||||
pitr != ts->getTrackPoints().end();
|
||||
++pitr)
|
||||
{
|
||||
osg::Vec3d newPos;
|
||||
double newElevation = pitr->elevation;
|
||||
em->convertLatLongHeightToXYZ(osg::DegreesToRadians(pitr->latitude), osg::DegreesToRadians(pitr->longitude), 0.0,
|
||||
newPos.x(), newPos.y(), newPos.z());
|
||||
|
||||
double distance = (newPos-previousPos).length();
|
||||
|
||||
totalDistance += distance;
|
||||
if (newElevation>previousElevation) totalAscent += (newElevation-previousElevation);
|
||||
else totalDescent += (previousElevation-newElevation);
|
||||
|
||||
osg::notify(osg::NOTICE)<<" distance="<<distance<<", "<<newElevation-previousElevation<<std::endl;
|
||||
|
||||
previousPos = newPos;
|
||||
previousElevation = newElevation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double metersToFeet = 1 / 0.3048;
|
||||
double metersToMiles = 1.0 / 1609.344;
|
||||
|
||||
osg::notify(osg::NOTICE)<<"totalDistance = "<<totalDistance<<"m, "<<totalDistance*metersToMiles<<" miles"<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"totalAscent = "<<totalAscent<<"m, "<<totalAscent*metersToFeet<<"ft"<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"totalDescent = "<<totalDescent<<"m, "<<totalDescent*metersToFeet<<"ft"<<std::endl;
|
||||
|
||||
}
|
||||
|
||||
if (!outputFilename.empty())
|
||||
{
|
||||
std::ofstream fout(outputFilename.c_str());
|
||||
|
||||
fout<<"<?xml version=\"1.0\" encoding=\"utf-8\"?><gpx version=\"1.0\" creator=\"osggpx\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.topografix.com/GPX/1/0\" xsi:schemaLocation=\"http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd\">"<<std::endl;
|
||||
|
||||
for(Tracks::iterator itr = tracks.begin();
|
||||
itr != tracks.end();
|
||||
++itr)
|
||||
{
|
||||
Track* track = itr->get();
|
||||
|
||||
fout<<"<trk>"<<std::endl;
|
||||
fout<<"<desc>The track description</desc>"<<std::endl;
|
||||
for(Track::TrackSegments::iterator itr = track->getTrackSegments().begin();
|
||||
itr != track->getTrackSegments().end();
|
||||
++itr)
|
||||
{
|
||||
TrackSegment* ts = itr->get();
|
||||
fout<<"<trkseg>"<<std::endl;
|
||||
|
||||
for(TrackSegment::TrackPoints::iterator pitr = ts->getTrackPoints().begin();
|
||||
pitr != ts->getTrackPoints().end();
|
||||
++pitr)
|
||||
{
|
||||
fout<<"<trkpt lat=\""<<pitr->latitude<<"\" lon=\""<<pitr->longitude<<"\">"<<std::endl;
|
||||
fout<<"<ele>"<<pitr->elevation<<"</ele>"<<std::endl;
|
||||
fout<<"<time>"<<pitr->time<<"</time>"<<std::endl;
|
||||
fout<<"</trkpt>"<<std::endl;
|
||||
}
|
||||
|
||||
fout<<"</trkseg>"<<std::endl;
|
||||
|
||||
}
|
||||
fout<<"</trk>"<<std::endl;
|
||||
}
|
||||
fout<<"</gpx>"<<std::endl;
|
||||
}
|
||||
|
||||
osgViewer::Viewer viewer(arguments);
|
||||
viewer.setCameraManipulator(new osgGA::TerrainManipulator);
|
||||
viewer.setSceneData(group.get());
|
||||
return viewer.run();
|
||||
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
|
||||
osg::Group* createModel()
|
||||
{
|
||||
// no database loaded so automatically create Ed Levin Park
|
||||
// no database loaded so automatically create Ed Levin Park..
|
||||
osg::Group* group = new osg::Group;
|
||||
|
||||
// the base and sky subgraphs go to set the earth sky of the
|
||||
@@ -87,13 +87,13 @@ osg::Group* createModel()
|
||||
osg::ClearNode* clearNode = new osg::ClearNode;
|
||||
clearNode->setRequiresClear(false); // we've got base and sky to do it.
|
||||
|
||||
// use a transform to make the sky and base move around with the eye point.
|
||||
// use a transform to make the sky and base around with the eye point.
|
||||
osg::Transform* transform = new MoveEarthySkyWithEyePointTransform;
|
||||
|
||||
// transform's value isn't knowm until in the cull traversal so its bounding
|
||||
// volume is can't be determined, therefore culling will be invalid,
|
||||
// so switch it off, this causes all our paresnts to switch culling
|
||||
// off as well. But don't worry, culling will be back on once underneath
|
||||
// so switch it off, this cause all our paresnts to switch culling
|
||||
// off as well. But don't worry culling will be back on once underneath
|
||||
// this node or any other branch above this transform.
|
||||
transform->setCullingActive(false);
|
||||
|
||||
@@ -107,7 +107,7 @@ osg::Group* createModel()
|
||||
// add to earth sky to the scene.
|
||||
group->addChild(clearNode);
|
||||
|
||||
// the rest of the scene is drawn after the base and sky above.
|
||||
// the rest of the scene drawn after the base and sky above.
|
||||
group->addChild(makeTrees()); // will drop into a transparent, depth sorted bin (1)
|
||||
group->addChild(makeTerrain()); // will drop into default bin - state sorted 0
|
||||
group->addChild(makeTank()); // will drop into default bin - state sorted 0
|
||||
@@ -132,7 +132,7 @@ int main( int argc, char **argv )
|
||||
// construct the viewer.
|
||||
osgViewer::Viewer viewer;
|
||||
|
||||
// if user requests help write it out to cout.
|
||||
// if user request help write it out to cout.
|
||||
if (arguments.read("-h") || arguments.read("--help"))
|
||||
{
|
||||
arguments.getApplicationUsage()->write(std::cout);
|
||||
@@ -193,7 +193,7 @@ int main( int argc, char **argv )
|
||||
|
||||
}
|
||||
|
||||
// set up the camera manipulation with our custom manipultor
|
||||
// set up the camera manipulation with out custom manipultor
|
||||
viewer.setCameraManipulator(new GliderManipulator());
|
||||
|
||||
// pass the scene graph to the viewer
|
||||
|
||||
@@ -76,7 +76,7 @@ Node *makeTank( void )
|
||||
1
|
||||
);
|
||||
|
||||
// 42 required for sides, 22 for the top.
|
||||
// 42 required for sodes, 22 for the top.
|
||||
Vec3Array& vc = *(new Vec3Array(42+22));
|
||||
Vec2Array& tc = *(new Vec2Array(42+22));
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
osg::Camera* createHUD()
|
||||
{
|
||||
// create a camera to set up the projection and model view matrices, and the subgraph to draw in the HUD
|
||||
// create a camera to set up the projection and model view matrices, and the subgraph to drawn in the HUD
|
||||
osg::Camera* camera = new osg::Camera;
|
||||
|
||||
// set the projection matrix
|
||||
@@ -68,7 +68,7 @@ osg::Camera* createHUD()
|
||||
|
||||
std::string timesFont("fonts/arial.ttf");
|
||||
|
||||
// turn lighting off for the text and disable depth test to ensure it's always ontop.
|
||||
// turn lighting off for the text and disable depth test to ensure its always ontop.
|
||||
osg::StateSet* stateset = geode->getOrCreateStateSet();
|
||||
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||
|
||||
@@ -141,7 +141,7 @@ osg::Camera* createHUD()
|
||||
text->setFont(timesFont);
|
||||
text->setPosition(position);
|
||||
text->setText("And finally set the Camera's RenderOrder to POST_RENDER\n"
|
||||
"to make sure it's drawn last.");
|
||||
"to make sure its drawn last.");
|
||||
|
||||
position += delta;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ int main( int argc, char **argv )
|
||||
// read the scene from the list of file specified commandline args.
|
||||
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(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 mode instead.
|
||||
if (!scene) scene = osgDB::readNodeFile("dumptruck.osg");
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ int main( int argc, char **argv )
|
||||
|
||||
osg::Camera* hudCamera = createHUD();
|
||||
|
||||
// set up cameras to render on the first window available.
|
||||
// set up cameras to rendering on the first window available.
|
||||
hudCamera->setGraphicsContext(windows[0]);
|
||||
hudCamera->setViewport(0,0,windows[0]->getTraits()->width, windows[0]->getTraits()->height);
|
||||
|
||||
@@ -335,7 +335,7 @@ int main( int argc, char **argv )
|
||||
|
||||
osg::Camera* hudCamera = createHUD();
|
||||
|
||||
// set up cameras to render on the first window available.
|
||||
// set up cameras to rendering on the first window available.
|
||||
hudCamera->setGraphicsContext(windows[0]);
|
||||
hudCamera->setViewport(0,0,windows[0]->getTraits()->width, windows[0]->getTraits()->height);
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
SET(TARGET_SRC osgintrospection.cpp )
|
||||
SET(TARGET_ADDED_LIBRARIES osgIntrospection )
|
||||
|
||||
ADD_DEFINITIONS(-DOSG_PLUGIN_EXTENSION=${CMAKE_SHARED_MODULE_SUFFIX})
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_EXAMPLE(osgintrospection)
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
#include <osgIntrospection/PropertyInfo>
|
||||
|
||||
#include <osgDB/DynamicLibrary>
|
||||
#include <osg/Object>
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace osgIntrospection;
|
||||
|
||||
|
||||
// borrowed from osgDB...
|
||||
std::string createLibraryNameForWrapper(const std::string& ext)
|
||||
{
|
||||
@@ -49,9 +49,12 @@ std::string createLibraryNameForWrapper(const std::string& ext)
|
||||
#endif
|
||||
#endif
|
||||
#elif macintosh
|
||||
return "osgwrapper_" + ext;
|
||||
return "osgwrapper_"+ext;
|
||||
#elif defined(__hpux__)
|
||||
// why don't we use PLUGIN_EXT from the makefiles here?
|
||||
return "osgwrapper_"+ext+".sl";
|
||||
#else
|
||||
return "osgwrapper_" + ext + ADDQUOTES(OSG_PLUGIN_EXTENSION);
|
||||
return "osgwrapper_"+ext+".so";
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#include <osg/CoordinateSystemNode>
|
||||
#include <osgText/Text>
|
||||
|
||||
#include <osgManipulator/CommandManager>
|
||||
#include <osgManipulator/TabBoxDragger>
|
||||
#include <osgManipulator/TabBoxTrackballDragger>
|
||||
#include <osgManipulator/TabPlaneDragger>
|
||||
#include <osgManipulator/TabPlaneTrackballDragger>
|
||||
#include <osgManipulator/TrackballDragger>
|
||||
@@ -53,12 +53,6 @@ osgManipulator::Dragger* createDragger(const std::string& name)
|
||||
d->setupDefaultGeometry();
|
||||
dragger = d;
|
||||
}
|
||||
else if ("TabBoxTrackballDragger" == name)
|
||||
{
|
||||
osgManipulator::TabBoxTrackballDragger* d = new osgManipulator::TabBoxTrackballDragger();
|
||||
d->setupDefaultGeometry();
|
||||
dragger = d;
|
||||
}
|
||||
else if ("TrackballDragger" == name)
|
||||
{
|
||||
osgManipulator::TrackballDragger* d = new osgManipulator::TrackballDragger();
|
||||
@@ -96,41 +90,66 @@ osgManipulator::Dragger* createDragger(const std::string& name)
|
||||
}
|
||||
|
||||
|
||||
osg::Node* addDraggerToScene(osg::Node* scene, const std::string& name)
|
||||
osg::Node* createHUD()
|
||||
{
|
||||
osg::Geode* geode = new osg::Geode();
|
||||
|
||||
std::string timesFont("fonts/arial.ttf");
|
||||
|
||||
osg::StateSet* stateset = geode->getOrCreateStateSet();
|
||||
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||
|
||||
osgText::Text* text = new osgText::Text;
|
||||
geode->addDrawable( text );
|
||||
|
||||
osg::Vec3 position(50.0f,50.0f,0.0f);
|
||||
text->setPosition(position);
|
||||
text->setText("Use the Tab key to switch between the trackball and pick modes.");
|
||||
text->setFont(timesFont);
|
||||
|
||||
osg::Camera* camera = new osg::Camera;
|
||||
|
||||
// set the projection matrix
|
||||
camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
|
||||
|
||||
// set the view matrix
|
||||
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||
camera->setViewMatrix(osg::Matrix::identity());
|
||||
|
||||
// only clear the depth buffer
|
||||
camera->setClearMask(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// draw subgraph after main camera view.
|
||||
camera->setRenderOrder(osg::Camera::POST_RENDER);
|
||||
|
||||
camera->addChild(geode);
|
||||
|
||||
return camera;
|
||||
}
|
||||
|
||||
osg::Node* addDraggerToScene(osg::Node* scene, osgManipulator::CommandManager* cmdMgr, const std::string& name)
|
||||
{
|
||||
scene->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
|
||||
|
||||
osg::MatrixTransform* selection = new osg::MatrixTransform;
|
||||
osgManipulator::Selection* selection = new osgManipulator::Selection;
|
||||
selection->addChild(scene);
|
||||
|
||||
osgManipulator::Dragger* dragger = createDragger(name);
|
||||
|
||||
|
||||
osg::Group* root = new osg::Group;
|
||||
root->addChild(dragger);
|
||||
root->addChild(selection);
|
||||
root->addChild(createHUD());
|
||||
|
||||
float scale = scene->getBound().radius() * 1.6;
|
||||
dragger->setMatrix(osg::Matrix::scale(scale, scale, scale) *
|
||||
osg::Matrix::translate(scene->getBound().center()));
|
||||
|
||||
dragger->addTransformUpdating(selection);
|
||||
|
||||
// we want the dragger to handle it's own events automatically
|
||||
dragger->setHandleEvents(true);
|
||||
|
||||
// if we don't set an activation key or mod mask then any mouse click on
|
||||
// the dragger will activate it, however if do define either of ActivationModKeyMask or
|
||||
// and ActivationKeyEvent then you'll have to press either than mod key or the specified key to
|
||||
// be able to activate the dragger when you mouse click on it. Please note the follow allows
|
||||
// activation if either the ctrl key or the 'a' key is pressed and held down.
|
||||
dragger->setActivationModKeyMask(osgGA::GUIEventAdapter::MODKEY_CTRL);
|
||||
dragger->setActivationKeyEvent('a');
|
||||
cmdMgr->connect(*dragger, *selection);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
osg::Node* createDemoScene() {
|
||||
osg::Node* createDemoScene(osgManipulator::CommandManager* cmdMgr) {
|
||||
|
||||
osg::Group* root = new osg::Group;
|
||||
|
||||
@@ -206,13 +225,13 @@ osg::Node* createDemoScene() {
|
||||
matirial->setShininess(osg::Material::FRONT_AND_BACK, 64.0f);
|
||||
root->getOrCreateStateSet()->setAttributeAndModes(matirial.get(), osg::StateAttribute::ON);
|
||||
|
||||
transform_1.get()->addChild(addDraggerToScene(geode_1.get(),"TabBoxDragger"));
|
||||
transform_2.get()->addChild(addDraggerToScene(geode_2.get(),"TabPlaneDragger"));
|
||||
transform_3.get()->addChild(addDraggerToScene(geode_3.get(),"TabBoxTrackballDragger"));
|
||||
transform_4.get()->addChild(addDraggerToScene(geode_4.get(),"TrackballDragger"));
|
||||
transform_5.get()->addChild(addDraggerToScene(geode_5.get(),"Translate1DDragger"));
|
||||
transform_6.get()->addChild(addDraggerToScene(geode_6.get(),"Translate2DDragger"));
|
||||
transform_7.get()->addChild(addDraggerToScene(geode_7.get(),"TranslateAxisDragger"));
|
||||
transform_1.get()->addChild(addDraggerToScene(geode_1.get(),cmdMgr,"TabBoxDragger"));
|
||||
transform_2.get()->addChild(addDraggerToScene(geode_2.get(),cmdMgr,"TabPlaneDragger"));
|
||||
transform_3.get()->addChild(addDraggerToScene(geode_3.get(),cmdMgr,"TabPlaneTrackballDragger"));
|
||||
transform_4.get()->addChild(addDraggerToScene(geode_4.get(),cmdMgr,"TrackballDragger"));
|
||||
transform_5.get()->addChild(addDraggerToScene(geode_5.get(),cmdMgr,"Translate1DDragger"));
|
||||
transform_6.get()->addChild(addDraggerToScene(geode_6.get(),cmdMgr,"Translate2DDragger"));
|
||||
transform_7.get()->addChild(addDraggerToScene(geode_7.get(),cmdMgr,"TranslateAxisDragger"));
|
||||
|
||||
root->addChild(transform_1.get());
|
||||
root->addChild(transform_2.get());
|
||||
@@ -226,7 +245,104 @@ osg::Node* createDemoScene() {
|
||||
|
||||
return root;
|
||||
}
|
||||
//
|
||||
|
||||
|
||||
class PickModeHandler : public osgGA::GUIEventHandler
|
||||
{
|
||||
public:
|
||||
enum Modes
|
||||
{
|
||||
VIEW = 0,
|
||||
PICK
|
||||
};
|
||||
|
||||
PickModeHandler():
|
||||
_mode(VIEW),
|
||||
_activeDragger(0)
|
||||
{
|
||||
}
|
||||
|
||||
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa,
|
||||
osg::Object*, osg::NodeVisitor*)
|
||||
{
|
||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
|
||||
if (!view) return false;
|
||||
|
||||
if (ea.getKey() == osgGA::GUIEventAdapter::KEY_Tab &&
|
||||
ea.getEventType() == osgGA::GUIEventAdapter::KEYDOWN &&
|
||||
_activeDragger == 0)
|
||||
{
|
||||
_mode = ! _mode;
|
||||
}
|
||||
|
||||
if (VIEW == _mode) return false;
|
||||
|
||||
switch (ea.getEventType())
|
||||
{
|
||||
case osgGA::GUIEventAdapter::PUSH:
|
||||
{
|
||||
osgUtil::LineSegmentIntersector::Intersections intersections;
|
||||
|
||||
_pointer.reset();
|
||||
|
||||
if (view->computeIntersections(ea.getX(),ea.getY(),intersections))
|
||||
{
|
||||
_pointer.setCamera(view->getCamera());
|
||||
_pointer.setMousePosition(ea.getX(), ea.getY());
|
||||
|
||||
for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin();
|
||||
hitr != intersections.end();
|
||||
++hitr)
|
||||
{
|
||||
_pointer.addIntersection(hitr->nodePath, hitr->getLocalIntersectPoint());
|
||||
}
|
||||
for (osg::NodePath::iterator itr = _pointer._hitList.front().first.begin();
|
||||
itr != _pointer._hitList.front().first.end();
|
||||
++itr)
|
||||
{
|
||||
osgManipulator::Dragger* dragger = dynamic_cast<osgManipulator::Dragger*>(*itr);
|
||||
if (dragger)
|
||||
{
|
||||
|
||||
dragger->handle(_pointer, ea, aa);
|
||||
_activeDragger = dragger;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case osgGA::GUIEventAdapter::DRAG:
|
||||
case osgGA::GUIEventAdapter::RELEASE:
|
||||
{
|
||||
if (_activeDragger)
|
||||
{
|
||||
_pointer._hitIter = _pointer._hitList.begin();
|
||||
_pointer.setCamera(view->getCamera());
|
||||
_pointer.setMousePosition(ea.getX(), ea.getY());
|
||||
|
||||
_activeDragger->handle(_pointer, ea, aa);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (ea.getEventType() == osgGA::GUIEventAdapter::RELEASE)
|
||||
{
|
||||
_activeDragger = 0;
|
||||
_pointer.reset();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int _mode;
|
||||
osgManipulator::Dragger* _activeDragger;
|
||||
osgManipulator::PointerInfo _pointer;
|
||||
};
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
|
||||
@@ -278,13 +394,16 @@ int main( int argc, char **argv )
|
||||
// read the scene from the list of file specified command line args.
|
||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
||||
|
||||
// create a command manager
|
||||
osg::ref_ptr<osgManipulator::CommandManager> cmdMgr = new osgManipulator::CommandManager;
|
||||
|
||||
// if no model has been successfully loaded report failure.
|
||||
bool tragger2Scene(true);
|
||||
if (!loadedModel)
|
||||
{
|
||||
//std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||
//return 1;
|
||||
loadedModel = createDemoScene();
|
||||
loadedModel = createDemoScene(cmdMgr.get());
|
||||
tragger2Scene=false;
|
||||
}
|
||||
|
||||
@@ -309,11 +428,11 @@ int main( int argc, char **argv )
|
||||
|
||||
// pass the loaded scene graph to the viewer.
|
||||
if ( tragger2Scene ) {
|
||||
viewer.setSceneData(addDraggerToScene(loadedModel.get(), dragger_name));
|
||||
viewer.setSceneData(addDraggerToScene(loadedModel.get(), cmdMgr.get(), dragger_name));
|
||||
} else {
|
||||
viewer.setSceneData(loadedModel.get());
|
||||
}
|
||||
|
||||
viewer.addEventHandler(new PickModeHandler());
|
||||
|
||||
return viewer.run();
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
SET(TARGET_SRC osgmultiviewpaging.cpp )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_EXAMPLE(osgmultiviewpaging)
|
||||
@@ -1,190 +0,0 @@
|
||||
/* OpenSceneGraph example, osgcompositeviewer.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <osgUtil/Optimizer>
|
||||
#include <osgDB/ReadFile>
|
||||
|
||||
#include <osg/Material>
|
||||
#include <osg/Geode>
|
||||
#include <osg/BlendFunc>
|
||||
#include <osg/Depth>
|
||||
#include <osg/Projection>
|
||||
#include <osg/PolygonOffset>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Camera>
|
||||
#include <osg/FrontFace>
|
||||
|
||||
#include <osgText/Text>
|
||||
|
||||
#include <osgGA/TerrainManipulator>
|
||||
#include <osgGA/FlightManipulator>
|
||||
#include <osgGA/StateSetManipulator>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
|
||||
#include <osgViewer/CompositeViewer>
|
||||
|
||||
#include <osgFX/Scribe>
|
||||
|
||||
#include <osg/io_utils>
|
||||
|
||||
class MyPager : public osgDB::DatabasePager
|
||||
{
|
||||
public:
|
||||
virtual void updateSceneGraph(const osg::FrameStamp& frameStamp)
|
||||
{
|
||||
if (frameStamp.getFrameNumber() % 60 == 0)
|
||||
{
|
||||
osg::Timer_t start = osg::Timer::instance()->tick();
|
||||
osgDB::DatabasePager::updateSceneGraph(frameStamp);
|
||||
double d = osg::Timer::instance()->delta_m(start, osg::Timer::instance()->tick());
|
||||
std::cout << "DatabasePager update took " << d << " ms. Length of active nodes = " << _activePagedLODList.size() << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
|
||||
// use an ArgumentParser object to manage the program arguments.
|
||||
osg::ArgumentParser arguments(&argc,argv);
|
||||
|
||||
// read the scene from the list of file specified commandline args.
|
||||
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
|
||||
|
||||
if (!scene)
|
||||
{
|
||||
scene = osgDB::readNodeFile("http://www.openscenegraph.org/data/earth_bayarea/earth.ive");
|
||||
}
|
||||
|
||||
if (!scene)
|
||||
{
|
||||
std::cout << argv[0] << ": requires filename argument." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// construct the viewer.
|
||||
osgViewer::CompositeViewer viewer(arguments);
|
||||
|
||||
if (viewer.getNumViews()==0)
|
||||
{
|
||||
|
||||
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
||||
if (!wsi)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned int width, height;
|
||||
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
|
||||
|
||||
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
|
||||
traits->x = 100;
|
||||
traits->y = 100;
|
||||
traits->width = 1000;
|
||||
traits->height = 800;
|
||||
traits->windowDecoration = true;
|
||||
traits->doubleBuffer = true;
|
||||
traits->sharedContext = 0;
|
||||
|
||||
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
|
||||
if (gc.valid())
|
||||
{
|
||||
osg::notify(osg::INFO)<<" GraphicsWindow has been created successfully."<<std::endl;
|
||||
|
||||
// need to ensure that the window is cleared make sure that the complete window is set the correct colour
|
||||
// rather than just the parts of the window that are under the camera's viewports
|
||||
gc->setClearColor(osg::Vec4f(0.2f,0.2f,0.6f,1.0f));
|
||||
gc->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<" GraphicsWindow has not been created successfully."<<std::endl;
|
||||
}
|
||||
|
||||
// view one
|
||||
{
|
||||
osgViewer::View* view = new osgViewer::View;
|
||||
view->setName("View one");
|
||||
viewer.addView(view);
|
||||
|
||||
view->setSceneData(scene.get());
|
||||
view->getCamera()->setName("Cam one");
|
||||
view->getCamera()->setViewport(new osg::Viewport(0,0, traits->width/2, traits->height/2));
|
||||
view->getCamera()->setGraphicsContext(gc.get());
|
||||
|
||||
// add the state manipulator
|
||||
osg::ref_ptr<osgGA::StateSetManipulator> statesetManipulator = new osgGA::StateSetManipulator;
|
||||
statesetManipulator->setStateSet(view->getCamera()->getOrCreateStateSet());
|
||||
|
||||
view->setCameraManipulator(new osgGA::TerrainManipulator);
|
||||
view->addEventHandler( statesetManipulator.get() );
|
||||
|
||||
view->addEventHandler( new osgViewer::StatsHandler );
|
||||
view->addEventHandler( new osgViewer::HelpHandler );
|
||||
view->addEventHandler( new osgViewer::WindowSizeHandler );
|
||||
view->addEventHandler( new osgViewer::ThreadingHandler );
|
||||
view->addEventHandler( new osgViewer::RecordCameraPathHandler );
|
||||
}
|
||||
|
||||
// view two
|
||||
{
|
||||
osgViewer::View* view = new osgViewer::View;
|
||||
view->setName("View two");
|
||||
viewer.addView(view);
|
||||
|
||||
view->setSceneData(scene.get());
|
||||
view->getCamera()->setName("Cam two");
|
||||
view->getCamera()->setViewport(new osg::Viewport(traits->width/2,0, traits->width/2, traits->height/2));
|
||||
view->getCamera()->setGraphicsContext(gc.get());
|
||||
view->setCameraManipulator(new osgGA::TerrainManipulator);
|
||||
|
||||
}
|
||||
|
||||
// view three
|
||||
{
|
||||
osgViewer::View* view = new osgViewer::View;
|
||||
view->setName("View three");
|
||||
viewer.addView(view);
|
||||
|
||||
view->setSceneData(scene.get());
|
||||
|
||||
view->getCamera()->setName("Cam three");
|
||||
view->getCamera()->setProjectionMatrixAsPerspective(30.0, double(traits->width) / double(traits->height/2), 1.0, 1000.0);
|
||||
view->getCamera()->setViewport(new osg::Viewport(0, traits->height/2, traits->width, traits->height/2));
|
||||
view->getCamera()->setGraphicsContext(gc.get());
|
||||
view->setCameraManipulator(new osgGA::TerrainManipulator);
|
||||
|
||||
// attach custom database pager
|
||||
view->setDatabasePager(new MyPager);
|
||||
view->getDatabasePager()->setTargetMaximumNumberOfPageLOD(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
while (arguments.read("-s")) { viewer.setThreadingModel(osgViewer::CompositeViewer::SingleThreaded); }
|
||||
while (arguments.read("-g")) { viewer.setThreadingModel(osgViewer::CompositeViewer::CullDrawThreadPerContext); }
|
||||
while (arguments.read("-c")) { viewer.setThreadingModel(osgViewer::CompositeViewer::CullThreadPerCameraDrawThreadPerContext); }
|
||||
|
||||
// run the viewer's main frame loop
|
||||
return viewer.run();
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#this file is automatically generated
|
||||
|
||||
SET(TARGET_SRC osgoutline.cpp )
|
||||
SET(TARGET_ADDED_LIBRARIES osgFX osgGA )
|
||||
#### end var setup ###
|
||||
SETUP_EXAMPLE(osgoutline)
|
||||
@@ -1,46 +0,0 @@
|
||||
// -*-c++-*-
|
||||
|
||||
/*
|
||||
* Draw an outline around a model.
|
||||
*/
|
||||
|
||||
#include <osg/Group>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgViewer/Viewer>
|
||||
|
||||
#include <osgFX/Outline>
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
osg::ArgumentParser arguments(&argc,argv);
|
||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] <file>");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
|
||||
|
||||
// create outline effect
|
||||
osg::ref_ptr<osgFX::Outline> outline = new osgFX::Outline;
|
||||
outline->setWidth(8);
|
||||
outline->setColor(osg::Vec4(1,1,0,1));
|
||||
|
||||
// create scene
|
||||
osg::ref_ptr<osg::Group> root = new osg::Group;
|
||||
root->addChild(outline.get());
|
||||
|
||||
osg::ref_ptr<osg::Node> model0 = osgDB::readNodeFile(arguments.argc() > 1 ? arguments[1] : "al.obj");
|
||||
outline->addChild(model0.get());
|
||||
|
||||
// must have stencil buffer...
|
||||
osg::DisplaySettings::instance()->setMinimumNumStencilBits(1);
|
||||
|
||||
// construct the viewer
|
||||
osgViewer::Viewer viewer;
|
||||
viewer.setSceneData(root.get());
|
||||
|
||||
// must clear stencil buffer...
|
||||
unsigned int clearMask = viewer.getCamera()->getClearMask();
|
||||
viewer.getCamera()->setClearMask(clearMask | GL_STENCIL_BUFFER_BIT);
|
||||
viewer.getCamera()->setClearStencil(0);
|
||||
|
||||
return viewer.run();
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class UniformVarying : public osg::Uniform::Callback
|
||||
}
|
||||
};
|
||||
|
||||
osg::Node* createModel(const std::string& shader, const std::string& textureFileName, const std::string& terrainFileName, bool dynamic, bool useVBO)
|
||||
osg::Node* createModel(const std::string& shader, const std::string& textureFileName, const std::string& terrainFileName, bool dynamic, bool vbo)
|
||||
{
|
||||
osg::Geode* geode = new osg::Geode;
|
||||
|
||||
@@ -238,10 +238,10 @@ osg::Node* createModel(const std::string& shader, const std::string& textureFile
|
||||
|
||||
geom->setVertexArray(vertices);
|
||||
|
||||
osg::VertexBufferObject* vbo = useVBO ? new osg::VertexBufferObject : 0;
|
||||
if (vbo) vertices->setVertexBufferObject(vbo);
|
||||
osg::VertexBufferObject* vbObject = new osg::VertexBufferObject;
|
||||
vertices->setVertexBufferObject(vbObject);
|
||||
|
||||
osg::ElementBufferObject* ebo = useVBO ? new osg::ElementBufferObject : 0;
|
||||
osg::ElementBufferObject* ebo = new osg::ElementBufferObject;
|
||||
|
||||
for(iy=0; iy<num_y-1; ++iy)
|
||||
{
|
||||
@@ -255,10 +255,10 @@ osg::Node* createModel(const std::string& shader, const std::string& textureFile
|
||||
}
|
||||
geom->addPrimitiveSet(elements);
|
||||
|
||||
if (ebo) elements->setElementBufferObject(ebo);
|
||||
if (ebo) elements->setElementBufferObject(ebo);
|
||||
}
|
||||
|
||||
geom->setUseVertexBufferObjects(useVBO);
|
||||
geom->setUseVertexBufferObjects(vbo);
|
||||
|
||||
return geode;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
|
||||
#include <osgViewer/Viewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
|
||||
#include <osg/Group>
|
||||
#include <osg/Geode>
|
||||
@@ -323,121 +322,6 @@ osgParticle::ParticleSystem *create_complex_particle_system(osg::Group *root)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// ANIMATED PARTICLE SYSTEM CREATION
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
osgParticle::ParticleSystem *create_animated_particle_system(osg::Group *root)
|
||||
{
|
||||
|
||||
// Now we will create a particle system that uses two emitters to
|
||||
// display two animated particles, one showing an explosion, the other
|
||||
// a smoke cloud. A particle system can only use one texture, so
|
||||
// the animations for both particles are stored in a single bitmap.
|
||||
// The frames of the animation are stored in tiles. For each particle
|
||||
// template, the start and end tile of their animation have to be given.
|
||||
// The example file used here has 64 tiles, stored in eight rows with
|
||||
// eight images each.
|
||||
|
||||
// First create a prototype for the explosion particle.
|
||||
osgParticle::Particle pexplosion;
|
||||
|
||||
// The frames of the explosion particle are played from birth to
|
||||
// death of the particle. So if lifetime is one second, all 16 images
|
||||
// of the particle are shown in this second.
|
||||
pexplosion.setLifeTime(1);
|
||||
|
||||
// some other particle properties just as in the last example.
|
||||
pexplosion.setSizeRange(osgParticle::rangef(0.75f, 3.0f));
|
||||
pexplosion.setAlphaRange(osgParticle::rangef(0.5f, 1.0f));
|
||||
pexplosion.setColorRange(osgParticle::rangev4(
|
||||
osg::Vec4(1, 1, 1, 1),
|
||||
osg::Vec4(1, 1, 1, 1)));
|
||||
pexplosion.setRadius(0.05f);
|
||||
pexplosion.setMass(0.05f);
|
||||
|
||||
// This command sets the animation tiles to be shown for the particle.
|
||||
// The first two parameters define the tile layout of the texture image.
|
||||
// 8, 8 means the texture has eight rows of tiles with eight columns each.
|
||||
// 0, 15 defines the start and end tile
|
||||
pexplosion.setTextureTileRange(8, 8, 0, 15);
|
||||
|
||||
// The smoke particle is just the same, only plays another tile range.
|
||||
osgParticle::Particle psmoke = pexplosion;
|
||||
psmoke.setTextureTileRange(8, 8, 32, 45);
|
||||
|
||||
// Create a single particle system for both particle types
|
||||
osgParticle::ParticleSystem *ps = new osgParticle::ParticleSystem;
|
||||
|
||||
// Assign the tiled texture
|
||||
ps->setDefaultAttributes("Images/fireparticle8x8.png", false, false);
|
||||
|
||||
// Create two emitters, one for the explosions, one for the smoke balls.
|
||||
osgParticle::ModularEmitter *emitter1 = new osgParticle::ModularEmitter;
|
||||
emitter1->setParticleSystem(ps);
|
||||
emitter1->setParticleTemplate(pexplosion);
|
||||
|
||||
osgParticle::ModularEmitter *emitter2 = new osgParticle::ModularEmitter;
|
||||
emitter2->setParticleSystem(ps);
|
||||
emitter2->setParticleTemplate(psmoke);
|
||||
|
||||
// create a counter each. We could reuse the counter for both emitters, but
|
||||
// then we could not control the ratio of smoke balls to explosions
|
||||
osgParticle::RandomRateCounter *counter1 = new osgParticle::RandomRateCounter;
|
||||
counter1->setRateRange(10, 10);
|
||||
emitter1->setCounter(counter1);
|
||||
|
||||
osgParticle::RandomRateCounter *counter2 = new osgParticle::RandomRateCounter;
|
||||
counter2->setRateRange(3, 4);
|
||||
emitter2->setCounter(counter2);
|
||||
|
||||
// setup a single placer for both emitters.
|
||||
osgParticle::SectorPlacer *placer = new osgParticle::SectorPlacer;
|
||||
placer->setCenter(-8, 0, 0);
|
||||
placer->setRadiusRange(2.5, 5);
|
||||
placer->setPhiRange(0, 2 * osg::PI); // 360<36> angle to make a circle
|
||||
emitter1->setPlacer(placer);
|
||||
emitter2->setPlacer(placer);
|
||||
|
||||
// the shooter is reused for both emitters
|
||||
osgParticle::RadialShooter *shooter = new osgParticle::RadialShooter;
|
||||
shooter->setInitialSpeedRange(0, 0);
|
||||
|
||||
// give particles a little spin
|
||||
shooter->setInitialRotationalSpeedRange(osgParticle::rangev3(
|
||||
osg::Vec3(0, 0, -1),
|
||||
osg::Vec3(0, 0, 1)));
|
||||
emitter1->setShooter(shooter);
|
||||
emitter2->setShooter(shooter);
|
||||
|
||||
// add both emitters to the scene graph
|
||||
root->addChild(emitter1);
|
||||
root->addChild(emitter2);
|
||||
|
||||
// create a program, just as before
|
||||
osgParticle::ModularProgram *program = new osgParticle::ModularProgram;
|
||||
program->setParticleSystem(ps);
|
||||
|
||||
// create an operator that moves the particles upwards
|
||||
osgParticle::AccelOperator *op1 = new osgParticle::AccelOperator;
|
||||
op1->setAcceleration(osg::Vec3(0, 0, 2.0f));
|
||||
program->addOperator(op1);
|
||||
|
||||
// add the program to the scene graph
|
||||
root->addChild(program);
|
||||
|
||||
// create a Geode to contain our particle system.
|
||||
osg::Geode *geode = new osg::Geode;
|
||||
geode->addDrawable(ps);
|
||||
|
||||
// add the geode to the scene graph.
|
||||
root->addChild(geode);
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// MAIN SCENE GRAPH BUILDING FUNCTION
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -456,7 +340,6 @@ void build_world(osg::Group *root)
|
||||
|
||||
osgParticle::ParticleSystem *ps1 = create_simple_particle_system(root);
|
||||
osgParticle::ParticleSystem *ps2 = create_complex_particle_system(root);
|
||||
osgParticle::ParticleSystem *ps3 = create_animated_particle_system(root);
|
||||
|
||||
// Now that the particle systems and all other related objects have been
|
||||
// created, we have to add an "updater" node to the scene graph. This node
|
||||
@@ -465,7 +348,6 @@ void build_world(osg::Group *root)
|
||||
osgParticle::ParticleSystemUpdater *psu = new osgParticle::ParticleSystemUpdater;
|
||||
psu->addParticleSystem(ps1);
|
||||
psu->addParticleSystem(ps2);
|
||||
psu->addParticleSystem(ps3);
|
||||
|
||||
// add the updater node to the scene graph
|
||||
root->addChild(psu);
|
||||
@@ -486,9 +368,6 @@ int main(int, char **)
|
||||
osg::Group *root = new osg::Group;
|
||||
build_world(root);
|
||||
|
||||
// add the stats handler
|
||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||
|
||||
// add a viewport to the viewer and attach the scene graph.
|
||||
viewer.setSceneData(root);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user