Compare commits
90 Commits
OpenSceneG
...
OpenSceneG
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b02a5b85a6 | ||
|
|
45d5cc4745 | ||
|
|
54bafb9cc6 | ||
|
|
97b6099fa5 | ||
|
|
03b59e970b | ||
|
|
60746206f1 | ||
|
|
84f4ff1d96 | ||
|
|
c68440f3cb | ||
|
|
42d6b86530 | ||
|
|
866da7bdd5 | ||
|
|
14b8c242cf | ||
|
|
ad817735cf | ||
|
|
ede2f9d58a | ||
|
|
9a44ab4440 | ||
|
|
be9bd9cd08 | ||
|
|
4d19d54de5 | ||
|
|
83887b61d7 | ||
|
|
90afef26bb | ||
|
|
1753cad35f | ||
|
|
df098a3a8d | ||
|
|
87bf7980e2 | ||
|
|
5b4051d9e8 | ||
|
|
75bce7da0b | ||
|
|
b1045223f1 | ||
|
|
68a97a6424 | ||
|
|
419a228fe9 | ||
|
|
b970343c47 | ||
|
|
9529b14f3c | ||
|
|
902c4aa1e9 | ||
|
|
c0d2ccc017 | ||
|
|
0ce917d3bb | ||
|
|
806993f3e0 | ||
|
|
8f4c026a85 | ||
|
|
373687b72f | ||
|
|
73026ea973 | ||
|
|
55ff7019a1 | ||
|
|
efa37bd4c4 | ||
|
|
b4a32f6cab | ||
|
|
9ffd6d1dc0 | ||
|
|
701c976495 | ||
|
|
3f7406e903 | ||
|
|
0079c132a7 | ||
|
|
3254630625 | ||
|
|
125fa6d05d | ||
|
|
a92241d40d | ||
|
|
8ea9d68c9c | ||
|
|
1e94ed9fa8 | ||
|
|
cd7dc0f161 | ||
|
|
6779944c0e | ||
|
|
d5f476a822 | ||
|
|
b361047aa0 | ||
|
|
bd2ad48c00 | ||
|
|
e306f27e23 | ||
|
|
26ee7e07d3 | ||
|
|
3660e3a3c3 | ||
|
|
cb627520a7 | ||
|
|
c5867e4957 | ||
|
|
8f20178748 | ||
|
|
c93ef23d2f | ||
|
|
69659ade08 | ||
|
|
d4e68e5d73 | ||
|
|
b29bf3fe06 | ||
|
|
8f23b42ed2 | ||
|
|
17d876f787 | ||
|
|
5cb72e06c2 | ||
|
|
68ac058045 | ||
|
|
75fa5c0555 | ||
|
|
3159b36acd | ||
|
|
893a6365a4 | ||
|
|
e330051cf3 | ||
|
|
672777189a | ||
|
|
1ef313787d | ||
|
|
35c26bb5aa | ||
|
|
8aee244e64 | ||
|
|
12ca59d3e5 | ||
|
|
93156fd2ce | ||
|
|
e9d597b392 | ||
|
|
781e4e259d | ||
|
|
46fa819fa1 | ||
|
|
80e1adfb6c | ||
|
|
ff216c2100 | ||
|
|
7f6938ebad | ||
|
|
1dc91aa355 | ||
|
|
caa9e38d2b | ||
|
|
6402710910 | ||
|
|
b087e0f952 | ||
|
|
98a2ec67a6 | ||
|
|
d5d9f4c082 | ||
|
|
a656e402b7 | ||
|
|
f173ea4224 |
209
AUTHORS.txt
209
AUTHORS.txt
@@ -1,6 +1,6 @@
|
|||||||
OpenSceneGraph Library 3.2.2
|
OpenSceneGraph Library 3.0.1
|
||||||
|
|
||||||
529 Contributors:
|
466 Contributors:
|
||||||
|
|
||||||
Firstname Surname
|
Firstname Surname
|
||||||
-----------------
|
-----------------
|
||||||
@@ -8,113 +8,102 @@ Robert Osfield
|
|||||||
Don Burns
|
Don Burns
|
||||||
Stephan Huber
|
Stephan Huber
|
||||||
Paul Martz
|
Paul Martz
|
||||||
Mathias Fr<46>hlich
|
|
||||||
Farshid Lashkari
|
|
||||||
Marco Jez
|
Marco Jez
|
||||||
Wang Rui
|
Mathias Fr<46>hlich
|
||||||
Jean-S<>bastien Guay
|
|
||||||
Ulrich Hertlein
|
|
||||||
Mike Weiblen
|
Mike Weiblen
|
||||||
Sukender
|
Jean-S<>bastien Guay
|
||||||
|
Farshid Lashkari
|
||||||
Eric Wing
|
Eric Wing
|
||||||
|
Wang Rui
|
||||||
|
Ulrich Hertlein
|
||||||
Cedric Pinson
|
Cedric Pinson
|
||||||
Brede Johansen
|
Brede Johansen
|
||||||
Bob Kuehne
|
Sukender
|
||||||
Michael Platings
|
Michael Platings
|
||||||
|
Bob Kuehne
|
||||||
Geoff Michel
|
Geoff Michel
|
||||||
Wojciech Lewandowski
|
|
||||||
Eric Sokolowsky
|
Eric Sokolowsky
|
||||||
|
Wojciech Lewandowski
|
||||||
David Callu
|
David Callu
|
||||||
Laurens Voerman
|
|
||||||
Colin McDonald
|
|
||||||
Trajce Nikolov
|
Trajce Nikolov
|
||||||
Tim Moore
|
Tim Moore
|
||||||
Martin Lavery
|
Martin Lavery
|
||||||
|
Colin McDonald
|
||||||
Tree
|
Tree
|
||||||
Luigi Calori
|
Luigi Calori
|
||||||
Mike Wittman
|
Mike Wittman
|
||||||
Jason Beverage
|
|
||||||
Chris Hanson
|
|
||||||
Roland Smeenk
|
Roland Smeenk
|
||||||
Roger James
|
Roger James
|
||||||
Mattias Helsing
|
|
||||||
Jeremy Moles
|
Jeremy Moles
|
||||||
|
Chris Hanson
|
||||||
|
Jason Beverage
|
||||||
|
Mattias Helsing
|
||||||
Jan Peciva
|
Jan Peciva
|
||||||
Alberto Luaces
|
|
||||||
J.P. Delport
|
|
||||||
Magnus Kessler
|
|
||||||
David Fries
|
|
||||||
Andy Skinner
|
Andy Skinner
|
||||||
Tom Jolley
|
|
||||||
Paul Melis
|
Paul Melis
|
||||||
Luc Frauciel
|
J.P. Delport
|
||||||
|
David Fries
|
||||||
|
Tom Jolley
|
||||||
Pavel Moloshtan
|
Pavel Moloshtan
|
||||||
Brad Christiansen
|
|
||||||
Olaf Flebbe
|
|
||||||
Mathieu Marache
|
|
||||||
Jason Daly
|
Jason Daly
|
||||||
Aurelien Albert
|
Alberto Luaces
|
||||||
Art Tevs
|
|
||||||
Philip Lowman
|
Philip Lowman
|
||||||
Per Fahlberg
|
Per Fahlberg
|
||||||
Norman Vine
|
Norman Vine
|
||||||
Lionel Lagarde
|
Art Tevs
|
||||||
Terry Welsh
|
|
||||||
Serge Lages
|
Serge Lages
|
||||||
Romano Jos<6F> Magacho da Silva
|
Magnus Kessler
|
||||||
Pjotr Svetachov
|
Laurens Voerman
|
||||||
Chris Denham
|
|
||||||
Alberto Farre
|
Alberto Farre
|
||||||
Torben Dannhauer
|
Terry Welsh
|
||||||
Sherman Wilcox
|
Sherman Wilcox
|
||||||
Robert Michael
|
Robert Milharcic
|
||||||
Mourad Boufarguine
|
Olaf Flebbe
|
||||||
Glenn Waldron
|
Mathieu Marache
|
||||||
Andr<EFBFBD> Garneau
|
Andr<EFBFBD> Garneau
|
||||||
Adrian Egli
|
Adrian Egli
|
||||||
Ruben Lopez
|
Ruben Lopez
|
||||||
Randall Hopper
|
Randall Hopper
|
||||||
Jan Ciger
|
Mourad Boufarguine
|
||||||
|
Brad Christiansen
|
||||||
Gideon May
|
Gideon May
|
||||||
Don Tidrow
|
Don Tidrow
|
||||||
|
Chris Denham
|
||||||
Stephane Lamoliatte
|
Stephane Lamoliatte
|
||||||
|
Romano Jos<6F> Magacho da Silva
|
||||||
Michael Gronager
|
Michael Gronager
|
||||||
Martin Naylor
|
|
||||||
Joakim Simonsson
|
Joakim Simonsson
|
||||||
David Spilling
|
David Spilling
|
||||||
Daniel Sj<53>lie
|
Daniel Sj<53>lie
|
||||||
Bryan Thrall
|
Bryan Thrall
|
||||||
|
Glenn Waldron
|
||||||
Fabien Lavignotte
|
Fabien Lavignotte
|
||||||
Andreas Ekstrand
|
Torben Dannhauer
|
||||||
Riccardo Corsi
|
|
||||||
Mike Connell
|
|
||||||
Melchior Franz
|
Melchior Franz
|
||||||
Johannes Baeuerle
|
Lionel Lagarde
|
||||||
Thomas Hogarth
|
Jan Ciger
|
||||||
Sebastian Messerschmidt
|
|
||||||
Rafa Gaitan
|
Rafa Gaitan
|
||||||
Neil Hughes
|
Neil Hughes
|
||||||
|
Mike Connell
|
||||||
Martin Beckett
|
Martin Beckett
|
||||||
Joran Jessurun
|
Joran Jessurun
|
||||||
Gino van den Bergen
|
Gino van den Bergen
|
||||||
Frederic Marmond
|
Frederic Marmond
|
||||||
David Guthrie
|
David Guthrie
|
||||||
Csaba Halasz
|
Csaba Halasz
|
||||||
Cory Riddell
|
|
||||||
Chuck Seberino
|
|
||||||
Boris Bralo
|
Boris Bralo
|
||||||
|
Andreas Ekstrand
|
||||||
Yefei He
|
Yefei He
|
||||||
Sondra Iverson
|
Sondra Iverson
|
||||||
Simon Julier
|
Simon Julier
|
||||||
Rune Schmidt Jensen
|
Rune Schmidt Jensen
|
||||||
Rainer Oder
|
Rainer Oder
|
||||||
Nico Kruithof
|
Martin Naylor
|
||||||
Martin Aumueller
|
Martin Aumueller
|
||||||
Mario Valle
|
Mario Valle
|
||||||
Lukasz Izdebski
|
Luc Frauciel
|
||||||
Jorge Izquierdo Ciges
|
|
||||||
Gordon Tomlinson
|
Gordon Tomlinson
|
||||||
Frederic Bouvier
|
Cory Riddell
|
||||||
Carlo Camporesi
|
Carlo Camporesi
|
||||||
Ben Discoe
|
Ben Discoe
|
||||||
Thibault Genessay
|
Thibault Genessay
|
||||||
@@ -122,23 +111,20 @@ Sasa Bistrovic
|
|||||||
Ravi Mathur
|
Ravi Mathur
|
||||||
Ralf Habacker
|
Ralf Habacker
|
||||||
Neil Groves
|
Neil Groves
|
||||||
Mikhail Izmestev
|
|
||||||
Markus Trenkwalder
|
Markus Trenkwalder
|
||||||
Loic Dachary
|
Loic Dachary
|
||||||
Joseph Steel
|
Joseph Steel
|
||||||
Jordi Torres
|
Jorge Izquierdo
|
||||||
John Shue
|
John Shue
|
||||||
|
Johannes Baeuerle
|
||||||
|
Chuck Seberino
|
||||||
Brad Colbert
|
Brad Colbert
|
||||||
Bj<EFBFBD>rn Blissing
|
|
||||||
Alexander Sinditskiy
|
|
||||||
Vivek Rajan
|
Vivek Rajan
|
||||||
Uwe Woessner
|
Uwe Woessner
|
||||||
Tony Horrobin
|
|
||||||
Thom DeCarlo
|
Thom DeCarlo
|
||||||
Tatsuhiro Nishioka
|
Tatsuhiro Nishioka
|
||||||
Tanguy Fautr<74>
|
Tanguy Fautr<74>
|
||||||
Sean Spicer
|
Sean Spicer
|
||||||
Ryan Kawicki
|
|
||||||
Richard Schmidt
|
Richard Schmidt
|
||||||
Peter Hrenka
|
Peter Hrenka
|
||||||
Paul de Repentigny
|
Paul de Repentigny
|
||||||
@@ -147,77 +133,72 @@ Neil Salter
|
|||||||
Mihai Radu
|
Mihai Radu
|
||||||
Michael Hartman
|
Michael Hartman
|
||||||
Martins Innus
|
Martins Innus
|
||||||
Marc Helbling
|
|
||||||
Maciej Krol
|
Maciej Krol
|
||||||
Lilin Xiong
|
|
||||||
Leandro Motta Barros
|
|
||||||
Johan Nouvel
|
Johan Nouvel
|
||||||
Hartwig Wiesmann
|
Hartwig Wiesmann
|
||||||
|
Frederic Bouvier
|
||||||
Donn Mielcarek
|
Donn Mielcarek
|
||||||
Corbin Holtz
|
Corbin Holtz
|
||||||
Blasius Czink
|
Blasius Czink
|
||||||
Alexander Irion
|
|
||||||
Toshiyuki Takahei
|
Toshiyuki Takahei
|
||||||
|
Tony Horrobin
|
||||||
Sebastien Grignard
|
Sebastien Grignard
|
||||||
Rudolf Wiedemann
|
Ryan Kawicki
|
||||||
Robert Milharcic
|
Romano Magacho
|
||||||
|
Riccardo Corsi
|
||||||
|
Nico Kruithof
|
||||||
|
Mikhail Izmestev
|
||||||
Maria Ten
|
Maria Ten
|
||||||
Liang Aibin
|
Liang Aibin
|
||||||
Kristofer Tingdahl
|
Leandro Motta Barros
|
||||||
Konstantin Matveyev
|
|
||||||
Katharina Plugge
|
Katharina Plugge
|
||||||
John Vidar Larring
|
John Vidar Larring
|
||||||
John Kelso
|
John Kelso
|
||||||
John Ivar
|
John Ivar
|
||||||
Gustav Haapalahti
|
Gustav Haapalahti
|
||||||
Erik den Dekker
|
|
||||||
Emmanuel Roche
|
Emmanuel Roche
|
||||||
Domenico Mangieri
|
|
||||||
Daniel Larimer
|
Daniel Larimer
|
||||||
Colin Dunlop
|
Colin Dunlop
|
||||||
Bruce Clay
|
Bruce Clay
|
||||||
Bradley Anderegg
|
Bradley Anderegg
|
||||||
Andreas Goebel
|
Andreas Goebel
|
||||||
Alok Priyadarshi
|
Alok Priyadarshi
|
||||||
|
Alexander Irion
|
||||||
Alberto Barbati
|
Alberto Barbati
|
||||||
Alan Dickinson
|
Alan Dickinson
|
||||||
Vladimir Shabanov
|
Vladimir Shabanov
|
||||||
Vladimir Chebaev
|
|
||||||
Tugkan Calapoglu
|
Tugkan Calapoglu
|
||||||
Tim Daoust
|
Tim Daoust
|
||||||
|
Thomas Hogarth
|
||||||
Sohey Yamamoto
|
Sohey Yamamoto
|
||||||
Sergey Leontyev
|
Sergey Leontyev
|
||||||
Santosh Gaikwad
|
Santosh Gaikwad
|
||||||
Ryan Pavlik
|
Ryan Pavlik
|
||||||
|
Rudolf Wiedemann
|
||||||
Rene Molenaar
|
Rene Molenaar
|
||||||
Piotr Domagalski
|
|
||||||
Phil Atkin
|
Phil Atkin
|
||||||
Nathan Monteleone
|
Nathan Monteleone
|
||||||
Miguel Escriva
|
Miguel Escriva
|
||||||
Mattias Linde
|
Mattias Linde
|
||||||
Mark Sciabica
|
Mark Sciabica
|
||||||
Marcin Prus
|
Lilin Xiong
|
||||||
Lee Butler
|
Lee Butler
|
||||||
Lars Nilsson
|
|
||||||
Konstantin Sinitsyn
|
Konstantin Sinitsyn
|
||||||
Ken Sewell
|
Ken Sewell
|
||||||
Julian Ortiz
|
Julian Ortiz
|
||||||
John Kaniarz
|
|
||||||
Jim Vaughan
|
Jim Vaughan
|
||||||
Jeremy Bell
|
Jeremy Bell
|
||||||
Jaromir Vitek
|
Jaromir Vitek
|
||||||
James French
|
James French
|
||||||
Guillaume Millet
|
|
||||||
Gary Quinn
|
Gary Quinn
|
||||||
Garrett Potts
|
Garrett Potts
|
||||||
Gabor Dorka
|
Gabor Dorka
|
||||||
Fabio Mierlo
|
Fabio Mierlo
|
||||||
|
Erik den Dekker
|
||||||
Doug McCorkle
|
Doug McCorkle
|
||||||
Donald Cipperly
|
Donald Cipperly
|
||||||
Don Leich
|
Don Leich
|
||||||
Dietmar Funck
|
Domenico Mangieri
|
||||||
Colin Cochran
|
|
||||||
Christian Buchner
|
|
||||||
Charles Cole
|
Charles Cole
|
||||||
Blake Williams
|
Blake Williams
|
||||||
Antoine Hue
|
Antoine Hue
|
||||||
@@ -225,10 +206,8 @@ Andrew Bettison
|
|||||||
Anders Backman
|
Anders Backman
|
||||||
Ali Botorabi
|
Ali Botorabi
|
||||||
Alexander Wiebel
|
Alexander Wiebel
|
||||||
Alessandro Terenzi
|
|
||||||
Zach Deedler
|
Zach Deedler
|
||||||
Yuzhong Shen
|
Yuzhong Shen
|
||||||
Wee See
|
|
||||||
Warren Macchi
|
Warren Macchi
|
||||||
Vincent Bourdier
|
Vincent Bourdier
|
||||||
Terrex
|
Terrex
|
||||||
@@ -238,19 +217,15 @@ Steve Lunsford
|
|||||||
Stephane Simon
|
Stephane Simon
|
||||||
Stephan Eilemann
|
Stephan Eilemann
|
||||||
Stanislav Blinov
|
Stanislav Blinov
|
||||||
Sergey Polischuk
|
Sebastian Messerschmidt
|
||||||
Raymond de Vries
|
Raymond de Vries
|
||||||
Ralf Kern
|
Ralf Kern
|
||||||
Piotr Gwiazdowski
|
Piotr Gwiazdowski
|
||||||
Pierre Haritchabalet
|
Pierre Haritchabalet
|
||||||
Perry Miller
|
Perry Miller
|
||||||
Pawel Ksiezopolski
|
|
||||||
Paul Palumbo
|
|
||||||
Paul Obermeier
|
Paul Obermeier
|
||||||
Patrick Neary
|
|
||||||
Nguyen Van Truong
|
Nguyen Van Truong
|
||||||
Nathan Cournia
|
Nathan Cournia
|
||||||
Morten Haukness
|
|
||||||
Morn<EFBFBD> Pistorius
|
Morn<EFBFBD> Pistorius
|
||||||
Michael Henheffer
|
Michael Henheffer
|
||||||
Michael Guerrero
|
Michael Guerrero
|
||||||
@@ -258,28 +233,22 @@ Maya Leonard
|
|||||||
Max Bandazian
|
Max Bandazian
|
||||||
Mathias Fiedler
|
Mathias Fiedler
|
||||||
Mathew May
|
Mathew May
|
||||||
Martin von Gargern
|
|
||||||
Martin Spott
|
Martin Spott
|
||||||
Martin Lambers
|
|
||||||
Martijn Kragtwijk
|
Martijn Kragtwijk
|
||||||
Marius Heise
|
Marius Heise
|
||||||
Marcin Hajder
|
Marcin Hajder
|
||||||
Marcel Pursche
|
Lukasz Izdebski
|
||||||
Lilith Bryant
|
Lilith Bryant
|
||||||
|
Lars Nilsson
|
||||||
Kevin Moiule
|
Kevin Moiule
|
||||||
Keith Steffen
|
Keith Steffen
|
||||||
Julien Valentin
|
|
||||||
Julen Garcia
|
Julen Garcia
|
||||||
Joseph Winston
|
Joseph Winston
|
||||||
John Aughey
|
John Aughey
|
||||||
Johannes Scholz
|
|
||||||
Joachim Pouderoux
|
Joachim Pouderoux
|
||||||
Jean-Christophe Lombardo
|
Jean-Christophe Lombardo
|
||||||
Javier Taibo
|
Javier Taibo
|
||||||
Jannik Heller
|
|
||||||
Jan Klimke
|
|
||||||
James Moliere
|
James Moliere
|
||||||
Jaap Glas
|
|
||||||
Igor Kravtchenko
|
Igor Kravtchenko
|
||||||
Himar Carmona
|
Himar Carmona
|
||||||
He Sicong
|
He Sicong
|
||||||
@@ -287,8 +256,6 @@ Guy Volckaert
|
|||||||
Gustavo Wagner
|
Gustavo Wagner
|
||||||
Guillaume Taze
|
Guillaume Taze
|
||||||
Guillaume Chouvenc
|
Guillaume Chouvenc
|
||||||
Giuseppe Donvito
|
|
||||||
Gill Peacegood
|
|
||||||
Gerrick Bivins
|
Gerrick Bivins
|
||||||
George Tarantilis
|
George Tarantilis
|
||||||
Ferdi Smit
|
Ferdi Smit
|
||||||
@@ -296,21 +263,17 @@ Eric Buehler
|
|||||||
Eduardo Poyart
|
Eduardo Poyart
|
||||||
Edgar Ellis
|
Edgar Ellis
|
||||||
Dimi Christopoulos
|
Dimi Christopoulos
|
||||||
Diane Delall<6C>e
|
Dietmar Funck
|
||||||
David Longest
|
|
||||||
David Ergo
|
David Ergo
|
||||||
Daniel Trstenjak
|
Daniel Trstenjak
|
||||||
Craig Bosma
|
Craig Bosma
|
||||||
Claus Scheiblauer
|
|
||||||
Christophe Loustaunau
|
Christophe Loustaunau
|
||||||
Christian Ruzicka
|
|
||||||
Bradley Baker Searles
|
|
||||||
Brad Anderegg
|
Brad Anderegg
|
||||||
Bj<EFBFBD>rn Hein
|
|
||||||
Aric Aumann
|
Aric Aumann
|
||||||
Andrew Sampson
|
Andrew Sampson
|
||||||
Andrew Lorino
|
Andrew Lorino
|
||||||
Alexandre Amalric
|
Alexandre Amalric
|
||||||
|
Alessandro Terenzi
|
||||||
Zbigniew Sroczynski
|
Zbigniew Sroczynski
|
||||||
Yuri Vilmanis
|
Yuri Vilmanis
|
||||||
Xin Li
|
Xin Li
|
||||||
@@ -324,20 +287,15 @@ Vincent Vivanloc
|
|||||||
Vincent Gadoury
|
Vincent Gadoury
|
||||||
Vasily Radostev
|
Vasily Radostev
|
||||||
Valery Bickov
|
Valery Bickov
|
||||||
Valeriy Dubov
|
|
||||||
Vaclav Bilek
|
Vaclav Bilek
|
||||||
Tyge L<>vset
|
Tyge L<>vset
|
||||||
Troy Yee
|
Troy Yee
|
||||||
Tomas Hogarth
|
Tomas Hogarth
|
||||||
Tomas Hnilica
|
Tomas Hnilica
|
||||||
Todd Furlong
|
Todd Furlong
|
||||||
Tobias Ottenweller
|
|
||||||
Tino Schwarze
|
Tino Schwarze
|
||||||
Tim George
|
|
||||||
Thorsten Brehm
|
|
||||||
Thomas Weidner
|
Thomas Weidner
|
||||||
Tan Dunning
|
Tan Dunning
|
||||||
Tamer Fahmy
|
|
||||||
Stewart Andreason
|
Stewart Andreason
|
||||||
Steven Thomas
|
Steven Thomas
|
||||||
Simon Hammett
|
Simon Hammett
|
||||||
@@ -346,7 +304,6 @@ Simon Buckley
|
|||||||
Sid Byce
|
Sid Byce
|
||||||
Shuxing Xiao
|
Shuxing Xiao
|
||||||
Shane Arnott
|
Shane Arnott
|
||||||
Sergey Kurdakov
|
|
||||||
Sebastien Kuntz
|
Sebastien Kuntz
|
||||||
Ruth Lang
|
Ruth Lang
|
||||||
Ruben Smelik
|
Ruben Smelik
|
||||||
@@ -354,14 +311,12 @@ Ross Anderson
|
|||||||
Ronny Krueger
|
Ronny Krueger
|
||||||
Ronald van Maarseveen
|
Ronald van Maarseveen
|
||||||
Romain Charbit
|
Romain Charbit
|
||||||
Rocco Martino
|
|
||||||
Robert Swain
|
Robert Swain
|
||||||
Rob Smith
|
Rob Smith
|
||||||
Rob Radtke
|
Rob Radtke
|
||||||
Rob Bloemkool
|
Rob Bloemkool
|
||||||
Rick Pingry
|
Rick Pingry
|
||||||
Rick Appleton
|
Rick Appleton
|
||||||
Remo Eichenberger
|
|
||||||
Reinhard Sainitzer
|
Reinhard Sainitzer
|
||||||
Rein Kadijk
|
Rein Kadijk
|
||||||
Ragnar Hammarqvist
|
Ragnar Hammarqvist
|
||||||
@@ -375,7 +330,7 @@ Philip Lamb
|
|||||||
Petr Salinger
|
Petr Salinger
|
||||||
Peter Bear
|
Peter Bear
|
||||||
Peter Amstutz
|
Peter Amstutz
|
||||||
Paul Idstein
|
Paul Palumbo
|
||||||
Paul Fredrikson
|
Paul Fredrikson
|
||||||
Paul Fotheringham
|
Paul Fotheringham
|
||||||
Pau Garcia
|
Pau Garcia
|
||||||
@@ -384,24 +339,17 @@ Parag Chaudhur
|
|||||||
Panagiotis Papadakos
|
Panagiotis Papadakos
|
||||||
Panagiotis Koutsourakis
|
Panagiotis Koutsourakis
|
||||||
Orhun Birsoy
|
Orhun Birsoy
|
||||||
Oren Fromberg
|
|
||||||
Oliver Neumann
|
Oliver Neumann
|
||||||
Ole-Morten Duesund
|
Ole-Morten Duesund
|
||||||
Nicolas Brodu
|
Nicolas Brodu
|
||||||
Nick Black
|
Morten Haukness
|
||||||
Mojtaba Fathi
|
Mojtaba Fathi
|
||||||
Mirko Viviani
|
Mirko Viviani
|
||||||
Mikkel Gj<EFBFBD>l
|
Mikkel Gjøl
|
||||||
Mike Krus
|
|
||||||
Mike Garrity
|
Mike Garrity
|
||||||
Miha Rav<61>elj
|
|
||||||
Michael Schanne
|
|
||||||
Michael Polak
|
Michael Polak
|
||||||
Michael Morrison
|
Michael Morrison
|
||||||
Michael Mc Donnell
|
|
||||||
Michael Logan
|
Michael Logan
|
||||||
Michael Kapelko
|
|
||||||
Michael Bach Jensen
|
|
||||||
Max Rhiener
|
Max Rhiener
|
||||||
Max Behensky
|
Max Behensky
|
||||||
Mauricio Hofmam
|
Mauricio Hofmam
|
||||||
@@ -412,30 +360,29 @@ Matt Burke
|
|||||||
Mathias Walker
|
Mathias Walker
|
||||||
Mathias Goldau
|
Mathias Goldau
|
||||||
Mason Menninger
|
Mason Menninger
|
||||||
|
Martin von Gargern
|
||||||
Martin Scheffler
|
Martin Scheffler
|
||||||
|
Martin Lambers
|
||||||
Martin Innus
|
Martin Innus
|
||||||
Martin Beck
|
Martin Beck
|
||||||
Marius Kintel
|
|
||||||
Mario Guimaraes
|
Mario Guimaraes
|
||||||
Marco Sciabica
|
Marco Sciabica
|
||||||
Marco Lehmann
|
Marco Lehmann
|
||||||
|
Marcin Prus
|
||||||
Maik Keller
|
Maik Keller
|
||||||
Lukas Diduch
|
Lukas Diduch
|
||||||
Louis Hamilton
|
Louis Hamilton
|
||||||
Lewis Harmon
|
Lewis Harmon
|
||||||
Leigh Stivers
|
|
||||||
Laurence Muller
|
Laurence Muller
|
||||||
Laura Cerritelli
|
Laura Cerritelli
|
||||||
Kyle Centers
|
Kyle Centers
|
||||||
Kristopher Bixler
|
Kristopher Bixler
|
||||||
|
Konstantin Matveyev
|
||||||
Kim Seokhwan
|
Kim Seokhwan
|
||||||
Kim Bale
|
|
||||||
Karsten Weiss
|
Karsten Weiss
|
||||||
Karl Heijdenberg
|
Karl Heijdenberg
|
||||||
Jutta Sauer
|
Jutta Sauer
|
||||||
Julian Scheid
|
Julian Scheid
|
||||||
Juergen Rensen
|
|
||||||
Juan Manuel Alvarez
|
|
||||||
Juan Hernando
|
Juan Hernando
|
||||||
Josh Portway
|
Josh Portway
|
||||||
John Tan
|
John Tan
|
||||||
@@ -450,15 +397,14 @@ Jeroen den Dekker
|
|||||||
Jay Zuckerman
|
Jay Zuckerman
|
||||||
Jason Howlett
|
Jason Howlett
|
||||||
Jason Ballenger
|
Jason Ballenger
|
||||||
James Turner
|
Jan Klimke
|
||||||
James Killian
|
James Killian
|
||||||
James Athey
|
|
||||||
J.E. Hoffmann
|
J.E. Hoffmann
|
||||||
Holger Helmich
|
Holger Helmich
|
||||||
Henrique Bucher
|
Henrique Bucher
|
||||||
Hautio Jari
|
Hautio Jari
|
||||||
Hartmut Seichter
|
|
||||||
Gunter Huber
|
Gunter Huber
|
||||||
|
Guillaume Millet
|
||||||
Gregory Jaegy
|
Gregory Jaegy
|
||||||
Graeme Harkness
|
Graeme Harkness
|
||||||
Gian Lorenzetto
|
Gian Lorenzetto
|
||||||
@@ -466,13 +412,10 @@ George Papagiannakis
|
|||||||
Galen Faidley
|
Galen Faidley
|
||||||
Frida Schlaug
|
Frida Schlaug
|
||||||
Frederic Smith
|
Frederic Smith
|
||||||
Frederic Morin
|
|
||||||
Frank Warmerdam
|
Frank Warmerdam
|
||||||
Frank Midgley
|
Frank Midgley
|
||||||
Frank Lindeman
|
Frank Lindeman
|
||||||
Frank Lichtenheld
|
Frank Lichtenheld
|
||||||
Francois Tigeot
|
|
||||||
Filip Arlet
|
|
||||||
Ferdinand Cornelissen
|
Ferdinand Cornelissen
|
||||||
Fajran Iman
|
Fajran Iman
|
||||||
Fabien Dachicourt
|
Fabien Dachicourt
|
||||||
@@ -484,7 +427,6 @@ Duvan Cope
|
|||||||
Duncan Cavens
|
Duncan Cavens
|
||||||
Drew Whitehouse
|
Drew Whitehouse
|
||||||
Douglas A. Pouk
|
Douglas A. Pouk
|
||||||
Dmitry Marakasov
|
|
||||||
Dean Iverson
|
Dean Iverson
|
||||||
David Jung
|
David Jung
|
||||||
Danny Valente
|
Danny Valente
|
||||||
@@ -492,16 +434,13 @@ Daniel Stien
|
|||||||
Dan Minor
|
Dan Minor
|
||||||
C<EFBFBD>sar L. B. Silveira
|
C<EFBFBD>sar L. B. Silveira
|
||||||
Cyril Brulebois
|
Cyril Brulebois
|
||||||
Cl<EFBFBD>ment B<>sch
|
|
||||||
Clay Fowler
|
Clay Fowler
|
||||||
Claus Steuer
|
Claus Scheiblauer
|
||||||
Chuck Sembroski
|
Chuck Sembroski
|
||||||
Christopher Blaesius
|
Christopher Blaesius
|
||||||
Christopher Baker
|
|
||||||
Christophe Herreman
|
|
||||||
Christian Noon
|
|
||||||
Christian Kaser
|
Christian Kaser
|
||||||
Christian Ehrlicher
|
Christian Ehrlicher
|
||||||
|
Christian Buchner
|
||||||
Chris McGlone
|
Chris McGlone
|
||||||
Carlos Garcea
|
Carlos Garcea
|
||||||
Bryce Eldridge
|
Bryce Eldridge
|
||||||
@@ -509,6 +448,7 @@ Bruno Herbelin
|
|||||||
Brian Keener
|
Brian Keener
|
||||||
Brandon Hamm
|
Brandon Hamm
|
||||||
Bora Utka
|
Bora Utka
|
||||||
|
Bj<EFBFBD>rn Hein
|
||||||
Bill Prendergast
|
Bill Prendergast
|
||||||
Bernardt Duvenhage
|
Bernardt Duvenhage
|
||||||
Benoit Laniel
|
Benoit Laniel
|
||||||
@@ -516,9 +456,7 @@ Benjamin Wasty
|
|||||||
Ben van Basten
|
Ben van Basten
|
||||||
Bart Gallet
|
Bart Gallet
|
||||||
Axel Volley
|
Axel Volley
|
||||||
Arjun Ramamurthy
|
|
||||||
Anthousis Andreadis
|
Anthousis Andreadis
|
||||||
Anish Thomas
|
|
||||||
Andy Preece
|
Andy Preece
|
||||||
Andrew Reyonolds
|
Andrew Reyonolds
|
||||||
Andreas Roth
|
Andreas Roth
|
||||||
@@ -526,10 +464,9 @@ Andreas Jochens
|
|||||||
Andre Normann
|
Andre Normann
|
||||||
Almalric Alexandre
|
Almalric Alexandre
|
||||||
Allen Bierbaum
|
Allen Bierbaum
|
||||||
|
Alexander Sinditskiy
|
||||||
Alberto Jaspe
|
Alberto Jaspe
|
||||||
Alan Purvis
|
Alan Purvis
|
||||||
Alan Ott
|
Alan Ott
|
||||||
Alan Harris
|
Alan Harris
|
||||||
Adrien Grandemange
|
|
||||||
Adrian Clark
|
|
||||||
Adam Richard
|
Adam Richard
|
||||||
|
|||||||
278
CMakeLists.txt
278
CMakeLists.txt
@@ -20,41 +20,19 @@ if(COMMAND cmake_policy)
|
|||||||
# statements.
|
# statements.
|
||||||
cmake_policy(SET CMP0005 NEW)
|
cmake_policy(SET CMP0005 NEW)
|
||||||
|
|
||||||
# tell CMake to prefer CMake's own CMake modules when available
|
|
||||||
# only available from cmake-2.8.4
|
|
||||||
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR
|
|
||||||
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 8) OR
|
|
||||||
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3))
|
|
||||||
cmake_policy(SET CMP0017 NEW)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# cmake-2.6.1 introduces policy cmp0008 decide how to treat full path libraries that do not appear to be valid library file names
|
# cmake-2.6.1 introduces policy cmp0008 decide how to treat full path libraries that do not appear to be valid library file names
|
||||||
# quote from cvslog "Such libraries worked by accident in the VS IDE and Xcode generators in CMake 2.4 and below."
|
# 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} GREATER 2 OR
|
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
|
||||||
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 6) OR
|
|
||||||
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6 AND ${CMAKE_PATCH_VERSION} GREATER 0))
|
|
||||||
cmake_policy(SET CMP0008 OLD)
|
cmake_policy(SET CMP0008 OLD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# disable autolinking to qtmain as we have our own main() functions (new in Qt 5.1)
|
|
||||||
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR
|
|
||||||
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 8) OR
|
|
||||||
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 10))
|
|
||||||
cmake_policy(SET CMP0020 OLD)
|
|
||||||
endif()
|
|
||||||
# nicer version check - but needs at least CMake 2.6.2? Worth upgrading the requirements?
|
|
||||||
#if("${CMAKE_VERSION}" VERSION_GREATER 2.8.10)
|
|
||||||
# or even easier (available in cmake-2.6)
|
|
||||||
#if(POLICY CMPxyzw)
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
PROJECT(OpenSceneGraph)
|
PROJECT(OpenSceneGraph)
|
||||||
|
|
||||||
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
|
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
|
||||||
SET(OPENSCENEGRAPH_MINOR_VERSION 2)
|
SET(OPENSCENEGRAPH_MINOR_VERSION 0)
|
||||||
SET(OPENSCENEGRAPH_PATCH_VERSION 3)
|
SET(OPENSCENEGRAPH_PATCH_VERSION 1)
|
||||||
SET(OPENSCENEGRAPH_SOVERSION 100)
|
SET(OPENSCENEGRAPH_SOVERSION 80)
|
||||||
|
|
||||||
# set to 0 when not a release candidate, non zero means that any generated
|
# set to 0 when not a release candidate, non zero means that any generated
|
||||||
# svn tags will be treated as release candidates of given number
|
# svn tags will be treated as release candidates of given number
|
||||||
@@ -85,13 +63,6 @@ SET(OpenThreads_SOURCE_DIR ${OpenSceneGraph_SOURCE_DIR})
|
|||||||
# Maybe this can be used override existing behavior if needed?
|
# Maybe this can be used override existing behavior if needed?
|
||||||
SET(CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
|
SET(CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
|
||||||
|
|
||||||
|
|
||||||
# Change the default build type to Release
|
|
||||||
IF(NOT CMAKE_BUILD_TYPE)
|
|
||||||
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
|
||||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
|
||||||
|
|
||||||
|
|
||||||
## Option to enable Android build using AndroidNDK
|
## Option to enable Android build using AndroidNDK
|
||||||
OPTION(OSG_BUILD_PLATFORM_ANDROID OFF)
|
OPTION(OSG_BUILD_PLATFORM_ANDROID OFF)
|
||||||
IF(OSG_BUILD_PLATFORM_ANDROID)
|
IF(OSG_BUILD_PLATFORM_ANDROID)
|
||||||
@@ -100,38 +71,7 @@ IF(OSG_BUILD_PLATFORM_ANDROID)
|
|||||||
|
|
||||||
INCLUDE(OsgAndroidMacroUtils)
|
INCLUDE(OsgAndroidMacroUtils)
|
||||||
SET(ANDROID TRUE)
|
SET(ANDROID TRUE)
|
||||||
IF(NOT ANDROID_PLATFORM)
|
SET(ANDROID_PLATFORM 5)
|
||||||
MESSAGE("Warning Android Platform version NOT defined, Default selected version: 5")
|
|
||||||
SET(ANDROID_PLATFORM 5)
|
|
||||||
ENDIF()
|
|
||||||
IF(NOT ANDROID_ABI)
|
|
||||||
MESSAGE("Warning Android ABI version NOT defined, Default selection: armeabi armeabi-v7a")
|
|
||||||
SET(ANDROID_ABI "armeabi armeabi-v7a")
|
|
||||||
ENDIF()
|
|
||||||
IF(NOT ANDROID_STL)
|
|
||||||
MESSAGE("Warning Android STL NOT defined, Default selection: gnustl_static")
|
|
||||||
SET(ANDROID_STL "gnustl_static")
|
|
||||||
ENDIF()
|
|
||||||
IF(ANDROID_DEBUG)
|
|
||||||
MESSAGE("Warning Android Build is in debug mode")
|
|
||||||
SET(ANDROID_RELEASE_OPTIM "debug")
|
|
||||||
ELSE()
|
|
||||||
MESSAGE("Warning Android Build is in release mode")
|
|
||||||
SET(ANDROID_RELEASE_OPTIM "release")
|
|
||||||
ENDIF()
|
|
||||||
IF(ANDROID_NEON)
|
|
||||||
MESSAGE("Warning Android NEON optimizations enabled, this will not be available on all armeabi-v7a devices ie. Tegra2")
|
|
||||||
SET(ANDROID_OPTIM_NEON true)
|
|
||||||
ELSE()
|
|
||||||
SET(ANDROID_OPTIM_NEON false)
|
|
||||||
ENDIF()
|
|
||||||
IF(ANDROID_ARM32)
|
|
||||||
MESSAGE("Warning ARM 32bit instruction set will be used")
|
|
||||||
SET(ANDROID_OPTIM_ARM32 true)
|
|
||||||
ELSE()
|
|
||||||
SET(ANDROID_OPTIM_ARM32 false)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
FIND_PACKAGE(AndroidNDK REQUIRED)
|
FIND_PACKAGE(AndroidNDK REQUIRED)
|
||||||
|
|
||||||
SET(OSG_ANDROID_TEMPLATES "${CMAKE_SOURCE_DIR}/PlatformSpecifics/Android")
|
SET(OSG_ANDROID_TEMPLATES "${CMAKE_SOURCE_DIR}/PlatformSpecifics/Android")
|
||||||
@@ -194,9 +134,9 @@ IF (OSG_MAINTAINER)
|
|||||||
# Provide target for tagging a release
|
# Provide target for tagging a release
|
||||||
#
|
#
|
||||||
SET(SVNCOMMAND svn)
|
SET(SVNCOMMAND svn)
|
||||||
SET(SVNTRUNKDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk)
|
SET(SVNTRUNKDIR http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk)
|
||||||
SET(SVNTAGDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/tags)
|
SET(SVNTAGDIR http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags)
|
||||||
SET(SVNBRANCHDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/branches)
|
SET(SVNBRANCHDIR http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branches)
|
||||||
|
|
||||||
IF (OPENSCENEGRAPH_SVN STREQUAL "trunk")
|
IF (OPENSCENEGRAPH_SVN STREQUAL "trunk")
|
||||||
SET(SVNSOURCEDIR ${SVNTRUNKDIR})
|
SET(SVNSOURCEDIR ${SVNTRUNKDIR})
|
||||||
@@ -242,17 +182,6 @@ ENDIF(OSG_MAINTAINER)
|
|||||||
|
|
||||||
IF(NOT ANDROID)
|
IF(NOT ANDROID)
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
# Determine the canonical name of the selected Platform SDK
|
|
||||||
EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion"
|
|
||||||
OUTPUT_VARIABLE OSG_OSX_SDK_NAME
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
STRING(REPLACE "." ";" MACOS_VERSION_LIST ${OSG_OSX_SDK_NAME})
|
|
||||||
LIST(GET MACOS_VERSION_LIST 0 MACOS_VERSION_MAJOR)
|
|
||||||
LIST(GET MACOS_VERSION_LIST 1 MACOS_VERSION_MINOR)
|
|
||||||
LIST(GET MACOS_VERSION_LIST 2 MACOS_VERSION_PATCH)
|
|
||||||
|
|
||||||
SET(OSG_OSX_SDK_NAME "macosx${MACOS_VERSION_MAJOR}.${MACOS_VERSION_MINOR}")
|
|
||||||
|
|
||||||
# Trying to get CMake to generate an XCode IPhone project, current efforts are to get iphoneos sdk 3.1 working
|
# Trying to get CMake to generate an XCode IPhone project, current efforts are to get iphoneos sdk 3.1 working
|
||||||
# Added option which needs manually setting to select the IPhone SDK for building. We can only have one of the below
|
# Added option which needs manually setting to select the IPhone SDK for building. We can only have one of the below
|
||||||
# set to true. Should realy have an OSG_BUILD_PLATFORM variable that we set to our desired platform
|
# set to true. Should realy have an OSG_BUILD_PLATFORM variable that we set to our desired platform
|
||||||
@@ -262,24 +191,21 @@ IF(APPLE)
|
|||||||
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
||||||
|
|
||||||
#you need to manually set the default sdk version here
|
#you need to manually set the default sdk version here
|
||||||
SET (IPHONE_SDKVER "6.0" CACHE STRING "IOS SDK-Version")
|
SET (IPHONE_SDKVER "3.2")
|
||||||
SET (IPHONE_VERSION_MIN "4.2" CACHE STRING "IOS minimum os version, use 7.0 or greater to get 64bit support")
|
|
||||||
|
|
||||||
#the below is taken from ogre, it states the gcc stuff needs to happen before PROJECT() is called. I've no clue if we even need it
|
#the below is taken from ogre, it states the gcc stuff needs to happen before PROJECT() is called. I've no clue if we even need it
|
||||||
# Force gcc <= 4.2 on iPhone
|
# Force gcc <= 4.2 on iPhone
|
||||||
IF(IPHONE_VERSION_MIN LESS "6.0")
|
include(CMakeForceCompiler)
|
||||||
include(CMakeForceCompiler)
|
CMAKE_FORCE_C_COMPILER(gcc-4.2 GNU)
|
||||||
CMAKE_FORCE_C_COMPILER(llvm-gcc-4.2 GNU)
|
CMAKE_FORCE_CXX_COMPILER(gcc-4.2 GNU)
|
||||||
CMAKE_FORCE_CXX_COMPILER(llvm-gcc-4.2 GNU)
|
SET(GCC_THUMB_SUPPORT NO)
|
||||||
SET(GCC_THUMB_SUPPORT NO)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
#set either the device sdk or the simulator sdk. Can't find away to separate these in the same project
|
#set either the device sdk or the simulator sdk. Can't find away to separate these in the same project
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE)
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
||||||
SET (IPHONE_DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer")
|
SET (IPHONE_DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer")
|
||||||
SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneOS${IPHONE_SDKVER}.sdk")
|
SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneOS${IPHONE_SDKVER}.sdk")
|
||||||
ELSE()
|
ELSE()
|
||||||
SET (IPHONE_DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer")
|
SET (IPHONE_DEVROOT "/Developer/Platforms/iPhoneSimulator.platform/Developer")
|
||||||
SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneSimulator${IPHONE_SDKVER}.sdk")
|
SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneSimulator${IPHONE_SDKVER}.sdk")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@@ -376,13 +302,7 @@ IF(WIN32 AND NOT ANDROID)
|
|||||||
STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||||
STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
|
STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
|
||||||
ENDIF(MSVC_USE_DEFAULT_STACK_SIZE)
|
ENDIF(MSVC_USE_DEFAULT_STACK_SIZE)
|
||||||
get_filename_component( CMAKE_MAKE_PROGRAM_NAME ${CMAKE_MAKE_PROGRAM} NAME)
|
|
||||||
IF (CMAKE_MAKE_PROGRAM_NAME STREQUAL "VCExpress.exe")
|
|
||||||
OPTION(MSVC_BUILD_USE_SOLUTION_FOLDERS "Enable project grouping in VS - VCExpress detected, not supported in VCExpress )" OFF)
|
|
||||||
ELSE()
|
|
||||||
OPTION(MSVC_BUILD_USE_SOLUTION_FOLDERS "Enable project grouping in VS" ON)
|
|
||||||
ENDIF()
|
|
||||||
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ${MSVC_BUILD_USE_SOLUTION_FOLDERS})
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
#needed for net plugin
|
#needed for net plugin
|
||||||
@@ -465,7 +385,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_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON)
|
||||||
|
|
||||||
|
|
||||||
OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON)
|
OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON)
|
||||||
OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.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_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." OFF)
|
||||||
@@ -484,7 +403,7 @@ SET(OPENGL_egl_LIBRARY CACHE STRING "Set the OpenGL egl library.")
|
|||||||
OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." ${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_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_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 glVertexPointer/glColorPointer 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_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)
|
OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON)
|
||||||
@@ -527,17 +446,11 @@ IF(WIN32 AND NOT ANDROID)
|
|||||||
INCLUDE(Find3rdPartyDependencies)
|
INCLUDE(Find3rdPartyDependencies)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
#
|
|
||||||
# If you want to prevent CMake from picking up on any of the following optional 3rd Party dependencies in CMake 2.8 onwards
|
|
||||||
# you can use the following style of command line option when invoking Cmake (here illustrating ignoring PythonLibs) :
|
|
||||||
# cmake -DCMAKE_DISABLE_FIND_PACKAGE_PythonLibs=1 .
|
|
||||||
#
|
|
||||||
|
|
||||||
IF(ANDROID)
|
IF(ANDROID)
|
||||||
ANDROID_3RD_PARTY()
|
ANDROID_3RD_PARTY()
|
||||||
ELSE()
|
ELSE()
|
||||||
# Common to all platforms except android:
|
# Common to all platforms except android:
|
||||||
FIND_PACKAGE(Freetype)
|
FIND_PACKAGE(FreeType)
|
||||||
FIND_PACKAGE(Inventor)
|
FIND_PACKAGE(Inventor)
|
||||||
FIND_PACKAGE(Jasper)
|
FIND_PACKAGE(Jasper)
|
||||||
FIND_PACKAGE(OpenEXR)
|
FIND_PACKAGE(OpenEXR)
|
||||||
@@ -548,10 +461,11 @@ ELSE()
|
|||||||
FIND_PACKAGE(OpenVRML)
|
FIND_PACKAGE(OpenVRML)
|
||||||
FIND_PACKAGE(Performer)
|
FIND_PACKAGE(Performer)
|
||||||
FIND_PACKAGE(GDAL)
|
FIND_PACKAGE(GDAL)
|
||||||
FIND_PACKAGE(GTA)
|
|
||||||
FIND_PACKAGE(CURL)
|
FIND_PACKAGE(CURL)
|
||||||
|
FIND_PACKAGE(ITK)
|
||||||
FIND_PACKAGE(LibVNCServer)
|
FIND_PACKAGE(LibVNCServer)
|
||||||
FIND_PACKAGE(OurDCMTK)
|
FIND_PACKAGE(OurDCMTK)
|
||||||
|
FIND_PACKAGE(OpenAL)
|
||||||
FIND_PACKAGE(FFmpeg)
|
FIND_PACKAGE(FFmpeg)
|
||||||
FIND_PACKAGE(DirectShow)
|
FIND_PACKAGE(DirectShow)
|
||||||
FIND_PACKAGE(SDL)
|
FIND_PACKAGE(SDL)
|
||||||
@@ -560,30 +474,17 @@ ELSE()
|
|||||||
FIND_PACKAGE(GtkGl)
|
FIND_PACKAGE(GtkGl)
|
||||||
FIND_PACKAGE(DirectInput)
|
FIND_PACKAGE(DirectInput)
|
||||||
FIND_PACKAGE(NVTT)
|
FIND_PACKAGE(NVTT)
|
||||||
IF (NOT WIN32)
|
|
||||||
FIND_PACKAGE(Asio)
|
|
||||||
ENDIF()
|
|
||||||
FIND_PACKAGE(ZeroConf)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8)
|
|
||||||
FIND_PACKAGE(ITK)
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Include macro utilities here
|
# Include macro utilities here
|
||||||
INCLUDE(OsgMacroUtils)
|
INCLUDE(OsgMacroUtils)
|
||||||
|
|
||||||
OPTION(OSG_USE_QT "Enable to use Qt (build Qt-dependent libraries, plugins and examples)" ON)
|
IF(NOT ANDROID)
|
||||||
|
|
||||||
IF(OSG_USE_QT AND NOT ANDROID)
|
|
||||||
# To select a specific version of QT define DESIRED_QT_VERSION
|
# To select a specific version of QT define DESIRED_QT_VERSION
|
||||||
# via cmake -DDESIRED_QT_VERSION=5
|
# via cmake -DDESIRED_QT_VERSION=4
|
||||||
# QUIET option disables messages if the package cannot be found.
|
|
||||||
|
|
||||||
IF (DESIRED_QT_VERSION)
|
IF (DESIRED_QT_VERSION)
|
||||||
IF (DESIRED_QT_VERSION MATCHES 5)
|
|
||||||
FIND_PACKAGE(Qt5Widgets)
|
IF (DESIRED_QT_VERSION MATCHES 4)
|
||||||
ELSEIF (DESIRED_QT_VERSION MATCHES 4)
|
|
||||||
FIND_PACKAGE(Qt4)
|
FIND_PACKAGE(Qt4)
|
||||||
ELSE()
|
ELSE()
|
||||||
FIND_PACKAGE(Qt3)
|
FIND_PACKAGE(Qt3)
|
||||||
@@ -591,44 +492,14 @@ IF(OSG_USE_QT AND NOT ANDROID)
|
|||||||
|
|
||||||
ELSE()
|
ELSE()
|
||||||
|
|
||||||
FIND_PACKAGE(Qt5Widgets QUIET)
|
FIND_PACKAGE(Qt4)
|
||||||
|
|
||||||
IF ( Qt5Widgets_FOUND )
|
IF (NOT QT4_FOUND)
|
||||||
# CMake 2.8.8 or greater required
|
FIND_PACKAGE(Qt3)
|
||||||
BUILDER_VERSION_GREATER(2 8 7)
|
|
||||||
IF(NOT VALID_BUILDER_VERSION)
|
|
||||||
MESSAGE(
|
|
||||||
SEND_ERROR
|
|
||||||
"Qt5 requires CMake version 2.8.8 or greater!\n"
|
|
||||||
"Update CMake or set DESIRED_QT_VERSION to less than 5
|
|
||||||
or disable OSG_USE_QT."
|
|
||||||
)
|
|
||||||
ENDIF( )
|
|
||||||
ENDIF( )
|
|
||||||
|
|
||||||
IF ( NOT Qt5Widgets_FOUND )
|
|
||||||
FIND_PACKAGE(Qt4)
|
|
||||||
|
|
||||||
IF (NOT QT4_FOUND)
|
|
||||||
FIND_PACKAGE(Qt3)
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
ENDIF(NOT ANDROID)
|
||||||
#If we have found Qt5, let's try to top off by getting the webkit as well
|
|
||||||
IF ( Qt5Widgets_FOUND )
|
|
||||||
FIND_PACKAGE(Qt5WebKitWidgets QUIET)
|
|
||||||
|
|
||||||
IF(COMMAND cmake_policy)
|
|
||||||
IF(${CMAKE_MAJOR_VERSION} GREATER 2)
|
|
||||||
# Qt5 qt5_use_modules usage was causing "Policy CMP0043 is not set: Ignore COMPILE_DEFINITIONS_<Config> properties." warnings
|
|
||||||
cmake_policy(SET CMP0043 NEW)
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
#optional example related dependencies
|
#optional example related dependencies
|
||||||
IF (BUILD_OSG_EXAMPLES AND NOT ANDROID)
|
IF (BUILD_OSG_EXAMPLES AND NOT ANDROID)
|
||||||
|
|
||||||
@@ -663,19 +534,16 @@ IF(NOT ANDROID)
|
|||||||
FIND_PACKAGE(JPEG)
|
FIND_PACKAGE(JPEG)
|
||||||
FIND_PACKAGE(PNG)
|
FIND_PACKAGE(PNG)
|
||||||
FIND_PACKAGE(TIFF)
|
FIND_PACKAGE(TIFF)
|
||||||
|
|
||||||
# QuickTime is required for OS X, but optional for Windows.
|
# QuickTime is required for OS X, but optional for Windows.
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
FIND_PACKAGE(QuickTime)
|
FIND_PACKAGE(QuickTime)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ELSE()
|
ELSE()
|
||||||
FIND_PACKAGE(TIFF)
|
|
||||||
FIND_PACKAGE(QuickTime)
|
FIND_PACKAGE(QuickTime)
|
||||||
FIND_PACKAGE(QTKit)
|
FIND_PACKAGE(QTKit)
|
||||||
FIND_PACKAGE(CoreVideo)
|
FIND_PACKAGE(CoreVideo)
|
||||||
FIND_PACKAGE(CoreMedia)
|
|
||||||
FIND_PACKAGE(QuartzCore)
|
|
||||||
FIND_PACKAGE(AVFoundation)
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@@ -824,31 +692,28 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
# returns too many hits.
|
# returns too many hits.
|
||||||
# FYI, if we do implement GNUCC, then -Wmissing-prototypes in another
|
# FYI, if we do implement GNUCC, then -Wmissing-prototypes in another
|
||||||
# interesting C-specific flag.
|
# interesting C-specific flag.
|
||||||
SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused)
|
# Also, there is a bug in gcc 4.0. Under C++, -pedantic will create
|
||||||
|
# errors instead of warnings for certain issues, including superfluous
|
||||||
|
# semicolons and commas, and the use of long long. -fpermissive seems
|
||||||
|
# to be the workaround.
|
||||||
|
SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive)
|
||||||
|
|
||||||
# Previous included -Wformat=2 in OSG_AGGRESSIVE_WARNING_FLAGS but had to remove it due to standard library errors
|
# Previous included -Wformat=2 in OSG_AGGRESSIVE_WARNING_FLAGS but had to remove it due to standard library errors
|
||||||
|
|
||||||
|
|
||||||
ELSEIF(MSVC)
|
ELSE()
|
||||||
#disable specific warning level 4 warnings:
|
IF(MSVC)
|
||||||
#C4100 'identifier' : unreferenced formal parameter
|
# FIXME: What are good aggressive warning flags for Visual Studio?
|
||||||
#C4127 Error Message conditional expression is constant
|
# And do we need to further subcase this for different versions of VS?
|
||||||
#C4706 assignment within conditional expression
|
# CMake variables: MSVC60, MSVC70, MSVC71, MSVC80, CMAKE_COMPILER_2005
|
||||||
SET(OSG_AGGRESSIVE_WARNING_FLAGS /W4 /wd4706 /wd4127 /wd4100)
|
SET(OSG_AGGRESSIVE_WARNING_FLAGS /W4 /wd4706 /wd4127 /wd4100)
|
||||||
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|
||||||
SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -Wno-overloaded-virtual)
|
|
||||||
|
|
||||||
|
|
||||||
|
ELSE()
|
||||||
# CMake lacks an elseif, so other non-gcc, non-VS compilers need
|
# CMake lacks an elseif, so other non-gcc, non-VS compilers need
|
||||||
# to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should
|
# to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should
|
||||||
# remain unset.
|
# remain unset.
|
||||||
|
ENDIF()
|
||||||
IF (APPLE)
|
|
||||||
# set standard lib, clang defaults to c++0x
|
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++98")
|
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -stdlib=libstdc++ -Wno-overloaded-virtual -Wno-conversion")
|
|
||||||
set(WARNING_CFLAGS "")
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# This part is for the CMake menu option to toggle the warnings on/off.
|
# This part is for the CMake menu option to toggle the warnings on/off.
|
||||||
@@ -901,21 +766,15 @@ IF (BUILD_OSG_EXAMPLES)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
IF(APPLE AND NOT ANDROID)
|
IF(APPLE)
|
||||||
|
|
||||||
#Here we check if the user specified IPhone SDK
|
#Here we check if the user specified IPhone SDK
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
||||||
|
|
||||||
#set iphone arch and flags taken from http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake
|
#set iphone arch and flags taken from http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE)
|
IF(OSG_BUILD_PLATFORM_IPHONE)
|
||||||
IF(${IPHONE_VERSION_MIN} LESS "7.0")
|
SET(CMAKE_OSX_ARCHITECTURES "armv6;armv7" CACHE STRING "Build architectures for iOS" FORCE)
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "armv6;armv7" CACHE STRING "Build architectures for iOS" FORCE)
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=3.1 -mno-thumb -arch armv6 -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=${IPHONE_VERSION_MIN} -mno-thumb -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
|
||||||
ELSE()
|
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "armv7;armv7s;arm64" CACHE STRING "Build architectures for iOS" FORCE)
|
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=${IPHONE_VERSION_MIN} -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
ELSE()
|
ELSE()
|
||||||
#simulator uses i386 architectures
|
#simulator uses i386 architectures
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Build architectures for iOS Simulator" FORCE)
|
SET(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Build architectures for iOS Simulator" FORCE)
|
||||||
@@ -947,23 +806,18 @@ IF(APPLE AND NOT ANDROID)
|
|||||||
# FORCE is used because the options are not reflected in the UI otherwise.
|
# FORCE is used because the options are not reflected in the UI otherwise.
|
||||||
# Seems like a good place to add version specific compiler flags too.
|
# Seems like a good place to add version specific compiler flags too.
|
||||||
IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
|
IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
|
||||||
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10")
|
# This is really fragile, but CMake doesn't provide the OS system
|
||||||
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
|
# version information we need. (Darwin versions can be changed
|
||||||
# 64 Bit Works, i386,ppc is not supported any more
|
# independently of OS X versions.)
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" FORCE)
|
# It does look like CMake handles the CMAKE_OSX_SYSROOT automatically.
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.8 -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
IF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
|
||||||
ELSEIF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7")
|
# 64-bit compiles are not supported with Carbon. We should enable
|
||||||
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
|
# 64-bit compilation by default once osgviewer has been
|
||||||
# 64 Bit Works, PPC is not supported any more
|
# rewritten with Cocoa.
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
|
#SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7 -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
|
||||||
ELSEIF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.6" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.5")
|
|
||||||
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
|
|
||||||
# 64-bit compiles are not supported with Carbon.
|
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" 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)
|
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(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.4")
|
ELSEIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
|
||||||
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "quicktime" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
|
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" 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.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." 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()
|
ELSE()
|
||||||
@@ -971,21 +825,21 @@ IF(APPLE AND NOT ANDROID)
|
|||||||
# Should break down further to set the -mmacosx-version-min,
|
# Should break down further to set the -mmacosx-version-min,
|
||||||
# but the SDK detection is too unreliable here.
|
# but the SDK detection is too unreliable here.
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
|
||||||
|
|
||||||
OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF)
|
OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF)
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ENDIF()
|
ENDIF(APPLE)
|
||||||
|
|
||||||
|
|
||||||
# For Doxygen
|
# For Doxygen
|
||||||
INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
|
INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
|
||||||
OPTION(BUILD_DOCUMENTATION "Build OpenSceneGraph reference documentation using doxygen (use: make doc_openscenegraph doc_openthreads)" OFF)
|
OPTION(BUILD_DOCUMENTATION "Build OpenSceneGraph reference documentation using doxygen (use: make DoxygenDoc)" OFF)
|
||||||
MARK_AS_ADVANCED(CLEAR BUILD_DOCUMENTATION)
|
MARK_AS_ADVANCED(CLEAR BUILD_DOCUMENTATION)
|
||||||
# To build the documention, you will have to enable it
|
# To build the documention, you will have to enable it
|
||||||
# and then do the equivalent of "make doc_openscenegraph doc_openthreads".
|
# and then do the equivalent of "make DoxygenDoc".
|
||||||
IF(BUILD_DOCUMENTATION)
|
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)
|
OPTION(BUILD_REF_DOCS_SEARCHENGINE "Enable doxygen's search engine (requires that documentation to be installed on a php enabled web server)" OFF)
|
||||||
@@ -1011,12 +865,12 @@ IF(BUILD_DOCUMENTATION)
|
|||||||
# If html help generation was requested. DOCUMENTATION_HTML_HELP is defined by Documentation.cmake
|
# If html help generation was requested. DOCUMENTATION_HTML_HELP is defined by Documentation.cmake
|
||||||
SET(GENERATE_HTMLHELP "NO")
|
SET(GENERATE_HTMLHELP "NO")
|
||||||
IF(DOCUMENTATION_HTML_HELP)
|
IF(DOCUMENTATION_HTML_HELP)
|
||||||
# on windows Documentation.cmake finds the html help workshop if it exists. On u*ix we might have it with wine but no way to point it out
|
# on windows Documentation.cmake finds the html help workshop fi it exists. On u*ix we might have it with wine but no way to point it out
|
||||||
IF(NOT WIN32)
|
IF(NOT WIN32)
|
||||||
SET(HTML_HELP_COMPILER "" CACHE FILEPATH "Enter location of the HTML help compiler to let doxygen compile html")
|
SET(HTML_HELP_COMPILER "" CACHE FILEPATH "Enter location of the HTML help compiler to let doxygen compile html")
|
||||||
MARK_AS_ADVANCED(HTML_HELP_COMPILER)
|
MARK_AS_ADVANCED(HTML_HELP_COMPILER)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
# this var sets a proper value in .doxygen files when configuring them below
|
# this var sets a proper value in .doxygen files when coniguring them below
|
||||||
SET(GENERATE_HTMLHELP "YES")
|
SET(GENERATE_HTMLHELP "YES")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -1073,10 +927,10 @@ IF(BUILD_DOCUMENTATION)
|
|||||||
SET_TARGET_PROPERTIES(doc_openthreads PROPERTIES FOLDER "Documentation")
|
SET_TARGET_PROPERTIES(doc_openthreads PROPERTIES FOLDER "Documentation")
|
||||||
ENDIF(BUILD_DOCUMENTATION)
|
ENDIF(BUILD_DOCUMENTATION)
|
||||||
|
|
||||||
OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of OpenSceneGraph builds here http://cdash.openscenegraph.org/index.php?project=OpenSceneGraph" OFF)
|
OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of OpenSceneGraph builds here http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph" OFF)
|
||||||
IF(BUILD_DASHBOARD_REPORTS)
|
IF(BUILD_DASHBOARD_REPORTS)
|
||||||
# The following are required to uses Dart and the Cdash dashboard
|
# The following are required to uses Dart and the Cdash dashboard
|
||||||
# viewable here : http://cdash.openscenegraph.org/index.php?project=OpenSceneGraph
|
# viewable here : http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph
|
||||||
INCLUDE(Dart)
|
INCLUDE(Dart)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@@ -1109,9 +963,9 @@ SET(PKGCONFIG_FILES
|
|||||||
openscenegraph-osgVolume
|
openscenegraph-osgVolume
|
||||||
)
|
)
|
||||||
|
|
||||||
IF(QT4_FOUND OR Qt5Widgets_FOUND )
|
IF(QT4_FOUND)
|
||||||
SET(PKGCONFIG_FILES ${PKGCONFIG_FILES} openscenegraph-osgQt)
|
SET(PKGCONFIG_FILES ${PKGCONFIG_FILES} openscenegraph-osgQt)
|
||||||
ENDIF()
|
ENDIF(QT4_FOUND)
|
||||||
|
|
||||||
FOREACH(PKGCONFIG_FILE ${PKGCONFIG_FILES})
|
FOREACH(PKGCONFIG_FILE ${PKGCONFIG_FILES})
|
||||||
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc.in
|
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc.in
|
||||||
|
|||||||
@@ -15,143 +15,123 @@ IF (OPENTHREADS_ATOMIC_USE_MUTEX)
|
|||||||
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
|
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
|
||||||
|
|
||||||
ELSE()
|
ELSE()
|
||||||
# as the test does not work for IOS hardcode the ATOMIC implementation
|
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE_SIMULATOR OR OSG_BUILD_PLATFORM_IPHONE)
|
|
||||||
SET(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS 0)
|
|
||||||
SET(_OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS 0)
|
|
||||||
SET(_OPENTHREADS_ATOMIC_USE_SUN 0)
|
|
||||||
SET(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED 0)
|
|
||||||
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 0)
|
|
||||||
|
|
||||||
SET(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC 1)
|
INCLUDE(CheckCXXSourceRuns)
|
||||||
|
|
||||||
ELSE()
|
# Do step by step checking,
|
||||||
INCLUDE(CheckCXXSourceRuns)
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
# Do step by step checking,
|
int main()
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
{
|
||||||
#include <cstdlib>
|
unsigned value = 0;
|
||||||
|
void* ptr = &value;
|
||||||
|
__sync_add_and_fetch(&value, 1);
|
||||||
|
__sync_synchronize();
|
||||||
|
__sync_sub_and_fetch(&value, 1);
|
||||||
|
if (!__sync_bool_compare_and_swap(&value, 0, 1))
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
int main()
|
if (!__sync_bool_compare_and_swap(&ptr, ptr, ptr))
|
||||||
{
|
return EXIT_FAILURE;
|
||||||
unsigned value = 0;
|
|
||||||
void* ptr = &value;
|
|
||||||
__sync_add_and_fetch(&value, 1);
|
|
||||||
__sync_synchronize();
|
|
||||||
__sync_sub_and_fetch(&value, 1);
|
|
||||||
if (!__sync_bool_compare_and_swap(&value, 0, 1))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
if (!__sync_bool_compare_and_swap(&ptr, ptr, ptr))
|
return EXIT_SUCCESS;
|
||||||
return EXIT_FAILURE;
|
}
|
||||||
|
" _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
}
|
#include <stdlib.h>
|
||||||
" _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
|
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
int main(int, const char**)
|
||||||
#include <stdlib.h>
|
{
|
||||||
|
unsigned value = 0;
|
||||||
|
void* ptr = &value;
|
||||||
|
__add_and_fetch(&value, 1);
|
||||||
|
__synchronize(value);
|
||||||
|
__sub_and_fetch(&value, 1);
|
||||||
|
if (!__compare_and_swap(&value, 0, 1))
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
int main(int, const char**)
|
if (!__compare_and_swap((unsigned long*)&ptr, (unsigned long)ptr, (unsigned long)ptr))
|
||||||
{
|
return EXIT_FAILURE;
|
||||||
unsigned value = 0;
|
|
||||||
void* ptr = &value;
|
|
||||||
__add_and_fetch(&value, 1);
|
|
||||||
__synchronize(value);
|
|
||||||
__sub_and_fetch(&value, 1);
|
|
||||||
if (!__compare_and_swap(&value, 0, 1))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
if (!__compare_and_swap((unsigned long*)&ptr, (unsigned long)ptr, (unsigned long)ptr))
|
return EXIT_SUCCESS;
|
||||||
return EXIT_FAILURE;
|
}
|
||||||
|
" _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS)
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
}
|
#include <atomic.h>
|
||||||
" _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS)
|
#include <cstdlib>
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
int main(int, const char**)
|
||||||
#include <atomic.h>
|
{
|
||||||
#include <cstdlib>
|
uint_t value = 0;
|
||||||
|
void* ptr = &value;
|
||||||
|
atomic_inc_uint_nv(&value);
|
||||||
|
membar_consumer();
|
||||||
|
atomic_dec_uint_nv(&value);
|
||||||
|
if (0 != atomic_cas_uint(&value, 0, 1))
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
int main(int, const char**)
|
if (ptr != atomic_cas_ptr(&ptr, ptr, ptr))
|
||||||
{
|
return EXIT_FAILURE;
|
||||||
uint_t value = 0;
|
|
||||||
void* ptr = &value;
|
|
||||||
atomic_inc_uint_nv(&value);
|
|
||||||
membar_consumer();
|
|
||||||
atomic_dec_uint_nv(&value);
|
|
||||||
if (0 != atomic_cas_uint(&value, 0, 1))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
if (ptr != atomic_cas_ptr(&ptr, ptr, ptr))
|
return EXIT_SUCCESS;
|
||||||
return EXIT_FAILURE;
|
}
|
||||||
|
" _OPENTHREADS_ATOMIC_USE_SUN)
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
}
|
#include <windows.h>
|
||||||
" _OPENTHREADS_ATOMIC_USE_SUN)
|
#include <intrin.h>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
#pragma intrinsic(_InterlockedAnd)
|
||||||
#include <windows.h>
|
#pragma intrinsic(_InterlockedOr)
|
||||||
#include <intrin.h>
|
#pragma intrinsic(_InterlockedXor)
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
#pragma intrinsic(_InterlockedAnd)
|
int main(int, const char**)
|
||||||
#pragma intrinsic(_InterlockedOr)
|
{
|
||||||
#pragma intrinsic(_InterlockedXor)
|
volatile long value = 0;
|
||||||
|
long data = 0;
|
||||||
|
long* volatile ptr = &data;
|
||||||
|
|
||||||
int main(int, const char**)
|
InterlockedIncrement(&value);
|
||||||
{
|
MemoryBarrier();
|
||||||
volatile long value = 0;
|
InterlockedDecrement(&value);
|
||||||
long data = 0;
|
|
||||||
long* volatile ptr = &data;
|
|
||||||
|
|
||||||
InterlockedIncrement(&value);
|
if (0 != InterlockedCompareExchange(&value, 1, 0))
|
||||||
MemoryBarrier();
|
return EXIT_FAILURE;
|
||||||
InterlockedDecrement(&value);
|
|
||||||
|
|
||||||
if (0 != InterlockedCompareExchange(&value, 1, 0))
|
if (ptr != InterlockedCompareExchangePointer((PVOID volatile*)&ptr, (PVOID)ptr, (PVOID)ptr))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
if (ptr != InterlockedCompareExchangePointer((PVOID volatile*)&ptr, (PVOID)ptr, (PVOID)ptr))
|
return EXIT_SUCCESS;
|
||||||
return EXIT_FAILURE;
|
}
|
||||||
|
" _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
}
|
#include <libkern/OSAtomic.h>
|
||||||
" _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
|
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
int main()
|
||||||
#include <libkern/OSAtomic.h>
|
{
|
||||||
|
volatile int32_t value = 0;
|
||||||
|
long data = 0;
|
||||||
|
long * volatile ptr = &data;
|
||||||
|
|
||||||
int main()
|
OSAtomicIncrement32(&value);
|
||||||
{
|
OSMemoryBarrier();
|
||||||
volatile int32_t value = 0;
|
OSAtomicDecrement32(&value);
|
||||||
long data = 0;
|
OSAtomicCompareAndSwapInt(value, 1, &value);
|
||||||
long * volatile ptr = &data;
|
OSAtomicCompareAndSwapPtr(ptr, ptr, (void * volatile *)&ptr);
|
||||||
|
}
|
||||||
OSAtomicIncrement32(&value);
|
" _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
||||||
OSMemoryBarrier();
|
|
||||||
OSAtomicDecrement32(&value);
|
|
||||||
OSAtomicCompareAndSwapInt(value, 1, &value);
|
|
||||||
OSAtomicCompareAndSwapPtr(ptr, ptr, (void * volatile *)&ptr);
|
|
||||||
}
|
|
||||||
" _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
|
||||||
|
|
||||||
IF(NOT _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND
|
|
||||||
NOT _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS AND
|
|
||||||
NOT _OPENTHREADS_ATOMIC_USE_SUN AND
|
|
||||||
NOT _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED AND
|
|
||||||
NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
|
||||||
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
|
|
||||||
# MinGW can set both WIN32_INTERLOCKED and GCC_BUILTINS to true which results in compliation errors
|
|
||||||
IF (_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
|
|
||||||
# In this case we prefer the GCC_BUILTINS
|
|
||||||
SET(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS 1)
|
|
||||||
SET(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED 0)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
|
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()
|
ENDIF()
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|||||||
@@ -54,12 +54,12 @@ ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST D
|
|||||||
|
|
||||||
|
|
||||||
################################################################################################
|
################################################################################################
|
||||||
# this Macro is tailored to Mike and Torbens dependencies
|
# this Macro is tailored to Mike dependencies
|
||||||
################################################################################################
|
################################################################################################
|
||||||
|
|
||||||
MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
||||||
FIND_DEPENDENCY(TIFF tiff.h libtiff ${OSG_3RDPARTY_BIN} "D" "_i")
|
FIND_DEPENDENCY(TIFF tiff.h libtiff ${OSG_3RDPARTY_BIN} "D" "_i")
|
||||||
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype2311MT;freetype234;freetype234MT;freetype235;freetype237;freetype238;freetype244;freetype250;" ${OSG_3RDPARTY_BIN} "d" "")
|
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype2311MT;freetype234;freetype234MT;freetype235;freetype237;freetype238;freetype244;" ${OSG_3RDPARTY_BIN} "d" "")
|
||||||
IF(FREETYPE_FOUND)
|
IF(FREETYPE_FOUND)
|
||||||
#forcing subsequent FindFreeType stuff to not search for other variables.... kind of a hack
|
#forcing subsequent FindFreeType stuff to not search for other variables.... kind of a hack
|
||||||
SET(FREETYPE_INCLUDE_DIR_ft2build ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
|
SET(FREETYPE_INCLUDE_DIR_ft2build ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
|
||||||
@@ -79,14 +79,14 @@ MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
|||||||
FIND_DEPENDENCY(GIFLIB gif_lib.h "ungif;libungif;giflib" ${OSG_3RDPARTY_BIN} "D" "")
|
FIND_DEPENDENCY(GIFLIB gif_lib.h "ungif;libungif;giflib" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
FIND_DEPENDENCY(ZLIB zlib.h "z;zlib;zlib1" ${OSG_3RDPARTY_BIN} "D" "")
|
FIND_DEPENDENCY(ZLIB zlib.h "z;zlib;zlib1" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
IF(ZLIB_FOUND)
|
IF(ZLIB_FOUND)
|
||||||
FIND_DEPENDENCY(PNG png.h "libpng;libpng13;libpng15;libpng16" ${OSG_3RDPARTY_BIN} "D" "")
|
FIND_DEPENDENCY(PNG png.h "libpng;libpng13;libpng15" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
IF(PNG_FOUND)
|
IF(PNG_FOUND)
|
||||||
#forcing subsequent FindPNG stuff to not search for other variables.... kind of a hack
|
#forcing subsequent FindPNG stuff to not search for other variables.... kind of a hack
|
||||||
SET(PNG_PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE FILEPATH "")
|
SET(PNG_PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE FILEPATH "")
|
||||||
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR)
|
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR)
|
||||||
ENDIF(PNG_FOUND)
|
ENDIF(PNG_FOUND)
|
||||||
ENDIF(ZLIB_FOUND)
|
ENDIF(ZLIB_FOUND)
|
||||||
FIND_DEPENDENCY(LIBXML2 libxml2 "libxml2" ${OSG_3RDPARTY_BIN} "D" "")
|
FIND_DEPENDENCY(LIBXML2 libxml "libxml2" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
IF(LIBXML2_FOUND)
|
IF(LIBXML2_FOUND)
|
||||||
# The CMAKE find libxml module uses LIBXML2_LIBRARIES -> fill it.... kind of a hack
|
# The CMAKE find libxml module uses LIBXML2_LIBRARIES -> fill it.... kind of a hack
|
||||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY} CACHE FILEPATH "" FORCE)
|
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY} CACHE FILEPATH "" FORCE)
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
# Locate Apple AVFoundation (next-generation QTKit)
|
|
||||||
# This module defines
|
|
||||||
# AV_FOUNDATION_LIBRARY
|
|
||||||
# AV_FOUNDATION_FOUND, if false, do not try to link to gdal
|
|
||||||
#
|
|
||||||
# $AV_FOUNDATION_DIR is an environment variable that would
|
|
||||||
# correspond to the ./configure --prefix=$AV_FOUNDATION_DIR
|
|
||||||
#
|
|
||||||
# Created by Stephan Maximilian Huber
|
|
||||||
|
|
||||||
|
|
||||||
IF(APPLE)
|
|
||||||
FIND_LIBRARY(AV_FOUNDATION_LIBRARY AVFoundation)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SET(AV_FOUNDATION_FOUND "NO")
|
|
||||||
IF(AV_FOUNDATION_LIBRARY)
|
|
||||||
SET(AV_FOUNDATION_FOUND "YES")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
|
||||||
# AVFoundation exists ON iOS, too -- good support for SDK 6.0 and greater
|
|
||||||
IF(${IPHONE_SDKVER} LESS "6.0")
|
|
||||||
SET(AV_FOUNDATION_FOUND "NO")
|
|
||||||
ELSE()
|
|
||||||
SET(AV_FOUNDATION_FOUND "YES")
|
|
||||||
ENDIF()
|
|
||||||
ELSE()
|
|
||||||
IF(APPLE)
|
|
||||||
# AVFoundation exists since 10.7, but only 10.8 has all features necessary for OSG
|
|
||||||
# so check the SDK-setting
|
|
||||||
|
|
||||||
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10")
|
|
||||||
# nothing special here ;-)
|
|
||||||
ELSE()
|
|
||||||
MESSAGE("AVFoundation disabled for SDK < 10.8")
|
|
||||||
SET(AV_FOUNDATION_FOUND "NO")
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# Locate ASIO-headers (http://think-async.com/Asio)
|
|
||||||
# This module defines
|
|
||||||
# ASIO_FOUND, if false, do not try to link to gdal
|
|
||||||
# ASIO_INCLUDE_DIR, where to find the headers
|
|
||||||
#
|
|
||||||
# Created by Stephan Maximilian Huber
|
|
||||||
|
|
||||||
FIND_PATH(ASIO_INCLUDE_DIR
|
|
||||||
NAMES
|
|
||||||
asio.hpp
|
|
||||||
PATHS
|
|
||||||
/usr/include
|
|
||||||
/usr/local/include
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(ASIO_FOUND "NO")
|
|
||||||
FIND_PACKAGE( Boost 1.37 )
|
|
||||||
IF(Boost_FOUND AND ASIO_INCLUDE_DIR)
|
|
||||||
SET(ASIO_FOUND "YES")
|
|
||||||
ENDIF()
|
|
||||||
@@ -28,12 +28,6 @@ IF(APPLE)
|
|||||||
SET(COLLADA_BUILDNAME "mac")
|
SET(COLLADA_BUILDNAME "mac")
|
||||||
ELSEIF(MINGW)
|
ELSEIF(MINGW)
|
||||||
SET(COLLADA_BUILDNAME "mingw")
|
SET(COLLADA_BUILDNAME "mingw")
|
||||||
ELSEIF(MSVC12)
|
|
||||||
SET(COLLADA_BUILDNAME "vc12")
|
|
||||||
ELSEIF(MSVC11)
|
|
||||||
SET(COLLADA_BUILDNAME "vc11")
|
|
||||||
ELSEIF(MSVC10)
|
|
||||||
SET(COLLADA_BUILDNAME "vc10")
|
|
||||||
ELSEIF(MSVC90)
|
ELSEIF(MSVC90)
|
||||||
SET(COLLADA_BUILDNAME "vc9")
|
SET(COLLADA_BUILDNAME "vc9")
|
||||||
ELSEIF(MSVC80)
|
ELSEIF(MSVC80)
|
||||||
@@ -53,7 +47,6 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
|
|||||||
/usr/local/include
|
/usr/local/include
|
||||||
/usr/local/include/colladadom
|
/usr/local/include/colladadom
|
||||||
/usr/local/include/collada-dom
|
/usr/local/include/collada-dom
|
||||||
/opt/local/include/collada-dom
|
|
||||||
/usr/include/
|
/usr/include/
|
||||||
/usr/include/colladadom
|
/usr/include/colladadom
|
||||||
/usr/include/collada-dom
|
/usr/include/collada-dom
|
||||||
@@ -242,7 +235,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
|
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
|
||||||
NAMES libboost_filesystem boost_filesystem boost_filesystem-mt libboost_filesystem-${COLLADA_BUILDNAME}0-mt libboost_filesystem-${COLLADA_BUILDNAME}0-mt-1_54 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-1_55
|
NAMES libboost_filesystem boost_filesystem libboost_filesystem-vc90-mt libboost_filesystem-vc100-mt
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
||||||
@@ -250,7 +243,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
|
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
|
||||||
NAMES libboost_filesystem-d boost_filesystem-d boost_filesystem-mt-d libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_54 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_55
|
NAMES libboost_filesystem-d boost_filesystem-d libboost_filesystem-vc90-mt-gd libboost_filesystem-vc100-mt-gd
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
||||||
@@ -258,7 +251,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
|
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
|
||||||
NAMES libboost_system boost_system boost_system-mt libboost_system-${COLLADA_BUILDNAME}0-mt libboost_system-${COLLADA_BUILDNAME}0-mt-1_54 libboost_system-${COLLADA_BUILDNAME}0-mt-1_55
|
NAMES libboost_system boost_system libboost_system-vc90-mt libboost_system-vc100-mt
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
||||||
@@ -266,7 +259,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
|
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
|
||||||
NAMES libboost_system-d boost_system-d boost_system-mt-d libboost_system-${COLLADA_BUILDNAME}0-mt-gd libboost_system-${COLLADA_BUILDNAME}0-mt-gd-1_54 libboost_system-${COLLADA_BUILDNAME}0-mt-gd-1_55
|
NAMES libboost_system-d boost_system-d libboost_system-vc90-mt-gd libboost_system-vc100-mt-gd
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
# Locate Apple CoreMedia
|
|
||||||
# This module defines
|
|
||||||
# COREMEDIA_LIBRARY
|
|
||||||
# COREMEDIA_FOUND, if false, do not try to link to gdal
|
|
||||||
# COREMEDIA_INCLUDE_DIR, where to find the headers
|
|
||||||
#
|
|
||||||
# $COREMEDIA_DIR is an environment variable that would
|
|
||||||
# correspond to the ./configure --prefix=$COREMEDIA_DIR
|
|
||||||
#
|
|
||||||
# Created by Stephan Maximilian Huber.
|
|
||||||
|
|
||||||
|
|
||||||
IF(APPLE)
|
|
||||||
FIND_PATH(COREMEDIA_INCLUDE_DIR CoreMedia/CoreMedia.h)
|
|
||||||
FIND_LIBRARY(COREMEDIA_LIBRARY CoreMedia)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
|
|
||||||
SET(COREMEDIA_FOUND "NO")
|
|
||||||
IF(COREMEDIA_LIBRARY AND COREMEDIA_INCLUDE_DIR)
|
|
||||||
SET(COREMEDIA_FOUND "YES")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
@@ -16,12 +16,8 @@ ELSEIF(MSVC80)
|
|||||||
SET(FBX_LIBDIR "vs2005")
|
SET(FBX_LIBDIR "vs2005")
|
||||||
ELSEIF(MSVC90)
|
ELSEIF(MSVC90)
|
||||||
SET(FBX_LIBDIR "vs2008")
|
SET(FBX_LIBDIR "vs2008")
|
||||||
ELSEIF(MSVC10)
|
ELSEIF(MSVC10 OR MSVC_VERSION>1600)
|
||||||
SET(FBX_LIBDIR "vs2010")
|
SET(FBX_LIBDIR "vs2010")
|
||||||
ELSEIF(MSVC11)
|
|
||||||
SET(FBX_LIBDIR "vs2012")
|
|
||||||
ELSEIF(MSVC12 OR MSVC_VERSION>1800)
|
|
||||||
SET(FBX_LIBDIR "vs2013")
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
@@ -34,29 +30,22 @@ ELSE()
|
|||||||
SET(FBX_LIBDIR ${FBX_LIBDIR}/x86)
|
SET(FBX_LIBDIR ${FBX_LIBDIR}/x86)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
#try to use 2015.1 or 2014.2 version
|
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
SET(FBX_LIBNAME "libfbxsdk")
|
SET(FBX_LIBNAME "fbxsdk-2012.1-static")
|
||||||
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
|
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
SET(FBX_LIBNAME "fbxsdk")
|
SET(FBX_LIBNAME "fbxsdk-2012.1-static")
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(FBX_LIBNAME "libfbxsdk-md")
|
SET(FBX_LIBNAME "fbxsdk-2012.1-md")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
|
SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
|
||||||
|
|
||||||
SET( FBX_SEARCH_PATHS
|
SET( FBX_SEARCH_PATHS
|
||||||
$ENV{FBX_DIR}
|
$ENV{FBX_DIR}
|
||||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2015.1"
|
$ENV{ProgramW6432}/Autodesk/FBX/FbxSdk/2012.1
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2015.1"
|
$ENV{PROGRAMFILES}/Autodesk/FBX/FbxSdk/2012.1
|
||||||
/Applications/Autodesk/FBXSDK20151
|
/Applications/Autodesk/FBXSDK20121
|
||||||
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.2"
|
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.2"
|
|
||||||
/Applications/Autodesk/FBXSDK20142
|
|
||||||
/Applications/Autodesk/FBXSDK20141
|
|
||||||
)
|
)
|
||||||
#I think the last line in the search path is an old typo, but let's search for 2014.1 anyway - LV
|
|
||||||
|
|
||||||
# search for headers & debug/release libraries
|
# search for headers & debug/release libraries
|
||||||
FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
|
FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
|
||||||
@@ -64,14 +53,7 @@ FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
|
|||||||
PATH_SUFFIXES "include")
|
PATH_SUFFIXES "include")
|
||||||
FIND_LIBRARY( FBX_LIBRARY ${FBX_LIBNAME}
|
FIND_LIBRARY( FBX_LIBRARY ${FBX_LIBNAME}
|
||||||
PATHS ${FBX_SEARCH_PATHS}
|
PATHS ${FBX_SEARCH_PATHS}
|
||||||
PATH_SUFFIXES "lib/${FBX_LIBDIR}/release" "lib/${FBX_LIBDIR}")
|
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
|
||||||
|
|
||||||
#Once one of the calls succeeds the result variable will be set and stored in the cache so that no call will search again.
|
|
||||||
|
|
||||||
#no debug d suffix, search in debug folder only
|
|
||||||
FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME}
|
|
||||||
PATHS ${FBX_SEARCH_PATHS}
|
|
||||||
PATH_SUFFIXES "lib/${FBX_LIBDIR}/debug")
|
|
||||||
FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME_DEBUG}
|
FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME_DEBUG}
|
||||||
PATHS ${FBX_SEARCH_PATHS}
|
PATHS ${FBX_SEARCH_PATHS}
|
||||||
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
|
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
|
||||||
@@ -81,79 +63,3 @@ IF(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR)
|
|||||||
ELSE()
|
ELSE()
|
||||||
SET(FBX_FOUND "NO")
|
SET(FBX_FOUND "NO")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT FBX_FOUND)
|
|
||||||
#try to use 2014.1 version
|
|
||||||
IF(APPLE)
|
|
||||||
SET(FBX_LIBNAME "fbxsdk-2014.1")
|
|
||||||
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
SET(FBX_LIBNAME "fbxsdk-2014.1")
|
|
||||||
ELSE()
|
|
||||||
SET(FBX_LIBNAME "fbxsdk-2014.1")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
|
|
||||||
|
|
||||||
SET( FBX_SEARCH_PATHS
|
|
||||||
$ENV{FBX_DIR}
|
|
||||||
$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.1
|
|
||||||
$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.1
|
|
||||||
/Applications/Autodesk/FBXSDK20141
|
|
||||||
)
|
|
||||||
|
|
||||||
# search for headers & debug/release libraries
|
|
||||||
FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
|
|
||||||
PATHS ${FBX_SEARCH_PATHS}
|
|
||||||
PATH_SUFFIXES "include")
|
|
||||||
FIND_LIBRARY( FBX_LIBRARY ${FBX_LIBNAME}
|
|
||||||
PATHS ${FBX_SEARCH_PATHS}
|
|
||||||
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
|
|
||||||
|
|
||||||
FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME_DEBUG}
|
|
||||||
PATHS ${FBX_SEARCH_PATHS}
|
|
||||||
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
|
|
||||||
IF(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR)
|
|
||||||
SET(FBX_FOUND "YES")
|
|
||||||
ELSE()
|
|
||||||
SET(FBX_FOUND "NO")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(NOT FBX_FOUND)
|
|
||||||
#try to use 2013.3 version
|
|
||||||
IF(APPLE)
|
|
||||||
SET(FBX_LIBNAME "fbxsdk-2013.3-static")
|
|
||||||
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
SET(FBX_LIBNAME "fbxsdk-2013.3-static")
|
|
||||||
ELSE()
|
|
||||||
SET(FBX_LIBNAME "fbxsdk-2013.3-md")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
|
|
||||||
|
|
||||||
SET( FBX_SEARCH_PATHS
|
|
||||||
$ENV{FBX_DIR}
|
|
||||||
$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2013.3
|
|
||||||
$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2013.3
|
|
||||||
/Applications/Autodesk/FBXSDK20133
|
|
||||||
)
|
|
||||||
|
|
||||||
# search for headers & debug/release libraries
|
|
||||||
FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
|
|
||||||
PATHS ${FBX_SEARCH_PATHS}
|
|
||||||
PATH_SUFFIXES "include")
|
|
||||||
FIND_LIBRARY( FBX_LIBRARY ${FBX_LIBNAME}
|
|
||||||
PATHS ${FBX_SEARCH_PATHS}
|
|
||||||
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
|
|
||||||
|
|
||||||
FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME_DEBUG}
|
|
||||||
PATHS ${FBX_SEARCH_PATHS}
|
|
||||||
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
|
|
||||||
IF(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR)
|
|
||||||
SET(FBX_FOUND "YES")
|
|
||||||
ELSE()
|
|
||||||
SET(FBX_FOUND "NO")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
ENDIF()
|
|
||||||
|
|||||||
@@ -11,8 +11,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#In ffmpeg code, old version use "#include <header.h>" and newer use "#include <libname/header.h>"
|
#In ffmpeg code, old version use "#include <header.h>" and newer use "#include <libname/header.h>"
|
||||||
#In OSG ffmpeg plugin, we used "#include <header.h>" for compatibility with old version of ffmpeg
|
#In OSG ffmpeg plugin, we use "#include <header.h>" for compatibility with old version of ffmpeg
|
||||||
#With the new version of FFmpeg, a file named "time.h" was added that breaks compatability with the old version of ffmpeg.
|
|
||||||
|
|
||||||
#We have to search the path which contain the header.h (usefull for old version)
|
#We have to search the path which contain the header.h (usefull for old version)
|
||||||
#and search the path which contain the libname/header.h (usefull for new version)
|
#and search the path which contain the libname/header.h (usefull for new version)
|
||||||
@@ -132,17 +131,20 @@ IF (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODE
|
|||||||
SET(FFMPEG_FOUND "YES")
|
SET(FFMPEG_FOUND "YES")
|
||||||
|
|
||||||
SET(FFMPEG_INCLUDE_DIRS
|
SET(FFMPEG_INCLUDE_DIRS
|
||||||
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}
|
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat
|
||||||
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}
|
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS} ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/libavdevice
|
||||||
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}
|
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/libavcodec
|
||||||
${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}
|
${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/libavutil
|
||||||
)
|
)
|
||||||
|
|
||||||
# Using the new include style for FFmpeg prevents issues with #include <time.h>
|
|
||||||
IF (FFMPEG_STDINT_INCLUDE_DIR)
|
IF (FFMPEG_STDINT_INCLUDE_DIR)
|
||||||
SET(FFMPEG_INCLUDE_DIRS
|
SET(FFMPEG_INCLUDE_DIRS
|
||||||
${FFMPEG_INCLUDE_DIRS}
|
${FFMPEG_INCLUDE_DIRS}
|
||||||
${FFMPEG_STDINT_INCLUDE_DIR}
|
${FFMPEG_STDINT_INCLUDE_DIR}
|
||||||
|
${FFMPEG_STDINT_INCLUDE_DIR}/libavformat
|
||||||
|
${FFMPEG_STDINT_INCLUDE_DIR}/libavdevice
|
||||||
|
${FFMPEG_STDINT_INCLUDE_DIR}/libavcodec
|
||||||
|
${FFMPEG_STDINT_INCLUDE_DIR}/libavutil
|
||||||
)
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
|
|||||||
/opt/csw
|
/opt/csw
|
||||||
/opt
|
/opt
|
||||||
/usr/freeware
|
/usr/freeware
|
||||||
PATH_SUFFIXES include include/freetype2
|
PATH_SUFFIXES include
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
|
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
|
||||||
@@ -74,20 +74,6 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
|
|||||||
/usr/freeware/include/freetype2
|
/usr/freeware/include/freetype2
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 config/ftheader.h
|
|
||||||
/usr/local/include/freetype2
|
|
||||||
/usr/include/freetype2
|
|
||||||
/usr/local/X11R6/include/freetype2
|
|
||||||
/usr/local/X11/include/freetype2
|
|
||||||
/usr/X11R6/include/freetype2
|
|
||||||
/usr/X11/include/freetype2
|
|
||||||
/sw/include/freetype2
|
|
||||||
/opt/local/include/freetype2
|
|
||||||
/opt/csw/include/freetype2
|
|
||||||
/opt/include/freetype2
|
|
||||||
/usr/freeware/include/freetype2
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY(FREETYPE_LIBRARY
|
FIND_LIBRARY(FREETYPE_LIBRARY
|
||||||
NAMES freetype libfreetype freetype219
|
NAMES freetype libfreetype freetype219
|
||||||
PATHS
|
PATHS
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
# Locate libgta
|
|
||||||
# This module defines
|
|
||||||
# GTA_FOUND, if false, do not try to link to libgta
|
|
||||||
# GTA_INCLUDE_DIRS, where to find the headers
|
|
||||||
# GTA_LIBRARIES
|
|
||||||
#
|
|
||||||
# $GTA_DIR is an environment variable that would
|
|
||||||
# correspond to the ./configure --prefix=$GTA_DIR
|
|
||||||
# used in building libgta.
|
|
||||||
|
|
||||||
INCLUDE(FindPkgConfig OPTIONAL)
|
|
||||||
|
|
||||||
IF(PKG_CONFIG_FOUND)
|
|
||||||
|
|
||||||
INCLUDE(FindPkgConfig)
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES(GTA gta)
|
|
||||||
|
|
||||||
ELSE(PKG_CONFIG_FOUND)
|
|
||||||
|
|
||||||
FIND_PATH(GTA_INCLUDE_DIRS gta/gta.hpp
|
|
||||||
$ENV{GTA_DIR}/include
|
|
||||||
$ENV{GTA_DIR}
|
|
||||||
~/Library/Frameworks
|
|
||||||
/Library/Frameworks
|
|
||||||
/usr/local/include
|
|
||||||
/usr/include
|
|
||||||
/sw/include # Fink
|
|
||||||
/opt/local/include # DarwinPorts
|
|
||||||
/opt/csw/include # Blastwave
|
|
||||||
/opt/include
|
|
||||||
/usr/freeware/include
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY(GTA_LIBRARIES
|
|
||||||
NAMES gta libgta
|
|
||||||
PATHS
|
|
||||||
$ENV{GTA_DIR}/lib
|
|
||||||
$ENV{GTA_DIR}
|
|
||||||
~/Library/Frameworks
|
|
||||||
/Library/Frameworks
|
|
||||||
/usr/local/lib
|
|
||||||
/usr/lib
|
|
||||||
/sw/lib
|
|
||||||
/opt/local/lib
|
|
||||||
/opt/csw/lib
|
|
||||||
/opt/lib
|
|
||||||
/usr/freeware/lib64
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(GTA_FOUND "NO")
|
|
||||||
IF(GTA_LIBRARIES AND GTA_INCLUDE_DIRS)
|
|
||||||
SET(GTA_FOUND "YES")
|
|
||||||
ENDIF(GTA_LIBRARIES AND GTA_INCLUDE_DIRS)
|
|
||||||
|
|
||||||
ENDIF(PKG_CONFIG_FOUND)
|
|
||||||
@@ -15,7 +15,6 @@ FIND_PATH(NVTT_INCLUDE_DIR nvtt/nvtt.h
|
|||||||
PATH_SUFFIXES include
|
PATH_SUFFIXES include
|
||||||
)
|
)
|
||||||
|
|
||||||
# NVTT
|
|
||||||
FIND_LIBRARY(NVTT_LIBRARY
|
FIND_LIBRARY(NVTT_LIBRARY
|
||||||
NAMES nvtt
|
NAMES nvtt
|
||||||
PATHS
|
PATHS
|
||||||
@@ -26,17 +25,6 @@ FIND_LIBRARY(NVTT_LIBRARY
|
|||||||
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(NVTT_LIBRARY_DEBUG
|
|
||||||
NAMES nvtt_d
|
|
||||||
PATHS
|
|
||||||
/usr/local
|
|
||||||
/usr
|
|
||||||
$ENV{NVTT_DIR}
|
|
||||||
${3rdPartyRoot}
|
|
||||||
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
|
||||||
)
|
|
||||||
|
|
||||||
# NVIMAGE
|
|
||||||
FIND_LIBRARY(NVIMAGE_LIBRARY
|
FIND_LIBRARY(NVIMAGE_LIBRARY
|
||||||
NAMES nvimage
|
NAMES nvimage
|
||||||
PATHS
|
PATHS
|
||||||
@@ -47,17 +35,6 @@ FIND_LIBRARY(NVIMAGE_LIBRARY
|
|||||||
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(NVIMAGE_LIBRARY_DEBUG
|
|
||||||
NAMES nvimage_d
|
|
||||||
PATHS
|
|
||||||
/usr/local
|
|
||||||
/usr
|
|
||||||
$ENV{NVTT_DIR}
|
|
||||||
${3rdPartyRoot}
|
|
||||||
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
|
||||||
)
|
|
||||||
|
|
||||||
# NVMATH
|
|
||||||
FIND_LIBRARY(NVMATH_LIBRARY
|
FIND_LIBRARY(NVMATH_LIBRARY
|
||||||
NAMES nvmath
|
NAMES nvmath
|
||||||
PATHS
|
PATHS
|
||||||
@@ -68,17 +45,6 @@ FIND_LIBRARY(NVMATH_LIBRARY
|
|||||||
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(NVMATH_LIBRARY_DEBUG
|
|
||||||
NAMES nvmath_d
|
|
||||||
PATHS
|
|
||||||
/usr/local
|
|
||||||
/usr
|
|
||||||
$ENV{NVTT_DIR}
|
|
||||||
${3rdPartyRoot}
|
|
||||||
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
|
||||||
)
|
|
||||||
|
|
||||||
# NVCORE
|
|
||||||
FIND_LIBRARY(NVCORE_LIBRARY
|
FIND_LIBRARY(NVCORE_LIBRARY
|
||||||
NAMES nvcore
|
NAMES nvcore
|
||||||
PATHS
|
PATHS
|
||||||
@@ -88,18 +54,6 @@ FIND_LIBRARY(NVCORE_LIBRARY
|
|||||||
${3rdPartyRoot}
|
${3rdPartyRoot}
|
||||||
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
)
|
)
|
||||||
FIND_LIBRARY(NVCORE_LIBRARY_DEBUG
|
|
||||||
NAMES nvcore_d
|
|
||||||
PATHS
|
|
||||||
/usr/local
|
|
||||||
/usr
|
|
||||||
$ENV{NVTT_DIR}
|
|
||||||
${3rdPartyRoot}
|
|
||||||
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SET(NVTT_FOUND "NO")
|
SET(NVTT_FOUND "NO")
|
||||||
IF(NVTT_LIBRARY AND NVTT_INCLUDE_DIR)
|
IF(NVTT_LIBRARY AND NVTT_INCLUDE_DIR)
|
||||||
|
|||||||
@@ -100,13 +100,8 @@ MACRO(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
|||||||
IF( NOT ${MYLIBRARY}_DEBUG)
|
IF( NOT ${MYLIBRARY}_DEBUG)
|
||||||
IF(MYLIBRARY)
|
IF(MYLIBRARY)
|
||||||
SET(${MYLIBRARY}_DEBUG ${MYLIBRARY})
|
SET(${MYLIBRARY}_DEBUG ${MYLIBRARY})
|
||||||
ENDIF(MYLIBRARY)
|
ENDIF(MYLIBRARY)
|
||||||
ELSE()
|
ENDIF( NOT ${MYLIBRARY}_DEBUG)
|
||||||
IF( NOT MYLIBRARY )
|
|
||||||
SET(${MYLIBRARY} ${${MYLIBRARY}_DEBUG} )
|
|
||||||
ENDIF(NOT MYLIBRARY)
|
|
||||||
|
|
||||||
ENDIF( NOT ${MYLIBRARY}_DEBUG )
|
|
||||||
|
|
||||||
ENDMACRO(FIND_OSG_LIBRARY LIBRARY LIBRARYNAME)
|
ENDMACRO(FIND_OSG_LIBRARY LIBRARY LIBRARYNAME)
|
||||||
|
|
||||||
@@ -116,20 +111,12 @@ FIND_OSG_LIBRARY(OSGUTIL_LIBRARY osgUtil)
|
|||||||
FIND_OSG_LIBRARY(OSGDB_LIBRARY osgDB)
|
FIND_OSG_LIBRARY(OSGDB_LIBRARY osgDB)
|
||||||
FIND_OSG_LIBRARY(OSGTEXT_LIBRARY osgText)
|
FIND_OSG_LIBRARY(OSGTEXT_LIBRARY osgText)
|
||||||
FIND_OSG_LIBRARY(OSGWIDGET_LIBRARY osgWidget)
|
FIND_OSG_LIBRARY(OSGWIDGET_LIBRARY osgWidget)
|
||||||
FIND_OSG_LIBRARY(OSGQT_LIBRARY osgQt)
|
|
||||||
FIND_OSG_LIBRARY(OSGTERRAIN_LIBRARY osgTerrain)
|
FIND_OSG_LIBRARY(OSGTERRAIN_LIBRARY osgTerrain)
|
||||||
FIND_OSG_LIBRARY(OSGFX_LIBRARY osgFX)
|
FIND_OSG_LIBRARY(OSGFX_LIBRARY osgFX)
|
||||||
FIND_OSG_LIBRARY(OSGVIEWER_LIBRARY osgViewer)
|
FIND_OSG_LIBRARY(OSGVIEWER_LIBRARY osgViewer)
|
||||||
FIND_OSG_LIBRARY(OSGVOLUME_LIBRARY osgVolume)
|
FIND_OSG_LIBRARY(OSGVOLUME_LIBRARY osgVolume)
|
||||||
FIND_OSG_LIBRARY(OSGMANIPULATOR_LIBRARY osgManipulator)
|
|
||||||
FIND_OSG_LIBRARY(OSGANIMATION_LIBRARY osgAnimation)
|
|
||||||
FIND_OSG_LIBRARY(OSGPARTICLE_LIBRARY osgParticle)
|
|
||||||
FIND_OSG_LIBRARY(OSGSHADOW_LIBRARY osgShadow)
|
|
||||||
FIND_OSG_LIBRARY(OSGPRESENTATION_LIBRARY osgPresentation)
|
|
||||||
FIND_OSG_LIBRARY(OSGSIM_LIBRARY osgSim)
|
|
||||||
FIND_OSG_LIBRARY(OPENTHREADS_LIBRARY OpenThreads)
|
FIND_OSG_LIBRARY(OPENTHREADS_LIBRARY OpenThreads)
|
||||||
|
|
||||||
|
|
||||||
SET(OSG_FOUND "NO")
|
SET(OSG_FOUND "NO")
|
||||||
IF(OSG_LIBRARY AND OSG_INCLUDE_DIR)
|
IF(OSG_LIBRARY AND OSG_INCLUDE_DIR)
|
||||||
SET(OSG_FOUND "YES")
|
SET(OSG_FOUND "YES")
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
# Locate Apple QuartzCore
|
|
||||||
# This module defines
|
|
||||||
# QUARTZCORE_LIBRARY
|
|
||||||
# QUARTZCORE_FOUND, if false, do not try to link to QUARTZCORE
|
|
||||||
# QUARTZCORE_INCLUDE_DIR, where to find the headers
|
|
||||||
#
|
|
||||||
# $QUARTZCORE_DIR is an environment variable that would
|
|
||||||
# correspond to the ./configure --prefix=$QUARTZCORE_DIR
|
|
||||||
#
|
|
||||||
# Created by Stephan Maximilian Huber.
|
|
||||||
|
|
||||||
|
|
||||||
IF(APPLE)
|
|
||||||
FIND_PATH(QUARTZCORE_INCLUDE_DIR QuartzCore/QuartzCore.h)
|
|
||||||
FIND_LIBRARY(QUARTZCORE_LIBRARY QuartzCore)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
|
|
||||||
SET(QUARTZCORE_FOUND "NO")
|
|
||||||
IF(QUARTZCORE_LIBRARY AND QUARTZCORE_INCLUDE_DIR)
|
|
||||||
SET(QUARTZCORE_FOUND "YES")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
@@ -49,24 +49,18 @@ ENDIF()
|
|||||||
|
|
||||||
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
|
||||||
SET(QUICKTIME_FOUND "NO")
|
SET(QUICKTIME_FOUND "NO")
|
||||||
ELSE()
|
ENDIF()
|
||||||
IF(APPLE)
|
|
||||||
#Quicktime is not supported under 64bit OSX build so we need to detect it and disable it.
|
IF(APPLE)
|
||||||
#First check to see if we are running with a native 64-bit compiler (10.6 default) and implicit arch
|
#Quicktime is not supported under 64bit OSX build so we need to detect it and disable it.
|
||||||
IF(NOT CMAKE_OSX_ARCHITECTURES AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
#First check to see if we are running with a native 64-bit compiler (10.6 default) and implicit arch
|
||||||
SET(QUICKTIME_FOUND "NO")
|
IF(NOT CMAKE_OSX_ARCHITECTURES AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
ELSE()
|
SET(QUICKTIME_FOUND "NO")
|
||||||
#Otherwise check to see if 64-bit is explicitly called for.
|
ELSE()
|
||||||
LIST(FIND CMAKE_OSX_ARCHITECTURES "x86_64" has64Compile)
|
#Otherwise check to see if 64-bit is explicitly called for.
|
||||||
IF(NOT has64Compile EQUAL -1)
|
LIST(FIND CMAKE_OSX_ARCHITECTURES "x86_64" has64Compile)
|
||||||
SET(QUICKTIME_FOUND "NO")
|
IF(NOT has64Compile EQUAL -1)
|
||||||
ENDIF()
|
SET(QUICKTIME_FOUND "NO")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
# Disable quicktime for >= 10.7, as it's officially deprecated
|
ENDIF()
|
||||||
|
|
||||||
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10")
|
|
||||||
MESSAGE("disabling quicktime because it's not supported by the selected SDK ${OSG_OSX_SDK_NAME}")
|
|
||||||
SET(QUICKTIME_FOUND "NO")
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ IF(PKG_CONFIG_FOUND)
|
|||||||
|
|
||||||
INCLUDE(FindPkgConfig)
|
INCLUDE(FindPkgConfig)
|
||||||
|
|
||||||
#Version 2.35 introduces the rsvg_cleanup function which is used
|
PKG_CHECK_MODULES(RSVG librsvg-2.0)
|
||||||
PKG_CHECK_MODULES(RSVG librsvg-2.0>=2.35)
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES(CAIRO cairo)
|
PKG_CHECK_MODULES(CAIRO cairo)
|
||||||
|
|
||||||
IF (RSVG_FOUND AND NOT CAIRO_FOUND)
|
IF (RSVG_FOUND AND NOT CAIRO_FOUND)
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
# Locate ZeroConf / Bonjour
|
|
||||||
# This module defines
|
|
||||||
# ZEROCONF_LIBRARY
|
|
||||||
# ZEROCONF_FOUND, if false, do not try to link to gdal
|
|
||||||
# ZEROCONF_INCLUDE_DIR, where to find the headers
|
|
||||||
#
|
|
||||||
# $ZEROCONF_DIR is an environment variable that would
|
|
||||||
# correspond to the ./configure --prefix=$ZEROCONF_DIR
|
|
||||||
|
|
||||||
# Created by Stephan Maximilian Huber
|
|
||||||
|
|
||||||
SET(ZEROCONF_FOUND "NO")
|
|
||||||
|
|
||||||
IF(APPLE)
|
|
||||||
# bonjour is part of the system on os x / ios
|
|
||||||
SET(ZEROCONF_FOUND "YES")
|
|
||||||
ELSE()
|
|
||||||
IF(WIN32)
|
|
||||||
# find the Bonjour SDK
|
|
||||||
FIND_PATH(ZEROCONF_INCLUDE_DIR dnssd.h
|
|
||||||
$ENV{ZEROCONF_DIR}/include
|
|
||||||
$ENV{ZEROCONF_DIR}
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
)
|
|
||||||
FIND_PATH(ZEROCONF_INCLUDE_DIR dnssd.h
|
|
||||||
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
PATH_SUFFIXES include
|
|
||||||
)
|
|
||||||
FIND_PATH(ZEROCONF_INCLUDE_DIR dnssd.h)
|
|
||||||
|
|
||||||
FIND_LIBRARY(ZEROCONF_LIBRARY dnssd
|
|
||||||
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
PATH_SUFFIXES lib64 lib
|
|
||||||
)
|
|
||||||
FIND_LIBRARY(ZEROCONF_LIBRARY dnssd)
|
|
||||||
|
|
||||||
SET(ZEROCONF_FOUND "NO")
|
|
||||||
IF(ZEROCONF_LIBRARY AND ZEROCONF_INCLUDE_DIR)
|
|
||||||
SET(ZEROCONF_FOUND "YES")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
ELSE()
|
|
||||||
# TODO find AVAHI on linux
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
@@ -1,15 +1,12 @@
|
|||||||
MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
|
MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
|
||||||
|
|
||||||
#foreach(arg ${TARGET_LIBRARIES})
|
foreach(arg ${TARGET_LIBRARIES})
|
||||||
# set(MODULE_LIBS "${MODULE_LIBS} -l${arg}")
|
set(MODULE_LIBS "${MODULE_LIBS} -l${arg}")
|
||||||
#endforeach(arg ${TARGET_LIBRARIES})
|
endforeach(arg ${TARGET_LIBRARIES})
|
||||||
|
|
||||||
foreach(arg ${TARGET_SRC})
|
foreach(arg ${TARGET_SRC})
|
||||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" n_f ${arg})
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" n_f ${arg})
|
||||||
IF ("${arg}" MATCHES ".*\\.c$" OR "${arg}" MATCHES ".*\\.cpp$")
|
set(MODULE_SOURCES "${MODULE_SOURCES} ${n_f}")
|
||||||
#We only include source files, not header files, this removes anoying warnings
|
|
||||||
set(MODULE_SOURCES "${MODULE_SOURCES} ${n_f}")
|
|
||||||
ENDIF()
|
|
||||||
endforeach(arg ${TARGET_SRC})
|
endforeach(arg ${TARGET_SRC})
|
||||||
|
|
||||||
#SET(MODULE_INCLUDES "${CMAKE_SOURCE_DIR}/include include")
|
#SET(MODULE_INCLUDES "${CMAKE_SOURCE_DIR}/include include")
|
||||||
@@ -38,8 +35,7 @@ MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
|
|||||||
ELSEIF(OSG_GLES2_AVAILABLE)
|
ELSEIF(OSG_GLES2_AVAILABLE)
|
||||||
SET(OPENGLES_LIBRARY -lGLESv2)
|
SET(OPENGLES_LIBRARY -lGLESv2)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
#${MODULE_LIBS}
|
set(MODULE_LIBS "${MODULE_LIBS} ${OPENGLES_LIBRARY} -ldl")
|
||||||
set(MODULE_LIBS_FLAGS "${OPENGLES_LIBRARY} -ldl")
|
|
||||||
if(NOT CPP_EXTENSION)
|
if(NOT CPP_EXTENSION)
|
||||||
set(CPP_EXTENSION "cpp")
|
set(CPP_EXTENSION "cpp")
|
||||||
endif()
|
endif()
|
||||||
@@ -48,12 +44,8 @@ MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
IF("MODULE_USER_STATIC_OR_DYNAMIC" MATCHES "STATIC")
|
IF("MODULE_USER_STATIC_OR_DYNAMIC" MATCHES "STATIC")
|
||||||
SET(MODULE_BUILD_TYPE "\$\(BUILD_STATIC_LIBRARY\)")
|
SET(MODULE_BUILD_TYPE "\$\(BUILD_STATIC_LIBRARY\)")
|
||||||
SET(MODULE_LIBS_SHARED " ")
|
|
||||||
SET(MODULE_LIBS_STATIC ${TARGET_LIBRARIES})
|
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(MODULE_BUILD_TYPE "\$\(BUILD_SHARED_LIBRARY\)")
|
SET(MODULE_BUILD_TYPE "\$\(BUILD_DYNAMIC_LIBRARY\)")
|
||||||
SET(MODULE_LIBS_SHARED ${TARGET_LIBRARIES})
|
|
||||||
SET(MODULE_LIBS_STATIC " ")
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} ${LIB_NAME}")
|
set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} ${LIB_NAME}")
|
||||||
set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${CMAKE_CURRENT_BINARY_DIR}/Android.mk \n")
|
set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${CMAKE_CURRENT_BINARY_DIR}/Android.mk \n")
|
||||||
|
|||||||
@@ -224,9 +224,6 @@ MACRO(SETUP_LIBRARY LIB_NAME)
|
|||||||
${TARGET_SRC}
|
${TARGET_SRC}
|
||||||
)
|
)
|
||||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES FOLDER "OSG Core")
|
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES FOLDER "OSG Core")
|
||||||
IF(APPLE)
|
|
||||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
|
|
||||||
ENDIF()
|
|
||||||
IF(TARGET_LABEL)
|
IF(TARGET_LABEL)
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
|
||||||
ENDIF(TARGET_LABEL)
|
ENDIF(TARGET_LABEL)
|
||||||
@@ -282,7 +279,12 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
|||||||
ADD_LIBRARY(${TARGET_TARGETNAME} STATIC ${TARGET_SRC} ${TARGET_H})
|
ADD_LIBRARY(${TARGET_TARGETNAME} STATIC ${TARGET_SRC} ${TARGET_H})
|
||||||
ENDIF(DYNAMIC_OPENSCENEGRAPH)
|
ENDIF(DYNAMIC_OPENSCENEGRAPH)
|
||||||
|
|
||||||
IF(MSVC)
|
#not sure if needed, but for plugins only Msvc need the d suffix
|
||||||
|
IF(NOT MSVC)
|
||||||
|
IF(NOT UNIX)
|
||||||
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "")
|
||||||
|
ENDIF(NOT UNIX)
|
||||||
|
ELSE(NOT MSVC)
|
||||||
IF(NOT CMAKE24)
|
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
|
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)
|
ELSE(NOT CMAKE24)
|
||||||
@@ -311,13 +313,11 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
|||||||
ENDIF(OSG_MSVC_VERSIONED_DLL)
|
ENDIF(OSG_MSVC_VERSIONED_DLL)
|
||||||
|
|
||||||
ENDIF(NOT CMAKE24)
|
ENDIF(NOT CMAKE24)
|
||||||
ENDIF(MSVC)
|
ENDIF(NOT MSVC)
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Plugins")
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Plugins")
|
||||||
IF(APPLE)
|
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
|
|
||||||
ENDIF()
|
|
||||||
SETUP_LINK_LIBRARIES()
|
SETUP_LINK_LIBRARIES()
|
||||||
|
|
||||||
#the installation path are differentiated for win32 that install in bib versus other architecture that install in lib${LIB_POSTFIX}/${OSG_PLUGINS}
|
#the installation path are differentiated for win32 that install in bib versus other architecture that install in lib${LIB_POSTFIX}/${OSG_PLUGINS}
|
||||||
@@ -363,8 +363,6 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
|
|||||||
# Bundle version is the version the OS looks at.
|
# Bundle version is the version the OS looks at.
|
||||||
SET(MACOSX_BUNDLE_BUNDLE_VERSION "${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION}")
|
SET(MACOSX_BUNDLE_BUNDLE_VERSION "${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION}")
|
||||||
SET(MACOSX_BUNDLE_GUI_IDENTIFIER "org.openscenegraph.${TARGET_TARGETNAME}" )
|
SET(MACOSX_BUNDLE_GUI_IDENTIFIER "org.openscenegraph.${TARGET_TARGETNAME}" )
|
||||||
# replace underscore by hyphen
|
|
||||||
STRING(REGEX REPLACE "_" "-" MACOSX_BUNDLE_GUI_IDENTIFIER ${MACOSX_BUNDLE_GUI_IDENTIFIER})
|
|
||||||
SET(MACOSX_BUNDLE_BUNDLE_NAME "${TARGET_NAME}" )
|
SET(MACOSX_BUNDLE_BUNDLE_NAME "${TARGET_NAME}" )
|
||||||
# SET(MACOSX_BUNDLE_ICON_FILE "myicon.icns")
|
# SET(MACOSX_BUNDLE_ICON_FILE "myicon.icns")
|
||||||
# SET(MACOSX_BUNDLE_COPYRIGHT "")
|
# SET(MACOSX_BUNDLE_COPYRIGHT "")
|
||||||
@@ -398,10 +396,6 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
|
|||||||
SET_OUTPUT_DIR_PROPERTY_260(${TARGET_TARGETNAME} "") # Ensure the /Debug /Release are removed
|
SET_OUTPUT_DIR_PROPERTY_260(${TARGET_TARGETNAME} "") # Ensure the /Debug /Release are removed
|
||||||
ENDIF(MSVC_IDE AND OSG_MSVC_VERSIONED_DLL)
|
ENDIF(MSVC_IDE AND OSG_MSVC_VERSIONED_DLL)
|
||||||
|
|
||||||
IF(APPLE)
|
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SETUP_LINK_LIBRARIES()
|
SETUP_LINK_LIBRARIES()
|
||||||
|
|
||||||
ENDMACRO(SETUP_EXE)
|
ENDMACRO(SETUP_EXE)
|
||||||
@@ -527,7 +521,3 @@ MACRO(HANDLE_MSVC_DLL)
|
|||||||
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/osg${OPENSCENEGRAPH_SOVERSION}-")
|
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/osg${OPENSCENEGRAPH_SOVERSION}-")
|
||||||
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES IMPORT_PREFIX "../")
|
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES IMPORT_PREFIX "../")
|
||||||
ENDMACRO(HANDLE_MSVC_DLL)
|
ENDMACRO(HANDLE_MSVC_DLL)
|
||||||
|
|
||||||
MACRO(REMOVE_CXX_FLAG flag)
|
|
||||||
STRING(REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
ENDMACRO()
|
|
||||||
|
|||||||
108
NEWS.txt
108
NEWS.txt
@@ -1,114 +1,6 @@
|
|||||||
OSG News
|
OSG News
|
||||||
========
|
========
|
||||||
|
|
||||||
|
|
||||||
= OpenSceneGraph 3.2.2 maintance release provides a number of bug and build fixes over the 3.2.1 stable release
|
|
||||||
|
|
||||||
PERTHSHIRE, Scotland - 4th August 2015 - OpenSceneGraph Professional Services announces the release of OpenSceneGraph 3.2.2, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. OpenSceneGraph 3.2.2 is written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. OpenSceneGraph 3.2.2 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
|
|
||||||
|
|
||||||
=== Open-source development delivers industry-leading features and performance ===
|
|
||||||
The OpenSceneGraph 3.2.2 stable release is the culmination of 16 years of work by the open-source community that has grown up around the project. This point release is fully binary compatible with the 3.2.0 and 3.2.1 stable releases. The changes made are focused on addressing bugs and improving build support for latest compilers, OS updates and 3rd changes to Party Libraries.
|
|
||||||
|
|
||||||
=== Downloads and Licensing ===
|
|
||||||
OpenSceneGraph is open-source, so full source code is provided, and can be copied, modified and used free of charge for commercial and non-commercial use. Access to the source allows end users greater flexibility in how they develop, debug and deploy their applications. They gain productivity and freedom by being able to leverage the tool chain in accordance with their own release cycles. Downloads of binaries and source can be found in the [http://www.openscenegraph.org/index.php/download-section/stable-releases Downloads] section of the openscenegraph.org website.
|
|
||||||
|
|
||||||
OpenSceneGraph is released under the [http://www.openscenegraph.org/projects/osg/wiki/Legal OpenSceneGraph Public License], which is based on the Lesser GNU Public License (LGPL), permitting the software to be used free of charge across the full spectrum of commercial and open-source applications. Furthermore, it allows both static and dynamic linking of the OpenSceneGraph libraries without restricting the licensing of the user's software.
|
|
||||||
|
|
||||||
=== Professional support and services ===
|
|
||||||
OpenSceneGraph project is backed up with professional services by [http://www.openscenegraph.com OpenSceneGraph Professional Services], based in Scotland, and [http://www.alphapixel.com AlphaPixel] based in the USA, and a range of [wiki:Community/Contractors Contractors] from around the world. Services available include:
|
|
||||||
|
|
||||||
* Confidential Professional Support
|
|
||||||
* Bespoke development
|
|
||||||
* Consultancy
|
|
||||||
* Training
|
|
||||||
|
|
||||||
=== Community support and contributions ===
|
|
||||||
The diverse and growing community of over 5000 developers is centred around the public osg-users mailing list/forum, where members discuss how best to use OpenSceneGraph, provide mutual support, and coordinate development of new features and bug fixes. Members of this community come from many different countries with backgrounds ranging from some of the world's largest aerospace companies, game companies, and visual simulation specialists to university researchers, students and hobbyists.
|
|
||||||
|
|
||||||
The OpenSceneGraph project owes a great deal to the community for its development and support, in particular we wish to thank the [http://www.openscenegraph.org/index.php/about/197-contributors-to-openscenegraph-3-2-2 individuals] from around the world that have directly contributed to the development and refinement of the OpenSceneGraph code base.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
= OpenSceneGraph 3.2.1 stable release provides a number of bug and build fixes to the 3.2.0 stable release
|
|
||||||
|
|
||||||
PERTHSHIRE, Scotland - 4th July 2014 - OpenSceneGraph Professional Services announces the release of OpenSceneGraph 3.2.1, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. OpenSceneGraph 3.2 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. OpenSceneGraph 3.2 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
|
|
||||||
|
|
||||||
=== Open-source development delivers industry-leading features and performance ===
|
|
||||||
The OpenSceneGraph 3.2.1 stable release is the culmination of 15 years of work by the open-source community that has grown up around the project. This point release is fully binary compatible with the 3.2.0 stable release. The changes made are focused on addressing bugs and improving build support for latest compilers, OS updates and 3rd changes to Party Libraries.
|
|
||||||
|
|
||||||
=== Downloads and Licensing ===
|
|
||||||
OpenSceneGraph is open-source, so full source code is provided, and can be copied, modified and used free of charge for commercial and non-commercial use. Access to the source allows end users greater flexibility in how they develop, debug and deploy their applications. They gain productivity and freedom by being able to leverage the tool chain in accordance with their own release cycles. Downloads of binaries and source can be found in the [http://www.openscenegraph.org/index.php/download-section/stable-releases Downloads] section of the openscenegraph.org website.
|
|
||||||
|
|
||||||
OpenSceneGraph is released under the [http://www.openscenegraph.org/projects/osg/wiki/Legal OpenSceneGraph Public License], which is based on the Lesser GNU Public License (LGPL), permitting the software to be used free of charge across the full spectrum of commercial and open-source applications. Furthermore, it allows both static and dynamic linking of the OpenSceneGraph libraries without restricting the licensing of the user's software.
|
|
||||||
|
|
||||||
=== Professional support and services ===
|
|
||||||
OpenSceneGraph project is backed up with professional services by [http://www.openscenegraph.com OpenSceneGraph Professional Services], based in Scotland, and [http://www.skew-matrix.com Skew-Matrix] and [http://www.alphapixel.com AlphaPixel] 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 5000 developers is centred around the public osg-users mailing list/forum, where members discuss how best to use OpenSceneGraph, provide mutual support, and coordinate development of new features and bug fixes. Members of this community come from many different countries with backgrounds ranging from some of the world's largest aerospace companies, game companies, and visual simulation specialists to university researchers, students and hobbyists.
|
|
||||||
|
|
||||||
The OpenSceneGraph project owes a great deal to the community for its development and support, in particular we wish to thank the [http://www.openscenegraph.org/index.php/about/56-contributors/162-contributors-to-openscenegraph-3-2-1 individuals] from around the world that have directly contributed to the development and refinement of the OpenSceneGraph code base.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
= !OpenSceneGraph 3.2 release improves support iOS and Android, supports a range of new OpenGL features much more.
|
|
||||||
|
|
||||||
PERTHSHIRE, Scotland - 24th July 2013 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 3.2, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 3.2 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. !OpenSceneGraph 3.2 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
|
|
||||||
|
|
||||||
=== Open-source development delivers industry-leading features and performance ===
|
|
||||||
The !OpenSceneGraph 3.2 release is the culmination of 14 years of work by 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 in both the desktop and mobile space.
|
|
||||||
|
|
||||||
=== Updates include: ===
|
|
||||||
|
|
||||||
* Improvements to OpenGL ES 1.1 and 2.0 support, including platform specific extensions
|
|
||||||
* Revamped QTKit, imageio and quicktime plugins for improved support of iOS and OSX
|
|
||||||
* New avfoundation plugin for reading video on iOS and OSX
|
|
||||||
* New ktx plugin for reading Khronos Texture Files
|
|
||||||
* New OpenGL extensions support including compute shaders, tessellation shaders, integer array formats and associated Vec* classes, primitive restart
|
|
||||||
* Improvements to osgManipulator NodeKit that introduce new manipulators and improve flexibility and customizability
|
|
||||||
* Updates to osgQt to support Qt5 and provide better support for Qt4
|
|
||||||
* New osgGA::Device base class for recieving from and sending events to both real and virtual devices in a generic, extensible way
|
|
||||||
* New ZeroConf, RestHTTP and OSC plugins to enable remote control of applications such as controlling desktop systems from tablets and phones
|
|
||||||
* Improvements to osgVolume NodeKit and DICOM plugin for better medical visualization
|
|
||||||
* New TrackVis .trk track files plugin for the visualization of brain scans.
|
|
||||||
* Improvements to osgPresentation NodeKit and Present3D application to make it possible to create non-linear interactive, remote controlled shows
|
|
||||||
* New osgViewer::ViewConfig class with range of implementations to make it easier to configure viewers for advanced rendering support
|
|
||||||
* Support for GPU based Keystone correction with onscreen editing making it possible to use low cost projectors in off axis setups
|
|
||||||
* Clean up of osg::Geometry class removing all deprecated slow path API's resulting in a smaller and faster Geometry class
|
|
||||||
* Addition of deprecated_osg namespace and deprecated_osg::Geometry class that provides deprecated BIND_PER_PRIMITIVE and array indices APIs to add with porting
|
|
||||||
* New ViewDependentShadowMap shadow rendering class that combines enables robust combining of parallel split and perspective shadow map techniques
|
|
||||||
* Updates of plugins to work with the latest FBX, ffmpeg, NVTT, OpenVRML, LibVNCServer releases
|
|
||||||
|
|
||||||
|
|
||||||
=== Downloads and Licensing ===
|
|
||||||
!OpenSceneGraph is open-source, so full source code is provided, and can be copied, modified and used free of charge for commercial and non-commercial use. Access to the source allows end users greater flexibility in how they develop, debug and deploy their applications. They gain productivity and freedom by being able to leverage the tool chain in accordance with their own release cycles. Downloads of binaries and source can be found in the [http://www.openscenegraph.org/index.php/download-section/stable-releases Downloads] section of the openscenegraph.org website.
|
|
||||||
|
|
||||||
!OpenSceneGraph is released under the [http://www.openscenegraph.org/projects/osg/wiki/Legal OpenSceneGraph Public License], which is based on the Lesser GNU Public License (LGPL), permitting the software to be used free of charge across the full spectrum of commercial and open-source applications. Furthermore, it allows both static and dynamic linking of the !OpenSceneGraph libraries without restricting the licensing of the user's software.
|
|
||||||
|
|
||||||
=== Professional support and services ===
|
|
||||||
!OpenSceneGraph project is backed up with professional services by [http://www.openscenegraph.com OpenSceneGraph Professional Services], based in Scotland, and [http://www.skew-matrix.com Skew-Matrix] and [http://www.alphapixel.com AlphaPixel] 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 5000 developers is centred around the public osg-users mailing list/forum, where members discuss how best to use !OpenSceneGraph, provide mutual support, and coordinate development of new features and bug fixes. Members of this community come from many different countries with backgrounds ranging from some of the world's largest aerospace companies, game companies, and visual simulation specialists to university researchers, students and hobbyists.
|
|
||||||
|
|
||||||
The !OpenSceneGraph project owes a great deal to the community for its development and support, in particular we wish to thank the [http://www.openscenegraph.org/index.php/about/http:/www.openscenegraph.org/index.php/about/142-contributors-to-openscenegraph-3-2-0 511 individuals] from around the world that have directly contributed to the development and refinement of the !OpenSceneGraph code base.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
= !OpenSceneGraph 3.0 release adds support OpenGL ES 1.1, OpenGL ES 2.0, OpenGL 3.x to 4.0, support for Andoid and IOS platforms and much more.
|
= !OpenSceneGraph 3.0 release adds support OpenGL ES 1.1, OpenGL ES 2.0, OpenGL 3.x to 4.0, support for Andoid and IOS platforms and much more.
|
||||||
|
|
||||||
PERTHSHIRE, Scotland - 28th June 2011 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 3.0, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 3.0 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. !OpenSceneGraph 3.0 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
|
PERTHSHIRE, Scotland - 28th June 2011 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 3.0, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 3.0 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. !OpenSceneGraph 3.0 runs on all Microsoft Windows platforms, Apple OS/X, IOS, GNU/Linux, Android, IRIX, Solaris, HP-UX, AIX and FreeBSD operating systems.
|
||||||
|
|||||||
@@ -1,36 +1,27 @@
|
|||||||
#ANDROID makefile ${MODULE_NAME}
|
#ANDROID makefile ${MODULE_NAME}
|
||||||
|
|
||||||
LOCAL_PATH := ${MODULE_DIR}
|
LOCAL_PATH := ${MODULE_DIR}
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
ifeq (${ANDROID_OPTIM_NEON},true)
|
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
LOCAL_ARM_NEON := true
|
||||||
LOCAL_ARM_NEON := true
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (${ANDROID_OPTIM_ARM32},true)
|
LOCAL_CPP_EXTENSION := ${CPP_EXTENSION}
|
||||||
LOCAL_ARM_MODE := arm
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
LOCAL_LDLIBS := ${MODULE_LIBS}
|
||||||
|
|
||||||
LOCAL_CPP_EXTENSION := ${CPP_EXTENSION}
|
LOCAL_MODULE := ${MODULE_NAME}
|
||||||
|
|
||||||
LOCAL_LDLIBS := ${MODULE_LIBS_FLAGS}
|
LOCAL_SRC_FILES := ${MODULE_SOURCES}
|
||||||
|
|
||||||
LOCAL_MODULE := ${MODULE_NAME}
|
LOCAL_C_INCLUDES := ${MODULE_INCLUDES}
|
||||||
|
|
||||||
LOCAL_SRC_FILES := ${MODULE_SOURCES}
|
LOCAL_CFLAGS := ${MODULE_FLAGS_C}
|
||||||
|
|
||||||
LOCAL_C_INCLUDES := ${MODULE_INCLUDES}
|
LOCAL_CPPFLAGS := ${MODULE_FLAGS_CPP}
|
||||||
|
|
||||||
LOCAL_CFLAGS := ${MODULE_FLAGS_C}
|
|
||||||
|
|
||||||
LOCAL_CPPFLAGS := ${MODULE_FLAGS_CPP}
|
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := ${MODULE_LIBS_SHARED}
|
|
||||||
LOCAL_STATIC_LIBRARIES := ${MODULE_LIBS_STATIC}
|
|
||||||
|
|
||||||
|
#include $(BUILD_STATIC_LIBRARY)
|
||||||
include ${MODULE_BUILD_TYPE}
|
include ${MODULE_BUILD_TYPE}
|
||||||
|
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
package="com.openscenegraph"
|
package="com.openscenegraph"
|
||||||
android:versionCode="1"
|
android:versionCode="1"
|
||||||
android:versionName="1.0">
|
android:versionName="1.0">
|
||||||
<uses-sdk android:minSdkVersion="8" />
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
APP_BUILD_SCRIPT := $(call my-dir)/Android.mk
|
APP_BUILD_SCRIPT := $(call my-dir)/Android.mk
|
||||||
APP_PROJECT_PATH := $(call my-dir)
|
APP_PROJECT_PATH := $(call my-dir)
|
||||||
|
|
||||||
APP_OPTIM := ${ANDROID_RELEASE_OPTIM}
|
APP_OPTIM := release
|
||||||
|
|
||||||
APP_PLATFORM := android-${ANDROID_PLATFORM}
|
APP_PLATFORM := android-5
|
||||||
APP_STL := ${ANDROID_STL}
|
APP_STL := gnustl_static
|
||||||
APP_CPPFLAGS := -fexceptions -frtti
|
APP_CPPFLAGS := -fexceptions -frtti
|
||||||
#APP_CPPFLAGS := -Os -mthumb-interwork -fno-short-enums
|
#APP_CPPFLAGS := -Os -mthumb-interwork -fno-short-enums
|
||||||
#APP_CPPFLAGS := -Wl,--no-undefined
|
#APP_CPPFLAGS := -Wl,--no-undefined
|
||||||
|
|
||||||
APP_ABI := ${ANDROID_ABI}
|
APP_ABI := armeabi armeabi-v7a
|
||||||
|
|
||||||
APP_MODULES := $ENV{AND_OSG_LIB_NAMES}
|
APP_MODULES := $ENV{AND_OSG_LIB_NAMES}
|
||||||
|
|||||||
16
README.txt
16
README.txt
@@ -4,11 +4,15 @@ For up-to-date information on the project, in-depth details on how to
|
|||||||
compile and run libraries and examples, see the documentation on the
|
compile and run libraries and examples, see the documentation on the
|
||||||
OpenSceneGraph website:
|
OpenSceneGraph website:
|
||||||
|
|
||||||
http://www.openscenegraph.org/index.php/documentation
|
http://www.openscenegraph.org
|
||||||
|
|
||||||
For support subscribe to our public mailing list or forum, details at:
|
For support subscribe to our public mailing list:
|
||||||
|
|
||||||
http://www.openscenegraph.org/index.php/support
|
http://www.openscenegraph.org/projects/osg/wiki/MailingLists
|
||||||
|
|
||||||
|
or forum:
|
||||||
|
|
||||||
|
http://forum.openscenegraph.org/
|
||||||
|
|
||||||
For the impatient, we've included quick build instructions below, these
|
For the impatient, we've included quick build instructions below, these
|
||||||
are are broken down is three parts:
|
are are broken down is three parts:
|
||||||
@@ -23,7 +27,7 @@ more indepth instructions.
|
|||||||
|
|
||||||
Robert Osfield.
|
Robert Osfield.
|
||||||
Project Lead.
|
Project Lead.
|
||||||
12th August 2015.
|
31st July 2011.
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
@@ -70,7 +74,7 @@ Under Windows use the GUI tool CMakeSetup to build your VisualStudio
|
|||||||
files. The following page on our wiki dedicated to the CMake build
|
files. The following page on our wiki dedicated to the CMake build
|
||||||
system should help guide you through the process:
|
system should help guide you through the process:
|
||||||
|
|
||||||
http://www.openscenegraph.org/index.php/documentation/platform-specifics/windows
|
http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/VisualStudio
|
||||||
|
|
||||||
Under OSX you can either use the CMake build system above, or use the
|
Under OSX you can either use the CMake build system above, or use the
|
||||||
Xcode projects that you will find in the OpenSceneGraph/Xcode
|
Xcode projects that you will find in the OpenSceneGraph/Xcode
|
||||||
@@ -79,7 +83,7 @@ directory. See release notes on OSX CMake build below.
|
|||||||
For further details on compilation, installation and platform-specific
|
For further details on compilation, installation and platform-specific
|
||||||
information read "Getting Started" guide:
|
information read "Getting Started" guide:
|
||||||
|
|
||||||
http://www.openscenegraph.org/index.php/documentation/10-getting-started
|
http://www.openscenegraph.org/projects/osg/wiki/Support/GettingStarted
|
||||||
|
|
||||||
|
|
||||||
Section 2. Release notes on OSX build, by Eric Sokolowsky, August 5, 2008
|
Section 2. Release notes on OSX build, by Eric Sokolowsky, August 5, 2008
|
||||||
|
|||||||
@@ -139,15 +139,7 @@ int main( int argc, char **argv )
|
|||||||
if (obj.valid())
|
if (obj.valid())
|
||||||
{
|
{
|
||||||
std::cout<<" write to archive "<<*itr<<std::endl;
|
std::cout<<" write to archive "<<*itr<<std::endl;
|
||||||
osg::Image* image = dynamic_cast<osg::Image*>(obj.get());
|
archive->writeObject(*obj, *itr);
|
||||||
osg::HeightField* hf = dynamic_cast<osg::HeightField*>(obj.get());
|
|
||||||
osg::Node* node = dynamic_cast<osg::Node*>(obj.get());
|
|
||||||
osg::Shader* shader = dynamic_cast<osg::Shader*>(obj.get());
|
|
||||||
if (image) archive->writeImage(*image, *itr);
|
|
||||||
else if (hf) archive->writeHeightField(*hf, *itr);
|
|
||||||
else if (node) archive->writeNode(*node, *itr);
|
|
||||||
else if (shader) archive->writeShader(*shader, *itr);
|
|
||||||
else archive->writeObject(*obj, *itr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,8 @@ public:
|
|||||||
{
|
{
|
||||||
osg::ref_ptr< osg::Vec3Array > newnormals = new osg::Vec3Array;
|
osg::ref_ptr< osg::Vec3Array > newnormals = new osg::Vec3Array;
|
||||||
newnormals->push_back( osg::Z_AXIS );
|
newnormals->push_back( osg::Z_AXIS );
|
||||||
geometry->setNormalArray( newnormals.get(), osg::Array::BIND_OVERALL );
|
geometry->setNormalArray( newnormals.get() );
|
||||||
|
geometry->setNormalBinding( osg::Geometry::BIND_OVERALL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -407,7 +408,8 @@ public:
|
|||||||
{
|
{
|
||||||
osg::Vec4Array* colours = new osg::Vec4Array(1);
|
osg::Vec4Array* colours = new osg::Vec4Array(1);
|
||||||
(*colours)[0].set(1.0f,1.0f,1.0f,1.0f);
|
(*colours)[0].set(1.0f,1.0f,1.0f,1.0f);
|
||||||
geometry->setColorArray(colours, osg::Array::BIND_OVERALL);
|
geometry->setColorArray(colours);
|
||||||
|
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -557,7 +559,6 @@ int main( int argc, char **argv )
|
|||||||
// if user request help write it out to cout.
|
// if user request help write it out to cout.
|
||||||
if (arguments.read("-h") || arguments.read("--help"))
|
if (arguments.read("-h") || arguments.read("--help"))
|
||||||
{
|
{
|
||||||
osg::setNotifyLevel(osg::NOTICE);
|
|
||||||
usage( arguments.getApplicationName().c_str(), 0 );
|
usage( arguments.getApplicationName().c_str(), 0 );
|
||||||
//arguments.getApplicationUsage()->write(std::cout);
|
//arguments.getApplicationUsage()->write(std::cout);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -130,6 +130,40 @@ struct Extents
|
|||||||
osg::Vec2d _max;
|
osg::Vec2d _max;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CheckValidVisitor : public osg::NodeVisitor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
CheckValidVisitor():
|
||||||
|
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
|
||||||
|
_numInvalidGeometries(0) {}
|
||||||
|
|
||||||
|
void apply(osg::Geode& geode)
|
||||||
|
{
|
||||||
|
unsigned int local_numInvalidGeometries = 0;
|
||||||
|
for(unsigned int i=0; i<geode.getNumDrawables(); ++i)
|
||||||
|
{
|
||||||
|
osg::Geometry* geometry = dynamic_cast<osg::Geometry*>(geode.getDrawable(i));
|
||||||
|
if (geometry)
|
||||||
|
{
|
||||||
|
if (!geometry->verifyArrays(_errorReports)) ++local_numInvalidGeometries;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (local_numInvalidGeometries)
|
||||||
|
{
|
||||||
|
_errorReports<<"Geode "<<geode.getName()<<" contains problem geometries"<<std::endl;
|
||||||
|
_numInvalidGeometries += local_numInvalidGeometries;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool valid() const { return _numInvalidGeometries==0; }
|
||||||
|
|
||||||
|
unsigned int _numInvalidGeometries;
|
||||||
|
std::stringstream _errorReports;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class LoadDataVisitor : public osg::NodeVisitor
|
class LoadDataVisitor : public osg::NodeVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -275,7 +309,7 @@ public:
|
|||||||
osg::Node* readNodeFileAndWriteToCache(const std::string& filename)
|
osg::Node* readNodeFileAndWriteToCache(const std::string& filename)
|
||||||
{
|
{
|
||||||
osg::Node* node = 0;
|
osg::Node* node = 0;
|
||||||
if (_fileCache.valid() )
|
if (_fileCache.valid() && osgDB::containsServerAddress(filename))
|
||||||
{
|
{
|
||||||
if (_fileCache->existsInCache(filename))
|
if (_fileCache->existsInCache(filename))
|
||||||
{
|
{
|
||||||
@@ -300,6 +334,17 @@ public:
|
|||||||
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
|
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
|
||||||
node = osgDB::readNodeFile(filename);
|
node = osgDB::readNodeFile(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node)
|
||||||
|
{
|
||||||
|
CheckValidVisitor cvv;
|
||||||
|
node->accept(cvv);
|
||||||
|
if (!cvv.valid())
|
||||||
|
{
|
||||||
|
OSG_NOTICE<<"Warning, errors in geometry found in file "<<filename<<std::endl;
|
||||||
|
OSG_NOTICE<<cvv._errorReports.str()<<std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ const char* invalidNames[] =
|
|||||||
"LineStipple",
|
"LineStipple",
|
||||||
"Logos",
|
"Logos",
|
||||||
"LongIDRecord",
|
"LongIDRecord",
|
||||||
"InputIterator",
|
|
||||||
"Make",
|
"Make",
|
||||||
"Makefile",
|
"Makefile",
|
||||||
"Material",
|
"Material",
|
||||||
@@ -248,20 +247,7 @@ const char* invalidNames[] =
|
|||||||
"UpdateSkeleton",
|
"UpdateSkeleton",
|
||||||
"Vec3",
|
"Vec3",
|
||||||
"Plugin",
|
"Plugin",
|
||||||
"Get",
|
"Get"
|
||||||
"LightSource",
|
|
||||||
"SlideEventHandler",
|
|
||||||
"GraphicsContext*",
|
|
||||||
"Apple",
|
|
||||||
"GeometryNew",
|
|
||||||
"FrameBufferObject",
|
|
||||||
"Lua",
|
|
||||||
"VolumeTile",
|
|
||||||
"PushStackValueVisitor",
|
|
||||||
"RayIntersector",
|
|
||||||
"OpenSceneGraph-Data",
|
|
||||||
"Node",
|
|
||||||
"AlphaFunc"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -273,7 +259,6 @@ struct TypoCorrection
|
|||||||
|
|
||||||
TypoCorrection typoCorrections[] =
|
TypoCorrection typoCorrections[] =
|
||||||
{
|
{
|
||||||
{"Cheaev", "Chebaev"},
|
|
||||||
{"Alaxandre", "Alexandre"},
|
{"Alaxandre", "Alexandre"},
|
||||||
{"Aderian", "Adrian"},
|
{"Aderian", "Adrian"},
|
||||||
{"Adndre", "Andre"},
|
{"Adndre", "Andre"},
|
||||||
@@ -283,7 +268,6 @@ TypoCorrection typoCorrections[] =
|
|||||||
{"André", "Andr<EFBFBD>"},
|
{"André", "Andr<EFBFBD>"},
|
||||||
{"Antione", "Antoine"},
|
{"Antione", "Antoine"},
|
||||||
{"Antonoine", "Antoine"},
|
{"Antonoine", "Antoine"},
|
||||||
{"Aurelein", "Aurelien"},
|
|
||||||
{"Atr", "Art"},
|
{"Atr", "Art"},
|
||||||
{"Baverage", "Beverage"},
|
{"Baverage", "Beverage"},
|
||||||
{"Bistroviae", "Bistrovic"},
|
{"Bistroviae", "Bistrovic"},
|
||||||
@@ -302,7 +286,6 @@ TypoCorrection typoCorrections[] =
|
|||||||
{"Fabian", "Fabien"},
|
{"Fabian", "Fabien"},
|
||||||
{"Fautre", "Fautr<EFBFBD>"},
|
{"Fautre", "Fautr<EFBFBD>"},
|
||||||
{"Frashid", "Farshid"},
|
{"Frashid", "Farshid"},
|
||||||
{"Farshild", "Farshid"},
|
|
||||||
{"Fred", "Frederic"},
|
{"Fred", "Frederic"},
|
||||||
{"Fredrick", "Frederic"},
|
{"Fredrick", "Frederic"},
|
||||||
{"Fredric", "Frederic"},
|
{"Fredric", "Frederic"},
|
||||||
@@ -328,8 +311,6 @@ TypoCorrection typoCorrections[] =
|
|||||||
{"Happalahti", "Haapalahti"},
|
{"Happalahti", "Haapalahti"},
|
||||||
{"Hertlien", "Hertlein"},
|
{"Hertlien", "Hertlein"},
|
||||||
{"Hatwig", "Hartwig"},
|
{"Hatwig", "Hartwig"},
|
||||||
{"Hauknes", "Haukness"},
|
|
||||||
{"Hunber", "Huber"},
|
|
||||||
{"Hi", "He"},
|
{"Hi", "He"},
|
||||||
{"Hooper", "Hopper"},
|
{"Hooper", "Hopper"},
|
||||||
{"Inverson", "Iverson"},
|
{"Inverson", "Iverson"},
|
||||||
@@ -354,7 +335,6 @@ TypoCorrection typoCorrections[] =
|
|||||||
{"Krulthof", "Kruithof"},
|
{"Krulthof", "Kruithof"},
|
||||||
{"Lagrade", "Lagarde"},
|
{"Lagrade", "Lagarde"},
|
||||||
{"Largade", "Lagarde"},
|
{"Largade", "Lagarde"},
|
||||||
{"Largarde", "Lagarde"},
|
|
||||||
{"Larshkari", "Lashkari"},
|
{"Larshkari", "Lashkari"},
|
||||||
{"Lashakari", "Lashkari"},
|
{"Lashakari", "Lashkari"},
|
||||||
{"Lashari", "Lashkari"},
|
{"Lashari", "Lashkari"},
|
||||||
@@ -400,7 +380,6 @@ TypoCorrection typoCorrections[] =
|
|||||||
{"Oritz", "Ortiz"},
|
{"Oritz", "Ortiz"},
|
||||||
{"Osfeld", "Osfield"},
|
{"Osfeld", "Osfield"},
|
||||||
{"Osfied", "Osfield"},
|
{"Osfied", "Osfield"},
|
||||||
{"Paulk", "Paul"},
|
|
||||||
{"Pail", "Paul"},
|
{"Pail", "Paul"},
|
||||||
{"Perciva", "Peciva"},
|
{"Perciva", "Peciva"},
|
||||||
{"Pecvia", "Peciva"},
|
{"Pecvia", "Peciva"},
|
||||||
@@ -461,30 +440,7 @@ TypoCorrection typoCorrections[] =
|
|||||||
{"Jahannes","Johannes"},
|
{"Jahannes","Johannes"},
|
||||||
{"Eskland","Ekstrand"},
|
{"Eskland","Ekstrand"},
|
||||||
{"Baeuerele","Baeuerle"},
|
{"Baeuerele","Baeuerle"},
|
||||||
{"Bauerle","Baeuerle"},
|
{"Bauerle","Baeuerle"}
|
||||||
{"Baeurele","Baeuerle"},
|
|
||||||
{"Nillson","Nilsson"},
|
|
||||||
{"Bjorn","Bj<EFBFBD>rn"},
|
|
||||||
{"Björn","Bj<EFBFBD>rn"},
|
|
||||||
{"Stepan","Stephan"},
|
|
||||||
{"Kristoger","Kristofer"},
|
|
||||||
{"Blessing","Blissing"},
|
|
||||||
{"Dannahuer","Dannhauer"},
|
|
||||||
{"Chebeav", "Chebaev"},
|
|
||||||
{"Messershmidt","Messerschmidt"},
|
|
||||||
{"Auelien","Aurelien"},
|
|
||||||
{"Aurélien","Aur<EFBFBD>lien"},
|
|
||||||
{"McDonnel","Mc Donnell"},
|
|
||||||
{"McDonnell","Mc Donnell"},
|
|
||||||
{"Delallée","Delall<EFBFBD>e"},
|
|
||||||
{"Gjøl","Gj<EFBFBD>l"},
|
|
||||||
{"Ravšelj","Rav<EFBFBD>elj"},
|
|
||||||
{"Ravsel", "Rav<EFBFBD>elj"},
|
|
||||||
{"Ravselj", "Rav<EFBFBD>elj"},
|
|
||||||
{"Janik", "Jannik"},
|
|
||||||
{"Viganò", "Vigan<EFBFBD>"},
|
|
||||||
{"Vigano", "Vigan<EFBFBD>"},
|
|
||||||
{"Frashud", "Farshid"}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -498,28 +454,18 @@ struct NameCorrection
|
|||||||
|
|
||||||
NameCorrection nameCorrections[] =
|
NameCorrection nameCorrections[] =
|
||||||
{
|
{
|
||||||
{"FrancoisTigeot","",
|
|
||||||
"Francois", "Tigeot"},
|
|
||||||
{"Juan","Manuel",
|
|
||||||
"Juan", "Manuel Alvarez"},
|
|
||||||
{"Jaap","Gas",
|
|
||||||
"Jaap", "Glas"},
|
|
||||||
{"Philip","Lamp",
|
{"Philip","Lamp",
|
||||||
"Philip", "Lamb"},
|
"Philip", "Lamb"},
|
||||||
{"Dimi","Christop",
|
{"Dimi","Christop",
|
||||||
"Dimi", "Christopoulos"},
|
"Dimi", "Christopoulos"},
|
||||||
{"Jorge","Ciges",
|
{"Jorge","Ciges",
|
||||||
"Jorge", "Izquierdo Ciges"},
|
"Jorge", "Izquierdo"},
|
||||||
{"Jorge","Izquierdo",
|
|
||||||
"Jorge", "Izquierdo Ciges"},
|
|
||||||
{"Rafa","Gata",
|
{"Rafa","Gata",
|
||||||
"Rafa", "Gaitan"},
|
"Rafa", "Gaitan"},
|
||||||
{"Sukender","I",
|
{"Sukender","I",
|
||||||
"Sukender", ""},
|
"Sukender", ""},
|
||||||
{"Sukender","Here",
|
{"Sukender","Here",
|
||||||
"Sukender", ""},
|
"Sukender", ""},
|
||||||
{"Sukender","Fix",
|
|
||||||
"Sukender", ""},
|
|
||||||
{"Ewe","Woessner",
|
{"Ewe","Woessner",
|
||||||
"Uwe", "Woessner"},
|
"Uwe", "Woessner"},
|
||||||
{"Martin","von",
|
{"Martin","von",
|
||||||
@@ -534,8 +480,6 @@ NameCorrection nameCorrections[] =
|
|||||||
"Thomas", "Hogarth"},
|
"Thomas", "Hogarth"},
|
||||||
{"Marin", "Lavery",
|
{"Marin", "Lavery",
|
||||||
"Martin", "Lavery"},
|
"Martin", "Lavery"},
|
||||||
{"Michael", "Bach",
|
|
||||||
"Michael", "Bach Jensen"},
|
|
||||||
{"Nguyen", "Van",
|
{"Nguyen", "Van",
|
||||||
"Nguyen", "Van Truong"},
|
"Nguyen", "Van Truong"},
|
||||||
{"Thom", "Carlo",
|
{"Thom", "Carlo",
|
||||||
@@ -592,8 +536,6 @@ NameCorrection nameCorrections[] =
|
|||||||
"Melchior", "Franz"},
|
"Melchior", "Franz"},
|
||||||
{"Glen", "Waldon",
|
{"Glen", "Waldon",
|
||||||
"Glenn", "Waldron"},
|
"Glenn", "Waldron"},
|
||||||
{"Glen", "Waldron",
|
|
||||||
"Glenn", "Waldron"},
|
|
||||||
{"Ralf", "Karn",
|
{"Ralf", "Karn",
|
||||||
"Ralf", "Kern"},
|
"Ralf", "Kern"},
|
||||||
{"Donny", "Cipperly",
|
{"Donny", "Cipperly",
|
||||||
@@ -626,12 +568,8 @@ NameCorrection nameCorrections[] =
|
|||||||
"Romano", "Jos<EFBFBD> Magacho da Silva"},
|
"Romano", "Jos<EFBFBD> Magacho da Silva"},
|
||||||
{"Rommano", "Silva",
|
{"Rommano", "Silva",
|
||||||
"Romano", "Jos<EFBFBD> Magacho da Silva"},
|
"Romano", "Jos<EFBFBD> Magacho da Silva"},
|
||||||
{"Romano", "Magacho",
|
|
||||||
"Romano", "Jos<EFBFBD> Magacho da Silva"},
|
|
||||||
{"Leandro", "Motta",
|
{"Leandro", "Motta",
|
||||||
"Leandro", "Motta Barros"},
|
"Leandro", "Motta Barros"},
|
||||||
{"Leandro", "Motto",
|
|
||||||
"Leandro", "Motta Barros"},
|
|
||||||
{"A", "Botorabi",
|
{"A", "Botorabi",
|
||||||
"Ali", "Botorabi"},
|
"Ali", "Botorabi"},
|
||||||
{"Waltice", "",
|
{"Waltice", "",
|
||||||
@@ -648,32 +586,10 @@ NameCorrection nameCorrections[] =
|
|||||||
"Luc", "Frauciel"},
|
"Luc", "Frauciel"},
|
||||||
{"Alberto", "Lucas",
|
{"Alberto", "Lucas",
|
||||||
"Alberto", "Luaces"},
|
"Alberto", "Luaces"},
|
||||||
{"Alberto", "Luacus",
|
|
||||||
"Alberto", "Luaces"},
|
|
||||||
{"Tyge", "",
|
{"Tyge", "",
|
||||||
"Tyge", "L<EFBFBD>vset"},
|
"Tyge", "L<EFBFBD>vset"},
|
||||||
{"Ricard", "Schmidt",
|
{"Ricard", "Schmidt",
|
||||||
"Richard", "Schmidt"},
|
"Richard", "Schmidt"}
|
||||||
{"Matthias", "Helsing",
|
|
||||||
"Mattias", "Helsing"},
|
|
||||||
{"Clement", "Boesch",
|
|
||||||
"Cl<EFBFBD>ment", "B<EFBFBD>sch"},
|
|
||||||
{"Lauren", "Voerman",
|
|
||||||
"Laurens", "Voerman"},
|
|
||||||
{"Pjotr", "Sventachov",
|
|
||||||
"Pjotr", "Svetachov"},
|
|
||||||
{"Bradley", "Baker",
|
|
||||||
"Bradley", "Baker Searles"},
|
|
||||||
{"PawelKsiezopolski", "",
|
|
||||||
"Pawel", "Ksiezopolski"},
|
|
||||||
{"Albert", "Luaces",
|
|
||||||
"Alberto","Luaces"},
|
|
||||||
{"KOS", "",
|
|
||||||
"Konstantin","Matveyev"},
|
|
||||||
{"WeSee", "",
|
|
||||||
"Alois", "Wismer"},
|
|
||||||
{"We", "See",
|
|
||||||
"Alois", "Wismer"}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1005,9 +921,7 @@ void printContributors(const std::string& changeLog, bool printNumEntries)
|
|||||||
cout << "-------------------------" << endl;
|
cout << "-------------------------" << endl;
|
||||||
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
|
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
|
||||||
{
|
{
|
||||||
cout << sitr->first << "\t" << sitr->second.first;
|
cout << sitr->first << "\t" << sitr->second.first << " " << sitr->second.second << endl;
|
||||||
if (!sitr->second.second.empty()) cout << " " << sitr->second.second;
|
|
||||||
cout << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1016,9 +930,7 @@ void printContributors(const std::string& changeLog, bool printNumEntries)
|
|||||||
cout << "-----------------" << endl;
|
cout << "-----------------" << endl;
|
||||||
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
|
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
|
||||||
{
|
{
|
||||||
cout << sitr->second.first;
|
cout << sitr->second.first << " " << sitr->second.second << endl;
|
||||||
if (!sitr->second.second.empty()) cout << " " << sitr->second.second;
|
|
||||||
cout << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,116 +28,7 @@
|
|||||||
#include <osgGA/TerrainManipulator>
|
#include <osgGA/TerrainManipulator>
|
||||||
#include <osgGA/SphericalManipulator>
|
#include <osgGA/SphericalManipulator>
|
||||||
|
|
||||||
#include <osgGA/Device>
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <osg/GLExtensions>
|
|
||||||
|
|
||||||
#ifndef GL_ARB_sync
|
|
||||||
#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
|
|
||||||
#define GL_OBJECT_TYPE 0x9112
|
|
||||||
#define GL_SYNC_CONDITION 0x9113
|
|
||||||
#define GL_SYNC_STATUS 0x9114
|
|
||||||
#define GL_SYNC_FLAGS 0x9115
|
|
||||||
#define GL_SYNC_FENCE 0x9116
|
|
||||||
#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
|
|
||||||
#define GL_UNSIGNALED 0x9118
|
|
||||||
#define GL_SIGNALED 0x9119
|
|
||||||
#define GL_ALREADY_SIGNALED 0x911A
|
|
||||||
#define GL_TIMEOUT_EXPIRED 0x911B
|
|
||||||
#define GL_CONDITION_SATISFIED 0x911C
|
|
||||||
#define GL_WAIT_FAILED 0x911D
|
|
||||||
#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
|
|
||||||
#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class MySwapBuffersCallback : public osg::GraphicsContext::SwapCallback
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MySwapBuffersCallback():
|
|
||||||
_extensionInitialized(false),
|
|
||||||
_glFenceSync(0),
|
|
||||||
_glIsSync(0),
|
|
||||||
_glDeleteSync(0),
|
|
||||||
_glClientWaitSync(0),
|
|
||||||
_glWaitSync(0),
|
|
||||||
_glGetInteger64v(0),
|
|
||||||
_glGetSynciv(0),
|
|
||||||
_previousSync(0)
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"Created Swap callback."<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setUpExtensions()
|
|
||||||
{
|
|
||||||
_extensionInitialized = true;
|
|
||||||
osg::setGLExtensionFuncPtr(_glFenceSync, "glFenceSync");
|
|
||||||
osg::setGLExtensionFuncPtr(_glIsSync, "glIsSync");
|
|
||||||
osg::setGLExtensionFuncPtr(_glDeleteSync, "glDeleteSync");
|
|
||||||
osg::setGLExtensionFuncPtr(_glClientWaitSync, "glClientWaitSync");
|
|
||||||
osg::setGLExtensionFuncPtr(_glWaitSync, "glWaitSync");
|
|
||||||
osg::setGLExtensionFuncPtr(_glGetInteger64v, "glGetInteger64v");
|
|
||||||
osg::setGLExtensionFuncPtr(_glGetSynciv, "glGetSynciv");
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void swapBuffersImplementation(osg::GraphicsContext* gc)
|
|
||||||
{
|
|
||||||
// OSG_NOTICE<<"Before swap - place to do swap ready sync"<<std::endl;
|
|
||||||
gc->swapBuffersImplementation();
|
|
||||||
//glFinish();
|
|
||||||
|
|
||||||
if (!_extensionInitialized) setUpExtensions();
|
|
||||||
|
|
||||||
if (_glClientWaitSync)
|
|
||||||
{
|
|
||||||
if (_previousSync)
|
|
||||||
{
|
|
||||||
unsigned int num_seconds = 1;
|
|
||||||
GLuint64 timeout = num_seconds * ((GLuint64)1000 * 1000 * 1000);
|
|
||||||
_glClientWaitSync(_previousSync, 0, timeout);
|
|
||||||
|
|
||||||
_glDeleteSync(_previousSync);
|
|
||||||
}
|
|
||||||
|
|
||||||
_previousSync = _glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
|
||||||
}
|
|
||||||
//gc->getState()->checkGLErrors("after glWaitSync");
|
|
||||||
|
|
||||||
//OSG_NOTICE<<"After swap"<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
typedef __int64 GLint64;
|
|
||||||
typedef unsigned __int64 GLuint64;
|
|
||||||
#else
|
|
||||||
typedef int64_t GLint64;
|
|
||||||
typedef uint64_t GLuint64;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct __GLsync *GLsync;
|
|
||||||
|
|
||||||
typedef GLsync (GL_APIENTRY * PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
|
|
||||||
typedef GLboolean (GL_APIENTRY * PFNGLISSYNCPROC) (GLsync sync);
|
|
||||||
typedef void (GL_APIENTRY * PFNGLDELETESYNCPROC) (GLsync sync);
|
|
||||||
typedef GLenum (GL_APIENTRY * PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
|
|
||||||
typedef void (GL_APIENTRY * PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
|
|
||||||
typedef void (GL_APIENTRY * PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params);
|
|
||||||
typedef void (GL_APIENTRY * PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
|
|
||||||
|
|
||||||
bool _extensionInitialized;
|
|
||||||
|
|
||||||
PFNGLFENCESYNCPROC _glFenceSync;
|
|
||||||
PFNGLISSYNCPROC _glIsSync;
|
|
||||||
PFNGLDELETESYNCPROC _glDeleteSync;
|
|
||||||
PFNGLCLIENTWAITSYNCPROC _glClientWaitSync;
|
|
||||||
PFNGLWAITSYNCPROC _glWaitSync;
|
|
||||||
PFNGLGETINTEGER64VPROC _glGetInteger64v;
|
|
||||||
PFNGLGETSYNCIVPROC _glGetSynciv;
|
|
||||||
|
|
||||||
GLsync _previousSync;
|
|
||||||
};
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
@@ -150,9 +41,6 @@ int main(int argc, char** argv)
|
|||||||
arguments.getApplicationUsage()->addCommandLineOption("--image <filename>","Load an image and render it on a quad");
|
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("--dem <filename>","Load an image/DEM and render it on a HeightField");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--login <url> <username> <password>","Provide authentication information for http file access.");
|
arguments.getApplicationUsage()->addCommandLineOption("--login <url> <username> <password>","Provide authentication information for http file access.");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-p <filename>","Play specified camera path animation file, previously saved with 'z' key.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--speed <factor>","Speed factor for animation playing (1 == normal speed).");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--device <device-name>","add named device to the viewer");
|
|
||||||
|
|
||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
@@ -189,16 +77,6 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string device;
|
|
||||||
while(arguments.read("--device", device))
|
|
||||||
{
|
|
||||||
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device);
|
|
||||||
if (dev.valid())
|
|
||||||
{
|
|
||||||
viewer.addDevice(dev.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up the camera manipulators.
|
// set up the camera manipulators.
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
|
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
|
||||||
@@ -232,8 +110,6 @@ int main(int argc, char** argv)
|
|||||||
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool doArbSync = arguments.read("--sync");
|
|
||||||
|
|
||||||
// add the state manipulator
|
// add the state manipulator
|
||||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||||
|
|
||||||
@@ -285,18 +161,6 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
viewer.realize();
|
viewer.realize();
|
||||||
|
|
||||||
if (doArbSync)
|
|
||||||
{
|
|
||||||
osgViewer::ViewerBase::Contexts contexts;
|
|
||||||
viewer.getContexts(contexts);
|
|
||||||
for(osgViewer::ViewerBase::Contexts::iterator itr = contexts.begin();
|
|
||||||
itr != contexts.end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
(*itr)->setSwapCallback(new MySwapBuffersCallback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return viewer.run();
|
return viewer.run();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#if defined(__linux)
|
#if defined(__linux)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <linux/sockios.h>
|
#include <linux/sockios.h>
|
||||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
#elif defined(__FreeBSD__)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
#elif defined(__sgi)
|
#elif defined(__sgi)
|
||||||
@@ -336,8 +336,7 @@ void Receiver::sync( void )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \
|
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ )
|
||||||
defined(__DragonFly__)
|
|
||||||
socklen_t
|
socklen_t
|
||||||
#else
|
#else
|
||||||
int
|
int
|
||||||
|
|||||||
@@ -305,14 +305,14 @@ class DataConverter
|
|||||||
inline void writeFloat(float c) { write4((char*)&c); }
|
inline void writeFloat(float c) { write4((char*)&c); }
|
||||||
inline void writeDouble(double c) { write8((char*)&c); }
|
inline void writeDouble(double c) { write8((char*)&c); }
|
||||||
|
|
||||||
inline char readChar() { char c=0; read1(&c); return c; }
|
inline char readChar() { char c; read1(&c); return c; }
|
||||||
inline unsigned char readUChar() { unsigned char c=0; read1((char*)&c); return c; }
|
inline unsigned char readUChar() { unsigned char c; read1((char*)&c); return c; }
|
||||||
inline short readShort() { short c=0; read2((char*)&c); return c; }
|
inline short readShort() { short c; read2((char*)&c); return c; }
|
||||||
inline unsigned short readUShort() { unsigned short c=0; read2((char*)&c); return c; }
|
inline unsigned short readUShort() { unsigned short c; read2((char*)&c); return c; }
|
||||||
inline int readInt() { int c=0; read4((char*)&c); return c; }
|
inline int readInt() { int c; read4((char*)&c); return c; }
|
||||||
inline unsigned int readUInt() { unsigned int c=0; read4((char*)&c); return c; }
|
inline unsigned int readUInt() { unsigned int c; read4((char*)&c); return c; }
|
||||||
inline float readFloat() { float c=0.0f; read4((char*)&c); return c; }
|
inline float readFloat() { float c; read4((char*)&c); return c; }
|
||||||
inline double readDouble() { double c=0.0; read8((char*)&c); return c; }
|
inline double readDouble() { double c; read8((char*)&c); return c; }
|
||||||
|
|
||||||
void write(const osg::FrameStamp& fs);
|
void write(const osg::FrameStamp& fs);
|
||||||
void read(osg::FrameStamp& fs);
|
void read(osg::FrameStamp& fs);
|
||||||
|
|||||||
@@ -251,12 +251,8 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
|
|||||||
|
|
||||||
if(node)
|
if(node)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (node->getName().empty()) node->setName( arguments[pos] );
|
if (node->getName().empty()) node->setName( arguments[pos] );
|
||||||
nodeList.push_back(node);
|
nodeList.push_back(node);
|
||||||
|
|
||||||
// make sure that this presentation isn't cached
|
|
||||||
osgDB::Registry::instance()->removeFromObjectCache( arguments[pos] );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include <OpenThreads/Thread>
|
#include <OpenThreads/Thread>
|
||||||
|
|
||||||
#include <osgGA/GUIEventHandler>
|
|
||||||
#include <osgGA/TrackballManipulator>
|
#include <osgGA/TrackballManipulator>
|
||||||
#include <osgGA/FlightManipulator>
|
#include <osgGA/FlightManipulator>
|
||||||
#include <osgGA/DriveManipulator>
|
#include <osgGA/DriveManipulator>
|
||||||
@@ -128,64 +127,89 @@ void setViewer(osgViewer::Viewer& viewer, float width, float height, float dista
|
|||||||
// double hfov = osg::RadiansToDegrees(atan2(width/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);
|
viewer.getCamera()->setProjectionMatrixAsPerspective( vfov, width/height, 0.1, 1000.0);
|
||||||
|
|
||||||
OSG_NOTICE<<"setProjectionMatrixAsPerspective( "<<vfov<<", "<<width/height<<", "<<0.1<<", "<<1000.0<<");"<<std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ForwardToDeviceEventHandler : public osgGA::GUIEventHandler {
|
#if 1
|
||||||
public:
|
|
||||||
ForwardToDeviceEventHandler(osgGA::Device* device) : osgGA::GUIEventHandler(), _device(device) {}
|
|
||||||
|
|
||||||
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *)
|
class RayFollowsMouseCallback : public osg::Drawable::EventCallback
|
||||||
|
{
|
||||||
|
RayFollowsMouseCallback() {}
|
||||||
|
|
||||||
|
/** do customized Event code. */
|
||||||
|
virtual void event(osg::NodeVisitor* nv, osg::Drawable* drawable)
|
||||||
{
|
{
|
||||||
OSG_INFO<<"ForwardToDeviceEventHandler::setEvent("<<ea.getKey()<<")"<<std::endl;
|
osg::Geometry* geometry = drawable->asGeometry();
|
||||||
_device->sendEvent(ea);
|
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
|
||||||
return false;
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
void handle(const osg::Matrix& inverse_VP, osgGA::GUIEventAdapter& ea, osg::Vec3Array* vertices)
|
||||||
osg::ref_ptr<osgGA::Device> _device;
|
{
|
||||||
};
|
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
|
class FollowMouseCallback: public osgGA::GUIEventHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FollowMouseCallback():
|
|
||||||
_mousePostition(0.5,0.5) {}
|
|
||||||
|
|
||||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv)
|
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv)
|
||||||
{
|
{
|
||||||
osg::AutoTransform* transform = dynamic_cast<osg::AutoTransform*>(object);
|
osg::AutoTransform* transform = dynamic_cast<osg::AutoTransform*>(object);
|
||||||
if (!transform) return false;
|
if (!transform) return false;
|
||||||
|
|
||||||
osg::NotifySeverity level = osg::INFO;
|
|
||||||
|
|
||||||
switch(ea.getEventType())
|
switch(ea.getEventType())
|
||||||
{
|
{
|
||||||
case(osgGA::GUIEventAdapter::PUSH):
|
|
||||||
case(osgGA::GUIEventAdapter::RELEASE):
|
|
||||||
case(osgGA::GUIEventAdapter::MOVE):
|
|
||||||
case(osgGA::GUIEventAdapter::DRAG):
|
|
||||||
|
|
||||||
osg::notify(level)<<std::endl<<"ea.getGraphicsContext()="<<ea.getGraphicsContext()<<std::endl;
|
|
||||||
osg::notify(level)<<"ea.getWindowWidth()="<<ea.getWindowWidth()<<std::endl;
|
|
||||||
osg::notify(level)<<"ea.getWindowHeight()="<<ea.getWindowHeight()<<std::endl;
|
|
||||||
osg::notify(level)<<"ea.getX()="<<ea.getX()<<std::endl;
|
|
||||||
osg::notify(level)<<"ea.getXin()="<<ea.getXmin()<<std::endl;
|
|
||||||
osg::notify(level)<<"ea.getXmax()="<<ea.getXmax()<<std::endl;
|
|
||||||
osg::notify(level)<<"ea.getY()="<<ea.getY()<<std::endl;
|
|
||||||
osg::notify(level)<<"ea.getYin()="<<ea.getYmin()<<std::endl;
|
|
||||||
osg::notify(level)<<"ea.getYmax()="<<ea.getYmax()<<std::endl;
|
|
||||||
|
|
||||||
_mousePostition.set(ea.getXnormalized(), ea.getYnormalized());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case(osgGA::GUIEventAdapter::FRAME):
|
case(osgGA::GUIEventAdapter::FRAME):
|
||||||
|
//case(osgGA::GUIEventAdapter::MOVE):
|
||||||
|
//case(osgGA::GUIEventAdapter::DRAG):
|
||||||
{
|
{
|
||||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
|
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::Camera* camera = view->getCamera();
|
||||||
osg::Matrix VP = camera->getViewMatrix() * camera->getProjectionMatrix();
|
osg::Matrix VP = camera->getViewMatrix() * camera->getProjectionMatrix();
|
||||||
@@ -193,20 +217,18 @@ class FollowMouseCallback: public osgGA::GUIEventHandler
|
|||||||
osg::Matrix inverse_VP;
|
osg::Matrix inverse_VP;
|
||||||
inverse_VP.invert(VP);
|
inverse_VP.invert(VP);
|
||||||
|
|
||||||
osg::Vec3d start_eye(_mousePostition.x(), _mousePostition.y(), 0.0);
|
osg::Vec3d start_eye(ea.getXnormalized(), ea.getYnormalized(), 0.0);
|
||||||
osg::Vec3d end_eye(_mousePostition.x(), _mousePostition.y(), 1.0);
|
osg::Vec3d end_eye(ea.getXnormalized(), ea.getYnormalized(), 1.0);
|
||||||
|
|
||||||
osg::Vec3d start_world = start_eye * inverse_VP;
|
osg::Vec3d start_world = start_eye * inverse_VP;
|
||||||
osg::Vec3d end_world = start_eye * inverse_VP;
|
osg::Vec3d end_world = start_eye * inverse_VP;
|
||||||
|
|
||||||
osg::notify(level)<<"start_world="<<start_world<<std::endl;
|
osg::notify(osg::NOTICE)<<"start_world="<<start_world<<std::endl;
|
||||||
osg::notify(level)<<"end_world="<<end_world<<std::endl;
|
osg::notify(osg::NOTICE)<<"end_world="<<end_world<<std::endl;
|
||||||
|
|
||||||
if (end_world.valid()) transform->setPosition(end_world);
|
transform->setPosition(end_world);
|
||||||
else
|
|
||||||
{
|
transform->setNodeMask(0xffffffff);
|
||||||
OSG_NOTICE<<"Ignoring invalid end_world position"<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -236,7 +258,6 @@ class FollowMouseCallback: public osgGA::GUIEventHandler
|
|||||||
v.visit(*this);
|
v.visit(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Vec2d _mousePostition;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
osg::Node* createCursorSubgraph(const std::string& filename, float size)
|
osg::Node* createCursorSubgraph(const std::string& filename, float size)
|
||||||
@@ -246,14 +267,13 @@ osg::Node* createCursorSubgraph(const std::string& filename, float size)
|
|||||||
size = 20.0f;
|
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::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));
|
||||||
geom->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile(osgDB::findDataFile(filename));
|
osg::Image* image = osgDB::readImageFile(osgDB::findDataFile(filename));
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::StateSet* stateset = geom->getOrCreateStateSet();
|
osg::StateSet* stateset = geom->getOrCreateStateSet();
|
||||||
stateset->setTextureAttributeAndModes(0, new osg::Texture2D(image),osg::StateAttribute::ON|osg::StateAttribute::PROTECTED);
|
stateset->setTextureAttributeAndModes(0, new osg::Texture2D(image),osg::StateAttribute::ON);
|
||||||
stateset->setMode(GL_BLEND,osg::StateAttribute::ON|osg::StateAttribute::PROTECTED);
|
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
|
||||||
// stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
|
// stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
|
||||||
stateset->setRenderBinDetails(1000, "DepthSortedBin");
|
stateset->setRenderBinDetails(1000, "DepthSortedBin");
|
||||||
}
|
}
|
||||||
@@ -271,6 +291,101 @@ osg::Node* createCursorSubgraph(const std::string& filename, float size)
|
|||||||
return transform;
|
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
|
enum P3DApplicationType
|
||||||
@@ -281,47 +396,6 @@ enum P3DApplicationType
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void processLoadedModel(osg::ref_ptr<osg::Node>& loadedModel, int optimizer_options, const std::string& cursorFileName)
|
|
||||||
{
|
|
||||||
if (!loadedModel) return;
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void addDeviceTo(osgViewer::Viewer& viewer, const std::string& device_name)
|
|
||||||
{
|
|
||||||
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device_name);
|
|
||||||
if (dev.valid())
|
|
||||||
{
|
|
||||||
OSG_INFO << "Adding Device : " << device_name << std::endl;
|
|
||||||
viewer.addDevice(dev.get());
|
|
||||||
|
|
||||||
if (dev->getCapabilities() & osgGA::Device::SEND_EVENTS)
|
|
||||||
viewer.getEventHandlers().push_front(new ForwardToDeviceEventHandler(dev.get()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OSG_WARN << "could not open device: " << device_name << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
{
|
{
|
||||||
@@ -368,21 +442,6 @@ int main( int argc, char **argv )
|
|||||||
osg::DisplaySettings::instance()->readEnvironmentalVariables();
|
osg::DisplaySettings::instance()->readEnvironmentalVariables();
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up any logins required for http access
|
|
||||||
std::string url, username, password;
|
|
||||||
while(arguments.read("--login",url, username, password))
|
|
||||||
{
|
|
||||||
if (!osgDB::Registry::instance()->getAuthenticationMap())
|
|
||||||
{
|
|
||||||
osgDB::Registry::instance()->setAuthenticationMap(new osgDB::AuthenticationMap);
|
|
||||||
osgDB::Registry::instance()->getAuthenticationMap()->addAuthenticationDetails(
|
|
||||||
url,
|
|
||||||
new osgDB::AuthenticationDetails(username, password)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_SDL
|
#ifdef USE_SDL
|
||||||
SDLIntegration sdlIntegration;
|
SDLIntegration sdlIntegration;
|
||||||
@@ -451,60 +510,11 @@ int main( int argc, char **argv )
|
|||||||
doSetViewer = false;
|
doSetViewer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* p3dDevice = getenv("P3D_DEVICE");
|
|
||||||
if (p3dDevice)
|
|
||||||
{
|
|
||||||
osgDB::StringList devices;
|
|
||||||
osgDB::split(p3dDevice, devices);
|
|
||||||
for(osgDB::StringList::iterator i = devices.begin(); i != devices.end(); ++i)
|
|
||||||
{
|
|
||||||
addDeviceTo(viewer, *i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string device;
|
|
||||||
while (arguments.read("--device", device))
|
|
||||||
{
|
|
||||||
addDeviceTo(viewer, device);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arguments.read("--http-control"))
|
|
||||||
{
|
|
||||||
|
|
||||||
std::string server_address = "localhost";
|
|
||||||
std::string server_port = "8080";
|
|
||||||
std::string document_root = "htdocs";
|
|
||||||
|
|
||||||
while (arguments.read("--http-server-address", server_address)) {}
|
|
||||||
while (arguments.read("--http-server-port", server_port)) {}
|
|
||||||
while (arguments.read("--http-document-root", document_root)) {}
|
|
||||||
|
|
||||||
osg::ref_ptr<osgDB::Options> device_options = new osgDB::Options("documentRegisteredHandlers");
|
|
||||||
|
|
||||||
osg::ref_ptr<osgGA::Device> rest_http_device = osgDB::readFile<osgGA::Device>(server_address+":"+server_port+"/"+document_root+".resthttp", device_options.get());
|
|
||||||
if (rest_http_device.valid())
|
|
||||||
{
|
|
||||||
viewer.addDevice(rest_http_device.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up stereo masks
|
// set up stereo masks
|
||||||
|
viewer.getCamera()->setCullMask(0xffffffff);
|
||||||
viewer.getCamera()->setCullMaskLeft(0x00000001);
|
viewer.getCamera()->setCullMaskLeft(0x00000001);
|
||||||
viewer.getCamera()->setCullMaskRight(0x00000002);
|
viewer.getCamera()->setCullMaskRight(0x00000002);
|
||||||
|
|
||||||
bool assignLeftCullMaskForMono = true;
|
|
||||||
if (assignLeftCullMaskForMono)
|
|
||||||
{
|
|
||||||
viewer.getCamera()->setCullMask(viewer.getCamera()->getCullMaskLeft());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
viewer.getCamera()->setCullMask(0xffffffff);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up the camera manipulators.
|
// set up the camera manipulators.
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
|
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
|
||||||
@@ -532,9 +542,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add the state manipulator
|
// add the state manipulator
|
||||||
osg::ref_ptr<osgGA::StateSetManipulator> ssManipulator = new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet());
|
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||||
ssManipulator->setKeyEventToggleTexturing('e');
|
|
||||||
viewer.addEventHandler( ssManipulator.get() );
|
|
||||||
|
|
||||||
// add the state manipulator
|
// add the state manipulator
|
||||||
viewer.addEventHandler( new osgViewer::StatsHandler() );
|
viewer.addEventHandler( new osgViewer::StatsHandler() );
|
||||||
@@ -549,20 +557,11 @@ int main( int argc, char **argv )
|
|||||||
std::string cursorFileName( p3dCursor ? p3dCursor : "");
|
std::string cursorFileName( p3dCursor ? p3dCursor : "");
|
||||||
while (arguments.read("--cursor",cursorFileName)) {}
|
while (arguments.read("--cursor",cursorFileName)) {}
|
||||||
|
|
||||||
const char* p3dShowCursor = getenv("P3D_SHOW_CURSOR");
|
|
||||||
std::string showCursor( p3dShowCursor ? p3dShowCursor : "YES");
|
|
||||||
while (arguments.read("--show-cursor")) { showCursor="YES"; }
|
|
||||||
while (arguments.read("--hide-cursor")) { showCursor="NO"; }
|
|
||||||
|
|
||||||
bool hideCursor = (showCursor=="No" || showCursor=="NO" || showCursor=="no");
|
|
||||||
|
|
||||||
while (arguments.read("--set-viewer")) { doSetViewer = true; }
|
while (arguments.read("--set-viewer")) { doSetViewer = true; }
|
||||||
|
|
||||||
while (arguments.read("--no-set-viewer")) { doSetViewer = false; }
|
while (arguments.read("--no-set-viewer")) { doSetViewer = false; }
|
||||||
|
|
||||||
// if we want to hide the cursor override the custom cursor.
|
|
||||||
if (hideCursor) cursorFileName.clear();
|
|
||||||
|
|
||||||
|
|
||||||
// cluster related entries.
|
// cluster related entries.
|
||||||
int socketNumber=8100;
|
int socketNumber=8100;
|
||||||
@@ -590,29 +589,10 @@ int main( int argc, char **argv )
|
|||||||
bool loopPresentation = false;
|
bool loopPresentation = false;
|
||||||
while (arguments.read("--loop")) loopPresentation = true;
|
while (arguments.read("--loop")) loopPresentation = true;
|
||||||
|
|
||||||
{
|
|
||||||
// set update hte default traversal mode settings for update visitor
|
|
||||||
// default to osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN.
|
|
||||||
osg::NodeVisitor::TraversalMode updateTraversalMode = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN; // viewer.getUpdateVisitor()->getTraversalMode();
|
|
||||||
|
|
||||||
const char* p3dUpdateStr = getenv("P3D_UPDATE");
|
|
||||||
if (p3dUpdateStr)
|
|
||||||
{
|
|
||||||
std::string updateStr(p3dUpdateStr);
|
|
||||||
if (updateStr=="active" || updateStr=="Active" || updateStr=="ACTIVE") updateTraversalMode = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN;
|
|
||||||
else if (updateStr=="all" || updateStr=="All" || updateStr=="ALL") updateTraversalMode = osg::NodeVisitor::TRAVERSE_ALL_CHILDREN;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(arguments.read("--update-active")) updateTraversalMode = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN;
|
|
||||||
while(arguments.read("--update-all")) updateTraversalMode = osg::NodeVisitor::TRAVERSE_ALL_CHILDREN;
|
|
||||||
|
|
||||||
viewer.getUpdateVisitor()->setTraversalMode(updateTraversalMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// register the slide event handler - which moves the presentation from slide to slide, layer to layer.
|
// register the slide event handler - which moves the presentation from slide to slide, layer to layer.
|
||||||
osg::ref_ptr<osgPresentation::SlideEventHandler> seh = new osgPresentation::SlideEventHandler(&viewer);
|
osgPresentation::SlideEventHandler* seh = new osgPresentation::SlideEventHandler(&viewer);
|
||||||
viewer.addEventHandler(seh.get());
|
viewer.addEventHandler(seh);
|
||||||
|
|
||||||
seh->setAutoSteppingActive(autoSteppingActive);
|
seh->setAutoSteppingActive(autoSteppingActive);
|
||||||
seh->setTimeDelayBetweenSlides(timeDelayBetweenSlides);
|
seh->setTimeDelayBetweenSlides(timeDelayBetweenSlides);
|
||||||
@@ -648,19 +628,8 @@ int main( int argc, char **argv )
|
|||||||
// osgDB::Registry::instance()->getOrCreateDatabasePager()->setExpiryDelay(1.0f);
|
// osgDB::Registry::instance()->getOrCreateDatabasePager()->setExpiryDelay(1.0f);
|
||||||
|
|
||||||
// register the handler for modifying the point size
|
// register the handler for modifying the point size
|
||||||
osg::ref_ptr<PointsEventHandler> peh = new PointsEventHandler;
|
PointsEventHandler* peh = new PointsEventHandler;
|
||||||
viewer.addEventHandler(peh.get());
|
viewer.addEventHandler(peh);
|
||||||
|
|
||||||
// add the screen capture handler
|
|
||||||
std::string screenCaptureFilename = "screen_shot.jpg";
|
|
||||||
while(arguments.read("--screenshot", screenCaptureFilename)) {}
|
|
||||||
osg::ref_ptr<osgViewer::ScreenCaptureHandler::WriteToFile> writeFile = new osgViewer::ScreenCaptureHandler::WriteToFile(
|
|
||||||
osgDB::getNameLessExtension(screenCaptureFilename),
|
|
||||||
osgDB::getFileExtension(screenCaptureFilename) );
|
|
||||||
osg::ref_ptr<osgViewer::ScreenCaptureHandler> screenCaptureHandler = new osgViewer::ScreenCaptureHandler(writeFile.get());
|
|
||||||
screenCaptureHandler->setKeyEventTakeScreenShot('m');//osgGA::GUIEventAdapter::KEY_Print);
|
|
||||||
screenCaptureHandler->setKeyEventToggleContinuousCapture('M');
|
|
||||||
viewer.addEventHandler(screenCaptureHandler.get());
|
|
||||||
|
|
||||||
// osg::DisplaySettings::instance()->setSplitStereoAutoAjustAspectRatio(false);
|
// osg::DisplaySettings::instance()->setSplitStereoAutoAjustAspectRatio(false);
|
||||||
|
|
||||||
@@ -820,7 +789,26 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
processLoadedModel(loadedModel, optimizer_options, cursorFileName);
|
#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
|
// set the scene to render
|
||||||
viewer.setSceneData(loadedModel.get());
|
viewer.setSceneData(loadedModel.get());
|
||||||
@@ -839,23 +827,7 @@ int main( int argc, char **argv )
|
|||||||
viewerInitialized = true;
|
viewerInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!cursorFileName.empty())
|
||||||
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!cursorFileName.empty() || hideCursor)
|
|
||||||
{
|
{
|
||||||
// have to add a frame in here to avoid problems with X11 threading issue on switching off the cursor
|
// 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
|
// not yet sure why it makes a difference, but it at least fixes the crash that would otherwise occur
|
||||||
@@ -873,6 +845,18 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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();
|
osg::Timer_t startOfFrameTick = osg::Timer::instance()->tick();
|
||||||
double targetFrameTime = 1.0/targetFrameRate;
|
double targetFrameTime = 1.0/targetFrameRate;
|
||||||
|
|
||||||
@@ -960,31 +944,6 @@ int main( int argc, char **argv )
|
|||||||
// call all node update callbacks and animations.
|
// call all node update callbacks and animations.
|
||||||
viewer.eventTraversal();
|
viewer.eventTraversal();
|
||||||
|
|
||||||
if (seh->getRequestReload())
|
|
||||||
{
|
|
||||||
OSG_INFO<<"Reload requested"<<std::endl;
|
|
||||||
seh->setRequestReload(false);
|
|
||||||
int previous_ActiveSlide = seh->getActiveSlide();
|
|
||||||
int previous_ActiveLayer = seh->getActiveLayer();
|
|
||||||
|
|
||||||
// reset time so any event key generate
|
|
||||||
|
|
||||||
loadedModel = p3d::readShowFiles(arguments,cacheAllOption.get());
|
|
||||||
processLoadedModel(loadedModel, optimizer_options, cursorFileName);
|
|
||||||
|
|
||||||
if (!loadedModel)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
viewer.setSceneData(loadedModel.get());
|
|
||||||
seh->set(loadedModel.get());
|
|
||||||
seh->selectSlide(previous_ActiveSlide, previous_ActiveLayer);
|
|
||||||
|
|
||||||
continue;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the scene by traversing it with the the update visitor which will
|
// update the scene by traversing it with the the update visitor which will
|
||||||
// call all node update callbacks and animations.
|
// call all node update callbacks and animations.
|
||||||
viewer.updateTraversal();
|
viewer.updateTraversal();
|
||||||
@@ -1004,7 +963,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ExportHTML::write(seh.get(), viewer, exportName);
|
ExportHTML::write(seh, viewer, exportName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ SHORT_NAMES = YES
|
|||||||
JAVADOC_AUTOBRIEF = YES
|
JAVADOC_AUTOBRIEF = YES
|
||||||
QT_AUTOBRIEF = NO
|
QT_AUTOBRIEF = NO
|
||||||
MULTILINE_CPP_IS_BRIEF = NO
|
MULTILINE_CPP_IS_BRIEF = NO
|
||||||
|
DETAILS_AT_TOP = NO
|
||||||
INHERIT_DOCS = YES
|
INHERIT_DOCS = YES
|
||||||
SEPARATE_MEMBER_PAGES = NO
|
SEPARATE_MEMBER_PAGES = NO
|
||||||
TAB_SIZE = 8
|
TAB_SIZE = 8
|
||||||
@@ -75,6 +76,7 @@ GENERATE_DEPRECATEDLIST= YES
|
|||||||
ENABLED_SECTIONS =
|
ENABLED_SECTIONS =
|
||||||
MAX_INITIALIZER_LINES = 30
|
MAX_INITIALIZER_LINES = 30
|
||||||
SHOW_USED_FILES = YES
|
SHOW_USED_FILES = YES
|
||||||
|
SHOW_DIRECTORIES = NO
|
||||||
SHOW_FILES = YES
|
SHOW_FILES = YES
|
||||||
SHOW_NAMESPACES = YES
|
SHOW_NAMESPACES = YES
|
||||||
FILE_VERSION_FILTER =
|
FILE_VERSION_FILTER =
|
||||||
@@ -136,6 +138,7 @@ HTML_FILE_EXTENSION = .html
|
|||||||
HTML_HEADER =
|
HTML_HEADER =
|
||||||
HTML_FOOTER = ${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html
|
HTML_FOOTER = ${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html
|
||||||
HTML_STYLESHEET =
|
HTML_STYLESHEET =
|
||||||
|
HTML_ALIGN_MEMBERS = YES
|
||||||
GENERATE_HTMLHELP = NO
|
GENERATE_HTMLHELP = NO
|
||||||
GENERATE_DOCSET = NO
|
GENERATE_DOCSET = NO
|
||||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ SHORT_NAMES = YES
|
|||||||
JAVADOC_AUTOBRIEF = YES
|
JAVADOC_AUTOBRIEF = YES
|
||||||
QT_AUTOBRIEF = NO
|
QT_AUTOBRIEF = NO
|
||||||
MULTILINE_CPP_IS_BRIEF = NO
|
MULTILINE_CPP_IS_BRIEF = NO
|
||||||
|
DETAILS_AT_TOP = NO
|
||||||
INHERIT_DOCS = YES
|
INHERIT_DOCS = YES
|
||||||
SEPARATE_MEMBER_PAGES = NO
|
SEPARATE_MEMBER_PAGES = NO
|
||||||
TAB_SIZE = 8
|
TAB_SIZE = 8
|
||||||
@@ -75,6 +76,7 @@ GENERATE_DEPRECATEDLIST= YES
|
|||||||
ENABLED_SECTIONS =
|
ENABLED_SECTIONS =
|
||||||
MAX_INITIALIZER_LINES = 30
|
MAX_INITIALIZER_LINES = 30
|
||||||
SHOW_USED_FILES = YES
|
SHOW_USED_FILES = YES
|
||||||
|
SHOW_DIRECTORIES = NO
|
||||||
SHOW_FILES = YES
|
SHOW_FILES = YES
|
||||||
SHOW_NAMESPACES = YES
|
SHOW_NAMESPACES = YES
|
||||||
FILE_VERSION_FILTER =
|
FILE_VERSION_FILTER =
|
||||||
@@ -149,6 +151,7 @@ HTML_FILE_EXTENSION = .html
|
|||||||
HTML_HEADER =
|
HTML_HEADER =
|
||||||
HTML_FOOTER = ${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html
|
HTML_FOOTER = ${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html
|
||||||
HTML_STYLESHEET =
|
HTML_STYLESHEET =
|
||||||
|
HTML_ALIGN_MEMBERS = YES
|
||||||
GENERATE_HTMLHELP = NO
|
GENERATE_HTMLHELP = NO
|
||||||
GENERATE_DOCSET = NO
|
GENERATE_DOCSET = NO
|
||||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||||
|
|||||||
@@ -128,6 +128,13 @@ JAVADOC_AUTOBRIEF = NO
|
|||||||
|
|
||||||
MULTILINE_CPP_IS_BRIEF = NO
|
MULTILINE_CPP_IS_BRIEF = NO
|
||||||
|
|
||||||
|
# If the DETAILS_AT_TOP tag is set to YES then Doxygen
|
||||||
|
# will output the detailed description near the top, like JavaDoc.
|
||||||
|
# If set to NO, the detailed description appears after the member
|
||||||
|
# documentation.
|
||||||
|
|
||||||
|
DETAILS_AT_TOP = NO
|
||||||
|
|
||||||
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
|
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
|
||||||
# member inherits the documentation from any documented member that it
|
# member inherits the documentation from any documented member that it
|
||||||
# re-implements.
|
# re-implements.
|
||||||
@@ -564,6 +571,12 @@ HTML_FOOTER =
|
|||||||
|
|
||||||
HTML_STYLESHEET =
|
HTML_STYLESHEET =
|
||||||
|
|
||||||
|
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
|
||||||
|
# files or namespaces will be aligned in HTML using tables. If set to
|
||||||
|
# NO a bullet list will be used.
|
||||||
|
|
||||||
|
HTML_ALIGN_MEMBERS = YES
|
||||||
|
|
||||||
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
|
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
|
||||||
# will be generated that can be used as input for tools like the
|
# will be generated that can be used as input for tools like the
|
||||||
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
|
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ SHORT_NAMES = YES
|
|||||||
JAVADOC_AUTOBRIEF = YES
|
JAVADOC_AUTOBRIEF = YES
|
||||||
QT_AUTOBRIEF = NO
|
QT_AUTOBRIEF = NO
|
||||||
MULTILINE_CPP_IS_BRIEF = NO
|
MULTILINE_CPP_IS_BRIEF = NO
|
||||||
|
DETAILS_AT_TOP = NO
|
||||||
INHERIT_DOCS = YES
|
INHERIT_DOCS = YES
|
||||||
SEPARATE_MEMBER_PAGES = NO
|
SEPARATE_MEMBER_PAGES = NO
|
||||||
TAB_SIZE = 8
|
TAB_SIZE = 8
|
||||||
@@ -65,6 +66,7 @@ GENERATE_DEPRECATEDLIST= YES
|
|||||||
ENABLED_SECTIONS =
|
ENABLED_SECTIONS =
|
||||||
MAX_INITIALIZER_LINES = 30
|
MAX_INITIALIZER_LINES = 30
|
||||||
SHOW_USED_FILES = YES
|
SHOW_USED_FILES = YES
|
||||||
|
SHOW_DIRECTORIES = NO
|
||||||
SHOW_FILES = YES
|
SHOW_FILES = YES
|
||||||
SHOW_NAMESPACES = YES
|
SHOW_NAMESPACES = YES
|
||||||
FILE_VERSION_FILTER =
|
FILE_VERSION_FILTER =
|
||||||
@@ -139,6 +141,7 @@ HTML_FILE_EXTENSION = .html
|
|||||||
HTML_HEADER =
|
HTML_HEADER =
|
||||||
HTML_FOOTER = ${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html
|
HTML_FOOTER = ${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html
|
||||||
HTML_STYLESHEET =
|
HTML_STYLESHEET =
|
||||||
|
HTML_ALIGN_MEMBERS = YES
|
||||||
GENERATE_HTMLHELP = NO
|
GENERATE_HTMLHELP = NO
|
||||||
GENERATE_DOCSET = NO
|
GENERATE_DOCSET = NO
|
||||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ GENERATE_DEPRECATEDLIST= YES
|
|||||||
ENABLED_SECTIONS =
|
ENABLED_SECTIONS =
|
||||||
MAX_INITIALIZER_LINES = 30
|
MAX_INITIALIZER_LINES = 30
|
||||||
SHOW_USED_FILES = YES
|
SHOW_USED_FILES = YES
|
||||||
|
SHOW_DIRECTORIES = YES
|
||||||
SHOW_FILES = YES
|
SHOW_FILES = YES
|
||||||
SHOW_NAMESPACES = YES
|
SHOW_NAMESPACES = YES
|
||||||
FILE_VERSION_FILTER =
|
FILE_VERSION_FILTER =
|
||||||
@@ -140,6 +141,7 @@ HTML_FILE_EXTENSION = .html
|
|||||||
HTML_HEADER =
|
HTML_HEADER =
|
||||||
HTML_FOOTER = "${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html"
|
HTML_FOOTER = "${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html"
|
||||||
HTML_STYLESHEET =
|
HTML_STYLESHEET =
|
||||||
|
HTML_ALIGN_MEMBERS = YES
|
||||||
HTML_DYNAMIC_SECTIONS = NO
|
HTML_DYNAMIC_SECTIONS = NO
|
||||||
GENERATE_DOCSET = NO
|
GENERATE_DOCSET = NO
|
||||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ GENERATE_DEPRECATEDLIST= YES
|
|||||||
ENABLED_SECTIONS =
|
ENABLED_SECTIONS =
|
||||||
MAX_INITIALIZER_LINES = 30
|
MAX_INITIALIZER_LINES = 30
|
||||||
SHOW_USED_FILES = YES
|
SHOW_USED_FILES = YES
|
||||||
|
SHOW_DIRECTORIES = YES
|
||||||
SHOW_FILES = YES
|
SHOW_FILES = YES
|
||||||
SHOW_NAMESPACES = YES
|
SHOW_NAMESPACES = YES
|
||||||
FILE_VERSION_FILTER =
|
FILE_VERSION_FILTER =
|
||||||
@@ -125,6 +126,7 @@ HTML_FILE_EXTENSION = .html
|
|||||||
HTML_HEADER =
|
HTML_HEADER =
|
||||||
HTML_FOOTER = "${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html"
|
HTML_FOOTER = "${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html"
|
||||||
HTML_STYLESHEET =
|
HTML_STYLESHEET =
|
||||||
|
HTML_ALIGN_MEMBERS = YES
|
||||||
HTML_DYNAMIC_SECTIONS = NO
|
HTML_DYNAMIC_SECTIONS = NO
|
||||||
GENERATE_DOCSET = NO
|
GENERATE_DOCSET = NO
|
||||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
ADD_SUBDIRECTORY(osg2cpp)
|
ADD_SUBDIRECTORY(osg2cpp)
|
||||||
ADD_SUBDIRECTORY(osganalysis)
|
ADD_SUBDIRECTORY(osganalysis)
|
||||||
ADD_SUBDIRECTORY(osganimate)
|
ADD_SUBDIRECTORY(osganimate)
|
||||||
ADD_SUBDIRECTORY(osgatomiccounter)
|
|
||||||
ADD_SUBDIRECTORY(osgautocapture)
|
ADD_SUBDIRECTORY(osgautocapture)
|
||||||
ADD_SUBDIRECTORY(osgautotransform)
|
ADD_SUBDIRECTORY(osgautotransform)
|
||||||
ADD_SUBDIRECTORY(osgbillboard)
|
ADD_SUBDIRECTORY(osgbillboard)
|
||||||
@@ -46,9 +45,9 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
ADD_SUBDIRECTORY(osgfont)
|
ADD_SUBDIRECTORY(osgfont)
|
||||||
ADD_SUBDIRECTORY(osgforest)
|
ADD_SUBDIRECTORY(osgforest)
|
||||||
ADD_SUBDIRECTORY(osgfxbrowser)
|
ADD_SUBDIRECTORY(osgfxbrowser)
|
||||||
ADD_SUBDIRECTORY(osgframerenderer)
|
|
||||||
ADD_SUBDIRECTORY(osgoutline)
|
ADD_SUBDIRECTORY(osgoutline)
|
||||||
ADD_SUBDIRECTORY(osggameoflife)
|
ADD_SUBDIRECTORY(osggameoflife)
|
||||||
|
ADD_SUBDIRECTORY(osggeodemo)
|
||||||
ADD_SUBDIRECTORY(osggeometry)
|
ADD_SUBDIRECTORY(osggeometry)
|
||||||
ADD_SUBDIRECTORY(osggeometryshaders)
|
ADD_SUBDIRECTORY(osggeometryshaders)
|
||||||
ADD_SUBDIRECTORY(osghangglide)
|
ADD_SUBDIRECTORY(osghangglide)
|
||||||
@@ -59,7 +58,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
ADD_SUBDIRECTORY(osgkdtree)
|
ADD_SUBDIRECTORY(osgkdtree)
|
||||||
ADD_SUBDIRECTORY(osgkeyboard)
|
ADD_SUBDIRECTORY(osgkeyboard)
|
||||||
ADD_SUBDIRECTORY(osgkeyboardmouse)
|
ADD_SUBDIRECTORY(osgkeyboardmouse)
|
||||||
ADD_SUBDIRECTORY(osgkeystone)
|
|
||||||
ADD_SUBDIRECTORY(osglauncher)
|
ADD_SUBDIRECTORY(osglauncher)
|
||||||
ADD_SUBDIRECTORY(osglight)
|
ADD_SUBDIRECTORY(osglight)
|
||||||
ADD_SUBDIRECTORY(osglightpoint)
|
ADD_SUBDIRECTORY(osglightpoint)
|
||||||
@@ -69,16 +67,13 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
ADD_SUBDIRECTORY(osggraphicscost)
|
ADD_SUBDIRECTORY(osggraphicscost)
|
||||||
ADD_SUBDIRECTORY(osgmanipulator)
|
ADD_SUBDIRECTORY(osgmanipulator)
|
||||||
ADD_SUBDIRECTORY(osgmovie)
|
ADD_SUBDIRECTORY(osgmovie)
|
||||||
ADD_SUBDIRECTORY(osgmultiplemovies)
|
|
||||||
ADD_SUBDIRECTORY(osgmultiplerendertargets)
|
ADD_SUBDIRECTORY(osgmultiplerendertargets)
|
||||||
ADD_SUBDIRECTORY(osgmultitexture)
|
ADD_SUBDIRECTORY(osgmultitexture)
|
||||||
ADD_SUBDIRECTORY(osgmultitexturecontrol)
|
ADD_SUBDIRECTORY(osgmultitexturecontrol)
|
||||||
ADD_SUBDIRECTORY(osgmultitouch)
|
|
||||||
ADD_SUBDIRECTORY(osgmultiviewpaging)
|
ADD_SUBDIRECTORY(osgmultiviewpaging)
|
||||||
ADD_SUBDIRECTORY(osgoccluder)
|
ADD_SUBDIRECTORY(osgoccluder)
|
||||||
ADD_SUBDIRECTORY(osgocclusionquery)
|
ADD_SUBDIRECTORY(osgocclusionquery)
|
||||||
ADD_SUBDIRECTORY(osgoit)
|
ADD_SUBDIRECTORY(osgoit)
|
||||||
ADD_SUBDIRECTORY(osgoscdevice)
|
|
||||||
ADD_SUBDIRECTORY(osgpackeddepthstencil)
|
ADD_SUBDIRECTORY(osgpackeddepthstencil)
|
||||||
ADD_SUBDIRECTORY(osgpagedlod)
|
ADD_SUBDIRECTORY(osgpagedlod)
|
||||||
ADD_SUBDIRECTORY(osgparametric)
|
ADD_SUBDIRECTORY(osgparametric)
|
||||||
@@ -106,7 +101,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
ADD_SUBDIRECTORY(osgshadow)
|
ADD_SUBDIRECTORY(osgshadow)
|
||||||
ADD_SUBDIRECTORY(osgshape)
|
ADD_SUBDIRECTORY(osgshape)
|
||||||
ADD_SUBDIRECTORY(osgsharedarray)
|
ADD_SUBDIRECTORY(osgsharedarray)
|
||||||
ADD_SUBDIRECTORY(osgsimpleshaders)
|
|
||||||
ADD_SUBDIRECTORY(osgsimplifier)
|
ADD_SUBDIRECTORY(osgsimplifier)
|
||||||
ADD_SUBDIRECTORY(osgsimulation)
|
ADD_SUBDIRECTORY(osgsimulation)
|
||||||
ADD_SUBDIRECTORY(osgsidebyside)
|
ADD_SUBDIRECTORY(osgsidebyside)
|
||||||
@@ -159,9 +153,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
ADD_SUBDIRECTORY(osgwidgetwindow)
|
ADD_SUBDIRECTORY(osgwidgetwindow)
|
||||||
ADD_SUBDIRECTORY(osguserdata)
|
ADD_SUBDIRECTORY(osguserdata)
|
||||||
|
|
||||||
# GL3/GL4 example
|
|
||||||
ADD_SUBDIRECTORY(osgsimplegl3)
|
|
||||||
|
|
||||||
IF(OSG_CPP_EXCEPTIONS_AVAILABLE)
|
IF(OSG_CPP_EXCEPTIONS_AVAILABLE)
|
||||||
ADD_SUBDIRECTORY(osgunittests)
|
ADD_SUBDIRECTORY(osgunittests)
|
||||||
ADD_SUBDIRECTORY(osgmemorytest)
|
ADD_SUBDIRECTORY(osgmemorytest)
|
||||||
@@ -179,8 +170,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
|
|
||||||
ADD_SUBDIRECTORY(osgphotoalbum)
|
ADD_SUBDIRECTORY(osgphotoalbum)
|
||||||
ADD_SUBDIRECTORY(osgtessellate)
|
ADD_SUBDIRECTORY(osgtessellate)
|
||||||
ADD_SUBDIRECTORY(osgtessellationshaders)
|
|
||||||
ADD_SUBDIRECTORY(osgcomputeshaders)
|
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(osgpdf)
|
ADD_SUBDIRECTORY(osgpdf)
|
||||||
|
|
||||||
@@ -200,29 +189,28 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
ADD_SUBDIRECTORY(osgviewerFOX)
|
ADD_SUBDIRECTORY(osgviewerFOX)
|
||||||
ENDIF(FOX_FOUND)
|
ENDIF(FOX_FOUND)
|
||||||
|
|
||||||
IF (wxWidgets_FOUND AND CMAKE_BUILD_TYPE)
|
IF (wxWidgets_FOUND)
|
||||||
IF (${CMAKE_BUILD_TYPE} STREQUAL "Release")
|
ADD_SUBDIRECTORY(osgviewerWX)
|
||||||
ADD_SUBDIRECTORY(osgviewerWX)
|
ENDIF(wxWidgets_FOUND)
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF ( (QT4_FOUND OR Qt5Widgets_FOUND) AND NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE AND NOT OSG_GL3_AVAILABLE)
|
IF (QT_FOUND AND NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE AND NOT OSG_GL3_AVAILABLE)
|
||||||
|
OPTION(BUILD_QT_EXAMPLES "Enable the build of the examples that depend on Qt" ON)
|
||||||
|
|
||||||
IF ( QT4_FOUND OR Qt5Widgets_FOUND)
|
IF (BUILD_QT_EXAMPLES AND QT_QTOPENGL_LIBRARY)
|
||||||
ADD_SUBDIRECTORY(osgviewerQt)
|
ADD_SUBDIRECTORY(osgviewerQt)
|
||||||
ADD_SUBDIRECTORY(osgqfont)
|
ADD_SUBDIRECTORY(osgqfont)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF ( (QT4_FOUND AND QT_QTWEBKIT_FOUND) OR Qt5WebKitWidgets_FOUND )
|
IF (BUILD_QT_EXAMPLES AND QT4_FOUND AND QT_QTWEBKIT_FOUND)
|
||||||
ADD_SUBDIRECTORY(osgQtWidgets)
|
ADD_SUBDIRECTORY(osgQtWidgets)
|
||||||
ADD_SUBDIRECTORY(osgQtBrowser)
|
ADD_SUBDIRECTORY(osgQtBrowser)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF (FLTK_FOUND AND FLTK_GL_LIBRARY)
|
IF (FLTK_FOUND)
|
||||||
ADD_SUBDIRECTORY(osgviewerFLTK)
|
ADD_SUBDIRECTORY(osgviewerFLTK)
|
||||||
ENDIF()
|
ENDIF(FLTK_FOUND)
|
||||||
|
|
||||||
IF (WIN32)
|
IF (WIN32)
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is a utility for converting glsl shader files into char arrays that can be compiled into applications.");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is a utility for converting between various input and output databases formats.");
|
||||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--shader <filename>","Shader file to create a .cpp file for.");
|
arguments.getApplicationUsage()->addCommandLineOption("--shader <filename>","Shader file to create a .cpp file for.");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");
|
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_setClearColor(JNIEnv
|
|||||||
}
|
}
|
||||||
JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv * env, jobject obj, jstring address){
|
JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv * env, jobject obj, jstring address){
|
||||||
//Import Strings from JNI
|
//Import Strings from JNI
|
||||||
const char *nativeAddress = env->GetStringUTFChars(address, JNI_FALSE);
|
const char *nativeAddress = env->GetStringUTFChars(address, false);
|
||||||
|
|
||||||
mainApp.loadObject(std::string(nativeAddress));
|
mainApp.loadObject(std::string(nativeAddress));
|
||||||
|
|
||||||
@@ -84,8 +84,8 @@ JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv *
|
|||||||
}
|
}
|
||||||
JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv * env, jobject obj, jstring address, jstring name){
|
JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv * env, jobject obj, jstring address, jstring name){
|
||||||
//Import Strings from JNI
|
//Import Strings from JNI
|
||||||
const char *nativeAddress = env->GetStringUTFChars(address,JNI_FALSE);
|
const char *nativeAddress = env->GetStringUTFChars(address, false);
|
||||||
const char *nativeName = env->GetStringUTFChars(name, JNI_FALSE);
|
const char *nativeName = env->GetStringUTFChars(name, false);
|
||||||
|
|
||||||
mainApp.loadObject(std::string(nativeName),std::string(nativeAddress));
|
mainApp.loadObject(std::string(nativeName),std::string(nativeAddress));
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_setClearColor(JNIEnv
|
|||||||
}
|
}
|
||||||
JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv * env, jobject obj, jstring address){
|
JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv * env, jobject obj, jstring address){
|
||||||
//Import Strings from JNI
|
//Import Strings from JNI
|
||||||
const char *nativeAddress = env->GetStringUTFChars(address, JNI_FALSE);
|
const char *nativeAddress = env->GetStringUTFChars(address, false);
|
||||||
|
|
||||||
mainApp.loadObject(std::string(nativeAddress));
|
mainApp.loadObject(std::string(nativeAddress));
|
||||||
|
|
||||||
@@ -84,8 +84,8 @@ JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv *
|
|||||||
}
|
}
|
||||||
JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv * env, jobject obj, jstring address, jstring name){
|
JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv * env, jobject obj, jstring address, jstring name){
|
||||||
//Import Strings from JNI
|
//Import Strings from JNI
|
||||||
const char *nativeAddress = env->GetStringUTFChars(address,JNI_FALSE);
|
const char *nativeAddress = env->GetStringUTFChars(address, false);
|
||||||
const char *nativeName = env->GetStringUTFChars(name, JNI_FALSE);
|
const char *nativeName = env->GetStringUTFChars(name, false);
|
||||||
|
|
||||||
mainApp.loadObject(std::string(nativeName),std::string(nativeAddress));
|
mainApp.loadObject(std::string(nativeName),std::string(nativeAddress));
|
||||||
|
|
||||||
|
|||||||
@@ -7,19 +7,10 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
if ( QT4_FOUND )
|
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${QT_QTWEBKIT_LIBRARY})
|
||||||
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})
|
||||||
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTOPENGL_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTWEBKIT_INCLUDE_DIR} )
|
|
||||||
endif( QT4_FOUND )
|
|
||||||
|
|
||||||
SET(TARGET_ADDED_LIBRARIES osgWidget osgQt)
|
SET(TARGET_ADDED_LIBRARIES osgWidget osgQt)
|
||||||
|
|
||||||
#### end var setup ###
|
#### end var setup ###
|
||||||
SET ( EXAMPLE_NAME osgQtBrowser )
|
SETUP_EXAMPLE(osgQtBrowser)
|
||||||
SETUP_EXAMPLE(${EXAMPLE_NAME})
|
|
||||||
|
|
||||||
IF ( Qt5Widgets_FOUND )
|
|
||||||
qt5_use_modules( example_${EXAMPLE_NAME} Widgets OpenGL WebKitWidgets )
|
|
||||||
ENDIF( Qt5Widgets_FOUND )
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,20 +29,14 @@
|
|||||||
#include <osgViewer/ViewerEventHandlers>
|
#include <osgViewer/ViewerEventHandlers>
|
||||||
#include <osgWidget/Browser>
|
#include <osgWidget/Browser>
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
# include <QtWebKitWidgets>
|
|
||||||
#else
|
|
||||||
# include <QtWebKit>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <QWebSettings>
|
#include <QtWebKit/QWebSettings>
|
||||||
|
#include <QtWebKit/QtWebKit>
|
||||||
#include <QGraphicsScene>
|
#include <QtGui/QGraphicsScene>
|
||||||
#include <QGraphicsView>
|
#include <QtGui/QGraphicsView>
|
||||||
#include <QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QPainter>
|
#include <QtGui/QPainter>
|
||||||
#include <QtEvents>
|
#include <QtGui/QtEvents>
|
||||||
|
|
||||||
#include <osgQt/QGraphicsViewAdapter>
|
#include <osgQt/QGraphicsViewAdapter>
|
||||||
#include <osgQt/QWebViewImage>
|
#include <osgQt/QWebViewImage>
|
||||||
|
|||||||
@@ -7,17 +7,10 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
if ( QT4_FOUND )
|
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${QT_QTWEBKIT_LIBRARY})
|
||||||
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})
|
||||||
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTOPENGL_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTWEBKIT_INCLUDE_DIR} )
|
|
||||||
endif( QT4_FOUND )
|
|
||||||
|
|
||||||
SET(TARGET_ADDED_LIBRARIES osgWidget osgQt)
|
SET(TARGET_ADDED_LIBRARIES osgWidget osgQt)
|
||||||
|
|
||||||
#### end var setup ###
|
#### end var setup ###
|
||||||
SET ( EXAMPLE_NAME osgQtWidgets )
|
SETUP_EXAMPLE(osgQtWidgets)
|
||||||
SETUP_EXAMPLE(${EXAMPLE_NAME})
|
|
||||||
|
|
||||||
IF ( Qt5Widgets_FOUND )
|
|
||||||
qt5_use_modules( example_${EXAMPLE_NAME} OpenGL WebKitWidgets )
|
|
||||||
ENDIF( Qt5Widgets_FOUND )
|
|
||||||
|
|||||||
@@ -36,16 +36,17 @@
|
|||||||
#include <osgWidget/Browser>
|
#include <osgWidget/Browser>
|
||||||
|
|
||||||
|
|
||||||
//#include <QWebSettings>
|
//#include <QtWebKit/QWebSettings>
|
||||||
#include <QGraphicsScene>
|
//#include <QtWebKit/QtWebKit>
|
||||||
#include <QGraphicsView>
|
#include <QtGui/QGraphicsScene>
|
||||||
#include <QApplication>
|
#include <QtGui/QGraphicsView>
|
||||||
#include <QPainter>
|
#include <QtGui/QApplication>
|
||||||
#include <QtEvents>
|
#include <QtGui/QPainter>
|
||||||
#include <QDialog>
|
#include <QtGui/QtEvents>
|
||||||
#include <QVBoxLayout>
|
#include <QtGui/QDialog>
|
||||||
#include <QMainWindow>
|
#include <QtGui/QVBoxLayout>
|
||||||
#include <QtOpenGL>
|
#include <QtGui/QMainWindow>
|
||||||
|
#include <QtOpenGL/QtOpenGL>
|
||||||
|
|
||||||
#include <osgQt/QGraphicsViewAdapter>
|
#include <osgQt/QGraphicsViewAdapter>
|
||||||
#include <osgQt/QWebViewImage>
|
#include <osgQt/QWebViewImage>
|
||||||
@@ -97,11 +98,7 @@ protected:
|
|||||||
virtual void mousePressEvent(QMouseEvent* e)
|
virtual void mousePressEvent(QMouseEvent* e)
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
#if QT_VERSION >= 0x040500
|
|
||||||
int val = QInputDialog::getInt(this, "Get integer", "Please enter an integer between 0 and pi", 0, 0, 3, 1, &ok);
|
|
||||||
#else
|
|
||||||
int val = QInputDialog::getInteger(this, "Get integer", "Please enter an integer between 0 and pi", 0, 0, 3, 1, &ok);
|
int val = QInputDialog::getInteger(this, "Get integer", "Please enter an integer between 0 and pi", 0, 0, 3, 1, &ok);
|
||||||
#endif
|
|
||||||
std::cout << "Ok was " << (ok ? "" : "not") << " pressed, val is " << val << std::endl;
|
std::cout << "Ok was " << (ok ? "" : "not") << " pressed, val is " << val << std::endl;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -93,36 +93,45 @@ osg::Node* createBase(const osg::Vec3& center,float radius)
|
|||||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||||
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); // white
|
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); // white
|
||||||
colors->push_back(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); // black
|
colors->push_back(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); // black
|
||||||
|
int numColors=colors->size();
|
||||||
|
|
||||||
osg::ref_ptr<osg::DrawElementsUShort> whitePrimitives = new osg::DrawElementsUShort(GL_QUADS);
|
|
||||||
osg::ref_ptr<osg::DrawElementsUShort> blackPrimitives = new osg::DrawElementsUShort(GL_QUADS);
|
|
||||||
|
|
||||||
int numIndicesPerRow=numTilesX+1;
|
int numIndicesPerRow=numTilesX+1;
|
||||||
|
osg::UByteArray* coordIndices = new osg::UByteArray; // assumes we are using less than 256 points...
|
||||||
|
osg::UByteArray* colorIndices = new osg::UByteArray;
|
||||||
for(iy=0;iy<numTilesY;++iy)
|
for(iy=0;iy<numTilesY;++iy)
|
||||||
{
|
{
|
||||||
for(int ix=0;ix<numTilesX;++ix)
|
for(int ix=0;ix<numTilesX;++ix)
|
||||||
{
|
{
|
||||||
osg::DrawElementsUShort* primitives = ((iy+ix)%2==0) ? whitePrimitives.get() : blackPrimitives.get();
|
// four vertices per quad.
|
||||||
primitives->push_back(ix +(iy+1)*numIndicesPerRow);
|
coordIndices->push_back(ix +(iy+1)*numIndicesPerRow);
|
||||||
primitives->push_back(ix +iy*numIndicesPerRow);
|
coordIndices->push_back(ix +iy*numIndicesPerRow);
|
||||||
primitives->push_back((ix+1)+iy*numIndicesPerRow);
|
coordIndices->push_back((ix+1)+iy*numIndicesPerRow);
|
||||||
primitives->push_back((ix+1)+(iy+1)*numIndicesPerRow);
|
coordIndices->push_back((ix+1)+(iy+1)*numIndicesPerRow);
|
||||||
|
|
||||||
|
// one color per quad
|
||||||
|
colorIndices->push_back((ix+iy)%numColors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// set up a single normal
|
// set up a single normal
|
||||||
osg::Vec3Array* normals = new osg::Vec3Array;
|
osg::Vec3Array* normals = new osg::Vec3Array;
|
||||||
normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
|
normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
|
||||||
|
|
||||||
|
|
||||||
osg::Geometry* geom = new osg::Geometry;
|
osg::Geometry* geom = new osg::Geometry;
|
||||||
geom->setVertexArray(coords);
|
geom->setVertexArray(coords);
|
||||||
|
geom->setVertexIndices(coordIndices);
|
||||||
|
|
||||||
geom->setColorArray(colors, osg::Array::BIND_PER_PRIMITIVE_SET);
|
geom->setColorArray(colors);
|
||||||
|
geom->setColorIndices(colorIndices);
|
||||||
|
geom->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE);
|
||||||
|
|
||||||
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
geom->setNormalArray(normals);
|
||||||
|
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
geom->addPrimitiveSet(whitePrimitives.get());
|
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,coordIndices->size()));
|
||||||
geom->addPrimitiveSet(blackPrimitives.get());
|
|
||||||
|
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
geode->addDrawable(geom);
|
geode->addDrawable(geom);
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ osg::Geometry* createEaseMotionGeometry(osgAnimation::Motion* motion) {
|
|||||||
|
|
||||||
geom->setUseDisplayList(false);
|
geom->setUseDisplayList(false);
|
||||||
geom->setVertexArray(v);
|
geom->setVertexArray(v);
|
||||||
geom->setColorArray(cols, osg::Array::BIND_OVERALL);
|
geom->setColorArray(cols);
|
||||||
|
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, 0, v->size()));
|
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, 0, v->size()));
|
||||||
|
|
||||||
return geom;
|
return geom;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ struct MyRigTransformHardware : public osgAnimation::RigTransformHardware
|
|||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "boneWeight" << i;
|
ss << "boneWeight" << i;
|
||||||
geom.setVertexAttribArray(attribIndex + i, getVertexAttrib(i));
|
geom.setVertexAttribData(attribIndex + i, osg::Geometry::ArrayData(getVertexAttrib(i),osg::Geometry::BIND_PER_VERTEX));
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::StateSet> ss = new osg::StateSet;
|
osg::ref_ptr<osg::StateSet> ss = new osg::StateSet;
|
||||||
|
|||||||
@@ -168,7 +168,9 @@ osg::Geode* createAxis()
|
|||||||
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
|
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
|
||||||
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
|
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
|
||||||
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
|
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
|
||||||
geometry->setColorArray (colors.get(), osg::Array::BIND_PER_VERTEX);
|
geometry->setColorArray (colors.get());
|
||||||
|
|
||||||
|
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
|
||||||
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
|
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
|
||||||
|
|
||||||
geode->addDrawable( geometry.get() );
|
geode->addDrawable( geometry.get() );
|
||||||
|
|||||||
@@ -53,7 +53,9 @@ osg::Geode* createAxis()
|
|||||||
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
|
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
|
||||||
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
|
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
|
||||||
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
|
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
|
||||||
geometry->setColorArray (colors, osg::Array::BIND_PER_VERTEX);
|
geometry->setColorArray (colors);
|
||||||
|
|
||||||
|
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
|
||||||
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
|
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
|
||||||
|
|
||||||
geode->addDrawable( geometry );
|
geode->addDrawable( geometry );
|
||||||
@@ -68,7 +70,8 @@ osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
|
|||||||
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
|
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
|
||||||
osg::ref_ptr<osg::Vec3Array> colors (new osg::Vec3Array());
|
osg::ref_ptr<osg::Vec3Array> colors (new osg::Vec3Array());
|
||||||
geometry->setVertexArray (vertices.get());
|
geometry->setVertexArray (vertices.get());
|
||||||
geometry->setColorArray (colors.get(), osg::Array::BIND_PER_VERTEX);
|
geometry->setColorArray (colors.get());
|
||||||
|
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
|
||||||
|
|
||||||
float step = size / static_cast<float>(nsplit);
|
float step = size / static_cast<float>(nsplit);
|
||||||
float s = 0.5f/4.0f;
|
float s = 0.5f/4.0f;
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ osg::ref_ptr<osg::Geode> createAxis()
|
|||||||
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
|
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
|
||||||
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
|
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
|
||||||
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
|
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
|
||||||
geometry->setColorArray (colors.get(), osg::Array::BIND_PER_VERTEX);
|
geometry->setColorArray (colors.get());
|
||||||
|
|
||||||
|
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
|
||||||
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
|
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
|
||||||
|
|
||||||
geode->addDrawable( geometry.get() );
|
geode->addDrawable( geometry.get() );
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ osg::Geode* createAxis()
|
|||||||
colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
|
colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
|
||||||
|
|
||||||
geometry->setVertexArray(vertices);
|
geometry->setVertexArray(vertices);
|
||||||
geometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
|
geometry->setColorArray(colors);
|
||||||
|
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||||
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, 6));
|
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, 6));
|
||||||
geometry->getOrCreateStateSet()->setMode(GL_LIGHTING, false);
|
geometry->getOrCreateStateSet()->setMode(GL_LIGHTING, false);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
SET(TARGET_SRC osgatomiccounter.cpp)
|
|
||||||
|
|
||||||
#### end var setup ###
|
|
||||||
SETUP_EXAMPLE(osgatomiccounter)
|
|
||||||
@@ -1,238 +0,0 @@
|
|||||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 2012-2012 David Callu
|
|
||||||
*
|
|
||||||
* This application is open source and may be redistributed and/or modified
|
|
||||||
* freely and without restriction, both in commercial and non commercial applications,
|
|
||||||
* as long as this copyright notice is maintained.
|
|
||||||
*
|
|
||||||
* This application is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <osg/BufferIndexBinding>
|
|
||||||
#include <osg/BufferObject>
|
|
||||||
#include <osg/Camera>
|
|
||||||
#include <osg/Program>
|
|
||||||
|
|
||||||
#include <osgDB/ReadFile>
|
|
||||||
#include <osgUtil/Optimizer>
|
|
||||||
|
|
||||||
#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>
|
|
||||||
|
|
||||||
|
|
||||||
class AdaptNumPixelUniform : public osg::Camera::DrawCallback
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AdaptNumPixelUniform()
|
|
||||||
{
|
|
||||||
_atomicCounterArray = new osg::UIntArray;
|
|
||||||
_atomicCounterArray->push_back(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void operator () (osg::RenderInfo& renderInfo) const
|
|
||||||
{
|
|
||||||
_acbb->readData(*renderInfo.getState(), *_atomicCounterArray);
|
|
||||||
unsigned int numPixel = osg::maximum(1u, _atomicCounterArray->front());
|
|
||||||
|
|
||||||
if ((renderInfo.getView()->getFrameStamp()->getFrameNumber() % 10) == 0)
|
|
||||||
{
|
|
||||||
OSG_INFO << "osgatomiccounter : draw " << numPixel << " pixels." << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
_invNumPixelUniform->set( 1.0f / static_cast<float>(numPixel) );
|
|
||||||
}
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Uniform> _invNumPixelUniform;
|
|
||||||
osg::ref_ptr<osg::UIntArray> _atomicCounterArray;
|
|
||||||
osg::ref_ptr<osg::AtomicCounterBufferBinding> _acbb;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
osg::Program * createProgram()
|
|
||||||
{
|
|
||||||
|
|
||||||
std::stringstream vp;
|
|
||||||
vp << "#version 420 compatibility\n"
|
|
||||||
<< "\n"
|
|
||||||
<< "void main(void)\n"
|
|
||||||
<< "{\n"
|
|
||||||
<< " gl_Position = ftransform();\n"
|
|
||||||
<< "}\n";
|
|
||||||
osg::Shader * vpShader = new osg::Shader( osg::Shader::VERTEX, vp.str() );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::stringstream fp;
|
|
||||||
fp << "#version 420 compatibility\n"
|
|
||||||
<< "\n"
|
|
||||||
<< "layout(binding = 0) uniform atomic_uint acRed;\n"
|
|
||||||
<< "layout(binding = 0, offset = 4) uniform atomic_uint acGreen;\n"
|
|
||||||
<< "layout(binding = 2) uniform atomic_uint acBlue;\n"
|
|
||||||
<< "\n"
|
|
||||||
<< "uniform float invNumPixel;\n"
|
|
||||||
<< "\n"
|
|
||||||
<< "void main(void)\n"
|
|
||||||
<< "{\n"
|
|
||||||
<< " float r = float(atomicCounterIncrement(acRed)) * invNumPixel;\n"
|
|
||||||
<< " float g = float(atomicCounterIncrement(acGreen)) * invNumPixel;\n"
|
|
||||||
<< " float b = float(atomicCounterIncrement(acBlue)) * invNumPixel;\n"
|
|
||||||
<< " gl_FragColor = vec4(r, g, b, 1.0);\n"
|
|
||||||
<< "}\n"
|
|
||||||
<< "\n";
|
|
||||||
osg::Shader * fpShader = new osg::Shader( osg::Shader::FRAGMENT, fp.str() );
|
|
||||||
|
|
||||||
osg::Program * program = new osg::Program;
|
|
||||||
program->addShader(vpShader);
|
|
||||||
program->addShader(fpShader);
|
|
||||||
|
|
||||||
return program;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ResetAtomicCounter : public osg::StateAttributeCallback
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual void operator () (osg::StateAttribute* sa, osg::NodeVisitor*)
|
|
||||||
{
|
|
||||||
osg::AtomicCounterBufferBinding * acbb = dynamic_cast<osg::AtomicCounterBufferBinding *>(sa);
|
|
||||||
if (acbb)
|
|
||||||
{
|
|
||||||
osg::AtomicCounterBufferObject * acbo = dynamic_cast<osg::AtomicCounterBufferObject*>(acbb->getBufferObject());
|
|
||||||
if (acbo && acbo->getBufferData(0))
|
|
||||||
{
|
|
||||||
acbo->getBufferData(0)->dirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
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 a simple example which show draw order of pixel.");
|
|
||||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up the camera manipulators.
|
|
||||||
viewer.setCameraManipulator( new osgGA::TrackballManipulator() );
|
|
||||||
|
|
||||||
// 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 screen capture handler
|
|
||||||
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
|
|
||||||
|
|
||||||
// load the data
|
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
|
||||||
if (!loadedModel)
|
|
||||||
{
|
|
||||||
osg::Geometry * quad = osg::createTexturedQuadGeometry(osg::Vec3f(-2.0f, 0.0f, -2.0f),
|
|
||||||
osg::Vec3f(2.0f, 0.0f, 0.0f),
|
|
||||||
osg::Vec3f(0.0f, 0.0f, 2.0f) );
|
|
||||||
|
|
||||||
osg::Geode * geode = new osg::Geode;
|
|
||||||
geode->addDrawable(quad);
|
|
||||||
loadedModel = geode;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
osg::StateSet * ss = loadedModel->asGeode()->getDrawable(0)->getOrCreateStateSet();
|
|
||||||
ss->setAttributeAndModes( createProgram(), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE | osg::StateAttribute::PROTECTED );
|
|
||||||
|
|
||||||
ss = loadedModel->getOrCreateStateSet();
|
|
||||||
osg::ref_ptr<osg::UIntArray> atomicCounterArrayRedAndGreen = new osg::UIntArray;
|
|
||||||
atomicCounterArrayRedAndGreen->push_back(0);
|
|
||||||
atomicCounterArrayRedAndGreen->push_back(0);
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::UIntArray> atomicCounterArrayBlue = new osg::UIntArray;
|
|
||||||
atomicCounterArrayBlue->push_back(0);
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::AtomicCounterBufferObject> acboRedAndGreen = new osg::AtomicCounterBufferObject;
|
|
||||||
acboRedAndGreen->setUsage(GL_STREAM_COPY);
|
|
||||||
atomicCounterArrayRedAndGreen->setBufferObject(acboRedAndGreen.get());
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::AtomicCounterBufferObject> acboBlue = new osg::AtomicCounterBufferObject;
|
|
||||||
acboBlue->setUsage(GL_STREAM_COPY);
|
|
||||||
atomicCounterArrayBlue->setBufferObject(acboBlue.get());
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::AtomicCounterBufferBinding> acbbRedAndGreen = new osg::AtomicCounterBufferBinding(0, acboRedAndGreen.get(), 0, sizeof(GLuint)*3);
|
|
||||||
ss->setAttributeAndModes(acbbRedAndGreen.get());
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::AtomicCounterBufferBinding> acbbBlue = new osg::AtomicCounterBufferBinding(2, acboBlue.get(), 0, sizeof(GLuint));
|
|
||||||
ss->setAttributeAndModes(acbbBlue.get());
|
|
||||||
|
|
||||||
acbbRedAndGreen->setUpdateCallback(new ResetAtomicCounter);
|
|
||||||
acbbBlue->setUpdateCallback(new ResetAtomicCounter);
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Uniform> invNumPixelUniform = new osg::Uniform("invNumPixel", 1.0f/(800.0f*600.0f));
|
|
||||||
ss->addUniform( invNumPixelUniform.get() );
|
|
||||||
|
|
||||||
AdaptNumPixelUniform * drawCallback = new AdaptNumPixelUniform;
|
|
||||||
drawCallback->_invNumPixelUniform = invNumPixelUniform;
|
|
||||||
drawCallback->_acbb = acbbBlue;
|
|
||||||
|
|
||||||
viewer.getCamera()->setFinalDrawCallback(drawCallback);
|
|
||||||
|
|
||||||
// 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();
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -348,8 +348,6 @@ int main( int argc, char **argv )
|
|||||||
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
|
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
|
||||||
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
|
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
|
||||||
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
|
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
|
||||||
|
|
||||||
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,8 @@ osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::
|
|||||||
|
|
||||||
osg::Geometry* geom = new osg::Geometry;
|
osg::Geometry* geom = new osg::Geometry;
|
||||||
geom->setVertexArray(vertices);
|
geom->setVertexArray(vertices);
|
||||||
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
|
geom->setColorArray(colors);
|
||||||
|
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
geom->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP,0,vertices->size()));
|
geom->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP,0,vertices->size()));
|
||||||
|
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
@@ -139,7 +140,8 @@ osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::
|
|||||||
|
|
||||||
osg::Geometry* geom = new osg::Geometry;
|
osg::Geometry* geom = new osg::Geometry;
|
||||||
geom->setVertexArray(vertices);
|
geom->setVertexArray(vertices);
|
||||||
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
|
geom->setColorArray(colors);
|
||||||
|
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
geom->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP,0,vertices->size()));
|
geom->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP,0,vertices->size()));
|
||||||
|
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
|
|||||||
(*norms)[0] = width^height;
|
(*norms)[0] = width^height;
|
||||||
(*norms)[0].normalize();
|
(*norms)[0].normalize();
|
||||||
|
|
||||||
geom->setNormalArray(norms, osg::Array::BIND_OVERALL);
|
geom->setNormalArray(norms);
|
||||||
|
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
osg::Vec2Array* tcoords = new osg::Vec2Array(4);
|
osg::Vec2Array* tcoords = new osg::Vec2Array(4);
|
||||||
(*tcoords)[0].set(0.0f,0.0f);
|
(*tcoords)[0].set(0.0f,0.0f);
|
||||||
@@ -110,7 +111,8 @@ osg::Drawable* createAxis(const osg::Vec3& corner,const osg::Vec3& xdir,const os
|
|||||||
(*color)[4] = z_color;
|
(*color)[4] = z_color;
|
||||||
(*color)[5] = z_color;
|
(*color)[5] = z_color;
|
||||||
|
|
||||||
geom->setColorArray(color, osg::Array::BIND_PER_VERTEX);
|
geom->setColorArray(color);
|
||||||
|
geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||||
|
|
||||||
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
|
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
|
||||||
|
|
||||||
|
|||||||
@@ -241,14 +241,14 @@ class DataConverter
|
|||||||
inline void writeFloat(float c) { write4((char*)&c); }
|
inline void writeFloat(float c) { write4((char*)&c); }
|
||||||
inline void writeDouble(double c) { write8((char*)&c); }
|
inline void writeDouble(double c) { write8((char*)&c); }
|
||||||
|
|
||||||
inline char readChar() { char c=0; read1(&c); return c; }
|
inline char readChar() { char c; read1(&c); return c; }
|
||||||
inline unsigned char readUChar() { unsigned char c=0; read1((char*)&c); return c; }
|
inline unsigned char readUChar() { unsigned char c; read1((char*)&c); return c; }
|
||||||
inline short readShort() { short c=0; read2((char*)&c); return c; }
|
inline short readShort() { short c; read2((char*)&c); return c; }
|
||||||
inline unsigned short readUShort() { unsigned short c=0; read2((char*)&c); return c; }
|
inline unsigned short readUShort() { unsigned short c; read2((char*)&c); return c; }
|
||||||
inline int readInt() { int c=0; read4((char*)&c); return c; }
|
inline int readInt() { int c; read4((char*)&c); return c; }
|
||||||
inline unsigned int readUInt() { unsigned int c=0; read4((char*)&c); return c; }
|
inline unsigned int readUInt() { unsigned int c; read4((char*)&c); return c; }
|
||||||
inline float readFloat() { float c=0.0f; read4((char*)&c); return c; }
|
inline float readFloat() { float c; read4((char*)&c); return c; }
|
||||||
inline double readDouble() { double c=0.0; read8((char*)&c); return c; }
|
inline double readDouble() { double c; read8((char*)&c); return c; }
|
||||||
|
|
||||||
void write(const osg::FrameStamp& fs)
|
void write(const osg::FrameStamp& fs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
~PickHandler() {}
|
~PickHandler() {}
|
||||||
|
|
||||||
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
|
bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa)
|
||||||
{
|
{
|
||||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
|
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
|
||||||
if (!view) return false;
|
if (!view) return false;
|
||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (_mx==ea.getX() && _my==ea.getY())
|
if (_mx==ea.getX() && _my==ea.getY())
|
||||||
{
|
{
|
||||||
pick(view, ea);
|
pick(view, ea.getX(), ea.getY());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -81,13 +81,13 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pick(osgViewer::View* view, const osgGA::GUIEventAdapter& event)
|
void pick(osgViewer::View* view, float x, float y)
|
||||||
{
|
{
|
||||||
osg::Node* node = 0;
|
osg::Node* node = 0;
|
||||||
osg::Group* parent = 0;
|
osg::Group* parent = 0;
|
||||||
|
|
||||||
osgUtil::LineSegmentIntersector::Intersections intersections;
|
osgUtil::LineSegmentIntersector::Intersections intersections;
|
||||||
if (view->computeIntersections(event, intersections))
|
if (view->computeIntersections(x, y, intersections))
|
||||||
{
|
{
|
||||||
osgUtil::LineSegmentIntersector::Intersection intersection = *intersections.begin();
|
osgUtil::LineSegmentIntersector::Intersection intersection = *intersections.begin();
|
||||||
osg::NodePath& nodePath = intersection.nodePath;
|
osg::NodePath& nodePath = intersection.nodePath;
|
||||||
@@ -98,6 +98,7 @@ public:
|
|||||||
// now we try to decorate the hit node by the osgFX::Scribe to show that its been "picked"
|
// now we try to decorate the hit node by the osgFX::Scribe to show that its been "picked"
|
||||||
if (parent && node)
|
if (parent && node)
|
||||||
{
|
{
|
||||||
|
|
||||||
osgFX::Scribe* parentAsScribe = dynamic_cast<osgFX::Scribe*>(parent);
|
osgFX::Scribe* parentAsScribe = dynamic_cast<osgFX::Scribe*>(parent);
|
||||||
if (!parentAsScribe)
|
if (!parentAsScribe)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
SET(TARGET_SRC osgcomputeshaders.cpp)
|
|
||||||
SETUP_EXAMPLE(osgcomputeshaders)
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
/* -*-c++-*- OpenSceneGraph example, osgcomputeshaders.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Written by Wang Rui
|
|
||||||
// This example can work only if GL version is 4.3 or greater
|
|
||||||
|
|
||||||
#include <osg/Texture2D>
|
|
||||||
#include <osg/Geometry>
|
|
||||||
#include <osg/Geode>
|
|
||||||
#include <osgDB/ReadFile>
|
|
||||||
#include <osgGA/StateSetManipulator>
|
|
||||||
#include <osgViewer/Viewer>
|
|
||||||
#include <osgViewer/ViewerEventHandlers>
|
|
||||||
|
|
||||||
static const char* computeSrc = {
|
|
||||||
"#version 430\n"
|
|
||||||
"uniform float osg_FrameTime;\n"
|
|
||||||
"layout (r32f, binding =0) uniform image2D targetTex;\n"
|
|
||||||
"layout (local_size_x = 16, local_size_y = 16) in;\n"
|
|
||||||
"void main() {\n"
|
|
||||||
" ivec2 storePos = ivec2(gl_GlobalInvocationID.xy);\n"
|
|
||||||
" float coeffcient = 0.5*sin(float(gl_WorkGroupID.x + gl_WorkGroupID.y)*0.1 + osg_FrameTime);\n"
|
|
||||||
" coeffcient *= length(vec2(ivec2(gl_LocalInvocationID.xy) - ivec2(8)) / vec2(8.0));\n"
|
|
||||||
" imageStore(targetTex, storePos, vec4(1.0-coeffcient, 0.0, 0.0, 0.0));\n"
|
|
||||||
"}\n"
|
|
||||||
};
|
|
||||||
|
|
||||||
int main( int argc, char** argv )
|
|
||||||
{
|
|
||||||
osg::ArgumentParser arguments( &argc, argv );
|
|
||||||
|
|
||||||
// Create the texture as both the output of compute shader and the input of a normal quad
|
|
||||||
osg::ref_ptr<osg::Texture2D> tex2D = new osg::Texture2D;
|
|
||||||
tex2D->setTextureSize( 512, 512 );
|
|
||||||
tex2D->setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR );
|
|
||||||
tex2D->setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR );
|
|
||||||
tex2D->setInternalFormat( GL_R32F );
|
|
||||||
tex2D->setSourceFormat( GL_RED );
|
|
||||||
tex2D->setSourceType( GL_FLOAT );
|
|
||||||
tex2D->bindToImageUnit( 0, osg::Texture::WRITE_ONLY ); // So we can use 'image2D' in the compute shader
|
|
||||||
|
|
||||||
// The compute shader can't work with other kinds of shaders
|
|
||||||
// It also requires the work group numbers. Setting them to 0 will disable the compute shader
|
|
||||||
osg::ref_ptr<osg::Program> computeProg = new osg::Program;
|
|
||||||
computeProg->setComputeGroups( 512/16, 512/16, 1 );
|
|
||||||
computeProg->addShader( new osg::Shader(osg::Shader::COMPUTE, computeSrc) );
|
|
||||||
|
|
||||||
// Create a node for outputting to the texture.
|
|
||||||
// It is OK to have just an empty node here, but seems inbuilt uniforms like osg_FrameTime won't work then.
|
|
||||||
// TODO: maybe we can have a custom drawable which also will implement glMemoryBarrier?
|
|
||||||
osg::Node* sourceNode = osgDB::readNodeFile("axes.osgt");
|
|
||||||
if ( !sourceNode ) sourceNode = new osg::Node;
|
|
||||||
sourceNode->setDataVariance( osg::Object::DYNAMIC );
|
|
||||||
sourceNode->getOrCreateStateSet()->setAttributeAndModes( computeProg.get() );
|
|
||||||
sourceNode->getOrCreateStateSet()->addUniform( new osg::Uniform("targetTex", (int)0) );
|
|
||||||
sourceNode->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
|
|
||||||
|
|
||||||
// Display the texture on a quad. We will also be able to operate on the data if reading back to CPU side
|
|
||||||
osg::Geometry* geom = osg::createTexturedQuadGeometry(
|
|
||||||
osg::Vec3(), osg::Vec3(1.0f,0.0f,0.0f), osg::Vec3(0.0f,0.0f,1.0f) );
|
|
||||||
osg::ref_ptr<osg::Geode> quad = new osg::Geode;
|
|
||||||
quad->addDrawable( geom );
|
|
||||||
quad->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
|
|
||||||
quad->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
|
|
||||||
|
|
||||||
// Create the scene graph and start the viewer
|
|
||||||
osg::ref_ptr<osg::Group> scene = new osg::Group;
|
|
||||||
scene->addChild( sourceNode );
|
|
||||||
scene->addChild( quad.get() );
|
|
||||||
|
|
||||||
osgViewer::Viewer viewer;
|
|
||||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
|
||||||
viewer.addEventHandler( new osgViewer::StatsHandler );
|
|
||||||
viewer.addEventHandler( new osgViewer::WindowSizeHandler );
|
|
||||||
viewer.setSceneData( scene.get() );
|
|
||||||
return viewer.run();
|
|
||||||
}
|
|
||||||
@@ -113,10 +113,10 @@ public:
|
|||||||
|
|
||||||
/** return a geometry that fills the constraint.
|
/** return a geometry that fills the constraint.
|
||||||
*/
|
*/
|
||||||
virtual deprecated_osg::Geometry * makeAreal( osg::Vec3Array *points);
|
virtual osg::Geometry * makeAreal( osg::Vec3Array *points);
|
||||||
|
|
||||||
/** or create a wall around the constraint area: */
|
/** or create a wall around the constraint area: */
|
||||||
virtual deprecated_osg::Geometry * makeWallGeometry( osg::Vec3Array *points) ;
|
virtual osg::Geometry * makeWallGeometry( osg::Vec3Array *points) ;
|
||||||
|
|
||||||
/** for basic purposes, you can call these routines to make simple fill in geometries */
|
/** for basic purposes, you can call these routines to make simple fill in geometries */
|
||||||
virtual osg::DrawArrays* makeWall(void ) const;
|
virtual osg::DrawArrays* makeWall(void ) const;
|
||||||
@@ -166,7 +166,7 @@ public:
|
|||||||
|
|
||||||
/** return a geometry that fills the constraint.
|
/** return a geometry that fills the constraint.
|
||||||
*/
|
*/
|
||||||
virtual deprecated_osg::Geometry *makeGeometry(const osg::Vec3Array *points) ;
|
virtual osg::Geometry *makeGeometry(const osg::Vec3Array *points) ;
|
||||||
|
|
||||||
/** return normals array - flat shaded */
|
/** return normals array - flat shaded */
|
||||||
osg::Vec3Array* getNormals(const osg::Vec3Array *points);
|
osg::Vec3Array* getNormals(const osg::Vec3Array *points);
|
||||||
@@ -203,7 +203,7 @@ public:
|
|||||||
{
|
{
|
||||||
// create pyramid geometry. Centre plus points around base
|
// create pyramid geometry. Centre plus points around base
|
||||||
const osg::Vec3Array *_line= dynamic_cast<const osg::Vec3Array*>(getVertexArray());
|
const osg::Vec3Array *_line= dynamic_cast<const osg::Vec3Array*>(getVertexArray());
|
||||||
deprecated_osg::Geometry *gm=new deprecated_osg::Geometry;
|
osg::Geometry *gm=new osg::Geometry;
|
||||||
osg::Vec3Array *pts=new osg::Vec3Array;
|
osg::Vec3Array *pts=new osg::Vec3Array;
|
||||||
osg::Vec3Array *norms=new osg::Vec3Array;
|
osg::Vec3Array *norms=new osg::Vec3Array;
|
||||||
osg::Vec2Array *tcoords=new osg::Vec2Array;
|
osg::Vec2Array *tcoords=new osg::Vec2Array;
|
||||||
@@ -219,7 +219,7 @@ public:
|
|||||||
norms->push_back(nrm);
|
norms->push_back(nrm);
|
||||||
}
|
}
|
||||||
|
|
||||||
gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
|
gm->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE);
|
||||||
gm->setVertexArray(pts);
|
gm->setVertexArray(pts);
|
||||||
osg::StateSet *dstate= gm->getOrCreateStateSet( );
|
osg::StateSet *dstate= gm->getOrCreateStateSet( );
|
||||||
dstate->setMode( GL_LIGHTING, osg::StateAttribute::ON );
|
dstate->setMode( GL_LIGHTING, osg::StateAttribute::ON );
|
||||||
@@ -615,7 +615,7 @@ osg::Group *makedelaunay(const int ndcs)
|
|||||||
|
|
||||||
// Calculate the texture coordinates after triangulation as
|
// Calculate the texture coordinates after triangulation as
|
||||||
//the points may get disordered by the triangulate function
|
//the points may get disordered by the triangulate function
|
||||||
osg::ref_ptr<deprecated_osg::Geometry> gm=new deprecated_osg::Geometry;
|
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry;
|
||||||
gm->setVertexArray(points); // points may have been modified in order by triangulation.
|
gm->setVertexArray(points); // points may have been modified in order by triangulation.
|
||||||
/** calculate texture coords for terrain points */
|
/** calculate texture coords for terrain points */
|
||||||
if (image) {
|
if (image) {
|
||||||
@@ -629,7 +629,7 @@ osg::Group *makedelaunay(const int ndcs)
|
|||||||
}
|
}
|
||||||
gm->addPrimitiveSet(trig->getTriangles());
|
gm->addPrimitiveSet(trig->getTriangles());
|
||||||
gm->setNormalArray(trig->getOutputNormalArray());
|
gm->setNormalArray(trig->getOutputNormalArray());
|
||||||
gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
|
gm->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE);
|
||||||
geode->addDrawable(gm.get());
|
geode->addDrawable(gm.get());
|
||||||
if (ndcs>0) {
|
if (ndcs>0) {
|
||||||
for ( std::vector < pyramid* >::iterator itr=pyrlist.begin(); itr!=pyrlist.end(); itr++) {
|
for ( std::vector < pyramid* >::iterator itr=pyrlist.begin(); itr!=pyrlist.end(); itr++) {
|
||||||
@@ -836,7 +836,8 @@ osg::Geometry *WallConstraint::makeWallGeometry() const
|
|||||||
gm->setVertexArray(getWall(height));
|
gm->setVertexArray(getWall(height));
|
||||||
gm->addPrimitiveSet(makeWall());
|
gm->addPrimitiveSet(makeWall());
|
||||||
gm->setTexCoordArray(0,getWallTexcoords(height));
|
gm->setTexCoordArray(0,getWallTexcoords(height));
|
||||||
gm->setNormalArray(getWallNormals(), osg::Array::BIND_PER_VERTEX); // this creates normals to walls
|
gm->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||||
|
gm->setNormalArray(getWallNormals()); // this creates normals to walls
|
||||||
|
|
||||||
return gm.release();
|
return gm.release();
|
||||||
}
|
}
|
||||||
@@ -987,10 +988,10 @@ osg::DrawArrays * ArealConstraint::makeWall(void) const
|
|||||||
return (new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,2+2*_line->size()));
|
return (new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,2+2*_line->size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
deprecated_osg::Geometry *ArealConstraint::makeWallGeometry( osg::Vec3Array *pt)
|
osg::Geometry *ArealConstraint::makeWallGeometry( osg::Vec3Array *pt)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<deprecated_osg::Geometry> gm=new deprecated_osg::Geometry; // the wall
|
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry; // the wall
|
||||||
osg::ref_ptr<deprecated_osg::Geometry> edges=new deprecated_osg::Geometry; // edges of bounds
|
osg::ref_ptr<osg::Geometry> edges=new osg::Geometry; // edges of bounds
|
||||||
edges->setVertexArray(pt);
|
edges->setVertexArray(pt);
|
||||||
osg::DrawElementsUInt *trgeom=getTriangles();
|
osg::DrawElementsUInt *trgeom=getTriangles();
|
||||||
edges->addPrimitiveSet(trgeom);
|
edges->addPrimitiveSet(trgeom);
|
||||||
@@ -1051,16 +1052,16 @@ deprecated_osg::Geometry *ArealConstraint::makeWallGeometry( osg::Vec3Array *pt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
deprecated_osg::Geometry * ArealConstraint::makeAreal( osg::Vec3Array *points)
|
osg::Geometry * ArealConstraint::makeAreal( osg::Vec3Array *points)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<deprecated_osg::Geometry> gm; // the fill in area
|
osg::ref_ptr<osg::Geometry> gm; // the fill in area
|
||||||
if (_interiorTris.size()>0) {
|
if (_interiorTris.size()>0) {
|
||||||
gm =new deprecated_osg::Geometry; // the forest roof
|
gm =new osg::Geometry; // the forest roof
|
||||||
gm->setVertexArray(points);
|
gm->setVertexArray(points);
|
||||||
osg::DrawElementsUInt *trgeom=getTriangles();
|
osg::DrawElementsUInt *trgeom=getTriangles();
|
||||||
gm->addPrimitiveSet(trgeom);
|
gm->addPrimitiveSet(trgeom);
|
||||||
gm->setNormalArray(getCanopyNormals(points));
|
gm->setNormalArray(getCanopyNormals(points));
|
||||||
gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
|
gm->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE);
|
||||||
gm->setTexCoordArray(0,getCanopyTexcoords(points));
|
gm->setTexCoordArray(0,getCanopyTexcoords(points));
|
||||||
osg::Image* image = osgDB::readImageFile(texture);
|
osg::Image* image = osgDB::readImageFile(texture);
|
||||||
if (image)
|
if (image)
|
||||||
@@ -1232,9 +1233,9 @@ osg::Vec3Array * LinearConstraint::getNormals(const osg::Vec3Array *points)
|
|||||||
return norms.release();
|
return norms.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
deprecated_osg::Geometry * LinearConstraint::makeGeometry(const osg::Vec3Array *points)
|
osg::Geometry * LinearConstraint::makeGeometry(const osg::Vec3Array *points)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<deprecated_osg::Geometry> gm=new deprecated_osg::Geometry; // the fill in road/railway
|
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry; // the fill in road/railway
|
||||||
if (_midline->size()>0) {
|
if (_midline->size()>0) {
|
||||||
osg::ref_ptr<osg::Vec3Array> locpts=getPoints(points);
|
osg::ref_ptr<osg::Vec3Array> locpts=getPoints(points);
|
||||||
if (texture!="") {
|
if (texture!="") {
|
||||||
@@ -1257,7 +1258,7 @@ deprecated_osg::Geometry * LinearConstraint::makeGeometry(const osg::Vec3Array *
|
|||||||
}
|
}
|
||||||
gm->setVertexArray(locpts.get());
|
gm->setVertexArray(locpts.get());
|
||||||
gm->setNormalArray(getNormals(locpts.get()));
|
gm->setNormalArray(getNormals(locpts.get()));
|
||||||
gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
|
gm->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE);
|
||||||
gm->addPrimitiveSet(getTriangles());
|
gm->addPrimitiveSet(getTriangles());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ osg::Node* createScene()
|
|||||||
{
|
{
|
||||||
osg::Vec4Array * colours = new osg::Vec4Array(1);
|
osg::Vec4Array * colours = new osg::Vec4Array(1);
|
||||||
(*colours)[0] = osg::Vec4d(1.0,1.0,1.0,1.0);
|
(*colours)[0] = osg::Vec4d(1.0,1.0,1.0,1.0);
|
||||||
unitCircle->setColorArray(colours, osg::Array::BIND_OVERALL);
|
unitCircle->setColorArray(colours);
|
||||||
|
unitCircle->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
const unsigned int n_points = 1024;
|
const unsigned int n_points = 1024;
|
||||||
osg::Vec3Array * coords = new osg::Vec3Array(n_points);
|
osg::Vec3Array * coords = new osg::Vec3Array(n_points);
|
||||||
const double dx = 2.0*osg::PI/n_points;
|
const double dx = 2.0*osg::PI/n_points;
|
||||||
@@ -87,7 +88,8 @@ osg::Node* createScene()
|
|||||||
{
|
{
|
||||||
osg::Vec4Array *colours = new osg::Vec4Array(1);
|
osg::Vec4Array *colours = new osg::Vec4Array(1);
|
||||||
(*colours)[0] = osg::Vec4d(1.0,0.0,0.0,1.0);
|
(*colours)[0] = osg::Vec4d(1.0,0.0,0.0,1.0);
|
||||||
axes->setColorArray(colours, osg::Array::BIND_OVERALL);
|
axes->setColorArray(colours);
|
||||||
|
axes->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
osg::Vec3Array *coords = new osg::Vec3Array(6);
|
osg::Vec3Array *coords = new osg::Vec3Array(6);
|
||||||
(*coords)[0].set(osg::Vec3d(0.0, 0.0, 0.0));
|
(*coords)[0].set(osg::Vec3d(0.0, 0.0, 0.0));
|
||||||
(*coords)[1].set(osg::Vec3d(0.5, 0.0, 0.0));
|
(*coords)[1].set(osg::Vec3d(0.5, 0.0, 0.0));
|
||||||
|
|||||||
@@ -318,11 +318,13 @@ bool DePee::createHUD()
|
|||||||
|
|
||||||
osg::Vec3Array* normals = new osg::Vec3Array;
|
osg::Vec3Array* normals = new osg::Vec3Array;
|
||||||
normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
|
normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
|
||||||
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
geom->setNormalArray(normals);
|
||||||
|
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||||
colors->push_back(osg::Vec4(0.0f,0.0,0.0f,0.3f));
|
colors->push_back(osg::Vec4(0.0f,0.0,0.0f,0.3f));
|
||||||
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
|
geom->setColorArray(colors);
|
||||||
|
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));
|
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));
|
||||||
|
|
||||||
|
|||||||
@@ -51,14 +51,14 @@ osg::Program* Utility::createProgram(std::string vs, std::string fs)
|
|||||||
if(!readFile((char*)vs.c_str(), vertSource))
|
if(!readFile((char*)vs.c_str(), vertSource))
|
||||||
{
|
{
|
||||||
printf("shader source not found\n");
|
printf("shader source not found\n");
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string fragSource;
|
std::string fragSource;
|
||||||
if(!readFile((char*)fs.c_str(), fragSource))
|
if(!readFile((char*)fs.c_str(), fragSource))
|
||||||
{
|
{
|
||||||
printf("shader source not found\n");
|
printf("shader source not found\n");
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -142,7 +142,8 @@ osg::Geode* Utility::getCanvasQuad(unsigned width, unsigned height, double depth
|
|||||||
|
|
||||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||||
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
|
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
|
||||||
quad->setColorArray(colors, osg::Array::BIND_OVERALL);
|
quad->setColorArray(colors);
|
||||||
|
quad->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
osg::Geode* geode = new osg::Geode();
|
osg::Geode* geode = new osg::Geode();
|
||||||
geode->addDrawable(quad);
|
geode->addDrawable(quad);
|
||||||
|
|||||||
@@ -141,7 +141,8 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
|
|||||||
// pass the created vertex array to the points geometry object.
|
// pass the created vertex array to the points geometry object.
|
||||||
polyGeom->setVertexArray(vertices);
|
polyGeom->setVertexArray(vertices);
|
||||||
|
|
||||||
polyGeom->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
|
polyGeom->setColorArray(colors);
|
||||||
|
polyGeom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||||
|
|
||||||
polyGeom->setTexCoordArray(0,texcoords);
|
polyGeom->setTexCoordArray(0,texcoords);
|
||||||
|
|
||||||
@@ -419,7 +420,8 @@ osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3
|
|||||||
// pass the created vertex array to the points geometry object.
|
// pass the created vertex array to the points geometry object.
|
||||||
geometry->setVertexArray(vertices);
|
geometry->setVertexArray(vertices);
|
||||||
|
|
||||||
geometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
|
geometry->setColorArray(colors);
|
||||||
|
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||||
|
|
||||||
geometry->setTexCoordArray(0,texcoords);
|
geometry->setTexCoordArray(0,texcoords);
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,6 @@
|
|||||||
#include <osg/StateSet>
|
#include <osg/StateSet>
|
||||||
#include <osg/Switch>
|
#include <osg/Switch>
|
||||||
#include <osg/Texture2D>
|
#include <osg/Texture2D>
|
||||||
#include <osg/TextureBuffer>
|
|
||||||
#include <osg/Image>
|
|
||||||
#include <osg/TexEnv>
|
#include <osg/TexEnv>
|
||||||
#include <osg/VertexProgram>
|
#include <osg/VertexProgram>
|
||||||
#include <osg/FragmentProgram>
|
#include <osg/FragmentProgram>
|
||||||
@@ -142,15 +140,9 @@ public:
|
|||||||
|
|
||||||
osg::Node* createShaderGraph(Cell* cell,osg::StateSet* stateset);
|
osg::Node* createShaderGraph(Cell* cell,osg::StateSet* stateset);
|
||||||
|
|
||||||
osg::Node* createGeometryShaderGraph(Cell* cell, osg::StateSet* stateset);
|
|
||||||
|
|
||||||
osg::Node* createTextureBufferGraph(Cell* cell, osg::Geometry* templateGeometry);
|
|
||||||
|
|
||||||
void CollectTreePositions(Cell* cell, std::vector< osg::Vec3 >& positions);
|
|
||||||
|
|
||||||
osg::Node* createHUDWithText(const std::string& text);
|
osg::Node* createHUDWithText(const std::string& text);
|
||||||
|
|
||||||
osg::Node* createScene(unsigned int numTreesToCreates, unsigned int maxNumTreesPerCell);
|
osg::Node* createScene(unsigned int numTreesToCreates);
|
||||||
|
|
||||||
void advanceToNextTechnique(int delta=1)
|
void advanceToNextTechnique(int delta=1)
|
||||||
{
|
{
|
||||||
@@ -474,7 +466,8 @@ osg::Geode* ForestTechniqueManager::createTerrain(const osg::Vec3& origin, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
geometry->setVertexArray(&v);
|
geometry->setVertexArray(&v);
|
||||||
geometry->setColorArray(&color, osg::Array::BIND_OVERALL);
|
geometry->setColorArray(&color);
|
||||||
|
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
geometry->setTexCoordArray(0,&t);
|
geometry->setTexCoordArray(0,&t);
|
||||||
|
|
||||||
for(r=0;r<numRows-1;++r)
|
for(r=0;r<numRows-1;++r)
|
||||||
@@ -570,7 +563,8 @@ osg::Geometry* ForestTechniqueManager::createSprite( float w, float h, osg::Vec4
|
|||||||
|
|
||||||
geom->setTexCoordArray( 0, &t );
|
geom->setTexCoordArray( 0, &t );
|
||||||
|
|
||||||
geom->setColorArray( &c, osg::Array::BIND_OVERALL );
|
geom->setColorArray( &c );
|
||||||
|
geom->setColorBinding( osg::Geometry::BIND_OVERALL );
|
||||||
|
|
||||||
geom->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4) );
|
geom->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4) );
|
||||||
|
|
||||||
@@ -616,7 +610,8 @@ osg::Geometry* ForestTechniqueManager::createOrthogonalQuads( const osg::Vec3& p
|
|||||||
|
|
||||||
geom->setTexCoordArray( 0, &t );
|
geom->setTexCoordArray( 0, &t );
|
||||||
|
|
||||||
geom->setColorArray( &c, osg::Array::BIND_OVERALL );
|
geom->setColorArray( &c );
|
||||||
|
geom->setColorBinding( osg::Geometry::BIND_OVERALL );
|
||||||
|
|
||||||
geom->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,8) );
|
geom->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,8) );
|
||||||
|
|
||||||
@@ -850,218 +845,6 @@ class ShaderGeometry : public osg::Drawable
|
|||||||
|
|
||||||
osg::Geometry* shared_geometry = 0;
|
osg::Geometry* shared_geometry = 0;
|
||||||
|
|
||||||
osg::Program* createGeometryShader()
|
|
||||||
{
|
|
||||||
static const char* vertSource = {
|
|
||||||
"#version 120\n"
|
|
||||||
"#extension GL_EXT_geometry_shader4 : enable\n"
|
|
||||||
"varying vec2 texcoord;\n"
|
|
||||||
"void main(void)\n"
|
|
||||||
"{\n"
|
|
||||||
" gl_Position = gl_Vertex;\n"
|
|
||||||
" texcoord = gl_MultiTexCoord0.st;\n"
|
|
||||||
"}\n"
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char* geomSource = {
|
|
||||||
"#version 120\n"
|
|
||||||
"#extension GL_EXT_geometry_shader4 : enable\n"
|
|
||||||
"varying vec2 texcoord;\n"
|
|
||||||
"varying float intensity; \n"
|
|
||||||
"varying float red_intensity; \n"
|
|
||||||
"void main(void)\n"
|
|
||||||
"{\n"
|
|
||||||
" vec4 v = gl_PositionIn[0];\n"
|
|
||||||
" vec4 info = gl_PositionIn[1];\n"
|
|
||||||
" intensity = info.y;\n"
|
|
||||||
" red_intensity = info.z;\n"
|
|
||||||
"\n"
|
|
||||||
" float h = info.x;\n"
|
|
||||||
" float w = h*0.35;\n"
|
|
||||||
" vec4 e;\n"
|
|
||||||
" e = v + vec4(-w,0.0,0.0,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(0.0,0.0); EmitVertex();\n"
|
|
||||||
" e = v + vec4(w,0.0,0.0,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(1.0,0.0); EmitVertex();\n"
|
|
||||||
" e = v + vec4(-w,0.0,h,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(0.0,1.0); EmitVertex();\n"
|
|
||||||
" e = v + vec4(w,0.0,h,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(1.0,1.0); EmitVertex();\n"
|
|
||||||
" EndPrimitive();\n"
|
|
||||||
" e = v + vec4(0.0,-w,0.0,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(0.0,0.0); EmitVertex();\n"
|
|
||||||
" e = v + vec4(0.0,w,0.0,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(1.0,0.0); EmitVertex();\n"
|
|
||||||
" e = v + vec4(0.0,-w,h,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(0.0,1.0); EmitVertex();\n"
|
|
||||||
" e = v + vec4(0.0,w,h,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(1.0,1.0); EmitVertex();\n"
|
|
||||||
" EndPrimitive();\n"
|
|
||||||
"}\n"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static const char* fragSource = {
|
|
||||||
"uniform sampler2D baseTexture; \n"
|
|
||||||
"varying vec2 texcoord; \n"
|
|
||||||
"varying float intensity; \n"
|
|
||||||
"varying float red_intensity; \n"
|
|
||||||
"\n"
|
|
||||||
"void main(void) \n"
|
|
||||||
"{ \n"
|
|
||||||
" vec4 finalColor = texture2D( baseTexture, texcoord); \n"
|
|
||||||
" vec4 color = finalColor * intensity;\n"
|
|
||||||
" color.w = finalColor.w;\n"
|
|
||||||
" color.x *= red_intensity;\n"
|
|
||||||
" gl_FragColor = color;\n"
|
|
||||||
"}\n"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
osg::Program* pgm = new osg::Program;
|
|
||||||
pgm->setName( "osgshader2 demo" );
|
|
||||||
|
|
||||||
pgm->addShader( new osg::Shader( osg::Shader::VERTEX, vertSource ) );
|
|
||||||
pgm->addShader( new osg::Shader( osg::Shader::FRAGMENT, fragSource ) );
|
|
||||||
|
|
||||||
pgm->addShader( new osg::Shader( osg::Shader::GEOMETRY, geomSource ) );
|
|
||||||
pgm->setParameter( GL_GEOMETRY_VERTICES_OUT_EXT, 8 );
|
|
||||||
pgm->setParameter( GL_GEOMETRY_INPUT_TYPE_EXT, GL_LINES );
|
|
||||||
pgm->setParameter( GL_GEOMETRY_OUTPUT_TYPE_EXT, GL_TRIANGLE_STRIP);
|
|
||||||
|
|
||||||
return pgm;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ForestTechniqueManager::CollectTreePositions(Cell* cell, std::vector< osg::Vec3 >& positions)
|
|
||||||
{
|
|
||||||
bool needGroup = !(cell->_cells.empty());
|
|
||||||
bool needTrees = !(cell->_trees.empty());
|
|
||||||
|
|
||||||
if (needTrees)
|
|
||||||
{
|
|
||||||
for(TreeList::iterator itr=cell->_trees.begin();
|
|
||||||
itr!=cell->_trees.end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
Tree& tree = **itr;
|
|
||||||
positions.push_back(tree._position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (needGroup)
|
|
||||||
{
|
|
||||||
for(Cell::CellList::iterator itr=cell->_cells.begin();
|
|
||||||
itr!=cell->_cells.end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
CollectTreePositions(itr->get(),positions);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
osg::Node* ForestTechniqueManager::createGeometryShaderGraph(Cell* cell, osg::StateSet* dstate)
|
|
||||||
{
|
|
||||||
bool needGroup = !(cell->_cells.empty());
|
|
||||||
bool needTrees = !(cell->_trees.empty());
|
|
||||||
|
|
||||||
osg::Geode* geode = 0;
|
|
||||||
osg::Group* group = 0;
|
|
||||||
|
|
||||||
if (needTrees)
|
|
||||||
{
|
|
||||||
geode = new osg::Geode;
|
|
||||||
geode->setStateSet(dstate);
|
|
||||||
|
|
||||||
osg::Geometry* geometry = new osg::Geometry;
|
|
||||||
geode->addDrawable(geometry);
|
|
||||||
|
|
||||||
osg::Vec3Array* v = new osg::Vec3Array;
|
|
||||||
|
|
||||||
for(TreeList::iterator itr=cell->_trees.begin();
|
|
||||||
itr!=cell->_trees.end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
Tree& tree = **itr;
|
|
||||||
v->push_back(tree._position);
|
|
||||||
v->push_back(osg::Vec3(/*tree._height*/30.0,(double)random(0.75f,1.15f),(double)random(1.0f,1.250f)));
|
|
||||||
}
|
|
||||||
geometry->setVertexArray( v );
|
|
||||||
geometry->addPrimitiveSet( new osg::DrawArrays( GL_LINES, 0, v->size() ) );
|
|
||||||
|
|
||||||
osg::StateSet* sset = geode->getOrCreateStateSet();
|
|
||||||
sset->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
|
|
||||||
sset->setAttribute( createGeometryShader() );
|
|
||||||
|
|
||||||
osg::Uniform* baseTextureSampler = new osg::Uniform("baseTexture",0);
|
|
||||||
sset->addUniform(baseTextureSampler);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (needGroup)
|
|
||||||
{
|
|
||||||
group = new osg::Group;
|
|
||||||
for(Cell::CellList::iterator itr=cell->_cells.begin();
|
|
||||||
itr!=cell->_cells.end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
group->addChild(createGeometryShaderGraph(itr->get(),dstate));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (geode) group->addChild(geode);
|
|
||||||
|
|
||||||
}
|
|
||||||
if (group) return group;
|
|
||||||
else return geode;
|
|
||||||
}
|
|
||||||
|
|
||||||
osg::Node* ForestTechniqueManager::createTextureBufferGraph(Cell* cell, osg::Geometry* templateGeometry)
|
|
||||||
{
|
|
||||||
bool needGroup = !(cell->_cells.empty());
|
|
||||||
bool needTrees = !(cell->_trees.empty());
|
|
||||||
|
|
||||||
osg::Geode* geode = 0;
|
|
||||||
osg::Group* group = 0;
|
|
||||||
|
|
||||||
if (needTrees)
|
|
||||||
{
|
|
||||||
osg::Geometry* geometry = (osg::Geometry*)templateGeometry->clone( osg::CopyOp::DEEP_COPY_PRIMITIVES );
|
|
||||||
osg::DrawArrays* primSet = dynamic_cast<osg::DrawArrays*>( geometry->getPrimitiveSet(0) );
|
|
||||||
primSet->setNumInstances( cell->_trees.size() );
|
|
||||||
geode = new osg::Geode;
|
|
||||||
geode->addDrawable(geometry);
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Image> treeParamsImage = new osg::Image;
|
|
||||||
treeParamsImage->allocateImage( 3*cell->_trees.size(), 1, 1, GL_RGBA, GL_FLOAT );
|
|
||||||
|
|
||||||
unsigned int i=0;
|
|
||||||
for(TreeList::iterator itr=cell->_trees.begin();
|
|
||||||
itr!=cell->_trees.end();
|
|
||||||
++itr,++i)
|
|
||||||
{
|
|
||||||
osg::Vec4f* ptr = (osg::Vec4f*)treeParamsImage->data(3*i);
|
|
||||||
Tree& tree = **itr;
|
|
||||||
ptr[0] = osg::Vec4f(tree._position.x(),tree._position.y(),tree._position.z(),1.0);
|
|
||||||
ptr[1] = osg::Vec4f((float)tree._color.r()/255.0f,(float)tree._color.g()/255.0f, (float)tree._color.b()/255.0f, 1.0);
|
|
||||||
ptr[2] = osg::Vec4f(tree._width, tree._height, 1.0, 1.0);
|
|
||||||
}
|
|
||||||
osg::ref_ptr<osg::TextureBuffer> tbo = new osg::TextureBuffer;
|
|
||||||
tbo->setImage( treeParamsImage.get() );
|
|
||||||
tbo->setInternalFormat(GL_RGBA32F_ARB);
|
|
||||||
geometry->getOrCreateStateSet()->setTextureAttribute(1, tbo.get());
|
|
||||||
geometry->setInitialBound( cell->_bb );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (needGroup)
|
|
||||||
{
|
|
||||||
group = new osg::Group;
|
|
||||||
for(Cell::CellList::iterator itr=cell->_cells.begin();
|
|
||||||
itr!=cell->_cells.end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
group->addChild(createTextureBufferGraph(itr->get(),templateGeometry));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (geode) group->addChild(geode);
|
|
||||||
|
|
||||||
}
|
|
||||||
if (group) return group;
|
|
||||||
else return geode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
osg::Node* ForestTechniqueManager::createShaderGraph(Cell* cell,osg::StateSet* stateset)
|
osg::Node* ForestTechniqueManager::createShaderGraph(Cell* cell,osg::StateSet* stateset)
|
||||||
{
|
{
|
||||||
if (shared_geometry==0)
|
if (shared_geometry==0)
|
||||||
@@ -1158,7 +941,7 @@ osg::Node* ForestTechniqueManager::createHUDWithText(const std::string& str)
|
|||||||
return projection;
|
return projection;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates, unsigned int maxNumTreesPerCell)
|
osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
|
||||||
{
|
{
|
||||||
osg::Vec3 origin(0.0f,0.0f,0.0f);
|
osg::Vec3 origin(0.0f,0.0f,0.0f);
|
||||||
osg::Vec3 size(1000.0f,1000.0f,200.0f);
|
osg::Vec3 size(1000.0f,1000.0f,200.0f);
|
||||||
@@ -1175,8 +958,8 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates, u
|
|||||||
std::cout<<"Creating cell subdivision...";
|
std::cout<<"Creating cell subdivision...";
|
||||||
osg::ref_ptr<Cell> cell = new Cell;
|
osg::ref_ptr<Cell> cell = new Cell;
|
||||||
cell->addTrees(trees);
|
cell->addTrees(trees);
|
||||||
cell->divide(maxNumTreesPerCell);
|
cell->divide();
|
||||||
std::cout<<"done."<<std::endl;
|
std::cout<<"done."<<std::endl;
|
||||||
|
|
||||||
|
|
||||||
osg::Texture2D *tex = new osg::Texture2D;
|
osg::Texture2D *tex = new osg::Texture2D;
|
||||||
@@ -1208,7 +991,7 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates, u
|
|||||||
std::cout<<"Creating osg::Billboard based forest...";
|
std::cout<<"Creating osg::Billboard based forest...";
|
||||||
osg::Group* group = new osg::Group;
|
osg::Group* group = new osg::Group;
|
||||||
group->addChild(createBillboardGraph(cell.get(),dstate));
|
group->addChild(createBillboardGraph(cell.get(),dstate));
|
||||||
group->addChild(createHUDWithText("Using osg::Billboard's to create a forest\n\nPress left cursor key to select geometry instancing with Texture Buffer Object\nPress right cursor key to select double quad based forest"));
|
group->addChild(createHUDWithText("Using osg::Billboard's to create a forest\n\nPress left cursor key to select OpenGL shader based forest\nPress right cursor key to select double quad based forest"));
|
||||||
_techniqueSwitch->addChild(group);
|
_techniqueSwitch->addChild(group);
|
||||||
std::cout<<"done."<<std::endl;
|
std::cout<<"done."<<std::endl;
|
||||||
}
|
}
|
||||||
@@ -1252,7 +1035,7 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates, u
|
|||||||
|
|
||||||
"TEMP position;\n"
|
"TEMP position;\n"
|
||||||
|
|
||||||
// vec3 position = gl_Vertex.xyz * gl_Color.w + gl_Color.xyz;
|
// vec3 position = gl_Vertex.xyz * gl_Color.w + gl_Color.xyz;
|
||||||
"MAD position, vpos, vcol.w, vcol;\n"
|
"MAD position, vpos, vcol.w, vcol;\n"
|
||||||
|
|
||||||
// gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0);
|
// gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0);
|
||||||
@@ -1265,7 +1048,7 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates, u
|
|||||||
// gl_FrontColor = vec4(1.0,1.0,1.0,1.0);
|
// gl_FrontColor = vec4(1.0,1.0,1.0,1.0);
|
||||||
"MOV result.color.front.primary, one;\n"
|
"MOV result.color.front.primary, one;\n"
|
||||||
|
|
||||||
// texcoord = gl_MultiTexCoord0.st;
|
// texcoord = gl_MultiTexCoord0.st;
|
||||||
"MOV result.texcoord, tc;\n"
|
"MOV result.texcoord, tc;\n"
|
||||||
"END\n";
|
"END\n";
|
||||||
|
|
||||||
@@ -1349,93 +1132,11 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
group->addChild(createShaderGraph(cell.get(),stateset));
|
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::Vertex/Geometry/FragmentProgram based forest"));
|
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"));
|
||||||
_techniqueSwitch->addChild(group);
|
_techniqueSwitch->addChild(group);
|
||||||
std::cout<<"done."<<std::endl;
|
std::cout<<"done."<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
std::cout<<"Creating Geometry Shader based forest...";
|
|
||||||
|
|
||||||
osg::StateSet* stateset = new osg::StateSet(*dstate, osg::CopyOp::DEEP_COPY_ALL);
|
|
||||||
|
|
||||||
osg::Group* group = new osg::Group;
|
|
||||||
group->addChild(createGeometryShaderGraph(cell.get(), stateset));
|
|
||||||
group->addChild(createHUDWithText("Using osg::Vertex/Geometry/FragmentProgram to create a forest\n\nPress left cursor key to select OpenGL Shader based forest\nPress right cursor key to select geometry instancing with Texture Buffer Object"));
|
|
||||||
|
|
||||||
_techniqueSwitch->addChild(group);
|
|
||||||
std::cout<<"done."<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
std::cout<<"Creating forest using geometry instancing and texture buffer objects ...";
|
|
||||||
|
|
||||||
osg::StateSet* stateset = new osg::StateSet(*dstate, osg::CopyOp::DEEP_COPY_ALL);
|
|
||||||
{
|
|
||||||
osg::Program* program = new osg::Program;
|
|
||||||
stateset->setAttribute(program);
|
|
||||||
|
|
||||||
char vertexShaderSource[] =
|
|
||||||
"#version 420 compatibility\n"
|
|
||||||
"uniform samplerBuffer dataBuffer;\n"
|
|
||||||
"layout(location = 0) in vec3 VertexPosition;\n"
|
|
||||||
"layout(location = 8) in vec3 VertexTexCoord;\n"
|
|
||||||
"out vec2 TexCoord;\n"
|
|
||||||
"out vec4 Color;\n"
|
|
||||||
"void main()\n"
|
|
||||||
"{\n"
|
|
||||||
" int instanceAddress = gl_InstanceID * 3;\n"
|
|
||||||
" vec3 position = texelFetch(dataBuffer, instanceAddress).xyz;\n"
|
|
||||||
" Color = texelFetch(dataBuffer, instanceAddress + 1);\n"
|
|
||||||
" vec2 size = texelFetch(dataBuffer, instanceAddress + 2).xy;\n"
|
|
||||||
" mat4 mvpMatrix = gl_ModelViewProjectionMatrix *\n"
|
|
||||||
" mat4( size.x, 0.0, 0.0, 0.0,\n"
|
|
||||||
" 0.0, size.x, 0.0, 0.0,\n"
|
|
||||||
" 0.0, 0.0, size.y, 0.0,\n"
|
|
||||||
" position.x, position.y, position.z, 1.0);\n"
|
|
||||||
" gl_Position = mvpMatrix * vec4(VertexPosition,1.0) ;\n"
|
|
||||||
" TexCoord = VertexTexCoord.xy;\n"
|
|
||||||
"}\n";
|
|
||||||
|
|
||||||
char fragmentShaderSource[] =
|
|
||||||
"#version 420 core\n"
|
|
||||||
"uniform sampler2D baseTexture; \n"
|
|
||||||
"in vec2 TexCoord;\n"
|
|
||||||
"in vec4 Color;\n"
|
|
||||||
"layout(location = 0, index = 0) out vec4 FragData0;\n"
|
|
||||||
"void main(void) \n"
|
|
||||||
"{\n"
|
|
||||||
" FragData0 = Color*texture(baseTexture, TexCoord);\n"
|
|
||||||
"}\n";
|
|
||||||
|
|
||||||
osg::Shader* vertex_shader = new osg::Shader(osg::Shader::VERTEX, vertexShaderSource);
|
|
||||||
program->addShader(vertex_shader);
|
|
||||||
|
|
||||||
osg::Shader* fragment_shader = new osg::Shader(osg::Shader::FRAGMENT, fragmentShaderSource);
|
|
||||||
program->addShader(fragment_shader);
|
|
||||||
|
|
||||||
osg::Uniform* baseTextureSampler = new osg::Uniform("baseTexture",0);
|
|
||||||
stateset->addUniform(baseTextureSampler);
|
|
||||||
|
|
||||||
osg::Uniform* dataBufferSampler = new osg::Uniform("dataBuffer",1);
|
|
||||||
stateset->addUniform(dataBufferSampler);
|
|
||||||
}
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Geometry> templateGeometry = createOrthogonalQuadsNoColor(osg::Vec3(0.0f,0.0f,0.0f),1.0f,1.0f);
|
|
||||||
templateGeometry->setUseVertexBufferObjects(true);
|
|
||||||
templateGeometry->setUseDisplayList(false);
|
|
||||||
osg::Node* textureBufferGraph = createTextureBufferGraph(cell.get(), templateGeometry.get());
|
|
||||||
textureBufferGraph->setStateSet( stateset );
|
|
||||||
osg::Group* group = new osg::Group;
|
|
||||||
group->addChild(textureBufferGraph);
|
|
||||||
group->addChild(createHUDWithText("Using geometry instancing to create a forest\n\nPress left cursor key to select osg::Vertex/Geometry/FragmentProgram based forest\nPress right cursor key to select osg::Billboard based forest"));
|
|
||||||
|
|
||||||
_techniqueSwitch->addChild(group);
|
|
||||||
|
|
||||||
std::cout<<"done."<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_currentTechnique = 0;
|
_currentTechnique = 0;
|
||||||
_techniqueSwitch->setSingleChildOn(_currentTechnique);
|
_techniqueSwitch->setSingleChildOn(_currentTechnique);
|
||||||
|
|
||||||
@@ -1457,12 +1158,8 @@ int main( int argc, char **argv )
|
|||||||
// construct the viewer.
|
// construct the viewer.
|
||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
unsigned int numTreesToCreate = 10000;
|
float numTreesToCreates = 10000;
|
||||||
arguments.read("--trees",numTreesToCreate);
|
arguments.read("--trees",numTreesToCreates);
|
||||||
|
|
||||||
unsigned int maxNumTreesPerCell = sqrtf(static_cast<float>(numTreesToCreate));
|
|
||||||
|
|
||||||
arguments.read("--trees-per-cell",maxNumTreesPerCell);
|
|
||||||
|
|
||||||
osg::ref_ptr<ForestTechniqueManager> ttm = new ForestTechniqueManager;
|
osg::ref_ptr<ForestTechniqueManager> ttm = new ForestTechniqueManager;
|
||||||
|
|
||||||
@@ -1473,7 +1170,7 @@ int main( int argc, char **argv )
|
|||||||
viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));
|
viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));
|
||||||
|
|
||||||
// add model to viewer.
|
// add model to viewer.
|
||||||
viewer.setSceneData( ttm->createScene(numTreesToCreate, maxNumTreesPerCell) );
|
viewer.setSceneData( ttm->createScene((unsigned int)numTreesToCreates) );
|
||||||
|
|
||||||
|
|
||||||
return viewer.run();
|
return viewer.run();
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
SET(TARGET_SRC
|
|
||||||
CameraPathProperty.cpp
|
|
||||||
CameraProperty.cpp
|
|
||||||
CaptureSettings.cpp
|
|
||||||
EventProperty.cpp
|
|
||||||
osgframerenderer.cpp
|
|
||||||
UpdateProperty.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
#### end var setup ###
|
|
||||||
SETUP_EXAMPLE(osgframerenderer)
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
#include "CameraPathProperty.h"
|
|
||||||
|
|
||||||
using namespace gsc;
|
|
||||||
|
|
||||||
void CameraPathProperty::update(osgViewer::View* view)
|
|
||||||
{
|
|
||||||
osg::Camera* camera = view->getCamera();
|
|
||||||
osg::FrameStamp* fs = view->getFrameStamp();
|
|
||||||
|
|
||||||
if (_animationPath.valid())
|
|
||||||
{
|
|
||||||
osg::AnimationPath::ControlPoint cp;
|
|
||||||
_animationPath->getInterpolatedControlPoint( fs->getSimulationTime(), cp );
|
|
||||||
|
|
||||||
OSG_NOTICE<<"CameraPathProperty "<<fs->getFrameNumber()<<" "<<fs->getSimulationTime()<<std::endl;
|
|
||||||
|
|
||||||
osg::Matrixd matrix;
|
|
||||||
cp.getMatrix( matrix );
|
|
||||||
camera->setViewMatrix( osg::Matrix::inverse(matrix) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CameraPathProperty::loadAnimationPath()
|
|
||||||
{
|
|
||||||
_animationPath = new osg::AnimationPath;;
|
|
||||||
//_animationPath->setLoopMode(osg::AnimationPath::LOOP);
|
|
||||||
|
|
||||||
osgDB::ifstream in(_filename.c_str());
|
|
||||||
if (!in)
|
|
||||||
{
|
|
||||||
OSG_WARN << "CameraPathProperty: Cannot open animation path file \"" << _filename << "\".\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_animationPath->read(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CameraPathProperty::getTimeRange(double& startTime, double& endTime) const
|
|
||||||
{
|
|
||||||
if (!_animationPath) return false;
|
|
||||||
|
|
||||||
const osg::AnimationPath::TimeControlPointMap& tcpm = _animationPath->getTimeControlPointMap();
|
|
||||||
if (tcpm.empty()) return false;
|
|
||||||
|
|
||||||
startTime = tcpm.begin()->first;
|
|
||||||
endTime = tcpm.rbegin()->first;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CameraPathProperty::resetTimeRange(double startTime, double endTime)
|
|
||||||
{
|
|
||||||
if (!_animationPath) return;
|
|
||||||
|
|
||||||
osg::AnimationPath::TimeControlPointMap& tcpm = _animationPath->getTimeControlPointMap();
|
|
||||||
if (tcpm.empty()) return;
|
|
||||||
|
|
||||||
osg::AnimationPath::TimeControlPointMap copy_tcpm = tcpm;
|
|
||||||
|
|
||||||
double offset = tcpm.begin()->first;
|
|
||||||
double originalLength = tcpm.rbegin()->first - tcpm.begin()->first ;
|
|
||||||
double scale = originalLength>0.0 ? (endTime-startTime)/originalLength : 1.0;
|
|
||||||
|
|
||||||
tcpm.clear();
|
|
||||||
|
|
||||||
for(osg::AnimationPath::TimeControlPointMap::iterator itr = copy_tcpm.begin();
|
|
||||||
itr != copy_tcpm.end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
tcpm[startTime + (itr->first-offset)*scale] = itr->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Serialization support
|
|
||||||
//
|
|
||||||
REGISTER_OBJECT_WRAPPER( gsc_CameraPathProperty,
|
|
||||||
new gsc::CameraPathProperty,
|
|
||||||
gsc::CameraPathProperty,
|
|
||||||
"osg::Object gsc::CameraPathProperty" )
|
|
||||||
{
|
|
||||||
ADD_STRING_SERIALIZER( AnimationPathFileName, "" );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
#ifndef CAMERAPATHPROPERTY_H
|
|
||||||
#define CAMERAPATHPROPERTY_H
|
|
||||||
|
|
||||||
#include <osg/AnimationPath>
|
|
||||||
|
|
||||||
#include "UpdateProperty.h"
|
|
||||||
|
|
||||||
namespace gsc
|
|
||||||
{
|
|
||||||
|
|
||||||
class CameraPathProperty : public gsc::UpdateProperty
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
CameraPathProperty() {}
|
|
||||||
CameraPathProperty(const std::string& filename) { setAnimationPathFileName(filename); }
|
|
||||||
CameraPathProperty(const CameraPathProperty& cpp, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) {}
|
|
||||||
|
|
||||||
META_Object(gsc, CameraPathProperty);
|
|
||||||
|
|
||||||
void setAnimationPathFileName(const std::string& filename) { _filename = filename; loadAnimationPath(); }
|
|
||||||
const std::string& getAnimationPathFileName() const { return _filename; }
|
|
||||||
|
|
||||||
void setAnimationPath(osg::AnimationPath* ap) { _animationPath = ap; }
|
|
||||||
osg::AnimationPath* getAnimationPath() { return _animationPath.get(); }
|
|
||||||
const osg::AnimationPath* getAnimationPath() const { return _animationPath.get(); }
|
|
||||||
|
|
||||||
bool getTimeRange(double& startTime, double& endTime) const;
|
|
||||||
|
|
||||||
void resetTimeRange(double startTime, double endTime);
|
|
||||||
|
|
||||||
virtual void update(osgViewer::View* view);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
virtual ~CameraPathProperty() {}
|
|
||||||
|
|
||||||
void loadAnimationPath();
|
|
||||||
|
|
||||||
std::string _filename;
|
|
||||||
osg::ref_ptr<osg::AnimationPath> _animationPath;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
#include "CameraProperty.h"
|
|
||||||
|
|
||||||
using namespace gsc;
|
|
||||||
|
|
||||||
void CameraProperty::setToModel(const osg::Node* node)
|
|
||||||
{
|
|
||||||
osg::BoundingSphere bs = node->getBound();
|
|
||||||
|
|
||||||
double dist = osg::DisplaySettings::instance()->getScreenDistance();
|
|
||||||
|
|
||||||
OSG_NOTICE<<"Node name "<<node->getName()<<std::endl;
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
if (node->getName().find("Presentation")==std::string::npos)
|
|
||||||
{
|
|
||||||
double screenWidth = osg::DisplaySettings::instance()->getScreenWidth();
|
|
||||||
double screenHeight = osg::DisplaySettings::instance()->getScreenHeight();
|
|
||||||
double screenDistance = osg::DisplaySettings::instance()->getScreenDistance();
|
|
||||||
|
|
||||||
double vfov = atan2(screenHeight/2.0,screenDistance)*2.0;
|
|
||||||
double hfov = atan2(screenWidth/2.0,screenDistance)*2.0;
|
|
||||||
double viewAngle = vfov<hfov ? vfov : hfov;
|
|
||||||
|
|
||||||
dist = bs.radius() / sin(viewAngle*0.5);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_center = bs.center();
|
|
||||||
_eye = _center - osg::Vec3d(0.0, dist, 0.0);
|
|
||||||
_up = osg::Vec3d(0.0, 0.0, 1.0);
|
|
||||||
|
|
||||||
_rotationCenter = _center;
|
|
||||||
_rotationAxis = osg::Vec3d(0.0, 0.0, 1.0);
|
|
||||||
_rotationSpeed = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CameraProperty::update(osgViewer::View* view)
|
|
||||||
{
|
|
||||||
osg::Camera* camera = view->getCamera();
|
|
||||||
osg::FrameStamp* fs = view->getFrameStamp();
|
|
||||||
|
|
||||||
osg::Matrixd matrix;
|
|
||||||
matrix.makeLookAt(_eye, _center, _up);
|
|
||||||
|
|
||||||
if (_rotationSpeed!=0.0)
|
|
||||||
{
|
|
||||||
matrix.preMult(osg::Matrixd::translate(-_rotationCenter) *
|
|
||||||
osg::Matrix::rotate(osg::DegreesToRadians(_rotationSpeed*fs->getSimulationTime()), _rotationAxis) *
|
|
||||||
osg::Matrixd::translate(_rotationCenter));
|
|
||||||
}
|
|
||||||
|
|
||||||
camera->setViewMatrix( matrix );
|
|
||||||
|
|
||||||
// set the fusion distance up so that the left and right eye images are co-incedent on the image plane at the center of ration.
|
|
||||||
view->setFusionDistance(osgUtil::SceneView::USE_FUSION_DISTANCE_VALUE,(_center-_eye).length());
|
|
||||||
// view->setFusionDistance(osgUtil::SceneView::PROPORTIONAL_TO_SCREEN_DISTANCE, 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Serialization support
|
|
||||||
//
|
|
||||||
REGISTER_OBJECT_WRAPPER( gsc_CameraProperty,
|
|
||||||
new gsc::CameraProperty,
|
|
||||||
gsc::CameraProperty,
|
|
||||||
"osg::Object gsc::CameraProperty" )
|
|
||||||
{
|
|
||||||
ADD_VEC3D_SERIALIZER( Center, osg::Vec3d(0.0,0.0,0.0) );
|
|
||||||
ADD_VEC3D_SERIALIZER( EyePoint, osg::Vec3d(0.0,-1.0,0.0) );
|
|
||||||
ADD_VEC3D_SERIALIZER( UpVector, osg::Vec3d(0.0,0.0,1.0) );
|
|
||||||
ADD_VEC3D_SERIALIZER( RotationCenter, osg::Vec3d(0.0,0.0,0.0) );
|
|
||||||
ADD_VEC3D_SERIALIZER( RotationAxis, osg::Vec3d(0.0,0.0,1.0) );
|
|
||||||
ADD_DOUBLE_SERIALIZER( RotationSpeed, 0.0 );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
#ifndef CAMERAPROPERTY_H
|
|
||||||
#define CAMERAPROPERTY_H
|
|
||||||
|
|
||||||
#include <osg/AnimationPath>
|
|
||||||
|
|
||||||
#include "UpdateProperty.h"
|
|
||||||
|
|
||||||
namespace gsc
|
|
||||||
{
|
|
||||||
|
|
||||||
class CameraProperty : public gsc::UpdateProperty
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
CameraProperty():
|
|
||||||
_center(0.0,0.0,0.0),
|
|
||||||
_eye(0.0,-1.0,0.0),
|
|
||||||
_up(0.0,0.0,1.0),
|
|
||||||
_rotationCenter(0.0,0.0,0.0),
|
|
||||||
_rotationAxis(0.0,0.0,1.0),
|
|
||||||
_rotationSpeed(0.0) {}
|
|
||||||
|
|
||||||
CameraProperty(const CameraProperty& cp, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
|
|
||||||
_center(cp._center),
|
|
||||||
_eye(cp._eye),
|
|
||||||
_up(cp._up),
|
|
||||||
_rotationCenter(cp._rotationCenter),
|
|
||||||
_rotationAxis(cp._rotationAxis),
|
|
||||||
_rotationSpeed(cp._rotationSpeed)
|
|
||||||
{}
|
|
||||||
|
|
||||||
META_Object(gsc, CameraProperty);
|
|
||||||
|
|
||||||
void setToModel(const osg::Node* node);
|
|
||||||
|
|
||||||
void setCenter(const osg::Vec3d& center) { _center = center; }
|
|
||||||
const osg::Vec3d& getCenter() const { return _center; }
|
|
||||||
|
|
||||||
void setEyePoint(const osg::Vec3d& eye) { _eye = eye; }
|
|
||||||
const osg::Vec3d& getEyePoint() const { return _eye; }
|
|
||||||
|
|
||||||
void setUpVector(const osg::Vec3d& up) { _up = up; }
|
|
||||||
const osg::Vec3d& getUpVector() const { return _up; }
|
|
||||||
|
|
||||||
void setRotationCenter(const osg::Vec3d& center) { _rotationCenter = center; }
|
|
||||||
const osg::Vec3d& getRotationCenter() const { return _rotationCenter; }
|
|
||||||
|
|
||||||
void setRotationAxis(const osg::Vec3d& axis) { _rotationAxis = axis; }
|
|
||||||
const osg::Vec3d& getRotationAxis() const { return _rotationAxis; }
|
|
||||||
|
|
||||||
void setRotationSpeed(double speed) { _rotationSpeed = speed; }
|
|
||||||
double getRotationSpeed() const { return _rotationSpeed; }
|
|
||||||
|
|
||||||
virtual void update(osgViewer::View* view);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
virtual ~CameraProperty() {}
|
|
||||||
|
|
||||||
|
|
||||||
osg::Vec3d _center;
|
|
||||||
osg::Vec3d _eye;
|
|
||||||
osg::Vec3d _up;
|
|
||||||
osg::Vec3d _rotationCenter;
|
|
||||||
osg::Vec3d _rotationAxis;
|
|
||||||
double _rotationSpeed;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,187 +0,0 @@
|
|||||||
#include "CaptureSettings.h"
|
|
||||||
|
|
||||||
using namespace gsc;
|
|
||||||
|
|
||||||
CaptureSettings::CaptureSettings():
|
|
||||||
_stereoMode(OFF),
|
|
||||||
_offscreen(false),
|
|
||||||
_outputImageFlip(false),
|
|
||||||
_width(1024),
|
|
||||||
_height(512),
|
|
||||||
_screenWidth(0.0),
|
|
||||||
_screenHeight(0.0),
|
|
||||||
_screenDistance(0.0),
|
|
||||||
_samples(0),
|
|
||||||
_sampleBuffers(0),
|
|
||||||
_frameRate(60.0),
|
|
||||||
_numberOfFrames(0.0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CaptureSettings::CaptureSettings(const CaptureSettings& cs, const osg::CopyOp& copyop):
|
|
||||||
osg::Object(cs, copyop),
|
|
||||||
_inputFileName(cs._inputFileName),
|
|
||||||
_outputFileName(cs._outputFileName),
|
|
||||||
_outputDirectoryName(cs._outputDirectoryName),
|
|
||||||
_outputBaseFileName(cs._outputBaseFileName),
|
|
||||||
_outputExtension(cs._outputExtension),
|
|
||||||
_stereoMode(cs._stereoMode),
|
|
||||||
_offscreen(cs._offscreen),
|
|
||||||
_outputImageFlip(cs._outputImageFlip),
|
|
||||||
_width(cs._width),
|
|
||||||
_height(cs._height),
|
|
||||||
_screenWidth(cs._screenWidth),
|
|
||||||
_screenHeight(cs._screenHeight),
|
|
||||||
_screenDistance(cs._screenDistance),
|
|
||||||
_samples(cs._samples),
|
|
||||||
_sampleBuffers(cs._sampleBuffers),
|
|
||||||
_frameRate(cs._frameRate),
|
|
||||||
_numberOfFrames(cs._numberOfFrames),
|
|
||||||
_eventHandlers(cs._eventHandlers),
|
|
||||||
_properties(cs._properties)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CaptureSettings::setOutputFileName(const std::string& filename)
|
|
||||||
{
|
|
||||||
_outputFileName = filename;
|
|
||||||
|
|
||||||
_outputDirectoryName = osgDB::getFilePath(filename);
|
|
||||||
if (!_outputDirectoryName.empty()) _outputDirectoryName += osgDB::getNativePathSeparator();
|
|
||||||
|
|
||||||
_outputBaseFileName = osgDB::getStrippedName(filename);
|
|
||||||
|
|
||||||
_outputExtension = osgDB::getFileExtensionIncludingDot(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string& CaptureSettings::getOutputFileName() const
|
|
||||||
{
|
|
||||||
return _outputFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CaptureSettings::getOutputFileName(unsigned int frameNumber) const
|
|
||||||
{
|
|
||||||
std::stringstream str;
|
|
||||||
str<<_outputDirectoryName<<_outputBaseFileName<<"_"<<frameNumber<<_outputExtension;
|
|
||||||
return str.str();
|
|
||||||
}
|
|
||||||
std::string CaptureSettings::getOutputFileName(unsigned int cameraNum, unsigned int frameNumber) const
|
|
||||||
{
|
|
||||||
std::stringstream str;
|
|
||||||
str<<_outputDirectoryName<<_outputBaseFileName<<"_"<<cameraNum<<"_"<<frameNumber<<_outputExtension;
|
|
||||||
return str.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CaptureSettings::valid() const
|
|
||||||
{
|
|
||||||
return _numberOfFrames>0 && !_outputBaseFileName.empty() && !_outputExtension.empty() && !_inputFileName.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Serialization support
|
|
||||||
//
|
|
||||||
static bool checkEventHandlers( const gsc::CaptureSettings& cs )
|
|
||||||
{
|
|
||||||
return !cs.getEventHandlers().empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool readEventHandlers( osgDB::InputStream& is, gsc::CaptureSettings& cs )
|
|
||||||
{
|
|
||||||
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
|
|
||||||
for ( unsigned int i=0; i<size; ++i )
|
|
||||||
{
|
|
||||||
osg::ref_ptr<osg::Object> obj = is.readObject();
|
|
||||||
gsc::UpdateProperty* up = dynamic_cast<gsc::UpdateProperty*>( obj.get() );
|
|
||||||
if ( up ) cs.addUpdateProperty( up );
|
|
||||||
}
|
|
||||||
is >> is.END_BRACKET;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool writeEventHandlers( osgDB::OutputStream& os, const gsc::CaptureSettings& cs )
|
|
||||||
{
|
|
||||||
const gsc::CaptureSettings::EventHandlers& pl = cs.getEventHandlers();
|
|
||||||
unsigned int size = pl.size();
|
|
||||||
os << size << os.BEGIN_BRACKET << std::endl;
|
|
||||||
for ( unsigned int i=0; i<size; ++i )
|
|
||||||
{
|
|
||||||
os << pl[i].get();
|
|
||||||
}
|
|
||||||
os << os.END_BRACKET << std::endl;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool checkProperties( const gsc::CaptureSettings& cs )
|
|
||||||
{
|
|
||||||
return !cs.getProperties().empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool readProperties( osgDB::InputStream& is, gsc::CaptureSettings& cs )
|
|
||||||
{
|
|
||||||
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
|
|
||||||
for ( unsigned int i=0; i<size; ++i )
|
|
||||||
{
|
|
||||||
osg::ref_ptr<osg::Object> obj = is.readObject();
|
|
||||||
gsc::UpdateProperty* up = dynamic_cast<gsc::UpdateProperty*>( obj.get() );
|
|
||||||
if ( up ) cs.addUpdateProperty( up );
|
|
||||||
}
|
|
||||||
is >> is.END_BRACKET;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool writeProperties( osgDB::OutputStream& os, const gsc::CaptureSettings& cs )
|
|
||||||
{
|
|
||||||
const gsc::CaptureSettings::Properties& pl = cs.getProperties();
|
|
||||||
unsigned int size = pl.size();
|
|
||||||
os << size << os.BEGIN_BRACKET << std::endl;
|
|
||||||
for ( unsigned int i=0; i<size; ++i )
|
|
||||||
{
|
|
||||||
os << pl[i].get();
|
|
||||||
}
|
|
||||||
os << os.END_BRACKET << std::endl;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
REGISTER_OBJECT_WRAPPER( gsc_CaptureSettings,
|
|
||||||
new gsc::CaptureSettings,
|
|
||||||
gsc::CaptureSettings,
|
|
||||||
"osg::Object gsc::CaptureSettings" )
|
|
||||||
{
|
|
||||||
ADD_STRING_SERIALIZER( InputFileName, "" );
|
|
||||||
ADD_STRING_SERIALIZER( OutputFileName, "" );
|
|
||||||
ADD_DOUBLE_SERIALIZER( FrameRate, 60.0 );
|
|
||||||
|
|
||||||
BEGIN_ENUM_SERIALIZER( StereoMode, OFF );
|
|
||||||
ADD_ENUM_VALUE( OFF );
|
|
||||||
ADD_ENUM_VALUE( HORIZONTAL_SPLIT );
|
|
||||||
ADD_ENUM_VALUE( VERTICAL_SPLIT );
|
|
||||||
END_ENUM_SERIALIZER();
|
|
||||||
|
|
||||||
ADD_BOOL_SERIALIZER( Offscreen, false );
|
|
||||||
ADD_BOOL_SERIALIZER( OutputImageFlip, false );
|
|
||||||
|
|
||||||
ADD_UINT_SERIALIZER( Width, 1024 );
|
|
||||||
ADD_UINT_SERIALIZER( Height, 512 );
|
|
||||||
|
|
||||||
ADD_FLOAT_SERIALIZER( ScreenWidth, 0.0 );
|
|
||||||
ADD_FLOAT_SERIALIZER( ScreenHeight, 0.0 );
|
|
||||||
ADD_FLOAT_SERIALIZER( ScreenDistance, 0.0 );
|
|
||||||
|
|
||||||
BEGIN_ENUM_SERIALIZER( PixelFormat, RGB );
|
|
||||||
ADD_ENUM_VALUE( RGB );
|
|
||||||
ADD_ENUM_VALUE( RGBA );
|
|
||||||
END_ENUM_SERIALIZER();
|
|
||||||
|
|
||||||
ADD_UINT_SERIALIZER( Samples, 0 );
|
|
||||||
ADD_UINT_SERIALIZER( SampleBuffers, 0 );
|
|
||||||
|
|
||||||
ADD_UINT_SERIALIZER( NumberOfFrames, 0 );
|
|
||||||
ADD_USER_SERIALIZER( EventHandlers );
|
|
||||||
ADD_USER_SERIALIZER( Properties );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,148 +0,0 @@
|
|||||||
#ifndef CAPTURESETTINGS_H
|
|
||||||
#define CAPTURESETTINGS_H
|
|
||||||
|
|
||||||
#include <osgDB/ReadFile>
|
|
||||||
#include <osgDB/FileNameUtils>
|
|
||||||
#include <osgDB/WriteFile>
|
|
||||||
#include <osgViewer/Viewer>
|
|
||||||
#include <osg/AnimationPath>
|
|
||||||
|
|
||||||
#include "UpdateProperty.h"
|
|
||||||
|
|
||||||
namespace gsc
|
|
||||||
{
|
|
||||||
|
|
||||||
class CaptureSettings : public osg::Object
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CaptureSettings();
|
|
||||||
CaptureSettings(const CaptureSettings& cs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
|
||||||
|
|
||||||
META_Object(gsc, CaptureSettings);
|
|
||||||
|
|
||||||
void setInputFileName(const std::string& filename) { _inputFileName = filename; }
|
|
||||||
const std::string& getInputFileName() const { return _inputFileName; }
|
|
||||||
|
|
||||||
void setOutputFileName(const std::string& filename);
|
|
||||||
const std::string& getOutputFileName() const;
|
|
||||||
|
|
||||||
std::string getOutputFileName(unsigned int frameNumber) const;
|
|
||||||
std::string getOutputFileName(unsigned int cameraNumber, unsigned int frameNumber) const;
|
|
||||||
|
|
||||||
enum StereoMode
|
|
||||||
{
|
|
||||||
OFF,
|
|
||||||
HORIZONTAL_SPLIT,
|
|
||||||
VERTICAL_SPLIT
|
|
||||||
};
|
|
||||||
|
|
||||||
void setStereoMode(StereoMode mode) { _stereoMode = mode; }
|
|
||||||
StereoMode getStereoMode() const { return _stereoMode; }
|
|
||||||
|
|
||||||
void setOffscreen(bool o) { _offscreen = o; }
|
|
||||||
bool getOffscreen() const { return _offscreen; }
|
|
||||||
|
|
||||||
void setOutputImageFlip(bool flip) { _outputImageFlip = flip; }
|
|
||||||
bool getOutputImageFlip() const { return _outputImageFlip; }
|
|
||||||
|
|
||||||
void setWidth(unsigned int width) { _width = width; }
|
|
||||||
unsigned int getWidth() const { return _width; }
|
|
||||||
|
|
||||||
void setHeight(unsigned int height) { _height = height; }
|
|
||||||
unsigned int getHeight() const { return _height; }
|
|
||||||
|
|
||||||
void setScreenWidth(float width) { _screenWidth = width; }
|
|
||||||
float getScreenWidth() const { return _screenWidth; }
|
|
||||||
|
|
||||||
void setScreenHeight(float height) { _screenHeight = height; }
|
|
||||||
float getScreenHeight() const { return _screenHeight; }
|
|
||||||
|
|
||||||
void setScreenDistance(float distance) { _screenDistance = distance; }
|
|
||||||
float getScreenDistance() const { return _screenDistance; }
|
|
||||||
|
|
||||||
|
|
||||||
enum PixelFormat
|
|
||||||
{
|
|
||||||
RGB,
|
|
||||||
RGBA
|
|
||||||
};
|
|
||||||
|
|
||||||
void setPixelFormat(PixelFormat format) { _pixelFormat = format; }
|
|
||||||
PixelFormat getPixelFormat() const { return _pixelFormat; }
|
|
||||||
|
|
||||||
void setSamples(unsigned int s) { _samples = s; }
|
|
||||||
unsigned int getSamples() const { return _samples; }
|
|
||||||
|
|
||||||
void setSampleBuffers(unsigned int s) { _sampleBuffers = s; }
|
|
||||||
unsigned int getSampleBuffers() const { return _sampleBuffers; }
|
|
||||||
|
|
||||||
void setFrameRate(double fr) { _frameRate = fr; }
|
|
||||||
double getFrameRate() const { return _frameRate; }
|
|
||||||
|
|
||||||
void setNumberOfFrames(unsigned int nf) { _numberOfFrames = nf; }
|
|
||||||
unsigned int getNumberOfFrames() const { return _numberOfFrames; }
|
|
||||||
|
|
||||||
typedef std::vector< osg::ref_ptr<osgGA::GUIEventHandler> > EventHandlers;
|
|
||||||
void setEventHandlers(const EventHandlers& eh);
|
|
||||||
EventHandlers& getEventHandlers() { return _eventHandlers; }
|
|
||||||
const EventHandlers& getEventHandlers() const { return _eventHandlers; }
|
|
||||||
|
|
||||||
typedef std::vector< osg::ref_ptr<UpdateProperty> > Properties;
|
|
||||||
|
|
||||||
void addUpdateProperty(UpdateProperty* up) { _properties.push_back(up); }
|
|
||||||
|
|
||||||
void setProperties(const Properties& pl) { _properties = pl; }
|
|
||||||
Properties& getProperties() { return _properties; }
|
|
||||||
const Properties& getProperties() const { return _properties; }
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
T* getPropertyOfType()
|
|
||||||
{
|
|
||||||
for(Properties::iterator itr = _properties.begin();
|
|
||||||
itr != _properties.end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
T* p = dynamic_cast<T*>(itr->get());
|
|
||||||
if (p) return p;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool valid() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual ~CaptureSettings() {}
|
|
||||||
|
|
||||||
std::string _inputFileName;
|
|
||||||
|
|
||||||
std::string _outputFileName;
|
|
||||||
std::string _outputDirectoryName;
|
|
||||||
std::string _outputBaseFileName;
|
|
||||||
std::string _outputExtension;
|
|
||||||
|
|
||||||
StereoMode _stereoMode;
|
|
||||||
bool _offscreen;
|
|
||||||
bool _outputImageFlip;
|
|
||||||
|
|
||||||
unsigned int _width;
|
|
||||||
unsigned int _height;
|
|
||||||
|
|
||||||
float _screenWidth;
|
|
||||||
float _screenHeight;
|
|
||||||
float _screenDistance;
|
|
||||||
|
|
||||||
PixelFormat _pixelFormat;
|
|
||||||
unsigned int _samples;
|
|
||||||
unsigned int _sampleBuffers;
|
|
||||||
|
|
||||||
double _frameRate;
|
|
||||||
unsigned int _numberOfFrames;
|
|
||||||
|
|
||||||
EventHandlers _eventHandlers;
|
|
||||||
Properties _properties;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
#include "EventProperty.h"
|
|
||||||
|
|
||||||
namespace gsc
|
|
||||||
{
|
|
||||||
|
|
||||||
void EventProperty::update(osgViewer::View* view)
|
|
||||||
{
|
|
||||||
if (view && view->getEventQueue() && _event.valid())
|
|
||||||
{
|
|
||||||
view->getEventQueue()->addEvent(_event.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Serialization support
|
|
||||||
//
|
|
||||||
REGISTER_OBJECT_WRAPPER( gsc_EventProperty,
|
|
||||||
new gsc::EventProperty,
|
|
||||||
gsc::EventProperty,
|
|
||||||
"osg::Object gsc::EventProperty" )
|
|
||||||
{
|
|
||||||
ADD_OBJECT_SERIALIZER( Event, osgGA::GUIEventAdapter, NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace osgGA
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace B
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
#ifndef EVENTPROPERTY_H
|
|
||||||
#define EVENTPROPERTY_H
|
|
||||||
|
|
||||||
#include <osgGA/GUIEventAdapter>
|
|
||||||
#include "UpdateProperty.h"
|
|
||||||
|
|
||||||
namespace gsc
|
|
||||||
{
|
|
||||||
|
|
||||||
class EventProperty : public gsc::UpdateProperty
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
EventProperty() {}
|
|
||||||
EventProperty(osgGA::GUIEventAdapter* event):_event(event) {}
|
|
||||||
EventProperty(const EventProperty& cpp, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) {}
|
|
||||||
|
|
||||||
META_Object(gsc, EventProperty);
|
|
||||||
|
|
||||||
void setEvent(osgGA::GUIEventAdapter* ea) { _event = ea; }
|
|
||||||
osgGA::GUIEventAdapter* getEvent() { return _event.get(); }
|
|
||||||
const osgGA::GUIEventAdapter* getEvent() const { return _event.get(); }
|
|
||||||
|
|
||||||
virtual void update(osgViewer::View* view);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
virtual ~EventProperty() {}
|
|
||||||
|
|
||||||
double _previousFrameTime;
|
|
||||||
osg::ref_ptr<osgGA::GUIEventAdapter> _event;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#include "UpdateProperty.h"
|
|
||||||
|
|
||||||
using namespace gsc;
|
|
||||||
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#ifndef UPDATEPROPERTY_H
|
|
||||||
#define UPDATEPROPERTY_H
|
|
||||||
|
|
||||||
#include <osgDB/ReadFile>
|
|
||||||
#include <osgDB/FileNameUtils>
|
|
||||||
#include <osgDB/WriteFile>
|
|
||||||
#include <osgViewer/Viewer>
|
|
||||||
#include <osg/AnimationPath>
|
|
||||||
|
|
||||||
namespace gsc
|
|
||||||
{
|
|
||||||
|
|
||||||
class UpdateProperty : public osg::Object
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
UpdateProperty() {}
|
|
||||||
UpdateProperty(const UpdateProperty& up, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) {}
|
|
||||||
|
|
||||||
META_Object(gsc, UpdateProperty);
|
|
||||||
|
|
||||||
virtual void update(osgViewer::View* view) {}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
virtual ~UpdateProperty() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,559 +0,0 @@
|
|||||||
#include <osgDB/ReadFile>
|
|
||||||
#include <osgDB/FileUtils>
|
|
||||||
#include <osgDB/FileNameUtils>
|
|
||||||
#include <osgDB/WriteFile>
|
|
||||||
#include <osgViewer/Viewer>
|
|
||||||
#include <osg/AnimationPath>
|
|
||||||
|
|
||||||
#include "UpdateProperty.h"
|
|
||||||
#include "CameraProperty.h"
|
|
||||||
#include "CameraPathProperty.h"
|
|
||||||
#include "EventProperty.h"
|
|
||||||
|
|
||||||
#include "CaptureSettings.h"
|
|
||||||
|
|
||||||
#include <osgGA/StateSetManipulator>
|
|
||||||
|
|
||||||
|
|
||||||
struct ScreenShot : public osg::Camera::DrawCallback
|
|
||||||
{
|
|
||||||
ScreenShot(GLenum pixelFormat, bool flip):
|
|
||||||
_pixelFormat(pixelFormat),
|
|
||||||
_flip(flip) {}
|
|
||||||
|
|
||||||
virtual void operator () (osg::RenderInfo& renderInfo) const
|
|
||||||
{
|
|
||||||
if (!_frameCapture)
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"No FrameCamera assigned"<<std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
|
|
||||||
|
|
||||||
CameraNumMap::const_iterator itr = _cameraNumMap.find(renderInfo.getCurrentCamera());
|
|
||||||
std::string outputFileName = (itr!=_cameraNumMap.end()) ?
|
|
||||||
_frameCapture->getOutputFileName(itr->second, frameNumber) :
|
|
||||||
_frameCapture->getOutputFileName(frameNumber);
|
|
||||||
|
|
||||||
OSG_NOTICE<<"outputFileName="<<outputFileName<<std::endl;
|
|
||||||
|
|
||||||
osg::Camera* camera = renderInfo.getCurrentCamera();
|
|
||||||
osg::Viewport* viewport = camera ? camera->getViewport() : 0;
|
|
||||||
if (viewport)
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"Doing read of ="<<viewport->x()<<", "<<viewport->y()<<", "<<viewport->width()<<", "<<viewport->height()<<" with pixelFormat=0x"<<std::hex<<_pixelFormat<<std::dec<<std::endl;
|
|
||||||
|
|
||||||
glReadBuffer(camera->getDrawBuffer());
|
|
||||||
osg::ref_ptr<osg::Image> image = new osg::Image;
|
|
||||||
|
|
||||||
image->readPixels(viewport->x(),viewport->y(),viewport->width(),viewport->height(),
|
|
||||||
_pixelFormat, GL_UNSIGNED_BYTE, 1);
|
|
||||||
|
|
||||||
if (_flip) image->flipVertical();
|
|
||||||
|
|
||||||
osgDB::writeImageFile(*image, outputFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef std::map<const osg::Camera*, unsigned int> CameraNumMap;
|
|
||||||
|
|
||||||
GLenum _pixelFormat;
|
|
||||||
bool _flip;
|
|
||||||
osg::ref_ptr<gsc::CaptureSettings> _frameCapture;
|
|
||||||
CameraNumMap _cameraNumMap;
|
|
||||||
};
|
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
|
||||||
{
|
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
|
||||||
|
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use of 3D textures.");
|
|
||||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options]");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-i <filename>","Input scene (or presentation) filename.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-o <filename>","Base ouput filename of the images, recommended to use something like Images/image.png");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--cs <filename>","Load pre-generated configuration file for run.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--ouput-cs <filename>","Output configuration file with settings provided on commandline.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-p <filename>","Use specificied camera path file to control camera position.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--offscreen","Use an pbuffer to render the images offscreen.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--screen","Use an window to render the images.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--width <width>","Window/output image width.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--height <height>","Window/output image height.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--screen-distance <distance>","Set the distance of the viewer from the physical screen.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--screen-width <width>","Set the width of the physical screen.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--screen-height <height>","Set the height of the physical screen.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--ms <s>","Number of multi-samples to use when rendering, an enable a single sample buffer.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--samples <s>","Number of multi-samples to use when rendering.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--sampleBuffers <sb>","Number of sample buffers to use when rendering.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-f <fps>","Number of frames per second in simulation time.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-n <frames>","Number of frames to render/images to create.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-d <time>","Duration of rendering run (duration = frames/fps).");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--center <x> <y> <z>","View center.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--eye <x> <y> <z>","Camera eye point.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--up <x> <y> <z>","Camera up vector.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--rotation-center <x> <y> <z>","Position to rotatate around.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--rotation-axis <x> <y> <z>","Axis to rotate around.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--rotation-speed <v>","Degrees per second.");
|
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--stereo <mode>","OFF | HORIZONTAL_SPLIT | VERTICAL_SPLIT");
|
|
||||||
|
|
||||||
unsigned int helpType = 0;
|
|
||||||
if ((helpType = arguments.readHelpType()))
|
|
||||||
{
|
|
||||||
arguments.getApplicationUsage()->write(std::cout, helpType);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
osgViewer::Viewer viewer;
|
|
||||||
|
|
||||||
typedef std::list< osg::ref_ptr<gsc::CaptureSettings> > CaptureSettingsList;
|
|
||||||
CaptureSettingsList frameCaptureList;
|
|
||||||
|
|
||||||
osg::ref_ptr<gsc::CaptureSettings> fc = new gsc::CaptureSettings;
|
|
||||||
|
|
||||||
double duration = 0.0;
|
|
||||||
double fps = 0.0f;
|
|
||||||
unsigned int nframes = 0;
|
|
||||||
|
|
||||||
bool readCaptureSettings = false;
|
|
||||||
std::string filename;
|
|
||||||
if (arguments.read("--cs",filename))
|
|
||||||
{
|
|
||||||
osg::ref_ptr<osg::Object> object = osgDB::readObjectFile(filename);
|
|
||||||
gsc::CaptureSettings* input_cs = dynamic_cast<gsc::CaptureSettings*>(object.get());
|
|
||||||
if (input_cs) { fc = input_cs; readCaptureSettings = true; }
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"Unable to read CaptureSettings from file: "<<filename<<std::endl;
|
|
||||||
if (object.valid()) OSG_NOTICE<<"Object read, "<<object.get()<<", className()="<<object->className()<<std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float screenWidth = fc->getScreenWidth()!=0.0 ? fc->getScreenWidth() : osg::DisplaySettings::instance()->getScreenWidth();
|
|
||||||
if (arguments.read("--screen-width",screenWidth)) {}
|
|
||||||
|
|
||||||
float screenHeight = fc->getScreenHeight()!=0.0 ? fc->getScreenHeight() : osg::DisplaySettings::instance()->getScreenHeight();
|
|
||||||
if (arguments.read("--screen-height",screenHeight)) {}
|
|
||||||
|
|
||||||
float screenDistance = fc->getScreenDistance()!=0.0 ? fc->getScreenDistance() : osg::DisplaySettings::instance()->getScreenDistance();
|
|
||||||
if (arguments.read("--screen-distance",screenDistance)) {}
|
|
||||||
|
|
||||||
fc->setScreenWidth(screenWidth);
|
|
||||||
osg::DisplaySettings::instance()->setScreenWidth(screenWidth);
|
|
||||||
|
|
||||||
fc->setScreenHeight(screenHeight);
|
|
||||||
osg::DisplaySettings::instance()->setScreenHeight(screenHeight);
|
|
||||||
|
|
||||||
fc->setScreenDistance(screenDistance);
|
|
||||||
osg::DisplaySettings::instance()->setScreenDistance(screenDistance);
|
|
||||||
|
|
||||||
bool useScreenSizeForProjectionMatrix = true;
|
|
||||||
|
|
||||||
if (arguments.read("-i",filename)) fc->setInputFileName(filename);
|
|
||||||
if (arguments.read("-o",filename)) fc->setOutputFileName(filename);
|
|
||||||
if (arguments.read("-p",filename))
|
|
||||||
{
|
|
||||||
osg::ref_ptr<gsc::CameraPathProperty> cpp = new gsc::CameraPathProperty;
|
|
||||||
cpp->setAnimationPathFileName(filename);
|
|
||||||
|
|
||||||
double startTime = 0, endTime = 1.0f;
|
|
||||||
if (cpp->getTimeRange(startTime, endTime))
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"Camera path time range "<<startTime<<", "<<endTime<<std::endl;
|
|
||||||
if (startTime!=0.0)
|
|
||||||
{
|
|
||||||
cpp->resetTimeRange(0.0, endTime-startTime);
|
|
||||||
if (cpp->getTimeRange(startTime, endTime))
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<" new time range "<<startTime<<", "<<endTime<<std::endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<" failed to set new time range "<<startTime<<", "<<endTime<<std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
duration = endTime;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"Camera path time range "<<startTime<<", "<<endTime<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
fc->addUpdateProperty(cpp.get());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
osg::ref_ptr<gsc::CameraProperty> cp = fc->getPropertyOfType<gsc::CameraProperty>();
|
|
||||||
|
|
||||||
bool newCameraProperty = false;
|
|
||||||
bool valueSet = false;
|
|
||||||
|
|
||||||
if (!cp)
|
|
||||||
{
|
|
||||||
newCameraProperty = true;
|
|
||||||
cp = new gsc::CameraProperty;
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> node = fc->getInputFileName().empty() ? 0 : osgDB::readNodeFile(fc->getInputFileName());
|
|
||||||
if (node.valid())
|
|
||||||
{
|
|
||||||
cp->setToModel(node.get());
|
|
||||||
valueSet = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
osg::Vec3d vec;
|
|
||||||
while (arguments.read("--center",vec.x(), vec.y(), vec.z())) { cp->setCenter(vec); valueSet = true; }
|
|
||||||
while (arguments.read("--eye",vec.x(), vec.y(), vec.z())) { cp->setEyePoint(vec); valueSet = true; }
|
|
||||||
while (arguments.read("--up",vec.x(), vec.y(), vec.z())) { cp->setUpVector(vec); valueSet = true; }
|
|
||||||
while (arguments.read("--rotation-center",vec.x(), vec.y(), vec.z())) { cp->setRotationCenter(vec); valueSet = true; }
|
|
||||||
while (arguments.read("--rotation-axis",vec.x(), vec.y(), vec.z())) { cp->setRotationAxis(vec); valueSet = true; }
|
|
||||||
|
|
||||||
double speed;
|
|
||||||
while (arguments.read("--rotation-speed",speed)) { cp->setRotationSpeed(speed); valueSet = true; }
|
|
||||||
|
|
||||||
if (newCameraProperty && valueSet)
|
|
||||||
{
|
|
||||||
fc->addUpdateProperty(cp.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string stereoMode;
|
|
||||||
if (arguments.read("--stereo", stereoMode))
|
|
||||||
{
|
|
||||||
if (stereoMode=="HORIZONTAL_SPLIT") fc->setStereoMode(gsc::CaptureSettings::HORIZONTAL_SPLIT);
|
|
||||||
else if (stereoMode=="VERTICAL_SPLIT") fc->setStereoMode(gsc::CaptureSettings::VERTICAL_SPLIT);
|
|
||||||
else if (stereoMode=="OFF") fc->setStereoMode(gsc::CaptureSettings::OFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arguments.read("--offscreen")) fc->setOffscreen(true);
|
|
||||||
if (arguments.read("--screen")) fc->setOffscreen(false);
|
|
||||||
|
|
||||||
if (arguments.read("--flip")) fc->setOutputImageFlip(true);
|
|
||||||
if (arguments.read("--no-flip")) fc->setOutputImageFlip(false);
|
|
||||||
|
|
||||||
unsigned int width = 1024;
|
|
||||||
if (arguments.read("--width",width)) fc->setWidth(width);
|
|
||||||
|
|
||||||
unsigned int height = 512;
|
|
||||||
if (arguments.read("--height",height)) fc->setHeight(height);
|
|
||||||
|
|
||||||
if (arguments.read("--rgb")) fc->setPixelFormat(gsc::CaptureSettings::RGB);
|
|
||||||
if (arguments.read("--rgba")) fc->setPixelFormat(gsc::CaptureSettings::RGBA);
|
|
||||||
|
|
||||||
osg::Vec4 clearColor(0.0f,0.0f,0.0f,0.0f);
|
|
||||||
while (arguments.read("--clear-color",clearColor[0],clearColor[1],clearColor[2],clearColor[3])) {}
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int samples = 0;
|
|
||||||
if (arguments.read("--samples",samples)) fc->setSamples(samples);
|
|
||||||
|
|
||||||
unsigned int sampleBuffers = 0;
|
|
||||||
if (arguments.read("--sampleBuffers",sampleBuffers)) fc->setSampleBuffers(sampleBuffers);
|
|
||||||
|
|
||||||
unsigned int ms = 0;
|
|
||||||
if (arguments.read("--ms",ms))
|
|
||||||
{
|
|
||||||
fc->setSamples(ms);
|
|
||||||
fc->setSampleBuffers(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arguments.read("-f",fps)) fc->setFrameRate(fps);
|
|
||||||
|
|
||||||
if (arguments.read("-n",nframes)) fc->setNumberOfFrames(nframes);
|
|
||||||
|
|
||||||
if (arguments.read("-d",duration)) {}
|
|
||||||
|
|
||||||
|
|
||||||
std::string key;
|
|
||||||
double time;
|
|
||||||
while(arguments.read("--key-down",time, key) && key.size()>=1)
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"keydown "<<key<<", "<<time<<std::endl;
|
|
||||||
osg::ref_ptr<osgGA::GUIEventAdapter> event = new osgGA::GUIEventAdapter;
|
|
||||||
event->setTime(time);
|
|
||||||
event->setEventType(osgGA::GUIEventAdapter::KEYDOWN);
|
|
||||||
event->setKey(key[0]);
|
|
||||||
fc->addUpdateProperty(new gsc::EventProperty(event.get()));
|
|
||||||
}
|
|
||||||
|
|
||||||
while(arguments.read("--key-up",time, key) && key.size()>=1)
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"keyup "<<key<<", "<<time<<std::endl;
|
|
||||||
osg::ref_ptr<osgGA::GUIEventAdapter> event = new osgGA::GUIEventAdapter;
|
|
||||||
event->setTime(time);
|
|
||||||
event->setEventType(osgGA::GUIEventAdapter::KEYUP);
|
|
||||||
event->setKey(key[0]);
|
|
||||||
fc->addUpdateProperty(new gsc::EventProperty(event.get()));
|
|
||||||
}
|
|
||||||
|
|
||||||
double mouse_x, mouse_y;
|
|
||||||
while(arguments.read("--mouse-move",time, mouse_x, mouse_y))
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"mouse move "<<time<<", "<<mouse_x<<", "<<mouse_y<<std::endl;
|
|
||||||
osg::ref_ptr<osgGA::GUIEventAdapter> event = new osgGA::GUIEventAdapter;
|
|
||||||
event->setTime(time);
|
|
||||||
event->setEventType(osgGA::GUIEventAdapter::MOVE);
|
|
||||||
event->setX(mouse_x);
|
|
||||||
event->setY(mouse_y);
|
|
||||||
fc->addUpdateProperty(new gsc::EventProperty(event.get()));
|
|
||||||
}
|
|
||||||
|
|
||||||
while(arguments.read("--mouse-drag",time, mouse_x, mouse_y))
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"mouse drag "<<time<<", "<<mouse_x<<", "<<mouse_y<<std::endl;
|
|
||||||
osg::ref_ptr<osgGA::GUIEventAdapter> event = new osgGA::GUIEventAdapter;
|
|
||||||
event->setTime(time);
|
|
||||||
event->setEventType(osgGA::GUIEventAdapter::DRAG);
|
|
||||||
event->setX(mouse_x);
|
|
||||||
event->setY(mouse_y);
|
|
||||||
fc->addUpdateProperty(new gsc::EventProperty(event.get()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!readCaptureSettings)
|
|
||||||
{
|
|
||||||
if (duration!=0.0)
|
|
||||||
{
|
|
||||||
if (fps!=0.0) nframes = static_cast<unsigned int>(ceil(duration*fps));
|
|
||||||
else if (nframes!=0) fps = duration/static_cast<double>(nframes);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fps = 60.0;
|
|
||||||
nframes = static_cast<unsigned int>(ceil(duration/fps));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // duration == 0.0
|
|
||||||
{
|
|
||||||
if (fps==0.0) fps=60.0;
|
|
||||||
if (nframes==0) nframes=1;
|
|
||||||
|
|
||||||
duration = static_cast<double>(nframes)/fps;
|
|
||||||
}
|
|
||||||
|
|
||||||
fc->setNumberOfFrames(nframes);
|
|
||||||
fc->setFrameRate(fps);
|
|
||||||
OSG_NOTICE<<"Duration="<<duration<<", FPS="<<fps<<", Number of Frames="<<nframes<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (arguments.read("--output-cs",filename))
|
|
||||||
{
|
|
||||||
osgDB::writeObjectFile(*fc, filename);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (fc.valid())
|
|
||||||
{
|
|
||||||
frameCaptureList.push_back(fc);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frameCaptureList.empty())
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"No settings provided"<<std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// setup viewer
|
|
||||||
{
|
|
||||||
osg::ref_ptr<osg::DisplaySettings> ds = new osg::DisplaySettings;
|
|
||||||
|
|
||||||
bool stereo = fc->getStereoMode()!=gsc::CaptureSettings::OFF;
|
|
||||||
osg::DisplaySettings::StereoMode stereoMode = fc->getStereoMode()==gsc::CaptureSettings::VERTICAL_SPLIT ? osg::DisplaySettings::VERTICAL_SPLIT : osg::DisplaySettings::HORIZONTAL_SPLIT;
|
|
||||||
double fovx_multiple = fc->getStereoMode()==gsc::CaptureSettings::HORIZONTAL_SPLIT ? 2.0 : 1;
|
|
||||||
double fovy_multiple = fc->getStereoMode()==gsc::CaptureSettings::VERTICAL_SPLIT ? 2.0 : 1;
|
|
||||||
ds->setStereoMode(stereoMode);
|
|
||||||
ds->setStereo(stereo);
|
|
||||||
|
|
||||||
if (fc->getScreenWidth()!=0.0) ds->setScreenWidth(fc->getScreenWidth());
|
|
||||||
if (fc->getScreenHeight()!=0.0) ds->setScreenHeight(fc->getScreenHeight());
|
|
||||||
if (fc->getScreenDistance()!=0.0) ds->setScreenDistance(fc->getScreenDistance());
|
|
||||||
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits(ds.get());
|
|
||||||
|
|
||||||
traits->readDISPLAY();
|
|
||||||
if (traits->displayNum<0) traits->displayNum = 0;
|
|
||||||
|
|
||||||
traits->x = 0;
|
|
||||||
traits->y = 0;
|
|
||||||
traits->width = fc->getWidth();
|
|
||||||
traits->height = fc->getHeight();
|
|
||||||
traits->alpha = (fc->getPixelFormat() == gsc::CaptureSettings::RGBA) ? 8 : 0;
|
|
||||||
traits->samples = fc->getSamples();
|
|
||||||
traits->sampleBuffers = fc->getSampleBuffers();
|
|
||||||
traits->windowDecoration = !(fc->getOffscreen());
|
|
||||||
traits->doubleBuffer = true;
|
|
||||||
traits->sharedContext = 0;
|
|
||||||
traits->pbuffer = fc->getOffscreen();
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
|
|
||||||
if (!gc)
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"Failed to created requested graphics context"<<std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
viewer.getCamera()->setClearColor(clearColor);
|
|
||||||
viewer.getCamera()->setGraphicsContext(gc.get());
|
|
||||||
viewer.getCamera()->setDisplaySettings(ds.get());
|
|
||||||
|
|
||||||
osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(gc.get());
|
|
||||||
if (gw)
|
|
||||||
{
|
|
||||||
OSG_INFO<<"GraphicsWindow has been created successfully."<<std::endl;
|
|
||||||
gw->getEventQueue()->getCurrentEventState()->setWindowRectangle(0, 0, fc->getWidth(), fc->getHeight());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"PixelBuffer has been created succseffully "<<traits->width<<", "<<traits->height<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (useScreenSizeForProjectionMatrix)
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"Setting projection matrix"<<std::endl;
|
|
||||||
|
|
||||||
double vfov = osg::RadiansToDegrees(atan2(screenHeight/2.0f,screenDistance)*2.0);
|
|
||||||
// double hfov = osg::RadiansToDegrees(atan2(width/2.0f,distance)*2.0);
|
|
||||||
|
|
||||||
viewer.getCamera()->setProjectionMatrixAsPerspective( vfov*fovy_multiple, (screenWidth/screenHeight)*fovx_multiple, 0.1, 1000.0);
|
|
||||||
|
|
||||||
OSG_NOTICE<<"setProjectionMatrixAsPerspective( "<<vfov*fovy_multiple<<", "<<(screenWidth/screenHeight)*fovx_multiple<<", "<<0.1<<", "<<1000.0<<");"<<std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
double fovy, aspectRatio, zNear, zFar;
|
|
||||||
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar);
|
|
||||||
|
|
||||||
double newAspectRatio = double(traits->width) / double(traits->height);
|
|
||||||
double aspectRatioChange = newAspectRatio / aspectRatio;
|
|
||||||
if (aspectRatioChange != 1.0)
|
|
||||||
{
|
|
||||||
viewer.getCamera()->getProjectionMatrix() *= osg::Matrix::scale(fovx_multiple/aspectRatioChange,fovy_multiple,1.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up stereo masks
|
|
||||||
viewer.getCamera()->setCullMask(0xffffffff);
|
|
||||||
viewer.getCamera()->setCullMaskLeft(0x00000001);
|
|
||||||
viewer.getCamera()->setCullMaskRight(0x00000002);
|
|
||||||
|
|
||||||
viewer.getCamera()->setViewport(new osg::Viewport(0, 0, traits->width, traits->height));
|
|
||||||
|
|
||||||
GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
|
|
||||||
|
|
||||||
viewer.getCamera()->setDrawBuffer(buffer);
|
|
||||||
viewer.getCamera()->setReadBuffer(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string outputPath = osgDB::getFilePath(fc->getOutputFileName());
|
|
||||||
if (!outputPath.empty())
|
|
||||||
{
|
|
||||||
osgDB::FileType type = osgDB::fileType(outputPath);
|
|
||||||
switch(type)
|
|
||||||
{
|
|
||||||
case(osgDB::FILE_NOT_FOUND):
|
|
||||||
if (!osgDB::makeDirectory(outputPath))
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"Error: could not create directory ["<<outputPath<<"]."<<std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
OSG_NOTICE<<"Created directory ["<<outputPath<<"]."<<std::endl;
|
|
||||||
break;
|
|
||||||
case(osgDB::REGULAR_FILE):
|
|
||||||
OSG_NOTICE<<"Error: filepath for output files is regular file, not a directory as required."<<std::endl;
|
|
||||||
return 1;
|
|
||||||
case(osgDB::DIRECTORY):
|
|
||||||
OSG_NOTICE<<"Valid path["<<outputPath<<"] provided for output files."<<std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GLenum pixelFormat = (fc->getPixelFormat()==gsc::CaptureSettings::RGBA) ? GL_RGBA : GL_RGB;
|
|
||||||
|
|
||||||
|
|
||||||
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
|
||||||
viewer.realize();
|
|
||||||
|
|
||||||
// set up screen shot
|
|
||||||
osg::ref_ptr<ScreenShot> screenShot = new ScreenShot(pixelFormat, fc->getOutputImageFlip());;
|
|
||||||
{
|
|
||||||
|
|
||||||
osgViewer::Viewer::Cameras cameras;
|
|
||||||
viewer.getCameras(cameras);
|
|
||||||
if (cameras.size()>1)
|
|
||||||
{
|
|
||||||
unsigned int cameraNum = 0;
|
|
||||||
for(osgViewer::Viewer::Cameras::iterator itr = cameras.begin();
|
|
||||||
itr != cameras.end();
|
|
||||||
++itr, ++cameraNum)
|
|
||||||
{
|
|
||||||
osg::Camera* camera = *itr;
|
|
||||||
camera->setFinalDrawCallback(screenShot.get());
|
|
||||||
screenShot->_cameraNumMap[camera] = cameraNum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (cameras.size()==1)
|
|
||||||
{
|
|
||||||
osg::Camera* camera = cameras.front();
|
|
||||||
camera->setFinalDrawCallback(screenShot.get());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"No usable Cameras created."<<std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(CaptureSettingsList::iterator itr = frameCaptureList.begin();
|
|
||||||
itr != frameCaptureList.end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
gsc::CaptureSettings* fc = itr->get();
|
|
||||||
screenShot->_frameCapture = fc;
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> model = osgDB::readNodeFile(fc->getInputFileName());
|
|
||||||
if (!model) break;
|
|
||||||
|
|
||||||
viewer.setSceneData(model.get());
|
|
||||||
|
|
||||||
double simulationTime = 0.0;
|
|
||||||
|
|
||||||
for(unsigned int i=0; i<fc->getNumberOfFrames(); ++i)
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"fc.getOutputFileName("<<i<<")="<<fc->getOutputFileName(i)<<std::endl;
|
|
||||||
|
|
||||||
viewer.advance(simulationTime);
|
|
||||||
|
|
||||||
gsc::CaptureSettings::Properties& pl = fc->getProperties();
|
|
||||||
for(gsc::CaptureSettings::Properties::iterator plitr = pl.begin();
|
|
||||||
plitr != pl.end();
|
|
||||||
++plitr)
|
|
||||||
{
|
|
||||||
(*plitr)->update(&viewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
viewer.eventTraversal();
|
|
||||||
viewer.updateTraversal();
|
|
||||||
viewer.renderingTraversals();
|
|
||||||
|
|
||||||
// advance simulationTime and number of frames rendered
|
|
||||||
simulationTime += 1.0/fc->getFrameRate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Object> object = new osgGA::StateSetManipulator;
|
|
||||||
osg::ref_ptr<osgGA::StateSetManipulator> ss = dynamic_cast<osgGA::StateSetManipulator*>(object.get());
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -108,7 +108,8 @@ osg::Geometry *Frame::build_quad(const Rect &rect, const osg::Vec4 &color, bool
|
|||||||
clr->push_back(osg::Vec4(black, 0));
|
clr->push_back(osg::Vec4(black, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
geo->setColorArray(clr.get(), osg::Array::BIND_PER_VERTEX);
|
geo->setColorArray(clr.get());
|
||||||
|
geo->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||||
|
|
||||||
geo->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, shadow? 12: 4));
|
geo->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, shadow? 12: 4));
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ osg::ref_ptr<osg::Group> ProcessPass::createTexturedQuad()
|
|||||||
quad_geom->setVertexArray(quad_coords.get());
|
quad_geom->setVertexArray(quad_coords.get());
|
||||||
quad_geom->setTexCoordArray(0, quad_tcoords.get());
|
quad_geom->setTexCoordArray(0, quad_tcoords.get());
|
||||||
quad_geom->addPrimitiveSet(quad_da.get());
|
quad_geom->addPrimitiveSet(quad_da.get());
|
||||||
quad_geom->setColorArray(quad_colors.get(), osg::Array::BIND_OVERALL);
|
quad_geom->setColorArray(quad_colors.get());
|
||||||
|
quad_geom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
_StateSet = quad_geom->getOrCreateStateSet();
|
_StateSet = quad_geom->getOrCreateStateSet();
|
||||||
_StateSet->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
_StateSet->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ osg::Node* createScene(osg::Image *start_im)
|
|||||||
geom->setVertexArray(vcoords.get());
|
geom->setVertexArray(vcoords.get());
|
||||||
geom->setTexCoordArray(0,tcoords.get());
|
geom->setTexCoordArray(0,tcoords.get());
|
||||||
geom->addPrimitiveSet(da.get());
|
geom->addPrimitiveSet(da.get());
|
||||||
geom->setColorArray(colors.get(), osg::Array::BIND_OVERALL);
|
geom->setColorArray(colors.get());
|
||||||
|
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
geomss = geom->getOrCreateStateSet();
|
geomss = geom->getOrCreateStateSet();
|
||||||
geomss->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
geomss->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||||
|
|
||||||
|
|||||||
7
examples/osggeodemo/CMakeLists.txt
Normal file
7
examples/osggeodemo/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#this file is automatically generated
|
||||||
|
|
||||||
|
|
||||||
|
SET(TARGET_SRC osggeodemo.cpp )
|
||||||
|
SET(TARGET_ADDED_LIBRARIES osgGA )
|
||||||
|
#### end var setup ###
|
||||||
|
SETUP_EXAMPLE(osggeodemo)
|
||||||
152
examples/osggeodemo/osggeodemo.cpp
Normal file
152
examples/osggeodemo/osggeodemo.cpp
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
// Geo demo written by Geoff Michel, November 2002.
|
||||||
|
/* OpenSceneGraph example, osggeodemo.
|
||||||
|
*
|
||||||
|
* 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 <stdio.h>
|
||||||
|
#include <osgViewer/Viewer>
|
||||||
|
|
||||||
|
#include <osg/Node>
|
||||||
|
#include <osg/Notify>
|
||||||
|
|
||||||
|
#include <osgDB/Registry>
|
||||||
|
#include <osgDB/ReadFile>
|
||||||
|
|
||||||
|
#include <osgGA/TrackballManipulator>
|
||||||
|
#include <osgGA/FlightManipulator>
|
||||||
|
#include <osgGA/DriveManipulator>
|
||||||
|
#include <osgGA/AnimationPathManipulator>
|
||||||
|
|
||||||
|
#include <osgDB/WriteFile>
|
||||||
|
#include <osgDB/FileUtils>
|
||||||
|
#include <osgDB/FileNameUtils>
|
||||||
|
|
||||||
|
#include <osgUtil/Optimizer>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
// currently not a satisfactory solution, but this is early days for the
|
||||||
|
// geo loader and having direct links with it.
|
||||||
|
#include "../../src/osgPlugins/geo/osgGeoAnimation.h"
|
||||||
|
|
||||||
|
|
||||||
|
//== event trapper gets events
|
||||||
|
|
||||||
|
class geodemoEventHandler : public osgGA::GUIEventHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
geodemoEventHandler( ) { mouse_x=mouse_y=0;}
|
||||||
|
virtual ~geodemoEventHandler( ) {}
|
||||||
|
|
||||||
|
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
||||||
|
{
|
||||||
|
mouse_x=ea.getX();
|
||||||
|
mouse_y=ea.getY();
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float getMouseX(void) {return mouse_x;};
|
||||||
|
inline float getMouseY(void) {return mouse_y;};
|
||||||
|
|
||||||
|
private:
|
||||||
|
float mouse_x, mouse_y;
|
||||||
|
};
|
||||||
|
|
||||||
|
static geodemoEventHandler *ghand=NULL;
|
||||||
|
inline double DEG2RAD(const double val) { return val*0.0174532925199432957692369076848861;}
|
||||||
|
inline double RAD2DEG(const double val) { return val*57.2957795130823208767981548141052;}
|
||||||
|
|
||||||
|
double dodynamics(const double /*time*/, const double val, const std::string name)
|
||||||
|
{ // Each local variable named 'name' declared in the geo modeller is passed into here.
|
||||||
|
// its current value is val; returns new value. Time - elapsed time
|
||||||
|
static double heading,speed; // these are only required for my 'dynamics'
|
||||||
|
if (name == "xpos") {
|
||||||
|
return (val+speed*sin(heading));
|
||||||
|
// std::cout << " nx " << (*itr->getValue()) ;
|
||||||
|
} else if (name == "ypos") {
|
||||||
|
return (val+speed*cos(heading));
|
||||||
|
// std::cout << " ny " << (*itr->getValue()) ;
|
||||||
|
} else if (name == "sped") {
|
||||||
|
speed=(0.00025*(ghand->getMouseY()-300)); // (*itr->getValue());
|
||||||
|
return (speed);
|
||||||
|
} else if (name == "heading") {
|
||||||
|
heading-= 0.01*DEG2RAD(ghand->getMouseX()-400); // =DEG2RAD(*itr->getValue());
|
||||||
|
return (RAD2DEG(heading));
|
||||||
|
} else if (name == "conerot") {
|
||||||
|
return ((ghand->getMouseX()-400));
|
||||||
|
} else if (name == "planrot") {
|
||||||
|
return ((ghand->getMouseY()-300)/200.0);
|
||||||
|
} else if (name == "secint" || name == "minutehand"|| name == "hourhand") {
|
||||||
|
// std::cout << " updating " << name << " " << val << std::endl;
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main( int argc, char **argv )
|
||||||
|
{
|
||||||
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
|
// construct the viewer.
|
||||||
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
|
// load the nodes from the commandline arguments.
|
||||||
|
osg::Node* rootnode = osgDB::readNodeFiles(arguments);
|
||||||
|
if (!rootnode)
|
||||||
|
{
|
||||||
|
osg::notify(osg::NOTICE)<<"Please specify a geo model filename on the command line."<<std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// run optimization over the scene graph
|
||||||
|
osgUtil::Optimizer optimzer;
|
||||||
|
optimzer.optimize(rootnode);
|
||||||
|
|
||||||
|
// add a viewport to the viewer and attach the scene graph.
|
||||||
|
viewer.setSceneData( rootnode );
|
||||||
|
|
||||||
|
geoHeader *gh = dynamic_cast<geoHeader *>(rootnode);
|
||||||
|
if (gh)
|
||||||
|
{ // it is a geo file, so set function to update its animation variables.
|
||||||
|
ghand=new geodemoEventHandler();
|
||||||
|
gh->setUserUpdate(dodynamics);
|
||||||
|
viewer.addEventHandler(ghand);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // maybe a group with geo models below.
|
||||||
|
osg::Group *gpall=dynamic_cast<osg::Group *>(rootnode);
|
||||||
|
if (gpall)
|
||||||
|
{
|
||||||
|
int nchild=gpall->getNumChildren();
|
||||||
|
for (int i=0; i<nchild; i++)
|
||||||
|
{
|
||||||
|
osg::Node *nod=gpall->getChild(i);
|
||||||
|
gh = dynamic_cast<geoHeader *>(nod);
|
||||||
|
if (gh)
|
||||||
|
{
|
||||||
|
ghand=new geodemoEventHandler();
|
||||||
|
gh->setUserUpdate(dodynamics);
|
||||||
|
viewer.addEventHandler(ghand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return viewer.run();
|
||||||
|
}
|
||||||
@@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
// This demo illustrates how to create the various different types of geometry that
|
// This demo illustrates how to create the various different types of geometry that
|
||||||
// the osg::Geometry class can represent. This demo uses the OpenGL red book diagram of different
|
// the osg::Geometry class can represent. This demo uses the OpenGL red book diagram of different
|
||||||
// OpenGL Primitives as a template for all the equivalent OpenSceneGraph Primitives. The OpenSceneGraph
|
// OpenGL Primitives as a template for all the equivalent OpenSceneGraph Primitives. The OpenSceneGraph
|
||||||
@@ -121,13 +120,15 @@ osg::Node* createScene()
|
|||||||
|
|
||||||
// pass the color array to points geometry, note the binding to tell the geometry
|
// pass the color array to points geometry, note the binding to tell the geometry
|
||||||
// that only use one color for the whole object.
|
// that only use one color for the whole object.
|
||||||
pointsGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
|
pointsGeom->setColorArray(colors);
|
||||||
|
pointsGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// set the normal in the same way color.
|
// set the normal in the same way color.
|
||||||
osg::Vec3Array* normals = new osg::Vec3Array;
|
osg::Vec3Array* normals = new osg::Vec3Array;
|
||||||
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
|
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
|
||||||
pointsGeom->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
pointsGeom->setNormalArray(normals);
|
||||||
|
pointsGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// create and add a DrawArray Primitive (see include/osg/Primitive). The first
|
// create and add a DrawArray Primitive (see include/osg/Primitive). The first
|
||||||
@@ -167,13 +168,15 @@ osg::Node* createScene()
|
|||||||
// set the colors as before, plus using the above
|
// set the colors as before, plus using the above
|
||||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||||
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
|
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
|
||||||
linesGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
|
linesGeom->setColorArray(colors);
|
||||||
|
linesGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// set the normal in the same way color.
|
// set the normal in the same way color.
|
||||||
osg::Vec3Array* normals = new osg::Vec3Array;
|
osg::Vec3Array* normals = new osg::Vec3Array;
|
||||||
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
|
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
|
||||||
linesGeom->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
linesGeom->setNormalArray(normals);
|
||||||
|
linesGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// This time we simply use primitive, and hardwire the number of coords to use
|
// This time we simply use primitive, and hardwire the number of coords to use
|
||||||
@@ -207,13 +210,15 @@ osg::Node* createScene()
|
|||||||
// set the colors as before, plus using the above
|
// set the colors as before, plus using the above
|
||||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||||
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
|
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
|
||||||
linesGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
|
linesGeom->setColorArray(colors);
|
||||||
|
linesGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// set the normal in the same way color.
|
// set the normal in the same way color.
|
||||||
osg::Vec3Array* normals = new osg::Vec3Array;
|
osg::Vec3Array* normals = new osg::Vec3Array;
|
||||||
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
|
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
|
||||||
linesGeom->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
linesGeom->setNormalArray(normals);
|
||||||
|
linesGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// This time we simply use primitive, and hardwire the number of coords to use
|
// This time we simply use primitive, and hardwire the number of coords to use
|
||||||
@@ -252,13 +257,15 @@ osg::Node* createScene()
|
|||||||
// set the colors as before, plus using the above
|
// set the colors as before, plus using the above
|
||||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||||
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
|
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
|
||||||
linesGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
|
linesGeom->setColorArray(colors);
|
||||||
|
linesGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// set the normal in the same way color.
|
// set the normal in the same way color.
|
||||||
osg::Vec3Array* normals = new osg::Vec3Array;
|
osg::Vec3Array* normals = new osg::Vec3Array;
|
||||||
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
|
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
|
||||||
linesGeom->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
linesGeom->setNormalArray(normals);
|
||||||
|
linesGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// This time we simply use primitive, and hardwire the number of coords to use
|
// This time we simply use primitive, and hardwire the number of coords to use
|
||||||
@@ -324,11 +331,13 @@ osg::Node* createScene()
|
|||||||
polyGeom->setVertexArray(vertices);
|
polyGeom->setVertexArray(vertices);
|
||||||
|
|
||||||
// use the shared color array.
|
// use the shared color array.
|
||||||
polyGeom->setColorArray(shared_colors.get(), osg::Array::BIND_OVERALL);
|
polyGeom->setColorArray(shared_colors.get());
|
||||||
|
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// use the shared normal array.
|
// use the shared normal array.
|
||||||
polyGeom->setNormalArray(shared_normals.get(), osg::Array::BIND_OVERALL);
|
polyGeom->setNormalArray(shared_normals.get());
|
||||||
|
polyGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// This time we simply use primitive, and hardwire the number of coords to use
|
// This time we simply use primitive, and hardwire the number of coords to use
|
||||||
@@ -369,11 +378,13 @@ osg::Node* createScene()
|
|||||||
polyGeom->setVertexArray(vertices);
|
polyGeom->setVertexArray(vertices);
|
||||||
|
|
||||||
// use the shared color array.
|
// use the shared color array.
|
||||||
polyGeom->setColorArray(shared_colors.get(), osg::Array::BIND_OVERALL);
|
polyGeom->setColorArray(shared_colors.get());
|
||||||
|
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// use the shared normal array.
|
// use the shared normal array.
|
||||||
polyGeom->setNormalArray(shared_normals.get(), osg::Array::BIND_OVERALL);
|
polyGeom->setNormalArray(shared_normals.get());
|
||||||
|
polyGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// This time we simply use primitive, and hardwire the number of coords to use
|
// This time we simply use primitive, and hardwire the number of coords to use
|
||||||
@@ -416,11 +427,13 @@ osg::Node* createScene()
|
|||||||
polyGeom->setVertexArray(vertices);
|
polyGeom->setVertexArray(vertices);
|
||||||
|
|
||||||
// use the shared color array.
|
// use the shared color array.
|
||||||
polyGeom->setColorArray(shared_colors.get(), osg::Array::BIND_OVERALL);
|
polyGeom->setColorArray(shared_colors.get());
|
||||||
|
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// use the shared normal array.
|
// use the shared normal array.
|
||||||
polyGeom->setNormalArray(shared_normals.get(), osg::Array::BIND_OVERALL);
|
polyGeom->setNormalArray(shared_normals.get());
|
||||||
|
polyGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// This time we simply use primitive, and hardwire the number of coords to use
|
// This time we simply use primitive, and hardwire the number of coords to use
|
||||||
@@ -482,11 +495,13 @@ osg::Node* createScene()
|
|||||||
polyGeom->setVertexArray(vertices);
|
polyGeom->setVertexArray(vertices);
|
||||||
|
|
||||||
// use the shared color array.
|
// use the shared color array.
|
||||||
polyGeom->setColorArray(shared_colors.get(), osg::Array::BIND_OVERALL);
|
polyGeom->setColorArray(shared_colors.get());
|
||||||
|
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// use the shared normal array.
|
// use the shared normal array.
|
||||||
polyGeom->setNormalArray(shared_normals.get(), osg::Array::BIND_OVERALL);
|
polyGeom->setNormalArray(shared_normals.get());
|
||||||
|
polyGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// This time we simply use primitive, and hardwire the number of coords to use
|
// This time we simply use primitive, and hardwire the number of coords to use
|
||||||
@@ -573,13 +588,15 @@ osg::Node* createBackground()
|
|||||||
|
|
||||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||||
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
|
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
|
||||||
polyGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
|
polyGeom->setColorArray(colors);
|
||||||
|
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
|
|
||||||
// set the normal in the same way color.
|
// set the normal in the same way color.
|
||||||
osg::Vec3Array* normals = new osg::Vec3Array;
|
osg::Vec3Array* normals = new osg::Vec3Array;
|
||||||
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
|
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
|
||||||
polyGeom->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
polyGeom->setNormalArray(normals);
|
||||||
|
polyGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
osg::Vec2 myTexCoords[] =
|
osg::Vec2 myTexCoords[] =
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -141,7 +141,8 @@ public:
|
|||||||
SomePoints()
|
SomePoints()
|
||||||
{
|
{
|
||||||
osg::Vec4Array* cAry = new osg::Vec4Array;
|
osg::Vec4Array* cAry = new osg::Vec4Array;
|
||||||
setColorArray( cAry, osg::Array::BIND_OVERALL );
|
setColorArray( cAry );
|
||||||
|
setColorBinding( osg::Geometry::BIND_OVERALL );
|
||||||
cAry->push_back( osg::Vec4(1,1,1,1) );
|
cAry->push_back( osg::Vec4(1,1,1,1) );
|
||||||
|
|
||||||
osg::Vec3Array* vAry = new osg::Vec3Array;
|
osg::Vec3Array* vAry = new osg::Vec3Array;
|
||||||
|
|||||||
@@ -395,7 +395,8 @@ osg::Node* createTrackModel(Track* track, const osg::Vec4& colour)
|
|||||||
|
|
||||||
osg::ref_ptr<osg::Vec4Array> colours = new osg::Vec4Array;
|
osg::ref_ptr<osg::Vec4Array> colours = new osg::Vec4Array;
|
||||||
colours->push_back(colour);
|
colours->push_back(colour);
|
||||||
geometry->setColorArray(colours.get(), osg::Array::BIND_OVERALL);
|
geometry->setColorArray(colours.get());
|
||||||
|
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
geometry->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP, 0, points.size()));
|
geometry->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP, 0, points.size()));
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ Node *makeBase( void )
|
|||||||
|
|
||||||
geom->setTexCoordArray( 0, tcoords );
|
geom->setTexCoordArray( 0, tcoords );
|
||||||
|
|
||||||
geom->setColorArray( colors, Array::BIND_OVERALL );
|
geom->setColorArray( colors );
|
||||||
|
geom->setColorBinding( Geometry::BIND_OVERALL );
|
||||||
|
|
||||||
geom->addPrimitiveSet( new DrawArrays(PrimitiveSet::TRIANGLE_FAN,0,19) );
|
geom->addPrimitiveSet( new DrawArrays(PrimitiveSet::TRIANGLE_FAN,0,19) );
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,8 @@ Node *makeSky( void )
|
|||||||
geom->setVertexArray( &coords );
|
geom->setVertexArray( &coords );
|
||||||
geom->setTexCoordArray( 0, &tcoords );
|
geom->setTexCoordArray( 0, &tcoords );
|
||||||
|
|
||||||
geom->setColorArray( &colors, Array::BIND_PER_VERTEX );
|
geom->setColorArray( &colors );
|
||||||
|
geom->setColorBinding( Geometry::BIND_PER_VERTEX );
|
||||||
|
|
||||||
|
|
||||||
Texture2D *tex = new Texture2D;
|
Texture2D *tex = new Texture2D;
|
||||||
|
|||||||
@@ -99,14 +99,12 @@ Node *makeTerrain( void )
|
|||||||
|
|
||||||
for( i = 0; i < m * n; i++ )
|
for( i = 0; i < m * n; i++ )
|
||||||
{
|
{
|
||||||
float* vc = vertex[i];
|
v[i][0] = vertex[i][0] - dbcenter[0];
|
||||||
v[i][0] = vc[0] - dbcenter[0];
|
v[i][1] = vertex[i][1] - dbcenter[1];
|
||||||
v[i][1] = vc[1] - dbcenter[1];
|
v[i][2] = vertex[i][2];
|
||||||
v[i][2] = vc[2];
|
|
||||||
|
|
||||||
float* tc = texcoord[i];
|
t[i][0] = texcoord[i][0] + 0.025;
|
||||||
t[i][0] = tc[0];
|
t[i][1] = texcoord[i][1];
|
||||||
t[i][1] = tc[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry *geom = new Geometry;
|
Geometry *geom = new Geometry;
|
||||||
@@ -114,7 +112,8 @@ Node *makeTerrain( void )
|
|||||||
geom->setVertexArray( &v );
|
geom->setVertexArray( &v );
|
||||||
geom->setTexCoordArray( 0, &t );
|
geom->setTexCoordArray( 0, &t );
|
||||||
|
|
||||||
geom->setColorArray( &col, Array::BIND_OVERALL );
|
geom->setColorArray( &col );
|
||||||
|
geom->setColorBinding( Geometry::BIND_OVERALL );
|
||||||
|
|
||||||
for( i = 0; i < m-2; i++ )
|
for( i = 0; i < m-2; i++ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -166,10 +166,10 @@ static Geometry *makeTree( _tree *tree, StateSet *dstate )
|
|||||||
{
|
{
|
||||||
float vv[][3] =
|
float vv[][3] =
|
||||||
{
|
{
|
||||||
{ -tree->w/2.0f, 0.0f, 0.0f },
|
{ -tree->w/2.0, 0.0, 0.0 },
|
||||||
{ tree->w/2.0f, 0.0f, 0.0f },
|
{ tree->w/2.0, 0.0, 0.0 },
|
||||||
{ tree->w/2.0f, 0.0f, 2.0f * tree->h },
|
{ tree->w/2.0, 0.0, 2 * tree->h },
|
||||||
{ -tree->w/2.0f, 0.0f, 2.0f * tree->h },
|
{ -tree->w/2.0, 0.0, 2 * tree->h },
|
||||||
};
|
};
|
||||||
|
|
||||||
Vec3Array& v = *(new Vec3Array(4));
|
Vec3Array& v = *(new Vec3Array(4));
|
||||||
@@ -198,7 +198,8 @@ static Geometry *makeTree( _tree *tree, StateSet *dstate )
|
|||||||
|
|
||||||
geom->setTexCoordArray( 0, &t );
|
geom->setTexCoordArray( 0, &t );
|
||||||
|
|
||||||
geom->setColorArray( &l, Array::BIND_OVERALL );
|
geom->setColorArray( &l );
|
||||||
|
geom->setColorBinding( Geometry::BIND_OVERALL );
|
||||||
|
|
||||||
geom->addPrimitiveSet( new DrawArrays(PrimitiveSet::QUADS,0,4) );
|
geom->addPrimitiveSet( new DrawArrays(PrimitiveSet::QUADS,0,4) );
|
||||||
|
|
||||||
|
|||||||
@@ -166,11 +166,13 @@ osg::Camera* createHUD()
|
|||||||
|
|
||||||
osg::Vec3Array* normals = new osg::Vec3Array;
|
osg::Vec3Array* normals = new osg::Vec3Array;
|
||||||
normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
|
normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
|
||||||
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
geom->setNormalArray(normals);
|
||||||
|
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||||
colors->push_back(osg::Vec4(1.0f,1.0,0.8f,0.2f));
|
colors->push_back(osg::Vec4(1.0f,1.0,0.8f,0.2f));
|
||||||
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
|
geom->setColorArray(colors);
|
||||||
|
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));
|
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,6 @@
|
|||||||
#include <osgDB/Registry>
|
#include <osgDB/Registry>
|
||||||
#include <osgDB/ReadFile>
|
#include <osgDB/ReadFile>
|
||||||
#include <osgDB/WriteFile>
|
#include <osgDB/WriteFile>
|
||||||
#include <osgDB/FileNameUtils>
|
|
||||||
#include <osgDB/FileUtils>
|
|
||||||
|
|
||||||
|
|
||||||
#include <osgViewer/Viewer>
|
#include <osgViewer/Viewer>
|
||||||
#include <osgViewer/ViewerEventHandlers>
|
#include <osgViewer/ViewerEventHandlers>
|
||||||
@@ -39,32 +36,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
static osgDB::DirectoryContents getSuitableFiles(osg::ArgumentParser& arguments)
|
|
||||||
{
|
|
||||||
osgDB::DirectoryContents files;
|
|
||||||
for(int i=1; i<arguments.argc(); ++i)
|
|
||||||
{
|
|
||||||
if (osgDB::fileType(arguments[i]) == osgDB::DIRECTORY)
|
|
||||||
{
|
|
||||||
const std::string& directory = arguments[i];
|
|
||||||
osgDB::DirectoryContents dc = osgDB::getSortedDirectoryContents(directory);
|
|
||||||
|
|
||||||
for(osgDB::DirectoryContents::iterator itr = dc.begin(); itr != dc.end(); ++itr)
|
|
||||||
{
|
|
||||||
std::string full_file_name = directory + "/" + (*itr);
|
|
||||||
std::string ext = osgDB::getLowerCaseFileExtension(full_file_name);
|
|
||||||
if ((ext == "jpg") || (ext == "png") || (ext == "gif") || (ext == "rgb") || (ext == "dds") )
|
|
||||||
{
|
|
||||||
files.push_back(full_file_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
files.push_back(arguments[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return files;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -98,20 +69,13 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
|
|||||||
double length = -1.0;
|
double length = -1.0;
|
||||||
while (arguments.read("--length",length)) {}
|
while (arguments.read("--length",length)) {}
|
||||||
|
|
||||||
double fps = 30.0;
|
if (arguments.argc()>1)
|
||||||
while (arguments.read("--fps",fps)) {}
|
|
||||||
|
|
||||||
osgDB::DirectoryContents files = getSuitableFiles(arguments);
|
|
||||||
if (!files.empty())
|
|
||||||
{
|
{
|
||||||
for(osgDB::DirectoryContents::iterator itr = files.begin();
|
for(int i=1; i<arguments.argc(); ++i)
|
||||||
itr != files.end();
|
|
||||||
++itr)
|
|
||||||
{
|
{
|
||||||
const std::string& filename = *itr;
|
|
||||||
if (preLoad)
|
if (preLoad)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Image> image = osgDB::readImageFile(filename);
|
osg::ref_ptr<osg::Image> image = osgDB::readImageFile(arguments[i]);
|
||||||
if (image.valid())
|
if (image.valid())
|
||||||
{
|
{
|
||||||
imageSequence->addImage(image.get());
|
imageSequence->addImage(image.get());
|
||||||
@@ -119,9 +83,8 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
imageSequence->addImageFile(filename);
|
imageSequence->addImageFile(arguments[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length>0.0)
|
if (length>0.0)
|
||||||
@@ -130,8 +93,10 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int maxNum = imageSequence->getNumImageData();
|
unsigned int maxNum = osg::maximum(imageSequence->getFileNames().size(),
|
||||||
imageSequence->setLength(double(maxNum)*(1.0/fps));
|
imageSequence->getImages().size());
|
||||||
|
|
||||||
|
imageSequence->setLength(float(maxNum)*0.1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -206,49 +171,12 @@ public:
|
|||||||
|
|
||||||
void set(osg::Node* node);
|
void set(osg::Node* node);
|
||||||
|
|
||||||
void setTrackMouse(bool tm)
|
|
||||||
{
|
|
||||||
if (tm==_trackMouse) return;
|
|
||||||
|
|
||||||
_trackMouse = tm;
|
|
||||||
|
|
||||||
std::cout << "tracking mouse: " << (_trackMouse ? "ON" : "OFF") << std::endl;
|
|
||||||
|
|
||||||
for(ImageStreamList::iterator itr=_imageStreamList.begin();
|
|
||||||
itr!=_imageStreamList.end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
if ((*itr)->getStatus()==osg::ImageStream::PLAYING)
|
|
||||||
{
|
|
||||||
(*itr)->pause();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
(*itr)->play();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool getTrackMouse() const { return _trackMouse; }
|
|
||||||
|
|
||||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv);
|
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv);
|
||||||
|
|
||||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||||
|
|
||||||
typedef std::vector< osg::observer_ptr<osg::ImageStream> > ImageStreamList;
|
typedef std::vector< osg::observer_ptr<osg::ImageStream> > ImageStreamList;
|
||||||
|
|
||||||
struct ImageStreamPlaybackSpeedData {
|
|
||||||
double fps;
|
|
||||||
unsigned char* lastData;
|
|
||||||
double timeStamp, lastOutput;
|
|
||||||
|
|
||||||
ImageStreamPlaybackSpeedData() : fps(0), lastData(NULL), timeStamp(0), lastOutput(0) {}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::vector< ImageStreamPlaybackSpeedData > ImageStreamPlayBackSpeedList;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual ~MovieEventHandler() {}
|
virtual ~MovieEventHandler() {}
|
||||||
@@ -312,7 +240,6 @@ protected:
|
|||||||
bool _playToggle;
|
bool _playToggle;
|
||||||
bool _trackMouse;
|
bool _trackMouse;
|
||||||
ImageStreamList _imageStreamList;
|
ImageStreamList _imageStreamList;
|
||||||
ImageStreamPlayBackSpeedList _imageStreamPlayBackSpeedList;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -326,7 +253,6 @@ void MovieEventHandler::set(osg::Node* node)
|
|||||||
FindImageStreamsVisitor fisv(_imageStreamList);
|
FindImageStreamsVisitor fisv(_imageStreamList);
|
||||||
node->accept(fisv);
|
node->accept(fisv);
|
||||||
}
|
}
|
||||||
_imageStreamPlayBackSpeedList.resize(_imageStreamList.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -334,53 +260,6 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
|
|||||||
{
|
{
|
||||||
switch(ea.getEventType())
|
switch(ea.getEventType())
|
||||||
{
|
{
|
||||||
case(osgGA::GUIEventAdapter::FRAME):
|
|
||||||
{
|
|
||||||
double t = ea.getTime();
|
|
||||||
bool printed(false);
|
|
||||||
|
|
||||||
ImageStreamPlayBackSpeedList::iterator fps_itr = _imageStreamPlayBackSpeedList.begin();
|
|
||||||
for(ImageStreamList::iterator itr=_imageStreamList.begin();
|
|
||||||
itr!=_imageStreamList.end();
|
|
||||||
++itr, ++fps_itr)
|
|
||||||
{
|
|
||||||
if (((*itr)->getStatus()==osg::ImageStream::PLAYING) && ((*itr)->data() != (*fps_itr).lastData))
|
|
||||||
{
|
|
||||||
ImageStreamPlaybackSpeedData& data(*fps_itr);
|
|
||||||
double dt = (data.timeStamp > 0) ? t - data.timeStamp : 1/60.0;
|
|
||||||
data.lastData = (*itr)->data();
|
|
||||||
data.fps = (*fps_itr).fps * 0.8 + 0.2 * (1/dt);
|
|
||||||
data.timeStamp = t;
|
|
||||||
|
|
||||||
if (t-data.lastOutput > 1)
|
|
||||||
{
|
|
||||||
std::cout << data.fps << " ";
|
|
||||||
data.lastOutput = t;
|
|
||||||
printed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (printed)
|
|
||||||
std::cout << std::endl;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case(osgGA::GUIEventAdapter::MOVE):
|
|
||||||
{
|
|
||||||
if (_trackMouse)
|
|
||||||
{
|
|
||||||
for(ImageStreamList::iterator itr=_imageStreamList.begin();
|
|
||||||
itr!=_imageStreamList.end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
double dt = (*itr)->getLength() * ((1.0+ea.getXnormalized()) / 2.0);
|
|
||||||
(*itr)->seek(dt);
|
|
||||||
std::cout << "seeking to " << dt << " length: " <<(*itr)->getLength() << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case(osgGA::GUIEventAdapter::KEYDOWN):
|
case(osgGA::GUIEventAdapter::KEYDOWN):
|
||||||
{
|
{
|
||||||
if (ea.getKey()=='p')
|
if (ea.getKey()=='p')
|
||||||
@@ -433,12 +312,6 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
else if (ea.getKey() == 'i')
|
|
||||||
{
|
|
||||||
setTrackMouse(!_trackMouse);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -446,13 +319,10 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovieEventHandler::getUsage(osg::ApplicationUsage& usage) const
|
void MovieEventHandler::getUsage(osg::ApplicationUsage& usage) const
|
||||||
{
|
{
|
||||||
usage.addKeyboardMouseBinding("i","toggle interactive mode, scrub via mouse-move");
|
|
||||||
usage.addKeyboardMouseBinding("p","Play/Pause movie");
|
usage.addKeyboardMouseBinding("p","Play/Pause movie");
|
||||||
usage.addKeyboardMouseBinding("r","Restart movie");
|
usage.addKeyboardMouseBinding("r","Restart movie");
|
||||||
usage.addKeyboardMouseBinding("l","Toggle looping of movie");
|
usage.addKeyboardMouseBinding("l","Toggle looping of movie");
|
||||||
@@ -477,9 +347,6 @@ int main(int argc, char **argv)
|
|||||||
// pass the model to the MovieEventHandler so it can pick out ImageStream's to manipulate.
|
// pass the model to the MovieEventHandler so it can pick out ImageStream's to manipulate.
|
||||||
MovieEventHandler* meh = new MovieEventHandler();
|
MovieEventHandler* meh = new MovieEventHandler();
|
||||||
meh->set( viewer.getSceneData() );
|
meh->set( viewer.getSceneData() );
|
||||||
|
|
||||||
if (arguments.read("--track-mouse")) meh->setTrackMouse(true);
|
|
||||||
|
|
||||||
viewer.addEventHandler( meh );
|
viewer.addEventHandler( meh );
|
||||||
|
|
||||||
viewer.addEventHandler( new osgViewer::StatsHandler());
|
viewer.addEventHandler( new osgViewer::StatsHandler());
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ typedef NodeContainer::iterator NodeIterator;
|
|||||||
NodeContainer nodes;
|
NodeContainer nodes;
|
||||||
|
|
||||||
//
|
//
|
||||||
osg::ref_ptr<osg::Group> Root = 0;
|
osg::Group * Root = 0;
|
||||||
|
|
||||||
const int HOUSES_SIZE = 25000; // total number of houses
|
const int HOUSES_SIZE = 25000; // total number of houses
|
||||||
double XDim = 5000.0f; // area dimension +/- XDim
|
double XDim = 5000.0f; // area dimension +/- XDim
|
||||||
@@ -81,11 +81,11 @@ void CreateHouses()
|
|||||||
};
|
};
|
||||||
|
|
||||||
// use the same color, normal and indices for all houses.
|
// use the same color, normal and indices for all houses.
|
||||||
osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array(1);
|
osg::Vec4Array* colors = new osg::Vec4Array(1);
|
||||||
(*colors)[0] = osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f);
|
(*colors)[0] = osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
// normals
|
// normals
|
||||||
osg::ref_ptr<osg::Vec3Array> normals = new osg::Vec3Array(16);
|
osg::Vec3Array * normals = new osg::Vec3Array(16);
|
||||||
(*normals)[0] = osg::Vec3( 0.0f, -0.0f, -1.0f);
|
(*normals)[0] = osg::Vec3( 0.0f, -0.0f, -1.0f);
|
||||||
(*normals)[1] = osg::Vec3( 0.0f, -0.0f, -1.0f);
|
(*normals)[1] = osg::Vec3( 0.0f, -0.0f, -1.0f);
|
||||||
(*normals)[2] = osg::Vec3( 0.0f, -1.0f, 0.0f);
|
(*normals)[2] = osg::Vec3( 0.0f, -1.0f, 0.0f);
|
||||||
@@ -104,10 +104,10 @@ void CreateHouses()
|
|||||||
(*normals)[15] = osg::Vec3(-0.707107f, 0.0f, 0.707107f);
|
(*normals)[15] = osg::Vec3(-0.707107f, 0.0f, 0.707107f);
|
||||||
|
|
||||||
// coordIndices
|
// coordIndices
|
||||||
osg::ref_ptr<osg::UByteArray> coordIndices = new osg::UByteArray(48,indices);
|
osg::UByteArray* coordIndices = new osg::UByteArray(48,indices);
|
||||||
|
|
||||||
// share the primitive set.
|
// share the primitive set.
|
||||||
osg::PrimitiveSet* primitives = new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,0,48);
|
osg::PrimitiveSet* primitives = new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,0,48);
|
||||||
|
|
||||||
for (int q = 0; q < HOUSES_SIZE; q++)
|
for (int q = 0; q < HOUSES_SIZE; q++)
|
||||||
{
|
{
|
||||||
@@ -121,10 +121,10 @@ void CreateHouses()
|
|||||||
|
|
||||||
float scale = 10.0f;
|
float scale = 10.0f;
|
||||||
|
|
||||||
osg::Vec3 offset(xPos,yPos,0.0f);
|
osg::Vec3 offset(xPos,yPos,0.0f);
|
||||||
|
|
||||||
// coords
|
// coords
|
||||||
osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array(10);
|
osg::Vec3Array* coords = new osg::Vec3Array(10);
|
||||||
(*coords)[0] = osg::Vec3( 0.5f, -0.7f, 0.0f);
|
(*coords)[0] = osg::Vec3( 0.5f, -0.7f, 0.0f);
|
||||||
(*coords)[1] = osg::Vec3( 0.5f, 0.7f, 0.0f);
|
(*coords)[1] = osg::Vec3( 0.5f, 0.7f, 0.0f);
|
||||||
(*coords)[2] = osg::Vec3(-0.5f, 0.7f, 0.0f);
|
(*coords)[2] = osg::Vec3(-0.5f, 0.7f, 0.0f);
|
||||||
@@ -143,23 +143,23 @@ void CreateHouses()
|
|||||||
|
|
||||||
|
|
||||||
// create geometry
|
// create geometry
|
||||||
osg::ref_ptr<deprecated_osg::Geometry> geometry = new deprecated_osg::Geometry();
|
osg::Geometry * geometry = new osg::Geometry();
|
||||||
|
|
||||||
geometry->addPrimitiveSet(primitives);
|
geometry->addPrimitiveSet(primitives);
|
||||||
|
|
||||||
geometry->setVertexArray(coords.get());
|
geometry->setVertexArray(coords);
|
||||||
geometry->setVertexIndices(coordIndices.get());
|
geometry->setVertexIndices(coordIndices);
|
||||||
|
|
||||||
geometry->setColorArray(colors.get());
|
geometry->setColorArray(colors);
|
||||||
geometry->setColorBinding(deprecated_osg::Geometry::BIND_OVERALL);
|
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||||
|
|
||||||
geometry->setNormalArray(normals.get());
|
geometry->setNormalArray(normals);
|
||||||
geometry->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
|
geometry->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE);
|
||||||
|
|
||||||
osg::ref_ptr<osg::Geode> geode = new osg::Geode();
|
osg::Geode * geode = new osg::Geode();
|
||||||
geode->addDrawable(geometry.get());
|
geode->addDrawable(geometry);
|
||||||
|
|
||||||
nodes.push_back(geode.get());
|
nodes.push_back(geode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,14 +244,14 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::ref_ptr<osg::Node> model = osgDB::readNodeFiles(arguments);
|
osg::Node* model = osgDB::readNodeFiles(arguments);
|
||||||
if (model)
|
if (model)
|
||||||
{
|
{
|
||||||
// the osgSim::InsertImpostorsVisitor used lower down to insert impostors
|
// the osgSim::InsertImpostorsVisitor used lower down to insert impostors
|
||||||
// only operators on subclass of Group's, if the model top node is not
|
// only operators on subclass of Group's, if the model top node is not
|
||||||
// a group then it won't be able to insert an impostor. We therefore
|
// a group then it won't be able to insert an impostor. We therefore
|
||||||
// manually insert an impostor above the model.
|
// manually insert an impostor above the model.
|
||||||
if (dynamic_cast<osg::Group*>(model.get())==0)
|
if (dynamic_cast<osg::Group*>(model)==0)
|
||||||
{
|
{
|
||||||
const osg::BoundingSphere& bs = model->getBound();
|
const osg::BoundingSphere& bs = model->getBound();
|
||||||
if (bs.valid())
|
if (bs.valid())
|
||||||
@@ -260,7 +260,7 @@ int main( int argc, char **argv )
|
|||||||
osgSim::Impostor* impostor = new osgSim::Impostor;
|
osgSim::Impostor* impostor = new osgSim::Impostor;
|
||||||
|
|
||||||
// standard LOD settings
|
// standard LOD settings
|
||||||
impostor->addChild(model.get());
|
impostor->addChild(model);
|
||||||
impostor->setRange(0,0.0f,1e7f);
|
impostor->setRange(0,0.0f,1e7f);
|
||||||
impostor->setCenter(bs.center());
|
impostor->setCenter(bs.center());
|
||||||
|
|
||||||
@@ -279,8 +279,8 @@ int main( int argc, char **argv )
|
|||||||
// up from model. This is really what should be done, but I'll pass
|
// up from model. This is really what should be done, but I'll pass
|
||||||
// on it right now as it requires a getRoots() method to be added to
|
// on it right now as it requires a getRoots() method to be added to
|
||||||
// osg::Node, and we're about to make a release so no new features!
|
// osg::Node, and we're about to make a release so no new features!
|
||||||
osg::ref_ptr<osg::Group> rootnode = new osg::Group;
|
osg::Group* rootnode = new osg::Group;
|
||||||
rootnode->addChild(model.get());
|
rootnode->addChild(model);
|
||||||
|
|
||||||
|
|
||||||
// now insert impostors in the model using the InsertImpostorsVisitor.
|
// now insert impostors in the model using the InsertImpostorsVisitor.
|
||||||
@@ -304,7 +304,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add model to viewer.
|
// add model to viewer.
|
||||||
viewer.setSceneData(model.get());
|
viewer.setSceneData(model);
|
||||||
|
|
||||||
return viewer.run();
|
return viewer.run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
SET(TARGET_SRC
|
|
||||||
osgkeystone.cpp )
|
|
||||||
|
|
||||||
#### end var setup ###
|
|
||||||
SETUP_EXAMPLE(osgkeystone)
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
/* OpenSceneGraph example, osganimate.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <osg/Notify>
|
|
||||||
#include <osg/io_utils>
|
|
||||||
#include <osg/TextureRectangle>
|
|
||||||
#include <osg/TexMat>
|
|
||||||
#include <osg/Stencil>
|
|
||||||
#include <osg/PolygonStipple>
|
|
||||||
#include <osg/ValueObject>
|
|
||||||
|
|
||||||
#include <osgDB/ReadFile>
|
|
||||||
#include <osgDB/WriteFile>
|
|
||||||
#include <osgGA/StateSetManipulator>
|
|
||||||
#include <osgGA/TrackballManipulator>
|
|
||||||
#include <osgViewer/Viewer>
|
|
||||||
#include <osgViewer/ViewerEventHandlers>
|
|
||||||
#include <osgViewer/config/SingleWindow>
|
|
||||||
#include <osgViewer/config/SingleScreen>
|
|
||||||
#include <osgViewer/config/WoWVxDisplay>
|
|
||||||
|
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
|
||||||
{
|
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
|
||||||
|
|
||||||
// initialize the viewer.
|
|
||||||
osgViewer::Viewer viewer(arguments);
|
|
||||||
|
|
||||||
osg::DisplaySettings* ds = viewer.getDisplaySettings() ? viewer.getDisplaySettings() : osg::DisplaySettings::instance().get();
|
|
||||||
ds->readCommandLine(arguments);
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> model = osgDB::readNodeFiles(arguments);
|
|
||||||
|
|
||||||
if (!model)
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"No models loaded, please specify a model file on the command line"<<std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
OSG_NOTICE<<"Stereo "<<ds->getStereo()<<std::endl;
|
|
||||||
OSG_NOTICE<<"StereoMode "<<ds->getStereoMode()<<std::endl;
|
|
||||||
|
|
||||||
viewer.setSceneData(model.get());
|
|
||||||
|
|
||||||
// add the state manipulator
|
|
||||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
|
||||||
|
|
||||||
// add the stats handler
|
|
||||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
|
||||||
|
|
||||||
// add camera manipulator
|
|
||||||
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
|
|
||||||
|
|
||||||
OSG_NOTICE<<"KeystoneFileNames.size()="<<ds->getKeystoneFileNames().size()<<std::endl;
|
|
||||||
for(osg::DisplaySettings::FileNames::iterator itr = ds->getKeystoneFileNames().begin();
|
|
||||||
itr != ds->getKeystoneFileNames().end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<" keystone filename = "<<*itr<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
ds->setKeystoneHint(true);
|
|
||||||
|
|
||||||
if (!ds->getKeystoneFileNames().empty())
|
|
||||||
{
|
|
||||||
for(osg::DisplaySettings::Objects::iterator itr = ds->getKeystones().begin();
|
|
||||||
itr != ds->getKeystones().end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
osgViewer::Keystone* keystone = dynamic_cast<osgViewer::Keystone*>(itr->get());
|
|
||||||
if (keystone)
|
|
||||||
{
|
|
||||||
std::string filename;
|
|
||||||
keystone->getUserValue("filename",filename);
|
|
||||||
OSG_NOTICE<<"Loaded keystone "<<filename<<", "<<keystone<<std::endl;
|
|
||||||
|
|
||||||
ds->getKeystones().push_back(keystone);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
viewer.apply(new osgViewer::SingleScreen(0));
|
|
||||||
|
|
||||||
viewer.realize();
|
|
||||||
|
|
||||||
while(!viewer.done())
|
|
||||||
{
|
|
||||||
viewer.advance();
|
|
||||||
viewer.eventTraversal();
|
|
||||||
viewer.updateTraversal();
|
|
||||||
viewer.renderingTraversals();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user