Compare commits
1192 Commits
OpenSceneG
...
OpenSceneG
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d69f2a81f9 | ||
|
|
35334daae4 | ||
|
|
14232cd993 | ||
|
|
ec86072533 | ||
|
|
3f66f1d276 | ||
|
|
c1055fdfbc | ||
|
|
328632af75 | ||
|
|
ec89d96114 | ||
|
|
ea17943a74 | ||
|
|
07d05840e9 | ||
|
|
d108bea9eb | ||
|
|
1bc5ef030f | ||
|
|
15e60acfb5 | ||
|
|
4710b6556d | ||
|
|
a231483ea6 | ||
|
|
5e48c51bd7 | ||
|
|
036c6676c1 | ||
|
|
ed9c28b4ec | ||
|
|
50e471d900 | ||
|
|
5b7ef57ad7 | ||
|
|
a3e11f1d50 | ||
|
|
4e67d6deb2 | ||
|
|
edee9d0946 | ||
|
|
e5cccefafe | ||
|
|
2c35b63d38 | ||
|
|
700dd2b9a7 | ||
|
|
c1585d3c17 | ||
|
|
76a92314cf | ||
|
|
60eb458c47 | ||
|
|
7e5a9582b3 | ||
|
|
662e76d721 | ||
|
|
428f4a3804 | ||
|
|
23edfad1fd | ||
|
|
0c1fad2c91 | ||
|
|
1201ac230d | ||
|
|
eabd08ef25 | ||
|
|
a5bcbc1822 | ||
|
|
f822603446 | ||
|
|
f449bd3730 | ||
|
|
b37b635a7c | ||
|
|
224f837e0d | ||
|
|
1d7d1dda42 | ||
|
|
ac36649ed6 | ||
|
|
9c7a474032 | ||
|
|
06a45ef889 | ||
|
|
1e4f6f675b | ||
|
|
e6ab01c7c6 | ||
|
|
b2cd4b5836 | ||
|
|
09b37224ff | ||
|
|
6d4afbbb49 | ||
|
|
8b433f8364 | ||
|
|
10c1fedfca | ||
|
|
0af180f8b0 | ||
|
|
b001e8d36d | ||
|
|
397ab4aa51 | ||
|
|
9eaf03e16e | ||
|
|
9ba9221ccf | ||
|
|
16591a310a | ||
|
|
1b9e1301cf | ||
|
|
796b9f0a9b | ||
|
|
232d227170 | ||
|
|
95818b0819 | ||
|
|
ad0a73273c | ||
|
|
168212f383 | ||
|
|
320e0ce60c | ||
|
|
6f1a828b37 | ||
|
|
e07f1ff5e9 | ||
|
|
b6ec9dc532 | ||
|
|
d93d2e0ec1 | ||
|
|
f272089857 | ||
|
|
ad917a5318 | ||
|
|
f0056c6d3b | ||
|
|
fe25b2961b | ||
|
|
6511347d4b | ||
|
|
192e654cdb | ||
|
|
b59c46c3cf | ||
|
|
29049ea238 | ||
|
|
46df1fd141 | ||
|
|
8af48d369c | ||
|
|
95d450e026 | ||
|
|
b58048e43b | ||
|
|
1f1c21772a | ||
|
|
fa27a1f3ed | ||
|
|
d5d4f7239b | ||
|
|
2a110515c1 | ||
|
|
d2a0315e20 | ||
|
|
1f9725ea49 | ||
|
|
d772304cec | ||
|
|
192574958a | ||
|
|
7df7eb78ac | ||
|
|
e2359890bd | ||
|
|
912e4f8a0c | ||
|
|
78300f7d61 | ||
|
|
2bd81226c3 | ||
|
|
37f6e2b39e | ||
|
|
2f4064d757 | ||
|
|
04f27c370e | ||
|
|
02eb8de191 | ||
|
|
d3f5aef5ef | ||
|
|
ec8cb360c8 | ||
|
|
8c79dccbbc | ||
|
|
517728c7d9 | ||
|
|
0f7e30a74e | ||
|
|
6cacc5a2c2 | ||
|
|
aae4f22163 | ||
|
|
6eaf2f5781 | ||
|
|
e536d8e601 | ||
|
|
af9d8889c8 | ||
|
|
a4c9cac2a8 | ||
|
|
5c46d9de3e | ||
|
|
8d08b75e19 | ||
|
|
6ec5d80b0d | ||
|
|
f48b5a3fdb | ||
|
|
7bcc5d861e | ||
|
|
933b8cdbaf | ||
|
|
7200e38fce | ||
|
|
4a1f033dbe | ||
|
|
ec19ee9655 | ||
|
|
653af27d02 | ||
|
|
29ce4f616d | ||
|
|
f39cc7b6f1 | ||
|
|
879a8bd020 | ||
|
|
ccb06f003a | ||
|
|
79fa48c984 | ||
|
|
47022a1bf0 | ||
|
|
926cffb2ee | ||
|
|
f044bc6b45 | ||
|
|
ac8bbb9d1e | ||
|
|
db24f7f09d | ||
|
|
520b6c24f6 | ||
|
|
244cec821e | ||
|
|
ba309bf38b | ||
|
|
60a7b8ce02 | ||
|
|
3a15c66290 | ||
|
|
577d161303 | ||
|
|
6011bc4307 | ||
|
|
40caedc7cd | ||
|
|
4371512dd2 | ||
|
|
9132d98785 | ||
|
|
47c531cc37 | ||
|
|
4704621c39 | ||
|
|
0244b234ca | ||
|
|
09fd75dcf4 | ||
|
|
c3d45732a1 | ||
|
|
89f74b1a56 | ||
|
|
6089257d3c | ||
|
|
97336b89ac | ||
|
|
229b833a5a | ||
|
|
7ae1421864 | ||
|
|
bf1aa5088e | ||
|
|
e798db04c8 | ||
|
|
adbadd66be | ||
|
|
bd0cf5e47d | ||
|
|
7239050c5b | ||
|
|
55bb474c3b | ||
|
|
ff1051a6fd | ||
|
|
845bb6aceb | ||
|
|
3e23c5b22d | ||
|
|
5675d86c9b | ||
|
|
5405d9c465 | ||
|
|
3b17418031 | ||
|
|
9fc6850962 | ||
|
|
46904ff67a | ||
|
|
636d595912 | ||
|
|
5310a96c73 | ||
|
|
5dc251a5c1 | ||
|
|
6a67be2e32 | ||
|
|
74f1838960 | ||
|
|
f4e71bad3a | ||
|
|
61d317b0b8 | ||
|
|
05f3e038d8 | ||
|
|
1a9a74216b | ||
|
|
6344d4430d | ||
|
|
3c7bf7ec8a | ||
|
|
87e5c54ee7 | ||
|
|
0567ce316d | ||
|
|
5cbd785f78 | ||
|
|
4ee38248a2 | ||
|
|
f4013a68da | ||
|
|
2ad1e661e0 | ||
|
|
c1d5b6992c | ||
|
|
b92c3f1455 | ||
|
|
9975e15a97 | ||
|
|
5b242d22ff | ||
|
|
814a885a6c | ||
|
|
471b256d30 | ||
|
|
8f73ddc27d | ||
|
|
0874f126c0 | ||
|
|
697128a11d | ||
|
|
96d247aa7e | ||
|
|
c0ac503123 | ||
|
|
b74924fab4 | ||
|
|
75217a2ed5 | ||
|
|
2bed348da1 | ||
|
|
af8b11a391 | ||
|
|
27f080159e | ||
|
|
e8722e76ea | ||
|
|
8b4ff0f50a | ||
|
|
559da06ffa | ||
|
|
5c40e9bf81 | ||
|
|
1186143571 | ||
|
|
732364d49b | ||
|
|
0153c3e7e2 | ||
|
|
5e8d5b50db | ||
|
|
e9b75e0ded | ||
|
|
803677e03c | ||
|
|
0f97a42e17 | ||
|
|
91fd245d7c | ||
|
|
eb90d9aa34 | ||
|
|
8e9f688809 | ||
|
|
6c1c179c62 | ||
|
|
cfe3e621ad | ||
|
|
761cf52bb7 | ||
|
|
42efcf24fb | ||
|
|
0a56f65077 | ||
|
|
3339395071 | ||
|
|
34e53a37e0 | ||
|
|
482fd41d58 | ||
|
|
2eef9d233b | ||
|
|
4a886c6e22 | ||
|
|
717d566713 | ||
|
|
1d0a265cd4 | ||
|
|
3d69d46e3e | ||
|
|
8e20224828 | ||
|
|
6e65a9955e | ||
|
|
2264c3b7e2 | ||
|
|
8c991c056f | ||
|
|
34ab8bc048 | ||
|
|
d73e979ea8 | ||
|
|
6273495c64 | ||
|
|
8f26396e78 | ||
|
|
78bf1e8ea4 | ||
|
|
83a03f3346 | ||
|
|
4626f6fb6a | ||
|
|
9e581f91db | ||
|
|
887768b55a | ||
|
|
5b1cfd26ab | ||
|
|
f48a4baa4e | ||
|
|
49c802153d | ||
|
|
13e79d3210 | ||
|
|
236617b6c5 | ||
|
|
a0229ee684 | ||
|
|
5ebfa0a71e | ||
|
|
5acad4e07e | ||
|
|
ccae59e98a | ||
|
|
222871aade | ||
|
|
d221133728 | ||
|
|
2eff96d1a4 | ||
|
|
0394ba5453 | ||
|
|
1db8a4e818 | ||
|
|
a39578826c | ||
|
|
98ebacdcbb | ||
|
|
04f4b542bd | ||
|
|
f0ac1a16f9 | ||
|
|
08893c7fcc | ||
|
|
17dfbe99fc | ||
|
|
74ddaeaf50 | ||
|
|
2f7193ee4c | ||
|
|
b4cd40cf7c | ||
|
|
5cd478e4bb | ||
|
|
d3baf9d311 | ||
|
|
fe09ebfbdb | ||
|
|
b5a3a58076 | ||
|
|
3bcfad833c | ||
|
|
6f00eb2548 | ||
|
|
4ec0e76c0b | ||
|
|
1e0d682979 | ||
|
|
824cc95518 | ||
|
|
08d2d322d9 | ||
|
|
75891924bb | ||
|
|
82c188c24a | ||
|
|
1e78098967 | ||
|
|
fc9848ff19 | ||
|
|
8aee04c780 | ||
|
|
e69405f99a | ||
|
|
e76c91ed78 | ||
|
|
d2e0081690 | ||
|
|
11a55ea6de | ||
|
|
bd9bd3f8b2 | ||
|
|
7e05d2fd54 | ||
|
|
37d051af5e | ||
|
|
03565e3bbe | ||
|
|
4073910ce8 | ||
|
|
ceabbdb8d9 | ||
|
|
f7f1487fca | ||
|
|
1f0ba7aa4f | ||
|
|
32b60cd2d7 | ||
|
|
ff42ff2a11 | ||
|
|
23cd6d2ba3 | ||
|
|
95f911e98c | ||
|
|
fd46645ade | ||
|
|
fd806293be | ||
|
|
9222506a2c | ||
|
|
e7244e654a | ||
|
|
da73723949 | ||
|
|
e3f0876e87 | ||
|
|
80791c6972 | ||
|
|
ba9dfb2ff6 | ||
|
|
d14a602a59 | ||
|
|
e0028bef6e | ||
|
|
120bf699b2 | ||
|
|
78a01ce2a5 | ||
|
|
44c406e167 | ||
|
|
f72b62a065 | ||
|
|
4f423ff66b | ||
|
|
906bb27fa0 | ||
|
|
0f35f31d72 | ||
|
|
ddda9a6a0d | ||
|
|
01e87939a4 | ||
|
|
820166b49d | ||
|
|
05841d7c00 | ||
|
|
95a507299b | ||
|
|
d5b615a4e1 | ||
|
|
2e11113072 | ||
|
|
180ce288c3 | ||
|
|
89fd422c98 | ||
|
|
5380aebfc1 | ||
|
|
eb5791e5e2 | ||
|
|
8962838e6a | ||
|
|
e52b95e084 | ||
|
|
5be2e05b18 | ||
|
|
f66b430476 | ||
|
|
7d66324e5d | ||
|
|
2b1abf1937 | ||
|
|
5237185e8c | ||
|
|
6a4a21afe3 | ||
|
|
e08fd168f6 | ||
|
|
54b389a18a | ||
|
|
1020e22c33 | ||
|
|
14ef282297 | ||
|
|
ed7629351f | ||
|
|
f4196dfe64 | ||
|
|
3bc1102f11 | ||
|
|
a583b306c5 | ||
|
|
3a2380932f | ||
|
|
c61c3d5500 | ||
|
|
4a734b314c | ||
|
|
bf0425f628 | ||
|
|
eb893eba75 | ||
|
|
1909de938a | ||
|
|
3add98180c | ||
|
|
87122ca369 | ||
|
|
0a1db3d6fc | ||
|
|
166c49eedd | ||
|
|
a711fdba36 | ||
|
|
0335ea3760 | ||
|
|
16b19a0c30 | ||
|
|
595a048319 | ||
|
|
70b5297575 | ||
|
|
ab2fc1be76 | ||
|
|
abdb23e367 | ||
|
|
31488eeba1 | ||
|
|
6cff8650f2 | ||
|
|
814693ffc1 | ||
|
|
4c84742664 | ||
|
|
c753dbc3e6 | ||
|
|
40a7f903ec | ||
|
|
8fb08496ae | ||
|
|
950d7bb60b | ||
|
|
9aa8d641a0 | ||
|
|
de415fbcf9 | ||
|
|
5229280901 | ||
|
|
a7ba138dc7 | ||
|
|
99f7bfab3b | ||
|
|
296c12a8e9 | ||
|
|
307e70f13b | ||
|
|
06e6f368fc | ||
|
|
890aea9537 | ||
|
|
953828a817 | ||
|
|
6854d2968f | ||
|
|
63a3595aab | ||
|
|
d9f920ee37 | ||
|
|
31fd2456b6 | ||
|
|
bf86b031e0 | ||
|
|
535b168d81 | ||
|
|
c086bef5ed | ||
|
|
fb4a2d7128 | ||
|
|
b8cd439697 | ||
|
|
728d5ead52 | ||
|
|
6d47fe4d98 | ||
|
|
e6e39e7924 | ||
|
|
7165182e35 | ||
|
|
a88fa6f7b7 | ||
|
|
58717d9279 | ||
|
|
e2f208af54 | ||
|
|
dd2de7f132 | ||
|
|
d3e9c44440 | ||
|
|
3d144a0312 | ||
|
|
53859bb3de | ||
|
|
11f5039695 | ||
|
|
75b9cd3627 | ||
|
|
b6acb1a8d3 | ||
|
|
c30be2355b | ||
|
|
d97e01c520 | ||
|
|
2a84719f4a | ||
|
|
9e2c23c9d3 | ||
|
|
6a860e5e82 | ||
|
|
e5b533726e | ||
|
|
ed9502e017 | ||
|
|
efb90a6a80 | ||
|
|
8c8b8f3305 | ||
|
|
26d1679248 | ||
|
|
412a9154c3 | ||
|
|
66aef5dfc9 | ||
|
|
5346e7772a | ||
|
|
ec6edf535d | ||
|
|
4c4738eced | ||
|
|
925c37b783 | ||
|
|
58edd10d04 | ||
|
|
1d9e7f144b | ||
|
|
0a83632f0a | ||
|
|
321750d72d | ||
|
|
e3e1a55702 | ||
|
|
e9f497aa1f | ||
|
|
b59b0e0253 | ||
|
|
d03b38dea8 | ||
|
|
23b76599bd | ||
|
|
f93a4f330a | ||
|
|
6a30705870 | ||
|
|
9dffd49241 | ||
|
|
77f662f9f7 | ||
|
|
63acee9ee3 | ||
|
|
d1c93f6bad | ||
|
|
11ff450231 | ||
|
|
9362339242 | ||
|
|
32831b1ef8 | ||
|
|
5f1b41a84f | ||
|
|
1db6def2c4 | ||
|
|
47202acc24 | ||
|
|
30a62bc4ad | ||
|
|
47db2da8b4 | ||
|
|
7d50c8e634 | ||
|
|
e7d41377be | ||
|
|
213efd20ad | ||
|
|
bd3f390b2f | ||
|
|
594b3064c0 | ||
|
|
685a270c18 | ||
|
|
1320c923ca | ||
|
|
72c4f3a8ba | ||
|
|
afbf20eba9 | ||
|
|
5c023d1f76 | ||
|
|
e5d51da1b3 | ||
|
|
4cb5bce66a | ||
|
|
3e2305d815 | ||
|
|
8546e911fc | ||
|
|
441dbe6b02 | ||
|
|
53198f2e9b | ||
|
|
6bddbdf074 | ||
|
|
77b8962bcc | ||
|
|
a40260a5a5 | ||
|
|
66210a6aca | ||
|
|
9fa3defb0e | ||
|
|
4a9f4aae9d | ||
|
|
a676d5d37b | ||
|
|
06f186dc07 | ||
|
|
ea7dbabda1 | ||
|
|
b38c6258bf | ||
|
|
b90503fdf5 | ||
|
|
bb637e73f3 | ||
|
|
1debc21bb2 | ||
|
|
bbb54cedc7 | ||
|
|
a9804d7e19 | ||
|
|
045caf1086 | ||
|
|
4bcf4cf7bb | ||
|
|
22cf4c18c3 | ||
|
|
f5faf615ef | ||
|
|
51b19d2d8b | ||
|
|
e330e9309c | ||
|
|
4a668d53c5 | ||
|
|
d5f2c34f24 | ||
|
|
7fbeeefea8 | ||
|
|
3ab06c54bf | ||
|
|
51afa2c1df | ||
|
|
a0f1442aae | ||
|
|
98f5fca9c2 | ||
|
|
0a4efa35c3 | ||
|
|
3eca5765c9 | ||
|
|
249c0ff208 | ||
|
|
3e3d7e4dc1 | ||
|
|
ed57c8718c | ||
|
|
d409ffcb91 | ||
|
|
bf794165d5 | ||
|
|
134b2e506f | ||
|
|
8b384baca9 | ||
|
|
f9f480b935 | ||
|
|
4538a0fa41 | ||
|
|
f7b95ea4e5 | ||
|
|
b1852757b5 | ||
|
|
ace32ebe6c | ||
|
|
1b1c987356 | ||
|
|
78729e28fd | ||
|
|
50203023c7 | ||
|
|
a331680cec | ||
|
|
2870c12b03 | ||
|
|
18323ac899 | ||
|
|
c57e62e799 | ||
|
|
f984f6032f | ||
|
|
5a4f962013 | ||
|
|
dd650921b1 | ||
|
|
73221e8682 | ||
|
|
8e901ebbac | ||
|
|
4945e03bcb | ||
|
|
c6013c721e | ||
|
|
dfc02b78bf | ||
|
|
a03ec99005 | ||
|
|
8be71caeaf | ||
|
|
b163ff8562 | ||
|
|
4ce6b07886 | ||
|
|
2a46857353 | ||
|
|
e281c264a7 | ||
|
|
34177d3f63 | ||
|
|
6f9ac83693 | ||
|
|
075e874c85 | ||
|
|
af16041f57 | ||
|
|
adf9596316 | ||
|
|
69abe094ab | ||
|
|
4513709a1b | ||
|
|
e7ea085912 | ||
|
|
e4e22bb1af | ||
|
|
4dfe6ab048 | ||
|
|
6cd9932780 | ||
|
|
58c47e9842 | ||
|
|
117869d154 | ||
|
|
811dde86c8 | ||
|
|
49c48a5509 | ||
|
|
1b6e50a2dd | ||
|
|
92e2d849ed | ||
|
|
487c2b5f67 | ||
|
|
3c07921dee | ||
|
|
485709f708 | ||
|
|
09205544b7 | ||
|
|
7629a5126a | ||
|
|
22e51c9902 | ||
|
|
a6aa47afcd | ||
|
|
d166b6d1df | ||
|
|
d32cd203a2 | ||
|
|
43049ebcf1 | ||
|
|
d5fcdabfa1 | ||
|
|
e31f682451 | ||
|
|
3f1e77d479 | ||
|
|
ec4f898bce | ||
|
|
cceee38727 | ||
|
|
a8804e2366 | ||
|
|
35cfbfdb8c | ||
|
|
bc424bc54f | ||
|
|
9b03b3f8ce | ||
|
|
f634152de0 | ||
|
|
1ce8029f39 | ||
|
|
1bcb944ddc | ||
|
|
aa090f0f99 | ||
|
|
d83e641fad | ||
|
|
d02c0bdc49 | ||
|
|
69407f4054 | ||
|
|
1791ac08a8 | ||
|
|
6569f69de1 | ||
|
|
66da1328f8 | ||
|
|
f8d53b7c8d | ||
|
|
5efe60dcf5 | ||
|
|
457d41d385 | ||
|
|
a9cab19ddb | ||
|
|
0ce96fbe8b | ||
|
|
ff73445bf3 | ||
|
|
b7067ad988 | ||
|
|
e5f5c30e4d | ||
|
|
d7c6bb1c4b | ||
|
|
6d98c5460f | ||
|
|
1c9993dd5d | ||
|
|
114ddbb0c6 | ||
|
|
95b3622d1d | ||
|
|
4184696809 | ||
|
|
d76947845a | ||
|
|
2f0cc6fbc9 | ||
|
|
f802f6d0ed | ||
|
|
a165930b48 | ||
|
|
0be132c07c | ||
|
|
d6ed4c4d6d | ||
|
|
8fe82b463f | ||
|
|
dd186fe6a1 | ||
|
|
dfb0b2ab8e | ||
|
|
d9f93f9d1a | ||
|
|
eaa170809f | ||
|
|
4c5a1885d2 | ||
|
|
f06ea2bc6e | ||
|
|
79a4fff2dc | ||
|
|
53e337611a | ||
|
|
86ddca4edb | ||
|
|
2a8d894168 | ||
|
|
fce7137525 | ||
|
|
671d8dc342 | ||
|
|
a97f104ab6 | ||
|
|
e51fd3d4fa | ||
|
|
b37d6b1921 | ||
|
|
e67466a74f | ||
|
|
f49d7ae110 | ||
|
|
c71016bd3c | ||
|
|
b9a529148a | ||
|
|
2986df22d6 | ||
|
|
5da4e80e95 | ||
|
|
f8c4ad4b90 | ||
|
|
834c940db1 | ||
|
|
600e98773e | ||
|
|
2da766ff1b | ||
|
|
1e75ca63f4 | ||
|
|
cf7258e03a | ||
|
|
b4354df6fb | ||
|
|
7ae45b7ac2 | ||
|
|
f3859f6d11 | ||
|
|
f0882eda6b | ||
|
|
aa17d70853 | ||
|
|
f3eb245e98 | ||
|
|
a08b3104a8 | ||
|
|
43bdd32242 | ||
|
|
3dd9f8d430 | ||
|
|
34863fe2d2 | ||
|
|
5f45a39f28 | ||
|
|
5ab861cd04 | ||
|
|
f40df07ec7 | ||
|
|
ab47842d6d | ||
|
|
6661deeb24 | ||
|
|
bff5b0261b | ||
|
|
25cfb81a09 | ||
|
|
ed28ec97c7 | ||
|
|
0e9c93f335 | ||
|
|
14620aa1dd | ||
|
|
a84df15c0a | ||
|
|
7f592b7ad5 | ||
|
|
9cda04e51f | ||
|
|
7a33cc00cd | ||
|
|
1a265f53f7 | ||
|
|
5177298dad | ||
|
|
de0664ef77 | ||
|
|
aa962724e8 | ||
|
|
28a676e105 | ||
|
|
997ee30039 | ||
|
|
174c161daa | ||
|
|
4c1fd06252 | ||
|
|
fec06828cf | ||
|
|
68c4eaaff1 | ||
|
|
acbad2424e | ||
|
|
f3ba656303 | ||
|
|
e35b0796d6 | ||
|
|
e97059df78 | ||
|
|
e3a3ae6de6 | ||
|
|
fafe06acbf | ||
|
|
6b82d4099f | ||
|
|
57a42aac39 | ||
|
|
e93e7ca1f2 | ||
|
|
0db0bcdd5e | ||
|
|
23b8131ae5 | ||
|
|
9e9fe9b9c9 | ||
|
|
21fc2fae8d | ||
|
|
4f6dbf5623 | ||
|
|
1e9722601c | ||
|
|
959d78f755 | ||
|
|
30f4568f7b | ||
|
|
90c787a56a | ||
|
|
5633fa1247 | ||
|
|
baf139c75b | ||
|
|
d97081fe7f | ||
|
|
2f10db8f11 | ||
|
|
77c0f5f675 | ||
|
|
f6cc4440a1 | ||
|
|
d1bf811331 | ||
|
|
6126379362 | ||
|
|
beeda386ef | ||
|
|
d4260ddb18 | ||
|
|
a53e73ba10 | ||
|
|
e3c445a52f | ||
|
|
7e4b41e41a | ||
|
|
2032be209a | ||
|
|
818e1393ec | ||
|
|
f28d460caa | ||
|
|
5f74fdc326 | ||
|
|
f0125da6fd | ||
|
|
af5685bf28 | ||
|
|
89786dd42a | ||
|
|
973ac76197 | ||
|
|
99cbab1806 | ||
|
|
fdd9efe45a | ||
|
|
0335e9c63a | ||
|
|
ff78d30cee | ||
|
|
e979f76156 | ||
|
|
899e359cdb | ||
|
|
cbfcac6f63 | ||
|
|
0bdd7351f6 | ||
|
|
46440ad0a8 | ||
|
|
a3794f3bd3 | ||
|
|
90e58f66c0 | ||
|
|
839dbb1bc1 | ||
|
|
e65d03bf27 | ||
|
|
23ae292fe2 | ||
|
|
cbd2d6e434 | ||
|
|
3a7942dfb7 | ||
|
|
aa2c9c152f | ||
|
|
900534f86e | ||
|
|
5130361d65 | ||
|
|
7dc3b34bfd | ||
|
|
3b23b474dc | ||
|
|
d3945d5210 | ||
|
|
6bb2251faf | ||
|
|
8f39d7a2b2 | ||
|
|
20560bd927 | ||
|
|
93938439d9 | ||
|
|
0f611144d7 | ||
|
|
acb497b2ab | ||
|
|
50e63ad3ee | ||
|
|
5a7a20d01e | ||
|
|
f2d11bb46e | ||
|
|
70f9bdc6e1 | ||
|
|
d981ca416e | ||
|
|
3f637584f5 | ||
|
|
7a18876c5b | ||
|
|
3c6a1ec117 | ||
|
|
c4f199d1b5 | ||
|
|
b8dbebeca7 | ||
|
|
7bacd73e85 | ||
|
|
d4c4bee020 | ||
|
|
48c9816c38 | ||
|
|
43a068b156 | ||
|
|
45bea0db4b | ||
|
|
bb8b1538c7 | ||
|
|
147c5e183f | ||
|
|
9d5a510441 | ||
|
|
5fb078b4f1 | ||
|
|
1581699022 | ||
|
|
4c18eb62ca | ||
|
|
7a14b224ed | ||
|
|
555c935ffd | ||
|
|
1d4fbbce1f | ||
|
|
e9728042b9 | ||
|
|
23ae2acf73 | ||
|
|
f42ac7e15b | ||
|
|
32e0e21013 | ||
|
|
8d6bee6da9 | ||
|
|
d994e84288 | ||
|
|
92d684de6b | ||
|
|
a21ce3469b | ||
|
|
67f98edc05 | ||
|
|
93cf84da3e | ||
|
|
febcb25cb6 | ||
|
|
138ea0e0c7 | ||
|
|
ed314c6d7d | ||
|
|
d82131544b | ||
|
|
d939adeb56 | ||
|
|
2428e07f35 | ||
|
|
86ddbc7ad9 | ||
|
|
aac0a5fbe2 | ||
|
|
a2db511c99 | ||
|
|
1674692840 | ||
|
|
5c488d4c46 | ||
|
|
4e530a1938 | ||
|
|
d22f62396c | ||
|
|
71f7a74091 | ||
|
|
81c23564b5 | ||
|
|
82a34a2546 | ||
|
|
bd82d2a52d | ||
|
|
7295258d71 | ||
|
|
4ec4e88f85 | ||
|
|
c6ab14018a | ||
|
|
8d06b9b019 | ||
|
|
9195a0000b | ||
|
|
3a18699074 | ||
|
|
d9a6491a43 | ||
|
|
be13c2202d | ||
|
|
410f7d27ed | ||
|
|
63d101b653 | ||
|
|
584035b663 | ||
|
|
86a9a45525 | ||
|
|
89ca694684 | ||
|
|
d234262585 | ||
|
|
a316c30b4a | ||
|
|
1c699a3664 | ||
|
|
d7b99b9062 | ||
|
|
977ec20751 | ||
|
|
35d6cb812f | ||
|
|
6ea4f4a939 | ||
|
|
333a16a88d | ||
|
|
3dde165f14 | ||
|
|
2d41cbd0cf | ||
|
|
e1ec4ec67f | ||
|
|
199506296a | ||
|
|
189c0b3477 | ||
|
|
a45ba05bdd | ||
|
|
26a7c30229 | ||
|
|
1fcb91900a | ||
|
|
6af9edf33b | ||
|
|
faced0a896 | ||
|
|
5d635287c0 | ||
|
|
b04a4813ba | ||
|
|
5d234ba021 | ||
|
|
71352ea56d | ||
|
|
f50ec0fe8e | ||
|
|
cca18e82e8 | ||
|
|
55c2041d4d | ||
|
|
bda5ec4875 | ||
|
|
0b5b3213fe | ||
|
|
d8adc80c2c | ||
|
|
20fd80de3a | ||
|
|
28c36d615b | ||
|
|
9859f3110b | ||
|
|
30b54e3af2 | ||
|
|
e70acf4c51 | ||
|
|
8346f0ebe1 | ||
|
|
d917987938 | ||
|
|
e4004118db | ||
|
|
4ce2e075c4 | ||
|
|
1b34fed500 | ||
|
|
87fd1d38fb | ||
|
|
3e00764649 | ||
|
|
03fc0c3662 | ||
|
|
5b60708e80 | ||
|
|
d8a06f827e | ||
|
|
85386daa25 | ||
|
|
4f199e36c9 | ||
|
|
20b9f3ff88 | ||
|
|
afcf54b108 | ||
|
|
74f91037a7 | ||
|
|
ff21af2b0d | ||
|
|
4174d72a52 | ||
|
|
12a737ae02 | ||
|
|
b2c7bacfe9 | ||
|
|
ead92353fe | ||
|
|
490b351330 | ||
|
|
754a163cbf | ||
|
|
eae4d51e3f | ||
|
|
cf66750d7b | ||
|
|
1f33e2a2a0 | ||
|
|
35d73ea41c | ||
|
|
298f1c65b6 | ||
|
|
e16eb147a1 | ||
|
|
a04232a75a | ||
|
|
b6404d18c3 | ||
|
|
fa6f5219bf | ||
|
|
ecd26f9f5b | ||
|
|
2bb4e0566c | ||
|
|
4dd3e3562f | ||
|
|
f5261b9877 | ||
|
|
4994b806d2 | ||
|
|
6a0270279c | ||
|
|
3ec6938b95 | ||
|
|
7b4d7cd221 | ||
|
|
77f1c58345 | ||
|
|
bc5575f83a | ||
|
|
6f2d003bc5 | ||
|
|
ec658b115c | ||
|
|
a43cc12394 | ||
|
|
ef76994c05 | ||
|
|
a1342a6bf6 | ||
|
|
5597248895 | ||
|
|
560587c88f | ||
|
|
5015fb6dac | ||
|
|
c168887e5e | ||
|
|
db6df6fefd | ||
|
|
ef5be684ed | ||
|
|
51671348f7 | ||
|
|
a4a5957e2f | ||
|
|
25ddbf8f1f | ||
|
|
f2b746520b | ||
|
|
ca4d93652d | ||
|
|
efc493cfa0 | ||
|
|
391ab02573 | ||
|
|
64979a0c1a | ||
|
|
20c0292e97 | ||
|
|
88aa9ac5de | ||
|
|
ac380e03c4 | ||
|
|
67b4d5412b | ||
|
|
d773d358c4 | ||
|
|
e5fe59799d | ||
|
|
27b71e3927 | ||
|
|
2f8b0f7a70 | ||
|
|
d7944b6ca9 | ||
|
|
ed724a730e | ||
|
|
d703a2df44 | ||
|
|
7f206fbf80 | ||
|
|
ea865d0ff9 | ||
|
|
75982f3379 | ||
|
|
8f30a262f4 | ||
|
|
ee266255eb | ||
|
|
9b299dc4b9 | ||
|
|
9319350176 | ||
|
|
076adcbd82 | ||
|
|
218e36b12b | ||
|
|
c6e72ee00b | ||
|
|
2b67196418 | ||
|
|
de09adcaa9 | ||
|
|
46381cb15c | ||
|
|
9394215d31 | ||
|
|
69e9f2c973 | ||
|
|
4ef5d9eb5f | ||
|
|
6d68718fba | ||
|
|
cb805d7be5 | ||
|
|
42705bff3f | ||
|
|
743a6b049c | ||
|
|
8bbbea1274 | ||
|
|
2797e8cb7c | ||
|
|
e3a003a08f | ||
|
|
a9f8af3fb6 | ||
|
|
e21865ee33 | ||
|
|
31e98b51df | ||
|
|
3dcca431a9 | ||
|
|
1319c2d281 | ||
|
|
8eae4b0381 | ||
|
|
8ad0ab1f6b | ||
|
|
6f5e5c23df | ||
|
|
4016aed62d | ||
|
|
958a7d0ab0 | ||
|
|
99eb81e743 | ||
|
|
ca3737e002 | ||
|
|
2b8be97297 | ||
|
|
1909093cac | ||
|
|
c599189d7d | ||
|
|
6bf6d5eeb2 | ||
|
|
488e1692cc | ||
|
|
f44369777f | ||
|
|
306a4f2d2d | ||
|
|
5f8e2bda2f | ||
|
|
661f0e69ef | ||
|
|
d63c6f6978 | ||
|
|
fba7a65fb4 | ||
|
|
4814a5341e | ||
|
|
f7e6f0092c | ||
|
|
4f19237467 | ||
|
|
5292c7ca50 | ||
|
|
70bfad0371 | ||
|
|
fcc34a8b45 | ||
|
|
1ec3ec1247 | ||
|
|
1270236715 | ||
|
|
8a334e724b | ||
|
|
8ae57c2797 | ||
|
|
eb56080277 | ||
|
|
91b7104a92 | ||
|
|
15f44c8736 | ||
|
|
f0df819cbf | ||
|
|
29ab577bc3 | ||
|
|
4886a8941d | ||
|
|
d8482ef1ba | ||
|
|
a96ad565c7 | ||
|
|
09c09628ac | ||
|
|
15882aae5f | ||
|
|
8876394c7c | ||
|
|
fd85542d8f | ||
|
|
ea429d5d46 | ||
|
|
7f9f7dd216 | ||
|
|
405cb0d828 | ||
|
|
4fef6a3c2f | ||
|
|
7fe3244c71 | ||
|
|
c63bebd8c3 | ||
|
|
1678dc3562 | ||
|
|
e48d6812fa | ||
|
|
504b42aa61 | ||
|
|
779bd20fd5 | ||
|
|
752d40b118 | ||
|
|
b41e5ccc77 | ||
|
|
8a0e49d780 | ||
|
|
54a3f76a2b | ||
|
|
5cb305041d | ||
|
|
15399bbf35 | ||
|
|
6246cd5d85 | ||
|
|
0d4a448c34 | ||
|
|
8efe470d07 | ||
|
|
e968caae80 | ||
|
|
e04e03d695 | ||
|
|
354d79acd1 | ||
|
|
235a52405d | ||
|
|
706afaccae | ||
|
|
e8cd06c6e9 | ||
|
|
1264ec736a | ||
|
|
a30ec25067 | ||
|
|
110fbf89b0 | ||
|
|
2efd52dda2 | ||
|
|
889e4749ef | ||
|
|
84d301715e | ||
|
|
32d7a48712 | ||
|
|
db82bb4ab1 | ||
|
|
4a76063b03 | ||
|
|
716cfbffa4 | ||
|
|
0f2502c72d | ||
|
|
0bb62a8162 | ||
|
|
d48091d37e | ||
|
|
7bc373a056 | ||
|
|
0ee9f732b8 | ||
|
|
3531bec43c | ||
|
|
cc99a40b16 | ||
|
|
8ae971bdaa | ||
|
|
fa7f25d75d | ||
|
|
6490f1b6a5 | ||
|
|
534d21dffd | ||
|
|
bfdcf4d8d1 | ||
|
|
afab78ed40 | ||
|
|
865a47bd6b | ||
|
|
a72508bc71 | ||
|
|
e4810990f0 | ||
|
|
3e171414bd | ||
|
|
f16f278fea | ||
|
|
02120e188e | ||
|
|
a8dc460085 | ||
|
|
591c5bae42 | ||
|
|
666aa81185 | ||
|
|
723ecfad8d | ||
|
|
5571c361dc | ||
|
|
939aa38a2a | ||
|
|
a5c0127a6e | ||
|
|
2501f32e9a | ||
|
|
e3bf55a266 | ||
|
|
ff4a0ce1e2 | ||
|
|
bc95ea97fb | ||
|
|
499adba97f | ||
|
|
3858acf70f | ||
|
|
ed4deeb0fb | ||
|
|
1b3290221c | ||
|
|
477951b924 | ||
|
|
4fcf8d3e86 | ||
|
|
f02ed3c629 | ||
|
|
91033a3a1f | ||
|
|
d3a7115c45 | ||
|
|
5bea13c172 | ||
|
|
1b269a7711 | ||
|
|
9a9efb1c58 | ||
|
|
a5d78953d4 | ||
|
|
1e2bead9bc | ||
|
|
a54b999ccc | ||
|
|
dbf88cc209 | ||
|
|
d8c1c4bbeb | ||
|
|
e0d3ab4412 | ||
|
|
d7442e7456 | ||
|
|
80c45ad46a | ||
|
|
c194e92df8 | ||
|
|
835d9455a9 | ||
|
|
eede49d15c | ||
|
|
829cd9718a | ||
|
|
1a90789402 | ||
|
|
25b8b8bd16 | ||
|
|
70c78264dc | ||
|
|
7a2900e238 | ||
|
|
fef39b6215 | ||
|
|
2ebe81cb0e | ||
|
|
6f6c44446c | ||
|
|
ef3a65b93f | ||
|
|
2b3665f010 | ||
|
|
ffb0a8e545 | ||
|
|
a10e9c6950 | ||
|
|
ff8fe4143e | ||
|
|
ac383e15c1 | ||
|
|
4a660f6266 | ||
|
|
2025c511f0 | ||
|
|
191eabd3ab | ||
|
|
2a9ed125b8 | ||
|
|
b3603f76e4 | ||
|
|
95e8d2838c | ||
|
|
1861e025e9 | ||
|
|
ded27b4971 | ||
|
|
37fa2d698f | ||
|
|
234adf7daf | ||
|
|
f548bc79d4 | ||
|
|
c45f3aa4fb | ||
|
|
b7b7186cf8 | ||
|
|
3dba54c10a | ||
|
|
1196f153fc | ||
|
|
c34a8e4ddb | ||
|
|
5ed399ca48 | ||
|
|
4493d11ca3 | ||
|
|
074eb8e41c | ||
|
|
a68f0f26a8 | ||
|
|
9146ba7d44 | ||
|
|
5bfb2ef26d | ||
|
|
bddeecdbee | ||
|
|
49625a1baf | ||
|
|
a97e092619 | ||
|
|
7de6a0c9e2 | ||
|
|
eb7c2ae3f7 | ||
|
|
cd86995d7d | ||
|
|
08ec0a11bf | ||
|
|
0dc55ebc86 | ||
|
|
4e4d2b35cf | ||
|
|
9c53794bc7 | ||
|
|
e8b5272b02 | ||
|
|
20fbad6c29 | ||
|
|
da2d7e2dde | ||
|
|
d260b16981 | ||
|
|
79e2d1309f | ||
|
|
c77dc4fe9e | ||
|
|
b5b020a138 | ||
|
|
910cfeea60 | ||
|
|
83c396b13b | ||
|
|
69f2fb56b3 | ||
|
|
0ec35d5a5d | ||
|
|
0eb435e118 | ||
|
|
60d4b71d2b | ||
|
|
59caf4a48e | ||
|
|
fcc14e467a | ||
|
|
11168fea66 | ||
|
|
5015ec4b5d | ||
|
|
270883d3f4 | ||
|
|
c399db82a3 | ||
|
|
76d833f332 | ||
|
|
68c22efa58 | ||
|
|
c626b0e1f6 | ||
|
|
d304ed7d73 | ||
|
|
0ba856a637 | ||
|
|
8bc85764ff | ||
|
|
ff925f1d86 | ||
|
|
43cb1b3a41 | ||
|
|
6d8f40d13a | ||
|
|
796314c339 | ||
|
|
874a7ed3b3 | ||
|
|
351f98b10d | ||
|
|
3af70f13a3 | ||
|
|
8f3ee7c649 | ||
|
|
6bc413530e | ||
|
|
6e3f893a0e | ||
|
|
250d9f2ed7 | ||
|
|
f42481b60f | ||
|
|
24ecfb1a48 | ||
|
|
31cd80cea7 | ||
|
|
82bbcef117 | ||
|
|
898c716841 | ||
|
|
085bfd83d7 | ||
|
|
27b57dbf0c | ||
|
|
e9697859bd | ||
|
|
b20a74b017 | ||
|
|
80456598e0 | ||
|
|
61ccd56d25 | ||
|
|
7050c59cae | ||
|
|
df48d440e4 | ||
|
|
94735a8364 | ||
|
|
19f84b52e7 | ||
|
|
0d2825e06f | ||
|
|
73250601f0 | ||
|
|
9201cf8d00 | ||
|
|
856ec46467 | ||
|
|
ccf7bbdb50 | ||
|
|
9f5e131203 | ||
|
|
3c106e4dd7 | ||
|
|
fdfe3210ce | ||
|
|
f5deda56a6 | ||
|
|
b9ecec6452 | ||
|
|
698365e47f | ||
|
|
7c78101621 | ||
|
|
820ba45fab | ||
|
|
de428146b9 | ||
|
|
ef32fab30e | ||
|
|
d7038e1be1 | ||
|
|
11685a3e0c | ||
|
|
79c9aa7d02 | ||
|
|
ffa58776fe | ||
|
|
db449b9e09 | ||
|
|
464628b5c4 | ||
|
|
fcde15e136 | ||
|
|
c678fed113 | ||
|
|
4e3715d4bb | ||
|
|
28ce02915a | ||
|
|
bd7ec9c5f7 | ||
|
|
babd6e0ee7 | ||
|
|
eba9291e5c | ||
|
|
ef88a54125 | ||
|
|
93ebfd6217 | ||
|
|
82401defc7 | ||
|
|
835ee7aa8e | ||
|
|
0c609bc17e | ||
|
|
90703f99ee | ||
|
|
5f6a1f4093 | ||
|
|
b69745f178 | ||
|
|
14f63cbe67 | ||
|
|
46ec50aecb | ||
|
|
837a680849 | ||
|
|
07365c1073 | ||
|
|
364e2765e7 | ||
|
|
9c9939e5d4 | ||
|
|
9878a83894 | ||
|
|
56cb7de72a | ||
|
|
52761f2c29 | ||
|
|
fb8db6cb73 | ||
|
|
846001f06d | ||
|
|
0620f249a5 | ||
|
|
019bccfa6f | ||
|
|
75fd039dba | ||
|
|
9b733baf02 | ||
|
|
ee5a1b0a83 | ||
|
|
8d3e46dfac | ||
|
|
75226e6b68 | ||
|
|
085d3af14c | ||
|
|
ca3efe6bdc | ||
|
|
c21b60b038 | ||
|
|
51075421d3 | ||
|
|
f6c3c8ac00 | ||
|
|
fcca4032ef | ||
|
|
a802729562 | ||
|
|
95d5a19319 | ||
|
|
4a2e1534d5 | ||
|
|
f21a1dc9ad | ||
|
|
b3aa1bda1d | ||
|
|
cda0b615de |
94
.gitignore
vendored
Normal file
94
.gitignore
vendored
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
doc/all_Doxyfile
|
||||||
|
doc/auto_Doxyfile
|
||||||
|
doc/core_Doxyfile
|
||||||
|
doc/openscenegraph.doxyfile
|
||||||
|
doc/openthreads.doxyfile
|
||||||
|
|
||||||
|
doc/OpenSceneGraphReferenceDocs/
|
||||||
|
doc/OpenThreadsReferenceDocs/
|
||||||
|
|
||||||
|
cmake_uninstall.cmake
|
||||||
|
|
||||||
|
include/OpenThreads/Config
|
||||||
|
include/OpenThreads/Version
|
||||||
|
include/osg/Config
|
||||||
|
include/osg/GL
|
||||||
|
include/osg/Version
|
||||||
|
include/osgQt/Version
|
||||||
|
src/osgQt/__
|
||||||
|
|
||||||
|
lib/
|
||||||
|
bin/
|
||||||
|
|
||||||
|
*.pc
|
||||||
|
*.conf
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles
|
||||||
|
CMakeScripts
|
||||||
|
Makefile
|
||||||
|
cmake_install.cmake
|
||||||
|
install_manifest*.txt
|
||||||
|
|
||||||
|
|
||||||
|
# Compiled Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Compiled Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Fortran module files
|
||||||
|
*.mod
|
||||||
|
|
||||||
|
# Compiled Static libraries
|
||||||
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
# Platform Specifics - auto generated files
|
||||||
|
PlatformSpecifics/Windows/*.rc
|
||||||
|
|
||||||
|
# Visual studio - project files
|
||||||
|
*.sln
|
||||||
|
*.suo
|
||||||
|
*.vcxproj
|
||||||
|
*.vcxproj.filters
|
||||||
|
*.vcxproj.user
|
||||||
|
|
||||||
|
# Visual Studio - Build Results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Rr]elease/
|
||||||
|
[Mm]in[Ss]ize[Rr]el/
|
||||||
|
[Rr]el[Ww]ith[Dd]eb[Ii]nfo/
|
||||||
|
|
||||||
|
# Visual Studio - Browsing Database File
|
||||||
|
*.sdf
|
||||||
|
*.opensdf
|
||||||
|
|
||||||
|
#osx xcode
|
||||||
|
DerivedData/
|
||||||
|
*.DS_Store
|
||||||
|
*.build
|
||||||
|
*.xcodeproj
|
||||||
|
|
||||||
|
#CPACK related files
|
||||||
|
CPackConfig-*.cmake
|
||||||
|
_CPack_Packages/
|
||||||
|
|
||||||
|
#packages
|
||||||
|
*.tar.gz
|
||||||
|
*.zip
|
||||||
36
.travis.yml
Normal file
36
.travis.yml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
|
include:
|
||||||
|
#Linux build
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
language: cpp
|
||||||
|
env:
|
||||||
|
#- LLVM_VERSION=3.8
|
||||||
|
sudo: false
|
||||||
|
cache:
|
||||||
|
apt: true
|
||||||
|
directories:
|
||||||
|
- $HOME/.ccache
|
||||||
|
compiler:
|
||||||
|
#- clang
|
||||||
|
- g++
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
#- llvm-toolchain-precise-3.8
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
#- clang-3.8
|
||||||
|
- g++
|
||||||
|
- cmake
|
||||||
|
# OSX build
|
||||||
|
- os: osx
|
||||||
|
language: cpp
|
||||||
|
|
||||||
|
script:
|
||||||
|
- mkdir build
|
||||||
|
- cd build
|
||||||
|
- travis_wait 60 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../product -DBUILD_OSG_EXAMPLES=ON ..
|
||||||
|
- make install -j3
|
||||||
|
|
||||||
198
AUTHORS.txt
198
AUTHORS.txt
@@ -1,110 +1,116 @@
|
|||||||
OpenSceneGraph Library 3.2.0
|
OpenSceneGraph Library 3.4.1
|
||||||
|
|
||||||
510 Contributors:
|
562 Contributors:
|
||||||
|
|
||||||
Firstname Surname
|
Firstname Surname
|
||||||
-----------------
|
-----------------
|
||||||
Robert Osfield
|
Robert Osfield
|
||||||
Don Burns
|
|
||||||
Stephan Huber
|
Stephan Huber
|
||||||
Paul Martz
|
Paul Martz
|
||||||
|
Farshid Lashkari
|
||||||
Mathias Fr<46>hlich
|
Mathias Fr<46>hlich
|
||||||
Marco Jez
|
Marco Jez
|
||||||
Farshid Lashkari
|
|
||||||
Wang Rui
|
Wang Rui
|
||||||
Jean-S<>bastien Guay
|
Jean-S<>bastien Guay
|
||||||
Mike Weiblen
|
|
||||||
Ulrich Hertlein
|
Ulrich Hertlein
|
||||||
|
Mike Weiblen
|
||||||
|
Sukender
|
||||||
Eric Wing
|
Eric Wing
|
||||||
Sukender
|
|
||||||
Cedric Pinson
|
Cedric Pinson
|
||||||
Brede Johansen
|
Brede Johansen
|
||||||
Bob Kuehne
|
Bob Kuehne
|
||||||
|
Wojciech Lewandowski
|
||||||
Michael Platings
|
Michael Platings
|
||||||
Geoff Michel
|
Geoff Michel
|
||||||
Wojciech Lewandowski
|
|
||||||
Eric Sokolowsky
|
Eric Sokolowsky
|
||||||
|
Laurens Voerman
|
||||||
David Callu
|
David Callu
|
||||||
Trajce Nikolov
|
|
||||||
Colin McDonald
|
Colin McDonald
|
||||||
|
Trajce Nikolov
|
||||||
Tim Moore
|
Tim Moore
|
||||||
Martin Lavery
|
Martin Lavery
|
||||||
Laurens Voerman
|
Mattias Helsing
|
||||||
Tree
|
Jason Beverage
|
||||||
|
Tree
|
||||||
|
Pjotr Svetachov
|
||||||
Luigi Calori
|
Luigi Calori
|
||||||
|
Alberto Luaces
|
||||||
Mike Wittman
|
Mike Wittman
|
||||||
|
Jan Peciva
|
||||||
Chris Hanson
|
Chris Hanson
|
||||||
Roland Smeenk
|
Roland Smeenk
|
||||||
Roger James
|
Roger James
|
||||||
Jeremy Moles
|
Jeremy Moles
|
||||||
Jason Beverage
|
Jannik Heller
|
||||||
Jan Peciva
|
|
||||||
J.P. Delport
|
J.P. Delport
|
||||||
Mattias Helsing
|
Andy Skinner
|
||||||
Magnus Kessler
|
Magnus Kessler
|
||||||
David Fries
|
David Fries
|
||||||
Andy Skinner
|
|
||||||
Paul Melis
|
|
||||||
Alberto Luaces
|
|
||||||
Luc Frauciel
|
|
||||||
Tom Jolley
|
Tom Jolley
|
||||||
|
Paul Melis
|
||||||
|
Luc Frauciel
|
||||||
|
Aurelien Albert
|
||||||
Pavel Moloshtan
|
Pavel Moloshtan
|
||||||
Brad Christiansen
|
Brad Christiansen
|
||||||
|
Torben Dannhauer
|
||||||
|
Terry Welsh
|
||||||
Olaf Flebbe
|
Olaf Flebbe
|
||||||
Mathieu Marache
|
Mathieu Marache
|
||||||
|
Lionel Lagarde
|
||||||
Jason Daly
|
Jason Daly
|
||||||
Art Tevs
|
Art Tevs
|
||||||
Philip Lowman
|
Philip Lowman
|
||||||
Per Fahlberg
|
Per Fahlberg
|
||||||
Norman Vine
|
Norman Vine
|
||||||
Terry Welsh
|
|
||||||
Serge Lages
|
|
||||||
Lionel Lagarde
|
|
||||||
Chris Denham
|
Chris Denham
|
||||||
Alberto Farre
|
|
||||||
Sherman Wilcox
|
Sherman Wilcox
|
||||||
Robert Michael
|
Serge Lages
|
||||||
|
Romano Jos<6F> Magacho da Silva
|
||||||
Mourad Boufarguine
|
Mourad Boufarguine
|
||||||
|
Alberto Farre
|
||||||
|
Glenn Waldron
|
||||||
Andr<EFBFBD> Garneau
|
Andr<EFBFBD> Garneau
|
||||||
Adrian Egli
|
Adrian Egli
|
||||||
Ruben Lopez
|
Sebastian Messerschmidt
|
||||||
Randall Hopper
|
Randall Hopper
|
||||||
|
Kristofer Tingdahl
|
||||||
Jan Ciger
|
Jan Ciger
|
||||||
Glenn Waldron
|
Ruben Lopez
|
||||||
|
Robert Michael
|
||||||
Gideon May
|
Gideon May
|
||||||
Don Tidrow
|
Don Tidrow
|
||||||
Aurelien Albert
|
|
||||||
Torben Dannhauer
|
|
||||||
Stephane Lamoliatte
|
Stephane Lamoliatte
|
||||||
Romano Jos<6F> Magacho da Silva
|
|
||||||
Michael Gronager
|
Michael Gronager
|
||||||
Martin Naylor
|
Martin Naylor
|
||||||
Joakim Simonsson
|
Joakim Simonsson
|
||||||
David Spilling
|
David Spilling
|
||||||
Daniel Sj<53>lie
|
Daniel Sj<53>lie
|
||||||
Bryan Thrall
|
Bryan Thrall
|
||||||
Fabien Lavignotte
|
|
||||||
Mike Connell
|
|
||||||
Melchior Franz
|
|
||||||
Johannes Baeuerle
|
|
||||||
Andreas Ekstrand
|
Andreas Ekstrand
|
||||||
Riccardo Corsi
|
|
||||||
Rafa Gaitan
|
Rafa Gaitan
|
||||||
|
Mike Connell
|
||||||
|
Fabien Lavignotte
|
||||||
|
Thomas Hogarth
|
||||||
|
Riccardo Corsi
|
||||||
|
Melchior Franz
|
||||||
|
Konstantin Matveyev
|
||||||
|
Johannes Baeuerle
|
||||||
Neil Hughes
|
Neil Hughes
|
||||||
Martin Beckett
|
Martin Beckett
|
||||||
|
Marc Helbling
|
||||||
|
Jordi Torres
|
||||||
Joran Jessurun
|
Joran Jessurun
|
||||||
Gino van den Bergen
|
Gino van den Bergen
|
||||||
Frederic Marmond
|
|
||||||
David Guthrie
|
David Guthrie
|
||||||
Csaba Halasz
|
Csaba Halasz
|
||||||
Cory Riddell
|
Cory Riddell
|
||||||
Chuck Seberino
|
Chuck Seberino
|
||||||
Boris Bralo
|
Boris Bralo
|
||||||
Yefei He
|
Yefei He
|
||||||
Thomas Hogarth
|
|
||||||
Sondra Iverson
|
Sondra Iverson
|
||||||
Simon Julier
|
Simon Julier
|
||||||
Rune Schmidt Jensen
|
Rune Schmidt Jensen
|
||||||
|
Ravi Mathur
|
||||||
Rainer Oder
|
Rainer Oder
|
||||||
Nico Kruithof
|
Nico Kruithof
|
||||||
Martin Aumueller
|
Martin Aumueller
|
||||||
@@ -112,20 +118,24 @@ Mario Valle
|
|||||||
Lukasz Izdebski
|
Lukasz Izdebski
|
||||||
Jorge Izquierdo Ciges
|
Jorge Izquierdo Ciges
|
||||||
Gordon Tomlinson
|
Gordon Tomlinson
|
||||||
|
Frederic Marmond
|
||||||
Frederic Bouvier
|
Frederic Bouvier
|
||||||
Carlo Camporesi
|
Carlo Camporesi
|
||||||
Ben Discoe
|
Bj<EFBFBD>rn Blissing
|
||||||
|
Alexander Sinditskiy
|
||||||
Thibault Genessay
|
Thibault Genessay
|
||||||
Sasa Bistrovic
|
Sasa Bistrovic
|
||||||
Ravi Mathur
|
|
||||||
Ralf Habacker
|
Ralf Habacker
|
||||||
Pjotr Svetachov
|
|
||||||
Neil Groves
|
Neil Groves
|
||||||
|
Mikhail Izmestev
|
||||||
Markus Trenkwalder
|
Markus Trenkwalder
|
||||||
Loic Dachary
|
Loic Dachary
|
||||||
Joseph Steel
|
Joseph Steel
|
||||||
John Shue
|
John Shue
|
||||||
|
Hartwig Wiesmann
|
||||||
Brad Colbert
|
Brad Colbert
|
||||||
|
Ben Discoe
|
||||||
|
Vladimir Chebaev
|
||||||
Vivek Rajan
|
Vivek Rajan
|
||||||
Uwe Woessner
|
Uwe Woessner
|
||||||
Tony Horrobin
|
Tony Horrobin
|
||||||
@@ -133,6 +143,7 @@ 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
|
||||||
@@ -144,20 +155,16 @@ Martins Innus
|
|||||||
Maciej Krol
|
Maciej Krol
|
||||||
Lilin Xiong
|
Lilin Xiong
|
||||||
Leandro Motta Barros
|
Leandro Motta Barros
|
||||||
Jordi Torres
|
Julien Valentin
|
||||||
Johan Nouvel
|
Johan Nouvel
|
||||||
Hartwig Wiesmann
|
Javier Taibo
|
||||||
Donn Mielcarek
|
Donn Mielcarek
|
||||||
Corbin Holtz
|
Corbin Holtz
|
||||||
Blasius Czink
|
Blasius Czink
|
||||||
Alexander Sinditskiy
|
|
||||||
Alexander Irion
|
Alexander Irion
|
||||||
Toshiyuki Takahei
|
Toshiyuki Takahei
|
||||||
Sebastien Grignard
|
Sebastien Grignard
|
||||||
Ryan Kawicki
|
|
||||||
Rudolf Wiedemann
|
Rudolf Wiedemann
|
||||||
Romano Magacho
|
|
||||||
Mikhail Izmestev
|
|
||||||
Maria Ten
|
Maria Ten
|
||||||
Liang Aibin
|
Liang Aibin
|
||||||
Katharina Plugge
|
Katharina Plugge
|
||||||
@@ -174,34 +181,43 @@ Bruce Clay
|
|||||||
Bradley Anderegg
|
Bradley Anderegg
|
||||||
Andreas Goebel
|
Andreas Goebel
|
||||||
Alok Priyadarshi
|
Alok Priyadarshi
|
||||||
Alberto Barbati
|
Ali Botorabi
|
||||||
Alan Dickinson
|
Alan Dickinson
|
||||||
|
Wee See
|
||||||
Vladimir Shabanov
|
Vladimir Shabanov
|
||||||
Tugkan Calapoglu
|
Tugkan Calapoglu
|
||||||
Tim Daoust
|
Tim Daoust
|
||||||
|
Sylvain Marie
|
||||||
Sohey Yamamoto
|
Sohey Yamamoto
|
||||||
Sergey Leontyev
|
Sergey Leontyev
|
||||||
Sebastian Messerschmidt
|
|
||||||
Santosh Gaikwad
|
Santosh Gaikwad
|
||||||
Ryan Pavlik
|
Ryan Pavlik
|
||||||
Robert Milharcic
|
Robert Milharcic
|
||||||
Rene Molenaar
|
Rene Molenaar
|
||||||
Piotr Domagalski
|
Piotr Domagalski
|
||||||
|
Philippe Renon
|
||||||
Phil Atkin
|
Phil Atkin
|
||||||
|
Pawel Ksiezopolski
|
||||||
|
Patrick Neary
|
||||||
Nathan Monteleone
|
Nathan Monteleone
|
||||||
|
Miha Rav<61>elj
|
||||||
Miguel Escriva
|
Miguel Escriva
|
||||||
Mattias Linde
|
Mattias Linde
|
||||||
Mark Sciabica
|
Mark Sciabica
|
||||||
Marcin Prus
|
Marcin Prus
|
||||||
Lee Butler
|
Lee Butler
|
||||||
|
Lars Nilsson
|
||||||
Konstantin Sinitsyn
|
Konstantin Sinitsyn
|
||||||
Ken Sewell
|
Ken Sewell
|
||||||
Julian Ortiz
|
Julian Ortiz
|
||||||
|
Julen Garcia
|
||||||
John Kaniarz
|
John Kaniarz
|
||||||
|
Johannes Scholz
|
||||||
Jim Vaughan
|
Jim Vaughan
|
||||||
Jeremy Bell
|
Jeremy Bell
|
||||||
Jaromir Vitek
|
Jaromir Vitek
|
||||||
James French
|
James French
|
||||||
|
Jaap Glas
|
||||||
Guillaume Millet
|
Guillaume Millet
|
||||||
Gary Quinn
|
Gary Quinn
|
||||||
Garrett Potts
|
Garrett Potts
|
||||||
@@ -210,45 +226,48 @@ Fabio Mierlo
|
|||||||
Doug McCorkle
|
Doug McCorkle
|
||||||
Donald Cipperly
|
Donald Cipperly
|
||||||
Don Leich
|
Don Leich
|
||||||
|
Don Burns
|
||||||
Dietmar Funck
|
Dietmar Funck
|
||||||
|
Colin Cochran
|
||||||
|
Christian Ruzicka
|
||||||
Christian Buchner
|
Christian Buchner
|
||||||
Charles Cole
|
Charles Cole
|
||||||
Blake Williams
|
Blake Williams
|
||||||
|
Bj<EFBFBD>rn Hein
|
||||||
|
Aur<EFBFBD>lien Chatelain
|
||||||
Antoine Hue
|
Antoine Hue
|
||||||
Andrew Bettison
|
Andrew Bettison
|
||||||
|
Andreas Henne
|
||||||
Anders Backman
|
Anders Backman
|
||||||
Ali Botorabi
|
|
||||||
Alexander Wiebel
|
Alexander Wiebel
|
||||||
Alessandro Terenzi
|
Alessandro Terenzi
|
||||||
|
Alberto Barbati
|
||||||
Zach Deedler
|
Zach Deedler
|
||||||
Yuzhong Shen
|
Yuzhong Shen
|
||||||
Wee See
|
|
||||||
Warren Macchi
|
Warren Macchi
|
||||||
Vladimir Chebaev
|
|
||||||
Vincent Bourdier
|
Vincent Bourdier
|
||||||
Terrex
|
Terrex
|
||||||
Tassilo Glander
|
Tassilo Glander
|
||||||
Sylvain Marie
|
|
||||||
Steve Lunsford
|
Steve Lunsford
|
||||||
Stephane Simon
|
Stephane Simon
|
||||||
Stephan Eilemann
|
Stephan Eilemann
|
||||||
Stanislav Blinov
|
Stanislav Blinov
|
||||||
Sergey Polischuk
|
Sergey Polischuk
|
||||||
|
Roni Zanolli
|
||||||
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 Palumbo
|
||||||
Paul Obermeier
|
Paul Obermeier
|
||||||
Nguyen Van Truong
|
Nguyen Van Truong
|
||||||
Nathan Cournia
|
Nathan Cournia
|
||||||
Morten Haukness
|
Morten Haukness
|
||||||
Morn<EFBFBD> Pistorius
|
Morn<EFBFBD> Pistorius
|
||||||
|
Michael Mc Donnell
|
||||||
Michael Henheffer
|
Michael Henheffer
|
||||||
Michael Guerrero
|
Michael Guerrero
|
||||||
Maya Leonard
|
|
||||||
Max Bandazian
|
Max Bandazian
|
||||||
Mathias Fiedler
|
Mathias Fiedler
|
||||||
Mathew May
|
Mathew May
|
||||||
@@ -258,20 +277,17 @@ Martin Lambers
|
|||||||
Martijn Kragtwijk
|
Martijn Kragtwijk
|
||||||
Marius Heise
|
Marius Heise
|
||||||
Marcin Hajder
|
Marcin Hajder
|
||||||
|
Marcel Pursche
|
||||||
Lilith Bryant
|
Lilith Bryant
|
||||||
Lars Nilsson
|
|
||||||
Kristofer Tingdahl
|
|
||||||
Kevin Moiule
|
Kevin Moiule
|
||||||
Keith Steffen
|
Keith Steffen
|
||||||
Julen Garcia
|
|
||||||
Joseph Winston
|
Joseph Winston
|
||||||
John Aughey
|
John Aughey
|
||||||
Johannes Scholz
|
|
||||||
Joachim Pouderoux
|
Joachim Pouderoux
|
||||||
Jean-Christophe Lombardo
|
Jean-Christophe Lombardo
|
||||||
Javier Taibo
|
Jan Klimke
|
||||||
|
James Turner
|
||||||
James Moliere
|
James Moliere
|
||||||
Jaap Glas
|
|
||||||
Igor Kravtchenko
|
Igor Kravtchenko
|
||||||
Himar Carmona
|
Himar Carmona
|
||||||
He Sicong
|
He Sicong
|
||||||
@@ -279,30 +295,37 @@ Guy Volckaert
|
|||||||
Gustavo Wagner
|
Gustavo Wagner
|
||||||
Guillaume Taze
|
Guillaume Taze
|
||||||
Guillaume Chouvenc
|
Guillaume Chouvenc
|
||||||
|
Giuseppe Donvito
|
||||||
Gill Peacegood
|
Gill Peacegood
|
||||||
|
Giampaolo Vigan<61>
|
||||||
Gerrick Bivins
|
Gerrick Bivins
|
||||||
George Tarantilis
|
George Tarantilis
|
||||||
Ferdi Smit
|
Ferdi Smit
|
||||||
Eric Buehler
|
|
||||||
Eduardo Poyart
|
Eduardo Poyart
|
||||||
Edgar Ellis
|
Edgar Ellis
|
||||||
|
Dmitry Marakasov
|
||||||
Dimi Christopoulos
|
Dimi Christopoulos
|
||||||
Diane Delallée
|
Diane Delall<EFBFBD>e
|
||||||
David Longest
|
David Longest
|
||||||
David Ergo
|
David Ergo
|
||||||
Daniel Trstenjak
|
Daniel Trstenjak
|
||||||
Craig Bosma
|
Craig Bosma
|
||||||
Claus Scheiblauer
|
Claus Scheiblauer
|
||||||
Christophe Loustaunau
|
Christophe Loustaunau
|
||||||
|
Christian Kehl
|
||||||
|
Bradley Baker Searles
|
||||||
Brad Anderegg
|
Brad Anderegg
|
||||||
Aric Aumann
|
Aric Aumann
|
||||||
|
Anish Thomas
|
||||||
Andrew Sampson
|
Andrew Sampson
|
||||||
Andrew Lorino
|
Andrew Lorino
|
||||||
Alexandre Amalric
|
Alexandre Amalric
|
||||||
|
Aitor Moreno
|
||||||
Zbigniew Sroczynski
|
Zbigniew Sroczynski
|
||||||
Yuri Vilmanis
|
Yuri Vilmanis
|
||||||
Xin Li
|
Xin Li
|
||||||
Wang Lam
|
Wang Lam
|
||||||
|
Wand Rui
|
||||||
Walter J. Altice
|
Walter J. Altice
|
||||||
Volker Walkiewicz
|
Volker Walkiewicz
|
||||||
Vladimir Vukicevic
|
Vladimir Vukicevic
|
||||||
@@ -316,36 +339,44 @@ Valeriy Dubov
|
|||||||
Vaclav Bilek
|
Vaclav Bilek
|
||||||
Tyge L<>vset
|
Tyge L<>vset
|
||||||
Troy Yee
|
Troy Yee
|
||||||
|
Torben Dannahauer
|
||||||
|
Tony Vasile
|
||||||
Tomas Hogarth
|
Tomas Hogarth
|
||||||
Tomas Hnilica
|
Tomas Hnilica
|
||||||
Todd Furlong
|
Todd Furlong
|
||||||
Tobias Ottenweller
|
Tobias Ottenweller
|
||||||
Tino Schwarze
|
Tino Schwarze
|
||||||
|
Tim George
|
||||||
Thorsten Brehm
|
Thorsten Brehm
|
||||||
Thomas Weidner
|
Thomas Weidner
|
||||||
Tan Dunning
|
Tan Dunning
|
||||||
Tamer Fahmy
|
Tamer Fahmy
|
||||||
Stewart Andreason
|
Stewart Andreason
|
||||||
Steven Thomas
|
Steven Thomas
|
||||||
|
Stephan Wenglorz
|
||||||
Simon Hammett
|
Simon Hammett
|
||||||
Simon Carmody
|
Simon Carmody
|
||||||
Simon Buckley
|
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 The
|
||||||
Ruben Smelik
|
Ruben Smelik
|
||||||
Ross Anderson
|
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
|
||||||
@@ -359,9 +390,11 @@ Philip Lamb
|
|||||||
Petr Salinger
|
Petr Salinger
|
||||||
Peter Bear
|
Peter Bear
|
||||||
Peter Amstutz
|
Peter Amstutz
|
||||||
|
Per Nordqvist
|
||||||
Paul Idstein
|
Paul Idstein
|
||||||
Paul Fredrikson
|
Paul Fredrikson
|
||||||
Paul Fotheringham
|
Paul Fotheringham
|
||||||
|
Paul Cheyrou-Lagreze
|
||||||
Pau Garcia
|
Pau Garcia
|
||||||
Patrick Hartling
|
Patrick Hartling
|
||||||
Parag Chaudhur
|
Parag Chaudhur
|
||||||
@@ -372,21 +405,26 @@ Oren Fromberg
|
|||||||
Oliver Neumann
|
Oliver Neumann
|
||||||
Ole-Morten Duesund
|
Ole-Morten Duesund
|
||||||
Nicolas Brodu
|
Nicolas Brodu
|
||||||
|
Nick Thu
|
||||||
Nick Black
|
Nick Black
|
||||||
Mojtaba Fathi
|
Mojtaba Fathi
|
||||||
Mirko Viviani
|
Mirko Viviani
|
||||||
Mikkel Gjøl
|
Mikkel Gj<EFBFBD>l
|
||||||
|
Mike Krus
|
||||||
Mike Garrity
|
Mike Garrity
|
||||||
Miha Ravsel
|
Mick Thu
|
||||||
|
Michal Durkovic
|
||||||
|
Michael Schanne
|
||||||
Michael Polak
|
Michael Polak
|
||||||
Michael Morrison
|
Michael Morrison
|
||||||
Michael Logan
|
Michael Logan
|
||||||
Michael Kapelko
|
Michael Kapelko
|
||||||
Michael Bach Jensen
|
Michael Bach Jensen
|
||||||
|
Maya Thu
|
||||||
|
Maya Leonard
|
||||||
Max Rhiener
|
Max Rhiener
|
||||||
Max Behensky
|
Max Behensky
|
||||||
Mauricio Hofmam
|
Mauricio Hofmam
|
||||||
Matthias Helsing
|
|
||||||
Matthew May
|
Matthew May
|
||||||
Matthew Johnson-Roberson
|
Matthew Johnson-Roberson
|
||||||
Matt Green
|
Matt Green
|
||||||
@@ -399,20 +437,19 @@ Martin Innus
|
|||||||
Martin Beck
|
Martin Beck
|
||||||
Marius Kintel
|
Marius Kintel
|
||||||
Mario Guimaraes
|
Mario Guimaraes
|
||||||
|
Marcus Hein
|
||||||
|
Marco Thu
|
||||||
Marco Sciabica
|
Marco Sciabica
|
||||||
Marco Lehmann
|
Marco Lehmann
|
||||||
Marcel Pursche
|
|
||||||
Maik Keller
|
|
||||||
Lukas Diduch
|
Lukas Diduch
|
||||||
Louis Hamilton
|
Louis Hamilton
|
||||||
|
Likasz Izebski
|
||||||
Lewis Harmon
|
Lewis Harmon
|
||||||
Leigh Stivers
|
Leigh Stivers
|
||||||
Laurence Muller
|
Laurence Muller
|
||||||
Laura Cerritelli
|
Laura Cerritelli
|
||||||
Lars Nillson
|
|
||||||
Kyle Centers
|
Kyle Centers
|
||||||
Kristopher Bixler
|
Kristopher Bixler
|
||||||
Konstantin Matveyev
|
|
||||||
Kim Seokhwan
|
Kim Seokhwan
|
||||||
Kim Bale
|
Kim Bale
|
||||||
Karsten Weiss
|
Karsten Weiss
|
||||||
@@ -423,20 +460,24 @@ Juergen Rensen
|
|||||||
Juan Manuel Alvarez
|
Juan Manuel Alvarez
|
||||||
Juan Hernando
|
Juan Hernando
|
||||||
Josh Portway
|
Josh Portway
|
||||||
|
Jonathan Greig
|
||||||
John Tan
|
John Tan
|
||||||
|
John Hedström
|
||||||
John Grant
|
John Grant
|
||||||
|
John Farrier
|
||||||
John Donovan
|
John Donovan
|
||||||
John Davis
|
John Davis
|
||||||
John Cummings
|
John Cummings
|
||||||
John Argentieri
|
John Argentieri
|
||||||
|
Joe Thompson
|
||||||
Joan Abadie
|
Joan Abadie
|
||||||
Jim Brooks
|
Jim Brooks
|
||||||
Jeroen den Dekker
|
Jeroen den Dekker
|
||||||
|
Jeffrey Kinross
|
||||||
Jay Zuckerman
|
Jay Zuckerman
|
||||||
Jason Howlett
|
Jason Howlett
|
||||||
Jason Ballenger
|
Jason Ballenger
|
||||||
Jan Klimke
|
Jamie Robertson
|
||||||
James Turner
|
|
||||||
James Killian
|
James Killian
|
||||||
James Athey
|
James Athey
|
||||||
J.E. Hoffmann
|
J.E. Hoffmann
|
||||||
@@ -447,8 +488,10 @@ Hartmut Seichter
|
|||||||
Gunter Huber
|
Gunter Huber
|
||||||
Gregory Jaegy
|
Gregory Jaegy
|
||||||
Graeme Harkness
|
Graeme Harkness
|
||||||
|
Github It
|
||||||
Gian Lorenzetto
|
Gian Lorenzetto
|
||||||
George Papagiannakis
|
George Papagiannakis
|
||||||
|
Geoff Thu
|
||||||
Galen Faidley
|
Galen Faidley
|
||||||
Frida Schlaug
|
Frida Schlaug
|
||||||
Frederic Smith
|
Frederic Smith
|
||||||
@@ -463,6 +506,8 @@ Ferdinand Cornelissen
|
|||||||
Fajran Iman
|
Fajran Iman
|
||||||
Fabien Dachicourt
|
Fabien Dachicourt
|
||||||
Erik Johnson
|
Erik Johnson
|
||||||
|
Eric Thu
|
||||||
|
Eric Buehler
|
||||||
Eduardo Alberto
|
Eduardo Alberto
|
||||||
Edmond Gheury
|
Edmond Gheury
|
||||||
Ed Ralston
|
Ed Ralston
|
||||||
@@ -470,6 +515,7 @@ Duvan Cope
|
|||||||
Duncan Cavens
|
Duncan Cavens
|
||||||
Drew Whitehouse
|
Drew Whitehouse
|
||||||
Douglas A. Pouk
|
Douglas A. Pouk
|
||||||
|
Dmitriy Ogalcev
|
||||||
Dean Iverson
|
Dean Iverson
|
||||||
David Jung
|
David Jung
|
||||||
Danny Valente
|
Danny Valente
|
||||||
@@ -477,11 +523,14 @@ Daniel Stien
|
|||||||
Dan Minor
|
Dan Minor
|
||||||
C<EFBFBD>sar L. B. Silveira
|
C<EFBFBD>sar L. B. Silveira
|
||||||
Cyril Brulebois
|
Cyril Brulebois
|
||||||
|
Cory Slep
|
||||||
|
Cl<EFBFBD>ment B<>sch
|
||||||
Clay Fowler
|
Clay Fowler
|
||||||
|
Claus Steuer
|
||||||
Chuck Sembroski
|
Chuck Sembroski
|
||||||
Christopher Blaesius
|
Christopher Blaesius
|
||||||
|
Christopher Baker
|
||||||
Christophe Herreman
|
Christophe Herreman
|
||||||
Christian Ruzicka
|
|
||||||
Christian Noon
|
Christian Noon
|
||||||
Christian Kaser
|
Christian Kaser
|
||||||
Christian Ehrlicher
|
Christian Ehrlicher
|
||||||
@@ -490,10 +539,8 @@ Carlos Garcea
|
|||||||
Bryce Eldridge
|
Bryce Eldridge
|
||||||
Bruno Herbelin
|
Bruno Herbelin
|
||||||
Brian Keener
|
Brian Keener
|
||||||
|
Brede Thu
|
||||||
Brandon Hamm
|
Brandon Hamm
|
||||||
Bora Utka
|
|
||||||
Bj<EFBFBD>rn Hein
|
|
||||||
Bjorn Blissing
|
|
||||||
Bill Prendergast
|
Bill Prendergast
|
||||||
Bernardt Duvenhage
|
Bernardt Duvenhage
|
||||||
Benoit Laniel
|
Benoit Laniel
|
||||||
@@ -501,16 +548,21 @@ Benjamin Wasty
|
|||||||
Ben van Basten
|
Ben van Basten
|
||||||
Bart Gallet
|
Bart Gallet
|
||||||
Axel Volley
|
Axel Volley
|
||||||
|
Arjun Ramamurthy
|
||||||
Anthousis Andreadis
|
Anthousis Andreadis
|
||||||
Andy Preece
|
Andy Preece
|
||||||
Andrew Reyonolds
|
Andrew Reyonolds
|
||||||
Andreas Roth
|
Andreas Roth
|
||||||
Andreas Jochens
|
Andreas Jochens
|
||||||
Andre Normann
|
Andre Normann
|
||||||
|
Alois Wismer
|
||||||
Almalric Alexandre
|
Almalric Alexandre
|
||||||
Allen Bierbaum
|
Allen Bierbaum
|
||||||
|
Alexey Pavlov
|
||||||
Alberto Jaspe
|
Alberto Jaspe
|
||||||
Alan Purvis
|
Alan Purvis
|
||||||
Alan Ott
|
Alan Ott
|
||||||
Alan Harris
|
Alan Harris
|
||||||
|
Adrien Grandemange
|
||||||
|
Adrian Clark
|
||||||
Adam Richard
|
Adam Richard
|
||||||
|
|||||||
477
CMakeLists.txt
477
CMakeLists.txt
@@ -22,38 +22,43 @@ if(COMMAND cmake_policy)
|
|||||||
|
|
||||||
# tell CMake to prefer CMake's own CMake modules when available
|
# tell CMake to prefer CMake's own CMake modules when available
|
||||||
# only available from cmake-2.8.4
|
# only available from cmake-2.8.4
|
||||||
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3)
|
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)
|
cmake_policy(SET CMP0017 NEW)
|
||||||
endif()
|
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} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
|
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR
|
||||||
|
(${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)
|
# disable autolinking to qtmain as we have our own main() functions (new in Qt 5.1)
|
||||||
if((${CMAKE_MAJOR_VERSION} EQUAL 2 OR ${CMAKE_MAJOR_VERSION} GREATER 2) AND
|
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR
|
||||||
(${CMAKE_MINOR_VERSION} EQUAL 8 OR ${CMAKE_MINOR_VERSION} GREATER 8) AND
|
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 8) OR
|
||||||
${CMAKE_PATCH_VERSION} GREATER 10)
|
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 10))
|
||||||
cmake_policy(SET CMP0020 OLD)
|
cmake_policy(SET CMP0020 OLD)
|
||||||
endif()
|
endif()
|
||||||
# nicer version check - but needs at least CMake 2.6.2? Worth upgrading the requirements?
|
# nicer version check - but needs at least CMake 2.6.2? Worth upgrading the requirements?
|
||||||
#if("${CMAKE_VERSION}" VERSION_GREATER 2.8.10)
|
#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 4)
|
||||||
SET(OPENSCENEGRAPH_PATCH_VERSION 0)
|
SET(OPENSCENEGRAPH_PATCH_VERSION 1)
|
||||||
SET(OPENSCENEGRAPH_SOVERSION 99)
|
SET(OPENSCENEGRAPH_SOVERSION 131)
|
||||||
|
|
||||||
# set to 0 when not a release candidate, non zero means that any generated
|
# set to 0 when not a release candidate, non zero means that any generated
|
||||||
# svn tags will be treated as release candidates of given number
|
# git tags will be treated as release candidates of given number
|
||||||
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 1)
|
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 0)
|
||||||
|
|
||||||
SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
|
SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
|
||||||
|
|
||||||
@@ -80,78 +85,16 @@ 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}")
|
||||||
|
|
||||||
## Option to enable Android build using AndroidNDK
|
# Change the default build type to Release
|
||||||
OPTION(OSG_BUILD_PLATFORM_ANDROID OFF)
|
IF(NOT CMAKE_BUILD_TYPE)
|
||||||
IF(OSG_BUILD_PLATFORM_ANDROID)
|
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)
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
|
|
||||||
|
|
||||||
|
IF(ANDROID)
|
||||||
INCLUDE(OsgAndroidMacroUtils)
|
INCLUDE(OsgAndroidMacroUtils)
|
||||||
SET(ANDROID TRUE)
|
|
||||||
IF(NOT ANDROID_PLATFORM)
|
|
||||||
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)
|
|
||||||
|
|
||||||
SET(OSG_ANDROID_TEMPLATES "${CMAKE_SOURCE_DIR}/PlatformSpecifics/Android")
|
|
||||||
|
|
||||||
SET(J "4" CACHE STRING "how many processes for make -j <J>")
|
|
||||||
|
|
||||||
ADD_CUSTOM_COMMAND(
|
|
||||||
OUTPUT Android-OpenSceneGraph
|
|
||||||
DEPENDS ${CMAKE_BINARY_DIR}/Android.mk
|
|
||||||
COMMAND "${ANDROID_NDK}/ndk-build"
|
|
||||||
ARGS --directory=${CMAKE_BINARY_DIR} NDK_APPLICATION_MK=Application.mk -j${J} NDK_LOG=1
|
|
||||||
)
|
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(ndk ALL echo
|
|
||||||
DEPENDS Android-OpenSceneGraph
|
|
||||||
)
|
|
||||||
install(DIRECTORY include/ DESTINATION include/
|
|
||||||
PATTERN ".svn" EXCLUDE
|
|
||||||
)
|
|
||||||
install(DIRECTORY ${CMAKE_BINARY_DIR}/include/ DESTINATION include/
|
|
||||||
)
|
|
||||||
install(DIRECTORY ${CMAKE_BINARY_DIR}/obj/ DESTINATION obj/
|
|
||||||
PATTERN ".svn" EXCLUDE
|
|
||||||
PATTERN "objs" EXCLUDE
|
|
||||||
)
|
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DANDROID)
|
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Okay, here's the problem: On some platforms, linking against OpenThreads
|
# Okay, here's the problem: On some platforms, linking against OpenThreads
|
||||||
# is not enough and explicit linking to the underlying thread library
|
# is not enough and explicit linking to the underlying thread library
|
||||||
# is also required (e.g. FreeBSD). But OpenThreads may be built with different
|
# is also required (e.g. FreeBSD). But OpenThreads may be built with different
|
||||||
@@ -171,27 +114,15 @@ IF(CMAKE_SYSTEM MATCHES IRIX)
|
|||||||
SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
|
SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making svn branches, tags, updating ChangeLog." OFF)
|
OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making git branches, tags, updating ChangeLog." OFF)
|
||||||
IF (OSG_MAINTAINER)
|
IF (OSG_MAINTAINER)
|
||||||
|
|
||||||
SET(OPENSCENEGRAPH_SVN "trunk")
|
|
||||||
#SET(OPENSCENEGRAPH_SVN "branches")
|
|
||||||
SET(OPENSCENEGRAPH_BRANCH OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION})
|
SET(OPENSCENEGRAPH_BRANCH OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION})
|
||||||
|
|
||||||
#
|
#
|
||||||
# Provide target for tagging a release
|
# Provide target for tagging a release
|
||||||
#
|
#
|
||||||
SET(SVNCOMMAND svn)
|
SET(GITCOMMAND git)
|
||||||
SET(SVNTRUNKDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk)
|
|
||||||
SET(SVNTAGDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/tags)
|
|
||||||
SET(SVNBRANCHDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/branches)
|
|
||||||
|
|
||||||
IF (OPENSCENEGRAPH_SVN STREQUAL "trunk")
|
|
||||||
SET(SVNSOURCEDIR ${SVNTRUNKDIR})
|
|
||||||
ELSE()
|
|
||||||
SET(SVNSOURCEDIR ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH})
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
|
|
||||||
IF (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
|
IF (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
|
||||||
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION})
|
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION})
|
||||||
@@ -199,31 +130,38 @@ IF (OSG_MAINTAINER)
|
|||||||
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION}-rc${OPENSCENEGRAPH_RELEASE_CANDIDATE})
|
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION}-rc${OPENSCENEGRAPH_RELEASE_CANDIDATE})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
SET(RELEASE_MESSAGE "Release ${RELEASE_NAME}")
|
||||||
|
SET(BRANCH_MESSAGE "Branch ${OPENSCENEGRAPH_BRANCH}")
|
||||||
|
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(tag-test
|
ADD_CUSTOM_TARGET(tag-test
|
||||||
COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
|
COMMAND echo ${GITCOMMAND} tag -a ${RELEASE_NAME} -m ${RELEASE_MESSAGE}
|
||||||
|
COMMAND echo ${GITCOMMAND} push origin ${RELEASE_NAME}
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(tag-run
|
ADD_CUSTOM_TARGET(tag-run
|
||||||
COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
|
COMMAND ${GITCOMMAND} tag -a ${RELEASE_NAME} -m ${RELEASE_MESSAGE}
|
||||||
|
COMMAND ${GITCOMMAND} push origin ${RELEASE_NAME}
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(branch-test
|
ADD_CUSTOM_TARGET(branch-test
|
||||||
COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
|
COMMAND echo ${GITCOMMAND} branch ${OPENSCENEGRAPH_BRANCH} -m ${BRANCH_MESSAGE}
|
||||||
|
COMMAND echo ${GITCOMMAND} push origin ${OPENSCENEGRAPH_BRANCH}
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(branch-run
|
ADD_CUSTOM_TARGET(branch-run
|
||||||
COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
|
COMMAND ${GITCOMMAND} branch ${OPENSCENEGRAPH_BRANCH} -m ${BRANCH_MESSAGE}
|
||||||
|
COMMAND ${GITCOMMAND} push origin ${OPENSCENEGRAPH_BRANCH}
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Provide target for generating ChangeLog
|
# Provide target for generating ChangeLog
|
||||||
#
|
#
|
||||||
SET(GENERATELOGS svn2cl)
|
SET(GITLOGFORMAT "%aD%nChecked in by : %an%n%s%b%n")
|
||||||
|
SET(GENERATELOGS git log --pretty=format:${GITLOGFORMAT})
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(ChangeLog
|
ADD_CUSTOM_TARGET(ChangeLog
|
||||||
COMMAND ${SVNCOMMAND} update
|
COMMAND ${GENERATELOGS} > ChangeLog
|
||||||
COMMAND ${GENERATELOGS} ${SVNSOURCEDIR}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
ENDIF(OSG_MAINTAINER)
|
ENDIF(OSG_MAINTAINER)
|
||||||
@@ -234,8 +172,12 @@ IF(APPLE)
|
|||||||
EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion"
|
EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion"
|
||||||
OUTPUT_VARIABLE OSG_OSX_SDK_NAME
|
OUTPUT_VARIABLE OSG_OSX_SDK_NAME
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
STRING(SUBSTRING "${OSG_OSX_SDK_NAME}" 0 4 OSG_OSX_SDK_NAME)
|
STRING(REPLACE "." ";" MACOS_VERSION_LIST ${OSG_OSX_SDK_NAME})
|
||||||
SET(OSG_OSX_SDK_NAME "macosx${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
|
||||||
@@ -247,13 +189,16 @@ IF(APPLE)
|
|||||||
|
|
||||||
#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 "6.0" CACHE STRING "IOS SDK-Version")
|
||||||
|
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
|
||||||
include(CMakeForceCompiler)
|
IF(IPHONE_VERSION_MIN LESS "6.0")
|
||||||
CMAKE_FORCE_C_COMPILER(llvm-gcc-4.2 GNU)
|
include(CMakeForceCompiler)
|
||||||
CMAKE_FORCE_CXX_COMPILER(llvm-gcc-4.2 GNU)
|
CMAKE_FORCE_C_COMPILER(llvm-gcc-4.2 GNU)
|
||||||
SET(GCC_THUMB_SUPPORT NO)
|
CMAKE_FORCE_CXX_COMPILER(llvm-gcc-4.2 GNU)
|
||||||
|
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)
|
||||||
@@ -283,6 +228,10 @@ ELSE()
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IF(UNIX AND NOT ANDROID)
|
IF(UNIX AND NOT ANDROID)
|
||||||
# Not sure what this will do on Cygwin and Msys
|
# Not sure what this will do on Cygwin and Msys
|
||||||
# Also, remember OS X X11 is a user installed option so it may not exist.
|
# Also, remember OS X X11 is a user installed option so it may not exist.
|
||||||
@@ -444,49 +393,228 @@ ENDIF()
|
|||||||
OPTION(OSG_DISABLE_MSVC_WARNINGS "Set to OFF to not disable MSVC warnings generated by OSG headers." ON)
|
OPTION(OSG_DISABLE_MSVC_WARNINGS "Set to OFF to not disable MSVC warnings generated by OSG headers." ON)
|
||||||
MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS)
|
MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS)
|
||||||
|
|
||||||
|
OPTION(OSG_PROVIDE_READFILE "Set to ON for include/osgDB/ReadFile to provide the osgDB::read*File(() methods. " ON)
|
||||||
OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON)
|
OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON)
|
||||||
|
|
||||||
|
|
||||||
OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON)
|
# Map the OPENGL_PROFILE to OSG_GL*_AVAILABLE settings
|
||||||
OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." ON)
|
SET(OPENGL_PROFILE "GL2" CACHE STRING "OpenGL Profile to use, choose from GL1, GL2, GL3, GLES1, GLES2, GLES3")
|
||||||
OPTION(OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." OFF)
|
|
||||||
OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." OFF)
|
IF ((OPENGL_PROFILE STREQUAL "GL1") OR (OPENGL_PROFILE STREQUAL "GL2"))
|
||||||
OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." OFF)
|
OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON )
|
||||||
|
ELSE()
|
||||||
|
OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." OFF )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF ((OPENGL_PROFILE STREQUAL "GL2"))
|
||||||
|
OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." ON )
|
||||||
|
ELSE()
|
||||||
|
OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." OFF )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF ((OPENGL_PROFILE STREQUAL "GL3") OR (OPENGL_PROFILE STREQUAL "GLCORE"))
|
||||||
|
OPTION(OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." ON )
|
||||||
|
ELSE()
|
||||||
|
OPTION(OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." OFF )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF ((OPENGL_PROFILE STREQUAL "GLES1"))
|
||||||
|
OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." ON )
|
||||||
|
ELSE()
|
||||||
|
OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." OFF )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF ((OPENGL_PROFILE STREQUAL "GLES2"))
|
||||||
|
OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." ON )
|
||||||
|
ELSEIF ((OPENGL_PROFILE STREQUAL "GLES3"))
|
||||||
|
OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." ON )
|
||||||
|
OPTION(OSG_GLES3_AVAILABLE "Set to OFF to disable use of OpenGL ES 3.x functions library." ON )
|
||||||
|
ELSE()
|
||||||
|
OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." OFF )
|
||||||
|
OPTION(OSG_GLES3_AVAILABLE "Set to OFF to disable use of OpenGL ES 3.x functions library." OFF )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
OPTION(OSG_GL_LIBRARY_STATIC "Set to ON to statically link with OpenGL/GLES library." OFF)
|
OPTION(OSG_GL_LIBRARY_STATIC "Set to ON to statically link with OpenGL/GLES library." OFF)
|
||||||
|
|
||||||
SET(OPENGL_egl_LIBRARY CACHE STRING "Set the OpenGL egl library.")
|
SET(OPENGL_egl_LIBRARY CACHE STRING "Set the OpenGL egl library.")
|
||||||
|
|
||||||
# SET(OSG_GL_DISPLAYLISTS_AVAILABLE ${OSG_GL1_AVAILABLE})
|
# Map the OSG_GL*_AVAILABLE settings to OSG_GL_* settings
|
||||||
# SET(OSG_GL_MATRICES_AVAILABLE ${OSG_GL1_AVAILABLE})
|
IF (OSG_GLES2_AVAILABLE OR OSG_GL3_AVAILABLE)
|
||||||
# SET(OSG_GL_VERTEX_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE})
|
OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." OFF)
|
||||||
# SET(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE})
|
OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." OFF)
|
||||||
# SET(OSG_GL_FIXED_FUNCTION_AVAILABLE ${OSG_GL1_AVAILABLE})
|
OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." OFF)
|
||||||
|
OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." OFF)
|
||||||
|
OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." OFF)
|
||||||
|
ELSEIF (OSG_GLES1_AVAILABLE)
|
||||||
|
OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." OFF)
|
||||||
|
OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ON)
|
||||||
|
OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ON)
|
||||||
|
OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." ON)
|
||||||
|
OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ON)
|
||||||
|
ELSE()
|
||||||
|
OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." ON)
|
||||||
|
OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ON)
|
||||||
|
OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ON)
|
||||||
|
OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." ON)
|
||||||
|
OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ON)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." ${OSG_GL1_AVAILABLE})
|
IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE)
|
||||||
OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ${OSG_GL1_AVAILABLE})
|
OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." OFF)
|
||||||
OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ${OSG_GL1_AVAILABLE})
|
ELSE()
|
||||||
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_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON)
|
||||||
OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ${OSG_GL1_AVAILABLE})
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
|
# Map the OSG_GL*_AVAILABLE settings to OpenGL header settings
|
||||||
|
IF (OSG_GL3_AVAILABLE)
|
||||||
|
IF (APPLE)
|
||||||
|
SET(OPENGL_HEADER1 "#include <OpenGL/gl.h>" CACHE STRING "#include<> line for OpenGL Header")
|
||||||
|
SET(OPENGL_HEADER2 "#include <OpenGL/gl3.h>" CACHE STRING "#include<> line for additional OpenGL Headers if required")
|
||||||
|
ELSE()
|
||||||
|
|
||||||
|
IF (OPENGL_PROFILE STREQUAL "GLCORE")
|
||||||
|
IF(WIN32)
|
||||||
|
FIND_PACKAGE(GLCORE REQUIRED)
|
||||||
|
ENDIF()
|
||||||
|
SET(OPENGL_HEADER1 "#include <GL/glcorearb.h>" CACHE STRING "#include<> line for OpenGL Header")
|
||||||
|
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
|
||||||
|
ELSE()
|
||||||
|
SET(OPENGL_HEADER1 "#include <GL3/gl3.h>" CACHE STRING "#include<> line for OpenGL Header")
|
||||||
|
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
ENDIF()
|
||||||
|
ELSEIF(OSG_GLES1_AVAILABLE)
|
||||||
|
IF (APPLE AND NOT ANDROID)
|
||||||
|
SET(OPENGL_HEADER1 "#include \"TargetConditionals.h\"" CACHE STRING "#include<> line for OpenGL Header")
|
||||||
|
SET(OPENGL_HEADER2 "#include <OpenGLES/ES1/gl.h>" CACHE STRING "#include<> line for additional OpenGL Headers if required")
|
||||||
|
ELSE()
|
||||||
|
SET(OPENGL_HEADER1 "#include <GLES/gl.h>" CACHE STRING "#include<> line for OpenGL Header")
|
||||||
|
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
|
||||||
|
ENDIF()
|
||||||
|
ELSEIF(OSG_GLES2_AVAILABLE)
|
||||||
|
IF (APPLE AND NOT ANDROID)
|
||||||
|
SET(OPENGL_HEADER1 "#include \"TargetConditionals.h\"" CACHE STRING "#include<> line for OpenGL Header")
|
||||||
|
SET(OPENGL_HEADER2 "#include <OpenGLES/ES2/gl.h>" CACHE STRING "#include<> line for additional OpenGL Headers if required")
|
||||||
|
# TODO: GLES3
|
||||||
|
ELSE()
|
||||||
|
SET(OPENGL_HEADER1 "#include <GLES2/gl2.h>" CACHE STRING "#include<> line for OpenGL Header")
|
||||||
|
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
|
||||||
|
# TODO: GLES3
|
||||||
|
ENDIF()
|
||||||
|
ELSE()
|
||||||
|
IF (APPLE)
|
||||||
|
SET(OPENGL_HEADER1 "#include <OpenGL/gl.h>" CACHE STRING "#include<> line for OpenGL Header")
|
||||||
|
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
|
||||||
|
ELSE()
|
||||||
|
SET(OPENGL_HEADER1 "#include <GL/gl.h>" CACHE STRING "#include<> line for OpenGL Header")
|
||||||
|
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF (OSG_GL1_AVAILABLE)
|
||||||
|
SET(OSG_GL1_FEATURES 1)
|
||||||
|
ELSE()
|
||||||
|
SET(OSG_GL1_FEATURES 0)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF (OSG_GL2_AVAILABLE)
|
||||||
|
SET(OSG_GL2_FEATURES 1)
|
||||||
|
ELSE()
|
||||||
|
SET(OSG_GL2_FEATURES 0)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF (OSG_GL3_AVAILABLE)
|
||||||
|
SET(OSG_GL3_FEATURES 1)
|
||||||
|
ELSE()
|
||||||
|
SET(OSG_GL3_FEATURES 0)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF (OSG_GLES1_AVAILABLE)
|
||||||
|
SET(OSG_GLES1_FEATURES 1)
|
||||||
|
ELSE()
|
||||||
|
SET(OSG_GLES1_FEATURES 0)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF (OSG_GLES2_AVAILABLE)
|
||||||
|
SET(OSG_GLES2_FEATURES 1)
|
||||||
|
ELSE()
|
||||||
|
SET(OSG_GLES2_FEATURES 0)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF (OSG_GLES3_AVAILABLE)
|
||||||
|
SET(OSG_GLES3_FEATURES 1)
|
||||||
|
ELSE()
|
||||||
|
SET(OSG_GLES3_FEATURES 0)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(ANDROID)
|
||||||
|
IF(OSG_GLES1_AVAILABLE)
|
||||||
|
FIND_PATH(OPENGL_INCLUDE_DIR GLES/gl.h
|
||||||
|
PATHS
|
||||||
|
${ANDROID_SYSROOT}/usr/include)
|
||||||
|
FIND_LIBRARY(OPENGL_gl_LIBRARY GLESv1_CM
|
||||||
|
PATHS
|
||||||
|
${ANDROID_SYSROOT}/usr/lib)
|
||||||
|
ELSEIF(OSG_GLES2_AVAILABLE)
|
||||||
|
FIND_PATH(OPENGL_INCLUDE_DIR GLES2/gl2.h
|
||||||
|
PATHS
|
||||||
|
${ANDROID_SYSROOT}/usr/include)
|
||||||
|
FIND_LIBRARY(OPENGL_gl_LIBRARY GLESv2
|
||||||
|
PATHS
|
||||||
|
${ANDROID_SYSROOT}/usr/lib)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON)
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Set Config file
|
# Set Config header file
|
||||||
|
|
||||||
SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config")
|
SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config")
|
||||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
|
||||||
"${OPENSCENEGRAPH_CONFIG_HEADER}")
|
"${OPENSCENEGRAPH_CONFIG_HEADER}")
|
||||||
|
|
||||||
SET(OPENSCENEGRAPH_VERSION_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/osg/Version")
|
|
||||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Version.in"
|
################################################################################
|
||||||
"${OPENSCENEGRAPH_VERSION_HEADER}")
|
# Set OpenGL header file
|
||||||
|
|
||||||
|
INCLUDE (CheckCXXSourceCompiles)
|
||||||
|
#SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${OPENGL_INCLUDE_DIR})
|
||||||
|
|
||||||
|
check_cxx_source_compiles(
|
||||||
|
"${OPENGL_HEADER1}
|
||||||
|
${OPENGL_HEADER2}
|
||||||
|
int main() { GLint64 test; return 0; }"
|
||||||
|
GL_HEADER_HAS_GLINT64
|
||||||
|
)
|
||||||
|
|
||||||
|
check_cxx_source_compiles(
|
||||||
|
"${OPENGL_HEADER1}
|
||||||
|
${OPENGL_HEADER2}
|
||||||
|
int main() { GLuint64 test; return 0; }"
|
||||||
|
GL_HEADER_HAS_GLUINT64
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(OPENSCENEGRAPH_OPENGL_HEADER "${PROJECT_BINARY_DIR}/include/osg/GL")
|
||||||
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/GL.in"
|
||||||
|
"${OPENSCENEGRAPH_OPENGL_HEADER}")
|
||||||
|
|
||||||
# INSTALL_FILES(/include/osg/ FILES "${OPENSCENEGRAPH_CONFIG_HEADER}")
|
# INSTALL_FILES(/include/osg/ FILES "${OPENSCENEGRAPH_CONFIG_HEADER}")
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Set Version header file
|
||||||
|
|
||||||
|
SET(OPENSCENEGRAPH_VERSION_HEADER "${PROJECT_BINARY_DIR}/include/osg/Version")
|
||||||
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Version.in"
|
||||||
|
"${OPENSCENEGRAPH_VERSION_HEADER}")
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Set Version Info resource file
|
# Set Version Info resource file
|
||||||
|
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET(OPENSCENEGRAPH_VERSIONINFO_RC "${PROJECT_BINARY_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc")
|
SET(OPENSCENEGRAPH_VERSIONINFO_RC "${PROJECT_BINARY_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc")
|
||||||
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc.in"
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc.in"
|
||||||
@@ -508,11 +636,18 @@ IF(WIN32 AND NOT ANDROID)
|
|||||||
INCLUDE(Find3rdPartyDependencies)
|
INCLUDE(Find3rdPartyDependencies)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
OPTION(OSG_USE_LOCAL_LUA_SOURCE "Enable to use local Lua source when building the lua plugin" ON)
|
||||||
|
|
||||||
|
#
|
||||||
|
# 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)
|
||||||
@@ -528,15 +663,33 @@ ELSE()
|
|||||||
FIND_PACKAGE(LibVNCServer)
|
FIND_PACKAGE(LibVNCServer)
|
||||||
FIND_PACKAGE(OurDCMTK)
|
FIND_PACKAGE(OurDCMTK)
|
||||||
FIND_PACKAGE(FFmpeg)
|
FIND_PACKAGE(FFmpeg)
|
||||||
|
FIND_PACKAGE(GStreamer COMPONENTS app pbutils)
|
||||||
|
FIND_PACKAGE(GLIB COMPONENTS gobject)
|
||||||
FIND_PACKAGE(DirectShow)
|
FIND_PACKAGE(DirectShow)
|
||||||
|
FIND_PACKAGE(SDL2)
|
||||||
FIND_PACKAGE(SDL)
|
FIND_PACKAGE(SDL)
|
||||||
FIND_PACKAGE(Poppler-glib)
|
FIND_PACKAGE(Poppler-glib)
|
||||||
FIND_PACKAGE(RSVG)
|
FIND_PACKAGE(RSVG)
|
||||||
FIND_PACKAGE(GtkGl)
|
FIND_PACKAGE(GtkGl)
|
||||||
FIND_PACKAGE(DirectInput)
|
FIND_PACKAGE(DirectInput)
|
||||||
FIND_PACKAGE(NVTT)
|
FIND_PACKAGE(NVTT)
|
||||||
FIND_PACKAGE(Asio)
|
IF (NOT WIN32)
|
||||||
|
FIND_PACKAGE(Asio)
|
||||||
|
ENDIF()
|
||||||
FIND_PACKAGE(ZeroConf)
|
FIND_PACKAGE(ZeroConf)
|
||||||
|
|
||||||
|
FIND_PACKAGE(LIBLAS)
|
||||||
|
|
||||||
|
IF (NOT(OSG_USE_LOCAL_LUA_SOURCE))
|
||||||
|
FIND_PACKAGE(Lua52)
|
||||||
|
IF (NOT (LUA_LIBRARIES AND LUA_INCLUDE_DIR))
|
||||||
|
FIND_PACKAGE(Lua51)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# V8 and Python plugins are tests for linking against these libraries but aren't functionality beyond this.
|
||||||
|
# FIND_PACKAGE(V8)
|
||||||
|
# FIND_PACKAGE(PythonLibs)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8)
|
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8)
|
||||||
@@ -555,11 +708,11 @@ IF(OSG_USE_QT AND NOT ANDROID)
|
|||||||
|
|
||||||
IF (DESIRED_QT_VERSION)
|
IF (DESIRED_QT_VERSION)
|
||||||
IF (DESIRED_QT_VERSION MATCHES 5)
|
IF (DESIRED_QT_VERSION MATCHES 5)
|
||||||
FIND_PACKAGE(Qt5Widgets)
|
FIND_PACKAGE(Qt5Widgets)
|
||||||
ELSEIF (DESIRED_QT_VERSION MATCHES 4)
|
ELSEIF (DESIRED_QT_VERSION MATCHES 4)
|
||||||
FIND_PACKAGE(Qt4)
|
FIND_PACKAGE(Qt4)
|
||||||
ELSE()
|
ELSE()
|
||||||
FIND_PACKAGE(Qt3)
|
FIND_PACKAGE(Qt3)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ELSE()
|
ELSE()
|
||||||
@@ -590,7 +743,14 @@ IF(OSG_USE_QT AND NOT ANDROID)
|
|||||||
|
|
||||||
#If we have found Qt5, let's try to top off by getting the webkit as well
|
#If we have found Qt5, let's try to top off by getting the webkit as well
|
||||||
IF ( Qt5Widgets_FOUND )
|
IF ( Qt5Widgets_FOUND )
|
||||||
FIND_PACKAGE(Qt5WebKitWidgets)
|
FIND_PACKAGE(Qt5WebKitWidgets QUIET)
|
||||||
|
|
||||||
|
IF(COMMAND cmake_policy)
|
||||||
|
IF(${CMAKE_MAJOR_VERSION} GREATER 2)
|
||||||
|
# Qt5 qt5_use_modules usage was causing "Policy CMP0043 is not set: Ignore COMPILE_DEFINITIONS_<Config> properties." warnings
|
||||||
|
cmake_policy(SET CMP0043 NEW)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@@ -794,7 +954,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
# errors instead of warnings for certain issues, including superfluous
|
# errors instead of warnings for certain issues, including superfluous
|
||||||
# semicolons and commas, and the use of long long. -fpermissive seems
|
# semicolons and commas, and the use of long long. -fpermissive seems
|
||||||
# to be the workaround.
|
# 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)
|
SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused)
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
@@ -811,6 +971,36 @@ ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|||||||
# 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.
|
||||||
|
|
||||||
|
IF (APPLE)
|
||||||
|
SET(OSG_CXX_LANGUAGE_STANDARD "C++11" CACHE STRING "set the c++ language standard (C++98 / GNU++98 / C++11) for OSG" )
|
||||||
|
MARK_AS_ADVANCED(OSG_CXX_LANGUAGE_STANDARD)
|
||||||
|
# remove existing flags
|
||||||
|
REMOVE_CXX_FLAG(-std=c++98)
|
||||||
|
REMOVE_CXX_FLAG(-std=gnu++98)
|
||||||
|
REMOVE_CXX_FLAG(-std=c++11)
|
||||||
|
REMOVE_CXX_FLAG(-stdlib=libstdc++)
|
||||||
|
REMOVE_CXX_FLAG(-stdlib=libc++)
|
||||||
|
|
||||||
|
IF(${OSG_CXX_LANGUAGE_STANDARD} STREQUAL "c++98" OR ${OSG_CXX_LANGUAGE_STANDARD} STREQUAL "C++98")
|
||||||
|
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++")
|
||||||
|
ELSE()
|
||||||
|
IF(${OSG_CXX_LANGUAGE_STANDARD} STREQUAL "gnu++98" OR ${OSG_CXX_LANGUAGE_STANDARD} STREQUAL "GNU++98")
|
||||||
|
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++98")
|
||||||
|
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98 -stdlib=libstdc++")
|
||||||
|
ELSE()
|
||||||
|
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
|
||||||
|
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -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.
|
||||||
@@ -870,12 +1060,23 @@ IF(APPLE AND NOT ANDROID)
|
|||||||
|
|
||||||
#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)
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "armv6;armv7" CACHE STRING "Build architectures for iOS" FORCE)
|
IF(${IPHONE_VERSION_MIN} LESS "7.0")
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=4.1 -mno-thumb -arch armv6 -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
SET(CMAKE_OSX_ARCHITECTURES "armv6;armv7" CACHE STRING "Build architectures for iOS" FORCE)
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -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} -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=${IPHONE_VERSION_MIN}" FORCE)
|
||||||
|
|
||||||
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)
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-thumb -arch i386 -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-thumb -arch i386 -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
||||||
|
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mios-simulator-version-min=${IPHONE_VERSION_MIN}" FORCE)
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
#here we set the specific iphone sdk version. We can only set either device or simulator sdk. So if you want both you currently have to have two seperate projects
|
#here we set the specific iphone sdk version. We can only set either device or simulator sdk. So if you want both you currently have to have two seperate projects
|
||||||
@@ -903,7 +1104,7 @@ 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")
|
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10")
|
||||||
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
|
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
|
||||||
# 64 Bit Works, i386,ppc is not supported any more
|
# 64 Bit Works, i386,ppc is not supported any more
|
||||||
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" FORCE)
|
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" FORCE)
|
||||||
@@ -1140,10 +1341,4 @@ ADD_CUSTOM_TARGET(uninstall
|
|||||||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||||
|
|
||||||
#
|
#
|
||||||
IF(ANDROID)
|
|
||||||
message(STATUS "Creating Android Makefile Master files" )
|
|
||||||
configure_file("${OSG_ANDROID_TEMPLATES}/Android.mk.master.in" "${CMAKE_BINARY_DIR}/Android.mk")
|
|
||||||
configure_file("${OSG_ANDROID_TEMPLATES}/Application.mk.master.in" "${CMAKE_BINARY_DIR}/Application.mk")
|
|
||||||
configure_file("${OSG_ANDROID_TEMPLATES}/AndroidManifest.xml.master.in" "${CMAKE_BINARY_DIR}/AndroidManifest.xml")
|
|
||||||
ENDIF(ANDROID)
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Check for availability of atomic operations
|
# Check for availability of atomic operations
|
||||||
# This module defines
|
# This module defines
|
||||||
# OPENTHREADS_HAVE_ATOMIC_OPS
|
# OPENTHREADS_HAVE_ATOMIC_OPS
|
||||||
|
|
||||||
@@ -15,123 +15,143 @@ 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)
|
||||||
|
|
||||||
INCLUDE(CheckCXXSourceRuns)
|
SET(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC 1)
|
||||||
|
|
||||||
# Do step by step checking,
|
ELSE()
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
INCLUDE(CheckCXXSourceRuns)
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
int main()
|
# Do step by step checking,
|
||||||
{
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
unsigned value = 0;
|
#include <cstdlib>
|
||||||
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))
|
int main()
|
||||||
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;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
if (!__sync_bool_compare_and_swap(&ptr, ptr, ptr))
|
||||||
}
|
return EXIT_FAILURE;
|
||||||
" _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
|
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
return EXIT_SUCCESS;
|
||||||
#include <stdlib.h>
|
}
|
||||||
|
" _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
|
||||||
|
|
||||||
int main(int, const char**)
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
{
|
#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;
|
|
||||||
|
|
||||||
if (!__compare_and_swap((unsigned long*)&ptr, (unsigned long)ptr, (unsigned long)ptr))
|
int main(int, const char**)
|
||||||
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;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
if (!__compare_and_swap((unsigned long*)&ptr, (unsigned long)ptr, (unsigned long)ptr))
|
||||||
}
|
return EXIT_FAILURE;
|
||||||
" _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS)
|
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
return EXIT_SUCCESS;
|
||||||
#include <atomic.h>
|
}
|
||||||
#include <cstdlib>
|
" _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS)
|
||||||
|
|
||||||
int main(int, const char**)
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
{
|
#include <atomic.h>
|
||||||
uint_t value = 0;
|
#include <cstdlib>
|
||||||
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))
|
int main(int, const char**)
|
||||||
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;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
if (ptr != atomic_cas_ptr(&ptr, ptr, ptr))
|
||||||
}
|
return EXIT_FAILURE;
|
||||||
" _OPENTHREADS_ATOMIC_USE_SUN)
|
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
return EXIT_SUCCESS;
|
||||||
#include <windows.h>
|
}
|
||||||
#include <intrin.h>
|
" _OPENTHREADS_ATOMIC_USE_SUN)
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
#pragma intrinsic(_InterlockedAnd)
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
#pragma intrinsic(_InterlockedOr)
|
#include <windows.h>
|
||||||
#pragma intrinsic(_InterlockedXor)
|
#include <intrin.h>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
int main(int, const char**)
|
#pragma intrinsic(_InterlockedAnd)
|
||||||
{
|
#pragma intrinsic(_InterlockedOr)
|
||||||
volatile long value = 0;
|
#pragma intrinsic(_InterlockedXor)
|
||||||
long data = 0;
|
|
||||||
long* volatile ptr = &data;
|
|
||||||
|
|
||||||
InterlockedIncrement(&value);
|
int main(int, const char**)
|
||||||
MemoryBarrier();
|
{
|
||||||
InterlockedDecrement(&value);
|
volatile long value = 0;
|
||||||
|
long data = 0;
|
||||||
|
long* volatile ptr = &data;
|
||||||
|
|
||||||
if (0 != InterlockedCompareExchange(&value, 1, 0))
|
InterlockedIncrement(&value);
|
||||||
return EXIT_FAILURE;
|
MemoryBarrier();
|
||||||
|
InterlockedDecrement(&value);
|
||||||
|
|
||||||
if (ptr != InterlockedCompareExchangePointer((PVOID volatile*)&ptr, (PVOID)ptr, (PVOID)ptr))
|
if (0 != InterlockedCompareExchange(&value, 1, 0))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
if (ptr != InterlockedCompareExchangePointer((PVOID volatile*)&ptr, (PVOID)ptr, (PVOID)ptr))
|
||||||
}
|
return EXIT_FAILURE;
|
||||||
" _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
|
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
return EXIT_SUCCESS;
|
||||||
#include <libkern/OSAtomic.h>
|
}
|
||||||
|
" _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
|
||||||
|
|
||||||
int main()
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
{
|
#include <libkern/OSAtomic.h>
|
||||||
volatile int32_t value = 0;
|
|
||||||
long data = 0;
|
|
||||||
long * volatile ptr = &data;
|
|
||||||
|
|
||||||
OSAtomicIncrement32(&value);
|
int main()
|
||||||
OSMemoryBarrier();
|
{
|
||||||
OSAtomicDecrement32(&value);
|
volatile int32_t value = 0;
|
||||||
OSAtomicCompareAndSwapInt(value, 1, &value);
|
long data = 0;
|
||||||
OSAtomicCompareAndSwapPtr(ptr, ptr, (void * volatile *)&ptr);
|
long * volatile ptr = &data;
|
||||||
}
|
|
||||||
" _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
OSAtomicIncrement32(&value);
|
||||||
|
OSMemoryBarrier();
|
||||||
|
OSAtomicDecrement32(&value);
|
||||||
|
OSAtomicCompareAndSwapInt(value, 1, &value);
|
||||||
|
OSAtomicCompareAndSwapPtr(ptr, ptr, (void * volatile *)&ptr);
|
||||||
|
}
|
||||||
|
" _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
||||||
|
|
||||||
|
IF(NOT _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND
|
||||||
|
NOT _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS AND
|
||||||
|
NOT _OPENTHREADS_ATOMIC_USE_SUN AND
|
||||||
|
NOT _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED AND
|
||||||
|
NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
||||||
|
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
|
# 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()
|
||||||
|
|||||||
@@ -9,19 +9,19 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBU
|
|||||||
|
|
||||||
SET(MY_PATH_INCLUDE )
|
SET(MY_PATH_INCLUDE )
|
||||||
SET(MY_PATH_LIB )
|
SET(MY_PATH_LIB )
|
||||||
|
|
||||||
FOREACH( MYPATH ${SEARCHPATHLIST} )
|
FOREACH( MYPATH ${SEARCHPATHLIST} )
|
||||||
SET(MY_PATH_INCLUDE ${MY_PATH_INCLUDE} ${MYPATH}/include)
|
SET(MY_PATH_INCLUDE ${MY_PATH_INCLUDE} ${MYPATH}/include)
|
||||||
SET(MY_PATH_LIB ${MY_PATH_LIB} ${MYPATH}/lib)
|
SET(MY_PATH_LIB ${MY_PATH_LIB} ${MYPATH}/lib)
|
||||||
ENDFOREACH( MYPATH ${SEARCHPATHLIST} )
|
ENDFOREACH( MYPATH ${SEARCHPATHLIST} )
|
||||||
|
|
||||||
FIND_PATH("${DEPNAME}_INCLUDE_DIR" ${INCLUDEFILE}
|
FIND_PATH("${DEPNAME}_INCLUDE_DIR" ${INCLUDEFILE}
|
||||||
${MY_PATH_INCLUDE}
|
${MY_PATH_INCLUDE}
|
||||||
NO_DEFAULT_PATH
|
NO_DEFAULT_PATH
|
||||||
)
|
)
|
||||||
MARK_AS_ADVANCED("${DEPNAME}_INCLUDE_DIR")
|
MARK_AS_ADVANCED("${DEPNAME}_INCLUDE_DIR")
|
||||||
#MESSAGE( " ${DEPNAME}_INCLUDE_DIR --> ${${DEPNAME}_INCLUDE_DIR}<--")
|
#MESSAGE( " ${DEPNAME}_INCLUDE_DIR --> ${${DEPNAME}_INCLUDE_DIR}<--")
|
||||||
|
|
||||||
SET(LIBRARY_NAMES "")
|
SET(LIBRARY_NAMES "")
|
||||||
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
|
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
|
||||||
LIST(APPEND LIBRARY_NAMES "${LIBNAME}${EXSUFFIX}")
|
LIST(APPEND LIBRARY_NAMES "${LIBNAME}${EXSUFFIX}")
|
||||||
@@ -35,7 +35,7 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBU
|
|||||||
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
|
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
|
||||||
LIST(APPEND LIBRARY_NAMES_DEBUG "${LIBNAME}${DEBUGSUFFIX}${EXSUFFIX}")
|
LIST(APPEND LIBRARY_NAMES_DEBUG "${LIBNAME}${DEBUGSUFFIX}${EXSUFFIX}")
|
||||||
ENDFOREACH(LIBNAME)
|
ENDFOREACH(LIBNAME)
|
||||||
FIND_LIBRARY("${DEPNAME}_LIBRARY_DEBUG"
|
FIND_LIBRARY("${DEPNAME}_LIBRARY_DEBUG"
|
||||||
NAMES ${LIBRARY_NAMES_DEBUG}
|
NAMES ${LIBRARY_NAMES_DEBUG}
|
||||||
PATHS ${MY_PATH_LIB}
|
PATHS ${MY_PATH_LIB}
|
||||||
NO_DEFAULT_PATH
|
NO_DEFAULT_PATH
|
||||||
@@ -49,30 +49,36 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBU
|
|||||||
MESSAGE("-- Warning Debug ${DEPNAME} not found, using: ${${DEPNAME}_LIBRARY}")
|
MESSAGE("-- Warning Debug ${DEPNAME} not found, using: ${${DEPNAME}_LIBRARY}")
|
||||||
SET(${DEPNAME}_LIBRARY_DEBUG "${${DEPNAME}_LIBRARY}")
|
SET(${DEPNAME}_LIBRARY_DEBUG "${${DEPNAME}_LIBRARY}")
|
||||||
ENDIF(NOT ${DEPNAME}_LIBRARY_DEBUG)
|
ENDIF(NOT ${DEPNAME}_LIBRARY_DEBUG)
|
||||||
|
|
||||||
|
SET(${DEPNAME}_LIBRARIES debug ${${DEPNAME}_LIBRARY_DEBUG} optimized ${${DEPNAME}_LIBRARY} )
|
||||||
|
|
||||||
ENDIF(${DEPNAME}_INCLUDE_DIR AND ${DEPNAME}_LIBRARY)
|
ENDIF(${DEPNAME}_INCLUDE_DIR AND ${DEPNAME}_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX)
|
ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX)
|
||||||
|
|
||||||
|
|
||||||
################################################################################################
|
################################################################################################
|
||||||
# this Macro is tailored to Mike dependencies
|
# this Macro is tailored to Mike and Torbens 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;tiff" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype2311MT;freetype234;freetype234MT;freetype235;freetype237;freetype238;freetype244;freetype250;" ${OSG_3RDPARTY_BIN} "d" "")
|
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype2311MT;freetype234;freetype234MT;freetype235;freetype237;freetype238;freetype244;freetype250;freetype27;" ${OSG_3RDPARTY_BIN} "d" "")
|
||||||
IF(FREETYPE_FOUND)
|
IF(FREETYPE_FOUND)
|
||||||
#forcing subsequent FindFreeType stuff to not search for other variables.... kind of a hack
|
#forcing subsequent FindFreeType stuff to not search for other variables.... kind of a hack
|
||||||
SET(FREETYPE_INCLUDE_DIR_ft2build ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
|
SET(FREETYPE_INCLUDE_DIR_ft2build ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
|
||||||
SET(FREETYPE_INCLUDE_DIR_freetype2 ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
|
SET(FREETYPE_INCLUDE_DIR_freetype2 ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
|
||||||
MARK_AS_ADVANCED(FREETYPE_INCLUDE_DIR_ft2build FREETYPE_INCLUDE_DIR_freetype2)
|
MARK_AS_ADVANCED(FREETYPE_INCLUDE_DIR_ft2build FREETYPE_INCLUDE_DIR_freetype2)
|
||||||
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
|
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
|
||||||
ENDIF(FREETYPE_FOUND)
|
ENDIF(FREETYPE_FOUND)
|
||||||
FIND_DEPENDENCY(CURL curl/curl.h "libcurl;curllib" ${OSG_3RDPARTY_BIN} "D" "")
|
FIND_DEPENDENCY(CURL curl/curl.h "libcurl;curllib;libcurl_imp" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
FIND_DEPENDENCY(JPEG jpeglib.h "libjpeg;jpeg" ${OSG_3RDPARTY_BIN} "D" "")
|
FIND_DEPENDENCY(JPEG jpeglib.h "libjpeg;jpeg" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
FIND_DEPENDENCY(GDAL gdal.h "gdal;gdal16" ${OSG_3RDPARTY_BIN} "d" "_i")
|
FIND_DEPENDENCY(GDAL gdal.h "gdal;gdal16" ${OSG_3RDPARTY_BIN} "d" "_i")
|
||||||
FIND_DEPENDENCY(GLUT GL/glut.h glut32 ${OSG_3RDPARTY_BIN} "D" "")
|
FIND_DEPENDENCY(GLUT GL/glut.h glut32 ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
IF(GLUT_FOUND)
|
IF(GLUT_FOUND)
|
||||||
#forcing subsequent FindGlut stuff to not search for other variables.... kind of a hack
|
#forcing subsequent FindGlut stuff to not search for other variables.... kind of a hack
|
||||||
SET(GLUT_glut_LIBRARY ${GLUT_LIBRARY} CACHE FILEPATH "")
|
SET(GLUT_glut_LIBRARY ${GLUT_LIBRARY} CACHE FILEPATH "")
|
||||||
MARK_AS_ADVANCED(GLUT_glut_LIBRARY)
|
MARK_AS_ADVANCED(GLUT_glut_LIBRARY)
|
||||||
ENDIF(GLUT_FOUND)
|
ENDIF(GLUT_FOUND)
|
||||||
@@ -81,19 +87,21 @@ MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
|||||||
IF(ZLIB_FOUND)
|
IF(ZLIB_FOUND)
|
||||||
FIND_DEPENDENCY(PNG png.h "libpng;libpng13;libpng15;libpng16" ${OSG_3RDPARTY_BIN} "D" "")
|
FIND_DEPENDENCY(PNG png.h "libpng;libpng13;libpng15;libpng16" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
IF(PNG_FOUND)
|
IF(PNG_FOUND)
|
||||||
#forcing subsequent FindPNG stuff to not search for other variables.... kind of a hack
|
#forcing subsequent FindPNG stuff to not search for other variables.... kind of a hack
|
||||||
SET(PNG_PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE FILEPATH "")
|
SET(PNG_PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE FILEPATH "")
|
||||||
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR)
|
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR)
|
||||||
ENDIF(PNG_FOUND)
|
ENDIF(PNG_FOUND)
|
||||||
ENDIF(ZLIB_FOUND)
|
ENDIF(ZLIB_FOUND)
|
||||||
FIND_DEPENDENCY(LIBXML2 libxml "libxml2" ${OSG_3RDPARTY_BIN} "D" "")
|
|
||||||
|
# CMakes default module to find libxml2 will not find the in
|
||||||
|
FIND_DEPENDENCY(LIBXML2 libxml/xpath.h "libxml2" ${OSG_3RDPARTY_BIN} "D" "")
|
||||||
IF(LIBXML2_FOUND)
|
IF(LIBXML2_FOUND)
|
||||||
# The CMAKE find libxml module uses LIBXML2_LIBRARIES -> fill it.... kind of a hack
|
# The CMAKE find libxml module uses LIBXML2_LIBRARIES -> fill it.... kind of a hack
|
||||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY} CACHE FILEPATH "" FORCE)
|
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY} CACHE FILEPATH "LibXML2 library for collada" FORCE)
|
||||||
SET(LIBXML2_XMLLINT_EXECUTABLE ${OSG_3RDPARTY_BIN}/bin/xmllint.exe CACHE FILEPATH "Path to xmllint executable" FORCE)
|
# SET(LIBXML2_XMLLINT_EXECUTABLE ${OSG_3RDPARTY_BIN}/bin/xmllint.exe CACHE FILEPATH "Path to xmllint executable" FORCE)
|
||||||
ENDIF(LIBXML2_FOUND)
|
ENDIF(LIBXML2_FOUND)
|
||||||
#FIND_DEPENDENCY(DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX EXSUFFIX)
|
#FIND_DEPENDENCY(DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX EXSUFFIX)
|
||||||
FIND_Package(NVTT)
|
FIND_Package(NVTT)
|
||||||
#luigi#INCLUDE(FindOSGDepends.cmake)
|
#luigi#INCLUDE(FindOSGDepends.cmake)
|
||||||
ENDMACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
ENDMACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
||||||
|
|
||||||
@@ -104,7 +112,7 @@ ENDMACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
|
|||||||
# this is code for handling optional 3RDPARTY usage
|
# this is code for handling optional 3RDPARTY usage
|
||||||
################################################################################################
|
################################################################################################
|
||||||
|
|
||||||
OPTION(USE_3RDPARTY_BIN "Set to ON to use Mike prebuilt dependencies situated side of OpenSceneGraph source. Use OFF for avoiding." ON)
|
OPTION(USE_3RDPARTY_BIN "Set to ON to use Mike or Torbens prebuilt dependencies situated side of OpenSceneGraph source. Use OFF for avoiding." ON)
|
||||||
IF(USE_3RDPARTY_BIN)
|
IF(USE_3RDPARTY_BIN)
|
||||||
|
|
||||||
# Check Architecture
|
# Check Architecture
|
||||||
@@ -132,7 +140,7 @@ IF(USE_3RDPARTY_BIN)
|
|||||||
SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdParty_win32binaries_vs90sp1")
|
SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdParty_win32binaries_vs90sp1")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF(NOT EXISTS ${TEST_3RDPARTY_DIR})
|
ENDIF(NOT EXISTS ${TEST_3RDPARTY_DIR})
|
||||||
|
|
||||||
SET(ACTUAL_3RDPARTY_DIR "${TEST_3RDPARTY_DIR}" CACHE PATH "Location of 3rdparty dependencies")
|
SET(ACTUAL_3RDPARTY_DIR "${TEST_3RDPARTY_DIR}" CACHE PATH "Location of 3rdparty dependencies")
|
||||||
SET(ACTUAL_3DPARTY_DIR "${ACTUAL_3RDPARTY_DIR}") # kept for backcompatibility
|
SET(ACTUAL_3DPARTY_DIR "${ACTUAL_3RDPARTY_DIR}") # kept for backcompatibility
|
||||||
IF(EXISTS ${ACTUAL_3RDPARTY_DIR})
|
IF(EXISTS ${ACTUAL_3RDPARTY_DIR})
|
||||||
|
|||||||
@@ -1,22 +1,20 @@
|
|||||||
# Locate Apple AVFoundation (next-generation QTKit)
|
# Locate Apple AVFoundation (next-generation QTKit)
|
||||||
# This module defines
|
# This module defines
|
||||||
# AV_FOUNDATION_LIBRARY
|
# AV_FOUNDATION_LIBRARY
|
||||||
# AV_FOUNDATION_FOUND, if false, do not try to link to gdal
|
# AV_FOUNDATION_FOUND, if false, do not try to link to gdal
|
||||||
# AV_FOUNDATION_INCLUDE_DIR, where to find the headers
|
|
||||||
#
|
#
|
||||||
# $AV_FOUNDATION_DIR is an environment variable that would
|
# $AV_FOUNDATION_DIR is an environment variable that would
|
||||||
# correspond to the ./configure --prefix=$AV_FOUNDATION_DIR
|
# correspond to the ./configure --prefix=$AV_FOUNDATION_DIR
|
||||||
#
|
#
|
||||||
# Created by Stephan Maximilian Huber
|
# Created by Stephan Maximilian Huber
|
||||||
|
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
FIND_PATH(AV_FOUNDATION_INCLUDE_DIR AVFoundation/AVFoundation.h)
|
|
||||||
FIND_LIBRARY(AV_FOUNDATION_LIBRARY AVFoundation)
|
FIND_LIBRARY(AV_FOUNDATION_LIBRARY AVFoundation)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET(AV_FOUNDATION_FOUND "NO")
|
SET(AV_FOUNDATION_FOUND "NO")
|
||||||
IF(AV_FOUNDATION_LIBRARY AND AV_FOUNDATION_INCLUDE_DIR)
|
IF(AV_FOUNDATION_LIBRARY)
|
||||||
SET(AV_FOUNDATION_FOUND "YES")
|
SET(AV_FOUNDATION_FOUND "YES")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
@@ -32,11 +30,11 @@ ELSE()
|
|||||||
# AVFoundation exists since 10.7, but only 10.8 has all features necessary for OSG
|
# AVFoundation exists since 10.7, but only 10.8 has all features necessary for OSG
|
||||||
# so check the SDK-setting
|
# so check the SDK-setting
|
||||||
|
|
||||||
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8")
|
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.11")
|
||||||
# nothing special here ;-)
|
# nothing special here ;-)
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE("AVFoundation disabled for SDK < 10.8")
|
MESSAGE("AVFoundation disabled for SDK < 10.8")
|
||||||
SET(AV_FOUNDATION_FOUND "NO")
|
SET(AV_FOUNDATION_FOUND "NO")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|||||||
12
CMakeModules/FindAsio.cmake
Executable file → Normal file
12
CMakeModules/FindAsio.cmake
Executable file → Normal file
@@ -1,9 +1,9 @@
|
|||||||
# Locate ASIO-headers (http://think-async.com/Asio)
|
# Locate ASIO-headers (http://think-async.com/Asio)
|
||||||
# This module defines
|
# This module defines
|
||||||
# ASIO_FOUND, if false, do not try to link to gdal
|
# ASIO_FOUND, if false, do not try to link to gdal
|
||||||
# ASIO_INCLUDE_DIR, where to find the headers
|
# ASIO_INCLUDE_DIR, where to find the headers
|
||||||
#
|
#
|
||||||
# Created by Stephan Maximilian Huber
|
# Created by Stephan Maximilian Huber
|
||||||
|
|
||||||
FIND_PATH(ASIO_INCLUDE_DIR
|
FIND_PATH(ASIO_INCLUDE_DIR
|
||||||
NAMES
|
NAMES
|
||||||
@@ -14,7 +14,9 @@ FIND_PATH(ASIO_INCLUDE_DIR
|
|||||||
)
|
)
|
||||||
|
|
||||||
SET(ASIO_FOUND "NO")
|
SET(ASIO_FOUND "NO")
|
||||||
FIND_PACKAGE( Boost 1.37 )
|
IF(ASIO_INCLUDE_DIR)
|
||||||
IF(Boost_FOUND AND ASIO_INCLUDE_DIR)
|
FIND_PACKAGE( Boost 1.37 )
|
||||||
SET(ASIO_FOUND "YES")
|
IF(Boost_FOUND)
|
||||||
|
SET(ASIO_FOUND "YES")
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|||||||
@@ -11,16 +11,16 @@
|
|||||||
# $COLLADA_DIR is an environment variable that would
|
# $COLLADA_DIR is an environment variable that would
|
||||||
# correspond to the ./configure --prefix=$COLLADA_DIR
|
# correspond to the ./configure --prefix=$COLLADA_DIR
|
||||||
#
|
#
|
||||||
# Created by Robert Osfield.
|
# Created by Robert Osfield.
|
||||||
|
|
||||||
|
|
||||||
# Check if COLLADA_DIR is set, otherwise use ACTUAL_3DPARTY_DIR:
|
# Check if COLLADA_DIR is set, otherwise use ACTUAL_3DPARTY_DIR:
|
||||||
SET( COLLADA_ENV_VAR_AVAILABLE $ENV{COLLADA_DIR} )
|
SET( COLLADA_ENV_VAR_AVAILABLE $ENV{COLLADA_DIR} )
|
||||||
IF ( COLLADA_ENV_VAR_AVAILABLE )
|
IF ( COLLADA_ENV_VAR_AVAILABLE )
|
||||||
SET(COLLADA_DOM_ROOT "$ENV{COLLADA_DIR}/dom" CACHE PATH "Location of Collada DOM directory" FORCE)
|
SET(COLLADA_DOM_ROOT "$ENV{COLLADA_DIR}/dom" CACHE PATH "Location of Collada DOM directory" FORCE)
|
||||||
ELSE ( COLLADA_ENV_VAR_AVAILABLE )
|
ELSE ()
|
||||||
SET(COLLADA_DOM_ROOT "${ACTUAL_3DPARTY_DIR}/include/1.4/dom" CACHE PATH "Location of Collada DOM directory" FORCE)
|
SET(COLLADA_DOM_ROOT "${ACTUAL_3DPARTY_DIR}/include/1.4/dom" CACHE PATH "Location of Collada DOM directory" FORCE)
|
||||||
ENDIF( COLLADA_ENV_VAR_AVAILABLE )
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -28,6 +28,12 @@ IF(APPLE)
|
|||||||
SET(COLLADA_BUILDNAME "mac")
|
SET(COLLADA_BUILDNAME "mac")
|
||||||
ELSEIF(MINGW)
|
ELSEIF(MINGW)
|
||||||
SET(COLLADA_BUILDNAME "mingw")
|
SET(COLLADA_BUILDNAME "mingw")
|
||||||
|
ELSEIF(MSVC14)
|
||||||
|
SET(COLLADA_BUILDNAME "vc14")
|
||||||
|
ELSEIF(MSVC12)
|
||||||
|
SET(COLLADA_BUILDNAME "vc12")
|
||||||
|
ELSEIF(MSVC11)
|
||||||
|
SET(COLLADA_BUILDNAME "vc11")
|
||||||
ELSEIF(MSVC10)
|
ELSEIF(MSVC10)
|
||||||
SET(COLLADA_BUILDNAME "vc10")
|
SET(COLLADA_BUILDNAME "vc10")
|
||||||
ELSEIF(MSVC90)
|
ELSEIF(MSVC90)
|
||||||
@@ -49,10 +55,16 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
|
|||||||
/usr/local/include
|
/usr/local/include
|
||||||
/usr/local/include/colladadom
|
/usr/local/include/colladadom
|
||||||
/usr/local/include/collada-dom
|
/usr/local/include/collada-dom
|
||||||
|
/usr/local/include/collada-dom2.4
|
||||||
|
/usr/local/include/collada-dom2.2
|
||||||
/opt/local/include/collada-dom
|
/opt/local/include/collada-dom
|
||||||
|
/opt/local/include/collada-dom2.4
|
||||||
|
/opt/local/include/collada-dom2.2
|
||||||
/usr/include/
|
/usr/include/
|
||||||
/usr/include/colladadom
|
/usr/include/colladadom
|
||||||
/usr/include/collada-dom
|
/usr/include/collada-dom
|
||||||
|
/usr/include/collada-dom2.4
|
||||||
|
/usr/include/collada-dom2.2
|
||||||
/sw/include # Fink
|
/sw/include # Fink
|
||||||
/opt/local/include # DarwinPorts
|
/opt/local/include # DarwinPorts
|
||||||
/opt/csw/include # Blastwave
|
/opt/csw/include # Blastwave
|
||||||
@@ -61,16 +73,17 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
|
|||||||
${ACTUAL_3DPARTY_DIR}/include
|
${ACTUAL_3DPARTY_DIR}/include
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
|
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
|
||||||
NAMES collada_dom collada14dom Collada14Dom libcollada14dom21 libcollada14dom22
|
NAMES collada_dom collada14dom Collada14Dom libcollada14dom21 libcollada14dom22 collada-dom2.4-dp collada-dom2.4-dp-vc120-mt
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
|
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
|
||||||
|
${COLLADA_DOM_ROOT}
|
||||||
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4
|
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4
|
||||||
$ENV{COLLADA_DIR}/lib
|
$ENV{COLLADA_DIR}/lib
|
||||||
$ENV{COLLADA_DIR}/lib-dbg
|
$ENV{COLLADA_DIR}/lib-dbg
|
||||||
$ENV{COLLADA_DIR}
|
$ENV{COLLADA_DIR}
|
||||||
~/Library/Frameworks
|
~/Library/Frameworks
|
||||||
/Library/Frameworks
|
/Library/Frameworks
|
||||||
/opt/local/Library/Frameworks #macports
|
/opt/local/Library/Frameworks #macports
|
||||||
/usr/local/lib
|
/usr/local/lib
|
||||||
/usr/local/lib64
|
/usr/local/lib64
|
||||||
@@ -84,10 +97,11 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
|
|||||||
${ACTUAL_3DPARTY_DIR}/lib
|
${ACTUAL_3DPARTY_DIR}/lib
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
|
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
|
||||||
NAMES collada_dom-d collada14dom-d Collada14Dom-d libcollada14dom21-d libcollada14dom22-d
|
NAMES collada_dom-d collada14dom-d Collada14Dom-d libcollada14dom21-d libcollada14dom22-d collada-dom2.4-dp-d collada-dom2.4-dp-vc120-mt-d
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
|
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
|
||||||
|
${COLLADA_DOM_ROOT}
|
||||||
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4-d
|
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4-d
|
||||||
$ENV{COLLADA_DIR}/lib
|
$ENV{COLLADA_DIR}/lib
|
||||||
$ENV{COLLADA_DIR}/lib-dbg
|
$ENV{COLLADA_DIR}/lib-dbg
|
||||||
@@ -107,7 +121,7 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
|
|||||||
${ACTUAL_3DPARTY_DIR}/lib
|
${ACTUAL_3DPARTY_DIR}/lib
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_STATIC_LIBRARY
|
FIND_LIBRARY(COLLADA_STATIC_LIBRARY
|
||||||
NAMES libcollada14dom21-s libcollada14dom22-s libcollada14dom.a
|
NAMES libcollada14dom21-s libcollada14dom22-s libcollada14dom.a
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
|
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
|
||||||
@@ -130,7 +144,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY
|
|||||||
${ACTUAL_3DPARTY_DIR}/lib
|
${ACTUAL_3DPARTY_DIR}/lib
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
||||||
NAMES collada_dom-sd collada14dom-sd libcollada14dom21-sd libcollada14dom22-sd libcollada14dom-d.a
|
NAMES collada_dom-sd collada14dom-sd libcollada14dom21-sd libcollada14dom22-sd libcollada14dom-d.a
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
|
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
|
||||||
@@ -169,10 +183,19 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
)
|
)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
ENDIF(LIBXML2_FOUND)
|
ENDIF(LIBXML2_FOUND)
|
||||||
|
|
||||||
FIND_PACKAGE(ZLIB)
|
FIND_PACKAGE(ZLIB)
|
||||||
IF (ZLIB_FOUND)
|
IF (ZLIB_FOUND)
|
||||||
SET(COLLADA_ZLIB_LIBRARY "${ZLIB_LIBRARY}" CACHE FILEPATH "" FORCE)
|
IF (ZLIB_LIBRARY_RELEASE)
|
||||||
|
SET(COLLADA_ZLIB_LIBRARY "${ZLIB_LIBRARY_RELEASE}" CACHE FILEPATH "" FORCE)
|
||||||
|
ELSE(ZLIB_LIBRARY_RELEASE)
|
||||||
|
SET(COLLADA_ZLIB_LIBRARY "${ZLIB_LIBRARY}" CACHE FILEPATH "" FORCE)
|
||||||
|
ENDIF(ZLIB_LIBRARY_RELEASE)
|
||||||
|
IF (ZLIB_LIBRARY_DEBUG)
|
||||||
|
SET(COLLADA_ZLIB_LIBRARY_DEBUG "${ZLIB_LIBRARY_DEBUG}" CACHE FILEPATH "" FORCE)
|
||||||
|
ELSE(ZLIB_LIBRARY_DEBUG)
|
||||||
|
SET(COLLADA_ZLIB_LIBRARY_DEBUG "${COLLADA_ZLIB_LIBRARY}" CACHE FILEPATH "" FORCE)
|
||||||
|
ENDIF(ZLIB_LIBRARY_DEBUG)
|
||||||
ELSE(ZLIB_FOUND)
|
ELSE(ZLIB_FOUND)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
FIND_LIBRARY(COLLADA_ZLIB_LIBRARY
|
FIND_LIBRARY(COLLADA_ZLIB_LIBRARY
|
||||||
@@ -238,7 +261,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
|
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
|
||||||
NAMES libboost_filesystem boost_filesystem boost_filesystem-mt libboost_filesystem-vc90-mt libboost_filesystem-vc100-mt
|
NAMES libboost_filesystem boost_filesystem boost_filesystem-mt libboost_filesystem-${COLLADA_BUILDNAME}0-mt libboost_filesystem-${COLLADA_BUILDNAME}0-mt-1_54 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-1_55 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-1_58 boost_filesystem-${COLLADA_BUILDNAME}0-mt-1_62
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
||||||
@@ -246,7 +269,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
|
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
|
||||||
NAMES libboost_filesystem-d boost_filesystem-d boost_filesystem-mt-d libboost_filesystem-vc90-mt-gd libboost_filesystem-vc100-mt-gd
|
NAMES libboost_filesystem-d boost_filesystem-d boost_filesystem-mt-d libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_54 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_55 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_58 boost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_62
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
||||||
@@ -254,7 +277,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
|
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
|
||||||
NAMES libboost_system boost_system boost_system-mt libboost_system-vc90-mt libboost_system-vc100-mt
|
NAMES libboost_system boost_system boost_system-mt libboost_system-${COLLADA_BUILDNAME}0-mt libboost_system-${COLLADA_BUILDNAME}0-mt-1_54 libboost_system-${COLLADA_BUILDNAME}0-mt-1_55 libboost_system-${COLLADA_BUILDNAME}0-mt-1_58 boost_system-${COLLADA_BUILDNAME}0-mt-1_62
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
||||||
@@ -262,7 +285,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
|
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
|
||||||
NAMES libboost_system-d boost_system-d boost_system-mt-d libboost_system-vc90-mt-gd libboost_system-vc100-mt-gd
|
NAMES libboost_system-d boost_system-d boost_system-mt-d libboost_system-${COLLADA_BUILDNAME}0-mt-gd libboost_system-${COLLADA_BUILDNAME}0-mt-gd-1_54 libboost_system-${COLLADA_BUILDNAME}0-mt-gd-1_55 libboost_system-${COLLADA_BUILDNAME}0-mt-gd-1_58 boost_system-${COLLADA_BUILDNAME}0-mt-gd-1_62
|
||||||
PATHS
|
PATHS
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
|
||||||
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
|
||||||
@@ -273,6 +296,20 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
|
|||||||
SET(COLLADA_FOUND "NO")
|
SET(COLLADA_FOUND "NO")
|
||||||
IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
|
IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
|
||||||
IF (COLLADA_INCLUDE_DIR)
|
IF (COLLADA_INCLUDE_DIR)
|
||||||
|
|
||||||
SET(COLLADA_FOUND "YES")
|
SET(COLLADA_FOUND "YES")
|
||||||
ENDIF(COLLADA_INCLUDE_DIR)
|
|
||||||
ENDIF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
|
FIND_PATH(COLLADA_INCLUDE_DOMANY_DIR 1.4/dom/domAny.h
|
||||||
|
${COLLADA_INCLUDE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
IF (COLLADA_INCLUDE_DOMANY_DIR)
|
||||||
|
SET(COLLADA_DOM_2_4_OR_LATER TRUE)
|
||||||
|
ELSEIF()
|
||||||
|
SET(COLLADA_DOM_2_4_OR_LATER FALSE)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ ELSEIF(MSVC90)
|
|||||||
SET(FBX_LIBDIR "vs2008")
|
SET(FBX_LIBDIR "vs2008")
|
||||||
ELSEIF(MSVC10)
|
ELSEIF(MSVC10)
|
||||||
SET(FBX_LIBDIR "vs2010")
|
SET(FBX_LIBDIR "vs2010")
|
||||||
ELSEIF(MSVC11 OR MSVC_VERSION>1700)
|
ELSEIF(MSVC11)
|
||||||
SET(FBX_LIBDIR "vs2012")
|
SET(FBX_LIBDIR "vs2012")
|
||||||
|
ELSEIF(MSVC12 OR MSVC_VERSION>1800)
|
||||||
|
SET(FBX_LIBDIR "vs2013")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
@@ -32,6 +34,8 @@ 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 "libfbxsdk")
|
||||||
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
|
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
@@ -44,9 +48,14 @@ 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/2014.1"
|
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2015.1"
|
||||||
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.1"
|
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2015.1"
|
||||||
/Applications/Autodesk/FBXSDK20141
|
"/Applications/Autodesk/FBX/FBX SDK/2015.1"
|
||||||
|
/Applications/Autodesk/FBXSDK20151
|
||||||
|
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.2"
|
||||||
|
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.2"
|
||||||
|
"/Applications/Autodesk/FBX/FBX SDK/2014.2"
|
||||||
|
/Applications/Autodesk/FBXSDK20142
|
||||||
)
|
)
|
||||||
|
|
||||||
# search for headers & debug/release libraries
|
# search for headers & debug/release libraries
|
||||||
@@ -74,21 +83,22 @@ ELSE()
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT FBX_FOUND)
|
IF(NOT FBX_FOUND)
|
||||||
#try to use 2013.3 version
|
#try to use 2014.1 version
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
SET(FBX_LIBNAME "fbxsdk-2013.3-static")
|
SET(FBX_LIBNAME "fbxsdk-2014.1")
|
||||||
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
|
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
SET(FBX_LIBNAME "fbxsdk-2013.3-static")
|
SET(FBX_LIBNAME "fbxsdk-2014.1")
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(FBX_LIBNAME "fbxsdk-2013.3-md")
|
SET(FBX_LIBNAME "fbxsdk-2014.1")
|
||||||
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/2013.3
|
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.1"
|
||||||
$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2013.3
|
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.1"
|
||||||
|
"/Applications/Autodesk/FBX/FBX SDK/2014.1"
|
||||||
/Applications/Autodesk/FBXSDK20141
|
/Applications/Autodesk/FBXSDK20141
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -110,3 +120,42 @@ IF(NOT FBX_FOUND)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
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/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()
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
#In OSG ffmpeg plugin, we used "#include <header.h>" for compatibility with old version of ffmpeg
|
#In OSG ffmpeg plugin, we used "#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.
|
#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 (useful 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 (useful for new version)
|
||||||
|
|
||||||
#Then we need to include ${FFMPEG_libname_INCLUDE_DIRS} (in old version case, use by ffmpeg header and osg plugin code)
|
#Then we need to include ${FFMPEG_libname_INCLUDE_DIRS} (in old version case, use by ffmpeg header and osg plugin code)
|
||||||
# (in new version case, use by ffmpeg header)
|
# (in new version case, use by ffmpeg header)
|
||||||
@@ -32,6 +32,8 @@ MACRO(FFMPEG_FIND varname shortname headername)
|
|||||||
PATHS
|
PATHS
|
||||||
${FFMPEG_ROOT}/include
|
${FFMPEG_ROOT}/include
|
||||||
$ENV{FFMPEG_DIR}/include
|
$ENV{FFMPEG_DIR}/include
|
||||||
|
${FFMPEG_ROOT}
|
||||||
|
$ENV{FFMPEG_DIR}
|
||||||
~/Library/Frameworks
|
~/Library/Frameworks
|
||||||
/Library/Frameworks
|
/Library/Frameworks
|
||||||
/usr/local/include
|
/usr/local/include
|
||||||
@@ -49,6 +51,8 @@ MACRO(FFMPEG_FIND varname shortname headername)
|
|||||||
PATHS
|
PATHS
|
||||||
${FFMPEG_ROOT}/include
|
${FFMPEG_ROOT}/include
|
||||||
$ENV{FFMPEG_DIR}/include
|
$ENV{FFMPEG_DIR}/include
|
||||||
|
${FFMPEG_ROOT}
|
||||||
|
$ENV{FFMPEG_DIR}
|
||||||
~/Library/Frameworks
|
~/Library/Frameworks
|
||||||
/Library/Frameworks
|
/Library/Frameworks
|
||||||
/usr/local/include
|
/usr/local/include
|
||||||
@@ -67,6 +71,8 @@ MACRO(FFMPEG_FIND varname shortname headername)
|
|||||||
PATHS
|
PATHS
|
||||||
${FFMPEG_ROOT}/lib
|
${FFMPEG_ROOT}/lib
|
||||||
$ENV{FFMPEG_DIR}/lib
|
$ENV{FFMPEG_DIR}/lib
|
||||||
|
${FFMPEG_ROOT}/lib${shortname}
|
||||||
|
$ENV{FFMPEG_DIR}/lib${shortname}
|
||||||
~/Library/Frameworks
|
~/Library/Frameworks
|
||||||
/Library/Frameworks
|
/Library/Frameworks
|
||||||
/usr/local/lib
|
/usr/local/lib
|
||||||
@@ -123,11 +129,14 @@ FFMPEG_FIND(LIBAVFORMAT avformat avformat.h)
|
|||||||
FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h)
|
FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h)
|
||||||
FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h)
|
FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h)
|
||||||
FFMPEG_FIND(LIBAVUTIL avutil avutil.h)
|
FFMPEG_FIND(LIBAVUTIL avutil avutil.h)
|
||||||
|
FFMPEG_FIND(LIBSWRESAMPLE swresample swresample.h)
|
||||||
|
FFMPEG_FIND(LIBAVRESAMPLE avresample avresample.h)
|
||||||
FFMPEG_FIND(LIBSWSCALE swscale swscale.h) # not sure about the header to look for here.
|
FFMPEG_FIND(LIBSWSCALE swscale swscale.h) # not sure about the header to look for here.
|
||||||
|
|
||||||
SET(FFMPEG_FOUND "NO")
|
SET(FFMPEG_FOUND "NO")
|
||||||
# Note we don't check FFMPEG_LIBSWSCALE_FOUND here, it's optional.
|
# Note we don't check FFMPEG_LIBSWSCALE_FOUND here, it's optional.
|
||||||
IF (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND AND STDINT_OK)
|
IF (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND AND STDINT_OK
|
||||||
|
AND ( FFMPEG_LIBSWRESAMPLE_FOUND OR FFMPEG_LIBAVRESAMPLE_FOUND ) )
|
||||||
|
|
||||||
SET(FFMPEG_FOUND "YES")
|
SET(FFMPEG_FOUND "YES")
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,15 @@
|
|||||||
#
|
#
|
||||||
# Created by Robert Osfield.
|
# Created by Robert Osfield.
|
||||||
|
|
||||||
|
# prefer FindFLTK from cmake distribution
|
||||||
|
if(EXISTS ${CMAKE_ROOT}/Modules/FindFLTK.cmake)
|
||||||
|
include(${CMAKE_ROOT}/Modules/FindFLTK.cmake)
|
||||||
|
|
||||||
|
if(FLTK_FOUND)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
FIND_PATH(FLTK_INCLUDE_DIR Fl/Fl.H Fl/Fl.h
|
FIND_PATH(FLTK_INCLUDE_DIR Fl/Fl.H Fl/Fl.h
|
||||||
$ENV{FLTK_DIR}/include
|
$ENV{FLTK_DIR}/include
|
||||||
$ENV{FLTK_DIR}
|
$ENV{FLTK_DIR}
|
||||||
|
|||||||
@@ -1,117 +0,0 @@
|
|||||||
# - Locate FreeType library
|
|
||||||
# This module defines
|
|
||||||
# FREETYPE_LIBRARY, the library to link against
|
|
||||||
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
|
|
||||||
# FREETYPE_INCLUDE_DIRS, where to find headers.
|
|
||||||
# This is the concatenation of the paths:
|
|
||||||
# FREETYPE_INCLUDE_DIR_ft2build
|
|
||||||
# FREETYPE_INCLUDE_DIR_freetype2
|
|
||||||
#
|
|
||||||
# $FREETYPE_DIR is an environment variable that would
|
|
||||||
# correspond to the ./configure --prefix=$FREETYPE_DIR
|
|
||||||
# used in building FREETYPE.
|
|
||||||
# Created by Eric Wing.
|
|
||||||
|
|
||||||
# Ugh, FreeType seems to use some #include trickery which
|
|
||||||
# makes this harder than it should be. It looks like they
|
|
||||||
# put ft2build.h in a common/easier-to-find location which
|
|
||||||
# then contains a #include to a more specific header in a
|
|
||||||
# more specific location (#include <freetype/config/ftheader.h>).
|
|
||||||
# Then from there, they need to set a bunch of #define's
|
|
||||||
# so you can do something like:
|
|
||||||
# #include FT_FREETYPE_H
|
|
||||||
# Unfortunately, using CMake's mechanisms like INCLUDE_DIRECTORIES()
|
|
||||||
# wants explicit full paths and this trickery doesn't work too well.
|
|
||||||
# I'm going to attempt to cut out the middleman and hope
|
|
||||||
# everything still works.
|
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
|
|
||||||
PATHS
|
|
||||||
$ENV{FREETYPE_DIR}
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
PATH_SUFFIXES include
|
|
||||||
)
|
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
|
|
||||||
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
PATH_SUFFIXES include
|
|
||||||
)
|
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
|
|
||||||
PATHS
|
|
||||||
/usr/local
|
|
||||||
/usr
|
|
||||||
/usr/local/X11R6
|
|
||||||
/usr/local/X11
|
|
||||||
/usr/X11R6
|
|
||||||
/usr/X11
|
|
||||||
/sw
|
|
||||||
/opt/local
|
|
||||||
/opt/csw
|
|
||||||
/opt
|
|
||||||
/usr/freeware
|
|
||||||
PATH_SUFFIXES include
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
|
|
||||||
$ENV{FREETYPE_DIR}/include/freetype2
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
)
|
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
|
|
||||||
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
PATH_SUFFIXES include/freetype2
|
|
||||||
)
|
|
||||||
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
|
|
||||||
/usr/local/include/freetype2
|
|
||||||
/usr/include/freetype2
|
|
||||||
/usr/local/X11R6/include/freetype2
|
|
||||||
/usr/local/X11/include/freetype2
|
|
||||||
/usr/X11R6/include/freetype2
|
|
||||||
/usr/X11/include/freetype2
|
|
||||||
/sw/include/freetype2
|
|
||||||
/opt/local/include/freetype2
|
|
||||||
/opt/csw/include/freetype2
|
|
||||||
/opt/include/freetype2
|
|
||||||
/usr/freeware/include/freetype2
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY(FREETYPE_LIBRARY
|
|
||||||
NAMES freetype libfreetype freetype219
|
|
||||||
PATHS
|
|
||||||
$ENV{FREETYPE_DIR}
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
PATH_SUFFIXES lib64 lib
|
|
||||||
)
|
|
||||||
FIND_LIBRARY(FREETYPE_LIBRARY
|
|
||||||
NAMES freetype libfreetype freetype219
|
|
||||||
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
PATH_SUFFIXES lib64 lib
|
|
||||||
)
|
|
||||||
FIND_LIBRARY(FREETYPE_LIBRARY
|
|
||||||
NAMES freetype libfreetype freetype219
|
|
||||||
PATHS
|
|
||||||
/usr/local
|
|
||||||
/usr
|
|
||||||
/usr/local/X11R6
|
|
||||||
/usr/local/X11
|
|
||||||
/usr/X11R6
|
|
||||||
/usr/X11
|
|
||||||
/sw
|
|
||||||
/opt/local
|
|
||||||
/opt/csw
|
|
||||||
/opt
|
|
||||||
/usr/freeware
|
|
||||||
PATH_SUFFIXES lib64 lib
|
|
||||||
)
|
|
||||||
|
|
||||||
IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
|
|
||||||
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
|
|
||||||
ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
|
|
||||||
|
|
||||||
|
|
||||||
SET(FREETYPE_FOUND "NO")
|
|
||||||
IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
|
|
||||||
SET(FREETYPE_FOUND "YES")
|
|
||||||
ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
|
|
||||||
|
|
||||||
|
|
||||||
188
CMakeModules/FindFreetype.cmake
Normal file
188
CMakeModules/FindFreetype.cmake
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
#.rst:
|
||||||
|
# FindFreetype
|
||||||
|
# ------------
|
||||||
|
#
|
||||||
|
# Locate FreeType library
|
||||||
|
#
|
||||||
|
# This module defines
|
||||||
|
#
|
||||||
|
# ::
|
||||||
|
#
|
||||||
|
# FREETYPE_LIBRARIES, the library to link against
|
||||||
|
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
|
||||||
|
# FREETYPE_INCLUDE_DIRS, where to find headers.
|
||||||
|
# FREETYPE_VERSION_STRING, the version of freetype found (since CMake 2.8.8)
|
||||||
|
# This is the concatenation of the paths:
|
||||||
|
# FREETYPE_INCLUDE_DIR_ft2build
|
||||||
|
# FREETYPE_INCLUDE_DIR_freetype2
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# $FREETYPE_DIR is an environment variable that would correspond to the
|
||||||
|
# ./configure --prefix=$FREETYPE_DIR used in building FREETYPE.
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2000-2016 Kitware, Inc.
|
||||||
|
# Copyright 2000-2011 Insight Software Consortium
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# * Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
|
||||||
|
# nor the names of their contributors may be used to endorse or promote
|
||||||
|
# products derived from this software without specific prior written
|
||||||
|
# permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#=============================================================================
|
||||||
|
|
||||||
|
# Created by Eric Wing.
|
||||||
|
# Modifications by Alexander Neundorf.
|
||||||
|
# This file has been renamed to "FindFreetype.cmake" instead of the correct
|
||||||
|
# "FindFreeType.cmake" in order to be compatible with the one from KDE4, Alex.
|
||||||
|
|
||||||
|
# Ugh, FreeType seems to use some #include trickery which
|
||||||
|
# makes this harder than it should be. It looks like they
|
||||||
|
# put ft2build.h in a common/easier-to-find location which
|
||||||
|
# then contains a #include to a more specific header in a
|
||||||
|
# more specific location (#include <freetype/config/ftheader.h>).
|
||||||
|
# Then from there, they need to set a bunch of #define's
|
||||||
|
# so you can do something like:
|
||||||
|
# #include FT_FREETYPE_H
|
||||||
|
# Unfortunately, using CMake's mechanisms like include_directories()
|
||||||
|
# wants explicit full paths and this trickery doesn't work too well.
|
||||||
|
# I'm going to attempt to cut out the middleman and hope
|
||||||
|
# everything still works.
|
||||||
|
|
||||||
|
# Adapted for OpenSceneGraph until the updates here for finding the debug Windows library freetyped are released with CMake
|
||||||
|
|
||||||
|
set(FREETYPE_FIND_ARGS
|
||||||
|
HINTS
|
||||||
|
ENV FREETYPE_DIR
|
||||||
|
PATHS
|
||||||
|
/usr/X11R6
|
||||||
|
/usr/local/X11R6
|
||||||
|
/usr/local/X11
|
||||||
|
/usr/freeware
|
||||||
|
ENV GTKMM_BASEPATH
|
||||||
|
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
|
||||||
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
|
||||||
|
)
|
||||||
|
|
||||||
|
find_path(
|
||||||
|
FREETYPE_INCLUDE_DIR_ft2build
|
||||||
|
ft2build.h
|
||||||
|
${FREETYPE_FIND_ARGS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include/freetype2
|
||||||
|
include
|
||||||
|
freetype2
|
||||||
|
)
|
||||||
|
|
||||||
|
find_path(
|
||||||
|
FREETYPE_INCLUDE_DIR_freetype2
|
||||||
|
NAMES
|
||||||
|
freetype/config/ftheader.h
|
||||||
|
config/ftheader.h
|
||||||
|
${FREETYPE_FIND_ARGS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include/freetype2
|
||||||
|
include
|
||||||
|
freetype2
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT FREETYPE_LIBRARY)
|
||||||
|
find_library(FREETYPE_LIBRARY_RELEASE
|
||||||
|
NAMES
|
||||||
|
freetype
|
||||||
|
libfreetype
|
||||||
|
freetype219
|
||||||
|
${FREETYPE_FIND_ARGS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
)
|
||||||
|
find_library(FREETYPE_LIBRARY_DEBUG
|
||||||
|
NAMES
|
||||||
|
freetyped
|
||||||
|
libfreetyped
|
||||||
|
freetype219d
|
||||||
|
${FREETYPE_FIND_ARGS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
)
|
||||||
|
include(SelectLibraryConfigurations) #OSG Look in CMake Modules dir
|
||||||
|
select_library_configurations(FREETYPE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
unset(FREETYPE_FIND_ARGS)
|
||||||
|
|
||||||
|
# set the user variables
|
||||||
|
if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
|
||||||
|
set(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
|
||||||
|
list(REMOVE_DUPLICATES FREETYPE_INCLUDE_DIRS)
|
||||||
|
endif()
|
||||||
|
set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
|
||||||
|
|
||||||
|
if(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
|
||||||
|
set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
|
||||||
|
elseif(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
|
||||||
|
set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
|
||||||
|
file(STRINGS "${FREETYPE_H}" freetype_version_str
|
||||||
|
REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
|
||||||
|
|
||||||
|
unset(FREETYPE_VERSION_STRING)
|
||||||
|
foreach(VPART MAJOR MINOR PATCH)
|
||||||
|
foreach(VLINE ${freetype_version_str})
|
||||||
|
if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$")
|
||||||
|
set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}")
|
||||||
|
if(FREETYPE_VERSION_STRING)
|
||||||
|
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
|
||||||
|
else()
|
||||||
|
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
|
||||||
|
endif()
|
||||||
|
unset(FREETYPE_VERSION_PART)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
|
||||||
|
# all listed variables are TRUE
|
||||||
|
include(FindPackageHandleStandardArgs) #OSG Look in CMake Modules dir
|
||||||
|
|
||||||
|
find_package_handle_standard_args(
|
||||||
|
Freetype
|
||||||
|
REQUIRED_VARS
|
||||||
|
FREETYPE_LIBRARY
|
||||||
|
FREETYPE_INCLUDE_DIRS
|
||||||
|
VERSION_VAR
|
||||||
|
FREETYPE_VERSION_STRING
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
FREETYPE_INCLUDE_DIR_freetype2
|
||||||
|
FREETYPE_INCLUDE_DIR_ft2build
|
||||||
|
)
|
||||||
@@ -19,6 +19,15 @@
|
|||||||
# This makes the presumption that you are include gdal.h like
|
# This makes the presumption that you are include gdal.h like
|
||||||
# #include "gdal.h"
|
# #include "gdal.h"
|
||||||
|
|
||||||
|
# prefer FindGDAL from cmake distribution
|
||||||
|
if(EXISTS ${CMAKE_ROOT}/Modules/FindGDAL.cmake)
|
||||||
|
include(${CMAKE_ROOT}/Modules/FindGDAL.cmake)
|
||||||
|
|
||||||
|
if(GDAL_FOUND)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
FIND_PATH(GDAL_INCLUDE_DIR gdal.h
|
FIND_PATH(GDAL_INCLUDE_DIR gdal.h
|
||||||
PATHS
|
PATHS
|
||||||
$ENV{GDAL_DIR}
|
$ENV{GDAL_DIR}
|
||||||
|
|||||||
36
CMakeModules/FindGLCORE.cmake
Normal file
36
CMakeModules/FindGLCORE.cmake
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# Finds the OpenGL Core Profile (cp) header file.
|
||||||
|
# Looks for glcorearb.h
|
||||||
|
#
|
||||||
|
# This script defines the following:
|
||||||
|
# GLCORE_FOUND // Set to TRUE if glcorearb.h is found
|
||||||
|
# GLCORE_INCLUDE_DIR // Parent directory of directory (gl, GL3, or OpenGL) containing the CP header.
|
||||||
|
# GLCORE_GLCOREARB_HEADER // advanced
|
||||||
|
#
|
||||||
|
# GLCORE_ROOT can be set as an environment variable or a CMake variable,
|
||||||
|
# to the parent directory of the gl, GL3, or OpenGL directory containing the CP header.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
FIND_PATH( GLCORE_GLCOREARB_HEADER
|
||||||
|
NAMES GL/glcorearb.h GL3/glcorearb.h OpenGL/glcorearb.h gl/glcorearb.h
|
||||||
|
HINTS ${GLCORE_ROOT}
|
||||||
|
PATHS ENV GLCORE_ROOT
|
||||||
|
)
|
||||||
|
|
||||||
|
set( GLCORE_INCLUDE_DIR )
|
||||||
|
if( GLCORE_GLCOREARB_HEADER )
|
||||||
|
set( GLCORE_INCLUDE_DIR ${GLCORE_GLCOREARB_HEADER} )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set
|
||||||
|
# GLCORE_FOUND to TRUE as appropriate
|
||||||
|
INCLUDE( FindPackageHandleStandardArgs )
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS( GLCORE
|
||||||
|
"Set GLCORE_ROOT as the parent of the directory containing the OpenGL core profile header."
|
||||||
|
GLCORE_INCLUDE_DIR )
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(
|
||||||
|
GLCORE_INCLUDE_DIR
|
||||||
|
GLCORE_GLCOREARB_HEADER
|
||||||
|
)
|
||||||
142
CMakeModules/FindGLIB.cmake
Normal file
142
CMakeModules/FindGLIB.cmake
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
# - Try to find Glib and its components (gio, gobject etc)
|
||||||
|
# Once done, this will define
|
||||||
|
#
|
||||||
|
# GLIB_FOUND - system has Glib
|
||||||
|
# GLIB_INCLUDE_DIRS - the Glib include directories
|
||||||
|
# GLIB_LIBRARIES - link these to use Glib
|
||||||
|
#
|
||||||
|
# Optionally, the COMPONENTS keyword can be passed to find_package()
|
||||||
|
# and Glib components can be looked for. Currently, the following
|
||||||
|
# components can be used, and they define the following variables if
|
||||||
|
# found:
|
||||||
|
#
|
||||||
|
# gio: GLIB_GIO_LIBRARIES
|
||||||
|
# gobject: GLIB_GOBJECT_LIBRARIES
|
||||||
|
# gmodule: GLIB_GMODULE_LIBRARIES
|
||||||
|
# gthread: GLIB_GTHREAD_LIBRARIES
|
||||||
|
#
|
||||||
|
# Note that the respective _INCLUDE_DIR variables are not set, since
|
||||||
|
# all headers are in the same directory as GLIB_INCLUDE_DIRS.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
|
||||||
|
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
find_library(GLIB_LIBRARIES
|
||||||
|
NAMES glib-2.0
|
||||||
|
PATHS C:/gstreamer/1.0/x86_64/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
else ()
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(PC_GLIB QUIET glib-2.0)
|
||||||
|
|
||||||
|
find_library(GLIB_LIBRARIES
|
||||||
|
NAMES glib-2.0
|
||||||
|
HINTS ${PC_GLIB_LIBDIR}
|
||||||
|
${PC_GLIB_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Files in glib's main include path may include glibconfig.h, which,
|
||||||
|
# for some odd reason, is normally in $LIBDIR/glib-2.0/include.
|
||||||
|
get_filename_component(_GLIB_LIBRARY_DIR ${GLIB_LIBRARIES} PATH)
|
||||||
|
|
||||||
|
find_path(GLIBCONFIG_INCLUDE_DIR
|
||||||
|
NAMES glibconfig.h
|
||||||
|
HINTS ${PC_LIBDIR} ${PC_LIBRARY_DIRS} ${_GLIB_LIBRARY_DIR}
|
||||||
|
PATH_SUFFIXES glib-2.0/include
|
||||||
|
)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
find_path(GLIB_INCLUDE_DIR
|
||||||
|
NAMES glib.h
|
||||||
|
PATHS C:/gstreamer/1.0/x86_64/include
|
||||||
|
PATH_SUFFIXES glib-2.0
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
find_path(GLIB_INCLUDE_DIR
|
||||||
|
NAMES glib.h
|
||||||
|
HINTS ${PC_GLIB_INCLUDEDIR}
|
||||||
|
${PC_GLIB_INCLUDE_DIRS}
|
||||||
|
PATH_SUFFIXES glib-2.0
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GLIBCONFIG_INCLUDE_DIR)
|
||||||
|
|
||||||
|
set(GLIB_INCLUDE_DIRS ${GLIB_INCLUDE_DIR} ${GLIBCONFIG_INCLUDE_DIR})
|
||||||
|
|
||||||
|
# Version detection
|
||||||
|
file(READ "${GLIBCONFIG_INCLUDE_DIR}/glibconfig.h" GLIBCONFIG_H_CONTENTS)
|
||||||
|
string(REGEX MATCH "#define GLIB_MAJOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}")
|
||||||
|
set(GLIB_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||||
|
string(REGEX MATCH "#define GLIB_MINOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}")
|
||||||
|
set(GLIB_VERSION_MINOR "${CMAKE_MATCH_1}")
|
||||||
|
string(REGEX MATCH "#define GLIB_MICRO_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}")
|
||||||
|
set(GLIB_VERSION_MICRO "${CMAKE_MATCH_1}")
|
||||||
|
set(GLIB_VERSION "${GLIB_VERSION_MAJOR}.${GLIB_VERSION_MINOR}.${GLIB_VERSION_MICRO}")
|
||||||
|
|
||||||
|
# Additional Glib components. We only look for libraries, as not all of them
|
||||||
|
# have corresponding headers and all headers are installed alongside the main
|
||||||
|
# glib ones.
|
||||||
|
foreach (_component ${GLIB_FIND_COMPONENTS})
|
||||||
|
if (${_component} STREQUAL "gio")
|
||||||
|
find_library(GLIB_GIO_LIBRARIES NAMES gio-2.0 HINTS ${_GLIB_LIBRARY_DIR})
|
||||||
|
set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GIO_LIBRARIES)
|
||||||
|
elseif (${_component} STREQUAL "gobject")
|
||||||
|
find_library(GLIB_GOBJECT_LIBRARIES NAMES gobject-2.0 HINTS ${_GLIB_LIBRARY_DIR})
|
||||||
|
set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GOBJECT_LIBRARIES)
|
||||||
|
elseif (${_component} STREQUAL "gmodule")
|
||||||
|
find_library(GLIB_GMODULE_LIBRARIES NAMES gmodule-2.0 HINTS ${_GLIB_LIBRARY_DIR})
|
||||||
|
set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GMODULE_LIBRARIES)
|
||||||
|
elseif (${_component} STREQUAL "gthread")
|
||||||
|
find_library(GLIB_GTHREAD_LIBRARIES NAMES gthread-2.0 HINTS ${_GLIB_LIBRARY_DIR})
|
||||||
|
set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GTHREAD_LIBRARIES)
|
||||||
|
elseif (${_component} STREQUAL "gio-unix")
|
||||||
|
# gio-unix is compiled as part of the gio library, but the include paths
|
||||||
|
# are separate from the shared glib ones. Since this is currently only used
|
||||||
|
# by WebKitGTK+ we don't go to extraordinary measures beyond pkg-config.
|
||||||
|
pkg_check_modules(GIO_UNIX QUIET gio-unix-2.0)
|
||||||
|
endif ()
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLIB REQUIRED_VARS GLIB_INCLUDE_DIRS GLIB_LIBRARIES ${ADDITIONAL_REQUIRED_VARS}
|
||||||
|
VERSION_VAR GLIB_VERSION)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
GLIBCONFIG_INCLUDE_DIR
|
||||||
|
GLIB_GIO_LIBRARIES
|
||||||
|
GLIB_GIO_UNIX_LIBRARIES
|
||||||
|
GLIB_GMODULE_LIBRARIES
|
||||||
|
GLIB_GOBJECT_LIBRARIES
|
||||||
|
GLIB_GTHREAD_LIBRARIES
|
||||||
|
GLIB_INCLUDE_DIR
|
||||||
|
GLIB_INCLUDE_DIRS
|
||||||
|
GLIB_LIBRARIES
|
||||||
|
)
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
endif ()
|
||||||
174
CMakeModules/FindGStreamer.cmake
Normal file
174
CMakeModules/FindGStreamer.cmake
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
# - Try to find GStreamer and its plugins
|
||||||
|
# Once done, this will define
|
||||||
|
#
|
||||||
|
# GSTREAMER_FOUND - system has GStreamer
|
||||||
|
# GSTREAMER_INCLUDE_DIRS - the GStreamer include directories
|
||||||
|
# GSTREAMER_LIBRARIES - link these to use GStreamer
|
||||||
|
#
|
||||||
|
# Additionally, gstreamer-base is always looked for and required, and
|
||||||
|
# the following related variables are defined:
|
||||||
|
#
|
||||||
|
# GSTREAMER_BASE_INCLUDE_DIRS - gstreamer-base's include directory
|
||||||
|
# GSTREAMER_BASE_LIBRARIES - link to these to use gstreamer-base
|
||||||
|
#
|
||||||
|
# Optionally, the COMPONENTS keyword can be passed to find_package()
|
||||||
|
# and GStreamer plugins can be looked for. Currently, the following
|
||||||
|
# plugins can be searched, and they define the following variables if
|
||||||
|
# found:
|
||||||
|
#
|
||||||
|
# gstreamer-app: GSTREAMER_APP_INCLUDE_DIRS and GSTREAMER_APP_LIBRARIES
|
||||||
|
# gstreamer-audio: GSTREAMER_AUDIO_INCLUDE_DIRS and GSTREAMER_AUDIO_LIBRARIES
|
||||||
|
# gstreamer-fft: GSTREAMER_FFT_INCLUDE_DIRS and GSTREAMER_FFT_LIBRARIES
|
||||||
|
# gstreamer-pbutils: GSTREAMER_PBUTILS_INCLUDE_DIRS and GSTREAMER_PBUTILS_LIBRARIES
|
||||||
|
# gstreamer-video: GSTREAMER_VIDEO_INCLUDE_DIRS and GSTREAMER_VIDEO_LIBRARIES
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
|
||||||
|
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
# Helper macro to find a GStreamer plugin (or GStreamer itself)
|
||||||
|
# _component_prefix is prepended to the _INCLUDE_DIRS and _LIBRARIES variables (eg. "GSTREAMER_AUDIO")
|
||||||
|
# _pkgconfig_name is the component's pkg-config name (eg. "gstreamer-1.0", or "gstreamer-video-1.0").
|
||||||
|
# _header is the component's header, relative to the gstreamer-1.0 directory (eg. "gst/gst.h").
|
||||||
|
# _library is the component's library name (eg. "gstreamer-1.0" or "gstvideo-1.0")
|
||||||
|
#macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library)
|
||||||
|
# pkg_check_modules(PC_${_component_prefix} QUIET ${_pkgconfig_name})
|
||||||
|
#
|
||||||
|
# find_path(${_component_prefix}_INCLUDE_DIRS
|
||||||
|
# NAMES ${_header}
|
||||||
|
# HINTS ${PC_${_component_prefix}_INCLUDE_DIRS} ${PC_${_component_prefix}_INCLUDEDIR}
|
||||||
|
# PATH_SUFFIXES gstreamer-1.0
|
||||||
|
# )
|
||||||
|
#
|
||||||
|
# find_library(${_component_prefix}_LIBRARIES
|
||||||
|
# NAMES ${_library}
|
||||||
|
# HINTS ${PC_${_component_prefix}_LIBRARY_DIRS} ${PC_${_component_prefix}_LIBDIR}
|
||||||
|
# )
|
||||||
|
#endmacro()
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library)
|
||||||
|
find_path(${_component_prefix}_INCLUDE_DIRS
|
||||||
|
NAMES ${_header}
|
||||||
|
PATHS C:/gstreamer/1.0/x86_64/include
|
||||||
|
PATH_SUFFIXES gstreamer-1.0
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(${_component_prefix}_LIBRARIES
|
||||||
|
NAMES ${_library}
|
||||||
|
PATHS C:/gstreamer/1.0/x86_64/lib
|
||||||
|
)
|
||||||
|
endmacro()
|
||||||
|
else ()
|
||||||
|
|
||||||
|
find_package(PkgConfig)
|
||||||
|
|
||||||
|
macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library)
|
||||||
|
pkg_check_modules(${_component_prefix} QUIET ${_pkgconfig_name})
|
||||||
|
|
||||||
|
# find_path(${_component_prefix}_INCLUDE_DIRS
|
||||||
|
# NAMES ${_header}
|
||||||
|
# HINTS ${PC_${_component_prefix}_INCLUDE_DIRS} ${PC_${_component_prefix}_INCLUDEDIR}
|
||||||
|
# PATH_SUFFIXES gstreamer-1.0
|
||||||
|
# )
|
||||||
|
|
||||||
|
# find_library(${_component_prefix}_LIBRARIES
|
||||||
|
# NAMES ${_library}
|
||||||
|
# HINTS ${PC_${_component_prefix}_LIBRARY_DIRS} ${PC_${_component_prefix}_LIBDIR}
|
||||||
|
# )
|
||||||
|
endmacro()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# ------------------------
|
||||||
|
# 1. Find GStreamer itself
|
||||||
|
# ------------------------
|
||||||
|
|
||||||
|
# 1.1. Find headers and libraries
|
||||||
|
FIND_GSTREAMER_COMPONENT(GSTREAMER gstreamer-1.0 gst/gst.h gstreamer-1.0)
|
||||||
|
FIND_GSTREAMER_COMPONENT(GSTREAMER_BASE gstreamer-base-1.0 gst/gst.h gstbase-1.0)
|
||||||
|
|
||||||
|
|
||||||
|
# 1.2. Check GStreamer version
|
||||||
|
if (GSTREAMER_INCLUDE_DIRS)
|
||||||
|
if (EXISTS "${GSTREAMER_INCLUDE_DIRS}/gst/gstversion.h")
|
||||||
|
file(READ "${GSTREAMER_INCLUDE_DIRS}/gst/gstversion.h" GSTREAMER_VERSION_CONTENTS)
|
||||||
|
|
||||||
|
string(REGEX MATCH "#define +GST_VERSION_MAJOR +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}")
|
||||||
|
set(GSTREAMER_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||||
|
|
||||||
|
string(REGEX MATCH "#define +GST_VERSION_MINOR +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}")
|
||||||
|
set(GSTREAMER_VERSION_MINOR "${CMAKE_MATCH_1}")
|
||||||
|
|
||||||
|
string(REGEX MATCH "#define +GST_VERSION_MICRO +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}")
|
||||||
|
set(GSTREAMER_VERSION_MICRO "${CMAKE_MATCH_1}")
|
||||||
|
|
||||||
|
set(GSTREAMER_VERSION "${GSTREAMER_VERSION_MAJOR}.${GSTREAMER_VERSION_MINOR}.${GSTREAMER_VERSION_MICRO}")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
if ("${GStreamer_FIND_VERSION}" VERSION_GREATER "${GSTREAMER_VERSION}")
|
||||||
|
message(FATAL_ERROR "Required version (" ${GStreamer_FIND_VERSION} ") is higher than found version (" ${GSTREAMER_VERSION} ")")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# -------------------------
|
||||||
|
# 2. Find GStreamer plugins
|
||||||
|
# -------------------------
|
||||||
|
|
||||||
|
FIND_GSTREAMER_COMPONENT(GSTREAMER_APP gstreamer-app-1.0 gst/app/gstappsink.h gstapp-1.0)
|
||||||
|
FIND_GSTREAMER_COMPONENT(GSTREAMER_AUDIO gstreamer-audio-1.0 gst/audio/audio.h gstaudio-1.0)
|
||||||
|
FIND_GSTREAMER_COMPONENT(GSTREAMER_FFT gstreamer-fft-1.0 gst/fft/gstfft.h gstfft-1.0)
|
||||||
|
FIND_GSTREAMER_COMPONENT(GSTREAMER_PBUTILS gstreamer-pbutils-1.0 gst/pbutils/pbutils.h gstpbutils-1.0)
|
||||||
|
FIND_GSTREAMER_COMPONENT(GSTREAMER_VIDEO gstreamer-video-1.0 gst/video/video.h gstvideo-1.0)
|
||||||
|
|
||||||
|
# ------------------------------------------------
|
||||||
|
# 3. Process the COMPONENTS passed to FIND_PACKAGE
|
||||||
|
# ------------------------------------------------
|
||||||
|
set(_GSTREAMER_REQUIRED_VARS GSTREAMER_INCLUDE_DIRS GSTREAMER_LIBRARIES GSTREAMER_VERSION GSTREAMER_BASE_INCLUDE_DIRS GSTREAMER_BASE_LIBRARIES)
|
||||||
|
|
||||||
|
foreach (_component ${GStreamer_FIND_COMPONENTS})
|
||||||
|
set(_gst_component "GSTREAMER_${_component}")
|
||||||
|
string(TOUPPER ${_gst_component} _UPPER_NAME)
|
||||||
|
|
||||||
|
list(APPEND _GSTREAMER_REQUIRED_VARS ${_UPPER_NAME}_INCLUDE_DIRS ${_UPPER_NAME}_LIBRARIES)
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer REQUIRED_VARS ${_GSTREAMER_REQUIRED_VARS}
|
||||||
|
VERSION_VAR GSTREAMER_VERSION)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
GSTREAMER_APP_INCLUDE_DIRS
|
||||||
|
GSTREAMER_APP_LIBRARIES
|
||||||
|
GSTREAMER_AUDIO_INCLUDE_DIRS
|
||||||
|
GSTREAMER_AUDIO_LIBRARIES
|
||||||
|
GSTREAMER_BASE_INCLUDE_DIRS
|
||||||
|
GSTREAMER_BASE_LIBRARIES
|
||||||
|
GSTREAMER_FFT_INCLUDE_DIRS
|
||||||
|
GSTREAMER_FFT_LIBRARIES
|
||||||
|
GSTREAMER_INCLUDE_DIRS
|
||||||
|
GSTREAMER_LIBRARIES
|
||||||
|
GSTREAMER_PBUTILS_INCLUDE_DIRS
|
||||||
|
GSTREAMER_PBUTILS_LIBRARIES
|
||||||
|
GSTREAMER_VIDEO_INCLUDE_DIRS
|
||||||
|
GSTREAMER_VIDEO_LIBRARIES
|
||||||
|
)
|
||||||
@@ -9,6 +9,15 @@
|
|||||||
#
|
#
|
||||||
# Created by Robert Osfield.
|
# Created by Robert Osfield.
|
||||||
|
|
||||||
|
# prefer FindJasper from cmake distribution
|
||||||
|
if(EXISTS ${CMAKE_ROOT}/Modules/FindJasper.cmake)
|
||||||
|
include(${CMAKE_ROOT}/Modules/FindJasper.cmake)
|
||||||
|
|
||||||
|
if(JASPER_FOUND)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h
|
FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h
|
||||||
$ENV{JASPER_DIR}/include
|
$ENV{JASPER_DIR}/include
|
||||||
$ENV{JASPER_DIR}/src/libjasper/include
|
$ENV{JASPER_DIR}/src/libjasper/include
|
||||||
|
|||||||
107
CMakeModules/FindLIBLAS.cmake
Normal file
107
CMakeModules/FindLIBLAS.cmake
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
#---
|
||||||
|
# File: FindLIBLAS.cmake
|
||||||
|
#
|
||||||
|
# Find the native LIBLAS includes and library
|
||||||
|
#
|
||||||
|
# LIBLAS_INCLUDE_DIRS - where to find liblas's includes.
|
||||||
|
# LIBLAS_LIBRARIES - List of libraries when using liblas.
|
||||||
|
# LIBLAS_FOUND - True if liblas found.
|
||||||
|
#---
|
||||||
|
|
||||||
|
|
||||||
|
# Set the include dir:
|
||||||
|
find_path(LIBLAS_INCLUDE_DIR liblas/liblas.hpp)
|
||||||
|
|
||||||
|
# Macro for setting libraries:
|
||||||
|
macro(FIND_LIBLAS_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
"${MYLIBRARY}_DEBUG"
|
||||||
|
NAMES "${MYLIBRARYNAME}${CMAKE_DEBUG_POSTFIX}"
|
||||||
|
PATHS
|
||||||
|
${LIBLAS_DIR}/lib/Debug
|
||||||
|
${LIBLAS_DIR}/lib64/Debug
|
||||||
|
${LIBLAS_DIR}/lib
|
||||||
|
${LIBLAS_DIR}/lib64
|
||||||
|
$ENV{LIBLAS_DIR}/lib/debug
|
||||||
|
$ENV{LIBLAS_DIR}/lib64/debug
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
"${MYLIBRARY}_DEBUG"
|
||||||
|
NAMES "${MYLIBRARYNAME}${CMAKE_DEBUG_POSTFIX}"
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/local/lib64
|
||||||
|
/usr/lib
|
||||||
|
/usr/lib64
|
||||||
|
/sw/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/opt/csw/lib
|
||||||
|
/opt/lib
|
||||||
|
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;LIBLAS_ROOT]/lib
|
||||||
|
/usr/freeware/lib64
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
${MYLIBRARY}
|
||||||
|
NAMES "${MYLIBRARYNAME}${CMAKE_RELEASE_POSTFIX}"
|
||||||
|
PATHS
|
||||||
|
${LIBLAS_DIR}/lib/Release
|
||||||
|
${LIBLAS_DIR}/lib64/Release
|
||||||
|
${LIBLAS_DIR}/lib
|
||||||
|
${LIBLAS_DIR}/lib64
|
||||||
|
$ENV{LIBLAS_DIR}/lib/Release
|
||||||
|
$ENV{LIBLAS_DIR}/lib64/Release
|
||||||
|
$ENV{LIBLAS_DIR}/lib
|
||||||
|
$ENV{LIBLAS_DIR}/lib64
|
||||||
|
$ENV{LIBLAS_DIR}
|
||||||
|
$ENV{LIBLASDIR}/lib
|
||||||
|
$ENV{LIBLASDIR}/lib64
|
||||||
|
$ENV{LIBLASDIR}
|
||||||
|
$ENV{LIBLAS_ROOT}/lib
|
||||||
|
$ENV{LIBLAS_ROOT}/lib64
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
${MYLIBRARY}
|
||||||
|
NAMES "${MYLIBRARYNAME}${CMAKE_RELEASE_POSTFIX}"
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/local/lib64
|
||||||
|
/usr/lib
|
||||||
|
/usr/lib64
|
||||||
|
/sw/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/opt/csw/lib
|
||||||
|
/opt/lib
|
||||||
|
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;LIBLAS_ROOT]/lib
|
||||||
|
/usr/freeware/lib64
|
||||||
|
)
|
||||||
|
|
||||||
|
if( NOT ${MYLIBRARY}_DEBUG )
|
||||||
|
if( MYLIBRARY )
|
||||||
|
set( ${MYLIBRARY}_DEBUG ${MYLIBRARY} )
|
||||||
|
endif(MYLIBRARY)
|
||||||
|
endif( NOT ${MYLIBRARY}_DEBUG )
|
||||||
|
|
||||||
|
endmacro(FIND_LIBLAS_LIBRARY LIBRARY LIBRARYNAME)
|
||||||
|
|
||||||
|
FIND_LIBLAS_LIBRARY(LIBLAS_LIBRARY las)
|
||||||
|
FIND_LIBLAS_LIBRARY(LIBLASC_LIBRARY las_c)
|
||||||
|
|
||||||
|
set(LIBLAS_FOUND "NO")
|
||||||
|
if(LIBLAS_LIBRARY AND LIBLASC_LIBRARY AND LIBLAS_INCLUDE_DIR)
|
||||||
|
|
||||||
|
FIND_PACKAGE(Boost) # used by LIBLAS
|
||||||
|
if(Boost_FOUND)
|
||||||
|
set(LIBLAS_LIBRARIES ${LIBLAS_LIBRARY} ${LIBLASC_LIBRARY} )
|
||||||
|
set(LIBLAS_FOUND "YES")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
83
CMakeModules/FindLua52.cmake
Normal file
83
CMakeModules/FindLua52.cmake
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
# Locate Lua library
|
||||||
|
# This module defines
|
||||||
|
# LUA51_FOUND, if false, do not try to link to Lua
|
||||||
|
# LUA_LIBRARIES
|
||||||
|
# LUA_INCLUDE_DIR, where to find lua.h
|
||||||
|
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
|
||||||
|
#
|
||||||
|
# Note that the expected include convention is
|
||||||
|
# #include "lua.h"
|
||||||
|
# and not
|
||||||
|
# #include <lua/lua.h>
|
||||||
|
# This is because, the lua location is not standardized and may exist
|
||||||
|
# in locations other than lua/
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2007-2009 Kitware, Inc.
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
find_path(LUA_INCLUDE_DIR lua.h
|
||||||
|
HINTS
|
||||||
|
ENV LUA_DIR
|
||||||
|
PATH_SUFFIXES include/lua52 include/lua5.2 include/lua include
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/sw # Fink
|
||||||
|
/opt/local # DarwinPorts
|
||||||
|
/opt/csw # Blastwave
|
||||||
|
/opt
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(LUA_LIBRARY
|
||||||
|
NAMES lua52 lua5.2 lua-5.2 lua
|
||||||
|
HINTS
|
||||||
|
ENV LUA_DIR
|
||||||
|
PATH_SUFFIXES lib
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/sw
|
||||||
|
/opt/local
|
||||||
|
/opt/csw
|
||||||
|
/opt
|
||||||
|
)
|
||||||
|
|
||||||
|
if(LUA_LIBRARY)
|
||||||
|
# include the math library for Unix
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
find_library(LUA_MATH_LIBRARY m)
|
||||||
|
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||||
|
# For Windows and Mac, don't need to explicitly include the math library
|
||||||
|
else()
|
||||||
|
set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
|
||||||
|
file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
|
||||||
|
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
|
||||||
|
unset(lua_version_str)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
|
||||||
|
# all listed variables are TRUE
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua52
|
||||||
|
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
|
||||||
|
VERSION_VAR LUA_VERSION_STRING)
|
||||||
|
|
||||||
|
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@ 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
|
||||||
@@ -25,6 +26,17 @@ 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
|
||||||
@@ -35,6 +47,17 @@ 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
|
||||||
@@ -45,6 +68,17 @@ 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
|
||||||
@@ -54,6 +88,97 @@ 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
|
||||||
|
)
|
||||||
|
|
||||||
|
# NVTHREAD
|
||||||
|
FIND_LIBRARY(NVTHREAD_LIBRARY
|
||||||
|
NAMES nvthread
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
FIND_LIBRARY(NVTHREAD_LIBRARY_DEBUG
|
||||||
|
NAMES nvthread_d
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
|
||||||
|
# SQUISH
|
||||||
|
FIND_LIBRARY(NVSQUISH_LIBRARY
|
||||||
|
NAMES squish
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
FIND_LIBRARY(NVSQUISH_LIBRARY_DEBUG
|
||||||
|
NAMES squish_d
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
|
||||||
|
# BC6H
|
||||||
|
FIND_LIBRARY(NVBC6H_LIBRARY
|
||||||
|
NAMES bc6h
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
FIND_LIBRARY(NVBC6H_LIBRARY_DEBUG
|
||||||
|
NAMES bc6h_d
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
|
||||||
|
# BC7
|
||||||
|
FIND_LIBRARY(NVBC7_LIBRARY
|
||||||
|
NAMES bc7
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
FIND_LIBRARY(NVBC7_LIBRARY_DEBUG
|
||||||
|
NAMES bc7_d
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
$ENV{NVTT_DIR}
|
||||||
|
${3rdPartyRoot}
|
||||||
|
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SET(NVTT_FOUND "NO")
|
SET(NVTT_FOUND "NO")
|
||||||
IF(NVTT_LIBRARY AND NVTT_INCLUDE_DIR)
|
IF(NVTT_LIBRARY AND NVTT_INCLUDE_DIR)
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
# Locate gdal
|
# Locate gdal
|
||||||
# This module defines
|
# This module defines
|
||||||
# OSG_LIBRARY
|
# OSG_LIBRARY
|
||||||
# OSG_FOUND, if false, do not try to link to gdal
|
# OSG_FOUND, if false, do not try to link to gdal
|
||||||
# OSG_INCLUDE_DIR, where to find the headers
|
# OSG_INCLUDE_DIR, where to find the headers
|
||||||
#
|
#
|
||||||
# $OSG_DIR is an environment variable that would
|
# $OSG_DIR is an environment variable that would
|
||||||
# correspond to the ./configure --prefix=$OSG_DIR
|
# correspond to the ./configure --prefix=$OSG_DIR
|
||||||
#
|
#
|
||||||
# Created by Robert Osfield.
|
# Created by Robert Osfield.
|
||||||
|
|
||||||
FIND_PATH(OSG_INCLUDE_DIR osg/Node
|
FIND_PATH(OSG_INCLUDE_DIR osg/Node
|
||||||
${OSG_DIR}/include
|
${OSG_DIR}/include
|
||||||
@@ -59,7 +59,7 @@ MACRO(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
|||||||
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
|
||||||
/usr/freeware/lib64
|
/usr/freeware/lib64
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(${MYLIBRARY}
|
FIND_LIBRARY(${MYLIBRARY}
|
||||||
NAMES "${MYLIBRARYNAME}${CMAKE_RELEASE_POSTFIX}"
|
NAMES "${MYLIBRARYNAME}${CMAKE_RELEASE_POSTFIX}"
|
||||||
PATHS
|
PATHS
|
||||||
@@ -107,7 +107,7 @@ MACRO(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
|||||||
ENDIF(NOT MYLIBRARY)
|
ENDIF(NOT MYLIBRARY)
|
||||||
|
|
||||||
ENDIF( NOT ${MYLIBRARY}_DEBUG )
|
ENDIF( NOT ${MYLIBRARY}_DEBUG )
|
||||||
|
|
||||||
ENDMACRO(FIND_OSG_LIBRARY LIBRARY LIBRARYNAME)
|
ENDMACRO(FIND_OSG_LIBRARY LIBRARY LIBRARYNAME)
|
||||||
|
|
||||||
FIND_OSG_LIBRARY(OSG_LIBRARY osg)
|
FIND_OSG_LIBRARY(OSG_LIBRARY osg)
|
||||||
@@ -126,7 +126,7 @@ FIND_OSG_LIBRARY(OSGANIMATION_LIBRARY osgAnimation)
|
|||||||
FIND_OSG_LIBRARY(OSGPARTICLE_LIBRARY osgParticle)
|
FIND_OSG_LIBRARY(OSGPARTICLE_LIBRARY osgParticle)
|
||||||
FIND_OSG_LIBRARY(OSGSHADOW_LIBRARY osgShadow)
|
FIND_OSG_LIBRARY(OSGSHADOW_LIBRARY osgShadow)
|
||||||
FIND_OSG_LIBRARY(OSGPRESENTATION_LIBRARY osgPresentation)
|
FIND_OSG_LIBRARY(OSGPRESENTATION_LIBRARY osgPresentation)
|
||||||
FIND_OSG_LIBRARY(OSGSIM osgSim)
|
FIND_OSG_LIBRARY(OSGSIM_LIBRARY osgSim)
|
||||||
FIND_OSG_LIBRARY(OPENTHREADS_LIBRARY OpenThreads)
|
FIND_OSG_LIBRARY(OPENTHREADS_LIBRARY OpenThreads)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#
|
#
|
||||||
# Created by Robert Osfield.
|
# Created by Robert Osfield.
|
||||||
|
|
||||||
|
|
||||||
FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h
|
FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h
|
||||||
$ENV{OPENEXR_DIR}/include
|
$ENV{OPENEXR_DIR}/include
|
||||||
$ENV{OPENEXR_DIR}
|
$ENV{OPENEXR_DIR}
|
||||||
@@ -23,78 +24,41 @@ FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h
|
|||||||
/usr/freeware/include
|
/usr/freeware/include
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(OPENEXR_IlmIlf_LIBRARY
|
# Macro to find exr libraries (deduplicating search paths)
|
||||||
NAMES IlmImf
|
# example: OPENEXR_FIND_VAR(OPENEXR_IlmImf_LIBRARY IlmImf)
|
||||||
PATHS
|
MACRO(OPENEXR_FIND_VAR varname libname)
|
||||||
$ENV{OPENEXR_DIR}/lib
|
FIND_LIBRARY( ${varname}
|
||||||
$ENV{OPENEXR_DIR}
|
NAMES ${libname}
|
||||||
~/Library/Frameworks
|
PATHS
|
||||||
/Library/Frameworks
|
$ENV{OPENEXR_DIR}/lib
|
||||||
/usr/local/lib
|
$ENV{OPENEXR_DIR}
|
||||||
/usr/lib
|
~/Library/Frameworks
|
||||||
/sw/lib
|
/Library/Frameworks
|
||||||
/opt/local/lib
|
/usr/local/lib
|
||||||
/opt/csw/lib
|
/usr/lib
|
||||||
/opt/lib
|
/sw/lib
|
||||||
/usr/freeware/lib64
|
/opt/local/lib
|
||||||
)
|
/opt/csw/lib
|
||||||
|
/opt/lib
|
||||||
|
/usr/freeware/lib64
|
||||||
|
)
|
||||||
|
ENDMACRO(OPENEXR_FIND_VAR)
|
||||||
|
|
||||||
FIND_LIBRARY(OPENEXR_IlmThread_LIBRARY
|
# Macro to find exr libraries (and debug versions)
|
||||||
NAMES IlmThread
|
# example: OPENEXR_FIND(IlmImf)
|
||||||
PATHS
|
MACRO(OPENEXR_FIND libname)
|
||||||
$ENV{OPENEXR_DIR}/lib
|
OPENEXR_FIND_VAR(OPENEXR_${libname}_LIBRARY ${libname})
|
||||||
$ENV{OPENEXR_DIR}
|
OPENEXR_FIND_VAR(OPENEXR_${libname}_LIBRARY_DEBUG ${libname}d)
|
||||||
~/Library/Frameworks
|
ENDMACRO(OPENEXR_FIND)
|
||||||
/Library/Frameworks
|
|
||||||
/usr/local/lib
|
|
||||||
/usr/lib
|
|
||||||
/sw/lib
|
|
||||||
/opt/local/lib
|
|
||||||
/opt/csw/lib
|
|
||||||
/opt/lib
|
|
||||||
/usr/freeware/lib64
|
|
||||||
)
|
|
||||||
|
|
||||||
|
OPENEXR_FIND(IlmImf)
|
||||||
FIND_LIBRARY(OPENEXR_Iex_LIBRARY
|
OPENEXR_FIND(IlmThread)
|
||||||
NAMES Iex
|
OPENEXR_FIND(Iex)
|
||||||
PATHS
|
OPENEXR_FIND(Half)
|
||||||
$ENV{OPENEXR_DIR}/lib
|
|
||||||
$ENV{OPENEXR_DIR}
|
|
||||||
~/Library/Frameworks
|
|
||||||
/Library/Frameworks
|
|
||||||
/usr/local/lib
|
|
||||||
/usr/lib
|
|
||||||
/sw/lib
|
|
||||||
/opt/local/lib
|
|
||||||
/opt/csw/lib
|
|
||||||
/opt/lib
|
|
||||||
/usr/freeware/lib64
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY(OPENEXR_Half_LIBRARY
|
|
||||||
NAMES Half
|
|
||||||
PATHS
|
|
||||||
$ENV{OPENEXR_DIR}/lib
|
|
||||||
$ENV{OPENEXR_DIR}
|
|
||||||
~/Library/Frameworks
|
|
||||||
/Library/Frameworks
|
|
||||||
/usr/local/lib
|
|
||||||
/usr/lib
|
|
||||||
/sw/lib
|
|
||||||
/opt/local/lib
|
|
||||||
/opt/csw/lib
|
|
||||||
/opt/lib
|
|
||||||
/usr/freeware/lib64
|
|
||||||
)
|
|
||||||
|
|
||||||
SET(OPENEXR_FOUND "NO")
|
SET(OPENEXR_FOUND "NO")
|
||||||
IF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY)
|
IF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmImf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY)
|
||||||
SET(OPENEXR_LIBRARIES
|
SET(OPENEXR_LIBRARIES ${OPENEXR_IlmImf_LIBRARY} ${OPENEXR_IlmThread_LIBRARY} ${OPENEXR_Half_LIBRARY} ${OPENEXR_Iex_LIBRARY} )
|
||||||
${OPENEXR_IlmIlf_LIBRARY}
|
SET(OPENEXR_LIBRARIES_VARS OPENEXR_IlmImf_LIBRARY OPENEXR_IlmThread_LIBRARY OPENEXR_Half_LIBRARY OPENEXR_Iex_LIBRARY )
|
||||||
${OPENEXR_IlmThread_LIBRARY}
|
|
||||||
${OPENEXR_Half_LIBRARY}
|
|
||||||
${OPENEXR_Iex_LIBRARY}
|
|
||||||
)
|
|
||||||
SET(OPENEXR_FOUND "YES")
|
SET(OPENEXR_FOUND "YES")
|
||||||
ENDIF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY)
|
ENDIF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmImf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY)
|
||||||
|
|||||||
@@ -17,6 +17,16 @@
|
|||||||
#
|
#
|
||||||
# Created by Eric Wing.
|
# Created by Eric Wing.
|
||||||
|
|
||||||
|
# prefer FindOpenThreads from cmake distribution
|
||||||
|
if(EXISTS ${CMAKE_ROOT}/Modules/FindOpenThreads.cmake)
|
||||||
|
include(${CMAKE_ROOT}/Modules/FindOpenThreads.cmake)
|
||||||
|
|
||||||
|
if(OPENTHREADS_FOUND)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Header files are presumed to be included like
|
# Header files are presumed to be included like
|
||||||
# #include <OpenThreads/Thread>
|
# #include <OpenThreads/Thread>
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
# Locate QuickTime
|
# Locate QuickTime
|
||||||
# This module defines
|
# This module defines
|
||||||
# QUICKTIME_LIBRARY
|
# QUICKTIME_LIBRARY
|
||||||
# QUICKTIME_FOUND, if false, do not try to link to gdal
|
# QUICKTIME_FOUND, if false, do not try to link to gdal
|
||||||
# QUICKTIME_INCLUDE_DIR, where to find the headers
|
# QUICKTIME_INCLUDE_DIR, where to find the headers
|
||||||
#
|
#
|
||||||
# $QUICKTIME_DIR is an environment variable that would
|
# $QUICKTIME_DIR is an environment variable that would
|
||||||
# correspond to the ./configure --prefix=$QUICKTIME_DIR
|
# correspond to the ./configure --prefix=$QUICKTIME_DIR
|
||||||
#
|
#
|
||||||
# Created by Eric Wing.
|
# Created by Eric Wing.
|
||||||
|
|
||||||
|
|
||||||
# QuickTime on OS X looks different than QuickTime for Windows,
|
# QuickTime on OS X looks different than QuickTime for Windows,
|
||||||
# so I am going to case the two.
|
# so I am going to case the two.
|
||||||
@@ -63,8 +64,8 @@ ELSE()
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
# Disable quicktime for >= 10.7, as it's officially deprecated
|
# Disable quicktime for >= 10.7, as it's officially deprecated
|
||||||
|
|
||||||
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9")
|
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}")
|
MESSAGE("disabling quicktime because it's not supported by the selected SDK ${OSG_OSX_SDK_NAME}")
|
||||||
SET(QUICKTIME_FOUND "NO")
|
SET(QUICKTIME_FOUND "NO")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ IF(PKG_CONFIG_FOUND)
|
|||||||
|
|
||||||
INCLUDE(FindPkgConfig)
|
INCLUDE(FindPkgConfig)
|
||||||
|
|
||||||
PKG_CHECK_MODULES(RSVG librsvg-2.0)
|
#Version 2.35 introduces the rsvg_cleanup function which is used
|
||||||
|
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)
|
||||||
|
|||||||
178
CMakeModules/FindSDL2.cmake
Normal file
178
CMakeModules/FindSDL2.cmake
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
# - Locate SDL library
|
||||||
|
# This module defines
|
||||||
|
# SDL2_LIBRARY, the name of the library to link against
|
||||||
|
# SDL2_FOUND, if false, do not try to link to SDL
|
||||||
|
# SDL2_INCLUDE_DIR, where to find SDL.h
|
||||||
|
# SDL2_VERSION_STRING, human-readable string containing the version of SDL
|
||||||
|
#
|
||||||
|
# This module responds to the flag:
|
||||||
|
# SDL2_BUILDING_LIBRARY
|
||||||
|
# If this is defined, then no SDL2_main will be linked in because
|
||||||
|
# only applications need main().
|
||||||
|
# Otherwise, it is assumed you are building an application and this
|
||||||
|
# module will attempt to locate and set the proper link flags
|
||||||
|
# as part of the returned SDL2_LIBRARY variable.
|
||||||
|
#
|
||||||
|
# Don't forget to include SDLmain.h and SDLmain.m your project for the
|
||||||
|
# OS X framework based version. (Other versions link to -lSDLmain which
|
||||||
|
# this module will try to find on your behalf.) Also for OS X, this
|
||||||
|
# module will automatically add the -framework Cocoa on your behalf.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
|
||||||
|
# and no SDL2_LIBRARY, it means CMake did not find your SDL library
|
||||||
|
# (SDL.dll, libsdl.so, SDL.framework, etc).
|
||||||
|
# Set SDL2_LIBRARY_TEMP to point to your SDL library, and configure again.
|
||||||
|
# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
|
||||||
|
# as appropriate. These values are used to generate the final SDL2_LIBRARY
|
||||||
|
# variable, but when these values are unset, SDL2_LIBRARY does not get created.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# $SDLDIR is an environment variable that would
|
||||||
|
# correspond to the ./configure --prefix=$SDLDIR
|
||||||
|
# used in building SDL.
|
||||||
|
# l.e.galup 9-20-02
|
||||||
|
#
|
||||||
|
# Modified by Eric Wing.
|
||||||
|
# Added code to assist with automated building by using environmental variables
|
||||||
|
# and providing a more controlled/consistent search behavior.
|
||||||
|
# Added new modifications to recognize OS X frameworks and
|
||||||
|
# additional Unix paths (FreeBSD, etc).
|
||||||
|
# Also corrected the header search path to follow "proper" SDL guidelines.
|
||||||
|
# Added a search for SDLmain which is needed by some platforms.
|
||||||
|
# Added a search for threads which is needed by some platforms.
|
||||||
|
# Added needed compile switches for MinGW.
|
||||||
|
#
|
||||||
|
# On OSX, this will prefer the Framework version (if found) over others.
|
||||||
|
# People will have to manually change the cache values of
|
||||||
|
# SDL2_LIBRARY to override this selection or set the CMake environment
|
||||||
|
# CMAKE_INCLUDE_PATH to modify the search paths.
|
||||||
|
#
|
||||||
|
# Note that the header path has changed from SDL/SDL.h to just SDL.h
|
||||||
|
# This needed to change because "proper" SDL convention
|
||||||
|
# is #include "SDL.h", not <SDL/SDL.h>. This is done for portability
|
||||||
|
# reasons because not all systems place things in SDL/ (see FreeBSD).
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2003-2009 Kitware, Inc.
|
||||||
|
# Copyright 2012 Benjamin Eikel
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
find_path(SDL2_INCLUDE_DIR SDL.h
|
||||||
|
HINTS
|
||||||
|
ENV SDL2DIR
|
||||||
|
PATH_SUFFIXES include/SDL2
|
||||||
|
)
|
||||||
|
|
||||||
|
# SDL-1.1 is the name used by FreeBSD ports...
|
||||||
|
# don't confuse it for the version number.
|
||||||
|
find_library(SDL2_LIBRARY_TEMP
|
||||||
|
NAMES SDL2
|
||||||
|
HINTS
|
||||||
|
ENV SDL2DIR
|
||||||
|
PATH_SUFFIXES lib
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT SDL2_BUILDING_LIBRARY)
|
||||||
|
if(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
|
||||||
|
# Non-OS X framework versions expect you to also dynamically link to
|
||||||
|
# SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms
|
||||||
|
# seem to provide SDLmain for compatibility even though they don't
|
||||||
|
# necessarily need it.
|
||||||
|
find_library(SDL2MAIN_LIBRARY
|
||||||
|
NAMES SDL2main
|
||||||
|
HINTS
|
||||||
|
ENV SDL2DIR
|
||||||
|
PATH_SUFFIXES lib
|
||||||
|
PATHS
|
||||||
|
/sw
|
||||||
|
/opt/local
|
||||||
|
/opt/csw
|
||||||
|
/opt
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# SDL may require threads on your system.
|
||||||
|
# The Apple build may not need an explicit flag because one of the
|
||||||
|
# frameworks may already provide it.
|
||||||
|
# But for non-OSX systems, I will use the CMake Threads package.
|
||||||
|
if(NOT APPLE)
|
||||||
|
find_package(Threads)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# MinGW needs an additional library, mwindows
|
||||||
|
# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows
|
||||||
|
# (Actually on second look, I think it only needs one of the m* libraries.)
|
||||||
|
if(MINGW)
|
||||||
|
set(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(SDL2_LIBRARY_TEMP)
|
||||||
|
# For SDLmain
|
||||||
|
if(SDL2MAIN_LIBRARY AND NOT SDL2_BUILDING_LIBRARY)
|
||||||
|
list(FIND SDL2_LIBRARY_TEMP "${SDL2MAIN_LIBRARY}" _SDL2_MAIN_INDEX)
|
||||||
|
if(_SDL2_MAIN_INDEX EQUAL -1)
|
||||||
|
set(SDL2_LIBRARY_TEMP "${SDL2MAIN_LIBRARY}" ${SDL2_LIBRARY_TEMP})
|
||||||
|
endif()
|
||||||
|
unset(_SDL2_MAIN_INDEX)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# For OS X, SDL uses Cocoa as a backend so it must link to Cocoa.
|
||||||
|
# CMake doesn't display the -framework Cocoa string in the UI even
|
||||||
|
# though it actually is there if I modify a pre-used variable.
|
||||||
|
# I think it has something to do with the CACHE STRING.
|
||||||
|
# So I use a temporary variable until the end so I can set the
|
||||||
|
# "real" variable in one-shot.
|
||||||
|
if(APPLE)
|
||||||
|
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# For threads, as mentioned Apple doesn't need this.
|
||||||
|
# In fact, there seems to be a problem if I used the Threads package
|
||||||
|
# and try using this line, so I'm just skipping it entirely for OS X.
|
||||||
|
if(NOT APPLE)
|
||||||
|
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# For MinGW library
|
||||||
|
if(MINGW)
|
||||||
|
set(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set the final string here so the GUI reflects the final state.
|
||||||
|
set(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found")
|
||||||
|
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
|
||||||
|
set(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(SDL2_INCLUDE_DIR AND EXISTS "${SDL2_INCLUDE_DIR}/SDL2_version.h")
|
||||||
|
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL2_MAJOR_VERSION[ \t]+[0-9]+$")
|
||||||
|
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_MINOR_VERSION[ \t]+[0-9]+$")
|
||||||
|
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_PATCHLEVEL[ \t]+[0-9]+$")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL2_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MAJOR "${SDL2_VERSION_MAJOR_LINE}")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL2_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MINOR "${SDL2_VERSION_MINOR_LINE}")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL2_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_PATCH "${SDL2_VERSION_PATCH_LINE}")
|
||||||
|
set(SDL2_VERSION_STRING ${SDL2_VERSION_MAJOR}.${SDL2_VERSION_MINOR}.${SDL2_VERSION_PATCH})
|
||||||
|
unset(SDL2_VERSION_MAJOR_LINE)
|
||||||
|
unset(SDL2_VERSION_MINOR_LINE)
|
||||||
|
unset(SDL2_VERSION_PATCH_LINE)
|
||||||
|
unset(SDL2_VERSION_MAJOR)
|
||||||
|
unset(SDL2_VERSION_MINOR)
|
||||||
|
unset(SDL2_VERSION_PATCH)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
|
||||||
|
REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR
|
||||||
|
VERSION_VAR SDL2_VERSION_STRING)
|
||||||
45
CMakeModules/FindV8.cmake
Normal file
45
CMakeModules/FindV8.cmake
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Locate V8
|
||||||
|
# This module defines
|
||||||
|
# V8_LIBRARY
|
||||||
|
# V8_FOUND, if false, do not try to link to gdal
|
||||||
|
# V8_INCLUDE_DIR, where to find the headers
|
||||||
|
#
|
||||||
|
# $V8_DIR is an environment variable that would
|
||||||
|
# correspond to the ./configure --prefix=$V8_DIR
|
||||||
|
#
|
||||||
|
# Created by Robert Osfield (based on FindFLTK.cmake)
|
||||||
|
|
||||||
|
FIND_PATH(V8_INCLUDE_DIR v8.h
|
||||||
|
$ENV{V8_DIR}/include
|
||||||
|
$ENV{V8_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(V8_LIBRARY
|
||||||
|
NAMES v8 libv8
|
||||||
|
PATHS
|
||||||
|
$ENV{V8_DIR}/lib
|
||||||
|
$ENV{V8_DIR}
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/usr/local/lib
|
||||||
|
/usr/lib
|
||||||
|
/sw/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/opt/csw/lib
|
||||||
|
/opt/lib
|
||||||
|
/usr/freeware/lib64
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(V8_FOUND "NO")
|
||||||
|
IF(V8_LIBRARY AND V8_INCLUDE_DIR)
|
||||||
|
SET(V8_FOUND "YES")
|
||||||
|
ENDIF()
|
||||||
@@ -10,6 +10,16 @@
|
|||||||
#
|
#
|
||||||
# Created by Ulrich Hertlein.
|
# Created by Ulrich Hertlein.
|
||||||
|
|
||||||
|
# prefer FindZLIB from cmake distribution
|
||||||
|
if(EXISTS ${CMAKE_ROOT}/Modules/FindZLIB.cmake)
|
||||||
|
include(${CMAKE_ROOT}/Modules/FindZLIB.cmake)
|
||||||
|
|
||||||
|
if(ZLIB_FOUND)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
|
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
|
||||||
$ENV{ZLIB_DIR}/include
|
$ENV{ZLIB_DIR}/include
|
||||||
$ENV{ZLIB_DIR}
|
$ENV{ZLIB_DIR}
|
||||||
|
|||||||
0
CMakeModules/FindZeroConf.cmake
Executable file → Normal file
0
CMakeModules/FindZeroConf.cmake
Executable file → Normal file
@@ -25,14 +25,6 @@ IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
|||||||
HANDLE_MSVC_DLL()
|
HANDLE_MSVC_DLL()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(ANDROID)
|
|
||||||
INSTALL (
|
|
||||||
FILES ${TARGET_H}
|
|
||||||
DESTINATION ${INSTALL_INCDIR}/${LIB_NAME}
|
|
||||||
COMPONENT libopenscenegraph-dev
|
|
||||||
)
|
|
||||||
ELSE(ANDROID)
|
|
||||||
|
|
||||||
INSTALL(
|
INSTALL(
|
||||||
TARGETS ${LIB_NAME}
|
TARGETS ${LIB_NAME}
|
||||||
RUNTIME DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph
|
RUNTIME DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph
|
||||||
@@ -40,6 +32,12 @@ INSTALL(
|
|||||||
ARCHIVE DESTINATION ${INSTALL_ARCHIVEDIR} COMPONENT libopenscenegraph-dev
|
ARCHIVE DESTINATION ${INSTALL_ARCHIVEDIR} COMPONENT libopenscenegraph-dev
|
||||||
)
|
)
|
||||||
|
|
||||||
|
IF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||||
|
GET_TARGET_PROPERTY(PREFIX ${LIB_NAME} PREFIX)
|
||||||
|
INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS RelWithDebInfo)
|
||||||
|
INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS Debug)
|
||||||
|
ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||||
|
|
||||||
IF(NOT OSG_COMPILE_FRAMEWORKS)
|
IF(NOT OSG_COMPILE_FRAMEWORKS)
|
||||||
INSTALL (
|
INSTALL (
|
||||||
FILES ${TARGET_H}
|
FILES ${TARGET_H}
|
||||||
@@ -59,4 +57,3 @@ ELSE()
|
|||||||
# MESSAGE("${OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}")
|
# MESSAGE("${OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ENDIF(ANDROID)
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#JPEG
|
#JPEG
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(JPEG_INCLUDE_DIR Android.mk
|
FIND_PATH(JPEG_INCLUDE_DIR Android.mk
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/libjpeg
|
${CMAKE_SOURCE_DIR}/3rdparty/libjpeg NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libjpeg")
|
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libjpeg")
|
||||||
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${JPEG_INCLUDE_DIR}/Android.mk \n")
|
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${JPEG_INCLUDE_DIR}/Android.mk \n")
|
||||||
@@ -82,7 +82,7 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#PNG
|
#PNG
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(PNG_INCLUDE_DIR Android.mk
|
FIND_PATH(PNG_INCLUDE_DIR Android.mk
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/libpng
|
${CMAKE_SOURCE_DIR}/3rdparty/libpng NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libpng")
|
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libpng")
|
||||||
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${PNG_INCLUDE_DIR}/Android.mk \n")
|
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${PNG_INCLUDE_DIR}/Android.mk \n")
|
||||||
@@ -97,7 +97,7 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#GIF
|
#GIF
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(GIFLIB_INCLUDE_DIR Android.mk
|
FIND_PATH(GIFLIB_INCLUDE_DIR Android.mk
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/giflib
|
${CMAKE_SOURCE_DIR}/3rdparty/giflib NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libgif")
|
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libgif")
|
||||||
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${GIFLIB_INCLUDE_DIR}/Android.mk \n")
|
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${GIFLIB_INCLUDE_DIR}/Android.mk \n")
|
||||||
@@ -112,7 +112,7 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#TIF
|
#TIF
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(TIFF_INCLUDE_DIR Android.mk
|
FIND_PATH(TIFF_INCLUDE_DIR Android.mk
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/libtiff
|
${CMAKE_SOURCE_DIR}/3rdparty/libtiff NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libtiff")
|
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libtiff")
|
||||||
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${TIFF_INCLUDE_DIR}/Android.mk \n")
|
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${TIFF_INCLUDE_DIR}/Android.mk \n")
|
||||||
@@ -142,7 +142,7 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#CURL
|
#CURL
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(CURL_DIR Android.mk
|
FIND_PATH(CURL_DIR Android.mk
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/curl
|
${CMAKE_SOURCE_DIR}/3rdparty/curl NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libcurl")
|
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libcurl")
|
||||||
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${CURL_DIR}/Android.mk \n")
|
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${CURL_DIR}/Android.mk \n")
|
||||||
@@ -159,11 +159,11 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#FREETYPE
|
#FREETYPE
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(FREETYPE_DIR Android.mk
|
FIND_PATH(FREETYPE_DIR Android.mk
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/freetype
|
${CMAKE_SOURCE_DIR}/3rdparty/freetype NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libft2")
|
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libft2")
|
||||||
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${FREETYPE_DIR}/Android.mk \n")
|
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${FREETYPE_DIR}/Android.mk \n")
|
||||||
set(FREETYPE_INCLUDE_DIRS "${FREETYPE_DIR}/include ${FREETYPE_DIR}/include/freetype/config")
|
set(FREETYPE_INCLUDE_DIRS ${FREETYPE_DIR}/include ${FREETYPE_DIR}/include/freetype/config)
|
||||||
if(FREETYPE_DIR)
|
if(FREETYPE_DIR)
|
||||||
message(STATUS "FREETYPE found ${FREETYPE_DIR}" )
|
message(STATUS "FREETYPE found ${FREETYPE_DIR}" )
|
||||||
set(FREETYPE_FOUND "Yes")
|
set(FREETYPE_FOUND "Yes")
|
||||||
@@ -175,7 +175,7 @@ MACRO(ANDROID_3RD_PARTY)
|
|||||||
#GDAL
|
#GDAL
|
||||||
################################################
|
################################################
|
||||||
FIND_PATH(GDAL_DIR gdal.h
|
FIND_PATH(GDAL_DIR gdal.h
|
||||||
${CMAKE_SOURCE_DIR}/3rdparty/gdal/include
|
${CMAKE_SOURCE_DIR}/3rdparty/gdal/include NO_CMAKE_FIND_ROOT_PATH
|
||||||
)
|
)
|
||||||
set(GDAL_INCLUDE_DIR "${GDAL_DIR}")
|
set(GDAL_INCLUDE_DIR "${GDAL_DIR}")
|
||||||
if(GDAL_DIR)
|
if(GDAL_DIR)
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
# full path of the library name. in order to differentiate release and debug, this macro get the
|
# full path of the library name. in order to differentiate release and debug, this macro get the
|
||||||
# NAME of the variables, so the macro gets as arguments the target name and the following list of parameters
|
# NAME of the variables, so the macro gets as arguments the target name and the following list of parameters
|
||||||
# is intended as a list of variable names each one containing the path of the libraries to link to
|
# is intended as a list of variable names each one containing the path of the libraries to link to
|
||||||
# The existance of a variable name with _DEBUG appended is tested and, in case it' s value is used
|
# The existence of a variable name with _DEBUG appended is tested and, in case it' s value is used
|
||||||
# for linking to when in debug mode
|
# for linking to when in debug mode
|
||||||
# the content of this library for linking when in debugging
|
# the content of this library for linking when in debugging
|
||||||
#######################################################################################################
|
#######################################################################################################
|
||||||
|
|
||||||
@@ -43,7 +43,11 @@ SET(VALID_BUILDER_VERSION OFF)
|
|||||||
MACRO(LINK_WITH_VARIABLES TRGTNAME)
|
MACRO(LINK_WITH_VARIABLES TRGTNAME)
|
||||||
FOREACH(varname ${ARGN})
|
FOREACH(varname ${ARGN})
|
||||||
IF(${varname}_DEBUG)
|
IF(${varname}_DEBUG)
|
||||||
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${${varname}}" debug "${${varname}_DEBUG}")
|
IF(${varname}_RELEASE)
|
||||||
|
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${${varname}_RELEASE}" debug "${${varname}_DEBUG}")
|
||||||
|
ELSE(${varname}_RELEASE)
|
||||||
|
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${${varname}}" debug "${${varname}_DEBUG}")
|
||||||
|
ENDIF(${varname}_RELEASE)
|
||||||
ELSE(${varname}_DEBUG)
|
ELSE(${varname}_DEBUG)
|
||||||
TARGET_LINK_LIBRARIES(${TRGTNAME} "${${varname}}" )
|
TARGET_LINK_LIBRARIES(${TRGTNAME} "${${varname}}" )
|
||||||
ENDIF(${varname}_DEBUG)
|
ENDIF(${varname}_DEBUG)
|
||||||
@@ -87,12 +91,12 @@ MACRO(LINK_CORELIB_DEFAULT CORELIB_NAME)
|
|||||||
SET(ALL_GL_LIBRARIES ${ALL_GL_LIBRARIES} ${OPENGL_egl_LIBRARY})
|
SET(ALL_GL_LIBRARIES ${ALL_GL_LIBRARIES} ${OPENGL_egl_LIBRARY})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
LINK_EXTERNAL(${CORELIB_NAME} ${ALL_GL_LIBRARIES})
|
LINK_EXTERNAL(${CORELIB_NAME} ${ALL_GL_LIBRARIES})
|
||||||
LINK_WITH_VARIABLES(${CORELIB_NAME} OPENTHREADS_LIBRARY)
|
LINK_WITH_VARIABLES(${CORELIB_NAME} OPENTHREADS_LIBRARY)
|
||||||
IF(OPENSCENEGRAPH_SONAMES)
|
IF(OPENSCENEGRAPH_SONAMES)
|
||||||
SET_TARGET_PROPERTIES(${CORELIB_NAME} PROPERTIES VERSION ${OPENSCENEGRAPH_VERSION} SOVERSION ${OPENSCENEGRAPH_SOVERSION})
|
SET_TARGET_PROPERTIES(${CORELIB_NAME} PROPERTIES VERSION ${OPENSCENEGRAPH_VERSION} SOVERSION ${OPENSCENEGRAPH_SOVERSION})
|
||||||
ENDIF(OPENSCENEGRAPH_SONAMES)
|
ENDIF(OPENSCENEGRAPH_SONAMES)
|
||||||
|
|
||||||
ENDMACRO(LINK_CORELIB_DEFAULT CORELIB_NAME)
|
ENDMACRO(LINK_CORELIB_DEFAULT CORELIB_NAME)
|
||||||
|
|
||||||
|
|
||||||
@@ -112,20 +116,20 @@ MACRO(SETUP_LINK_LIBRARIES)
|
|||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# This set up the libraries to link to, it assumes there are two variable: one common for a group of examples or plugins
|
# This set up the libraries to link to, it assumes there are two variable: one common for a group of examples or plugins
|
||||||
# kept in the variable TARGET_COMMON_LIBRARIES and an example or plugin specific kept in TARGET_ADDED_LIBRARIES
|
# kept in the variable TARGET_COMMON_LIBRARIES and an example or plugin specific kept in TARGET_ADDED_LIBRARIES
|
||||||
# they are combined in a single list checked for unicity
|
# they are combined in a single list checked for unicity
|
||||||
# the suffix ${CMAKE_DEBUG_POSTFIX} is used for differentiating optimized and debug
|
# the suffix ${CMAKE_DEBUG_POSTFIX} is used for differentiating optimized and debug
|
||||||
#
|
#
|
||||||
# a second variable TARGET_EXTERNAL_LIBRARIES hold the list of libraries not differentiated between debug and optimized
|
# a second variable TARGET_EXTERNAL_LIBRARIES hold the list of libraries not differentiated between debug and optimized
|
||||||
##################################################################################
|
##################################################################################
|
||||||
SET(TARGET_LIBRARIES ${TARGET_COMMON_LIBRARIES})
|
SET(TARGET_LIBRARIES ${TARGET_COMMON_LIBRARIES})
|
||||||
|
|
||||||
FOREACH(LINKLIB ${TARGET_ADDED_LIBRARIES})
|
FOREACH(LINKLIB ${TARGET_ADDED_LIBRARIES})
|
||||||
SET(TO_INSERT TRUE)
|
SET(TO_INSERT TRUE)
|
||||||
FOREACH (value ${TARGET_COMMON_LIBRARIES})
|
FOREACH (value ${TARGET_COMMON_LIBRARIES})
|
||||||
IF (${value} STREQUAL ${LINKLIB})
|
IF ("${value}" STREQUAL "${LINKLIB}")
|
||||||
SET(TO_INSERT FALSE)
|
SET(TO_INSERT FALSE)
|
||||||
ENDIF (${value} STREQUAL ${LINKLIB})
|
ENDIF ("${value}" STREQUAL "${LINKLIB}")
|
||||||
ENDFOREACH (value ${TARGET_COMMON_LIBRARIES})
|
ENDFOREACH (value ${TARGET_COMMON_LIBRARIES})
|
||||||
IF(TO_INSERT)
|
IF(TO_INSERT)
|
||||||
LIST(APPEND TARGET_LIBRARIES ${LINKLIB})
|
LIST(APPEND TARGET_LIBRARIES ${LINKLIB})
|
||||||
@@ -151,7 +155,7 @@ MACRO(SETUP_LINK_LIBRARIES)
|
|||||||
ENDIF(TARGET_LIBRARIES_VARS)
|
ENDIF(TARGET_LIBRARIES_VARS)
|
||||||
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
||||||
#when using full path name to specify linkage, it seems that already linked libs must be specified
|
#when using full path name to specify linkage, it seems that already linked libs must be specified
|
||||||
LINK_EXTERNAL(${TARGET_TARGETNAME} ${ALL_GL_LIBRARIES})
|
LINK_EXTERNAL(${TARGET_TARGETNAME} ${ALL_GL_LIBRARIES})
|
||||||
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
|
||||||
|
|
||||||
ENDMACRO(SETUP_LINK_LIBRARIES)
|
ENDMACRO(SETUP_LINK_LIBRARIES)
|
||||||
@@ -212,9 +216,10 @@ ENDMACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR)
|
|||||||
##########################################################################################################
|
##########################################################################################################
|
||||||
|
|
||||||
MACRO(SETUP_LIBRARY LIB_NAME)
|
MACRO(SETUP_LIBRARY LIB_NAME)
|
||||||
IF(ANDROID)
|
IF(GLCORE_FOUND)
|
||||||
SETUP_ANDROID_LIBRARY(${LIB_NAME})
|
INCLUDE_DIRECTORIES( ${GLCORE_INCLUDE_DIR} )
|
||||||
ELSE()
|
ENDIF()
|
||||||
|
|
||||||
SET(TARGET_NAME ${LIB_NAME} )
|
SET(TARGET_NAME ${LIB_NAME} )
|
||||||
SET(TARGET_TARGETNAME ${LIB_NAME} )
|
SET(TARGET_TARGETNAME ${LIB_NAME} )
|
||||||
ADD_LIBRARY(${LIB_NAME}
|
ADD_LIBRARY(${LIB_NAME}
|
||||||
@@ -224,10 +229,13 @@ 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)
|
||||||
|
|
||||||
IF(TARGET_LIBRARIES)
|
IF(TARGET_LIBRARIES)
|
||||||
LINK_INTERNAL(${LIB_NAME} ${TARGET_LIBRARIES})
|
LINK_INTERNAL(${LIB_NAME} ${TARGET_LIBRARIES})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@@ -238,15 +246,14 @@ MACRO(SETUP_LIBRARY LIB_NAME)
|
|||||||
LINK_WITH_VARIABLES(${LIB_NAME} ${TARGET_LIBRARIES_VARS})
|
LINK_WITH_VARIABLES(${LIB_NAME} ${TARGET_LIBRARIES_VARS})
|
||||||
ENDIF(TARGET_LIBRARIES_VARS)
|
ENDIF(TARGET_LIBRARIES_VARS)
|
||||||
LINK_CORELIB_DEFAULT(${LIB_NAME})
|
LINK_CORELIB_DEFAULT(${LIB_NAME})
|
||||||
|
|
||||||
ENDIF()
|
|
||||||
INCLUDE(ModuleInstall OPTIONAL)
|
INCLUDE(ModuleInstall OPTIONAL)
|
||||||
ENDMACRO(SETUP_LIBRARY LIB_NAME)
|
ENDMACRO(SETUP_LIBRARY LIB_NAME)
|
||||||
|
|
||||||
MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
||||||
IF(ANDROID)
|
IF(GLCORE_FOUND)
|
||||||
SETUP_ANDROID_LIBRARY(${TARGET_DEFAULT_PREFIX}${PLUGIN_NAME})
|
INCLUDE_DIRECTORIES( ${GLCORE_INCLUDE_DIR} )
|
||||||
ELSE()
|
ENDIF()
|
||||||
|
|
||||||
SET(TARGET_NAME ${PLUGIN_NAME} )
|
SET(TARGET_NAME ${PLUGIN_NAME} )
|
||||||
|
|
||||||
@@ -268,38 +275,33 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
|||||||
SET(PACKAGE_COMPONENT libopenscenegraph)
|
SET(PACKAGE_COMPONENT libopenscenegraph)
|
||||||
ENDIF(${ARGC} GREATER 1)
|
ENDIF(${ARGC} GREATER 1)
|
||||||
|
|
||||||
# Add the VisualStudio versioning info
|
# Add the VisualStudio versioning info
|
||||||
SET(TARGET_SRC ${TARGET_SRC} ${OPENSCENEGRAPH_VERSIONINFO_RC})
|
SET(TARGET_SRC ${TARGET_SRC} ${OPENSCENEGRAPH_VERSIONINFO_RC})
|
||||||
|
|
||||||
# here we use the command to generate the library
|
# here we use the command to generate the library
|
||||||
|
|
||||||
IF (DYNAMIC_OPENSCENEGRAPH)
|
IF (DYNAMIC_OPENSCENEGRAPH)
|
||||||
ADD_LIBRARY(${TARGET_TARGETNAME} MODULE ${TARGET_SRC} ${TARGET_H})
|
ADD_LIBRARY(${TARGET_TARGETNAME} MODULE ${TARGET_SRC} ${TARGET_H})
|
||||||
ELSE (DYNAMIC_OPENSCENEGRAPH)
|
ELSE (DYNAMIC_OPENSCENEGRAPH)
|
||||||
ADD_LIBRARY(${TARGET_TARGETNAME} STATIC ${TARGET_SRC} ${TARGET_H})
|
ADD_LIBRARY(${TARGET_TARGETNAME} STATIC ${TARGET_SRC} ${TARGET_H})
|
||||||
ENDIF(DYNAMIC_OPENSCENEGRAPH)
|
ENDIF(DYNAMIC_OPENSCENEGRAPH)
|
||||||
|
|
||||||
#not sure if needed, but for plugins only Msvc need the d suffix
|
IF(MSVC)
|
||||||
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)
|
||||||
|
|
||||||
IF(OSG_MSVC_VERSIONED_DLL)
|
IF(OSG_MSVC_VERSIONED_DLL)
|
||||||
|
|
||||||
#this is a hack... the build place is set to lib/<debug or release> by LIBARARY_OUTPUT_PATH equal to OUTPUT_LIBDIR
|
#this is a hack... the build place is set to lib/<debug or release> by LIBARARY_OUTPUT_PATH equal to OUTPUT_LIBDIR
|
||||||
#the .lib will be crated in ../ so going straight in lib by the IMPORT_PREFIX property
|
#the .lib will be crated in ../ so going straight in lib by the IMPORT_PREFIX property
|
||||||
#because we want dll placed in OUTPUT_BINDIR ie the bin folder sibling of lib, we can use ../../bin to go there,
|
#because we want dll placed in OUTPUT_BINDIR ie the bin folder sibling of lib, we can use ../../bin to go there,
|
||||||
#it is hardcoded, we should compute OUTPUT_BINDIR position relative to OUTPUT_LIBDIR ... to be implemented
|
#it is hardcoded, we should compute OUTPUT_BINDIR position relative to OUTPUT_LIBDIR ... to be implemented
|
||||||
#changing bin to something else breaks this hack
|
#changing bin to something else breaks this hack
|
||||||
#the dll are placed in bin/${OSG_PLUGINS}
|
#the dll are placed in bin/${OSG_PLUGINS}
|
||||||
|
|
||||||
IF(NOT MSVC_IDE)
|
IF(NOT MSVC_IDE)
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../bin/${OSG_PLUGINS}/")
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../bin/${OSG_PLUGINS}/")
|
||||||
ELSE(NOT MSVC_IDE)
|
ELSE(NOT MSVC_IDE)
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../../bin/${OSG_PLUGINS}/" IMPORT_PREFIX "../")
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../../bin/${OSG_PLUGINS}/" IMPORT_PREFIX "../")
|
||||||
ENDIF(NOT MSVC_IDE)
|
ENDIF(NOT MSVC_IDE)
|
||||||
@@ -313,26 +315,31 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
|
|||||||
ENDIF(OSG_MSVC_VERSIONED_DLL)
|
ENDIF(OSG_MSVC_VERSIONED_DLL)
|
||||||
|
|
||||||
ENDIF(NOT CMAKE24)
|
ENDIF(NOT CMAKE24)
|
||||||
ENDIF(NOT MSVC)
|
ENDIF(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}
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
INSTALL(TARGETS ${TARGET_TARGETNAME}
|
INSTALL(TARGETS ${TARGET_TARGETNAME}
|
||||||
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
|
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
|
||||||
ARCHIVE DESTINATION lib/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
|
ARCHIVE DESTINATION lib/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
|
||||||
LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
|
LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
|
||||||
|
IF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||||
|
INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS RelWithDebInfo)
|
||||||
|
INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS Debug)
|
||||||
|
ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
|
||||||
ELSE(WIN32)
|
ELSE(WIN32)
|
||||||
INSTALL(TARGETS ${TARGET_TARGETNAME}
|
INSTALL(TARGETS ${TARGET_TARGETNAME}
|
||||||
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
|
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
|
||||||
ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
|
ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
|
||||||
LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
|
LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
ENDIF()
|
|
||||||
ENDMACRO(SETUP_PLUGIN)
|
ENDMACRO(SETUP_PLUGIN)
|
||||||
|
|
||||||
|
|
||||||
@@ -342,6 +349,10 @@ ENDMACRO(SETUP_PLUGIN)
|
|||||||
|
|
||||||
MACRO(SETUP_EXE IS_COMMANDLINE_APP)
|
MACRO(SETUP_EXE IS_COMMANDLINE_APP)
|
||||||
#MESSAGE("in -->SETUP_EXE<-- ${TARGET_NAME}-->${TARGET_SRC} <--> ${TARGET_H}<--")
|
#MESSAGE("in -->SETUP_EXE<-- ${TARGET_NAME}-->${TARGET_SRC} <--> ${TARGET_H}<--")
|
||||||
|
IF(GL3_FOUND)
|
||||||
|
INCLUDE_DIRECTORIES( ${GLCORE_INCLUDE_DIR} )
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT TARGET_TARGETNAME)
|
IF(NOT TARGET_TARGETNAME)
|
||||||
SET(TARGET_TARGETNAME "${TARGET_DEFAULT_PREFIX}${TARGET_NAME}")
|
SET(TARGET_TARGETNAME "${TARGET_DEFAULT_PREFIX}${TARGET_NAME}")
|
||||||
ENDIF(NOT TARGET_TARGETNAME)
|
ENDIF(NOT TARGET_TARGETNAME)
|
||||||
@@ -350,11 +361,11 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
|
|||||||
ENDIF(NOT TARGET_LABEL)
|
ENDIF(NOT TARGET_LABEL)
|
||||||
|
|
||||||
IF(${IS_COMMANDLINE_APP})
|
IF(${IS_COMMANDLINE_APP})
|
||||||
|
|
||||||
ADD_EXECUTABLE(${TARGET_TARGETNAME} ${TARGET_SRC} ${TARGET_H})
|
ADD_EXECUTABLE(${TARGET_TARGETNAME} ${TARGET_SRC} ${TARGET_H})
|
||||||
|
|
||||||
ELSE(${IS_COMMANDLINE_APP})
|
ELSE(${IS_COMMANDLINE_APP})
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
# SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION}")
|
# SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION}")
|
||||||
# Short Version is the "marketing version". It is the version
|
# Short Version is the "marketing version". It is the version
|
||||||
@@ -363,6 +374,8 @@ 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 "")
|
||||||
@@ -382,7 +395,7 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
|
|||||||
ENDIF(APPLE)
|
ENDIF(APPLE)
|
||||||
|
|
||||||
ADD_EXECUTABLE(${TARGET_TARGETNAME} ${PLATFORM_SPECIFIC_CONTROL} ${TARGET_SRC} ${TARGET_H})
|
ADD_EXECUTABLE(${TARGET_TARGETNAME} ${PLATFORM_SPECIFIC_CONTROL} ${TARGET_SRC} ${TARGET_H})
|
||||||
|
|
||||||
ENDIF(${IS_COMMANDLINE_APP})
|
ENDIF(${IS_COMMANDLINE_APP})
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
|
||||||
@@ -396,7 +409,11 @@ 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)
|
||||||
|
|
||||||
SETUP_LINK_LIBRARIES()
|
IF(APPLE)
|
||||||
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
SETUP_LINK_LIBRARIES()
|
||||||
|
|
||||||
ENDMACRO(SETUP_EXE)
|
ENDMACRO(SETUP_EXE)
|
||||||
|
|
||||||
@@ -410,15 +427,19 @@ MACRO(SETUP_APPLICATION APPLICATION_NAME)
|
|||||||
ELSE(${ARGC} GREATER 1)
|
ELSE(${ARGC} GREATER 1)
|
||||||
SET(IS_COMMANDLINE_APP 0)
|
SET(IS_COMMANDLINE_APP 0)
|
||||||
ENDIF(${ARGC} GREATER 1)
|
ENDIF(${ARGC} GREATER 1)
|
||||||
|
|
||||||
SETUP_EXE(${IS_COMMANDLINE_APP})
|
SETUP_EXE(${IS_COMMANDLINE_APP})
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Applications")
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Applications")
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin BUNDLE DESTINATION bin)
|
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin BUNDLE DESTINATION bin)
|
||||||
ELSE(APPLE)
|
ELSE(APPLE)
|
||||||
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin COMPONENT openscenegraph )
|
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin COMPONENT openscenegraph )
|
||||||
|
IF(MSVC)
|
||||||
|
INSTALL(FILES ${CMAKE_BINARY_DIR}/bin/${TARGET_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION bin COMPONENT openscenegraph CONFIGURATIONS RelWithDebInfo)
|
||||||
|
INSTALL(FILES ${CMAKE_BINARY_DIR}/bin/${TARGET_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION bin COMPONENT openscenegraph CONFIGURATIONS Debug)
|
||||||
|
ENDIF(MSVC)
|
||||||
ENDIF(APPLE)
|
ENDIF(APPLE)
|
||||||
|
|
||||||
ENDMACRO(SETUP_APPLICATION)
|
ENDMACRO(SETUP_APPLICATION)
|
||||||
@@ -439,15 +460,19 @@ MACRO(SETUP_EXAMPLE EXAMPLE_NAME)
|
|||||||
ELSE(${ARGC} GREATER 1)
|
ELSE(${ARGC} GREATER 1)
|
||||||
SET(IS_COMMANDLINE_APP 0)
|
SET(IS_COMMANDLINE_APP 0)
|
||||||
ENDIF(${ARGC} GREATER 1)
|
ENDIF(${ARGC} GREATER 1)
|
||||||
|
|
||||||
SETUP_EXE(${IS_COMMANDLINE_APP})
|
SETUP_EXE(${IS_COMMANDLINE_APP})
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Examples")
|
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Examples")
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin BUNDLE DESTINATION share/OpenSceneGraph/bin )
|
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin BUNDLE DESTINATION share/OpenSceneGraph/bin )
|
||||||
ELSE(APPLE)
|
ELSE(APPLE)
|
||||||
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples )
|
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples )
|
||||||
|
IF(MSVC)
|
||||||
|
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_TARGETNAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples CONFIGURATIONS RelWithDebInfo)
|
||||||
|
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_TARGETNAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples CONFIGURATIONS Debug)
|
||||||
|
ENDIF(MSVC)
|
||||||
ENDIF(APPLE)
|
ENDIF(APPLE)
|
||||||
|
|
||||||
ENDMACRO(SETUP_EXAMPLE)
|
ENDMACRO(SETUP_EXAMPLE)
|
||||||
@@ -483,7 +508,7 @@ MACRO(HANDLE_MSVC_DLL)
|
|||||||
ENDIF(${ARGC} GREATER 1)
|
ENDIF(${ARGC} GREATER 1)
|
||||||
|
|
||||||
SET_OUTPUT_DIR_PROPERTY_260(${LIB_NAME} "") # Ensure the /Debug /Release are removed
|
SET_OUTPUT_DIR_PROPERTY_260(${LIB_NAME} "") # Ensure the /Debug /Release are removed
|
||||||
IF(NOT MSVC_IDE)
|
IF(NOT MSVC_IDE)
|
||||||
IF (NOT CMAKE24)
|
IF (NOT CMAKE24)
|
||||||
BUILDER_VERSION_GREATER(2 8 0)
|
BUILDER_VERSION_GREATER(2 8 0)
|
||||||
IF(NOT VALID_BUILDER_VERSION)
|
IF(NOT VALID_BUILDER_VERSION)
|
||||||
@@ -516,8 +541,12 @@ MACRO(HANDLE_MSVC_DLL)
|
|||||||
ELSE (NOT CMAKE24)
|
ELSE (NOT CMAKE24)
|
||||||
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
|
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
|
||||||
ENDIF (NOT CMAKE24)
|
ENDIF (NOT CMAKE24)
|
||||||
ENDIF(NOT MSVC_IDE)
|
ENDIF(NOT MSVC_IDE)
|
||||||
|
|
||||||
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/osg${OPENSCENEGRAPH_SOVERSION}-")
|
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES 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()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ APP_PROJECT_PATH := $(call my-dir)
|
|||||||
|
|
||||||
APP_OPTIM := ${ANDROID_RELEASE_OPTIM}
|
APP_OPTIM := ${ANDROID_RELEASE_OPTIM}
|
||||||
|
|
||||||
APP_PLATFORM := ${ANDROID_PLATFORM}
|
APP_PLATFORM := android-${ANDROID_PLATFORM}
|
||||||
APP_STL := ${ANDROID_STL}
|
APP_STL := ${ANDROID_STL}
|
||||||
APP_CPPFLAGS := -fexceptions -frtti
|
APP_CPPFLAGS := -fexceptions -frtti
|
||||||
#APP_CPPFLAGS := -Os -mthumb-interwork -fno-short-enums
|
#APP_CPPFLAGS := -Os -mthumb-interwork -fno-short-enums
|
||||||
|
|||||||
1761
PlatformSpecifics/Android/android.toolchain.cmake
Normal file
1761
PlatformSpecifics/Android/android.toolchain.cmake
Normal file
File diff suppressed because it is too large
Load Diff
85
README.txt
85
README.txt
@@ -1,18 +1,14 @@
|
|||||||
Welcome to the OpenSceneGraph (OSG).
|
Welcome to the OpenSceneGraph (OSG).
|
||||||
|
|
||||||
For up-to-date information on the project, in-depth details on how to
|
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
|
http://www.openscenegraph.org/index.php/documentation
|
||||||
|
|
||||||
For support subscribe to our public mailing list:
|
|
||||||
|
|
||||||
http://www.openscenegraph.org/projects/osg/wiki/MailingLists
|
For support subscribe to our public mailing list or forum, details at:
|
||||||
|
|
||||||
or forum:
|
http://www.openscenegraph.org/index.php/support
|
||||||
|
|
||||||
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:
|
||||||
@@ -27,65 +23,64 @@ more indepth instructions.
|
|||||||
|
|
||||||
Robert Osfield.
|
Robert Osfield.
|
||||||
Project Lead.
|
Project Lead.
|
||||||
26th April 2013.
|
28th August 2017.
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
Section 1. How to build the OpenSceneGraph
|
Section 1. How to build the OpenSceneGraph
|
||||||
==========================================
|
==========================================
|
||||||
|
|
||||||
The OpenSceneGraph uses the CMake build system to generate a
|
The OpenSceneGraph uses the CMake build system to generate a
|
||||||
platform-specific build environment. CMake reads the CMakeLists.txt
|
platform-specific build environment. CMake reads the CMakeLists.txt
|
||||||
files that you'll find throughout the OpenSceneGraph directories,
|
files that you'll find throughout the OpenSceneGraph directories,
|
||||||
checks for installed dependenciesand then generates the appropriate
|
checks for installed dependenciesand then generates the appropriate
|
||||||
build system.
|
build system.
|
||||||
|
|
||||||
If you don't already have CMake installed on your system you can grab
|
If you don't already have CMake installed on your system you can grab
|
||||||
it from http://www.cmake.org, use version 2.4.6 or later. Details on the
|
it from http://www.cmake.org, use version 2.4.6 or later. Details on the
|
||||||
OpenSceneGraph's CMake build can be found at:
|
OpenSceneGraph's CMake build can be found at:
|
||||||
|
|
||||||
http://www.openscenegraph.org/projects/osg/wiki/Build/CMake
|
http://www.openscenegraph.org/projects/osg/wiki/Build/CMake
|
||||||
|
|
||||||
Under unices (i.e. Linux, IRIX, Solaris, Free-BSD, HP-Ux, AIX, OSX)
|
Under unices (i.e. Linux, IRIX, Solaris, Free-BSD, HP-Ux, AIX, OSX)
|
||||||
use the cmake or ccmake command-line utils, or use the included tiny
|
use the cmake or ccmake command-line utils. Note that cmake . defaults
|
||||||
configure script that'll run cmake for you. The configure script
|
to building Release to ensure that you get the best performance from
|
||||||
simply runs 'cmake . -DCMAKE_BUILD_TYPE=Release' to ensure that you
|
your final libraries/applications.
|
||||||
get the best performance from your final libraries/applications.
|
|
||||||
|
|
||||||
cd OpenSceneGraph
|
cd OpenSceneGraph
|
||||||
./configure
|
cmake .
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
Alternatively, you can create an out-of-source build directory and run
|
Alternatively, you can create an out-of-source build directory and run
|
||||||
cmake or ccmake from there. The advantage to this approach is that the
|
cmake or ccmake from there. The advantage to this approach is that the
|
||||||
temporary files created by CMake won't clutter the OpenSceneGraph
|
temporary files created by CMake won't clutter the OpenSceneGraph
|
||||||
source directory, and also makes it possible to have multiple
|
source directory, and also makes it possible to have multiple
|
||||||
independent build targets by creating multiple build directories. In a
|
independent build targets by creating multiple build directories. In a
|
||||||
directory alongside the OpenSceneGraph use:
|
directory alongside the OpenSceneGraph use:
|
||||||
|
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake ../OpenSceneGraph -DCMAKE_BUILD_TYPE=Release
|
cmake ../OpenSceneGraph
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
Under Windows use the GUI tool CMakeSetup to build your VisualStudio
|
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/projects/osg/wiki/Support/PlatformSpecifics/VisualStudio
|
http://www.openscenegraph.org/index.php/documentation/platform-specifics/windows
|
||||||
|
|
||||||
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
|
||||||
directory. See release notes on OSX CMake build below.
|
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/projects/osg/wiki/Support/GettingStarted
|
http://www.openscenegraph.org/index.php/documentation/10-getting-started
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
=========================================================================
|
=========================================================================
|
||||||
|
|
||||||
@@ -169,11 +164,11 @@ Section 3. Release notes on iOS build, by Thomas Hoghart
|
|||||||
* Check that CMAKE_OSX_ARCHITECTURE is i386 for the simulator or armv6;armv7 for the device
|
* Check that CMAKE_OSX_ARCHITECTURE is i386 for the simulator or armv6;armv7 for the device
|
||||||
* Disable DYNAMIC_OPENSCENEGRAPH, DYNAMIC_OPENTHREADS
|
* Disable DYNAMIC_OPENSCENEGRAPH, DYNAMIC_OPENTHREADS
|
||||||
This will give us the static build we need for iPhone.
|
This will give us the static build we need for iPhone.
|
||||||
* Disable OSG_GL1_AVAILABLE, OSG_GL2_AVAILABLE, OSG_GL3_AVAILABLE,
|
* Disable OSG_GL1_AVAILABLE, OSG_GL2_AVAILABLE, OSG_GL3_AVAILABLE,
|
||||||
OSG_GL_DISPLAYLISTS_AVAILABLE, OSG_GL_VERTEX_FUNCS_AVAILABLE
|
OSG_GL_DISPLAYLISTS_AVAILABLE, OSG_GL_VERTEX_FUNCS_AVAILABLE
|
||||||
* Enable OSG_GLES1_AVAILABLE *OR* OSG_GLES2_AVAILABLE
|
* Enable OSG_GLES1_AVAILABLE *OR* OSG_GLES2_AVAILABLE *OR* OSG_GLES3_AVAILABLE (GLES3 will enable GLES2 features)
|
||||||
* Ensure OSG_WINDOWING_SYSTEM is set to IOS
|
* Ensure OSG_WINDOWING_SYSTEM is set to IOS
|
||||||
* Change FREETYPE include and library paths to an iPhone version
|
* Change FREETYPE include and library paths to an iPhone version
|
||||||
(OpenFrameworks has one bundled with its distribution)
|
(OpenFrameworks has one bundled with its distribution)
|
||||||
* Ensure that CMake_OSX_SYSROOT points to your iOS SDK.
|
* Ensure that CMake_OSX_SYSROOT points to your iOS SDK.
|
||||||
* Generate the Xcode project
|
* Generate the Xcode project
|
||||||
@@ -206,9 +201,9 @@ $ cmake -G Xcode \
|
|||||||
|
|
||||||
|
|
||||||
Known issues:
|
Known issues:
|
||||||
* When Linking final app against ive plugin, you need to add -lz to
|
* When Linking final app against ive plugin, you need to add -lz to
|
||||||
the 'Other linker flags' list.
|
the 'Other linker flags' list.
|
||||||
* Apps and exes don't get created
|
* Apps and exes don't get created
|
||||||
* You can only select Simulator, or Device projects. In the XCode
|
* You can only select Simulator, or Device projects. In the XCode
|
||||||
project you will see both types but the sdk they link will
|
project you will see both types but the sdk they link will
|
||||||
be the same.
|
be the same.
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This application is open source and may be redistributed and/or modified
|
* This application is open source and may be redistributed and/or modified
|
||||||
* freely and without restriction, both in commercial and non commercial applications,
|
* freely and without restriction, both in commercial and non commercial applications,
|
||||||
* as long as this copyright notice is maintained.
|
* as long as this copyright notice is maintained.
|
||||||
*
|
*
|
||||||
* This application is distributed in the hope that it will be useful,
|
* This application is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
@@ -26,12 +26,12 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an application for collecting a set of separate files into a single archive file that can be later read in OSG applications..");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an application for collecting a set of separate files into a single archive file that can be later read in OSG applications..");
|
||||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
||||||
|
|
||||||
// if user request help write it out to cout.
|
// if user request help write it out to cout.
|
||||||
if (arguments.read("-h") || arguments.read("--help"))
|
if (arguments.read("-h") || arguments.read("--help"))
|
||||||
{
|
{
|
||||||
@@ -49,14 +49,14 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
insert = true;
|
insert = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool extract = false;
|
bool extract = false;
|
||||||
while (arguments.read("-e") || arguments.read("--extract"))
|
while (arguments.read("-e") || arguments.read("--extract"))
|
||||||
{
|
{
|
||||||
extract = true;
|
extract = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool list = false;
|
bool list = false;
|
||||||
while (arguments.read("-l") || arguments.read("--list"))
|
while (arguments.read("-l") || arguments.read("--list"))
|
||||||
{
|
{
|
||||||
list = true;
|
list = true;
|
||||||
@@ -93,7 +93,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// any option left unread are converted into errors to write out later.
|
// any option left unread are converted into errors to write out later.
|
||||||
arguments.reportRemainingOptionsAsUnrecognized();
|
arguments.reportRemainingOptionsAsUnrecognized();
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ int main( int argc, char **argv )
|
|||||||
arguments.writeErrorMessages(std::cout);
|
arguments.writeErrorMessages(std::cout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (archiveFilename.empty())
|
if (archiveFilename.empty())
|
||||||
{
|
{
|
||||||
std::cout<<"Please specify an archive name using --archive filename"<<std::endl;
|
std::cout<<"Please specify an archive name using --archive filename"<<std::endl;
|
||||||
@@ -115,7 +115,7 @@ int main( int argc, char **argv )
|
|||||||
std::cout<<"Please specify an operation on the archive, either --insert, --extract or --list"<<std::endl;
|
std::cout<<"Please specify an operation on the archive, either --insert, --extract or --list"<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (insert && extract)
|
if (insert && extract)
|
||||||
{
|
{
|
||||||
std::cout<<"Cannot insert and extract files from the archive at one time, please use either --insert or --extract."<<std::endl;
|
std::cout<<"Cannot insert and extract files from the archive at one time, please use either --insert or --extract."<<std::endl;
|
||||||
@@ -127,7 +127,7 @@ int main( int argc, char **argv )
|
|||||||
if (insert)
|
if (insert)
|
||||||
{
|
{
|
||||||
archive = osgDB::openArchive(archiveFilename, osgDB::Archive::WRITE);
|
archive = osgDB::openArchive(archiveFilename, osgDB::Archive::WRITE);
|
||||||
|
|
||||||
if (archive.valid())
|
if (archive.valid())
|
||||||
{
|
{
|
||||||
for (FileNameList::iterator itr=files.begin();
|
for (FileNameList::iterator itr=files.begin();
|
||||||
@@ -135,7 +135,7 @@ int main( int argc, char **argv )
|
|||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
std::cout<<"reading "<<*itr<<std::endl;
|
std::cout<<"reading "<<*itr<<std::endl;
|
||||||
osg::ref_ptr<osg::Object> obj = osgDB::readObjectFile(*itr);
|
osg::ref_ptr<osg::Object> obj = osgDB::readRefObjectFile(*itr);
|
||||||
if (obj.valid())
|
if (obj.valid())
|
||||||
{
|
{
|
||||||
std::cout<<" write to archive "<<*itr<<std::endl;
|
std::cout<<" write to archive "<<*itr<<std::endl;
|
||||||
@@ -152,10 +152,10 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
archive = osgDB::openArchive(archiveFilename, osgDB::Archive::READ);
|
archive = osgDB::openArchive(archiveFilename, osgDB::Archive::READ);
|
||||||
|
|
||||||
if (extract && archive.valid())
|
if (extract && archive.valid())
|
||||||
{
|
{
|
||||||
for (FileNameList::iterator itr=files.begin();
|
for (FileNameList::iterator itr=files.begin();
|
||||||
@@ -175,7 +175,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (list && archive.valid())
|
if (list && archive.valid())
|
||||||
{
|
{
|
||||||
std::cout<<"List of files in archive:"<<std::endl;
|
std::cout<<"List of files in archive:"<<std::endl;
|
||||||
osgDB::Archive::FileNameList fileNames;
|
osgDB::Archive::FileNameList fileNames;
|
||||||
if (archive->getFileNames(fileNames))
|
if (archive->getFileNames(fileNames))
|
||||||
@@ -187,11 +187,11 @@ int main( int argc, char **argv )
|
|||||||
std::cout<<" "<<*itr<<std::endl;
|
std::cout<<" "<<*itr<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout<<std::endl;
|
std::cout<<std::endl;
|
||||||
std::cout<<"Master file "<<archive->getMasterFileName()<<std::endl;
|
std::cout<<"Master file "<<archive->getMasterFileName()<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::State> state = new osg::State;
|
osg::ref_ptr<osg::State> state = new osg::State;
|
||||||
|
state->initializeExtensionProcs();
|
||||||
|
|
||||||
for(TextureSet::iterator itr=_textureSet.begin();
|
for(TextureSet::iterator itr=_textureSet.begin();
|
||||||
itr!=_textureSet.end();
|
itr!=_textureSet.end();
|
||||||
@@ -174,7 +175,7 @@ public:
|
|||||||
{
|
{
|
||||||
texture->setInternalFormatMode(_internalFormatMode);
|
texture->setInternalFormatMode(_internalFormatMode);
|
||||||
|
|
||||||
// need to disable the unref after apply, other the image could go out of scope.
|
// need to disable the unref after apply, otherwise the image could go out of scope.
|
||||||
bool unrefImageDataAfterApply = texture->getUnRefImageDataAfterApply();
|
bool unrefImageDataAfterApply = texture->getUnRefImageDataAfterApply();
|
||||||
texture->setUnRefImageDataAfterApply(false);
|
texture->setUnRefImageDataAfterApply(false);
|
||||||
|
|
||||||
@@ -373,16 +374,6 @@ public:
|
|||||||
++_numStateSetRemoved;
|
++_numStateSetRemoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(unsigned int i=0;i<node.getNumDrawables();++i)
|
|
||||||
{
|
|
||||||
osg::Drawable* drawable = node.getDrawable(i);
|
|
||||||
if (drawable && drawable->getStateSet())
|
|
||||||
{
|
|
||||||
drawable->setStateSet(0);
|
|
||||||
++_numStateSetRemoved;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
traverse(node);
|
traverse(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -557,6 +548,7 @@ 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;
|
||||||
@@ -780,7 +772,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
osg::Timer_t startTick = osg::Timer::instance()->tick();
|
osg::Timer_t startTick = osg::Timer::instance()->tick();
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> root = osgDB::readNodeFiles(fileNames);
|
osg::ref_ptr<osg::Node> root = osgDB::readRefNodeFiles(fileNames);
|
||||||
|
|
||||||
if (root.valid())
|
if (root.valid())
|
||||||
{
|
{
|
||||||
@@ -816,7 +808,7 @@ int main( int argc, char **argv )
|
|||||||
root->accept(av);
|
root->accept(av);
|
||||||
}
|
}
|
||||||
|
|
||||||
// optimize the scene graph, remove rendundent nodes and state etc.
|
// optimize the scene graph, remove redundant nodes and state etc.
|
||||||
osgUtil::Optimizer optimizer;
|
osgUtil::Optimizer optimizer;
|
||||||
optimizer.optimize(root.get());
|
optimizer.optimize(root.get());
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This application is open source and may be redistributed and/or modified
|
* This application is open source and may be redistributed and/or modified
|
||||||
* freely and without restriction, both in commercial and non commercial applications,
|
* freely and without restriction, both in commercial and non commercial applications,
|
||||||
* as long as this copyright notice is maintained.
|
* as long as this copyright notice is maintained.
|
||||||
*
|
*
|
||||||
* This application is distributed in the hope that it will be useful,
|
* This application is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
@@ -46,20 +46,20 @@ struct Extents
|
|||||||
_maxLevel(maxLevel),
|
_maxLevel(maxLevel),
|
||||||
_min(minX, minY),
|
_min(minX, minY),
|
||||||
_max(maxX, maxY) {}
|
_max(maxX, maxY) {}
|
||||||
|
|
||||||
Extents(const Extents& extents):
|
Extents(const Extents& extents):
|
||||||
_maxLevel(extents._maxLevel),
|
_maxLevel(extents._maxLevel),
|
||||||
_min(extents._min),
|
_min(extents._min),
|
||||||
_max(extents._max) {}
|
_max(extents._max) {}
|
||||||
|
|
||||||
Extents& operator = (const Extents& rhs)
|
Extents& operator = (const Extents& rhs)
|
||||||
{
|
{
|
||||||
if (&rhs == this) return *this;
|
if (&rhs == this) return *this;
|
||||||
|
|
||||||
_maxLevel = rhs._maxLevel;
|
_maxLevel = rhs._maxLevel;
|
||||||
_min = rhs._min;
|
_min = rhs._min;
|
||||||
_max = rhs._max;
|
_max = rhs._max;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,10 +69,10 @@ struct Extents
|
|||||||
osg::notify(osg::INFO)<<" _maxLevel="<<_maxLevel<<", _min="<<_min<<" _max="<<_max<<std::endl;
|
osg::notify(osg::INFO)<<" _maxLevel="<<_maxLevel<<", _min="<<_min<<" _max="<<_max<<std::endl;
|
||||||
|
|
||||||
if (level>_maxLevel) return false;
|
if (level>_maxLevel) return false;
|
||||||
|
|
||||||
osg::Vec2d union_min, union_max;
|
osg::Vec2d union_min, union_max;
|
||||||
|
|
||||||
// handle mins
|
// handle mins
|
||||||
if (_min.x()!=DBL_MAX && in_min.x()!=DBL_MAX)
|
if (_min.x()!=DBL_MAX && in_min.x()!=DBL_MAX)
|
||||||
{
|
{
|
||||||
// both _min.x() and in_min.x() are defined so use max of two
|
// both _min.x() and in_min.x() are defined so use max of two
|
||||||
@@ -95,7 +95,7 @@ struct Extents
|
|||||||
union_min.y() = _min.y()<in_min.y() ? _min.y() : in_min.y();
|
union_min.y() = _min.y()<in_min.y() ? _min.y() : in_min.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle maxs
|
// handle maxs
|
||||||
if (_max.x()!=-DBL_MAX && in_max.x()!=-DBL_MAX)
|
if (_max.x()!=-DBL_MAX && in_max.x()!=-DBL_MAX)
|
||||||
{
|
{
|
||||||
// both _max.x() and in_max.x() are defined so use max of two
|
// both _max.x() and in_max.x() are defined so use max of two
|
||||||
@@ -121,7 +121,7 @@ struct Extents
|
|||||||
bool result = union_min.x()<union_max.x() && union_min.y()<union_max.y() ;
|
bool result = union_min.x()<union_max.x() && union_min.y()<union_max.y() ;
|
||||||
|
|
||||||
osg::notify(osg::INFO)<<" union_min="<<union_min<<" union_max="<<union_max<<" result = "<<result<<std::endl;
|
osg::notify(osg::INFO)<<" union_min="<<union_min<<" union_max="<<union_max<<" result = "<<result<<std::endl;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ public:
|
|||||||
_currentLevel(0) {}
|
_currentLevel(0) {}
|
||||||
|
|
||||||
void setFileCache(osgDB::FileCache* fileCache) { _fileCache = fileCache; }
|
void setFileCache(osgDB::FileCache* fileCache) { _fileCache = fileCache; }
|
||||||
|
|
||||||
void addExtents(unsigned int maxLevel, double minX, double minY, double maxX, double maxY)
|
void addExtents(unsigned int maxLevel, double minX, double minY, double maxX, double maxY)
|
||||||
{
|
{
|
||||||
_extentsList.push_back(Extents(maxLevel, minX, minY, maxX, maxY));
|
_extentsList.push_back(Extents(maxLevel, minX, minY, maxX, maxY));
|
||||||
@@ -154,16 +154,16 @@ public:
|
|||||||
void apply(osg::CoordinateSystemNode& cs)
|
void apply(osg::CoordinateSystemNode& cs)
|
||||||
{
|
{
|
||||||
_csnStack.push_back(&cs);
|
_csnStack.push_back(&cs);
|
||||||
|
|
||||||
if (!s_ExitApplication) traverse(cs);
|
if (!s_ExitApplication) traverse(cs);
|
||||||
|
|
||||||
_csnStack.pop_back();
|
_csnStack.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply(osg::Group& group)
|
void apply(osg::Group& group)
|
||||||
{
|
{
|
||||||
if (s_ExitApplication) return;
|
if (s_ExitApplication) return;
|
||||||
|
|
||||||
osgTerrain::TerrainTile* terrainTile = dynamic_cast<osgTerrain::TerrainTile*>(&group);
|
osgTerrain::TerrainTile* terrainTile = dynamic_cast<osgTerrain::TerrainTile*>(&group);
|
||||||
osgTerrain::Locator* locator = terrainTile ? terrainTile->getLocator() : 0;
|
osgTerrain::Locator* locator = terrainTile ? terrainTile->getLocator() : 0;
|
||||||
if (locator)
|
if (locator)
|
||||||
@@ -196,7 +196,7 @@ public:
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
traverse(group);
|
traverse(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,11 +217,11 @@ public:
|
|||||||
void apply(osg::PagedLOD& plod)
|
void apply(osg::PagedLOD& plod)
|
||||||
{
|
{
|
||||||
if (s_ExitApplication) return;
|
if (s_ExitApplication) return;
|
||||||
|
|
||||||
++_currentLevel;
|
++_currentLevel;
|
||||||
|
|
||||||
initBound();
|
initBound();
|
||||||
|
|
||||||
// first compute the bounds of this subgraph
|
// first compute the bounds of this subgraph
|
||||||
for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
|
for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
|
||||||
{
|
{
|
||||||
@@ -230,7 +230,7 @@ public:
|
|||||||
traverse(plod);
|
traverse(plod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intersects())
|
if (intersects())
|
||||||
{
|
{
|
||||||
for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
|
for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
|
||||||
@@ -239,7 +239,7 @@ public:
|
|||||||
if (!plod.getFileName(i).empty())
|
if (!plod.getFileName(i).empty())
|
||||||
{
|
{
|
||||||
std::string filename;
|
std::string filename;
|
||||||
if (!plod.getDatabasePath().empty())
|
if (!plod.getDatabasePath().empty())
|
||||||
{
|
{
|
||||||
filename = plod.getDatabasePath() + plod.getFileName(i);
|
filename = plod.getDatabasePath() + plod.getFileName(i);
|
||||||
}
|
}
|
||||||
@@ -255,10 +255,10 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
--_currentLevel;
|
--_currentLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply(osg::Geode& geode)
|
void apply(osg::Geode& geode)
|
||||||
{
|
{
|
||||||
for(unsigned int i=0; i<geode.getNumDrawables(); ++i)
|
for(unsigned int i=0; i<geode.getNumDrawables(); ++i)
|
||||||
@@ -271,10 +271,10 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node* readNodeFileAndWriteToCache(const std::string& filename)
|
osg::ref_ptr<osg::Node> readNodeFileAndWriteToCache(const std::string& filename)
|
||||||
{
|
{
|
||||||
osg::Node* node = 0;
|
osg::ref_ptr<osg::Node> node = 0;
|
||||||
if (_fileCache.valid() )
|
if (_fileCache.valid() )
|
||||||
{
|
{
|
||||||
if (_fileCache->existsInCache(filename))
|
if (_fileCache->existsInCache(filename))
|
||||||
@@ -286,7 +286,7 @@ public:
|
|||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
|
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
|
||||||
|
|
||||||
node = osgDB::readNodeFile(filename);
|
node = osgDB::readRefNodeFile(filename);
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"write to FileCache : "<<filename<<std::endl;
|
osg::notify(osg::NOTICE)<<"write to FileCache : "<<filename<<std::endl;
|
||||||
@@ -298,7 +298,7 @@ public:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
|
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
|
||||||
node = osgDB::readNodeFile(filename);
|
node = osgDB::readRefNodeFile(filename);
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
@@ -307,18 +307,18 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
inline void pushMatrix(osg::Matrix& matrix) { _matrixStack.push_back(matrix); }
|
inline void pushMatrix(osg::Matrix& matrix) { _matrixStack.push_back(matrix); }
|
||||||
|
|
||||||
inline void popMatrix() { _matrixStack.pop_back(); }
|
inline void popMatrix() { _matrixStack.pop_back(); }
|
||||||
|
|
||||||
void convertXYZToLatLongHeight(osg::EllipsoidModel* em, osg::Vec3d& v)
|
void convertXYZToLatLongHeight(osg::EllipsoidModel* em, osg::Vec3d& v)
|
||||||
{
|
{
|
||||||
em->convertXYZToLatLongHeight(v.x(), v.y(), v.z(),
|
em->convertXYZToLatLongHeight(v.x(), v.y(), v.z(),
|
||||||
v.y(), v.x(), v.z());
|
v.y(), v.x(), v.z());
|
||||||
|
|
||||||
v.x() = osg::RadiansToDegrees(v.x());
|
v.x() = osg::RadiansToDegrees(v.x());
|
||||||
v.y() = osg::RadiansToDegrees(v.y());
|
v.y() = osg::RadiansToDegrees(v.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
void initBound()
|
void initBound()
|
||||||
{
|
{
|
||||||
_min.set(DBL_MAX, DBL_MAX);
|
_min.set(DBL_MAX, DBL_MAX);
|
||||||
@@ -332,16 +332,16 @@ protected:
|
|||||||
if (v.x() > _max.x()) _max.x() = v.x();
|
if (v.x() > _max.x()) _max.x() = v.x();
|
||||||
if (v.y() > _max.y()) _max.y() = v.y();
|
if (v.y() > _max.y()) _max.y() = v.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateBound(osg::Vec3Array& vertices)
|
void updateBound(osg::Vec3Array& vertices)
|
||||||
{
|
{
|
||||||
// set up matrix
|
// set up matrix
|
||||||
osg::Matrix matrix;
|
osg::Matrix matrix;
|
||||||
if (!_matrixStack.empty()) matrix = _matrixStack.back();
|
if (!_matrixStack.empty()) matrix = _matrixStack.back();
|
||||||
|
|
||||||
// set up ellipsoid model
|
// set up ellipsoid model
|
||||||
osg::EllipsoidModel* em = !_csnStack.empty() ? _csnStack.back()->getEllipsoidModel() : 0;
|
osg::EllipsoidModel* em = !_csnStack.empty() ? _csnStack.back()->getEllipsoidModel() : 0;
|
||||||
|
|
||||||
for(osg::Vec3Array::iterator itr = vertices.begin();
|
for(osg::Vec3Array::iterator itr = vertices.begin();
|
||||||
itr != vertices.end();
|
itr != vertices.end();
|
||||||
++itr)
|
++itr)
|
||||||
@@ -352,7 +352,7 @@ protected:
|
|||||||
updateBound(v);
|
updateBound(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool intersects()
|
bool intersects()
|
||||||
{
|
{
|
||||||
osg::notify(osg::INFO)<<"intersects() _min = "<<_min<<" _max = "<<_max<<std::endl;
|
osg::notify(osg::INFO)<<"intersects() _min = "<<_min<<" _max = "<<_max<<std::endl;
|
||||||
@@ -362,7 +362,7 @@ protected:
|
|||||||
{
|
{
|
||||||
if (itr->intersects(_currentLevel, _min, _max)) return true;
|
if (itr->intersects(_currentLevel, _min, _max)) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ protected:
|
|||||||
unsigned int _currentLevel;
|
unsigned int _currentLevel;
|
||||||
MatrixStack _matrixStack;
|
MatrixStack _matrixStack;
|
||||||
CSNStack _csnStack;
|
CSNStack _csnStack;
|
||||||
|
|
||||||
osg::Vec2d _min;
|
osg::Vec2d _min;
|
||||||
osg::Vec2d _max;
|
osg::Vec2d _max;
|
||||||
};
|
};
|
||||||
@@ -403,7 +403,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an application for collecting a set of separate files into a single archive file that can be later read in OSG applications..");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an application for collecting a set of separate files into a single archive file that can be later read in OSG applications..");
|
||||||
@@ -412,21 +412,21 @@ int main( int argc, char **argv )
|
|||||||
arguments.getApplicationUsage()->addCommandLineOption("-e level minX minY maxX maxY","Read down to <level> across the extents minX, minY to maxY, maxY. Note, for geocentric datase X and Y are longitude and latitude respectively.");
|
arguments.getApplicationUsage()->addCommandLineOption("-e level minX minY maxX maxY","Read down to <level> across the extents minX, minY to maxY, maxY. Note, for geocentric datase X and Y are longitude and latitude respectively.");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-c directory","Shorthand for --file-cache directory.");
|
arguments.getApplicationUsage()->addCommandLineOption("-c directory","Shorthand for --file-cache directory.");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--file-cache directory","Set directory as to place cache download files.");
|
arguments.getApplicationUsage()->addCommandLineOption("--file-cache directory","Set directory as to place cache download files.");
|
||||||
|
|
||||||
// if user request help write it out to cout.
|
// if user request help write it out to cout.
|
||||||
if (arguments.read("-h") || arguments.read("--help"))
|
if (arguments.read("-h") || arguments.read("--help"))
|
||||||
{
|
{
|
||||||
arguments.getApplicationUsage()->write(std::cout);
|
arguments.getApplicationUsage()->write(std::cout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadDataVisitor ldv;
|
LoadDataVisitor ldv;
|
||||||
|
|
||||||
std::string fileCachePath;
|
std::string fileCachePath;
|
||||||
while(arguments.read("--file-cache",fileCachePath) || arguments.read("-c",fileCachePath)) {}
|
while(arguments.read("--file-cache",fileCachePath) || arguments.read("-c",fileCachePath)) {}
|
||||||
|
|
||||||
if (fileCachePath.empty())
|
if (fileCachePath.empty())
|
||||||
{
|
{
|
||||||
const char* env_fileCachePath = getenv("OSG_FILE_CACHE");
|
const char* env_fileCachePath = getenv("OSG_FILE_CACHE");
|
||||||
if (env_fileCachePath)
|
if (env_fileCachePath)
|
||||||
{
|
{
|
||||||
@@ -439,7 +439,7 @@ int main( int argc, char **argv )
|
|||||||
std::cout<<"No path to the file cache defined, please set OSG_FILE_PATH env var, or use --file-cache <directory> to set a suitable directory for the file cache."<<std::endl;
|
std::cout<<"No path to the file cache defined, please set OSG_FILE_PATH env var, or use --file-cache <directory> to set a suitable directory for the file cache."<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ldv.setFileCache(new osgDB::FileCache(fileCachePath));
|
ldv.setFileCache(new osgDB::FileCache(fileCachePath));
|
||||||
|
|
||||||
unsigned int maxLevels = 0;
|
unsigned int maxLevels = 0;
|
||||||
@@ -447,14 +447,14 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
ldv.addExtents(maxLevels);
|
ldv.addExtents(maxLevels);
|
||||||
}
|
}
|
||||||
|
|
||||||
double minX, maxX, minY, maxY;
|
double minX, maxX, minY, maxY;
|
||||||
while(arguments.read("-e",maxLevels, minX, minY, maxX, maxY))
|
while(arguments.read("-e",maxLevels, minX, minY, maxX, maxY))
|
||||||
{
|
{
|
||||||
ldv.addExtents(maxLevels, minX, minY, maxX, maxY);
|
ldv.addExtents(maxLevels, minX, minY, maxX, maxY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string filename;
|
std::string filename;
|
||||||
for(int i=1; i<arguments.argc(); ++i)
|
for(int i=1; i<arguments.argc(); ++i)
|
||||||
{
|
{
|
||||||
@@ -464,21 +464,21 @@ int main( int argc, char **argv )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filename.empty())
|
if (filename.empty())
|
||||||
{
|
{
|
||||||
std::cout<<"No file to load specified."<<std::endl;
|
std::cout<<"No file to load specified."<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> loadedModel = ldv.readNodeFileAndWriteToCache(filename);
|
osg::ref_ptr<osg::Node> loadedModel = ldv.readNodeFileAndWriteToCache(filename);
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout<<"No data loaded, please specify a database to load"<<std::endl;
|
std::cout<<"No data loaded, please specify a database to load"<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
loadedModel->accept(ldv);
|
loadedModel->accept(ldv);
|
||||||
|
|
||||||
if (s_ExitApplication)
|
if (s_ExitApplication)
|
||||||
|
|||||||
@@ -254,7 +254,28 @@ const char* invalidNames[] =
|
|||||||
"GraphicsContext*",
|
"GraphicsContext*",
|
||||||
"Apple",
|
"Apple",
|
||||||
"GeometryNew",
|
"GeometryNew",
|
||||||
"FrameBufferObject"
|
"FrameBufferObject",
|
||||||
|
"Lua",
|
||||||
|
"VolumeTile",
|
||||||
|
"PushStackValueVisitor",
|
||||||
|
"RayIntersector",
|
||||||
|
"OpenSceneGraph-Data",
|
||||||
|
"Node",
|
||||||
|
"AlphaFunc",
|
||||||
|
"CompositeViewer",
|
||||||
|
"OpenSceneGraph-3",
|
||||||
|
"DisplaySettings::SHADER_NONE",
|
||||||
|
"CodeDocs",
|
||||||
|
"Mon",
|
||||||
|
"Tue",
|
||||||
|
"Wed",
|
||||||
|
"Fri",
|
||||||
|
"Sat",
|
||||||
|
"Sun",
|
||||||
|
"I",
|
||||||
|
"TriangleFunctor",
|
||||||
|
"PrimitiveFunctor",
|
||||||
|
"OpenMW"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -347,6 +368,7 @@ 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"},
|
||||||
@@ -454,7 +476,31 @@ TypoCorrection typoCorrections[] =
|
|||||||
{"Eskland","Ekstrand"},
|
{"Eskland","Ekstrand"},
|
||||||
{"Baeuerele","Baeuerle"},
|
{"Baeuerele","Baeuerle"},
|
||||||
{"Bauerle","Baeuerle"},
|
{"Bauerle","Baeuerle"},
|
||||||
{"Baeurele","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"},
|
||||||
|
{"Dannahauer","Dannahauer"},
|
||||||
|
{"Sando","Sandro"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -468,6 +514,16 @@ struct NameCorrection
|
|||||||
|
|
||||||
NameCorrection nameCorrections[] =
|
NameCorrection nameCorrections[] =
|
||||||
{
|
{
|
||||||
|
{"LaurensVoerman","Meta_Shape",
|
||||||
|
"Laurens", "Voerman"},
|
||||||
|
{"LaurensVoerman","OpenCascade",
|
||||||
|
"Laurens", "Voerman"},
|
||||||
|
{"LaurensVoerman","Fri",
|
||||||
|
"Laurens", "Voerman"},
|
||||||
|
{"LaurensVoerman","",
|
||||||
|
"Laurens", "Voerman"},
|
||||||
|
{"Laurens","Loerman",
|
||||||
|
"Laurens", "Voerman"},
|
||||||
{"FrancoisTigeot","",
|
{"FrancoisTigeot","",
|
||||||
"Francois", "Tigeot"},
|
"Francois", "Tigeot"},
|
||||||
{"Juan","Manuel",
|
{"Juan","Manuel",
|
||||||
@@ -562,6 +618,8 @@ 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",
|
||||||
@@ -594,6 +652,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", "Motto",
|
||||||
@@ -619,7 +679,27 @@ NameCorrection nameCorrections[] =
|
|||||||
{"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"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -951,7 +1031,9 @@ 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 << " " << sitr->second.second << endl;
|
cout << sitr->first << "\t" << sitr->second.first;
|
||||||
|
if (!sitr->second.second.empty()) cout << " " << sitr->second.second;
|
||||||
|
cout << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -960,7 +1042,9 @@ 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 << " " << sitr->second.second << endl;
|
cout << sitr->second.first;
|
||||||
|
if (!sitr->second.second.empty()) cout << " " << sitr->second.second;
|
||||||
|
cout << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// The majority of the application is dedicated to building the
|
// The majority of the application is dedicated to building the
|
||||||
// current contribitors list by parsing the ChangeLog, it just takes
|
// current contributors list by parsing the ChangeLog, it just takes
|
||||||
// one line in the main itself to report the version number.
|
// one line in the main itself to report the version number.
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <osg/CoordinateSystemNode>
|
#include <osg/CoordinateSystemNode>
|
||||||
|
|
||||||
#include <osg/Switch>
|
#include <osg/Switch>
|
||||||
|
#include <osg/Types>
|
||||||
#include <osgText/Text>
|
#include <osgText/Text>
|
||||||
|
|
||||||
#include <osgViewer/Viewer>
|
#include <osgViewer/Viewer>
|
||||||
@@ -32,111 +33,6 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#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)
|
||||||
{
|
{
|
||||||
@@ -187,14 +83,14 @@ int main(int argc, char** argv)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string device;
|
std::string device;
|
||||||
while(arguments.read("--device", device))
|
while(arguments.read("--device", device))
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device);
|
osg::ref_ptr<osgGA::Device> dev = osgDB::readRefFile<osgGA::Device>(device);
|
||||||
if (dev.valid())
|
if (dev.valid())
|
||||||
{
|
{
|
||||||
viewer.addDevice(dev.get());
|
viewer.addDevice(dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,8 +127,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()) );
|
||||||
|
|
||||||
@@ -258,7 +152,7 @@ int main(int argc, char** argv)
|
|||||||
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
|
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
|
||||||
|
|
||||||
// load the data
|
// load the data
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
@@ -278,24 +172,12 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
// optimize the scene graph, remove redundant nodes and state etc.
|
// optimize the scene graph, remove redundant nodes and state etc.
|
||||||
osgUtil::Optimizer optimizer;
|
osgUtil::Optimizer optimizer;
|
||||||
optimizer.optimize(loadedModel.get());
|
optimizer.optimize(loadedModel);
|
||||||
|
|
||||||
viewer.setSceneData( loadedModel.get() );
|
viewer.setSceneData(loadedModel);
|
||||||
|
|
||||||
viewer.realize();
|
viewer.realize();
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ IF (NOT DYNAMIC_OPENSCENEGRAPH)
|
|||||||
osgdb_openflight
|
osgdb_openflight
|
||||||
osgdb_obj
|
osgdb_obj
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES}
|
SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES}
|
||||||
osgdb_deprecated_osg osgdb_deprecated_osgparticle osgdb_deprecated_osganimation
|
osgdb_deprecated_osg osgdb_deprecated_osgparticle osgdb_deprecated_osganimation
|
||||||
osgdb_deprecated_osgfx osgdb_deprecated_osgsim osgdb_deprecated_osgtext
|
osgdb_deprecated_osgfx osgdb_deprecated_osgsim osgdb_deprecated_osgtext
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This software is open source and may be redistributed and/or modified under
|
* This software is open source and may be redistributed and/or modified under
|
||||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||||
* The full license is in LICENSE.txt file included with this distribution,.
|
* The full license is in LICENSE.txt file included with this distribution,.
|
||||||
*
|
*
|
||||||
* This software is distributed in the hope that it will be useful,
|
* This software is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* include LICENSE.txt for more details.
|
* include LICENSE.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -33,15 +33,17 @@
|
|||||||
#if defined(__linux)
|
#if defined(__linux)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <linux/sockios.h>
|
#include <linux/sockios.h>
|
||||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
#elif defined(__sgi)
|
#elif defined(__sgi)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <net/soioctl.h>
|
#include <net/soioctl.h>
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#elif defined(__sun)
|
#elif defined (__GNU__)
|
||||||
|
#include <unistd.h>
|
||||||
|
#elif defined(__sun)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
#elif defined (__APPLE__)
|
#elif defined (__APPLE__)
|
||||||
@@ -202,7 +204,8 @@ void DataConverter::write(CameraPacket& cameraPacket)
|
|||||||
itr != cameraPacket._events.end();
|
itr != cameraPacket._events.end();
|
||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
write(*(*itr));
|
osgGA::GUIEventAdapter* event = (*itr)->asGUIEventAdapter();
|
||||||
|
if (event) write(*(event));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,7 +252,7 @@ void CameraPacket::writeEventQueue(osgViewer::Viewer& viewer)
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Reciever
|
// Receiver
|
||||||
//
|
//
|
||||||
Receiver::Receiver( void )
|
Receiver::Receiver( void )
|
||||||
{
|
{
|
||||||
@@ -337,8 +340,8 @@ void Receiver::sync( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \
|
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \
|
||||||
defined(__DragonFly__)
|
defined(__DragonFly__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
|
||||||
socklen_t
|
socklen_t
|
||||||
#else
|
#else
|
||||||
int
|
int
|
||||||
#endif
|
#endif
|
||||||
@@ -381,7 +384,7 @@ void Receiver::sync( void )
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Broadcaster
|
// Broadcaster
|
||||||
//
|
//
|
||||||
Broadcaster::Broadcaster( void )
|
Broadcaster::Broadcaster( void )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This software is open source and may be redistributed and/or modified under
|
* This software is open source and may be redistributed and/or modified under
|
||||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||||
* The full license is in LICENSE.txt file included with this distribution,.
|
* The full license is in LICENSE.txt file included with this distribution,.
|
||||||
*
|
*
|
||||||
* This software is distributed in the hope that it will be useful,
|
* This software is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* include LICENSE.txt for more details.
|
* include LICENSE.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,25 +29,25 @@
|
|||||||
//
|
//
|
||||||
// Class definition for the recipient of a broadcasted message
|
// Class definition for the recipient of a broadcasted message
|
||||||
//
|
//
|
||||||
class Receiver
|
class Receiver
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
Receiver();
|
Receiver();
|
||||||
~Receiver();
|
~Receiver();
|
||||||
|
|
||||||
// setBuffer defines the buffer into which the broadcasted
|
// setBuffer defines the buffer into which the broadcasted
|
||||||
// message will be received.
|
// message will be received.
|
||||||
void setBuffer( void *buffer, const unsigned int size );
|
void setBuffer( void *buffer, const unsigned int size );
|
||||||
|
|
||||||
// Define what port to listen and bind to
|
// Define what port to listen and bind to
|
||||||
void setPort( const short port );
|
void setPort( const short port );
|
||||||
|
|
||||||
// Sync does a blocking wait to recieve next message
|
// Sync does a blocking wait to recieve next message
|
||||||
void sync( void );
|
void sync( void );
|
||||||
|
|
||||||
private :
|
private :
|
||||||
bool init( void );
|
bool init( void );
|
||||||
|
|
||||||
private :
|
private :
|
||||||
#if defined (WIN32) && !defined(__CYGWIN__)
|
#if defined (WIN32) && !defined(__CYGWIN__)
|
||||||
@@ -68,29 +68,29 @@ class Receiver
|
|||||||
//
|
//
|
||||||
// Class definition for broadcasting a buffer to a LAN
|
// Class definition for broadcasting a buffer to a LAN
|
||||||
//
|
//
|
||||||
class Broadcaster
|
class Broadcaster
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
|
|
||||||
Broadcaster( void );
|
Broadcaster( void );
|
||||||
~Broadcaster( void );
|
~Broadcaster( void );
|
||||||
|
|
||||||
// Set the broadcast port
|
// Set the broadcast port
|
||||||
void setPort( const short port );
|
void setPort( const short port );
|
||||||
|
|
||||||
// Set the buffer to be broadcast
|
// Set the buffer to be broadcast
|
||||||
void setBuffer( void *buffer, const unsigned int buffer_size );
|
void setBuffer( void *buffer, const unsigned int buffer_size );
|
||||||
|
|
||||||
// Set a recipient host. If this is used, the Broadcaster
|
// Set a recipient host. If this is used, the Broadcaster
|
||||||
// no longer broadcasts, but rather directs UDP packets at
|
// no longer broadcasts, but rather directs UDP packets at
|
||||||
// host.
|
// host.
|
||||||
void setHost( const char *hostname );
|
void setHost( const char *hostname );
|
||||||
|
|
||||||
// Sync broadcasts the buffer
|
// Sync broadcasts the buffer
|
||||||
void sync( void );
|
void sync( void );
|
||||||
|
|
||||||
private :
|
private :
|
||||||
bool init( void );
|
bool init( void );
|
||||||
|
|
||||||
private :
|
private :
|
||||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
@@ -112,15 +112,15 @@ class Broadcaster
|
|||||||
|
|
||||||
class CameraPacket {
|
class CameraPacket {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static const unsigned int MAX_NUM_EVENTS;
|
static const unsigned int MAX_NUM_EVENTS;
|
||||||
static const unsigned int SWAP_BYTES_COMPARE;
|
static const unsigned int SWAP_BYTES_COMPARE;
|
||||||
|
|
||||||
CameraPacket():_masterKilled(false)
|
CameraPacket():_masterKilled(false)
|
||||||
{
|
{
|
||||||
_byte_order = SWAP_BYTES_COMPARE;
|
_byte_order = SWAP_BYTES_COMPARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp)
|
void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp)
|
||||||
{
|
{
|
||||||
_matrix = matrix;
|
_matrix = matrix;
|
||||||
@@ -129,20 +129,20 @@ class CameraPacket {
|
|||||||
_frameStamp = *frameStamp;
|
_frameStamp = *frameStamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void getModelView(osg::Matrix& matrix,float angle_offset=0.0f)
|
void getModelView(osg::Matrix& matrix,float angle_offset=0.0f)
|
||||||
{
|
{
|
||||||
|
|
||||||
matrix = _matrix * osg::Matrix::rotate(osg::DegreesToRadians(angle_offset),0.0f,1.0f,0.0f);
|
matrix = _matrix * osg::Matrix::rotate(osg::DegreesToRadians(angle_offset),0.0f,1.0f,0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void readEventQueue(osgViewer::Viewer& viewer);
|
void readEventQueue(osgViewer::Viewer& viewer);
|
||||||
|
|
||||||
void writeEventQueue(osgViewer::Viewer& viewer);
|
void writeEventQueue(osgViewer::Viewer& viewer);
|
||||||
|
|
||||||
void setMasterKilled(const bool flag) { _masterKilled = flag; }
|
void setMasterKilled(const bool flag) { _masterKilled = flag; }
|
||||||
const bool getMasterKilled() const { return _masterKilled; }
|
const bool getMasterKilled() const { return _masterKilled; }
|
||||||
|
|
||||||
unsigned int _byte_order;
|
unsigned int _byte_order;
|
||||||
bool _masterKilled;
|
bool _masterKilled;
|
||||||
osg::Matrix _matrix;
|
osg::Matrix _matrix;
|
||||||
@@ -150,11 +150,11 @@ class CameraPacket {
|
|||||||
// note don't use a ref_ptr as used elsewhere for FrameStamp
|
// note don't use a ref_ptr as used elsewhere for FrameStamp
|
||||||
// since we don't want to copy the pointer - but the memory.
|
// since we don't want to copy the pointer - but the memory.
|
||||||
// FrameStamp doesn't have a private destructor to allow
|
// FrameStamp doesn't have a private destructor to allow
|
||||||
// us to do this, even though its a reference counted object.
|
// us to do this, even though its a reference counted object.
|
||||||
osg::FrameStamp _frameStamp;
|
osg::FrameStamp _frameStamp;
|
||||||
|
|
||||||
osgGA::EventQueue::Events _events;
|
osgGA::EventQueue::Events _events;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DataConverter
|
class DataConverter
|
||||||
@@ -186,22 +186,22 @@ class DataConverter
|
|||||||
{
|
{
|
||||||
if (_currentPtr+1>=_endPtr) return;
|
if (_currentPtr+1>=_endPtr) return;
|
||||||
|
|
||||||
*(_currentPtr++) = *(ptr);
|
*(_currentPtr++) = *(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void read1(char* ptr)
|
inline void read1(char* ptr)
|
||||||
{
|
{
|
||||||
if (_currentPtr+1>=_endPtr) return;
|
if (_currentPtr+1>=_endPtr) return;
|
||||||
|
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void write2(char* ptr)
|
inline void write2(char* ptr)
|
||||||
{
|
{
|
||||||
if (_currentPtr+2>=_endPtr) return;
|
if (_currentPtr+2>=_endPtr) return;
|
||||||
|
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr);
|
*(_currentPtr++) = *(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void read2(char* ptr)
|
inline void read2(char* ptr)
|
||||||
@@ -210,13 +210,13 @@ class DataConverter
|
|||||||
|
|
||||||
if (_swapBytes)
|
if (_swapBytes)
|
||||||
{
|
{
|
||||||
*(ptr+1) = *(_currentPtr++);
|
*(ptr+1) = *(_currentPtr++);
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,10 +224,10 @@ class DataConverter
|
|||||||
{
|
{
|
||||||
if (_currentPtr+4>=_endPtr) return;
|
if (_currentPtr+4>=_endPtr) return;
|
||||||
|
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr);
|
*(_currentPtr++) = *(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void read4(char* ptr)
|
inline void read4(char* ptr)
|
||||||
@@ -236,17 +236,17 @@ class DataConverter
|
|||||||
|
|
||||||
if (_swapBytes)
|
if (_swapBytes)
|
||||||
{
|
{
|
||||||
*(ptr+3) = *(_currentPtr++);
|
*(ptr+3) = *(_currentPtr++);
|
||||||
*(ptr+2) = *(_currentPtr++);
|
*(ptr+2) = *(_currentPtr++);
|
||||||
*(ptr+1) = *(_currentPtr++);
|
*(ptr+1) = *(_currentPtr++);
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,15 +254,15 @@ class DataConverter
|
|||||||
{
|
{
|
||||||
if (_currentPtr+8>=_endPtr) return;
|
if (_currentPtr+8>=_endPtr) return;
|
||||||
|
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
|
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr);
|
*(_currentPtr++) = *(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void read8(char* ptr)
|
inline void read8(char* ptr)
|
||||||
@@ -272,27 +272,27 @@ class DataConverter
|
|||||||
|
|
||||||
if (_swapBytes)
|
if (_swapBytes)
|
||||||
{
|
{
|
||||||
*(ptr+7) = *(_currentPtr++);
|
*(ptr+7) = *(_currentPtr++);
|
||||||
*(ptr+6) = *(_currentPtr++);
|
*(ptr+6) = *(_currentPtr++);
|
||||||
*(ptr+5) = *(_currentPtr++);
|
*(ptr+5) = *(_currentPtr++);
|
||||||
*(ptr+4) = *(_currentPtr++);
|
*(ptr+4) = *(_currentPtr++);
|
||||||
|
|
||||||
*(ptr+3) = *(_currentPtr++);
|
*(ptr+3) = *(_currentPtr++);
|
||||||
*(ptr+2) = *(_currentPtr++);
|
*(ptr+2) = *(_currentPtr++);
|
||||||
*(ptr+1) = *(_currentPtr++);
|
*(ptr+1) = *(_currentPtr++);
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
|
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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; read1(&c); return c; }
|
inline char readChar() { char c=0; read1(&c); return c; }
|
||||||
inline unsigned char readUChar() { unsigned char c; read1((char*)&c); return c; }
|
inline unsigned char readUChar() { unsigned char c=0; read1((char*)&c); return c; }
|
||||||
inline short readShort() { short c; read2((char*)&c); return c; }
|
inline short readShort() { short c=0; read2((char*)&c); return c; }
|
||||||
inline unsigned short readUShort() { unsigned short c; read2((char*)&c); return c; }
|
inline unsigned short readUShort() { unsigned short c=0; read2((char*)&c); return c; }
|
||||||
inline int readInt() { int c; read4((char*)&c); return c; }
|
inline int readInt() { int c=0; read4((char*)&c); return c; }
|
||||||
inline unsigned int readUInt() { unsigned int c; read4((char*)&c); return c; }
|
inline unsigned int readUInt() { unsigned int c=0; read4((char*)&c); return c; }
|
||||||
inline float readFloat() { float c; read4((char*)&c); return c; }
|
inline float readFloat() { float c=0.0f; read4((char*)&c); return c; }
|
||||||
inline double readDouble() { double c; read8((char*)&c); return c; }
|
inline double readDouble() { double c=0.0; 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);
|
||||||
@@ -322,13 +322,13 @@ class DataConverter
|
|||||||
|
|
||||||
void write(const osgGA::GUIEventAdapter& event);
|
void write(const osgGA::GUIEventAdapter& event);
|
||||||
void read(osgGA::GUIEventAdapter& event);
|
void read(osgGA::GUIEventAdapter& event);
|
||||||
|
|
||||||
void write(CameraPacket& cameraPacket);
|
void write(CameraPacket& cameraPacket);
|
||||||
void read(CameraPacket& cameraPacket);
|
void read(CameraPacket& cameraPacket);
|
||||||
|
|
||||||
char* startPtr() { return _startPtr; }
|
char* startPtr() { return _startPtr; }
|
||||||
unsigned int numBytes() { return _numBytes; }
|
unsigned int numBytes() { return _numBytes; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
char* _startPtr;
|
char* _startPtr;
|
||||||
@@ -341,4 +341,4 @@ class DataConverter
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This software is open source and may be redistributed and/or modified under
|
* This software is open source and may be redistributed and/or modified under
|
||||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||||
* The full license is in LICENSE.txt file included with this distribution,.
|
* The full license is in LICENSE.txt file included with this distribution,.
|
||||||
*
|
*
|
||||||
* This software is distributed in the hope that it will be useful,
|
* This software is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* include LICENSE.txt for more details.
|
* include LICENSE.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -46,16 +46,16 @@ public:
|
|||||||
|
|
||||||
void setSnapImageOnNextFrame(bool flag) { _snapImageOnNextFrame = flag; }
|
void setSnapImageOnNextFrame(bool flag) { _snapImageOnNextFrame = flag; }
|
||||||
bool getSnapImageOnNextFrame() const { return _snapImageOnNextFrame; }
|
bool getSnapImageOnNextFrame() const { return _snapImageOnNextFrame; }
|
||||||
|
|
||||||
virtual void operator () (const osg::Camera& camera) const
|
virtual void operator () (const osg::Camera& camera) const
|
||||||
{
|
{
|
||||||
if (!_snapImageOnNextFrame) return;
|
if (!_snapImageOnNextFrame) return;
|
||||||
|
|
||||||
int x = static_cast<int>(camera.getViewport()->x());
|
int x = static_cast<int>(camera.getViewport()->x());
|
||||||
int y = static_cast<int>(camera.getViewport()->y());
|
int y = static_cast<int>(camera.getViewport()->y());
|
||||||
unsigned int width = static_cast<unsigned int>(camera.getViewport()->width());
|
unsigned int width = static_cast<unsigned int>(camera.getViewport()->width());
|
||||||
unsigned int height = static_cast<unsigned int>(camera.getViewport()->height());
|
unsigned int height = static_cast<unsigned int>(camera.getViewport()->height());
|
||||||
|
|
||||||
osg::ref_ptr<osg::Image> image = new osg::Image;
|
osg::ref_ptr<osg::Image> image = new osg::Image;
|
||||||
image->readPixels(x,y,width,height,
|
image->readPixels(x,y,width,height,
|
||||||
GL_RGB,GL_UNSIGNED_BYTE);
|
GL_RGB,GL_UNSIGNED_BYTE);
|
||||||
@@ -64,16 +64,16 @@ public:
|
|||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE) << "Saved screen image to `"<<_filename<<"`"<< std::endl;
|
osg::notify(osg::NOTICE) << "Saved screen image to `"<<_filename<<"`"<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
_snapImageOnNextFrame = false;
|
_snapImageOnNextFrame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
std::string _filename;
|
std::string _filename;
|
||||||
mutable bool _snapImageOnNextFrame;
|
mutable bool _snapImageOnNextFrame;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string ExportHTML::createFileName(const std::string& basename, unsigned int page, const std::string& ext)
|
std::string ExportHTML::createFileName(const std::string& basename, unsigned int page, const std::string& ext)
|
||||||
@@ -102,7 +102,7 @@ bool ExportHTML::write(osgPresentation::SlideEventHandler* seh, osgViewer::Viewe
|
|||||||
image_basename = osgDB::getNameLessExtension(filename);
|
image_basename = osgDB::getNameLessExtension(filename);
|
||||||
image_ext = ".jpg";
|
image_ext = ".jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout<<"Writing slides to "<<image_basename<<"_[slidenumber]"<<image_ext<<std::endl;
|
std::cout<<"Writing slides to "<<image_basename<<"_[slidenumber]"<<image_ext<<std::endl;
|
||||||
|
|
||||||
osg::ref_ptr<SnapImageDrawCallback> sidc = new SnapImageDrawCallback;
|
osg::ref_ptr<SnapImageDrawCallback> sidc = new SnapImageDrawCallback;
|
||||||
@@ -169,7 +169,7 @@ bool ExportHTML::write(osgPresentation::SlideEventHandler* seh, osgViewer::Viewe
|
|||||||
}
|
}
|
||||||
fout<<"</tr>"<<std::endl;
|
fout<<"</tr>"<<std::endl;
|
||||||
fout<<"</table>"<<std::endl;
|
fout<<"</table>"<<std::endl;
|
||||||
fout<<"<img src=\""<<osgDB::getSimpleFileName(os.str())<<"\">"<<std::endl;
|
fout<<"<img src=\""<<osgDB::getSimpleFileName(os.str())<<"\">"<<std::endl;
|
||||||
fout<<"</html>"<<std::endl;
|
fout<<"</html>"<<std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This software is open source and may be redistributed and/or modified under
|
* This software is open source and may be redistributed and/or modified under
|
||||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||||
* The full license is in LICENSE.txt file included with this distribution,.
|
* The full license is in LICENSE.txt file included with this distribution,.
|
||||||
*
|
*
|
||||||
* This software is distributed in the hope that it will be useful,
|
* This software is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* include LICENSE.txt for more details.
|
* include LICENSE.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This software is open source and may be redistributed and/or modified under
|
* This software is open source and may be redistributed and/or modified under
|
||||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||||
* The full license is in LICENSE.txt file included with this distribution,.
|
* The full license is in LICENSE.txt file included with this distribution,.
|
||||||
*
|
*
|
||||||
* This software is distributed in the hope that it will be useful,
|
* This software is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* include LICENSE.txt for more details.
|
* include LICENSE.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -54,11 +54,6 @@ bool PointsEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActio
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PointsEventHandler::accept(osgGA::GUIEventHandlerVisitor& v)
|
|
||||||
{
|
|
||||||
v.visit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PointsEventHandler::getUsage(osg::ApplicationUsage& usage) const
|
void PointsEventHandler::getUsage(osg::ApplicationUsage& usage) const
|
||||||
{
|
{
|
||||||
usage.addKeyboardMouseBinding("+","Increase point size");
|
usage.addKeyboardMouseBinding("+","Increase point size");
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This software is open source and may be redistributed and/or modified under
|
* This software is open source and may be redistributed and/or modified under
|
||||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||||
* The full license is in LICENSE.txt file included with this distribution,.
|
* The full license is in LICENSE.txt file included with this distribution,.
|
||||||
*
|
*
|
||||||
* This software is distributed in the hope that it will be useful,
|
* This software is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* include LICENSE.txt for more details.
|
* include LICENSE.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -22,25 +22,23 @@ class PointsEventHandler : public osgGA::GUIEventHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PointsEventHandler();
|
PointsEventHandler();
|
||||||
|
|
||||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
|
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
|
||||||
|
|
||||||
virtual void accept(osgGA::GUIEventHandlerVisitor& v);
|
|
||||||
|
|
||||||
void getUsage(osg::ApplicationUsage& usage) const;
|
void getUsage(osg::ApplicationUsage& usage) const;
|
||||||
|
|
||||||
void setStateSet(osg::StateSet* stateset) { _stateset=stateset; }
|
void setStateSet(osg::StateSet* stateset) { _stateset=stateset; }
|
||||||
|
|
||||||
osg::StateSet* getStateSet() { return _stateset.get(); }
|
osg::StateSet* getStateSet() { return _stateset.get(); }
|
||||||
|
|
||||||
const osg::StateSet* getStateSet() const { return _stateset.get(); }
|
const osg::StateSet* getStateSet() const { return _stateset.get(); }
|
||||||
|
|
||||||
void setPointSize(float psize);
|
void setPointSize(float psize);
|
||||||
|
|
||||||
float getPointSize() const;
|
float getPointSize() const;
|
||||||
|
|
||||||
void changePointSize(float delta);
|
void changePointSize(float delta);
|
||||||
|
|
||||||
void changePointAttenuation(float scale);
|
void changePointAttenuation(float scale);
|
||||||
|
|
||||||
osg::ref_ptr<osg::StateSet> _stateset;
|
osg::ref_ptr<osg::StateSet> _stateset;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This software is open source and may be redistributed and/or modified under
|
* This software is open source and may be redistributed and/or modified under
|
||||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||||
* The full license is in LICENSE.txt file included with this distribution,.
|
* The full license is in LICENSE.txt file included with this distribution,.
|
||||||
*
|
*
|
||||||
* This software is distributed in the hope that it will be useful,
|
* This software is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* include LICENSE.txt for more details.
|
* include LICENSE.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ class AddVolumeEditingCallbackVisitor : public osg::NodeVisitor
|
|||||||
public:
|
public:
|
||||||
AddVolumeEditingCallbackVisitor():
|
AddVolumeEditingCallbackVisitor():
|
||||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||||
|
|
||||||
void apply(osg::Group& group)
|
void apply(osg::Group& group)
|
||||||
{
|
{
|
||||||
osgVolume::VolumeTile* volumeTile = dynamic_cast<osgVolume::VolumeTile*>(&group);
|
osgVolume::VolumeTile* volumeTile = dynamic_cast<osgVolume::VolumeTile*>(&group);
|
||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
traverse(group);
|
traverse(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, FileNameList& normalFiles)
|
bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, FileNameList& normalFiles)
|
||||||
@@ -62,7 +62,7 @@ bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, F
|
|||||||
if (!arguments.isOption(pos))
|
if (!arguments.isOption(pos))
|
||||||
{
|
{
|
||||||
std::string ext = osgDB::getFileExtension(arguments[pos]);
|
std::string ext = osgDB::getFileExtension(arguments[pos]);
|
||||||
if (osgDB::equalCaseInsensitive(ext,"xml") || osgDB::equalCaseInsensitive(ext,"p3d"))
|
if (osgDB::equalCaseInsensitive(ext,"xml") || osgDB::equalCaseInsensitive(ext,"p3d"))
|
||||||
{
|
{
|
||||||
xmlFiles.push_back(arguments[pos]);
|
xmlFiles.push_back(arguments[pos]);
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, F
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (!xmlFiles.empty() || !normalFiles.empty());
|
return (!xmlFiles.empty() || !normalFiles.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3d::readEnvVars(osg::ArgumentParser& arguments)
|
bool p3d::readEnvVars(osg::ArgumentParser& arguments)
|
||||||
{
|
{
|
||||||
@@ -94,23 +94,23 @@ bool p3d::readEnvVars(osg::ArgumentParser& arguments)
|
|||||||
{
|
{
|
||||||
osgDB::getDataFilePathList().push_front(path);
|
osgDB::getDataFilePathList().push_front(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p3d::readEnvVars(file)) readVars = true;
|
if (p3d::readEnvVars(file)) readVars = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return readVars;
|
return readVars;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3d::readEnvVars(const std::string& fileName)
|
bool p3d::readEnvVars(const std::string& fileName)
|
||||||
{
|
{
|
||||||
std::string ext = osgDB::getFileExtension(fileName);
|
std::string ext = osgDB::getFileExtension(fileName);
|
||||||
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
|
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
|
||||||
!osgDB::equalCaseInsensitive(ext,"p3d")) return false;
|
!osgDB::equalCaseInsensitive(ext,"p3d")) return false;
|
||||||
|
|
||||||
|
|
||||||
osg::ref_ptr<osgDB::XmlNode> doc = new osgDB::XmlNode;
|
osg::ref_ptr<osgDB::XmlNode> doc = new osgDB::XmlNode;
|
||||||
osgDB::XmlNode* root = 0;
|
osgDB::XmlNode* root = 0;
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ bool p3d::readEnvVars(const std::string& fileName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool readVars = false;
|
bool readVars = false;
|
||||||
|
|
||||||
for(osgDB::XmlNode::Children::iterator itr = root->children.begin();
|
for(osgDB::XmlNode::Children::iterator itr = root->children.begin();
|
||||||
itr != root->children.end();
|
itr != root->children.end();
|
||||||
++itr)
|
++itr)
|
||||||
@@ -182,7 +182,7 @@ osgDB::Options* createOptions(const osgDB::ReaderWriter::Options* options)
|
|||||||
osg::ref_ptr<osg::Node> p3d::readHoldingSlide(const std::string& filename)
|
osg::ref_ptr<osg::Node> p3d::readHoldingSlide(const std::string& filename)
|
||||||
{
|
{
|
||||||
std::string ext = osgDB::getFileExtension(filename);
|
std::string ext = osgDB::getFileExtension(filename);
|
||||||
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
|
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
|
||||||
!osgDB::equalCaseInsensitive(ext,"p3d")) return 0;
|
!osgDB::equalCaseInsensitive(ext,"p3d")) return 0;
|
||||||
|
|
||||||
osg::ref_ptr<osgDB::ReaderWriter::Options> options = createOptions(0);
|
osg::ref_ptr<osgDB::ReaderWriter::Options> options = createOptions(0);
|
||||||
@@ -215,24 +215,24 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
|
|||||||
std::string filename;
|
std::string filename;
|
||||||
while (arguments.read("--image",filename))
|
while (arguments.read("--image",filename))
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Image> image = readImageFile(filename.c_str(), local_options.get());
|
osg::ref_ptr<osg::Image> image = readRefImageFile(filename.c_str(), local_options.get());
|
||||||
if (image.valid()) nodeList.push_back(osg::createGeodeForImage(image.get()));
|
if (image.valid()) nodeList.push_back(osg::createGeodeForImage(image));
|
||||||
}
|
}
|
||||||
|
|
||||||
while (arguments.read("--movie",filename))
|
while (arguments.read("--movie",filename))
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Image> image = readImageFile(filename.c_str(), local_options.get());
|
osg::ref_ptr<osg::Image> image = readRefImageFile(filename.c_str(), local_options.get());
|
||||||
osg::ref_ptr<osg::ImageStream> imageStream = dynamic_cast<osg::ImageStream*>(image.get());
|
osg::ref_ptr<osg::ImageStream> imageStream = dynamic_cast<osg::ImageStream*>(image.get());
|
||||||
if (image.valid())
|
if (image.valid())
|
||||||
{
|
{
|
||||||
imageStream->play();
|
imageStream->play();
|
||||||
nodeList.push_back(osg::createGeodeForImage(imageStream.get()));
|
nodeList.push_back(osg::createGeodeForImage(imageStream));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (arguments.read("--dem",filename))
|
while (arguments.read("--dem",filename))
|
||||||
{
|
{
|
||||||
osg::HeightField* hf = readHeightFieldFile(filename.c_str(), local_options.get());
|
osg::ref_ptr<osg::HeightField> hf = readRefHeightFieldFile(filename.c_str(), local_options.get());
|
||||||
if (hf)
|
if (hf)
|
||||||
{
|
{
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
@@ -247,7 +247,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
|
|||||||
if (!arguments.isOption(pos))
|
if (!arguments.isOption(pos))
|
||||||
{
|
{
|
||||||
// not an option so assume string is a filename.
|
// not an option so assume string is a filename.
|
||||||
osg::Node *node = osgDB::readNodeFile( arguments[pos], local_options.get());
|
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFile( arguments[pos], local_options.get());
|
||||||
|
|
||||||
if(node)
|
if(node)
|
||||||
{
|
{
|
||||||
@@ -260,12 +260,12 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodeList.empty())
|
if (nodeList.empty())
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> root;
|
osg::ref_ptr<osg::Node> root;
|
||||||
|
|
||||||
if (nodeList.size()==1)
|
if (nodeList.size()==1)
|
||||||
@@ -274,7 +274,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
|
|||||||
}
|
}
|
||||||
else // size >1
|
else // size >1
|
||||||
{
|
{
|
||||||
|
|
||||||
osg::Switch* sw = new osg::Switch;
|
osg::Switch* sw = new osg::Switch;
|
||||||
for(NodeList::iterator itr=nodeList.begin();
|
for(NodeList::iterator itr=nodeList.begin();
|
||||||
itr!=nodeList.end();
|
itr!=nodeList.end();
|
||||||
@@ -283,7 +283,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
|
|||||||
sw->addChild((*itr).get());
|
sw->addChild((*itr).get());
|
||||||
}
|
}
|
||||||
sw->setSingleChildOn(0);
|
sw->setSingleChildOn(0);
|
||||||
|
|
||||||
sw->setEventCallback(new p3d::ShowEventHandler());
|
sw->setEventCallback(new p3d::ShowEventHandler());
|
||||||
|
|
||||||
root = sw;
|
root = sw;
|
||||||
@@ -292,7 +292,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
|
|||||||
if (root.valid())
|
if (root.valid())
|
||||||
{
|
{
|
||||||
osg::notify(osg::INFO)<<"Got node now adding callback"<<std::endl;
|
osg::notify(osg::INFO)<<"Got node now adding callback"<<std::endl;
|
||||||
|
|
||||||
AddVolumeEditingCallbackVisitor avecv;
|
AddVolumeEditingCallbackVisitor avecv;
|
||||||
root->accept(avecv);
|
root->accept(avecv);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This software is open source and may be redistributed and/or modified under
|
* This software is open source and may be redistributed and/or modified under
|
||||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||||
* The full license is in LICENSE.txt file included with this distribution,.
|
* The full license is in LICENSE.txt file included with this distribution,.
|
||||||
*
|
*
|
||||||
* This software is distributed in the hope that it will be useful,
|
* This software is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* include LICENSE.txt for more details.
|
* include LICENSE.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -28,13 +28,13 @@ bool ShowEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
case(osgGA::GUIEventAdapter::KEYUP):
|
case(osgGA::GUIEventAdapter::KEYUP):
|
||||||
{
|
{
|
||||||
osg::notify(osg::INFO)<<"ShowEventHandler KEYUP "<<(int)ea.getKey()<<std::endl;
|
osg::notify(osg::INFO)<<"ShowEventHandler KEYUP "<<(int)ea.getKey()<<std::endl;
|
||||||
if (ea.getKey()>=osgGA::GUIEventAdapter::KEY_F1 &&
|
if (ea.getKey()>=osgGA::GUIEventAdapter::KEY_F1 &&
|
||||||
ea.getKey()<=osgGA::GUIEventAdapter::KEY_F8)
|
ea.getKey()<=osgGA::GUIEventAdapter::KEY_F8)
|
||||||
{
|
{
|
||||||
unsigned int child = ea.getKey()-osgGA::GUIEventAdapter::KEY_F1;
|
unsigned int child = ea.getKey()-osgGA::GUIEventAdapter::KEY_F1;
|
||||||
osg::notify(osg::INFO)<<" Select "<<child<<std::endl;
|
osg::notify(osg::INFO)<<" Select "<<child<<std::endl;
|
||||||
osg::Switch* showSwitch = dynamic_cast<osg::Switch*>(object);
|
osg::Switch* showSwitch = dynamic_cast<osg::Switch*>(object);
|
||||||
if (showSwitch)
|
if (showSwitch)
|
||||||
{
|
{
|
||||||
if (child<showSwitch->getNumChildren())
|
if (child<showSwitch->getNumChildren())
|
||||||
{
|
{
|
||||||
@@ -52,12 +52,6 @@ bool ShowEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ShowEventHandler::accept(osgGA::GUIEventHandlerVisitor& v)
|
|
||||||
{
|
|
||||||
v.visit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShowEventHandler::getUsage(osg::ApplicationUsage& /*usage*/) const
|
void ShowEventHandler::getUsage(osg::ApplicationUsage& /*usage*/) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This software is open source and may be redistributed and/or modified under
|
* This software is open source and may be redistributed and/or modified under
|
||||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||||
* The full license is in LICENSE.txt file included with this distribution,.
|
* The full license is in LICENSE.txt file included with this distribution,.
|
||||||
*
|
*
|
||||||
* This software is distributed in the hope that it will be useful,
|
* This software is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* include LICENSE.txt for more details.
|
* include LICENSE.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -28,11 +28,9 @@ class ShowEventHandler : public osgGA::GUIEventHandler
|
|||||||
ShowEventHandler();
|
ShowEventHandler();
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
virtual void accept(osgGA::GUIEventHandlerVisitor& v);
|
|
||||||
|
|
||||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This software is open source and may be redistributed and/or modified under
|
* This software is open source and may be redistributed and/or modified under
|
||||||
* the terms of the GNU General Public License (GPL) version 2.0.
|
* the terms of the GNU General Public License (GPL) version 2.0.
|
||||||
* The full license is in LICENSE.txt file included with this distribution,.
|
* The full license is in LICENSE.txt file included with this distribution,.
|
||||||
*
|
*
|
||||||
* This software is distributed in the hope that it will be useful,
|
* This software is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* include LICENSE.txt for more details.
|
* include LICENSE.txt for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <osg/Geometry>
|
#include <osg/Geometry>
|
||||||
#include <osg/CameraNode>
|
|
||||||
#include <osg/Texture2D>
|
#include <osg/Texture2D>
|
||||||
#include <osg/AutoTransform>
|
#include <osg/AutoTransform>
|
||||||
#include <osg/Notify>
|
#include <osg/Notify>
|
||||||
@@ -37,9 +36,10 @@
|
|||||||
#include <osgGA/TerrainManipulator>
|
#include <osgGA/TerrainManipulator>
|
||||||
#include <osgGA/AnimationPathManipulator>
|
#include <osgGA/AnimationPathManipulator>
|
||||||
#include <osgGA/StateSetManipulator>
|
#include <osgGA/StateSetManipulator>
|
||||||
|
#include <osgGA/MultiTouchTrackballManipulator>
|
||||||
|
|
||||||
#include <osgPresentation/SlideEventHandler>
|
#include <osgPresentation/SlideEventHandler>
|
||||||
#include <osgPresentation/SlideShowConstructor>
|
#include <osgPresentation/Cursor>
|
||||||
|
|
||||||
#include "ReadShowFile.h"
|
#include "ReadShowFile.h"
|
||||||
#include "PointsEventHandler.h"
|
#include "PointsEventHandler.h"
|
||||||
@@ -51,6 +51,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef USE_SDL
|
#ifdef USE_SDL
|
||||||
@@ -129,148 +130,103 @@ void setViewer(osgViewer::Viewer& viewer, float width, float height, float dista
|
|||||||
|
|
||||||
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;
|
OSG_INFO<<"setProjectionMatrixAsPerspective( "<<vfov<<", "<<width/height<<", "<<0.1<<", "<<1000.0<<");"<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ForwardToDeviceEventHandler : public osgGA::GUIEventHandler {
|
class ForwardToDeviceEventHandler : public osgGA::GUIEventHandler {
|
||||||
public:
|
public:
|
||||||
ForwardToDeviceEventHandler(osgGA::Device* device) : osgGA::GUIEventHandler(), _device(device) {}
|
ForwardToDeviceEventHandler(osgGA::Device* device, bool format_mouse_events) : osgGA::GUIEventHandler(), _device(device), _forwardMouseEvents(format_mouse_events) {}
|
||||||
|
|
||||||
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *)
|
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *)
|
||||||
{
|
{
|
||||||
OSG_INFO<<"ForwardToDeviceEventHandler::setEvent("<<ea.getKey()<<")"<<std::endl;
|
switch (ea.getEventType())
|
||||||
_device->sendEvent(ea);
|
{
|
||||||
|
case osgGA::GUIEventAdapter::PUSH:
|
||||||
|
case osgGA::GUIEventAdapter::RELEASE:
|
||||||
|
case osgGA::GUIEventAdapter::MOVE:
|
||||||
|
case osgGA::GUIEventAdapter::DRAG:
|
||||||
|
case osgGA::GUIEventAdapter::SCROLL:
|
||||||
|
if (_forwardMouseEvents)
|
||||||
|
_device->sendEvent(ea);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
_device->sendEvent(ea);
|
||||||
|
break;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
osg::ref_ptr<osgGA::Device> _device;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class FollowMouseCallback: public osgGA::GUIEventHandler
|
bool handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv)
|
||||||
{
|
{
|
||||||
public:
|
if (event->asGUIEventAdapter())
|
||||||
|
return osgGA::GUIEventHandler::handle(event, object, nv);
|
||||||
FollowMouseCallback():
|
else
|
||||||
_mousePostition(0.5,0.5) {}
|
|
||||||
|
|
||||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv)
|
|
||||||
{
|
{
|
||||||
osg::AutoTransform* transform = dynamic_cast<osg::AutoTransform*>(object);
|
_device->sendEvent(*event);
|
||||||
if (!transform) return false;
|
|
||||||
|
|
||||||
osg::NotifySeverity level = osg::INFO;
|
|
||||||
|
|
||||||
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):
|
|
||||||
{
|
|
||||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
|
|
||||||
|
|
||||||
|
|
||||||
osg::Camera* camera = view->getCamera();
|
|
||||||
osg::Matrix VP = camera->getViewMatrix() * camera->getProjectionMatrix();
|
|
||||||
|
|
||||||
osg::Matrix inverse_VP;
|
|
||||||
inverse_VP.invert(VP);
|
|
||||||
|
|
||||||
osg::Vec3d start_eye(_mousePostition.x(), _mousePostition.y(), 0.0);
|
|
||||||
osg::Vec3d end_eye(_mousePostition.x(), _mousePostition.y(), 1.0);
|
|
||||||
|
|
||||||
osg::Vec3d start_world = start_eye * inverse_VP;
|
|
||||||
osg::Vec3d end_world = start_eye * inverse_VP;
|
|
||||||
|
|
||||||
osg::notify(level)<<"start_world="<<start_world<<std::endl;
|
|
||||||
osg::notify(level)<<"end_world="<<end_world<<std::endl;
|
|
||||||
|
|
||||||
if (end_world.valid()) transform->setPosition(end_world);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OSG_NOTICE<<"Ignoring invalid end_world position"<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case(osgGA::GUIEventAdapter::KEYDOWN):
|
|
||||||
{
|
|
||||||
if (ea.getKey()=='c')
|
|
||||||
{
|
|
||||||
for(unsigned int i=0; i< transform->getNumChildren(); ++i)
|
|
||||||
{
|
|
||||||
osg::Node* node = transform->getChild(i);
|
|
||||||
node->setNodeMask(
|
|
||||||
node->getNodeMask()!=0 ?
|
|
||||||
0 :
|
|
||||||
0xffffff);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void accept(osgGA::GUIEventHandlerVisitor& v)
|
|
||||||
{
|
|
||||||
v.visit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
osg::Vec2d _mousePostition;
|
|
||||||
};
|
|
||||||
|
|
||||||
osg::Node* createCursorSubgraph(const std::string& filename, float size)
|
|
||||||
{
|
|
||||||
osg::Geode* geode = new osg::Geode;
|
|
||||||
|
|
||||||
size = 20.0f;
|
|
||||||
|
|
||||||
osg::Geometry* geom = osg::createTexturedQuadGeometry(osg::Vec3(-size*0.5f,-size*0.5f,0.0f),osg::Vec3(size,0.0f,0.0f),osg::Vec3(0.0f,size,0.0f));
|
|
||||||
geom->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
|
||||||
|
|
||||||
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|osg::StateAttribute::PROTECTED);
|
|
||||||
stateset->setMode(GL_BLEND,osg::StateAttribute::ON|osg::StateAttribute::PROTECTED);
|
|
||||||
// stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
|
|
||||||
stateset->setRenderBinDetails(1000, "DepthSortedBin");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
geode->addDrawable(geom);
|
|
||||||
|
|
||||||
osg::AutoTransform* transform = new osg::AutoTransform;
|
private:
|
||||||
transform->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_CAMERA);
|
osg::ref_ptr<osgGA::Device> _device;
|
||||||
transform->setAutoScaleToScreen(true);
|
bool _forwardMouseEvents;
|
||||||
|
};
|
||||||
|
|
||||||
transform->addChild(geode);
|
|
||||||
|
|
||||||
transform->setEventCallback(new FollowMouseCallback());
|
class DumpEventHandler : public osgGA::GUIEventHandler {
|
||||||
|
public:
|
||||||
|
DumpEventHandler() : osgGA::GUIEventHandler() {}
|
||||||
|
|
||||||
return transform;
|
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *)
|
||||||
|
{
|
||||||
|
switch (ea.getEventType())
|
||||||
|
{
|
||||||
|
case osgGA::GUIEventAdapter::FRAME:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case osgGA::GUIEventAdapter::PUSH:
|
||||||
|
std::cout << "PUSH: ";
|
||||||
|
break;
|
||||||
|
case osgGA::GUIEventAdapter::RELEASE:
|
||||||
|
std::cout << "RELEASE: ";
|
||||||
|
break;
|
||||||
|
case osgGA::GUIEventAdapter::MOVE:
|
||||||
|
std::cout << "MOVE: ";
|
||||||
|
break;
|
||||||
|
case osgGA::GUIEventAdapter::DRAG:
|
||||||
|
std::cout << "DRAG: ";
|
||||||
|
break;
|
||||||
|
case osgGA::GUIEventAdapter::SCROLL:
|
||||||
|
std::cout << "SCROLL: ";
|
||||||
|
break;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
std::cout << ea.getEventType() << " ";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
std::cout << ea.getX() << "/" << ea.getY() << " " << ea.isMultiTouchEvent() << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv)
|
||||||
|
{
|
||||||
|
if (event->asGUIEventAdapter())
|
||||||
|
return osgGA::GUIEventHandler::handle(event, object, nv);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
enum P3DApplicationType
|
enum P3DApplicationType
|
||||||
@@ -284,7 +240,7 @@ enum P3DApplicationType
|
|||||||
void processLoadedModel(osg::ref_ptr<osg::Node>& loadedModel, int optimizer_options, const std::string& cursorFileName)
|
void processLoadedModel(osg::ref_ptr<osg::Node>& loadedModel, int optimizer_options, const std::string& cursorFileName)
|
||||||
{
|
{
|
||||||
if (!loadedModel) return;
|
if (!loadedModel) return;
|
||||||
|
|
||||||
#if !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
|
#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.
|
// add back in enabling of the GL_ALPHA_TEST to get around the core OSG no longer setting it by default for opaque bins.
|
||||||
@@ -292,7 +248,7 @@ void processLoadedModel(osg::ref_ptr<osg::Node>& loadedModel, int optimizer_opti
|
|||||||
loadedModel->getOrCreateStateSet()->setMode(GL_ALPHA_TEST, osg::StateAttribute::ON);
|
loadedModel->getOrCreateStateSet()->setMode(GL_ALPHA_TEST, osg::StateAttribute::ON);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// optimize the scene graph, remove rendundent nodes and state etc.
|
// optimize the scene graph, remove redundant nodes and state etc.
|
||||||
osgUtil::Optimizer optimizer;
|
osgUtil::Optimizer optimizer;
|
||||||
optimizer.optimize(loadedModel.get(), optimizer_options);
|
optimizer.optimize(loadedModel.get(), optimizer_options);
|
||||||
|
|
||||||
@@ -300,21 +256,24 @@ void processLoadedModel(osg::ref_ptr<osg::Node>& loadedModel, int optimizer_opti
|
|||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Group> group = new osg::Group;
|
osg::ref_ptr<osg::Group> group = new osg::Group;
|
||||||
group->addChild(loadedModel.get());
|
group->addChild(loadedModel.get());
|
||||||
group->addChild(createCursorSubgraph(cursorFileName, 0.05f));
|
|
||||||
|
OSG_NOTICE<<"Creating Cursor"<<std::endl;
|
||||||
|
group->addChild(new osgPresentation::Cursor(cursorFileName, 20.0f));
|
||||||
|
|
||||||
loadedModel = group;
|
loadedModel = group;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addDeviceTo(osgViewer::Viewer& viewer, const std::string& device_name)
|
void addDeviceTo(osgViewer::Viewer& viewer, const std::string& device_name, bool forward_mouse_events)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device_name);
|
osg::ref_ptr<osgGA::Device> dev = osgDB::readRefFile<osgGA::Device>(device_name);
|
||||||
if (dev.valid())
|
if (dev.valid())
|
||||||
{
|
{
|
||||||
OSG_INFO << "Adding Device : " << device_name << std::endl;
|
OSG_INFO << "Adding Device : " << device_name << std::endl;
|
||||||
viewer.addDevice(dev.get());
|
viewer.addDevice(dev.get());
|
||||||
|
|
||||||
if (dev->getCapabilities() & osgGA::Device::SEND_EVENTS)
|
if ((dev->getCapabilities() & osgGA::Device::SEND_EVENTS))
|
||||||
viewer.getEventHandlers().push_front(new ForwardToDeviceEventHandler(dev.get()));
|
viewer.getEventHandlers().push_front(new ForwardToDeviceEventHandler(dev.get(), forward_mouse_events));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -327,7 +286,7 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the application for presenting 3D interactive slide shows.");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the application for presenting 3D interactive slide shows.");
|
||||||
@@ -348,6 +307,8 @@ int main( int argc, char **argv )
|
|||||||
arguments.getApplicationUsage()->addCommandLineOption("--html <filename>","Print out slides to a series of html & image files.");
|
arguments.getApplicationUsage()->addCommandLineOption("--html <filename>","Print out slides to a series of html & image files.");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--loop","Switch on looping of presentation.");
|
arguments.getApplicationUsage()->addCommandLineOption("--loop","Switch on looping of presentation.");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("--devices","Print the Video input capability via QuickTime and exit.");
|
arguments.getApplicationUsage()->addCommandLineOption("--devices","Print the Video input capability via QuickTime and exit.");
|
||||||
|
arguments.getApplicationUsage()->addCommandLineOption("--forwardMouseEvents","forward also mouse/touch-events to the devices");
|
||||||
|
arguments.getApplicationUsage()->addCommandLineOption("--suppressEnvTags", "suppresses all found ENV-tags in the presentation");
|
||||||
|
|
||||||
// add alias from xml to p3d to provide backwards compatibility for old p3d files.
|
// add alias from xml to p3d to provide backwards compatibility for old p3d files.
|
||||||
osgDB::Registry::instance()->addFileExtensionAlias("xml","p3d");
|
osgDB::Registry::instance()->addFileExtensionAlias("xml","p3d");
|
||||||
@@ -356,14 +317,17 @@ int main( int argc, char **argv )
|
|||||||
if (arguments.read("-devices") || arguments.read("--devices"))
|
if (arguments.read("-devices") || arguments.read("--devices"))
|
||||||
{
|
{
|
||||||
// Force load QuickTime plugin, probe video capability, exit
|
// Force load QuickTime plugin, probe video capability, exit
|
||||||
osgDB::readImageFile("devices.live");
|
osgDB::readRefImageFile("devices.live");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool suppress_env_tags = false;
|
||||||
|
if (arguments.read("--suppressEnvTags"))
|
||||||
|
suppress_env_tags = true;
|
||||||
|
|
||||||
// read any env vars from presentations before we create viewer to make sure the viewer
|
// read any env vars from presentations before we create viewer to make sure the viewer
|
||||||
// utilises these env vars
|
// utilises these env vars
|
||||||
if (p3d::readEnvVars(arguments))
|
if (!suppress_env_tags && p3d::readEnvVars(arguments))
|
||||||
{
|
{
|
||||||
osg::DisplaySettings::instance()->readEnvironmentalVariables();
|
osg::DisplaySettings::instance()->readEnvironmentalVariables();
|
||||||
}
|
}
|
||||||
@@ -386,10 +350,10 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
#ifdef USE_SDL
|
#ifdef USE_SDL
|
||||||
SDLIntegration sdlIntegration;
|
SDLIntegration sdlIntegration;
|
||||||
|
|
||||||
osg::notify(osg::INFO)<<"USE_SDL"<<std::endl;
|
osg::notify(osg::INFO)<<"USE_SDL"<<std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool doSetViewer = true;
|
bool doSetViewer = true;
|
||||||
std::string configurationFile;
|
std::string configurationFile;
|
||||||
|
|
||||||
@@ -402,7 +366,7 @@ int main( int argc, char **argv )
|
|||||||
while (arguments.read("-c",configurationFile)) {}
|
while (arguments.read("-c",configurationFile)) {}
|
||||||
|
|
||||||
osg::Vec4 clearColor(0.0f,0.0f,0.0f,0.0f);
|
osg::Vec4 clearColor(0.0f,0.0f,0.0f,0.0f);
|
||||||
|
|
||||||
while (arguments.read("--clear-color",clearColor[0],clearColor[1],clearColor[2],clearColor[3])) {}
|
while (arguments.read("--clear-color",clearColor[0],clearColor[1],clearColor[2],clearColor[3])) {}
|
||||||
|
|
||||||
std::string filename;
|
std::string filename;
|
||||||
@@ -441,7 +405,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// construct the viewer.
|
// construct the viewer.
|
||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
// set clear colour to black by default.
|
// set clear colour to black by default.
|
||||||
viewer.getCamera()->setClearColor(clearColor);
|
viewer.getCamera()->setClearColor(clearColor);
|
||||||
|
|
||||||
@@ -451,6 +415,10 @@ int main( int argc, char **argv )
|
|||||||
doSetViewer = false;
|
doSetViewer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool forwardMouseEvents = false;
|
||||||
|
if (arguments.read("--forwardMouseEvents"))
|
||||||
|
forwardMouseEvents = true;
|
||||||
|
|
||||||
const char* p3dDevice = getenv("P3D_DEVICE");
|
const char* p3dDevice = getenv("P3D_DEVICE");
|
||||||
if (p3dDevice)
|
if (p3dDevice)
|
||||||
{
|
{
|
||||||
@@ -458,7 +426,7 @@ int main( int argc, char **argv )
|
|||||||
osgDB::split(p3dDevice, devices);
|
osgDB::split(p3dDevice, devices);
|
||||||
for(osgDB::StringList::iterator i = devices.begin(); i != devices.end(); ++i)
|
for(osgDB::StringList::iterator i = devices.begin(); i != devices.end(); ++i)
|
||||||
{
|
{
|
||||||
addDeviceTo(viewer, *i);
|
addDeviceTo(viewer, *i, forwardMouseEvents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,13 +434,13 @@ int main( int argc, char **argv )
|
|||||||
std::string device;
|
std::string device;
|
||||||
while (arguments.read("--device", device))
|
while (arguments.read("--device", device))
|
||||||
{
|
{
|
||||||
addDeviceTo(viewer, device);
|
addDeviceTo(viewer, device, forwardMouseEvents);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arguments.read("--http-control"))
|
if (arguments.read("--http-control"))
|
||||||
{
|
{
|
||||||
|
|
||||||
std::string server_address = "localhost";
|
std::string server_address = "localhost";
|
||||||
std::string server_port = "8080";
|
std::string server_port = "8080";
|
||||||
std::string document_root = "htdocs";
|
std::string document_root = "htdocs";
|
||||||
@@ -483,23 +451,33 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
osg::ref_ptr<osgDB::Options> device_options = new osgDB::Options("documentRegisteredHandlers");
|
osg::ref_ptr<osgDB::Options> device_options = new osgDB::Options("documentRegisteredHandlers");
|
||||||
|
|
||||||
osg::ref_ptr<osgGA::Device> rest_http_device = osgDB::readFile<osgGA::Device>(server_address+":"+server_port+"/"+document_root+".resthttp", device_options.get());
|
osg::ref_ptr<osgGA::Device> rest_http_device = osgDB::readRefFile<osgGA::Device>(server_address+":"+server_port+"/"+document_root+".resthttp", device_options.get());
|
||||||
if (rest_http_device.valid())
|
if (rest_http_device.valid())
|
||||||
{
|
{
|
||||||
viewer.addDevice(rest_http_device.get());
|
viewer.addDevice(rest_http_device.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
||||||
keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
|
keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::MultiTouchTrackballManipulator() );
|
||||||
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() );
|
||||||
@@ -509,7 +487,7 @@ int main( int argc, char **argv )
|
|||||||
while (arguments.read("-p",pathfile))
|
while (arguments.read("-p",pathfile))
|
||||||
{
|
{
|
||||||
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||||
if (apm || !apm->valid())
|
if (apm || !apm->valid())
|
||||||
{
|
{
|
||||||
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
||||||
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
||||||
@@ -521,6 +499,8 @@ int main( int argc, char **argv )
|
|||||||
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//viewer.getEventHandlers().push_front(new DumpEventHandler());
|
||||||
|
|
||||||
// add the state manipulator
|
// add the state manipulator
|
||||||
osg::ref_ptr<osgGA::StateSetManipulator> ssManipulator = new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet());
|
osg::ref_ptr<osgGA::StateSetManipulator> ssManipulator = new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet());
|
||||||
ssManipulator->setKeyEventToggleTexturing('e');
|
ssManipulator->setKeyEventToggleTexturing('e');
|
||||||
@@ -547,12 +527,12 @@ int main( int argc, char **argv )
|
|||||||
bool hideCursor = (showCursor=="No" || showCursor=="NO" || 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 we want to hide the cursor override the custom cursor.
|
||||||
if (hideCursor) cursorFileName.clear();
|
if (hideCursor) cursorFileName.clear();
|
||||||
|
|
||||||
|
|
||||||
// cluster related entries.
|
// cluster related entries.
|
||||||
int socketNumber=8100;
|
int socketNumber=8100;
|
||||||
@@ -599,7 +579,7 @@ int main( int argc, char **argv )
|
|||||||
viewer.getUpdateVisitor()->setTraversalMode(updateTraversalMode);
|
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);
|
osg::ref_ptr<osgPresentation::SlideEventHandler> seh = new osgPresentation::SlideEventHandler(&viewer);
|
||||||
viewer.addEventHandler(seh.get());
|
viewer.addEventHandler(seh.get());
|
||||||
@@ -619,19 +599,19 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// set up optimizer options
|
// set up optimizer options
|
||||||
unsigned int optimizer_options = osgUtil::Optimizer::DEFAULT_OPTIMIZATIONS;
|
unsigned int optimizer_options = osgUtil::Optimizer::DEFAULT_OPTIMIZATIONS;
|
||||||
bool relase_and_compile = false;
|
bool release_and_compile = false;
|
||||||
while (arguments.read("--release-and-compile"))
|
while (arguments.read("--release-and-compile"))
|
||||||
{
|
{
|
||||||
relase_and_compile = true;
|
release_and_compile = true;
|
||||||
}
|
}
|
||||||
seh->setReleaseAndCompileOnEachNewSlide(relase_and_compile);
|
seh->setReleaseAndCompileOnEachNewSlide(release_and_compile);
|
||||||
if (relase_and_compile)
|
if (release_and_compile)
|
||||||
{
|
{
|
||||||
// make sure that imagery stays around after being applied to textures.
|
// make sure that imagery stays around after being applied to textures.
|
||||||
viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false);
|
viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false);
|
||||||
optimizer_options &= ~osgUtil::Optimizer::OPTIMIZE_TEXTURE_SETTINGS;
|
optimizer_options &= ~osgUtil::Optimizer::OPTIMIZE_TEXTURE_SETTINGS;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// osgDB::Registry::instance()->getOrCreateDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false);
|
// osgDB::Registry::instance()->getOrCreateDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false);
|
||||||
// optimizer_options &= ~osgUtil::Optimizer::OPTIMIZE_TEXTURE_SETTINGS;
|
// optimizer_options &= ~osgUtil::Optimizer::OPTIMIZE_TEXTURE_SETTINGS;
|
||||||
// osg::Texture::getTextureObjectManager()->setExpiryDelay(0.0f);
|
// osg::Texture::getTextureObjectManager()->setExpiryDelay(0.0f);
|
||||||
@@ -657,7 +637,7 @@ int main( int argc, char **argv )
|
|||||||
float width = osg::DisplaySettings::instance()->getScreenWidth();
|
float width = osg::DisplaySettings::instance()->getScreenWidth();
|
||||||
float height = osg::DisplaySettings::instance()->getScreenHeight();
|
float height = osg::DisplaySettings::instance()->getScreenHeight();
|
||||||
float distance = osg::DisplaySettings::instance()->getScreenDistance();
|
float distance = osg::DisplaySettings::instance()->getScreenDistance();
|
||||||
while (arguments.read("-s", width, height, distance))
|
while (arguments.read("-s", width, height, distance))
|
||||||
{
|
{
|
||||||
osg::DisplaySettings::instance()->setScreenDistance(distance);
|
osg::DisplaySettings::instance()->setScreenDistance(distance);
|
||||||
osg::DisplaySettings::instance()->setScreenHeight(height);
|
osg::DisplaySettings::instance()->setScreenHeight(height);
|
||||||
@@ -672,9 +652,10 @@ int main( int argc, char **argv )
|
|||||||
viewer.getUsage(*arguments.getApplicationUsage());
|
viewer.getUsage(*arguments.getApplicationUsage());
|
||||||
|
|
||||||
// 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"))
|
unsigned int helpType = 0;
|
||||||
|
if ((helpType = arguments.readHelpType()))
|
||||||
{
|
{
|
||||||
arguments.getApplicationUsage()->write(osg::notify(osg::NOTICE));
|
arguments.getApplicationUsage()->write(std::cout, helpType);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -687,11 +668,11 @@ int main( int argc, char **argv )
|
|||||||
else if (strcmp(str,"master")==0) P3DApplicationType = MASTER;
|
else if (strcmp(str,"master")==0) P3DApplicationType = MASTER;
|
||||||
else if (strcmp(str,"slave")==0) P3DApplicationType = SLAVE;
|
else if (strcmp(str,"slave")==0) P3DApplicationType = SLAVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (arguments.read("--viewer")) { P3DApplicationType = VIEWER; }
|
while (arguments.read("--viewer")) { P3DApplicationType = VIEWER; }
|
||||||
while (arguments.read("--master")) { P3DApplicationType = MASTER; }
|
while (arguments.read("--master")) { P3DApplicationType = MASTER; }
|
||||||
while (arguments.read("--slave")) { P3DApplicationType = SLAVE; }
|
while (arguments.read("--slave")) { P3DApplicationType = SLAVE; }
|
||||||
|
|
||||||
while (arguments.read("--version"))
|
while (arguments.read("--version"))
|
||||||
{
|
{
|
||||||
std::string appTypeName = "invalid";
|
std::string appTypeName = "invalid";
|
||||||
@@ -769,6 +750,9 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
|
|
||||||
osg::ref_ptr<osgDB::ReaderWriter::Options> cacheAllOption = new osgDB::ReaderWriter::Options;
|
osg::ref_ptr<osgDB::ReaderWriter::Options> cacheAllOption = new osgDB::ReaderWriter::Options;
|
||||||
|
if(suppress_env_tags)
|
||||||
|
cacheAllOption->setPluginStringData("suppressEnvTags", "true");
|
||||||
|
|
||||||
cacheAllOption->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_ALL);
|
cacheAllOption->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_ALL);
|
||||||
osgDB::Registry::instance()->setOptions(cacheAllOption.get());
|
osgDB::Registry::instance()->setOptions(cacheAllOption.get());
|
||||||
|
|
||||||
@@ -780,7 +764,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
|
|
||||||
// if no model has been successfully loaded report failure.
|
// if no model has been successfully loaded report failure.
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
osg::notify(osg::INFO) << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
osg::notify(osg::INFO) << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@@ -796,12 +780,12 @@ int main( int argc, char **argv )
|
|||||||
for(unsigned int i=0; i<loadedModel->getNumDescriptions(); ++i)
|
for(unsigned int i=0; i<loadedModel->getNumDescriptions(); ++i)
|
||||||
{
|
{
|
||||||
const std::string& desc = loadedModel->getDescription(i);
|
const std::string& desc = loadedModel->getDescription(i);
|
||||||
if (desc=="loop")
|
if (desc=="loop")
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Enabling looping"<<std::endl;
|
osg::notify(osg::NOTICE)<<"Enabling looping"<<std::endl;
|
||||||
seh->setLoopPresentation(true);
|
seh->setLoopPresentation(true);
|
||||||
}
|
}
|
||||||
else if (desc=="auto")
|
else if (desc=="auto")
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Enabling auto run"<<std::endl;
|
osg::notify(osg::NOTICE)<<"Enabling auto run"<<std::endl;
|
||||||
seh->setAutoSteppingActive(true);
|
seh->setAutoSteppingActive(true);
|
||||||
@@ -830,7 +814,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// pass the model to the slide event handler so it knows which to manipulate.
|
// pass the model to the slide event handler so it knows which to manipulate.
|
||||||
seh->set(loadedModel.get());
|
seh->set(loadedModel.get());
|
||||||
@@ -843,7 +827,7 @@ int main( int argc, char **argv )
|
|||||||
osgDB::writeNodeFile(*loadedModel,outputFileName);
|
osgDB::writeNodeFile(*loadedModel,outputFileName);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!cursorFileName.empty() || hideCursor)
|
if (!cursorFileName.empty() || hideCursor)
|
||||||
{
|
{
|
||||||
@@ -865,7 +849,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
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;
|
||||||
|
|
||||||
if (exportName.empty())
|
if (exportName.empty())
|
||||||
{
|
{
|
||||||
// objects for managing the broadcasting and recieving of camera packets.
|
// objects for managing the broadcasting and recieving of camera packets.
|
||||||
@@ -894,7 +878,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
startOfFrameTick = osg::Timer::instance()->tick();
|
startOfFrameTick = osg::Timer::instance()->tick();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (kmcb)
|
if (kmcb)
|
||||||
{
|
{
|
||||||
double time = kmcb->getTime();
|
double time = kmcb->getTime();
|
||||||
@@ -910,9 +894,9 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
// take camera zero as the guide.
|
// take camera zero as the guide.
|
||||||
osg::Matrix modelview(viewer.getCamera()->getViewMatrix());
|
osg::Matrix modelview(viewer.getCamera()->getViewMatrix());
|
||||||
|
|
||||||
cp.setPacket(modelview,viewer.getFrameStamp());
|
cp.setPacket(modelview,viewer.getFrameStamp());
|
||||||
|
|
||||||
// cp.readEventQueue(viewer);
|
// cp.readEventQueue(viewer);
|
||||||
|
|
||||||
scratchPad.reset();
|
scratchPad.reset();
|
||||||
@@ -922,7 +906,7 @@ int main( int argc, char **argv )
|
|||||||
scratchPad.read(cp);
|
scratchPad.read(cp);
|
||||||
|
|
||||||
bc.setBuffer(scratchPad.startPtr(), scratchPad.numBytes());
|
bc.setBuffer(scratchPad.startPtr(), scratchPad.numBytes());
|
||||||
|
|
||||||
std::cout << "bc.sync()"<<scratchPad.numBytes()<<std::endl;
|
std::cout << "bc.sync()"<<scratchPad.numBytes()<<std::endl;
|
||||||
|
|
||||||
bc.sync();
|
bc.sync();
|
||||||
@@ -932,13 +916,13 @@ int main( int argc, char **argv )
|
|||||||
rc.setBuffer(scratchPad.startPtr(), scratchPad.numBytes());
|
rc.setBuffer(scratchPad.startPtr(), scratchPad.numBytes());
|
||||||
|
|
||||||
rc.sync();
|
rc.sync();
|
||||||
|
|
||||||
scratchPad.reset();
|
scratchPad.reset();
|
||||||
scratchPad.read(cp);
|
scratchPad.read(cp);
|
||||||
|
|
||||||
// cp.writeEventQueue(viewer);
|
// cp.writeEventQueue(viewer);
|
||||||
|
|
||||||
if (cp.getMasterKilled())
|
if (cp.getMasterKilled())
|
||||||
{
|
{
|
||||||
std::cout << "Received master killed."<<std::endl;
|
std::cout << "Received master killed."<<std::endl;
|
||||||
// break out of while (!done) loop since we've now want to shut down.
|
// break out of while (!done) loop since we've now want to shut down.
|
||||||
@@ -946,7 +930,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the scene by traversing it with the the update visitor which will
|
// update the scene by traversing it with the update visitor which will
|
||||||
// call all node update callbacks and animations.
|
// call all node update callbacks and animations.
|
||||||
viewer.eventTraversal();
|
viewer.eventTraversal();
|
||||||
|
|
||||||
@@ -972,10 +956,10 @@ int main( int argc, char **argv )
|
|||||||
seh->selectSlide(previous_ActiveSlide, previous_ActiveLayer);
|
seh->selectSlide(previous_ActiveSlide, previous_ActiveLayer);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the scene by traversing it with the the update visitor which will
|
// update the scene by traversing it with the update visitor which will
|
||||||
// call all node update callbacks and animations.
|
// call all node update callbacks and animations.
|
||||||
viewer.updateTraversal();
|
viewer.updateTraversal();
|
||||||
|
|
||||||
@@ -996,7 +980,7 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
ExportHTML::write(seh.get(), viewer, exportName);
|
ExportHTML::write(seh.get(), viewer, exportName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
ADD_SUBDIRECTORY(osgautocapture)
|
ADD_SUBDIRECTORY(osgautocapture)
|
||||||
ADD_SUBDIRECTORY(osgautotransform)
|
ADD_SUBDIRECTORY(osgautotransform)
|
||||||
ADD_SUBDIRECTORY(osgbillboard)
|
ADD_SUBDIRECTORY(osgbillboard)
|
||||||
|
ADD_SUBDIRECTORY(osgblenddrawbuffers)
|
||||||
ADD_SUBDIRECTORY(osgblendequation)
|
ADD_SUBDIRECTORY(osgblendequation)
|
||||||
ADD_SUBDIRECTORY(osgcallback)
|
ADD_SUBDIRECTORY(osgcallback)
|
||||||
ADD_SUBDIRECTORY(osgcamera)
|
ADD_SUBDIRECTORY(osgcamera)
|
||||||
@@ -46,7 +47,6 @@ 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(osggeometry)
|
ADD_SUBDIRECTORY(osggeometry)
|
||||||
@@ -65,6 +65,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
ADD_SUBDIRECTORY(osglightpoint)
|
ADD_SUBDIRECTORY(osglightpoint)
|
||||||
ADD_SUBDIRECTORY(osglogicop)
|
ADD_SUBDIRECTORY(osglogicop)
|
||||||
ADD_SUBDIRECTORY(osglogo)
|
ADD_SUBDIRECTORY(osglogo)
|
||||||
|
ADD_SUBDIRECTORY(osggpucull)
|
||||||
ADD_SUBDIRECTORY(osggpx)
|
ADD_SUBDIRECTORY(osggpx)
|
||||||
ADD_SUBDIRECTORY(osggraphicscost)
|
ADD_SUBDIRECTORY(osggraphicscost)
|
||||||
ADD_SUBDIRECTORY(osgmanipulator)
|
ADD_SUBDIRECTORY(osgmanipulator)
|
||||||
@@ -95,6 +96,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
ADD_SUBDIRECTORY(osgprerendercubemap)
|
ADD_SUBDIRECTORY(osgprerendercubemap)
|
||||||
ADD_SUBDIRECTORY(osgreflect)
|
ADD_SUBDIRECTORY(osgreflect)
|
||||||
ADD_SUBDIRECTORY(osgrobot)
|
ADD_SUBDIRECTORY(osgrobot)
|
||||||
|
ADD_SUBDIRECTORY(osgSSBO)
|
||||||
ADD_SUBDIRECTORY(osgscalarbar)
|
ADD_SUBDIRECTORY(osgscalarbar)
|
||||||
ADD_SUBDIRECTORY(osgscribe)
|
ADD_SUBDIRECTORY(osgscribe)
|
||||||
ADD_SUBDIRECTORY(osgsequence)
|
ADD_SUBDIRECTORY(osgsequence)
|
||||||
@@ -118,14 +120,17 @@ IF(DYNAMIC_OPENSCENEGRAPH)
|
|||||||
ADD_SUBDIRECTORY(osgstereomatch)
|
ADD_SUBDIRECTORY(osgstereomatch)
|
||||||
ADD_SUBDIRECTORY(osgterrain)
|
ADD_SUBDIRECTORY(osgterrain)
|
||||||
ADD_SUBDIRECTORY(osgthreadedterrain)
|
ADD_SUBDIRECTORY(osgthreadedterrain)
|
||||||
|
ADD_SUBDIRECTORY(osgtransferfunction)
|
||||||
ADD_SUBDIRECTORY(osgtext)
|
ADD_SUBDIRECTORY(osgtext)
|
||||||
ADD_SUBDIRECTORY(osgtext3D)
|
ADD_SUBDIRECTORY(osgtext3D)
|
||||||
ADD_SUBDIRECTORY(osgtexture1D)
|
ADD_SUBDIRECTORY(osgtexture1D)
|
||||||
ADD_SUBDIRECTORY(osgtexture2D)
|
ADD_SUBDIRECTORY(osgtexture2D)
|
||||||
|
ADD_SUBDIRECTORY(osgtexture2DArray)
|
||||||
ADD_SUBDIRECTORY(osgtexture3D)
|
ADD_SUBDIRECTORY(osgtexture3D)
|
||||||
ADD_SUBDIRECTORY(osgtexturerectangle)
|
ADD_SUBDIRECTORY(osgtexturerectangle)
|
||||||
ADD_SUBDIRECTORY(osgtexturecompression)
|
ADD_SUBDIRECTORY(osgtexturecompression)
|
||||||
ADD_SUBDIRECTORY(osgthirdpersonview)
|
ADD_SUBDIRECTORY(osgthirdpersonview)
|
||||||
|
ADD_SUBDIRECTORY(osgtransformfeedback)
|
||||||
ADD_SUBDIRECTORY(osguniformbuffer)
|
ADD_SUBDIRECTORY(osguniformbuffer)
|
||||||
ADD_SUBDIRECTORY(osguserstats)
|
ADD_SUBDIRECTORY(osguserstats)
|
||||||
ADD_SUBDIRECTORY(osgvertexprogram)
|
ADD_SUBDIRECTORY(osgvertexprogram)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// Search in str for all occurences of spat and replace them with rpat.
|
// Search in str for all occurrences of spat and replace them with rpat.
|
||||||
void searchAndReplace(std::string& str, const std::string& spat, const std::string& rpat)
|
void searchAndReplace(std::string& str, const std::string& spat, const std::string& rpat)
|
||||||
{
|
{
|
||||||
std::string::size_type pos = 0;
|
std::string::size_type pos = 0;
|
||||||
@@ -30,13 +30,13 @@ void writeShader(osg::Shader* shader, const std::string& cppFileName, const std:
|
|||||||
searchAndReplace(shaderSource, "\r\n", "\n");
|
searchAndReplace(shaderSource, "\r\n", "\n");
|
||||||
searchAndReplace(shaderSource, "\r", "\n");
|
searchAndReplace(shaderSource, "\r", "\n");
|
||||||
searchAndReplace(shaderSource, "\"", "\\\"");
|
searchAndReplace(shaderSource, "\"", "\\\"");
|
||||||
|
|
||||||
std::string variableString = std::string("char ")+variableName+std::string("[] = ");
|
std::string variableString = std::string("char ")+variableName+std::string("[] = ");
|
||||||
|
|
||||||
std::string::size_type startOfLine = 0;
|
std::string::size_type startOfLine = 0;
|
||||||
std::string::size_type endOfLine = shaderSource.find_first_of('\n', startOfLine);
|
std::string::size_type endOfLine = shaderSource.find_first_of('\n', startOfLine);
|
||||||
|
|
||||||
if (endOfLine==std::string::npos)
|
if (endOfLine==std::string::npos)
|
||||||
{
|
{
|
||||||
fout<<variableString<<shaderSource<<"\\n\";"<<std::endl;
|
fout<<variableString<<shaderSource<<"\\n\";"<<std::endl;
|
||||||
}
|
}
|
||||||
@@ -63,25 +63,29 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is 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 glsl shader files into char arrays that can be compiled into applications.");
|
||||||
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("--write-to-source-file-directory","Use the path to the source filename as the directory to write to.");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");
|
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");
|
||||||
|
|
||||||
// if user request help write it out to cout.
|
// if user request help write it out to cout.
|
||||||
if (arguments.read("-h") || arguments.read("--help"))
|
if (arguments.read("-h") || arguments.read("--help"))
|
||||||
{
|
{
|
||||||
arguments.getApplicationUsage()->write(std::cout);
|
arguments.getApplicationUsage()->write(std::cout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool useSamePathAsSourceFile = false;
|
||||||
|
if (arguments.read("--write-to-source-file-directory")) useSamePathAsSourceFile = true;
|
||||||
|
|
||||||
std::string filename;
|
std::string filename;
|
||||||
if (arguments.read("--shader",filename))
|
if (arguments.read("--shader",filename))
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Shader> shader = osgDB::readShaderFile(filename);
|
osg::ref_ptr<osg::Shader> shader = osgDB::readRefShaderFile(filename);
|
||||||
if (shader.valid())
|
if (shader.valid())
|
||||||
{
|
{
|
||||||
std::string name = osgDB::getStrippedName(filename);
|
std::string name = osgDB::getStrippedName(filename);
|
||||||
@@ -94,9 +98,11 @@ int main( int argc, char **argv )
|
|||||||
name[pos] = '_';
|
name[pos] = '_';
|
||||||
pos = name.find_first_of(invalidCharacters);
|
pos = name.find_first_of(invalidCharacters);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ext = osgDB::getFileExtension(filename);
|
std::string ext = osgDB::getFileExtension(filename);
|
||||||
std::string cppFileName = osgDB::concatPaths(path, name + "_" + ext + ".cpp");
|
std::string cppFileName = name + "_" + ext + ".cpp";
|
||||||
|
if (useSamePathAsSourceFile) cppFileName = osgDB::concatPaths(path, cppFileName);
|
||||||
|
|
||||||
std::string variableName = name + "_" + ext;
|
std::string variableName = name + "_" + ext;
|
||||||
writeShader(shader.get(), cppFileName, variableName);
|
writeShader(shader.get(), cppFileName, variableName);
|
||||||
|
|
||||||
@@ -107,7 +113,7 @@ int main( int argc, char **argv )
|
|||||||
std::cout<<"Error: could not find file '"<<filename<<"'"<<std::endl;
|
std::cout<<"Error: could not find file '"<<filename<<"'"<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout<<"No appropriate command line options used."<<std::endl;
|
std::cout<<"No appropriate command line options used."<<std::endl;
|
||||||
|
|||||||
@@ -59,10 +59,10 @@ class ViewerFrameThread : public OpenThreads::Thread
|
|||||||
|
|
||||||
~ViewerFrameThread()
|
~ViewerFrameThread()
|
||||||
{
|
{
|
||||||
cancel();
|
if (isRunning())
|
||||||
while(isRunning())
|
|
||||||
{
|
{
|
||||||
OpenThreads::Thread::YieldCurrentThread();
|
cancel();
|
||||||
|
join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,25 +107,25 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//We would need to document the following somewhere in order to guide people on
|
//We would need to document the following somewhere in order to guide people on
|
||||||
//what they need to use...
|
//what they need to use...
|
||||||
//
|
//
|
||||||
//----------------------------------------------
|
//----------------------------------------------
|
||||||
//There are two angles to consider.
|
//There are two angles to consider.
|
||||||
//
|
//
|
||||||
//1. If someone wants a widget in their Qt app to be an OSG-rendered scene, they
|
//1. If someone wants a widget in their Qt app to be an OSG-rendered scene, they
|
||||||
//need GraphicsWindowQt (in the osgViewerQtContext example) or QOSGWidget (in the
|
//need GraphicsWindowQt (in the osgViewerQtContext example) or QOSGWidget (in the
|
||||||
//osgViewerQt example). These two allow both OSG and Qt to manage their threads
|
//osgViewerQt example). These two allow both OSG and Qt to manage their threads
|
||||||
//in a way which is optimal to them. We've used QOSGWidget in the past and had
|
//in a way which is optimal to them. We've used QOSGWidget in the past and had
|
||||||
//trouble when Qt tried to overlay other widgets over the QOSGWidget (since OSG
|
//trouble when Qt tried to overlay other widgets over the QOSGWidget (since OSG
|
||||||
//did its rendering independently of Qt, it would overwrite what Qt had drawn). I
|
//did its rendering independently of Qt, it would overwrite what Qt had drawn). I
|
||||||
//haven't tried GraphicsWindowQt yet, but I expect since it uses QGLWidget, it
|
//haven't tried GraphicsWindowQt yet, but I expect since it uses QGLWidget, it
|
||||||
//will result in Qt knowing when OSG has drawn and be able to do overlays at the
|
//will result in Qt knowing when OSG has drawn and be able to do overlays at the
|
||||||
//right time. Eventually GraphicsWindowQt can be brought into osgViewer I imagine...
|
//right time. Eventually GraphicsWindowQt can be brought into osgViewer I imagine...
|
||||||
//
|
//
|
||||||
//2. If someone wants to bring Qt widgets inside their OSG scene (to do HUDs or
|
//2. If someone wants to bring Qt widgets inside their OSG scene (to do HUDs or
|
||||||
//an interface on a computer screen which is inside the 3D scene, or even
|
//an interface on a computer screen which is inside the 3D scene, or even
|
||||||
//floating Qt widgets, for example). That's where QGraphicsViewAdapter +
|
//floating Qt widgets, for example). That's where QGraphicsViewAdapter +
|
||||||
//QWidgetImage will be useful.
|
//QWidgetImage will be useful.
|
||||||
//----------------------------------------------
|
//----------------------------------------------
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ int main(int argc, char **argv)
|
|||||||
bool useLabel = false;
|
bool useLabel = false;
|
||||||
if (arguments.read("--useLabel")) useLabel = true;
|
if (arguments.read("--useLabel")) useLabel = true;
|
||||||
|
|
||||||
// true = make a Qt window with the same content to compare to
|
// true = make a Qt window with the same content to compare to
|
||||||
// QWebViewImage/QWidgetImage
|
// QWebViewImage/QWidgetImage
|
||||||
// false = use QWebViewImage/QWidgetImage (depending on useWidgetImage)
|
// false = use QWebViewImage/QWidgetImage (depending on useWidgetImage)
|
||||||
bool sanityCheck = false;
|
bool sanityCheck = false;
|
||||||
@@ -183,9 +183,9 @@ int main(int argc, char **argv)
|
|||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// QWebViewImage test
|
// QWebViewImage test
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Note: When the last few issues with QWidgetImage are fixed,
|
// Note: When the last few issues with QWidgetImage are fixed,
|
||||||
// QWebViewImage and this if() {} section can be removed since
|
// QWebViewImage and this if() {} section can be removed since
|
||||||
// QWidgetImage can display a QWebView just like QWebViewImage. Use
|
// QWidgetImage can display a QWebView just like QWebViewImage. Use
|
||||||
// --useWidgetImage --useBrowser to see that in action.
|
// --useWidgetImage --useBrowser to see that in action.
|
||||||
|
|
||||||
if (!sanityCheck)
|
if (!sanityCheck)
|
||||||
@@ -193,7 +193,7 @@ int main(int argc, char **argv)
|
|||||||
osg::ref_ptr<osgQt::QWebViewImage> image = new osgQt::QWebViewImage;
|
osg::ref_ptr<osgQt::QWebViewImage> image = new osgQt::QWebViewImage;
|
||||||
|
|
||||||
if (arguments.argc()>1) image->navigateTo((arguments[1]));
|
if (arguments.argc()>1) image->navigateTo((arguments[1]));
|
||||||
else image->navigateTo("http://www.youtube.com/");
|
else image->navigateTo("http://www.openscenegraph.org/");
|
||||||
|
|
||||||
osgWidget::GeometryHints hints(osg::Vec3(0.0f,0.0f,0.0f),
|
osgWidget::GeometryHints hints(osg::Vec3(0.0f,0.0f,0.0f),
|
||||||
osg::Vec3(1.0f,0.0f,0.0f),
|
osg::Vec3(1.0f,0.0f,0.0f),
|
||||||
@@ -208,7 +208,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Sanity check, do the same thing as QGraphicsViewAdapter but in
|
// Sanity check, do the same thing as QGraphicsViewAdapter but in
|
||||||
// a separate Qt window.
|
// a separate Qt window.
|
||||||
QWebPage* webPage = new QWebPage;
|
QWebPage* webPage = new QWebPage;
|
||||||
webPage->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
|
webPage->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
|
||||||
@@ -218,7 +218,7 @@ int main(int argc, char **argv)
|
|||||||
webView->setPage(webPage);
|
webView->setPage(webPage);
|
||||||
|
|
||||||
if (arguments.argc()>1) webView->load(QUrl(arguments[1]));
|
if (arguments.argc()>1) webView->load(QUrl(arguments[1]));
|
||||||
else webView->load(QUrl("http://www.youtube.com/"));
|
else webView->load(QUrl("http://www.openscenegraph.org/"));
|
||||||
|
|
||||||
QGraphicsScene* graphicsScene = new QGraphicsScene;
|
QGraphicsScene* graphicsScene = new QGraphicsScene;
|
||||||
graphicsScene->addWidget(webView);
|
graphicsScene->addWidget(webView);
|
||||||
@@ -240,14 +240,16 @@ int main(int argc, char **argv)
|
|||||||
// QWidgetImage test
|
// QWidgetImage test
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// QWidgetImage still has some issues, some examples are:
|
// QWidgetImage still has some issues, some examples are:
|
||||||
//
|
//
|
||||||
// 1. Editing in the QTextEdit doesn't work. Also when started with
|
// 1. Editing in the QTextEdit doesn't work. Also when started with
|
||||||
// --useBrowser, editing in the search field on YouTube doesn't
|
// --useBrowser, editing in the search field on YouTube doesn't
|
||||||
// work. But that same search field when using QWebViewImage
|
// work. But that same search field when using QWebViewImage
|
||||||
// works... And editing in the text field in the pop-up getInteger
|
// works... And editing in the text field in the pop-up getInteger
|
||||||
// dialog works too. All these cases use QGraphicsViewAdapter
|
// dialog works too. All these cases use QGraphicsViewAdapter
|
||||||
// under the hood, so why do some work and others don't?
|
// under the hood, so why do some work and others don't?
|
||||||
//
|
//
|
||||||
|
// <<< FIXED, need TextEditorInteraction >>>
|
||||||
|
//
|
||||||
// a) osgQtBrowser --useWidgetImage [--fullscreen] (optional)
|
// a) osgQtBrowser --useWidgetImage [--fullscreen] (optional)
|
||||||
// b) Try to click in the QTextEdit and type, or to select text
|
// b) Try to click in the QTextEdit and type, or to select text
|
||||||
// and drag-and-drop it somewhere else in the QTextEdit. These
|
// and drag-and-drop it somewhere else in the QTextEdit. These
|
||||||
@@ -259,11 +261,11 @@ int main(int argc, char **argv)
|
|||||||
// g) osgQtBrowser
|
// g) osgQtBrowser
|
||||||
// h) Try the operation in f), it works.
|
// h) Try the operation in f), it works.
|
||||||
//
|
//
|
||||||
// 2. Operations on floating windows (--numFloatingWindows 1 or more).
|
// 2. Operations on floating windows (--numFloatingWindows 1 or more).
|
||||||
// Moving by dragging the titlebar, clicking the close button,
|
// Moving by dragging the titlebar, clicking the close button,
|
||||||
// resizing them, none of these work. I wonder if it's because the
|
// resizing them, none of these work. I wonder if it's because the
|
||||||
// OS manages those functions (they're functions of the window
|
// OS manages those functions (they're functions of the window
|
||||||
// decorations) so we need to do something special for that? But
|
// decorations) so we need to do something special for that? But
|
||||||
// in --sanityCheck mode they work.
|
// in --sanityCheck mode they work.
|
||||||
//
|
//
|
||||||
// a) osgQtBrowser --useWidgetImage --numFloatingWindows 1 [--fullscreen]
|
// a) osgQtBrowser --useWidgetImage --numFloatingWindows 1 [--fullscreen]
|
||||||
@@ -272,35 +274,37 @@ int main(int argc, char **argv)
|
|||||||
// c) osgQtBrowser --useWidgetImage --numFloatingWindows 1 --sanityCheck
|
// c) osgQtBrowser --useWidgetImage --numFloatingWindows 1 --sanityCheck
|
||||||
// d) Try the operations in b), all they work.
|
// d) Try the operations in b), all they work.
|
||||||
// e) osgQtBrowser --useWidgetImage [--fullscreen]
|
// e) osgQtBrowser --useWidgetImage [--fullscreen]
|
||||||
// f) Click the button so that the getInteger() dialog is
|
// f) Click the button so that the getInteger() dialog is
|
||||||
// displayed, then try to move that dialog or close it with the
|
// displayed, then try to move that dialog or close it with the
|
||||||
// close button, these don't work.
|
// close button, these don't work.
|
||||||
// g) osgQtBrowser --useWidgetImage --sanityCheck
|
// g) osgQtBrowser --useWidgetImage --sanityCheck
|
||||||
// h) Try the operation in f), it works.
|
// h) Try the operation in f), it works.
|
||||||
//
|
//
|
||||||
// 3. (Minor) The QGraphicsView's scrollbars don't appear when
|
// 3. (Minor) The QGraphicsView's scrollbars don't appear when
|
||||||
// using QWidgetImage or QWebViewImage. QGraphicsView is a
|
// using QWidgetImage or QWebViewImage. QGraphicsView is a
|
||||||
// QAbstractScrollArea and it should display scrollbars as soon as
|
// QAbstractScrollArea and it should display scrollbars as soon as
|
||||||
// the scene is too large to fit the view.
|
// the scene is too large to fit the view.
|
||||||
//
|
//
|
||||||
|
// <<< FIXED >>>
|
||||||
|
//
|
||||||
// a) osgQtBrowser --useWidgetImage --fullscreen
|
// a) osgQtBrowser --useWidgetImage --fullscreen
|
||||||
// b) Resize the OSG window so it's smaller than the QTextEdit.
|
// b) Resize the OSG window so it's smaller than the QTextEdit.
|
||||||
// Scrollbars should appear but don't.
|
// Scrollbars should appear but don't.
|
||||||
// c) osgQtBrowser --useWidgetImage --sanityCheck
|
// c) osgQtBrowser --useWidgetImage --sanityCheck
|
||||||
// d) Try the operation in b), scrollbars appear. Even if you have
|
// d) Try the operation in b), scrollbars appear. Even if you have
|
||||||
// floating windows (by clicking the button or by adding
|
// floating windows (by clicking the button or by adding
|
||||||
// --numFloatingWindows 1) and move them outside the view,
|
// --numFloatingWindows 1) and move them outside the view,
|
||||||
// scrollbars appear too. You can't test that case in OSG for
|
// scrollbars appear too. You can't test that case in OSG for
|
||||||
// now because of problem 2 above, but that's pretty cool.
|
// now because of problem 2 above, but that's pretty cool.
|
||||||
//
|
//
|
||||||
// 4. (Minor) In sanity check mode, the widget added to the
|
// 4. (Minor) In sanity check mode, the widget added to the
|
||||||
// QGraphicsView is centered. With QGraphicsViewAdapter, it is not.
|
// QGraphicsView is centered. With QGraphicsViewAdapter, it is not.
|
||||||
//
|
//
|
||||||
// a) osgQtBrowser --useWidgetImage [--fullscreen]
|
// a) osgQtBrowser --useWidgetImage [--fullscreen]
|
||||||
// b) The QTextEdit and button are not in the center of the image
|
// b) The QTextEdit and button are not in the center of the image
|
||||||
// generated by the QGraphicsViewAdapter.
|
// generated by the QGraphicsViewAdapter.
|
||||||
// c) osgQtBrowser --useWidgetImage --sanityCheck
|
// c) osgQtBrowser --useWidgetImage --sanityCheck
|
||||||
// d) The QTextEdit and button are in the center of the
|
// d) The QTextEdit and button are in the center of the
|
||||||
// QGraphicsView.
|
// QGraphicsView.
|
||||||
|
|
||||||
|
|
||||||
@@ -346,7 +350,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
QTextEdit* textEdit = new QTextEdit(text);
|
QTextEdit* textEdit = new QTextEdit(text);
|
||||||
textEdit->setReadOnly(false);
|
textEdit->setReadOnly(false);
|
||||||
textEdit->setTextInteractionFlags(Qt::TextEditable);
|
textEdit->setTextInteractionFlags(Qt::TextEditorInteraction);
|
||||||
|
|
||||||
QPalette palette = textEdit->palette();
|
QPalette palette = textEdit->palette();
|
||||||
palette.setColor(QPalette::Highlight, Qt::darkBlue);
|
palette.setColor(QPalette::Highlight, Qt::darkBlue);
|
||||||
@@ -388,7 +392,7 @@ int main(int argc, char **argv)
|
|||||||
texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
|
||||||
mt->getOrCreateStateSet()->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
|
mt->getOrCreateStateSet()->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
|
||||||
|
|
||||||
osgViewer::InteractiveImageHandler* handler;
|
osgViewer::InteractiveImageHandler* handler;
|
||||||
if (inScene)
|
if (inScene)
|
||||||
{
|
{
|
||||||
mt->setMatrix(osg::Matrix::rotate(osg::Vec3(0,1,0), osg::Vec3(0,0,1)));
|
mt->setMatrix(osg::Matrix::rotate(osg::Vec3(0,1,0), osg::Vec3(0,0,1)));
|
||||||
@@ -398,9 +402,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else // fullscreen
|
else // fullscreen
|
||||||
{
|
{
|
||||||
// The HUD camera's viewport needs to follow the size of the
|
// The HUD camera's viewport needs to follow the size of the
|
||||||
// window. MyInteractiveImageHandler will make sure of this.
|
// window. MyInteractiveImageHandler will make sure of this.
|
||||||
// As for the quad and the camera's projection, setting the
|
// As for the quad and the camera's projection, setting the
|
||||||
// projection resize policy to FIXED takes care of them, so
|
// projection resize policy to FIXED takes care of them, so
|
||||||
// they can stay the same: (0,1,0,1) with a quad that fits.
|
// they can stay the same: (0,1,0,1) with a quad that fits.
|
||||||
|
|
||||||
@@ -429,13 +433,13 @@ int main(int argc, char **argv)
|
|||||||
overlay->addChild(mt);
|
overlay->addChild(mt);
|
||||||
|
|
||||||
root->addChild(overlay);
|
root->addChild(overlay);
|
||||||
|
|
||||||
quad->setEventCallback(handler);
|
quad->setEventCallback(handler);
|
||||||
quad->setCullCallback(handler);
|
quad->setCullCallback(handler);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Sanity check, do the same thing as QWidgetImage and
|
// Sanity check, do the same thing as QWidgetImage and
|
||||||
// QGraphicsViewAdapter but in a separate Qt window.
|
// QGraphicsViewAdapter but in a separate Qt window.
|
||||||
|
|
||||||
graphicsScene = new QGraphicsScene;
|
graphicsScene = new QGraphicsScene;
|
||||||
|
|||||||
4
examples/osgSSBO/CMakeLists.txt
Normal file
4
examples/osgSSBO/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
SET(TARGET_SRC osgSSBO.cpp )
|
||||||
|
|
||||||
|
SETUP_EXAMPLE(osgSSBO)
|
||||||
949
examples/osgSSBO/osgSSBO.cpp
Normal file
949
examples/osgSSBO/osgSSBO.cpp
Normal file
@@ -0,0 +1,949 @@
|
|||||||
|
//info : osgSSBO example,testing ShaderStorageBufferObjects ,Markus Hein, 2014, osg-3.2.1
|
||||||
|
//required hardware and driver must support GL >= GL 4.3 or GL ES 3.1 (GL ES not tested, would be nice if someone will test it on a small device)
|
||||||
|
|
||||||
|
//testing osg support for Shader Storage Buffer Objects
|
||||||
|
|
||||||
|
//version: "first take" from last night session..
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <osg/StateAttributeCallback>
|
||||||
|
#include <osg/Texture2D>
|
||||||
|
#include <osg/Geometry>
|
||||||
|
#include <osg/Geode>
|
||||||
|
#include <osgDB/ReadFile>
|
||||||
|
#include <osgGA/StateSetManipulator>
|
||||||
|
#include <osgViewer/Viewer>
|
||||||
|
#include <osgViewer/ViewerEventHandlers>
|
||||||
|
|
||||||
|
#include <osg/Node>
|
||||||
|
#include <osg/PositionAttitudeTransform>
|
||||||
|
#include <osg/Geometry>
|
||||||
|
#include <osg/Notify>
|
||||||
|
#include <osg/MatrixTransform>
|
||||||
|
#include <osg/Texture2D>
|
||||||
|
#include <osg/TextureRectangle>
|
||||||
|
#include <osg/Stencil>
|
||||||
|
#include <osg/Depth>
|
||||||
|
#include <osg/Billboard>
|
||||||
|
#include <osg/Material>
|
||||||
|
#include <osg/AnimationPath>
|
||||||
|
|
||||||
|
#include <osgGA/TrackballManipulator>
|
||||||
|
#include <osgGA/FlightManipulator>
|
||||||
|
#include <osgGA/DriveManipulator>
|
||||||
|
|
||||||
|
#include <osgUtil/SmoothingVisitor>
|
||||||
|
|
||||||
|
#include <osgDB/Registry>
|
||||||
|
#include <osgDB/ReadFile>
|
||||||
|
#include <osgDB/WriteFile>
|
||||||
|
|
||||||
|
#include <osgViewer/Viewer>
|
||||||
|
#include <osgViewer/ViewerEventHandlers>
|
||||||
|
#include <osgViewer/Renderer>
|
||||||
|
|
||||||
|
|
||||||
|
#include <osg/Array>
|
||||||
|
#include <osg/BoundingSphere>
|
||||||
|
#include <osg/BufferIndexBinding>
|
||||||
|
#include <osg/BufferObject>
|
||||||
|
#include <osg/Group>
|
||||||
|
#include <osg/Math>
|
||||||
|
#include <osg/MatrixTransform>
|
||||||
|
#include <osg/Program>
|
||||||
|
#include <osg/Shader>
|
||||||
|
#include <osg/Drawable>
|
||||||
|
#include <osg/CopyOp>
|
||||||
|
#include <osg/State>
|
||||||
|
#include <osg/Matrix>
|
||||||
|
#include <osg/ShapeDrawable>
|
||||||
|
#include <osg/GL>
|
||||||
|
#include <osg/StateSet>
|
||||||
|
#include <osg/Texture2D>
|
||||||
|
#include <osg/BlendFunc>
|
||||||
|
#include <osg/TexEnv>
|
||||||
|
#include <osg/Material>
|
||||||
|
#include <osg/PointSprite>
|
||||||
|
#include <osg/Program>
|
||||||
|
#include <osg/Notify>
|
||||||
|
#include <osg/Point>
|
||||||
|
#include <osg/io_utils>
|
||||||
|
#include <osg/VertexProgram>
|
||||||
|
|
||||||
|
#include <osgText/Font>
|
||||||
|
#include <osgText/Text>
|
||||||
|
|
||||||
|
|
||||||
|
#include <osgDB/ReadFile>
|
||||||
|
#include <osgDB/WriteFile>
|
||||||
|
#include <osgDB/FileNameUtils>
|
||||||
|
#include <osgUtil/Optimizer>
|
||||||
|
#include <iostream>
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
|
|
||||||
|
using namespace osg;
|
||||||
|
|
||||||
|
|
||||||
|
//todo .. #define COMPUTATION_IN_SEPARATE_THREAD
|
||||||
|
|
||||||
|
#define WORK_GROUP_SIZE 16
|
||||||
|
|
||||||
|
|
||||||
|
#define PRERENDER_ANTIALIASINGMULTISAMPLES 16
|
||||||
|
#define PRERENDER_HIGH_QUALITY_ANTIALIASING
|
||||||
|
#define PRERENDER_WIDTH 1920
|
||||||
|
#define PRERENDER_HEIGHT 1080
|
||||||
|
|
||||||
|
|
||||||
|
#define SUB_PLACEMENT_OFFSET_HORIZONTAL 0.5
|
||||||
|
#define SUB_PLACEMENT_OFFSET_VERTICAL 0.5
|
||||||
|
|
||||||
|
enum BufferOffset
|
||||||
|
{
|
||||||
|
POSITION_NOW_OFFSET,
|
||||||
|
POSITION_OLD_OFFSET,
|
||||||
|
POSITION_INIT_OFFSET,
|
||||||
|
|
||||||
|
VELOCITY_NOW_OFFSET,
|
||||||
|
VELOCITY_OLD_OFFSET,
|
||||||
|
VELOCITY_INIT_OFFSET,
|
||||||
|
|
||||||
|
ACCELERATION_OFFSET,
|
||||||
|
PROPERTIES_OFFSET,
|
||||||
|
|
||||||
|
OFFSET_END
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const int __numDataValuesPerChannel = OFFSET_END;
|
||||||
|
const int __numChannels = 4;
|
||||||
|
|
||||||
|
//512x512x4x7 = 7.340.032 floats in SSBO on GPU
|
||||||
|
const int NUM_ELEMENTS_X = 512;
|
||||||
|
const int NUM_ELEMENTS_Y = 512;
|
||||||
|
|
||||||
|
float random(float min, float max) { return min + (max - min)*(float)rand() / (float)RAND_MAX; }
|
||||||
|
|
||||||
|
|
||||||
|
enum Channel
|
||||||
|
{
|
||||||
|
RED_CHANNEL,
|
||||||
|
GREEN_CHANNEL,
|
||||||
|
BLUE_CHANNEL,
|
||||||
|
ALPHA_CHANNEL,
|
||||||
|
RGB_CHANNEL,
|
||||||
|
RGBA_CHANNEL
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ShaderStorageBufferCallback : public osg::StateAttributeCallback
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void operator() (osg::StateAttribute* attr, osg::NodeVisitor* nv)
|
||||||
|
{
|
||||||
|
//if you need to process the data in your app-code , better leaving it on GPU and processing there, uploading per frame will make it slow
|
||||||
|
#if 0
|
||||||
|
osg::ShaderStorageBufferBinding* ssbb = static_cast<osg::ShaderStorageBufferBinding*>(attr);
|
||||||
|
osg::ShaderStorageBufferObject* ssbo
|
||||||
|
= static_cast<osg::ShaderStorageBufferObject*>(ssbb->getBufferObject());
|
||||||
|
|
||||||
|
osg::FloatArray* array = static_cast<osg::FloatArray*>(ssbo->getBufferData(0));
|
||||||
|
|
||||||
|
float someValue = array->at(0);
|
||||||
|
//std::cout << "someValue now: " << someValue << std::endl;
|
||||||
|
//data transfer performance test
|
||||||
|
// array->dirty();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//do not forget to set OSG_FILE_PATH to default OSG-Data and make sure the new shaders are copied there under"shaders"
|
||||||
|
class ComputeNode : public osg::PositionAttitudeTransform
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Program> _computeProgram;
|
||||||
|
osg::ref_ptr<osg::Shader> _computeShader; //compute and write position data in SSBO
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Shader> _vertexShader; //reading position data from SSBO (OBS!: make sure glMemoryBuffer() is syncing this)
|
||||||
|
osg::ref_ptr<osg::Shader> _geometryShader; //building a quad looking to the camera
|
||||||
|
osg::ref_ptr<osg::Shader> _fragmentShader; //use false-colors etc. for making your data visible
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Node> _helperNode; // coordinate system node
|
||||||
|
|
||||||
|
ref_ptr<osg::ShaderStorageBufferObject> _ssbo;
|
||||||
|
ref_ptr<osg::ShaderStorageBufferBinding> _ssbb;
|
||||||
|
|
||||||
|
GLfloat* _data; // some data we upload to GPU, initialised with random values
|
||||||
|
osg::ref_ptr<FloatArray> _dataArray; //
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Group> _computationResultsRenderGroup;
|
||||||
|
osg::ref_ptr<osg::Program> _computationResultsRenderProgram;
|
||||||
|
osg::ref_ptr<osg::StateSet> _computationResultsRenderStateSet;
|
||||||
|
|
||||||
|
|
||||||
|
std::string _computeShaderSourcePath;
|
||||||
|
std::string _vertexShaderSourcePath;
|
||||||
|
std::string _geometryShaderSourcePath;
|
||||||
|
std::string _fragmentShaderSourcePath;
|
||||||
|
|
||||||
|
|
||||||
|
void addHelperGeometry();
|
||||||
|
void addDataMonitor(osg::Vec3 placement, osg::Vec3 relativePlacement, float scale, Channel channel, BufferOffset shaderBufferOffset, std::string labelcaption, float minDataRange, float maxDataRange);
|
||||||
|
void addComputationResultsRenderTree();
|
||||||
|
void initComputingSetup();
|
||||||
|
|
||||||
|
ComputeNode()
|
||||||
|
{
|
||||||
|
const char* envOsgFilePath = getenv("OSG_FILE_PATH");
|
||||||
|
std::stringstream computeshaderpath; computeshaderpath << envOsgFilePath << "/shaders/osgssboComputeShader.cs";
|
||||||
|
_computeShaderSourcePath = computeshaderpath.str();
|
||||||
|
std::stringstream vertexshaderpath; vertexshaderpath << envOsgFilePath << "/shaders/osgssboVertexShader.vs";
|
||||||
|
_vertexShaderSourcePath = vertexshaderpath.str();
|
||||||
|
std::stringstream geometryshaderpath; geometryshaderpath << envOsgFilePath << "/shaders/osgssboGeometryShader.gs";
|
||||||
|
_geometryShaderSourcePath = geometryshaderpath.str();
|
||||||
|
std::stringstream fragmentshaderpath; fragmentshaderpath << envOsgFilePath << "/shaders/osgssboFragmentShader.fs";
|
||||||
|
_fragmentShaderSourcePath = fragmentshaderpath.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class ComputeNodeUpdateCallback : public osg::NodeCallback
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
ComputeNode* _computeNode;
|
||||||
|
osg::Timer_t _prevShaderUpdateTime;
|
||||||
|
osg::Timer _timer;
|
||||||
|
|
||||||
|
ComputeNodeUpdateCallback(){}
|
||||||
|
|
||||||
|
ComputeNodeUpdateCallback(ComputeNode* computeNode)
|
||||||
|
{
|
||||||
|
_computeNode = computeNode;
|
||||||
|
_prevShaderUpdateTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||||
|
{
|
||||||
|
osg::Timer_t currTime = _timer.tick();
|
||||||
|
|
||||||
|
if (_timer.delta_s(_prevShaderUpdateTime, currTime) > 1.0) //one second interval for shader-changed-do-reload check
|
||||||
|
{
|
||||||
|
osg::ref_ptr<osg::Shader> reloadedshader;
|
||||||
|
std::string runningSource;
|
||||||
|
std::string reloadedstring;
|
||||||
|
|
||||||
|
if (_computeNode->_computeShader.valid())
|
||||||
|
{
|
||||||
|
runningSource = _computeNode->_computeShader->getShaderSource();
|
||||||
|
reloadedshader = osg::Shader::readShaderFile(osg::Shader::COMPUTE, _computeNode->_computeShaderSourcePath);
|
||||||
|
|
||||||
|
reloadedstring = reloadedshader->getShaderSource();
|
||||||
|
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
|
||||||
|
{
|
||||||
|
_computeNode->_computeProgram->removeShader(_computeNode->_computeShader.get());
|
||||||
|
_computeNode->_computeShader = reloadedshader.get();
|
||||||
|
_computeNode->_computeProgram->addShader(_computeNode->_computeShader.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_computeNode->_vertexShader.valid())
|
||||||
|
{
|
||||||
|
|
||||||
|
runningSource = _computeNode->_vertexShader->getShaderSource();
|
||||||
|
reloadedshader = osg::Shader::readShaderFile(osg::Shader::VERTEX, _computeNode->_vertexShaderSourcePath);
|
||||||
|
|
||||||
|
reloadedstring = reloadedshader->getShaderSource();
|
||||||
|
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
|
||||||
|
{
|
||||||
|
_computeNode->_computationResultsRenderProgram->removeShader(_computeNode->_vertexShader.get());
|
||||||
|
_computeNode->_vertexShader = reloadedshader.get();
|
||||||
|
_computeNode->_computationResultsRenderProgram->addShader(_computeNode->_vertexShader.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (_computeNode->_geometryShader.valid())
|
||||||
|
{
|
||||||
|
runningSource = _computeNode->_geometryShader->getShaderSource();
|
||||||
|
reloadedshader = osg::Shader::readShaderFile(osg::Shader::GEOMETRY, _computeNode->_geometryShaderSourcePath);
|
||||||
|
|
||||||
|
reloadedstring = reloadedshader->getShaderSource();
|
||||||
|
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
|
||||||
|
{
|
||||||
|
_computeNode->_computationResultsRenderProgram->removeShader(_computeNode->_geometryShader.get());
|
||||||
|
_computeNode->_geometryShader = reloadedshader.get();
|
||||||
|
_computeNode->_computationResultsRenderProgram->addShader(_computeNode->_geometryShader.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_computeNode->_fragmentShader.valid())
|
||||||
|
{
|
||||||
|
runningSource = _computeNode->_fragmentShader->getShaderSource();
|
||||||
|
reloadedshader = osg::Shader::readShaderFile(osg::Shader::FRAGMENT, _computeNode->_fragmentShaderSourcePath);
|
||||||
|
|
||||||
|
reloadedstring = reloadedshader->getShaderSource();
|
||||||
|
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
|
||||||
|
{
|
||||||
|
_computeNode->_computationResultsRenderProgram->removeShader(_computeNode->_fragmentShader.get());
|
||||||
|
_computeNode->_fragmentShader = reloadedshader.get();
|
||||||
|
_computeNode->_computationResultsRenderProgram->addShader(_computeNode->_fragmentShader.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_prevShaderUpdateTime = _timer.tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
traverse(node, nv);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//set OSG_FILE_PATH for loading axes.osgt
|
||||||
|
void ComputeNode::addHelperGeometry()
|
||||||
|
{
|
||||||
|
_helperNode = osgDB::readRefNodeFile("axes.osgt");
|
||||||
|
|
||||||
|
if (_helperNode.valid())
|
||||||
|
{
|
||||||
|
addChild(_helperNode.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
//osg::PositionAttitudeTransform* pat = new osg::PositionAttitudeTransform;
|
||||||
|
//pat->setPosition(osg::Vec3(0.5, 0, 0.5));
|
||||||
|
//osg::Geode *sphereGeode = new osg::Geode;
|
||||||
|
//float radius = 0.5f;
|
||||||
|
//osg::TessellationHints* hints = new osg::TessellationHints;
|
||||||
|
//hints->setDetailRatio(0.9f);
|
||||||
|
//osg::ShapeDrawable* sphere = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0f, 0.0f, 0.0f), radius), hints);
|
||||||
|
//sphereGeode->addDrawable(sphere);
|
||||||
|
//sphere->setColor(osg::Vec4(0, 1, 0, 0.1));
|
||||||
|
//osg::StateSet* stateset = sphereGeode->getOrCreateStateSet();
|
||||||
|
//osg::BlendFunc *blend = new osg::BlendFunc;
|
||||||
|
//blend->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA);
|
||||||
|
//stateset->setAttributeAndModes(blend, osg::StateAttribute::ON);
|
||||||
|
//pat->addChild(sphereGeode);
|
||||||
|
//addChild(pat);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ComputeNode::addDataMonitor(osg::Vec3 placement, osg::Vec3 relativePlacement, float scale, Channel colorchannel, BufferOffset shaderStorageBufferOffset, std::string labelCaption, float minDataRange, float maxDataRange)
|
||||||
|
{
|
||||||
|
osg::PositionAttitudeTransform* pat = new osg::PositionAttitudeTransform;
|
||||||
|
pat->setPosition(relativePlacement);
|
||||||
|
addChild(pat);
|
||||||
|
osg::Geometry* geom;
|
||||||
|
|
||||||
|
if (NUM_ELEMENTS_X >= NUM_ELEMENTS_Y)
|
||||||
|
{
|
||||||
|
float ratio = (float)((float)NUM_ELEMENTS_Y / (float)NUM_ELEMENTS_X);
|
||||||
|
geom = osg::createTexturedQuadGeometry(placement, osg::Vec3(1.0f*scale, 0.0f, 0.0f), osg::Vec3(0.0f, 0.0f, ratio*1.0f*scale));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float ratio = (float)((float)NUM_ELEMENTS_X / (float)NUM_ELEMENTS_Y);
|
||||||
|
geom = osg::createTexturedQuadGeometry(placement, osg::Vec3(ratio*1.0f*scale, 0.0f, 0.0f), osg::Vec3(0.0f, 0.0f, 1.0f*scale));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
geom->setVertexAttribArray(1, geom->getTexCoordArray(0), osg::Array::BIND_PER_VERTEX);
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Geode> quad = new osg::Geode;
|
||||||
|
quad->addDrawable(geom);
|
||||||
|
quad->setStateSet(getOrCreateStateSet());
|
||||||
|
pat->addChild(quad.get());
|
||||||
|
|
||||||
|
static const char* vertexShaderSrcChannelMonitor = {
|
||||||
|
|
||||||
|
"#version 430 \n"
|
||||||
|
|
||||||
|
"uniform int numRows;\n"
|
||||||
|
"uniform int numCols;\n"
|
||||||
|
"uniform float osg_FrameTime;\n"
|
||||||
|
"uniform mat4 osg_ProjectionMatrix;\n"
|
||||||
|
"uniform mat4 osg_ModelViewMatrix;\n"
|
||||||
|
"out vec2 texCoordFromVertexShader;\n"
|
||||||
|
"struct particle{ float x; float y; float z; float w;};"
|
||||||
|
"layout (location = 0) in vec3 vertexpos;\n"
|
||||||
|
"attribute vec2 tex_coords;\n"
|
||||||
|
"void main() {\n"
|
||||||
|
"texCoordFromVertexShader.xy = tex_coords.xy; gl_Position = ( osg_ProjectionMatrix * osg_ModelViewMatrix * vec4(vertexpos.x,vertexpos.y,vertexpos.z,1) ); \n"
|
||||||
|
"}\n"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
std::stringstream fragmentshaderstringstreamChannelMonitor;
|
||||||
|
fragmentshaderstringstreamChannelMonitor << "#version 430\n";
|
||||||
|
fragmentshaderstringstreamChannelMonitor << "uniform int numRows;\n";
|
||||||
|
fragmentshaderstringstreamChannelMonitor << "uniform int numCols;\n";
|
||||||
|
fragmentshaderstringstreamChannelMonitor << "uniform float dataRangeMin;\n";
|
||||||
|
fragmentshaderstringstreamChannelMonitor << "uniform float dataRangeMax;\n";
|
||||||
|
fragmentshaderstringstreamChannelMonitor << "in vec2 texCoordFromVertexShader;\n";
|
||||||
|
fragmentshaderstringstreamChannelMonitor << "struct particle{ float x; float y; float z; float w;};";
|
||||||
|
fragmentshaderstringstreamChannelMonitor << "layout(std140, binding=0) coherent buffer particles{particle p[];}; ";
|
||||||
|
fragmentshaderstringstreamChannelMonitor << "\n";
|
||||||
|
fragmentshaderstringstreamChannelMonitor << "void main(void)\n";
|
||||||
|
fragmentshaderstringstreamChannelMonitor << "{\n";
|
||||||
|
fragmentshaderstringstreamChannelMonitor << "ivec2 storePos = ivec2(numRows*texCoordFromVertexShader.x, numCols*texCoordFromVertexShader.y); particle particleData = p[" << shaderStorageBufferOffset * NUM_ELEMENTS_X*NUM_ELEMENTS_Y << " + (storePos.x*numRows + storePos.y)]; ";
|
||||||
|
|
||||||
|
//fragmentshaderstringstreamChannelMonitor << " memoryBarrierBuffer(); \n";
|
||||||
|
fragmentshaderstringstreamChannelMonitor << " float dataRangeMultiplier = 1.0 / abs(dataRangeMax - dataRangeMin); \n";
|
||||||
|
|
||||||
|
switch (colorchannel)
|
||||||
|
{
|
||||||
|
case RED_CHANNEL:
|
||||||
|
{
|
||||||
|
fragmentshaderstringstreamChannelMonitor << " vec4 color; color.x = 0.5+dataRangeMultiplier*particleData.x; color.y =0.0; color.z = 0.0; color.w = 1.0; gl_FragColor = color;\n";
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GREEN_CHANNEL:
|
||||||
|
{
|
||||||
|
fragmentshaderstringstreamChannelMonitor << " vec4 color; color.x = 0.0; color.y = 0.5+dataRangeMultiplier*particleData.y; color.z = 0.0; color.w = 1.0; gl_FragColor = color;\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BLUE_CHANNEL:
|
||||||
|
{
|
||||||
|
fragmentshaderstringstreamChannelMonitor << " vec4 color; color.x = 0.0; color.y = 0.0; color.z = 0.5+dataRangeMultiplier*particleData.z; color.w = 0.0 ; gl_FragColor = color;\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ALPHA_CHANNEL:
|
||||||
|
{
|
||||||
|
fragmentshaderstringstreamChannelMonitor << " vec4 color; color.x = 0.5+dataRangeMultiplier*particleData.w; color.y = 0.5+dataRangeMultiplier*particleData.w; color.z = 0.5+dataRangeMultiplier*particleData.w; color.w = 0.5+0.5*particleData.w; gl_FragColor = color;\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case RGB_CHANNEL:
|
||||||
|
{
|
||||||
|
fragmentshaderstringstreamChannelMonitor << " vec4 color; color.x = 0.5+dataRangeMultiplier*particleData.x; color.y = 0.5+dataRangeMultiplier*particleData.y; color.z = 0.5+dataRangeMultiplier*particleData.z; color.w = 1.0; gl_FragColor = color;\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case RGBA_CHANNEL:
|
||||||
|
{
|
||||||
|
fragmentshaderstringstreamChannelMonitor << " vec4 color; color.x = 0.5+dataRangeMultiplier*particleData.x; color.y = 0.5+dataRangeMultiplier*particleData.y; color.z = 0.5+dataRangeMultiplier*particleData.z; color.w = 0.5+0.5*particleData.w; gl_FragColor = color;\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fragmentshaderstringstreamChannelMonitor << "}\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
osg::Program * program = new osg::Program;
|
||||||
|
program->addShader(new osg::Shader(osg::Shader::VERTEX, vertexShaderSrcChannelMonitor));
|
||||||
|
program->addShader(new osg::Shader(osg::Shader::FRAGMENT, fragmentshaderstringstreamChannelMonitor.str().c_str()));
|
||||||
|
program->addBindAttribLocation("tex_coords", 1);
|
||||||
|
|
||||||
|
osg::StateSet* ss = geom->getOrCreateStateSet();
|
||||||
|
ss->setAttributeAndModes(program, osg::StateAttribute::ON);
|
||||||
|
ss->addUniform(new osg::Uniform("numRows", (int)NUM_ELEMENTS_X));
|
||||||
|
ss->addUniform(new osg::Uniform("numCols", (int)NUM_ELEMENTS_Y));
|
||||||
|
|
||||||
|
ss->addUniform(new osg::Uniform("dataRangeMin", (float)minDataRange));
|
||||||
|
ss->addUniform(new osg::Uniform("dataRangeMax", (float)maxDataRange));
|
||||||
|
|
||||||
|
|
||||||
|
ss->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||||
|
|
||||||
|
//add a label
|
||||||
|
osg::ref_ptr<osgText::Text> text = new osgText::Text;
|
||||||
|
osg::ref_ptr<osgText::Font> font = osgText::readRefFontFile("fonts/arial.ttf");
|
||||||
|
text->setFont(font);
|
||||||
|
text->setColor(osg::Vec4(1, 1, 1, 1));
|
||||||
|
text->setCharacterSize(0.1*scale);
|
||||||
|
text->setPosition(placement + osg::Vec3(0.05, 0.05, 0));
|
||||||
|
pat->setName(labelCaption);
|
||||||
|
text->setText(pat->getName());
|
||||||
|
text->setBackdropType(osgText::Text::OUTLINE);
|
||||||
|
text->setBackdropImplementation(osgText::Text::POLYGON_OFFSET);
|
||||||
|
text->setBackdropOffset(0.05f);
|
||||||
|
text->setBackdropColor(osg::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||||
|
|
||||||
|
quad->addDrawable(text);
|
||||||
|
|
||||||
|
pat->addChild(quad.get());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//compute texture image , taken from osgspotlight
|
||||||
|
osg::Image* createSpotLightImage(const osg::Vec4& centerColour, const osg::Vec4& backgroudColour, unsigned int size, float power)
|
||||||
|
{
|
||||||
|
osg::Image* image = new osg::Image;
|
||||||
|
image->allocateImage(size, size, 1,
|
||||||
|
GL_RGBA, GL_UNSIGNED_BYTE);
|
||||||
|
|
||||||
|
|
||||||
|
float mid = (float(size) - 1)*0.5f;
|
||||||
|
float div = 2.0f / float(size);
|
||||||
|
for (unsigned int r = 0; r < size; ++r)
|
||||||
|
{
|
||||||
|
unsigned char* ptr = image->data(0, r, 0);
|
||||||
|
for (unsigned int c = 0; c < size; ++c)
|
||||||
|
{
|
||||||
|
float dx = (float(c) - mid)*div;
|
||||||
|
float dy = (float(r) - mid)*div;
|
||||||
|
float r = powf(1.0f - sqrtf(dx*dx + dy*dy), power);
|
||||||
|
if (r < 0.0f) r = 0.0f;
|
||||||
|
osg::Vec4 color = centerColour*r + backgroudColour*(1.0f - r);
|
||||||
|
*ptr++ = (unsigned char)((color[0])*255.0f);
|
||||||
|
*ptr++ = (unsigned char)((color[1])*255.0f);
|
||||||
|
*ptr++ = (unsigned char)((color[2])*255.0f);
|
||||||
|
*ptr++ = (unsigned char)((color[3])*255.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ComputeNode::addComputationResultsRenderTree()
|
||||||
|
{
|
||||||
|
|
||||||
|
_computationResultsRenderProgram = new osg::Program;
|
||||||
|
|
||||||
|
_vertexShader = osg::Shader::readShaderFile(osg::Shader::VERTEX, _vertexShaderSourcePath);
|
||||||
|
_computationResultsRenderProgram->addShader(_vertexShader.get());
|
||||||
|
|
||||||
|
_geometryShader = osg::Shader::readShaderFile(osg::Shader::GEOMETRY, _geometryShaderSourcePath);
|
||||||
|
_computationResultsRenderProgram->addShader(_geometryShader.get());
|
||||||
|
|
||||||
|
_fragmentShader = osg::Shader::readShaderFile(osg::Shader::FRAGMENT, _fragmentShaderSourcePath);
|
||||||
|
_computationResultsRenderProgram->addShader(_fragmentShader.get());
|
||||||
|
|
||||||
|
|
||||||
|
_computationResultsRenderProgram->addBindAttribLocation("tex_coords", 1);
|
||||||
|
|
||||||
|
_computationResultsRenderGroup = new osg::Group;
|
||||||
|
_computationResultsRenderGroup->setDataVariance(osg::Object::DYNAMIC);
|
||||||
|
_computationResultsRenderStateSet = _computationResultsRenderGroup->getOrCreateStateSet();
|
||||||
|
_computationResultsRenderStateSet->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||||
|
|
||||||
|
osg::PointSprite *sprite = new osg::PointSprite;
|
||||||
|
int texture_unit = 0;
|
||||||
|
_computationResultsRenderStateSet->setTextureAttributeAndModes(texture_unit, sprite, osg::StateAttribute::ON);
|
||||||
|
_computationResultsRenderStateSet->setAttributeAndModes(_computationResultsRenderProgram.get(), osg::StateAttribute::ON);
|
||||||
|
_computationResultsRenderStateSet->addUniform(new osg::Uniform("particleTexture", texture_unit));
|
||||||
|
_computationResultsRenderStateSet->addUniform(new osg::Uniform("numRows", (int)NUM_ELEMENTS_X));
|
||||||
|
_computationResultsRenderStateSet->addUniform(new osg::Uniform("numCols", (int)NUM_ELEMENTS_Y));
|
||||||
|
|
||||||
|
|
||||||
|
_computationResultsRenderStateSet->setMode(GL_POINT_SMOOTH, osg::StateAttribute::ON);
|
||||||
|
_computationResultsRenderStateSet->setMode(GL_VERTEX_PROGRAM_POINT_SIZE_ARB, osg::StateAttribute::ON);
|
||||||
|
_computationResultsRenderStateSet->setMode(GL_ALPHA_TEST, osg::StateAttribute::ON);
|
||||||
|
_computationResultsRenderStateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||||
|
|
||||||
|
osg::Texture2D *tex = new osg::Texture2D();
|
||||||
|
|
||||||
|
osg::Image* particleImage = createSpotLightImage(osg::Vec4(1, 0, 0, 1), osg::Vec4(0.5, 0, 0, 0.0), 32, 0.7);
|
||||||
|
if (particleImage)
|
||||||
|
{
|
||||||
|
tex->setImage(particleImage);
|
||||||
|
}
|
||||||
|
_computationResultsRenderStateSet->setTextureAttributeAndModes(texture_unit, tex, osg::StateAttribute::ON);
|
||||||
|
|
||||||
|
|
||||||
|
osg::BlendFunc *blend = new osg::BlendFunc;
|
||||||
|
if (false) //emissive particles
|
||||||
|
{
|
||||||
|
blend->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
blend->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA);
|
||||||
|
}
|
||||||
|
|
||||||
|
_computationResultsRenderStateSet->setAttributeAndModes(blend, osg::StateAttribute::ON);
|
||||||
|
|
||||||
|
|
||||||
|
osg::Depth* depth = new osg::Depth;
|
||||||
|
depth->setRange(0.0f, 0.0f);
|
||||||
|
depth->setFunction(osg::Depth::ALWAYS);
|
||||||
|
depth->setWriteMask(false);
|
||||||
|
depth->setFunction(osg::Depth::ALWAYS);
|
||||||
|
|
||||||
|
_computationResultsRenderStateSet->setAttributeAndModes(depth, osg::StateAttribute::OFF);
|
||||||
|
|
||||||
|
|
||||||
|
osg::Geode* particleGeode = new osg::Geode;
|
||||||
|
unsigned int numVertices = NUM_ELEMENTS_X*NUM_ELEMENTS_Y;
|
||||||
|
|
||||||
|
osg::Geometry* particleGeometry = new osg::Geometry;
|
||||||
|
particleGeometry->setUseDisplayList(false);
|
||||||
|
particleGeometry->setUseVertexBufferObjects(true);
|
||||||
|
|
||||||
|
osg::Vec3Array* vertexarray = new osg::Vec3Array;
|
||||||
|
osg::Vec2Array* tcoords = new osg::Vec2Array;
|
||||||
|
|
||||||
|
osg::Vec2 bottom_texcoord(0.0f, 0.0f);
|
||||||
|
|
||||||
|
osg::Vec2 dx_texcoord(1.0f / (float)(NUM_ELEMENTS_X), 0.0f);
|
||||||
|
osg::Vec2 dy_texcoord(0.0f, 1.0f / (float)(NUM_ELEMENTS_Y));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < NUM_ELEMENTS_X; i++)
|
||||||
|
{
|
||||||
|
osg::Vec2 texcoord = bottom_texcoord + dy_texcoord*(float)i;
|
||||||
|
|
||||||
|
for (int j = 0; j < NUM_ELEMENTS_Y; j++)
|
||||||
|
{
|
||||||
|
vertexarray->push_back(osg::Vec3(texcoord.x(), texcoord.y(), 0.0));
|
||||||
|
tcoords->push_back(osg::Vec2(texcoord.x(), texcoord.y()));
|
||||||
|
texcoord += dx_texcoord;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
particleGeometry->setVertexArray(vertexarray);
|
||||||
|
particleGeometry->addPrimitiveSet(new osg::DrawArrays(GL_POINTS, 0, numVertices));
|
||||||
|
particleGeometry->setTexCoordArray(0, tcoords);
|
||||||
|
//this glMemoryBarrier thing... not sure if we could better do instanced drawing? all the data is in Shader Storage Buffer..
|
||||||
|
particleGeometry->setVertexAttribArray(1, particleGeometry->getTexCoordArray(0), osg::Array::BIND_PER_VERTEX);
|
||||||
|
|
||||||
|
_computationResultsRenderGroup->addChild(particleGeode);
|
||||||
|
particleGeode->addDrawable(particleGeometry);
|
||||||
|
|
||||||
|
addChild(_computationResultsRenderGroup.get());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ComputeNode::initComputingSetup()
|
||||||
|
{
|
||||||
|
|
||||||
|
_computeProgram = new osg::Program;
|
||||||
|
_computeProgram->setComputeGroups((NUM_ELEMENTS_X / WORK_GROUP_SIZE) <= 1 ? 1 : (NUM_ELEMENTS_X / WORK_GROUP_SIZE), (NUM_ELEMENTS_Y / WORK_GROUP_SIZE) <= 1 ? 1 : (NUM_ELEMENTS_Y / WORK_GROUP_SIZE), 1);
|
||||||
|
_computeShader = osg::Shader::readShaderFile(osg::Shader::COMPUTE, _computeShaderSourcePath);
|
||||||
|
_computeProgram->addShader(_computeShader.get());
|
||||||
|
|
||||||
|
setDataVariance(osg::Object::DYNAMIC);
|
||||||
|
osg::StateSet* statesetComputation = getOrCreateStateSet();
|
||||||
|
statesetComputation->setAttributeAndModes(_computeProgram.get());
|
||||||
|
statesetComputation->addUniform(new osg::Uniform("numCols", (int)NUM_ELEMENTS_X));
|
||||||
|
statesetComputation->addUniform(new osg::Uniform("numRows", (int)NUM_ELEMENTS_Y));
|
||||||
|
statesetComputation->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||||
|
|
||||||
|
//blocksize
|
||||||
|
int numParticles = NUM_ELEMENTS_X * NUM_ELEMENTS_Y;
|
||||||
|
const unsigned blockSize = numParticles * __numChannels * __numDataValuesPerChannel* sizeof(GLfloat);
|
||||||
|
|
||||||
|
//init all the particle data array
|
||||||
|
int idx = 0;
|
||||||
|
_data = new GLfloat[NUM_ELEMENTS_X * NUM_ELEMENTS_Y * __numChannels * __numDataValuesPerChannel];
|
||||||
|
_dataArray = new FloatArray;
|
||||||
|
|
||||||
|
//init the data array somehow, this way all is stored in one BufferObject. maybe better using multiple buffers instead? not sure what is faster and better for threading
|
||||||
|
for (int d = 0; d < __numDataValuesPerChannel; ++d)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < NUM_ELEMENTS_X; ++i)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (int j = 0; j < NUM_ELEMENTS_Y; ++j)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (int k = 0; k < __numChannels; ++k)
|
||||||
|
{
|
||||||
|
switch (k)
|
||||||
|
{
|
||||||
|
|
||||||
|
case (RED_CHANNEL) :
|
||||||
|
{
|
||||||
|
if ((d == POSITION_NOW_OFFSET) || (d == POSITION_OLD_OFFSET) || (d == POSITION_INIT_OFFSET))//position
|
||||||
|
{
|
||||||
|
*_data = random(0.25, 0.75);
|
||||||
|
}
|
||||||
|
if ((d == VELOCITY_NOW_OFFSET) || (d == VELOCITY_OLD_OFFSET) || (d == VELOCITY_INIT_OFFSET))//velocity
|
||||||
|
{
|
||||||
|
*_data = random(-2.4, 2.4);
|
||||||
|
}
|
||||||
|
if (d == ACCELERATION_OFFSET) //acceleration
|
||||||
|
{
|
||||||
|
*_data = random(-3.0, 3.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d == PROPERTIES_OFFSET) //property particle mass (compute shader is computing sphere mass from radius instead)
|
||||||
|
{
|
||||||
|
*_data = random(0.2, 15.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case (GREEN_CHANNEL) :
|
||||||
|
{
|
||||||
|
if ((d == POSITION_NOW_OFFSET) || (d == POSITION_OLD_OFFSET) || (d == POSITION_INIT_OFFSET))//position
|
||||||
|
{
|
||||||
|
*_data = random(0.25, 0.75);
|
||||||
|
}
|
||||||
|
if ((d == VELOCITY_NOW_OFFSET) || (d == VELOCITY_OLD_OFFSET) || (d == VELOCITY_INIT_OFFSET))//velocity
|
||||||
|
{
|
||||||
|
*_data = random(-2.4, 2.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d == ACCELERATION_OFFSET)//acceleration
|
||||||
|
{
|
||||||
|
*_data = random(-3.0, 3.0);
|
||||||
|
}
|
||||||
|
if (d == PROPERTIES_OFFSET) //property particle radius
|
||||||
|
{
|
||||||
|
*_data = random(0.07, 0.219);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case (BLUE_CHANNEL) :
|
||||||
|
{
|
||||||
|
if ((d == POSITION_NOW_OFFSET) || (d == POSITION_OLD_OFFSET) || (d == POSITION_INIT_OFFSET))//position
|
||||||
|
{
|
||||||
|
*_data = random(0.25, 0.75);
|
||||||
|
}
|
||||||
|
if ((d == VELOCITY_NOW_OFFSET) || (d == VELOCITY_OLD_OFFSET) || (d == VELOCITY_INIT_OFFSET))//velocity
|
||||||
|
{
|
||||||
|
*_data = random(-2.4, 2.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d == ACCELERATION_OFFSET)//acceleration
|
||||||
|
{
|
||||||
|
*_data = random(-3.0, 3.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (d == PROPERTIES_OFFSET) //place for some other property
|
||||||
|
{
|
||||||
|
*_data = random(0.0, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case (ALPHA_CHANNEL) :
|
||||||
|
{
|
||||||
|
if ((d == POSITION_NOW_OFFSET) || (d == POSITION_OLD_OFFSET) || (d == POSITION_INIT_OFFSET))//position
|
||||||
|
{
|
||||||
|
*_data = random(1.0, 1.0);
|
||||||
|
}
|
||||||
|
if ((d == VELOCITY_NOW_OFFSET) || (d == VELOCITY_OLD_OFFSET) || (d == VELOCITY_INIT_OFFSET))//velocity
|
||||||
|
{
|
||||||
|
*_data = random(-2.4, 2.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d == ACCELERATION_OFFSET) //acceleration
|
||||||
|
{
|
||||||
|
//*_data = random(1.0, 1.0);
|
||||||
|
*_data = random(0.0, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d == PROPERTIES_OFFSET) //place for some other property
|
||||||
|
{
|
||||||
|
*_data = random(0.3, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
_dataArray->push_back(*_data);
|
||||||
|
_data++;
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_ssbo = new osg::ShaderStorageBufferObject;
|
||||||
|
_dataArray->setBufferObject(_ssbo.get());
|
||||||
|
|
||||||
|
|
||||||
|
_ssbb = new osg::ShaderStorageBufferBinding(0, _ssbo.get(), 0, blockSize);
|
||||||
|
statesetComputation->setAttributeAndModes(_ssbb.get(), osg::StateAttribute::ON);
|
||||||
|
|
||||||
|
|
||||||
|
//option, do something useful with data or test the transfer speed
|
||||||
|
//_ssbb->setUpdateCallback(new ShaderStorageBufferCallback);
|
||||||
|
|
||||||
|
//adding a quad , visualizing data in buffer
|
||||||
|
addDataMonitor(osg::Vec3(0, -1, 0), osg::Vec3(SUB_PLACEMENT_OFFSET_HORIZONTAL * 0, -SUB_PLACEMENT_OFFSET_VERTICAL * -2.0, SUB_PLACEMENT_OFFSET_HORIZONTAL * 0), 1.0, RGB_CHANNEL, POSITION_NOW_OFFSET, "X,Y,Z - PositionNow", -1.0, 1.0);
|
||||||
|
|
||||||
|
//the coord from default dataset
|
||||||
|
addHelperGeometry();
|
||||||
|
|
||||||
|
|
||||||
|
addComputationResultsRenderTree();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//taken from osgdistorsion example for getting it nice on screen with antialiasing
|
||||||
|
osg::Node* createPrerenderSubgraph(osg::Node* subgraph, const osg::Vec4& clearColour)
|
||||||
|
{
|
||||||
|
osg::Group* prerenderNode = new osg::Group;
|
||||||
|
|
||||||
|
unsigned int tex_width = PRERENDER_WIDTH;
|
||||||
|
unsigned int tex_height = PRERENDER_HEIGHT;
|
||||||
|
|
||||||
|
osg::Texture2D* texture = new osg::Texture2D;
|
||||||
|
texture->setTextureSize(tex_width, tex_height);
|
||||||
|
texture->setInternalFormat(GL_RGBA);
|
||||||
|
texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
|
||||||
|
texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);
|
||||||
|
|
||||||
|
{
|
||||||
|
osg::Camera* prerenderCamera = new osg::Camera;
|
||||||
|
prerenderCamera->setClearColor(clearColour);
|
||||||
|
prerenderCamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
prerenderCamera->setReferenceFrame(osg::Transform::RELATIVE_RF);
|
||||||
|
prerenderCamera->setProjectionMatrix(osg::Matrixd::identity());
|
||||||
|
prerenderCamera->setViewMatrix(osg::Matrixd::identity());
|
||||||
|
prerenderCamera->setViewport(0, 0, tex_width, tex_height);
|
||||||
|
prerenderCamera->setRenderOrder(osg::Camera::PRE_RENDER);
|
||||||
|
prerenderCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
|
||||||
|
prerenderCamera->attach(osg::Camera::COLOR_BUFFER0, texture, 0, 0, false, PRERENDER_ANTIALIASINGMULTISAMPLES, PRERENDER_ANTIALIASINGMULTISAMPLES);
|
||||||
|
prerenderCamera->addChild(subgraph);
|
||||||
|
prerenderNode->addChild(prerenderCamera);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
osg::Geometry* polyGeom = new osg::Geometry();
|
||||||
|
|
||||||
|
polyGeom->setSupportsDisplayList(false);
|
||||||
|
|
||||||
|
osg::Vec3 origin(0.0f, 0.0f, 0.0f);
|
||||||
|
osg::Vec3 xAxis(1.0f, 0.0f, 0.0f);
|
||||||
|
osg::Vec3 yAxis(0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
|
float height = 1024.0f;
|
||||||
|
float width = 1280.0f;
|
||||||
|
int noSteps = 3;
|
||||||
|
|
||||||
|
osg::Vec3Array* vertices = new osg::Vec3Array;
|
||||||
|
osg::Vec2Array* texcoords = new osg::Vec2Array;
|
||||||
|
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||||
|
|
||||||
|
osg::Vec3 bottom = origin;
|
||||||
|
osg::Vec3 dx = xAxis*(width / ((float)(noSteps - 1)));
|
||||||
|
osg::Vec3 dy = yAxis*(height / ((float)(noSteps - 1)));
|
||||||
|
|
||||||
|
osg::Vec2 bottom_texcoord(0.0f, 0.0f);
|
||||||
|
osg::Vec2 dx_texcoord(1.0f / (float)(noSteps - 1), 0.0f);
|
||||||
|
osg::Vec2 dy_texcoord(0.0f, 1.0f / (float)(noSteps - 1));
|
||||||
|
|
||||||
|
int i, j;
|
||||||
|
for (i = 0; i < noSteps; ++i)
|
||||||
|
{
|
||||||
|
osg::Vec3 cursor = bottom + dy*(float)i;
|
||||||
|
osg::Vec2 texcoord = bottom_texcoord + dy_texcoord*(float)i;
|
||||||
|
for (j = 0; j < noSteps; ++j)
|
||||||
|
{
|
||||||
|
vertices->push_back(cursor);
|
||||||
|
texcoords->push_back(osg::Vec2((sin(texcoord.x()*osg::PI - osg::PI*0.5) + 1.0f)*0.5f, (sin(texcoord.y()*osg::PI - osg::PI*0.5) + 1.0f)*0.5f));
|
||||||
|
colors->push_back(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||||
|
cursor += dx;
|
||||||
|
texcoord += dx_texcoord;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
polyGeom->setVertexArray(vertices);
|
||||||
|
polyGeom->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
|
||||||
|
polyGeom->setTexCoordArray(0, texcoords);
|
||||||
|
|
||||||
|
for (i = 0; i < noSteps - 1; ++i)
|
||||||
|
{
|
||||||
|
osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(osg::PrimitiveSet::QUAD_STRIP);
|
||||||
|
for (j = 0; j < noSteps; ++j)
|
||||||
|
{
|
||||||
|
elements->push_back(j + (i + 1)*noSteps);
|
||||||
|
elements->push_back(j + (i)*noSteps);
|
||||||
|
}
|
||||||
|
polyGeom->addPrimitiveSet(elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
osg::StateSet* stateset = polyGeom->getOrCreateStateSet();
|
||||||
|
stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
|
||||||
|
stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||||
|
|
||||||
|
osg::Geode* geode = new osg::Geode();
|
||||||
|
geode->addDrawable(polyGeom);
|
||||||
|
|
||||||
|
osg::Camera* nestedRenderCamera = new osg::Camera;
|
||||||
|
nestedRenderCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
|
||||||
|
nestedRenderCamera->setViewMatrix(osg::Matrix::identity());
|
||||||
|
nestedRenderCamera->setProjectionMatrixAsOrtho2D(0, 1280, 0, 1024);
|
||||||
|
nestedRenderCamera->setRenderOrder(osg::Camera::NESTED_RENDER);
|
||||||
|
nestedRenderCamera->addChild(geode);
|
||||||
|
|
||||||
|
prerenderNode->addChild(nestedRenderCamera);
|
||||||
|
}
|
||||||
|
|
||||||
|
return prerenderNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
osg::ArgumentParser arguments(&argc, argv);
|
||||||
|
|
||||||
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Group> scene = new osg::Group;
|
||||||
|
|
||||||
|
|
||||||
|
viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));
|
||||||
|
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||||
|
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
||||||
|
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
||||||
|
viewer.getCamera()->setProjectionMatrixAsPerspective(60.0f, 1.33333, 0.01, 100.0);
|
||||||
|
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
|
||||||
|
|
||||||
|
viewer.setUpViewInWindow(11, 11, 800 + 11, 600 + 11);
|
||||||
|
//viewer.setUpViewOnSingleScreen(0); // !!
|
||||||
|
|
||||||
|
viewer.getCamera()->setClearColor(osg::Vec4(0.3, 0.3, 0.3, 1.0));
|
||||||
|
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);// we can play with threading models later
|
||||||
|
|
||||||
|
osg::ref_ptr<ComputeNode> computeNode = new ComputeNode();
|
||||||
|
computeNode->setPosition(osg::Vec3(0, 0, 0));
|
||||||
|
computeNode->setUpdateCallback(new ComputeNodeUpdateCallback(computeNode.get())); // on-the-fly reloading the shaders if shader source on disk is changed
|
||||||
|
computeNode->initComputingSetup();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
scene->addChild(computeNode.get());
|
||||||
|
scene->addChild(computeNode->_computationResultsRenderGroup.get());
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef PRERENDER_HIGH_QUALITY_ANTIALIASING
|
||||||
|
viewer.setSceneData(createPrerenderSubgraph(scene.get(), osg::Vec4(0.3, 0.4, 0.6, 1)));
|
||||||
|
#else
|
||||||
|
viewer.setSceneData(scene.get());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
viewer.realize();
|
||||||
|
|
||||||
|
viewer.getCamera()->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(true);
|
||||||
|
|
||||||
|
viewer.run();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
@@ -56,18 +56,7 @@ public:
|
|||||||
traverse(node);
|
traverse(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply(osg::Geode& node)
|
void apply(osg::Drawable& drawable)
|
||||||
{
|
|
||||||
if (!_useStateSets && node.getStateSet()) node.setStateSet(0);
|
|
||||||
for(unsigned int i = 0; i<node.getNumDrawables(); ++i)
|
|
||||||
{
|
|
||||||
process(*node.getDrawable(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
traverse(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
void process(osg::Drawable& drawable)
|
|
||||||
{
|
{
|
||||||
if (!_useStateSets && drawable.getStateSet())
|
if (!_useStateSets && drawable.getStateSet())
|
||||||
{
|
{
|
||||||
@@ -515,7 +504,7 @@ protected:
|
|||||||
optimizeVertexOrder = false;
|
optimizeVertexOrder = false;
|
||||||
|
|
||||||
reallocateMemory = false;
|
reallocateMemory = false;
|
||||||
|
|
||||||
modifyTextureSettings = false;
|
modifyTextureSettings = false;
|
||||||
buildImageMipmaps = false;
|
buildImageMipmaps = false;
|
||||||
compressImages = false;
|
compressImages = false;
|
||||||
@@ -535,22 +524,23 @@ protected:
|
|||||||
bool optimizeVertexOrder;
|
bool optimizeVertexOrder;
|
||||||
|
|
||||||
bool reallocateMemory;
|
bool reallocateMemory;
|
||||||
|
|
||||||
bool modifyTextureSettings;
|
bool modifyTextureSettings;
|
||||||
bool buildImageMipmaps;
|
bool buildImageMipmaps;
|
||||||
bool compressImages;
|
bool compressImages;
|
||||||
bool disableMipmaps;
|
bool disableMipmaps;
|
||||||
|
|
||||||
};
|
};
|
||||||
//
|
//
|
||||||
class DatabasePagingOperation : public osg::Operation, public osgUtil::IncrementalCompileOperation::CompileCompletedCallback
|
class DatabasePagingOperation : public osg::Operation, public osgUtil::IncrementalCompileOperation::CompileCompletedCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DatabasePagingOperation(const std::string& filename,
|
DatabasePagingOperation(const std::string& filename,
|
||||||
const std::string& outputFilename,
|
const std::string& outputFilename,
|
||||||
SceneGraphProcessor* sceneGraphProcessor,
|
SceneGraphProcessor* sceneGraphProcessor,
|
||||||
osgUtil::IncrementalCompileOperation* ico):
|
osgUtil::IncrementalCompileOperation* ico):
|
||||||
|
osg::Referenced(true),
|
||||||
Operation("DatabasePaging Operation", false),
|
Operation("DatabasePaging Operation", false),
|
||||||
_filename(filename),
|
_filename(filename),
|
||||||
_outputFilename(outputFilename),
|
_outputFilename(outputFilename),
|
||||||
@@ -565,7 +555,7 @@ public:
|
|||||||
osg::notify(osg::NOTICE)<<"LoadAndCompileOperation "<<_filename<<std::endl;
|
osg::notify(osg::NOTICE)<<"LoadAndCompileOperation "<<_filename<<std::endl;
|
||||||
|
|
||||||
_modelReadyToMerge = false;
|
_modelReadyToMerge = false;
|
||||||
_loadedModel = osgDB::readNodeFile(_filename);
|
_loadedModel = osgDB::readRefNodeFile(_filename);
|
||||||
|
|
||||||
if (_loadedModel.valid())
|
if (_loadedModel.valid())
|
||||||
{
|
{
|
||||||
@@ -580,7 +570,7 @@ public:
|
|||||||
if (!_outputFilename.empty())
|
if (!_outputFilename.empty())
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"Writing out file "<<_outputFilename<<std::endl;
|
OSG_NOTICE<<"Writing out file "<<_outputFilename<<std::endl;
|
||||||
|
|
||||||
osgDB::writeNodeFile(*_loadedModel, _outputFilename);
|
osgDB::writeNodeFile(*_loadedModel, _outputFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -674,7 +664,7 @@ int main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
apm->setTimeScale(animationSpeed);
|
apm->setTimeScale(animationSpeed);
|
||||||
apm->setAnimationCompletedCallback(new ReportStatsAnimationCompletedCallback());
|
apm->setAnimationCompletedCallback(new ReportStatsAnimationCompletedCallback());
|
||||||
|
|
||||||
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
||||||
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
||||||
keyswitchManipulator->selectMatrixManipulator(num);
|
keyswitchManipulator->selectMatrixManipulator(num);
|
||||||
@@ -685,7 +675,7 @@ int main(int argc, char** argv)
|
|||||||
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up event handlers
|
// set up event handlers
|
||||||
{
|
{
|
||||||
viewer.addEventHandler( new osgViewer::StatsHandler());
|
viewer.addEventHandler( new osgViewer::StatsHandler());
|
||||||
viewer.addEventHandler( new osgViewer::WindowSizeHandler() );
|
viewer.addEventHandler( new osgViewer::WindowSizeHandler() );
|
||||||
@@ -807,7 +797,7 @@ int main(int argc, char** argv)
|
|||||||
if (databasePagingOperation.get() && databasePagingOperation->_modelReadyToMerge)
|
if (databasePagingOperation.get() && databasePagingOperation->_modelReadyToMerge)
|
||||||
{
|
{
|
||||||
OSG_NOTICE<<"Merging subgraph"<<std::endl;
|
OSG_NOTICE<<"Merging subgraph"<<std::endl;
|
||||||
|
|
||||||
timeOfLastMerge = currentTime;
|
timeOfLastMerge = currentTime;
|
||||||
|
|
||||||
group->removeChildren(0,group->getNumChildren());
|
group->removeChildren(0,group->getNumChildren());
|
||||||
|
|||||||
@@ -136,9 +136,9 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
|
|||||||
|
|
||||||
osg::AnimationPath* animationPath = createAnimationPath(center,radius,animationLength);
|
osg::AnimationPath* animationPath = createAnimationPath(center,radius,animationLength);
|
||||||
|
|
||||||
osg::Group* model = new osg::Group;
|
osg::ref_ptr<osg::Group> model = new osg::Group;
|
||||||
|
|
||||||
osg::Node* glider = osgDB::readNodeFile("glider.osgt");
|
osg::ref_ptr<osg::Node> glider = osgDB::readRefNodeFile("glider.osgt");
|
||||||
if (glider)
|
if (glider)
|
||||||
{
|
{
|
||||||
const osg::BoundingSphere& bs = glider->getBound();
|
const osg::BoundingSphere& bs = glider->getBound();
|
||||||
@@ -159,7 +159,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
|
|||||||
model->addChild(xform);
|
model->addChild(xform);
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node* cessna = osgDB::readNodeFile("cessna.osgt");
|
osg::ref_ptr<osg::Node> cessna = osgDB::readRefNodeFile("cessna.osgt");
|
||||||
if (cessna)
|
if (cessna)
|
||||||
{
|
{
|
||||||
const osg::BoundingSphere& bs = cessna->getBound();
|
const osg::BoundingSphere& bs = cessna->getBound();
|
||||||
@@ -173,26 +173,26 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
|
|||||||
|
|
||||||
positioned->addChild(cessna);
|
positioned->addChild(cessna);
|
||||||
|
|
||||||
osg::MatrixTransform* xform = new osg::MatrixTransform;
|
osg::ref_ptr<osg::MatrixTransform> xform = new osg::MatrixTransform;
|
||||||
xform->setUpdateCallback(new osg::AnimationPathCallback(animationPath,0.0f,2.0));
|
xform->setUpdateCallback(new osg::AnimationPathCallback(animationPath,0.0f,2.0));
|
||||||
xform->addChild(positioned);
|
xform->addChild(positioned);
|
||||||
|
|
||||||
model->addChild(xform);
|
model->addChild(xform);
|
||||||
}
|
}
|
||||||
|
|
||||||
return model;
|
return model.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node* createModel(bool overlay, osgSim::OverlayNode::OverlayTechnique technique)
|
osg::ref_ptr<osg::Group> createModel(bool overlay, osgSim::OverlayNode::OverlayTechnique technique)
|
||||||
{
|
{
|
||||||
osg::Vec3 center(0.0f,0.0f,0.0f);
|
osg::Vec3 center(0.0f,0.0f,0.0f);
|
||||||
float radius = 100.0f;
|
float radius = 100.0f;
|
||||||
|
|
||||||
osg::Group* root = new osg::Group;
|
osg::ref_ptr<osg::Group> root = new osg::Group;
|
||||||
|
|
||||||
float baseHeight = center.z()-radius*0.5;
|
float baseHeight = center.z()-radius*0.5;
|
||||||
osg::Node* baseModel = createBase(osg::Vec3(center.x(), center.y(), baseHeight),radius);
|
osg::ref_ptr<osg::Node> baseModel = createBase(osg::Vec3(center.x(), center.y(), baseHeight),radius);
|
||||||
osg::Node* movingModel = createMovingModel(center,radius*0.8f);
|
osg::ref_ptr<osg::Node> movingModel = createMovingModel(center,radius*0.8f);
|
||||||
|
|
||||||
if (overlay)
|
if (overlay)
|
||||||
{
|
{
|
||||||
@@ -232,14 +232,14 @@ int main( int argc, char **argv )
|
|||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* model = createModel(overlay, technique);
|
osg::ref_ptr<osg::Group> model = createModel(overlay, technique);
|
||||||
if (!model)
|
if (!model)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// tilt the scene so the default eye position is looking down on the model.
|
// tilt the scene so the default eye position is looking down on the model.
|
||||||
osg::MatrixTransform* rootnode = new osg::MatrixTransform;
|
osg::ref_ptr<osg::MatrixTransform> rootnode = new osg::MatrixTransform;
|
||||||
rootnode->setMatrix(osg::Matrix::rotate(osg::inDegrees(30.0f),1.0f,0.0f,0.0f));
|
rootnode->setMatrix(osg::Matrix::rotate(osg::inDegrees(30.0f),1.0f,0.0f,0.0f));
|
||||||
rootnode->addChild(model);
|
rootnode->addChild(model);
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
/* -*-c++-*-
|
/* -*-c++-*-
|
||||||
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
|
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
|
||||||
*
|
*
|
||||||
* This library is open source and may be redistributed and/or modified under
|
* This library is open source and may be redistributed and/or modified under
|
||||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||||
* (at your option) any later version. The full license is in LICENSE file
|
* (at your option) any later version. The full license is in LICENSE file
|
||||||
* included with this distribution, and on the openscenegraph.org website.
|
* included with this distribution, and on the openscenegraph.org website.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* OpenSceneGraph Public License for more details.
|
* OpenSceneGraph Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ struct MyRigTransformHardware : public osgAnimation::RigTransformHardware
|
|||||||
|
|
||||||
osg::notify(osg::INFO) << "set vertex attrib " << ss.str() << std::endl;
|
osg::notify(osg::INFO) << "set vertex attrib " << ss.str() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < nbAttribs; i++)
|
for (int i = 0; i < nbAttribs; i++)
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
@@ -134,7 +134,7 @@ struct SetupRigGeometry : public osg::NodeVisitor
|
|||||||
{
|
{
|
||||||
bool _hardware;
|
bool _hardware;
|
||||||
SetupRigGeometry( bool hardware = true) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _hardware(hardware) {}
|
SetupRigGeometry( bool hardware = true) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _hardware(hardware) {}
|
||||||
|
|
||||||
void apply(osg::Geode& geode)
|
void apply(osg::Geode& geode)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < geode.getNumDrawables(); i++)
|
for (unsigned int i = 0; i < geode.getNumDrawables(); i++)
|
||||||
@@ -173,7 +173,7 @@ osg::Group* createCharacterInstance(osg::Group* character, bool hardware)
|
|||||||
anim->playAnimation(list[v].get());
|
anim->playAnimation(list[v].get());
|
||||||
v = (v + 1)%list.size();
|
v = (v + 1)%list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
anim->playAnimation(list[v].get());
|
anim->playAnimation(list[v].get());
|
||||||
|
|
||||||
SetupRigGeometry switcher(hardware);
|
SetupRigGeometry switcher(hardware);
|
||||||
@@ -196,9 +196,9 @@ int main (int argc, char* argv[])
|
|||||||
while (psr.read("--software")) { hardware = false; }
|
while (psr.read("--software")) { hardware = false; }
|
||||||
while (psr.read("--number", maxChar)) {}
|
while (psr.read("--number", maxChar)) {}
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFiles(psr);
|
||||||
osg::ref_ptr<osg::Group> root = dynamic_cast<osg::Group*>(osgDB::readNodeFiles(psr));
|
osg::ref_ptr<osg::Group> root = dynamic_cast<osg::Group*>(node.get());
|
||||||
if (!root)
|
if (!root)
|
||||||
{
|
{
|
||||||
std::cout << psr.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << psr.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@@ -206,7 +206,7 @@ int main (int argc, char* argv[])
|
|||||||
|
|
||||||
{
|
{
|
||||||
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback());
|
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback());
|
||||||
if(!animationManager)
|
if(!animationManager)
|
||||||
{
|
{
|
||||||
osg::notify(osg::FATAL) << "no AnimationManagerBase found, updateCallback need to animate elements" << std::endl;
|
osg::notify(osg::FATAL) << "no AnimationManagerBase found, updateCallback need to animate elements" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@@ -218,13 +218,13 @@ int main (int argc, char* argv[])
|
|||||||
|
|
||||||
// add the state manipulator
|
// add the state manipulator
|
||||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||||
|
|
||||||
// add the thread model handler
|
// add the thread model handler
|
||||||
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
||||||
|
|
||||||
// add the window size toggle handler
|
// add the window size toggle handler
|
||||||
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
||||||
|
|
||||||
// add the stats handler
|
// add the stats handler
|
||||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
/* -*-c++-*-
|
/* -*-c++-*-
|
||||||
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
|
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
|
||||||
*
|
*
|
||||||
* This library is open source and may be redistributed and/or modified under
|
* This library is open source and may be redistributed and/or modified under
|
||||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||||
* (at your option) any later version. The full license is in LICENSE file
|
* (at your option) any later version. The full license is in LICENSE file
|
||||||
* included with this distribution, and on the openscenegraph.org website.
|
* included with this distribution, and on the openscenegraph.org website.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* OpenSceneGraph Public License for more details.
|
* OpenSceneGraph Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -33,11 +33,11 @@ struct GeometryFinder : public osg::NodeVisitor
|
|||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Geometry> _geom;
|
osg::ref_ptr<osg::Geometry> _geom;
|
||||||
GeometryFinder() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
GeometryFinder() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||||
void apply(osg::Geode& geode)
|
void apply(osg::Geode& geode)
|
||||||
{
|
{
|
||||||
if (_geom.valid())
|
if (_geom.valid())
|
||||||
return;
|
return;
|
||||||
for (unsigned int i = 0; i < geode.getNumDrawables(); i++)
|
for (unsigned int i = 0; i < geode.getNumDrawables(); i++)
|
||||||
{
|
{
|
||||||
osg::Geometry* geom = dynamic_cast<osg::Geometry*>(geode.getDrawable(i));
|
osg::Geometry* geom = dynamic_cast<osg::Geometry*>(geode.getDrawable(i));
|
||||||
if (geom) {
|
if (geom) {
|
||||||
@@ -50,7 +50,7 @@ struct GeometryFinder : public osg::NodeVisitor
|
|||||||
|
|
||||||
osg::ref_ptr<osg::Geometry> getShape(const std::string& name)
|
osg::ref_ptr<osg::Geometry> getShape(const std::string& name)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Node> shape0 = osgDB::readNodeFile(name);
|
osg::ref_ptr<osg::Node> shape0 = osgDB::readRefNodeFile(name);
|
||||||
if (shape0)
|
if (shape0)
|
||||||
{
|
{
|
||||||
GeometryFinder finder;
|
GeometryFinder finder;
|
||||||
@@ -104,7 +104,7 @@ int main (int argc, char* argv[])
|
|||||||
|
|
||||||
osg::Group* scene = new osg::Group;
|
osg::Group* scene = new osg::Group;
|
||||||
scene->addUpdateCallback(bam);
|
scene->addUpdateCallback(bam);
|
||||||
|
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
geode->addDrawable(morph);
|
geode->addDrawable(morph);
|
||||||
geode->addUpdateCallback(new osgAnimation::UpdateMorph("MorphNodeCallback"));
|
geode->addUpdateCallback(new osgAnimation::UpdateMorph("MorphNodeCallback"));
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ int main (int argc, char* argv[])
|
|||||||
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
||||||
geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0f,0.0f,0.0f),0.5)));
|
geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0f,0.0f,0.0f),0.5)));
|
||||||
|
|
||||||
//Tranformation to be manipulated by the animation
|
//Transformation to be manipulated by the animation
|
||||||
osg::ref_ptr<osg::MatrixTransform> trans = new osg::MatrixTransform();
|
osg::ref_ptr<osg::MatrixTransform> trans = new osg::MatrixTransform();
|
||||||
trans->setName("AnimatedNode");
|
trans->setName("AnimatedNode");
|
||||||
//Dynamic object, has to be updated during update traversal
|
//Dynamic object, has to be updated during update traversal
|
||||||
@@ -84,7 +84,7 @@ int main (int argc, char* argv[])
|
|||||||
//The second element modifies the rotation around x-axis
|
//The second element modifies the rotation around x-axis
|
||||||
updatecb->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("position"));
|
updatecb->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("position"));
|
||||||
updatecb->getStackedTransforms().push_back(new osgAnimation::StackedRotateAxisElement("euler",osg::Vec3(1,0,0),0));
|
updatecb->getStackedTransforms().push_back(new osgAnimation::StackedRotateAxisElement("euler",osg::Vec3(1,0,0),0));
|
||||||
//connect the UpdateMatrixTransform callback to the MatrixTRanform
|
//connect the UpdateMatrixTransform callback to the MatrixTransform
|
||||||
trans->setUpdateCallback(updatecb);
|
trans->setUpdateCallback(updatecb);
|
||||||
//initialize MatrixTranform
|
//initialize MatrixTranform
|
||||||
trans->setMatrix(osg::Matrix::identity());
|
trans->setMatrix(osg::Matrix::identity());
|
||||||
@@ -102,7 +102,7 @@ int main (int argc, char* argv[])
|
|||||||
//add the rest of the scene to the grp node
|
//add the rest of the scene to the grp node
|
||||||
grp->addChild(root);
|
grp->addChild(root);
|
||||||
|
|
||||||
// And we finaly define our channel for linear Vector interpolation
|
// And we finally define our channel for linear Vector interpolation
|
||||||
osgAnimation::Vec3LinearChannel* channelAnimation1 = new osgAnimation::Vec3LinearChannel;
|
osgAnimation::Vec3LinearChannel* channelAnimation1 = new osgAnimation::Vec3LinearChannel;
|
||||||
//name of the AnimationUpdateCallback
|
//name of the AnimationUpdateCallback
|
||||||
channelAnimation1->setTargetName("AnimatedCallback");
|
channelAnimation1->setTargetName("AnimatedCallback");
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
/* -*-c++-*-
|
/* -*-c++-*-
|
||||||
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
|
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
|
||||||
*
|
*
|
||||||
* This library is open source and may be redistributed and/or modified under
|
* This library is open source and may be redistributed and/or modified under
|
||||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||||
* (at your option) any later version. The full license is in LICENSE file
|
* (at your option) any later version. The full license is in LICENSE file
|
||||||
* included with this distribution, and on the openscenegraph.org website.
|
* included with this distribution, and on the openscenegraph.org website.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* OpenSceneGraph Public License for more details.
|
* OpenSceneGraph Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ struct ExampleTimelineUsage : public osgGA::GUIEventHandler
|
|||||||
_scratchNose->setLoop(1); // one time
|
_scratchNose->setLoop(1); // one time
|
||||||
|
|
||||||
// add the main loop at priority 0 at time 0.
|
// add the main loop at priority 0 at time 0.
|
||||||
|
|
||||||
osgAnimation::Timeline* tml = _manager->getTimeline();
|
osgAnimation::Timeline* tml = _manager->getTimeline();
|
||||||
tml->play();
|
tml->play();
|
||||||
tml->addActionAt(0.0, _mainLoop.get(), 0);
|
tml->addActionAt(0.0, _mainLoop.get(), 0);
|
||||||
@@ -98,9 +98,9 @@ struct ExampleTimelineUsage : public osgGA::GUIEventHandler
|
|||||||
{
|
{
|
||||||
// we add a scratch head priority 1 each 10 second
|
// we add a scratch head priority 1 each 10 second
|
||||||
// note:
|
// note:
|
||||||
// it's possible to add the same instance more then once on the timeline
|
// it's possible to add the same instance more than once on the timeline
|
||||||
// the only things you need to take care is if you remove it. It will remove
|
// the only things you need to take care is if you remove it. It will remove
|
||||||
// all instance that exist on the timeline. If you need to differtiate
|
// all instance that exist on the timeline. If you need to differentiate
|
||||||
// it's better to create a new instance
|
// it's better to create a new instance
|
||||||
tml->addActionAt(5.0 + 10.0 * i, _scratchHead.get(), 1);
|
tml->addActionAt(5.0 + 10.0 * i, _scratchHead.get(), 1);
|
||||||
}
|
}
|
||||||
@@ -139,21 +139,12 @@ struct ExampleTimelineUsage : public osgGA::GUIEventHandler
|
|||||||
}
|
}
|
||||||
_releaseKey = false;
|
_releaseKey = false;
|
||||||
}
|
}
|
||||||
|
traverse(node, nv);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
|
osgGA::GUIEventHandler::operator()(node, nv);
|
||||||
if (ev && ev->getActionAdapter() && !ev->getEvents().empty())
|
}
|
||||||
{
|
|
||||||
for(osgGA::EventQueue::Events::iterator itr = ev->getEvents().begin();
|
|
||||||
itr != ev->getEvents().end();
|
|
||||||
++itr)
|
|
||||||
{
|
|
||||||
handleWithCheckAgainstIgnoreHandledEventsMask(*(*itr), *(ev->getActionAdapter()), node, nv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
traverse(node, nv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -168,17 +159,18 @@ int main (int argc, char* argv[])
|
|||||||
osgViewer::Viewer viewer(psr);
|
osgViewer::Viewer viewer(psr);
|
||||||
|
|
||||||
std::string file = "nathan.osg";
|
std::string file = "nathan.osg";
|
||||||
if(argc >= 2)
|
if(argc >= 2)
|
||||||
file = psr[1];
|
file = psr[1];
|
||||||
|
|
||||||
// replace the manager
|
// replace the manager
|
||||||
osg::Group* root = dynamic_cast<osg::Group*>(osgDB::readNodeFile(file));
|
osg::ref_ptr<osg::Node> loadedmodel = osgDB::readRefNodeFile(file);
|
||||||
|
osg::Group* root = dynamic_cast<osg::Group*>(loadedmodel.get());
|
||||||
if (!root) {
|
if (!root) {
|
||||||
osg::notify(osg::FATAL) << "can't read file " << file << std::endl;
|
osg::notify(osg::FATAL) << "can't read file " << file << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback());
|
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback());
|
||||||
if(!animationManager)
|
if(!animationManager)
|
||||||
{
|
{
|
||||||
osg::notify(osg::FATAL) << "Did not find AnimationManagerBase updateCallback needed to animate elements" << std::endl;
|
osg::notify(osg::FATAL) << "Did not find AnimationManagerBase updateCallback needed to animate elements" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@@ -186,22 +178,22 @@ int main (int argc, char* argv[])
|
|||||||
|
|
||||||
osg::ref_ptr<osgAnimation::TimelineAnimationManager> tl = new osgAnimation::TimelineAnimationManager(*animationManager);
|
osg::ref_ptr<osgAnimation::TimelineAnimationManager> tl = new osgAnimation::TimelineAnimationManager(*animationManager);
|
||||||
root->setUpdateCallback(tl.get());
|
root->setUpdateCallback(tl.get());
|
||||||
|
|
||||||
ExampleTimelineUsage* callback = new ExampleTimelineUsage(tl.get());
|
ExampleTimelineUsage* callback = new ExampleTimelineUsage(tl.get());
|
||||||
root->setEventCallback(callback);
|
root->setEventCallback(callback);
|
||||||
root->getUpdateCallback()->addNestedCallback(callback);
|
root->getUpdateCallback()->addNestedCallback(callback);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// add the state manipulator
|
// add the state manipulator
|
||||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||||
|
|
||||||
// add the thread model handler
|
// add the thread model handler
|
||||||
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
||||||
|
|
||||||
// add the window size toggle handler
|
// add the window size toggle handler
|
||||||
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
||||||
|
|
||||||
// add the stats handler
|
// add the stats handler
|
||||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <osg/Geometry>
|
#include <osg/Geometry>
|
||||||
#include <osg/MatrixTransform>
|
#include <osg/MatrixTransform>
|
||||||
#include <osg/Geode>
|
#include <osg/Geode>
|
||||||
|
#include <osgDB/FileNameUtils>
|
||||||
#include <osgViewer/Viewer>
|
#include <osgViewer/Viewer>
|
||||||
#include <osgViewer/ViewerEventHandlers>
|
#include <osgViewer/ViewerEventHandlers>
|
||||||
#include <osgWidget/ViewerEventHandlers>
|
#include <osgWidget/ViewerEventHandlers>
|
||||||
@@ -126,7 +127,8 @@ int main(int argc, char** argv)
|
|||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
osg::ref_ptr<osg::Group> group = new osg::Group();
|
osg::ref_ptr<osg::Group> group = new osg::Group();
|
||||||
|
|
||||||
osg::Group* node = dynamic_cast<osg::Group*>(osgDB::readNodeFiles(arguments)); //dynamic_cast<osgAnimation::AnimationManager*>(osgDB::readNodeFile(psr[1]));
|
osg::ref_ptr<osg::Node> loadedmodel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
osg::Group* node = dynamic_cast<osg::Group*>(loadedmodel.get());
|
||||||
if(!node)
|
if(!node)
|
||||||
{
|
{
|
||||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
@@ -136,10 +138,30 @@ int main(int argc, char** argv)
|
|||||||
// Set our Singleton's model.
|
// Set our Singleton's model.
|
||||||
AnimationManagerFinder finder;
|
AnimationManagerFinder finder;
|
||||||
node->accept(finder);
|
node->accept(finder);
|
||||||
if (finder._am.valid()) {
|
if (finder._am.valid())
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string playModeOpt;
|
||||||
|
if (arguments.read("--play-mode", playModeOpt))
|
||||||
|
{
|
||||||
|
osgAnimation::Animation::PlayMode playMode = osgAnimation::Animation::LOOP;
|
||||||
|
if (osgDB::equalCaseInsensitive(playModeOpt, "ONCE")) playMode = osgAnimation::Animation::ONCE;
|
||||||
|
else if (osgDB::equalCaseInsensitive(playModeOpt, "STAY")) playMode = osgAnimation::Animation::STAY;
|
||||||
|
else if (osgDB::equalCaseInsensitive(playModeOpt, "LOOP")) playMode = osgAnimation::Animation::LOOP;
|
||||||
|
else if (osgDB::equalCaseInsensitive(playModeOpt, "PPONG")) playMode = osgAnimation::Animation::PPONG;
|
||||||
|
|
||||||
|
for (osgAnimation::AnimationList::const_iterator animIter = finder._am->getAnimationList().begin();
|
||||||
|
animIter != finder._am->getAnimationList().end(); ++animIter)
|
||||||
|
{
|
||||||
|
(*animIter)->setPlayMode(playMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
node->setUpdateCallback(finder._am.get());
|
node->setUpdateCallback(finder._am.get());
|
||||||
AnimtkViewerModelController::setModel(finder._am.get());
|
AnimtkViewerModelController::setModel(finder._am.get());
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
osg::notify(osg::WARN) << "no osgAnimation::AnimationManagerBase found in the subgraph, no animations available" << std::endl;
|
osg::notify(osg::WARN) << "no osgAnimation::AnimationManagerBase found in the subgraph, no animations available" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ int main(int argc, char** argv)
|
|||||||
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
|
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
|
||||||
|
|
||||||
// load the data
|
// load the data
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
osg::Geometry * quad = osg::createTexturedQuadGeometry(osg::Vec3f(-2.0f, 0.0f, -2.0f),
|
osg::Geometry * quad = osg::createTexturedQuadGeometry(osg::Vec3f(-2.0f, 0.0f, -2.0f),
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include <osgViewer/Viewer>
|
#include <osgViewer/Viewer>
|
||||||
#include <osgViewer/ViewerEventHandlers>
|
#include <osgViewer/ViewerEventHandlers>
|
||||||
#include <osgViewer/Renderer>
|
#include <osgViewer/Renderer>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
|
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
|
||||||
_foundNode(0)
|
_foundNode(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void apply(osg::Node& node)
|
void apply(osg::Node& node)
|
||||||
{
|
{
|
||||||
T* result = dynamic_cast<T*>(&node);
|
T* result = dynamic_cast<T*>(&node);
|
||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
else
|
else
|
||||||
traverse(node);
|
traverse(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
T* _foundNode;
|
T* _foundNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,21 +62,21 @@ T* findTopMostNodeOfType(osg::Node* node)
|
|||||||
|
|
||||||
FindTopMostNodeOfTypeVisitor<T> fnotv;
|
FindTopMostNodeOfTypeVisitor<T> fnotv;
|
||||||
node->accept(fnotv);
|
node->accept(fnotv);
|
||||||
|
|
||||||
return fnotv._foundNode;
|
return fnotv._foundNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Capture the frame buffer and write image to disk*/
|
/** Capture the frame buffer and write image to disk*/
|
||||||
class WindowCaptureCallback : public osg::Camera::DrawCallback
|
class WindowCaptureCallback : public osg::Camera::DrawCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WindowCaptureCallback(GLenum readBuffer, const std::string& name):
|
WindowCaptureCallback(GLenum readBuffer, const std::string& name):
|
||||||
_readBuffer(readBuffer),
|
_readBuffer(readBuffer),
|
||||||
_fileName(name)
|
_fileName(name)
|
||||||
{
|
{
|
||||||
_image = new osg::Image;
|
_image = new osg::Image;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void operator () (osg::RenderInfo& renderInfo) const
|
virtual void operator () (osg::RenderInfo& renderInfo) const
|
||||||
{
|
{
|
||||||
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
|
||||||
@@ -93,9 +93,9 @@ public:
|
|||||||
|
|
||||||
if (gc->getTraits()->alpha)
|
if (gc->getTraits()->alpha)
|
||||||
pixelFormat = GL_RGBA;
|
pixelFormat = GL_RGBA;
|
||||||
else
|
else
|
||||||
pixelFormat = GL_RGB;
|
pixelFormat = GL_RGB;
|
||||||
|
|
||||||
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
|
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
|
||||||
if (pixelFormat == GL_RGB)
|
if (pixelFormat == GL_RGB)
|
||||||
{
|
{
|
||||||
@@ -118,7 +118,7 @@ public:
|
|||||||
|
|
||||||
_image->readPixels(0, 0, width, height, pixelFormat, GL_UNSIGNED_BYTE);
|
_image->readPixels(0, 0, width, height, pixelFormat, GL_UNSIGNED_BYTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_fileName.empty())
|
if (!_fileName.empty())
|
||||||
{
|
{
|
||||||
std::cout << "Writing to: " << _fileName << std::endl;
|
std::cout << "Writing to: " << _fileName << std::endl;
|
||||||
@@ -126,7 +126,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GLenum _readBuffer;
|
GLenum _readBuffer;
|
||||||
std::string _fileName;
|
std::string _fileName;
|
||||||
osg::ref_ptr<osg::Image> _image;
|
osg::ref_ptr<osg::Image> _image;
|
||||||
@@ -138,7 +138,7 @@ protected:
|
|||||||
class CustomRenderer : public osgViewer::Renderer
|
class CustomRenderer : public osgViewer::Renderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CustomRenderer(osg::Camera* camera)
|
CustomRenderer(osg::Camera* camera)
|
||||||
: osgViewer::Renderer(camera),
|
: osgViewer::Renderer(camera),
|
||||||
_cullOnly(true)
|
_cullOnly(true)
|
||||||
{
|
{
|
||||||
@@ -162,19 +162,19 @@ public:
|
|||||||
{
|
{
|
||||||
osgUtil::SceneView* sceneView = _sceneView[0].get();
|
osgUtil::SceneView* sceneView = _sceneView[0].get();
|
||||||
if (!sceneView || _done ) return;
|
if (!sceneView || _done ) return;
|
||||||
|
|
||||||
updateSceneView(sceneView);
|
updateSceneView(sceneView);
|
||||||
|
|
||||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(_camera->getView());
|
osgViewer::View* view = dynamic_cast<osgViewer::View*>(_camera->getView());
|
||||||
if (view) sceneView->setFusionDistance(view->getFusionDistanceMode(), view->getFusionDistanceValue());
|
if (view) sceneView->setFusionDistance(view->getFusionDistanceMode(), view->getFusionDistanceValue());
|
||||||
|
|
||||||
sceneView->inheritCullSettings(*(sceneView->getCamera()));
|
sceneView->inheritCullSettings(*(sceneView->getCamera()));
|
||||||
sceneView->cull();
|
sceneView->cull();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _cullOnly;
|
bool _cullOnly;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//===============================================================
|
//===============================================================
|
||||||
// MAIN
|
// MAIN
|
||||||
@@ -287,8 +287,8 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load the data
|
// load the data
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@@ -309,7 +309,7 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
osg::CoordinateSystemNode* csn = findTopMostNodeOfType<osg::CoordinateSystemNode>(loadedModel.get());
|
osg::CoordinateSystemNode* csn = findTopMostNodeOfType<osg::CoordinateSystemNode>(loadedModel.get());
|
||||||
if(!csn) return 1;
|
if(!csn) return 1;
|
||||||
|
|
||||||
// Compute eye point in world coordiantes
|
// Compute eye point in world coordiantes
|
||||||
osg::Vec3d eye;
|
osg::Vec3d eye;
|
||||||
csn->getEllipsoidModel()->convertLatLongHeightToXYZ(lat, lon, alt, eye.x(), eye.y(), eye.z());
|
csn->getEllipsoidModel()->convertLatLongHeightToXYZ(lat, lon, alt, eye.x(), eye.y(), eye.z());
|
||||||
@@ -331,11 +331,11 @@ int main( int argc, char **argv )
|
|||||||
osg::Vec3d up_cross_tangent = up ^ tangent;
|
osg::Vec3d up_cross_tangent = up ^ tangent;
|
||||||
osg::Matrixd incline_matrix = osg::Matrixd::rotate(incline, up_cross_tangent);
|
osg::Matrixd incline_matrix = osg::Matrixd::rotate(incline, up_cross_tangent);
|
||||||
osg::Vec3d target = incline_matrix.preMult(tangent);
|
osg::Vec3d target = incline_matrix.preMult(tangent);
|
||||||
|
|
||||||
// Roll by rotating the up vector around the target vector ...
|
// Roll by rotating the up vector around the target vector ...
|
||||||
osg::Matrixd roll_matrix = incline_matrix * osg::Matrixd::rotate(roll, target);
|
osg::Matrixd roll_matrix = incline_matrix * osg::Matrixd::rotate(roll, target);
|
||||||
up = roll_matrix.preMult(up);
|
up = roll_matrix.preMult(up);
|
||||||
|
|
||||||
viewer.getCamera()->setViewMatrixAsLookAt(eye, eye+target, up);
|
viewer.getCamera()->setViewMatrixAsLookAt(eye, eye+target, up);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -349,10 +349,10 @@ int main( int argc, char **argv )
|
|||||||
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
|
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
|
||||||
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
|
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
|
||||||
|
|
||||||
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
viewer.setCameraManipulator( keyswitchManipulator.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Optimize DatabasePager for auto-capture
|
// Optimize DatabasePager for auto-capture
|
||||||
osgDB::DatabasePager* pager = viewer.getDatabasePager();
|
osgDB::DatabasePager* pager = viewer.getDatabasePager();
|
||||||
pager->setDoPreCompile(false);
|
pager->setDoPreCompile(false);
|
||||||
@@ -374,9 +374,9 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// Initiate the first PagedLOD request
|
// Initiate the first PagedLOD request
|
||||||
viewer.frame();
|
viewer.frame();
|
||||||
|
|
||||||
osg::Timer_t beforeLoadTick = osg::Timer::instance()->tick();
|
osg::Timer_t beforeLoadTick = osg::Timer::instance()->tick();
|
||||||
|
|
||||||
// Keep updating and culling until full level of detail is reached
|
// Keep updating and culling until full level of detail is reached
|
||||||
while(!viewer.done() && pager->getRequestsInProgress())
|
while(!viewer.done() && pager->getRequestsInProgress())
|
||||||
{
|
{
|
||||||
@@ -385,14 +385,14 @@ int main( int argc, char **argv )
|
|||||||
viewer.renderingTraversals();
|
viewer.renderingTraversals();
|
||||||
}
|
}
|
||||||
// std::cout<<std::endl;
|
// std::cout<<std::endl;
|
||||||
|
|
||||||
osg::Timer_t afterLoadTick = osg::Timer::instance()->tick();
|
osg::Timer_t afterLoadTick = osg::Timer::instance()->tick();
|
||||||
std::cout<<"Load and Compile time = "<<osg::Timer::instance()->delta_s(beforeLoadTick, afterLoadTick)<<" seconds"<<std::endl;
|
std::cout<<"Load and Compile time = "<<osg::Timer::instance()->delta_s(beforeLoadTick, afterLoadTick)<<" seconds"<<std::endl;
|
||||||
|
|
||||||
// Do cull and draw to render the scene correctly
|
// Do cull and draw to render the scene correctly
|
||||||
customRenderer->setCullOnly(false);
|
customRenderer->setCullOnly(false);
|
||||||
|
|
||||||
|
|
||||||
//--- Capture the image!!! ---
|
//--- Capture the image!!! ---
|
||||||
if (!activeMode)
|
if (!activeMode)
|
||||||
{
|
{
|
||||||
@@ -406,7 +406,7 @@ int main( int argc, char **argv )
|
|||||||
viewer.renderingTraversals();
|
viewer.renderingTraversals();
|
||||||
|
|
||||||
osg::Timer_t afterRenderTick = osg::Timer::instance()->tick();
|
osg::Timer_t afterRenderTick = osg::Timer::instance()->tick();
|
||||||
std::cout<<"Rendring time = "<<osg::Timer::instance()->delta_s(beforeRenderTick, afterRenderTick) <<" seconds"<<std::endl;
|
std::cout<<"Rendering time = "<<osg::Timer::instance()->delta_s(beforeRenderTick, afterRenderTick) <<" seconds"<<std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,10 @@
|
|||||||
typedef std::vector< osg::ref_ptr<osg::Image> > ImageList;
|
typedef std::vector< osg::ref_ptr<osg::Image> > ImageList;
|
||||||
|
|
||||||
/** create quad at specified position. */
|
/** create quad at specified position. */
|
||||||
osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const osg::Vec3& height, osg::Image* image=NULL)
|
osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const osg::Vec3& height, osg::ref_ptr<osg::Image> image)
|
||||||
{
|
{
|
||||||
// set up the Geometry.
|
// set up the Geometry.
|
||||||
osg::Geometry* geom = new osg::Geometry;
|
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
|
||||||
|
|
||||||
osg::Vec3Array* coords = new osg::Vec3Array(4);
|
osg::Vec3Array* coords = new osg::Vec3Array(4);
|
||||||
(*coords)[0] = corner;
|
(*coords)[0] = corner;
|
||||||
@@ -80,13 +80,13 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
|
|||||||
geom->setStateSet(stateset);
|
geom->setStateSet(stateset);
|
||||||
}
|
}
|
||||||
|
|
||||||
return geom;
|
return geom.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Drawable* createAxis(const osg::Vec3& corner,const osg::Vec3& xdir,const osg::Vec3& ydir,const osg::Vec3& zdir)
|
osg::Drawable* createAxis(const osg::Vec3& corner,const osg::Vec3& xdir,const osg::Vec3& ydir,const osg::Vec3& zdir)
|
||||||
{
|
{
|
||||||
// set up the Geometry.
|
// set up the Geometry.
|
||||||
osg::Geometry* geom = new osg::Geometry;
|
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
|
||||||
|
|
||||||
osg::Vec3Array* coords = new osg::Vec3Array(6);
|
osg::Vec3Array* coords = new osg::Vec3Array(6);
|
||||||
(*coords)[0] = corner;
|
(*coords)[0] = corner;
|
||||||
@@ -121,20 +121,20 @@ osg::Drawable* createAxis(const osg::Vec3& corner,const osg::Vec3& xdir,const os
|
|||||||
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||||
geom->setStateSet(stateset);
|
geom->setStateSet(stateset);
|
||||||
|
|
||||||
return geom;
|
return geom.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node* createModel()
|
osg::ref_ptr<osg::Node> createModel()
|
||||||
{
|
{
|
||||||
|
|
||||||
// create the root node which will hold the model.
|
// create the root node which will hold the model.
|
||||||
osg::Group* root = new osg::Group();
|
osg::ref_ptr<osg::Group> root = new osg::Group();
|
||||||
|
|
||||||
// add the drawable into a single goede to be shared...
|
// add the drawable into a single geode to be shared...
|
||||||
osg::Billboard* center = new osg::Billboard();
|
osg::Billboard* center = new osg::Billboard();
|
||||||
center->setMode(osg::Billboard::POINT_ROT_EYE);
|
center->setMode(osg::Billboard::POINT_ROT_EYE);
|
||||||
center->addDrawable(
|
center->addDrawable(
|
||||||
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readImageFile("Images/reflect.rgb")),
|
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readRefImageFile("Images/reflect.rgb")),
|
||||||
osg::Vec3(0.0f,0.0f,0.0f));
|
osg::Vec3(0.0f,0.0f,0.0f));
|
||||||
|
|
||||||
osg::Billboard* x_arrow = new osg::Billboard();
|
osg::Billboard* x_arrow = new osg::Billboard();
|
||||||
@@ -142,7 +142,7 @@ osg::Node* createModel()
|
|||||||
x_arrow->setAxis(osg::Vec3(1.0f,0.0f,0.0f));
|
x_arrow->setAxis(osg::Vec3(1.0f,0.0f,0.0f));
|
||||||
x_arrow->setNormal(osg::Vec3(0.0f,-1.0f,0.0f));
|
x_arrow->setNormal(osg::Vec3(0.0f,-1.0f,0.0f));
|
||||||
x_arrow->addDrawable(
|
x_arrow->addDrawable(
|
||||||
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readImageFile("Cubemap_axis/posx.png")),
|
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readRefImageFile("Cubemap_axis/posx.png")),
|
||||||
osg::Vec3(5.0f,0.0f,0.0f));
|
osg::Vec3(5.0f,0.0f,0.0f));
|
||||||
|
|
||||||
osg::Billboard* y_arrow = new osg::Billboard();
|
osg::Billboard* y_arrow = new osg::Billboard();
|
||||||
@@ -150,7 +150,7 @@ osg::Node* createModel()
|
|||||||
y_arrow->setAxis(osg::Vec3(0.0f,1.0f,0.0f));
|
y_arrow->setAxis(osg::Vec3(0.0f,1.0f,0.0f));
|
||||||
y_arrow->setNormal(osg::Vec3(1.0f,0.0f,0.0f));
|
y_arrow->setNormal(osg::Vec3(1.0f,0.0f,0.0f));
|
||||||
y_arrow->addDrawable(
|
y_arrow->addDrawable(
|
||||||
createSquare(osg::Vec3(0.0f,-0.5f,-0.5f),osg::Vec3(0.0f,1.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readImageFile("Cubemap_axis/posy.png")),
|
createSquare(osg::Vec3(0.0f,-0.5f,-0.5f),osg::Vec3(0.0f,1.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readRefImageFile("Cubemap_axis/posy.png")),
|
||||||
osg::Vec3(0.0f,5.0f,0.0f));
|
osg::Vec3(0.0f,5.0f,0.0f));
|
||||||
|
|
||||||
osg::Billboard* z_arrow = new osg::Billboard();
|
osg::Billboard* z_arrow = new osg::Billboard();
|
||||||
@@ -158,7 +158,7 @@ osg::Node* createModel()
|
|||||||
z_arrow->setAxis(osg::Vec3(0.0f,0.0f,1.0f));
|
z_arrow->setAxis(osg::Vec3(0.0f,0.0f,1.0f));
|
||||||
z_arrow->setNormal(osg::Vec3(0.0f,-1.0f,0.0f));
|
z_arrow->setNormal(osg::Vec3(0.0f,-1.0f,0.0f));
|
||||||
z_arrow->addDrawable(
|
z_arrow->addDrawable(
|
||||||
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readImageFile("Cubemap_axis/posz.png")),
|
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readRefImageFile("Cubemap_axis/posz.png")),
|
||||||
osg::Vec3(0.0f,0.0f,5.0f));
|
osg::Vec3(0.0f,0.0f,5.0f));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
7
examples/osgblenddrawbuffers/CMakeLists.txt
Normal file
7
examples/osgblenddrawbuffers/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#this file is automatically generated
|
||||||
|
|
||||||
|
|
||||||
|
SET(TARGET_SRC osgblenddrawbuffers.cpp )
|
||||||
|
SET(TARGET_ADDED_LIBRARIES osgGA )
|
||||||
|
#### end var setup ###
|
||||||
|
SETUP_EXAMPLE(osgblenddrawbuffers)
|
||||||
155
examples/osgblenddrawbuffers/osgblenddrawbuffers.cpp
Normal file
155
examples/osgblenddrawbuffers/osgblenddrawbuffers.cpp
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
/* OpenSceneGraph example, osgblenddrawbuffers.
|
||||||
|
*
|
||||||
|
* 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/Geometry>
|
||||||
|
#include <osg/Geode>
|
||||||
|
#include <osg/Camera>
|
||||||
|
#include <osg/Texture2D>
|
||||||
|
#include <osg/BlendFunci>
|
||||||
|
#include <osg/ColorMaski>
|
||||||
|
#include <osg/Capability>
|
||||||
|
#include <osgDB/ReadFile>
|
||||||
|
#include <osgViewer/Viewer>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
osg::Camera* createMRTCamera( std::vector<osg::Texture*>& attachedTextures )
|
||||||
|
{
|
||||||
|
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
|
||||||
|
camera->setClearColor( osg::Vec4(0.0f, 0.0f, 0.0f, 1.0f) );
|
||||||
|
camera->setClearMask( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
|
||||||
|
camera->setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT );
|
||||||
|
camera->setRenderOrder( osg::Camera::PRE_RENDER );
|
||||||
|
|
||||||
|
for ( int i=0; i<4; ++i )
|
||||||
|
{
|
||||||
|
osg::Texture2D* tex = new osg::Texture2D;
|
||||||
|
tex->setTextureSize( 1024, 1024 );
|
||||||
|
tex->setInternalFormat( GL_RGBA );
|
||||||
|
tex->setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR );
|
||||||
|
tex->setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR );
|
||||||
|
attachedTextures.push_back( tex );
|
||||||
|
|
||||||
|
camera->setViewport( 0, 0, tex->getTextureWidth(), tex->getTextureHeight() );
|
||||||
|
camera->attach( osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0+i), tex );
|
||||||
|
}
|
||||||
|
return camera.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
osg::Camera* createHUDCamera( double left, double right, double bottom, double top )
|
||||||
|
{
|
||||||
|
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
|
||||||
|
camera->setReferenceFrame( osg::Transform::ABSOLUTE_RF );
|
||||||
|
camera->setClearMask( GL_DEPTH_BUFFER_BIT );
|
||||||
|
camera->setRenderOrder( osg::Camera::POST_RENDER );
|
||||||
|
camera->setAllowEventFocus( false );
|
||||||
|
camera->setProjectionMatrix( osg::Matrix::ortho2D(left, right, bottom, top) );
|
||||||
|
camera->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
|
||||||
|
return camera.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main( int argc, char **argv )
|
||||||
|
{
|
||||||
|
osg::ArgumentParser arguments(&argc, argv);
|
||||||
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName() + " is the example which demonstrates how to enable/disable blending on specified draw buffers in multi-rendering-target cases.");
|
||||||
|
|
||||||
|
std::vector<osg::Texture*> textures;
|
||||||
|
bool useGlobalBlending = false;
|
||||||
|
if ( arguments.read("--no-draw-buffers") ) useGlobalBlending = true;
|
||||||
|
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Node> cessna = osgDB::readRefNodeFile("cessna.osgt");
|
||||||
|
if (!cessna)
|
||||||
|
{
|
||||||
|
OSG_NOTICE<<"Cannot not find model 'cessna.osg' to render"<<std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a camera to output multi-rendering-targets (MRT)
|
||||||
|
osg::ref_ptr<osg::Camera> mrtCam = createMRTCamera( textures );
|
||||||
|
mrtCam->addChild( cessna );
|
||||||
|
|
||||||
|
// Create shader program to be used
|
||||||
|
const char* mrtFragmentCode = {
|
||||||
|
"void main() {\n"
|
||||||
|
" gl_FragData[0] = gl_Color * vec4(1.0, 1.0, 1.0, 0.7);\n"
|
||||||
|
" gl_FragData[1] = vec4(0.0, 1.0, 1.0, 0.0);\n"
|
||||||
|
" gl_FragData[2] = vec4(1.0, 0.0, 1.0, 0.3);\n"
|
||||||
|
" gl_FragData[3] = vec4(1.0, 1.0, 0.0, 1.0);\n"
|
||||||
|
"}\n"
|
||||||
|
};
|
||||||
|
osg::ref_ptr<osg::Program> program = new osg::Program;
|
||||||
|
program->addShader( new osg::Shader(osg::Shader::FRAGMENT, mrtFragmentCode) );
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::StateSet> ss = mrtCam->getOrCreateStateSet();
|
||||||
|
ss->setAttributeAndModes( program );
|
||||||
|
|
||||||
|
// Apply blending to the original scene in MRT
|
||||||
|
if ( !useGlobalBlending )
|
||||||
|
{
|
||||||
|
// Only enable blending on the first draw buffer so other three outputs are
|
||||||
|
// totally opaque, which is important for MRT cases
|
||||||
|
ss->setAttribute( new osg::Enablei(GL_BLEND, 0) );
|
||||||
|
ss->setAttribute( new osg::Disablei(GL_BLEND, 1) );
|
||||||
|
ss->setAttribute( new osg::Disablei(GL_BLEND, 2) );
|
||||||
|
ss->setAttribute( new osg::Disablei(GL_BLEND, 3) );
|
||||||
|
|
||||||
|
// Accept different blend/colormask attributes on multiple render targets
|
||||||
|
osg::ref_ptr<osg::BlendFunci> blend0 = new osg::BlendFunci(0, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
osg::ref_ptr<osg::ColorMaski> colormask3 = new osg::ColorMaski(3, false, true, false, true);
|
||||||
|
ss->setAttribute( blend0 );
|
||||||
|
ss->setAttributeAndModes( colormask3 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// When separated blending is disabled, all rendering targets will be affected
|
||||||
|
// by its alpha channel and you will see each output blended with the background.
|
||||||
|
//
|
||||||
|
// This causes a big program in situations like deferred shading because we may
|
||||||
|
// have to save different scene data to MRT 'GBuffer', in which alpha channels are
|
||||||
|
// used to store certain attributes rather than opacity. These attributes can be
|
||||||
|
// reused in following post-processing steps.
|
||||||
|
//
|
||||||
|
// For such targets, alpha blending must be disabled; otherwise it will mess the
|
||||||
|
// output. That is why this example exists!
|
||||||
|
osg::ref_ptr<osg::BlendFunc> blend = new osg::BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
ss->setAttributeAndModes( blend.get() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create some quads to be shown on screen to contain the MRT result
|
||||||
|
osg::ref_ptr<osg::Geode> quad = new osg::Geode;
|
||||||
|
for ( unsigned int i=0; i<textures.size(); ++i )
|
||||||
|
{
|
||||||
|
osg::Geometry* geom = osg::createTexturedQuadGeometry(
|
||||||
|
osg::Vec3((float)i/(float)textures.size(), 0.0f, 0.0f),
|
||||||
|
osg::Vec3(1.0f/(float)textures.size()-0.01f,0.0f,0.0f), osg::Vec3(0.0f,1.0f,0.0f) );
|
||||||
|
geom->getOrCreateStateSet()->setTextureAttributeAndModes( 0, textures[i] );
|
||||||
|
quad->addDrawable( geom );
|
||||||
|
}
|
||||||
|
|
||||||
|
osg::Camera* hudCam = createHUDCamera( 0.0, 1.0, 0.0, 1.0 );
|
||||||
|
hudCam->addChild( quad.get() );
|
||||||
|
|
||||||
|
// Construct scene graph and viewer
|
||||||
|
osg::ref_ptr<osg::Group> root = new osg::Group;
|
||||||
|
root->addChild( mrtCam );
|
||||||
|
root->addChild( hudCam );
|
||||||
|
|
||||||
|
osgViewer::Viewer viewer;
|
||||||
|
viewer.setSceneData( root.get() );
|
||||||
|
return viewer.run();
|
||||||
|
}
|
||||||
@@ -82,7 +82,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool TechniqueEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
bool TechniqueEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
||||||
{
|
{
|
||||||
switch(ea.getEventType())
|
switch(ea.getEventType())
|
||||||
@@ -104,7 +104,7 @@ bool TechniqueEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAc
|
|||||||
_eq_index--;
|
_eq_index--;
|
||||||
if (_eq_index<0) _eq_index=_eq_nb-1;
|
if (_eq_index<0) _eq_index=_eq_nb-1;
|
||||||
_blendEq->setEquation(_equations[_eq_index]);
|
_blendEq->setEquation(_equations[_eq_index]);
|
||||||
std::cout<<"Operation name = "<<_equations_name[_eq_index]<<std::endl;
|
std::cout<<"Equation name = "<<_equations_name[_eq_index]<<std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -134,36 +134,36 @@ int main( int argc, char **argv )
|
|||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates how to use glBlendEquation for mixing rendered scene and the frame-buffer.");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates how to use glBlendEquation for mixing rendered scene and the frame-buffer.");
|
||||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
|
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
|
||||||
|
|
||||||
// construct the viewer.
|
// construct the viewer.
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("cessnafire.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("cessnafire.osgt");
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Group* root = new osg::Group;
|
osg::ref_ptr<osg::Group> root = new osg::Group;
|
||||||
root->addChild(loadedModel);
|
root->addChild(loadedModel);
|
||||||
|
|
||||||
|
|
||||||
osg::StateSet* stateset = new osg::StateSet;
|
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet;
|
||||||
stateset->setDataVariance(osg::Object::DYNAMIC);
|
stateset->setDataVariance(osg::Object::DYNAMIC);
|
||||||
|
|
||||||
osg::BlendEquation* blendEquation = new osg::BlendEquation(osg::BlendEquation::FUNC_ADD);
|
osg::BlendEquation* blendEquation = new osg::BlendEquation(osg::BlendEquation::FUNC_ADD);
|
||||||
blendEquation->setDataVariance(osg::Object::DYNAMIC);
|
blendEquation->setDataVariance(osg::Object::DYNAMIC);
|
||||||
|
|
||||||
stateset->setAttributeAndModes(blendEquation,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
stateset->setAttributeAndModes(blendEquation,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
||||||
|
|
||||||
//tell to sort the mesh before displaying it
|
//tell to sort the mesh before displaying it
|
||||||
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||||
|
|
||||||
loadedModel->setStateSet(stateset);
|
loadedModel->setStateSet(stateset);
|
||||||
|
|
||||||
@@ -171,6 +171,6 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// add a viewport to the viewer and attach the scene graph.
|
// add a viewport to the viewer and attach the scene graph.
|
||||||
viewer.setSceneData( root );
|
viewer.setSceneData( root );
|
||||||
|
|
||||||
return viewer.run();
|
return viewer.run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
class UpdateCallback : public osg::NodeCallback
|
class UpdateCallback : public osg::NodeCallback
|
||||||
{
|
{
|
||||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||||
{
|
{
|
||||||
std::cout<<"update callback - pre traverse"<<node<<std::endl;
|
std::cout<<"update callback - pre traverse"<<node<<std::endl;
|
||||||
traverse(node,nv);
|
traverse(node,nv);
|
||||||
std::cout<<"update callback - post traverse"<<node<<std::endl;
|
std::cout<<"update callback - post traverse"<<node<<std::endl;
|
||||||
@@ -48,7 +48,7 @@ class UpdateCallback : public osg::NodeCallback
|
|||||||
class CullCallback : public osg::NodeCallback
|
class CullCallback : public osg::NodeCallback
|
||||||
{
|
{
|
||||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||||
{
|
{
|
||||||
std::cout<<"cull callback - pre traverse"<<node<<std::endl;
|
std::cout<<"cull callback - pre traverse"<<node<<std::endl;
|
||||||
traverse(node,nv);
|
traverse(node,nv);
|
||||||
std::cout<<"cull callback - post traverse"<<node<<std::endl;
|
std::cout<<"cull callback - post traverse"<<node<<std::endl;
|
||||||
@@ -87,11 +87,11 @@ class InsertCallbacksVisitor : public osg::NodeVisitor
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
InsertCallbacksVisitor():osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
|
InsertCallbacksVisitor():osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void apply(osg::Node& node)
|
virtual void apply(osg::Node& node)
|
||||||
{
|
{
|
||||||
node.setUpdateCallback(new UpdateCallback());
|
node.setUpdateCallback(new UpdateCallback());
|
||||||
@@ -102,7 +102,7 @@ class InsertCallbacksVisitor : public osg::NodeVisitor
|
|||||||
virtual void apply(osg::Geode& geode)
|
virtual void apply(osg::Geode& geode)
|
||||||
{
|
{
|
||||||
geode.setUpdateCallback(new UpdateCallback());
|
geode.setUpdateCallback(new UpdateCallback());
|
||||||
|
|
||||||
//note, it makes no sense to attach a cull callback to the node
|
//note, it makes no sense to attach a cull callback to the node
|
||||||
//at there are no nodes to traverse below the geode, only
|
//at there are no nodes to traverse below the geode, only
|
||||||
//drawables, and as such the Cull node callbacks is ignored.
|
//drawables, and as such the Cull node callbacks is ignored.
|
||||||
@@ -116,7 +116,7 @@ class InsertCallbacksVisitor : public osg::NodeVisitor
|
|||||||
geode.getDrawable(i)->setDrawCallback(new DrawableDrawCallback());
|
geode.getDrawable(i)->setDrawCallback(new DrawableDrawCallback());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void apply(osg::Transform& node)
|
virtual void apply(osg::Transform& node)
|
||||||
{
|
{
|
||||||
apply((osg::Node&)node);
|
apply((osg::Node&)node);
|
||||||
@@ -140,7 +140,7 @@ public:
|
|||||||
class CameraUpdateCallback : public osg::NodeCallback
|
class CameraUpdateCallback : public osg::NodeCallback
|
||||||
{
|
{
|
||||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||||
{
|
{
|
||||||
std::cout<<"Camera update callback - pre traverse"<<node<<std::endl;
|
std::cout<<"Camera update callback - pre traverse"<<node<<std::endl;
|
||||||
traverse(node,nv);
|
traverse(node,nv);
|
||||||
std::cout<<"Camera update callback - post traverse"<<node<<std::endl;
|
std::cout<<"Camera update callback - post traverse"<<node<<std::endl;
|
||||||
@@ -150,50 +150,131 @@ class CameraUpdateCallback : public osg::NodeCallback
|
|||||||
class CameraEventCallback : public osg::NodeCallback
|
class CameraEventCallback : public osg::NodeCallback
|
||||||
{
|
{
|
||||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||||
{
|
{
|
||||||
std::cout<<"Camera event callback - pre traverse"<<node<<std::endl;
|
std::cout<<"Camera event callback - pre traverse"<<node<<std::endl;
|
||||||
traverse(node,nv);
|
traverse(node,nv);
|
||||||
std::cout<<"Camera event callback - post traverse"<<node<<std::endl;
|
std::cout<<"Camera event callback - post traverse"<<node<<std::endl;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct TestDrawableUpdateCallback : public osg::Drawable::UpdateCallback
|
||||||
|
{
|
||||||
|
TestDrawableUpdateCallback(const std::string &message): _message(message) {}
|
||||||
|
|
||||||
|
virtual void update(osg::NodeVisitor*, osg::Drawable* drw) {
|
||||||
|
printf("%s\n", _message.c_str());
|
||||||
|
}
|
||||||
|
std::string _message;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TestNodeUpdateCallback : public osg::NodeCallback
|
||||||
|
{
|
||||||
|
TestNodeUpdateCallback(const std::string &message): _message(message) {}
|
||||||
|
|
||||||
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) {
|
||||||
|
printf("%s\n", _message.c_str());
|
||||||
|
}
|
||||||
|
std::string _message;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
int main( int argc, char **argv )
|
||||||
{
|
{
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set the osgDB::Registy read file callback to catch all requests for reading files.
|
// set the osgDB::Registy read file callback to catch all requests for reading files.
|
||||||
osgDB::Registry::instance()->setReadFileCallback(new MyReadFileCallback());
|
osgDB::Registry::instance()->setReadFileCallback(new MyReadFileCallback());
|
||||||
|
|
||||||
// initialize the viewer.
|
// initialize the viewer.
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* rootnode = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> rootnode;
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
if (arguments.read("--test"))
|
||||||
if (!rootnode) rootnode = osgDB::readNodeFile("cow.osgt");
|
|
||||||
|
|
||||||
if (!rootnode)
|
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Please specify a file on the command line"<<std::endl;
|
osg::ref_ptr<osg::Group> root = new osg::Group();
|
||||||
|
rootnode = root;
|
||||||
|
|
||||||
|
osg::Node *test1 = new osg::Node();
|
||||||
|
test1->setUpdateCallback(new TestNodeUpdateCallback("test1"));
|
||||||
|
root->addChild(test1);
|
||||||
|
|
||||||
|
osg::Drawable *test2 = new osg::Drawable();
|
||||||
|
test2->osg::Node::setUpdateCallback(new TestNodeUpdateCallback("test2"));
|
||||||
|
root->addChild(test2);
|
||||||
|
|
||||||
|
osg::Drawable *test3 = new osg::Drawable();
|
||||||
|
test3->setUpdateCallback(new TestDrawableUpdateCallback("test3"));
|
||||||
|
root->addChild(test3);
|
||||||
|
|
||||||
|
osg::Geode *test4 = new osg::Geode();
|
||||||
|
osg::Drawable *drawable1 = new osg::Drawable();
|
||||||
|
drawable1->osg::Node::setUpdateCallback(new TestNodeUpdateCallback("test4"));
|
||||||
|
test4->addDrawable(drawable1);
|
||||||
|
root->addChild(test4);
|
||||||
|
|
||||||
|
osg::Geode *test5 = new osg::Geode();
|
||||||
|
osg::Drawable *drawable2 = new osg::Drawable();
|
||||||
|
drawable2->setUpdateCallback(new TestDrawableUpdateCallback("test5"));
|
||||||
|
test5->addDrawable(drawable2);
|
||||||
|
root->addChild(test5);
|
||||||
|
|
||||||
|
osg::Geode *test6 = new osg::Geode();
|
||||||
|
osg::Drawable *drawable3 = new osg::Drawable();
|
||||||
|
drawable3->setUpdateCallback(new TestDrawableUpdateCallback("test6"));
|
||||||
|
test6->addChild(drawable3);
|
||||||
|
root->addChild(test6);
|
||||||
|
|
||||||
|
osg::Geode *test7 = new osg::Geode();
|
||||||
|
osg::Drawable *drawable4 = new osg::Drawable();
|
||||||
|
drawable4->osg::Node::setUpdateCallback(new TestNodeUpdateCallback("test7"));
|
||||||
|
test7->addChild(drawable4);
|
||||||
|
root->addChild(test7);
|
||||||
|
|
||||||
|
printf("Numchildren with updates %u\n", rootnode->getNumChildrenRequiringUpdateTraversal());
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// run optimization over the scene graph
|
{
|
||||||
osgUtil::Optimizer optimzer;
|
rootnode = osgDB::readRefNodeFiles(arguments);
|
||||||
optimzer.optimize(rootnode);
|
|
||||||
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
// insert all the callbacks
|
if (!rootnode) rootnode = osgDB::readRefNodeFile("cow.osgt");
|
||||||
InsertCallbacksVisitor icv;
|
|
||||||
rootnode->accept(icv);
|
if (!rootnode)
|
||||||
|
{
|
||||||
|
osg::notify(osg::NOTICE)<<"Please specify a file on the command line"<<std::endl;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// run optimization over the scene graph
|
||||||
|
osgUtil::Optimizer optimzer;
|
||||||
|
optimzer.optimize(rootnode.get());
|
||||||
|
|
||||||
|
// insert all the callbacks
|
||||||
|
InsertCallbacksVisitor icv;
|
||||||
|
rootnode->accept(icv);
|
||||||
|
}
|
||||||
|
|
||||||
viewer.getCamera()->setUpdateCallback(new CameraUpdateCallback());
|
viewer.getCamera()->setUpdateCallback(new CameraUpdateCallback());
|
||||||
viewer.getCamera()->setEventCallback(new CameraEventCallback());
|
viewer.getCamera()->setEventCallback(new CameraEventCallback());
|
||||||
|
|
||||||
// set the scene to render
|
// set the scene to render
|
||||||
viewer.setSceneData(rootnode);
|
viewer.setSceneData(rootnode.get());
|
||||||
|
|
||||||
return viewer.run();
|
viewer.setCameraManipulator(new osgGA::TrackballManipulator);
|
||||||
|
|
||||||
|
viewer.realize();
|
||||||
|
|
||||||
|
while(!viewer.done())
|
||||||
|
{
|
||||||
|
OSG_NOTICE<<std::endl<<"New Frame"<<std::endl;
|
||||||
|
viewer.frame();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,50 +25,50 @@
|
|||||||
#include <osgGA/AnimationPathManipulator>
|
#include <osgGA/AnimationPathManipulator>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
class ModelHandler : public osgGA::GUIEventHandler
|
class ModelHandler : public osgGA::GUIEventHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ModelHandler():
|
ModelHandler():
|
||||||
_position(0) {}
|
_position(0) {}
|
||||||
|
|
||||||
typedef std::vector<std::string> Filenames;
|
typedef std::vector<std::string> Filenames;
|
||||||
Filenames _filenames;
|
Filenames _filenames;
|
||||||
unsigned int _position;
|
unsigned int _position;
|
||||||
|
|
||||||
void add(const std::string& filename) { _filenames.push_back(filename); }
|
void add(const std::string& filename) { _filenames.push_back(filename); }
|
||||||
|
|
||||||
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
|
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
|
||||||
{
|
{
|
||||||
osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(&aa);
|
osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(&aa);
|
||||||
if (!viewer) return false;
|
if (!viewer) return false;
|
||||||
|
|
||||||
if (_filenames.empty()) return false;
|
if (_filenames.empty()) return false;
|
||||||
|
|
||||||
switch(ea.getEventType())
|
switch(ea.getEventType())
|
||||||
{
|
{
|
||||||
case(osgGA::GUIEventAdapter::KEYUP):
|
case(osgGA::GUIEventAdapter::KEYUP):
|
||||||
{
|
{
|
||||||
if (ea.getKey()=='l')
|
if (ea.getKey()=='l')
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Node> model = osgDB::readNodeFile( _filenames[_position] );
|
osg::ref_ptr<osg::Node> model = osgDB::readRefNodeFile( _filenames[_position] );
|
||||||
++_position;
|
++_position;
|
||||||
if (_position>=_filenames.size()) _position = 0;
|
if (_position>=_filenames.size()) _position = 0;
|
||||||
|
|
||||||
if (model.valid())
|
if (model.valid())
|
||||||
{
|
{
|
||||||
viewer->setSceneData(model.get());
|
viewer->setSceneData(model.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _done;
|
bool _done;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,12 +76,12 @@ public:
|
|||||||
void singleWindowMultipleCameras(osgViewer::Viewer& viewer)
|
void singleWindowMultipleCameras(osgViewer::Viewer& viewer)
|
||||||
{
|
{
|
||||||
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
||||||
if (!wsi)
|
if (!wsi)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
|
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int width, height;
|
unsigned int width, height;
|
||||||
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
|
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
|
||||||
|
|
||||||
@@ -127,12 +127,12 @@ void singleWindowMultipleCameras(osgViewer::Viewer& viewer)
|
|||||||
void multipleWindowMultipleCameras(osgViewer::Viewer& viewer, bool multipleScreens)
|
void multipleWindowMultipleCameras(osgViewer::Viewer& viewer, bool multipleScreens)
|
||||||
{
|
{
|
||||||
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
||||||
if (!wsi)
|
if (!wsi)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
|
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int width, height;
|
unsigned int width, height;
|
||||||
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
|
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ int main( int argc, char **argv )
|
|||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
if (argc<2)
|
if (argc<2)
|
||||||
{
|
{
|
||||||
std::cout << argv[0] <<": requires filename argument." << std::endl;
|
std::cout << argv[0] <<": requires filename argument." << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@@ -214,7 +214,7 @@ int main( int argc, char **argv )
|
|||||||
osg::ref_ptr<osg::Node> model;
|
osg::ref_ptr<osg::Node> model;
|
||||||
if (sharedModel)
|
if (sharedModel)
|
||||||
{
|
{
|
||||||
model = osgDB::readNodeFiles(arguments);
|
model = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!model) return 0;
|
if (!model) return 0;
|
||||||
|
|
||||||
if (enableVBO)
|
if (enableVBO)
|
||||||
@@ -242,7 +242,7 @@ int main( int argc, char **argv )
|
|||||||
if (sharedModel) viewer.setSceneData(model.get());
|
if (sharedModel) viewer.setSceneData(model.get());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Node> node = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!node) return 0;
|
if (!node) return 0;
|
||||||
|
|
||||||
if (enableVBO)
|
if (enableVBO)
|
||||||
@@ -268,19 +268,19 @@ int main( int argc, char **argv )
|
|||||||
while (arguments.read("-p",pathfile))
|
while (arguments.read("-p",pathfile))
|
||||||
{
|
{
|
||||||
apm = new osgGA::AnimationPathManipulator(pathfile);
|
apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||||
if (!apm.valid() || !(apm->valid()) )
|
if (!apm.valid() || !(apm->valid()) )
|
||||||
{
|
{
|
||||||
apm = 0;
|
apm = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
while (arguments.read("-s")) { viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); }
|
while (arguments.read("-s")) { viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); }
|
||||||
while (arguments.read("-g")) { viewer.setThreadingModel(osgViewer::Viewer::CullDrawThreadPerContext); }
|
while (arguments.read("-g")) { viewer.setThreadingModel(osgViewer::Viewer::CullDrawThreadPerContext); }
|
||||||
while (arguments.read("-d")) { viewer.setThreadingModel(osgViewer::Viewer::DrawThreadPerContext); }
|
while (arguments.read("-d")) { viewer.setThreadingModel(osgViewer::Viewer::DrawThreadPerContext); }
|
||||||
while (arguments.read("-c")) { viewer.setThreadingModel(osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext); }
|
while (arguments.read("-c")) { viewer.setThreadingModel(osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext); }
|
||||||
|
|
||||||
bool limitNumberOfFrames = false;
|
bool limitNumberOfFrames = false;
|
||||||
unsigned int maxFrames = 10;
|
unsigned int maxFrames = 10;
|
||||||
while (arguments.read("--run-till-frame-number",maxFrames)) { limitNumberOfFrames = true; }
|
while (arguments.read("--run-till-frame-number",maxFrames)) { limitNumberOfFrames = true; }
|
||||||
@@ -292,7 +292,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
if (apm.valid()) viewer.setCameraManipulator(apm.get());
|
if (apm.valid()) viewer.setCameraManipulator(apm.get());
|
||||||
else viewer.setCameraManipulator( new osgGA::TrackballManipulator() );
|
else viewer.setCameraManipulator( new osgGA::TrackballManipulator() );
|
||||||
|
|
||||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||||
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
||||||
|
|
||||||
@@ -300,11 +300,11 @@ int main( int argc, char **argv )
|
|||||||
while (arguments.read("--config", configfile))
|
while (arguments.read("--config", configfile))
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Trying to read config file "<<configfile<<std::endl;
|
osg::notify(osg::NOTICE)<<"Trying to read config file "<<configfile<<std::endl;
|
||||||
osg::ref_ptr<osg::Object> object = osgDB::readObjectFile(configfile);
|
osg::ref_ptr<osg::Object> object = osgDB::readRefObjectFile(configfile);
|
||||||
osgViewer::View* view = dynamic_cast<osgViewer::View*>(object.get());
|
osgViewer::View* view = dynamic_cast<osgViewer::View*>(object.get());
|
||||||
if (view)
|
if (view)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Read config file succesfully"<<std::endl;
|
osg::notify(osg::NOTICE)<<"Read config file successfully"<<std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -329,19 +329,19 @@ int main( int argc, char **argv )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// load the scene.
|
// load the scene.
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("cow.osgt");
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout << argv[0] <<": No data loaded." << std::endl;
|
std::cout << argv[0] <<": No data loaded." << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer.setSceneData(loadedModel.get());
|
viewer.setSceneData(loadedModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer.realize();
|
viewer.realize();
|
||||||
|
|
||||||
unsigned int numFrames = 0;
|
unsigned int numFrames = 0;
|
||||||
|
|||||||
@@ -55,11 +55,11 @@ class Character : public osg::Referenced
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Character();
|
Character();
|
||||||
|
|
||||||
void setCharacter(const std::string& filename, const std::string& name, const osg::Vec3& orgin, const osg::Vec3& width, const osg::Vec3& catchPos, float positionRatio);
|
void setCharacter(const std::string& filename, const std::string& name, const osg::Vec3& orgin, const osg::Vec3& width, const osg::Vec3& catchPos, float positionRatio);
|
||||||
|
|
||||||
void setLives(const std::string& filename, const osg::Vec3& orgin, const osg::Vec3& delta, unsigned int numLives);
|
void setLives(const std::string& filename, const osg::Vec3& orgin, const osg::Vec3& delta, unsigned int numLives);
|
||||||
|
|
||||||
void setCatches(const std::string& filename, const osg::Vec3& orgin, const osg::Vec3& delta, unsigned int numLives);
|
void setCatches(const std::string& filename, const osg::Vec3& orgin, const osg::Vec3& delta, unsigned int numLives);
|
||||||
|
|
||||||
void moveLeft();
|
void moveLeft();
|
||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
void resetCatches();
|
void resetCatches();
|
||||||
|
|
||||||
bool addCatch();
|
bool addCatch();
|
||||||
|
|
||||||
bool looseLife();
|
bool looseLife();
|
||||||
|
|
||||||
osg::Vec3 getCurrentCenterOfBasket() const { return _character->getPosition()+_centerBasket; }
|
osg::Vec3 getCurrentCenterOfBasket() const { return _character->getPosition()+_centerBasket; }
|
||||||
@@ -91,12 +91,12 @@ public:
|
|||||||
|
|
||||||
unsigned int _numCatches;
|
unsigned int _numCatches;
|
||||||
osg::ref_ptr<osg::Switch> _catchSwitch;
|
osg::ref_ptr<osg::Switch> _catchSwitch;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Group> _objectsGroup;
|
osg::ref_ptr<osg::Group> _objectsGroup;
|
||||||
|
|
||||||
osg::Vec3 _centerBasket;
|
osg::Vec3 _centerBasket;
|
||||||
float _radiusBasket;
|
float _radiusBasket;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Character::Character():
|
Character::Character():
|
||||||
@@ -117,7 +117,7 @@ void Character::setCharacter(const std::string& filename, const std::string& nam
|
|||||||
|
|
||||||
float _characterSize = _width.length()*0.2f;
|
float _characterSize = _width.length()*0.2f;
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile(filename);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(filename);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Vec3 pos(-0.5f*_characterSize,0.0f,0.0f);
|
osg::Vec3 pos(-0.5f*_characterSize,0.0f,0.0f);
|
||||||
@@ -136,14 +136,14 @@ void Character::setCharacter(const std::string& filename, const std::string& nam
|
|||||||
_character = new osg::PositionAttitudeTransform;
|
_character = new osg::PositionAttitudeTransform;
|
||||||
_character->setName(name);
|
_character->setName(name);
|
||||||
_character->addChild(geode);
|
_character->addChild(geode);
|
||||||
|
|
||||||
moveTo(positionRatio);
|
moveTo(positionRatio);
|
||||||
|
|
||||||
_centerBasket = width*catchPos.x() + height*catchPos.y() + pos;
|
_centerBasket = width*catchPos.x() + height*catchPos.y() + pos;
|
||||||
_radiusBasket = width.length()*catchPos.z();
|
_radiusBasket = width.length()*catchPos.z();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Character::setLives(const std::string& filename, const osg::Vec3& origin, const osg::Vec3& delta, unsigned int numLives)
|
void Character::setLives(const std::string& filename, const osg::Vec3& origin, const osg::Vec3& delta, unsigned int numLives)
|
||||||
@@ -153,7 +153,7 @@ void Character::setLives(const std::string& filename, const osg::Vec3& origin, c
|
|||||||
_numLives = numLives;
|
_numLives = numLives;
|
||||||
_livesSwitch = new osg::Switch;
|
_livesSwitch = new osg::Switch;
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile(filename);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(filename);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::StateSet* stateset = _livesSwitch->getOrCreateStateSet();
|
osg::StateSet* stateset = _livesSwitch->getOrCreateStateSet();
|
||||||
@@ -186,7 +186,7 @@ void Character::setCatches(const std::string& filename, const osg::Vec3& origin,
|
|||||||
_numCatches = 0;
|
_numCatches = 0;
|
||||||
_catchSwitch = new osg::Switch;
|
_catchSwitch = new osg::Switch;
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile(filename);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(filename);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::StateSet* stateset = _catchSwitch->getOrCreateStateSet();
|
osg::StateSet* stateset = _catchSwitch->getOrCreateStateSet();
|
||||||
@@ -249,20 +249,20 @@ void Character::resetCatches()
|
|||||||
bool Character::addCatch()
|
bool Character::addCatch()
|
||||||
{
|
{
|
||||||
if (!_catchSwitch || _numCatches>=_catchSwitch->getNumChildren()) return false;
|
if (!_catchSwitch || _numCatches>=_catchSwitch->getNumChildren()) return false;
|
||||||
|
|
||||||
_catchSwitch->setValue(_numCatches,true);
|
_catchSwitch->setValue(_numCatches,true);
|
||||||
++_numCatches;
|
++_numCatches;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Character::looseLife()
|
bool Character::looseLife()
|
||||||
{
|
{
|
||||||
if (!_livesSwitch || _numLives==0) return false;
|
if (!_livesSwitch || _numLives==0) return false;
|
||||||
|
|
||||||
--_numLives;
|
--_numLives;
|
||||||
_livesSwitch->setValue(_numLives,false);
|
_livesSwitch->setValue(_numLives,false);
|
||||||
|
|
||||||
return (_numLives!=0);
|
return (_numLives!=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,21 +279,21 @@ class CatchableObject : public osg::Referenced
|
|||||||
bool anyInside(const osg::Vec3& lower_left, const osg::Vec3& top_right);
|
bool anyInside(const osg::Vec3& lower_left, const osg::Vec3& top_right);
|
||||||
|
|
||||||
bool centerInside(const osg::Vec3& center, float radius);
|
bool centerInside(const osg::Vec3& center, float radius);
|
||||||
|
|
||||||
void explode();
|
void explode();
|
||||||
|
|
||||||
bool dangerous() { return _dangerous; }
|
bool dangerous() { return _dangerous; }
|
||||||
|
|
||||||
void stop() { _stopped = true; }
|
void stop() { _stopped = true; }
|
||||||
|
|
||||||
bool stopped() { return _stopped; }
|
bool stopped() { return _stopped; }
|
||||||
|
|
||||||
void setTimeToRemove(double time) { _timeToRemove=time; }
|
void setTimeToRemove(double time) { _timeToRemove=time; }
|
||||||
|
|
||||||
double getTimeToRemove() { return _timeToRemove; }
|
double getTimeToRemove() { return _timeToRemove; }
|
||||||
|
|
||||||
bool needToRemove(double time) { return _timeToRemove>=0.0 && time>_timeToRemove; }
|
bool needToRemove(double time) { return _timeToRemove>=0.0 && time>_timeToRemove; }
|
||||||
|
|
||||||
osg::ref_ptr<osg::PositionAttitudeTransform> _object;
|
osg::ref_ptr<osg::PositionAttitudeTransform> _object;
|
||||||
osg::Vec3 _velocity;
|
osg::Vec3 _velocity;
|
||||||
float _mass;
|
float _mass;
|
||||||
@@ -307,7 +307,7 @@ class CatchableObject : public osg::Referenced
|
|||||||
static void setUpCatchablesMap(const FileList& fileList);
|
static void setUpCatchablesMap(const FileList& fileList);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// update position and velocity
|
// update position and velocity
|
||||||
void update(double dt);
|
void update(double dt);
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ class CatchableObject : public osg::Referenced
|
|||||||
_viscosity = v;
|
_viscosity = v;
|
||||||
_viscosityCoefficient = 6 * osg::PI * _viscosity;
|
_viscosityCoefficient = 6 * osg::PI * _viscosity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the viscosity of the fluid.
|
/// Get the viscosity of the fluid.
|
||||||
inline float getFluidViscosity() const { return _viscosity; }
|
inline float getFluidViscosity() const { return _viscosity; }
|
||||||
|
|
||||||
@@ -330,17 +330,17 @@ class CatchableObject : public osg::Referenced
|
|||||||
|
|
||||||
/// Get the density of the fluid.
|
/// Get the density of the fluid.
|
||||||
inline float getFluidDensity() const { return _density; }
|
inline float getFluidDensity() const { return _density; }
|
||||||
|
|
||||||
|
|
||||||
/// Set the wind vector.
|
/// Set the wind vector.
|
||||||
inline void setWind(const osg::Vec3& wind) { _wind = wind; }
|
inline void setWind(const osg::Vec3& wind) { _wind = wind; }
|
||||||
|
|
||||||
/// Get the wind vector.
|
/// Get the wind vector.
|
||||||
inline const osg::Vec3& getWind() const { return _wind; }
|
inline const osg::Vec3& getWind() const { return _wind; }
|
||||||
|
|
||||||
/// Set the acceleration vector.
|
/// Set the acceleration vector.
|
||||||
inline void setAcceleration(const osg::Vec3& v) { _acceleration = v; }
|
inline void setAcceleration(const osg::Vec3& v) { _acceleration = v; }
|
||||||
|
|
||||||
/// Get the acceleration vector.
|
/// Get the acceleration vector.
|
||||||
inline const osg::Vec3& getAcceleration() const { return _acceleration; }
|
inline const osg::Vec3& getAcceleration() const { return _acceleration; }
|
||||||
|
|
||||||
@@ -349,22 +349,22 @@ class CatchableObject : public osg::Referenced
|
|||||||
*/
|
*/
|
||||||
inline void setToGravity(float scale = 1.0f) { _acceleration.set(0, 0, -9.81f*scale); }
|
inline void setToGravity(float scale = 1.0f) { _acceleration.set(0, 0, -9.81f*scale); }
|
||||||
|
|
||||||
/// Set the fluid parameters as for air (20<EFBFBD>C temperature).
|
/// Set the fluid parameters as for air (20C temperature).
|
||||||
inline void setFluidToAir()
|
inline void setFluidToAir()
|
||||||
{
|
{
|
||||||
setToGravity(1.0f);
|
setToGravity(1.0f);
|
||||||
setFluidDensity(1.2929f);
|
setFluidDensity(1.2929f);
|
||||||
setFluidViscosity(1.8e-5f);
|
setFluidViscosity(1.8e-5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the fluid parameters as for pure water (20<EFBFBD>C temperature).
|
/// Set the fluid parameters as for pure water (20C temperature).
|
||||||
inline void setFluidToWater()
|
inline void setFluidToWater()
|
||||||
{
|
{
|
||||||
setToGravity(1.0f);
|
setToGravity(1.0f);
|
||||||
setFluidDensity(1.0f);
|
setFluidDensity(1.0f);
|
||||||
setFluidViscosity(1.002e-3f);
|
setFluidViscosity(1.002e-3f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -375,15 +375,15 @@ class CatchableObject : public osg::Referenced
|
|||||||
|
|
||||||
float _viscosityCoefficient;
|
float _viscosityCoefficient;
|
||||||
float _densityCoefficeint;
|
float _densityCoefficeint;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CatchableObject::CatchableObject()
|
CatchableObject::CatchableObject()
|
||||||
{
|
{
|
||||||
_stopped = false;
|
_stopped = false;
|
||||||
_dangerous = false;
|
_dangerous = false;
|
||||||
|
|
||||||
_timeToRemove = -1.0; // do not remove.
|
_timeToRemove = -1.0; // do not remove.
|
||||||
setFluidToAir();
|
setFluidToAir();
|
||||||
}
|
}
|
||||||
@@ -395,14 +395,14 @@ void CatchableObject::setUpCatchablesMap(const FileList& fileList)
|
|||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
const std::string& filename = *itr;
|
const std::string& filename = *itr;
|
||||||
osg::Image* image = osgDB::readImageFile(filename);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(filename);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet();
|
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet();
|
||||||
stateset->setTextureAttributeAndModes(0,new osg::Texture2D(image),osg::StateAttribute::ON);
|
stateset->setTextureAttributeAndModes(0,new osg::Texture2D(image),osg::StateAttribute::ON);
|
||||||
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
|
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
|
||||||
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||||
|
|
||||||
osg::Vec3 width((float)(image->s())/(float)(image->t()),0.0f,0.0);
|
osg::Vec3 width((float)(image->s())/(float)(image->t()),0.0f,0.0);
|
||||||
osg::Vec3 height(0.0f,0.0f,1.0f);
|
osg::Vec3 height(0.0f,0.0f,1.0f);
|
||||||
osg::Vec3 pos = (width+height)*-0.5f;
|
osg::Vec3 pos = (width+height)*-0.5f;
|
||||||
@@ -455,8 +455,8 @@ void CatchableObject::update(double dt)
|
|||||||
osg::Vec3 force = _acceleration * (_mass - _density*Volume);
|
osg::Vec3 force = _acceleration * (_mass - _density*Volume);
|
||||||
|
|
||||||
// compute force due to friction
|
// compute force due to friction
|
||||||
osg::Vec3 relative_wind = _velocity-_wind;
|
osg::Vec3 relative_wind = _velocity-_wind;
|
||||||
force -= relative_wind * Area * (_viscosityCoefficient + _densityCoefficeint*relative_wind.length());
|
force -= relative_wind * Area * (_viscosityCoefficient + _densityCoefficeint*relative_wind.length());
|
||||||
|
|
||||||
// divide force by mass to get acceleration.
|
// divide force by mass to get acceleration.
|
||||||
_velocity += force*(dt/_mass);
|
_velocity += force*(dt/_mass);
|
||||||
@@ -466,7 +466,7 @@ void CatchableObject::update(double dt)
|
|||||||
bool CatchableObject::anyInside(const osg::Vec3& lower_left, const osg::Vec3& upper_right)
|
bool CatchableObject::anyInside(const osg::Vec3& lower_left, const osg::Vec3& upper_right)
|
||||||
{
|
{
|
||||||
osg::Vec3 pos = _object->getPosition();
|
osg::Vec3 pos = _object->getPosition();
|
||||||
|
|
||||||
if (pos.x()+_radius < lower_left.x()) return false;
|
if (pos.x()+_radius < lower_left.x()) return false;
|
||||||
if (pos.x()-_radius > upper_right.x()) return false;
|
if (pos.x()-_radius > upper_right.x()) return false;
|
||||||
if (pos.z()+_radius < lower_left.z()) return false;
|
if (pos.z()+_radius < lower_left.z()) return false;
|
||||||
@@ -513,20 +513,20 @@ class GameEventHandler : public osgGA::GUIEventHandler
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
GameEventHandler();
|
GameEventHandler();
|
||||||
|
|
||||||
META_Object(osgStereImageApp,GameEventHandler);
|
META_Object(osgStereImageApp,GameEventHandler);
|
||||||
|
|
||||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
|
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
|
||||||
|
|
||||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||||
|
|
||||||
osg::Matrix getCameraPosition();
|
osg::Matrix getCameraPosition();
|
||||||
|
|
||||||
void compileGLObjects(osg::State& state)
|
void compileGLObjects(osg::State& state)
|
||||||
{
|
{
|
||||||
osgUtil::GLObjectsVisitor compile;
|
osgUtil::GLObjectsVisitor compile;
|
||||||
compile.setState(&state);
|
compile.setState(&state);
|
||||||
|
|
||||||
for(ObjectMap::iterator itr = s_objectMap.begin();
|
for(ObjectMap::iterator itr = s_objectMap.begin();
|
||||||
itr != s_objectMap.end();
|
itr != s_objectMap.end();
|
||||||
++itr)
|
++itr)
|
||||||
@@ -534,14 +534,14 @@ public:
|
|||||||
itr->second->accept(compile);
|
itr->second->accept(compile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node* createScene();
|
osg::Node* createScene();
|
||||||
|
|
||||||
void setFOVY(float fovy) { _fovy = fovy; }
|
void setFOVY(float fovy) { _fovy = fovy; }
|
||||||
float getFOVY() const { return _fovy; }
|
float getFOVY() const { return _fovy; }
|
||||||
|
|
||||||
void createNewCatchable();
|
void createNewCatchable();
|
||||||
|
|
||||||
void clearCatchables()
|
void clearCatchables()
|
||||||
{
|
{
|
||||||
for(CatchableObjectList::iterator itr=_catchableObjects.begin();
|
for(CatchableObjectList::iterator itr=_catchableObjects.begin();
|
||||||
@@ -562,7 +562,7 @@ public:
|
|||||||
|
|
||||||
_catchableObjects.clear();
|
_catchableObjects.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetLevel()
|
void resetLevel()
|
||||||
{
|
{
|
||||||
_level = 0;
|
_level = 0;
|
||||||
@@ -573,7 +573,7 @@ public:
|
|||||||
|
|
||||||
_levelStartTick = osg::Timer::instance()->tick();
|
_levelStartTick = osg::Timer::instance()->tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nextLevel()
|
void nextLevel()
|
||||||
{
|
{
|
||||||
++_level;
|
++_level;
|
||||||
@@ -596,12 +596,12 @@ public:
|
|||||||
void resetGame()
|
void resetGame()
|
||||||
{
|
{
|
||||||
_currentScore = 0;
|
_currentScore = 0;
|
||||||
|
|
||||||
updateTextWithScore();
|
updateTextWithScore();
|
||||||
|
|
||||||
clearCatchables();
|
clearCatchables();
|
||||||
resetLevel();
|
resetLevel();
|
||||||
|
|
||||||
for(unsigned int i=0;i<_numberOfPlayers;++i)
|
for(unsigned int i=0;i<_numberOfPlayers;++i)
|
||||||
{
|
{
|
||||||
_players[i].reset();
|
_players[i].reset();
|
||||||
@@ -629,12 +629,12 @@ public:
|
|||||||
livesPosition = _originBaseLine+osg::Vec3(1000.0f,-0.5f,000.0f);
|
livesPosition = _originBaseLine+osg::Vec3(1000.0f,-0.5f,000.0f);
|
||||||
catchesPosition = _originBaseLine+osg::Vec3(1100.0f,-0.5f,0.0f);
|
catchesPosition = _originBaseLine+osg::Vec3(1100.0f,-0.5f,0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(player)
|
switch(player)
|
||||||
{
|
{
|
||||||
case PLAYER_GIRL:
|
case PLAYER_GIRL:
|
||||||
{
|
{
|
||||||
std::string player_one = "Catch/girl.png";
|
std::string player_one = "Catch/girl.png";
|
||||||
osg::Vec3 catchPos(0.2, 0.57, 0.34);
|
osg::Vec3 catchPos(0.2, 0.57, 0.34);
|
||||||
|
|
||||||
_players[_numberOfPlayers].setCharacter(player_one,"girl", _originBaseLine + osg::Vec3(0.0f,-1.0f,0.0f), _widthBaseLine, catchPos, 0.5f);
|
_players[_numberOfPlayers].setCharacter(player_one,"girl", _originBaseLine + osg::Vec3(0.0f,-1.0f,0.0f), _widthBaseLine, catchPos, 0.5f);
|
||||||
@@ -646,7 +646,7 @@ public:
|
|||||||
}
|
}
|
||||||
case PLAYER_BOY:
|
case PLAYER_BOY:
|
||||||
{
|
{
|
||||||
std::string player_two = "Catch/boy.png";
|
std::string player_two = "Catch/boy.png";
|
||||||
osg::Vec3 catchPos(0.8, 0.57, 0.34);
|
osg::Vec3 catchPos(0.8, 0.57, 0.34);
|
||||||
|
|
||||||
_players[_numberOfPlayers].setCharacter(player_two,"boy", _originBaseLine + osg::Vec3(0.0f,-2.0f,0.0f), _widthBaseLine, catchPos, 0.5f);
|
_players[_numberOfPlayers].setCharacter(player_two,"boy", _originBaseLine + osg::Vec3(0.0f,-2.0f,0.0f), _widthBaseLine, catchPos, 0.5f);
|
||||||
@@ -656,10 +656,10 @@ public:
|
|||||||
++_numberOfPlayers;
|
++_numberOfPlayers;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef std::vector< osg::ref_ptr<osgText::Text> > TextList;
|
typedef std::vector< osg::ref_ptr<osgText::Text> > TextList;
|
||||||
|
|
||||||
void updateScoreWithCatch()
|
void updateScoreWithCatch()
|
||||||
@@ -673,8 +673,8 @@ public:
|
|||||||
osg::Timer_t newTick = osg::Timer::instance()->tick();
|
osg::Timer_t newTick = osg::Timer::instance()->tick();
|
||||||
double timeForLevel = osg::Timer::instance()->delta_s(_levelStartTick, newTick);
|
double timeForLevel = osg::Timer::instance()->delta_s(_levelStartTick, newTick);
|
||||||
|
|
||||||
// a ten second level gets you 10 points,
|
// a ten second level gets you 10 points,
|
||||||
// a twenty second levels gets you 5 points.
|
// a twenty second levels gets you 5 points.
|
||||||
_currentScore += static_cast<unsigned int>(10000.0f/(timeForLevel*timeForLevel));
|
_currentScore += static_cast<unsigned int>(10000.0f/(timeForLevel*timeForLevel));
|
||||||
|
|
||||||
updateTextWithScore();
|
updateTextWithScore();
|
||||||
@@ -685,24 +685,24 @@ public:
|
|||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os<<"Score: "<<_currentScore;
|
os<<"Score: "<<_currentScore;
|
||||||
|
|
||||||
std::string textString = os.str();
|
std::string textString = os.str();
|
||||||
|
|
||||||
for(TextList::iterator itr = _scoreTextList.begin();
|
for(TextList::iterator itr = _scoreTextList.begin();
|
||||||
itr != _scoreTextList.end();
|
itr != _scoreTextList.end();
|
||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
(*itr)->setText(textString);
|
(*itr)->setText(textString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateLevelText()
|
void updateLevelText()
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os<<"Level: "<<_level+1;
|
os<<"Level: "<<_level+1;
|
||||||
_levelText->setText(os.str());
|
_levelText->setText(os.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -715,45 +715,45 @@ protected:
|
|||||||
osg::Vec3 _originBaseLine;
|
osg::Vec3 _originBaseLine;
|
||||||
osg::Vec3 _widthBaseLine;
|
osg::Vec3 _widthBaseLine;
|
||||||
float _characterSize;
|
float _characterSize;
|
||||||
|
|
||||||
float _fovy;
|
float _fovy;
|
||||||
|
|
||||||
unsigned _level;
|
unsigned _level;
|
||||||
|
|
||||||
float _chanceOfExplodingAtStart;
|
float _chanceOfExplodingAtStart;
|
||||||
float _initialNumDropsPerSecond;
|
float _initialNumDropsPerSecond;
|
||||||
|
|
||||||
osg::ref_ptr<osg::Switch> _gameSwitch;
|
osg::ref_ptr<osg::Switch> _gameSwitch;
|
||||||
osg::ref_ptr<osg::Group> _gameGroup;
|
osg::ref_ptr<osg::Group> _gameGroup;
|
||||||
osg::ref_ptr<osg::Switch> _levelSwitch;
|
osg::ref_ptr<osg::Switch> _levelSwitch;
|
||||||
|
|
||||||
unsigned int _currentIndex;
|
unsigned int _currentIndex;
|
||||||
unsigned int _welcomeIndex;
|
unsigned int _welcomeIndex;
|
||||||
unsigned int _lostIndex;
|
unsigned int _lostIndex;
|
||||||
unsigned int _wonIndex;
|
unsigned int _wonIndex;
|
||||||
unsigned int _gameIndex;
|
unsigned int _gameIndex;
|
||||||
|
|
||||||
osg::Timer_t _levelStartTick;
|
osg::Timer_t _levelStartTick;
|
||||||
unsigned int _currentScore;
|
unsigned int _currentScore;
|
||||||
|
|
||||||
osg::ref_ptr<osgText::Text> _levelText;
|
osg::ref_ptr<osgText::Text> _levelText;
|
||||||
TextList _scoreTextList;
|
TextList _scoreTextList;
|
||||||
|
|
||||||
unsigned int _numberOfPlayers;
|
unsigned int _numberOfPlayers;
|
||||||
Character _players[2];
|
Character _players[2];
|
||||||
|
|
||||||
typedef std::list< osg::ref_ptr<CatchableObject> > CatchableObjectList;
|
typedef std::list< osg::ref_ptr<CatchableObject> > CatchableObjectList;
|
||||||
CatchableObjectList _catchableObjects;
|
CatchableObjectList _catchableObjects;
|
||||||
|
|
||||||
FileList _backgroundFiles;
|
FileList _backgroundFiles;
|
||||||
FileList _benignCatachables;
|
FileList _benignCatachables;
|
||||||
|
|
||||||
bool _leftKeyPressed;
|
bool _leftKeyPressed;
|
||||||
bool _rightKeyPressed;
|
bool _rightKeyPressed;
|
||||||
|
|
||||||
osg::ref_ptr<CatchableObject> _dummyCatchable;
|
osg::ref_ptr<CatchableObject> _dummyCatchable;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -791,11 +791,11 @@ GameEventHandler::GameEventHandler()
|
|||||||
_benignCatachables.push_back("Catch/t.png");
|
_benignCatachables.push_back("Catch/t.png");
|
||||||
_benignCatachables.push_back("Catch/u.png");
|
_benignCatachables.push_back("Catch/u.png");
|
||||||
_benignCatachables.push_back("Catch/ball.png");
|
_benignCatachables.push_back("Catch/ball.png");
|
||||||
|
|
||||||
CatchableObject::setUpCatchablesMap(_benignCatachables);
|
CatchableObject::setUpCatchablesMap(_benignCatachables);
|
||||||
|
|
||||||
_currentScore = 0;
|
_currentScore = 0;
|
||||||
|
|
||||||
setFOVY(osg::DegreesToRadians(60.0));
|
setFOVY(osg::DegreesToRadians(60.0));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -817,7 +817,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (_currentIndex==_lostIndex)
|
else if (_currentIndex==_lostIndex)
|
||||||
{
|
{
|
||||||
@@ -834,7 +834,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (_currentIndex==_wonIndex)
|
else if (_currentIndex==_wonIndex)
|
||||||
{
|
{
|
||||||
@@ -851,7 +851,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (_currentIndex==_gameIndex)
|
else if (_currentIndex==_gameIndex)
|
||||||
{
|
{
|
||||||
@@ -888,7 +888,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
for(unsigned int i=0;i<_numberOfPlayers;++i)
|
for(unsigned int i=0;i<_numberOfPlayers;++i)
|
||||||
{
|
{
|
||||||
bool inBasket = ((*itr)->centerInside(_players[i].getCurrentCenterOfBasket(),_players[i].getCurrentRadiusOfBasket()));
|
bool inBasket = ((*itr)->centerInside(_players[i].getCurrentCenterOfBasket(),_players[i].getCurrentRadiusOfBasket()));
|
||||||
|
|
||||||
if ((*itr)->dangerous())
|
if ((*itr)->dangerous())
|
||||||
{
|
{
|
||||||
if ((*itr)->anyInside(_players[i].getLowerLeft(),_players[i].getUpperRight()) || inBasket)
|
if ((*itr)->anyInside(_players[i].getLowerLeft(),_players[i].getUpperRight()) || inBasket)
|
||||||
@@ -912,7 +912,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
{
|
{
|
||||||
// player has caught a safe object.
|
// player has caught a safe object.
|
||||||
updateScoreWithCatch();
|
updateScoreWithCatch();
|
||||||
|
|
||||||
if (!_players[i].addCatch())
|
if (!_players[i].addCatch())
|
||||||
{
|
{
|
||||||
_players[i].resetCatches();
|
_players[i].resetCatches();
|
||||||
@@ -930,7 +930,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(*itr)->anyInside(_origin, _origin+_width+_height) ||
|
if (!(*itr)->anyInside(_origin, _origin+_width+_height) ||
|
||||||
(*itr)->needToRemove(ea.getTime()) ||
|
(*itr)->needToRemove(ea.getTime()) ||
|
||||||
removeEntry)
|
removeEntry)
|
||||||
{
|
{
|
||||||
@@ -968,7 +968,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
float numDropsPerSecond = _initialNumDropsPerSecond * (_level+1);
|
float numDropsPerSecond = _initialNumDropsPerSecond * (_level+1);
|
||||||
float r = (float)rand()/(float)RAND_MAX;
|
float r = (float)rand()/(float)RAND_MAX;
|
||||||
if (r < deltaTime*numDropsPerSecond)
|
if (r < deltaTime*numDropsPerSecond)
|
||||||
{
|
{
|
||||||
createNewCatchable();
|
createNewCatchable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1015,7 +1015,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameEventHandler::getUsage(osg::ApplicationUsage&) const
|
void GameEventHandler::getUsage(osg::ApplicationUsage&) const
|
||||||
@@ -1026,9 +1026,9 @@ osg::Matrix GameEventHandler::getCameraPosition()
|
|||||||
{
|
{
|
||||||
osg::Matrix cameraPosition;
|
osg::Matrix cameraPosition;
|
||||||
osg::Vec3 center = _origin+(_width+_height)*0.5f;
|
osg::Vec3 center = _origin+(_width+_height)*0.5f;
|
||||||
|
|
||||||
float distance = _height.length()/(2.0f*tanf(_fovy*0.5f));
|
float distance = _height.length()/(2.0f*tanf(_fovy*0.5f));
|
||||||
|
|
||||||
cameraPosition.makeLookAt(center-osg::Vec3(0.0f,distance,0.0f),center,osg::Vec3(0.0f,0.0f,1.0f));
|
cameraPosition.makeLookAt(center-osg::Vec3(0.0f,distance,0.0f),center,osg::Vec3(0.0f,0.0f,1.0f));
|
||||||
return cameraPosition;
|
return cameraPosition;
|
||||||
}
|
}
|
||||||
@@ -1036,8 +1036,8 @@ osg::Matrix GameEventHandler::getCameraPosition()
|
|||||||
osg::Node* GameEventHandler::createScene()
|
osg::Node* GameEventHandler::createScene()
|
||||||
{
|
{
|
||||||
_gameSwitch = new osg::Switch;
|
_gameSwitch = new osg::Switch;
|
||||||
|
|
||||||
// create a dummy catchable to load all the particule textures to reduce
|
// create a dummy catchable to load all the particule textures to reduce
|
||||||
// latency later on..
|
// latency later on..
|
||||||
_dummyCatchable = new CatchableObject;
|
_dummyCatchable = new CatchableObject;
|
||||||
_dummyCatchable->setObject("Catch/a.png","a",osg::Vec3(0.0f,0.0,0.0f),1.0f,osg::Vec3(0.0f,0.0,0.0f));
|
_dummyCatchable->setObject("Catch/a.png","a",osg::Vec3(0.0f,0.0,0.0f),1.0f,osg::Vec3(0.0f,0.0,0.0f));
|
||||||
@@ -1045,10 +1045,10 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
// set up welcome subgraph
|
// set up welcome subgraph
|
||||||
{
|
{
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
||||||
|
|
||||||
// set up the background
|
// set up the background
|
||||||
osg::Image* image = osgDB::readImageFile("Catch/Welcome.jpg");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Catch/Welcome.jpg");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
||||||
@@ -1057,7 +1057,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
geode->addDrawable(geometry);
|
geode->addDrawable(geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up the text
|
// set up the text
|
||||||
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.8f -osg::Vec3(0.0f,0.1f,0.0f);
|
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.8f -osg::Vec3(0.0f,0.1f,0.0f);
|
||||||
{
|
{
|
||||||
@@ -1072,7 +1072,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
geode->addDrawable(text);
|
geode->addDrawable(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
textPosition -= _height*0.25f;
|
textPosition -= _height*0.25f;
|
||||||
osgText::Text* text = new osgText::Text;
|
osgText::Text* text = new osgText::Text;
|
||||||
@@ -1121,9 +1121,9 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
// set up you've lost subgraph
|
// set up you've lost subgraph
|
||||||
{
|
{
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile("Catch/YouLost.jpg");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Catch/YouLost.jpg");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
||||||
@@ -1132,7 +1132,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
geode->addDrawable(geometry);
|
geode->addDrawable(geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up the text
|
// set up the text
|
||||||
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.75f -osg::Vec3(0.0f,0.1f,0.0f);
|
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.75f -osg::Vec3(0.0f,0.1f,0.0f);
|
||||||
{
|
{
|
||||||
@@ -1147,7 +1147,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
geode->addDrawable(text);
|
geode->addDrawable(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
textPosition -= _height*0.25f;
|
textPosition -= _height*0.25f;
|
||||||
osgText::Text* text = new osgText::Text;
|
osgText::Text* text = new osgText::Text;
|
||||||
@@ -1184,9 +1184,9 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
// set up you've won subgraph
|
// set up you've won subgraph
|
||||||
{
|
{
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile("Catch/YouWon.jpg");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Catch/YouWon.jpg");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
||||||
@@ -1195,7 +1195,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
geode->addDrawable(geometry);
|
geode->addDrawable(geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up the text
|
// set up the text
|
||||||
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.75f -osg::Vec3(0.0f,0.1f,0.0f);
|
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.75f -osg::Vec3(0.0f,0.1f,0.0f);
|
||||||
{
|
{
|
||||||
@@ -1210,7 +1210,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
geode->addDrawable(text);
|
geode->addDrawable(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
textPosition -= _height*0.25f;
|
textPosition -= _height*0.25f;
|
||||||
osgText::Text* text = new osgText::Text;
|
osgText::Text* text = new osgText::Text;
|
||||||
@@ -1258,7 +1258,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
_gameGroup->addChild(_players[i]._character.get());
|
_gameGroup->addChild(_players[i]._character.get());
|
||||||
_gameGroup->addChild(_players[i]._livesSwitch.get());
|
_gameGroup->addChild(_players[i]._livesSwitch.get());
|
||||||
_gameGroup->addChild(_players[i]._catchSwitch.get());
|
_gameGroup->addChild(_players[i]._catchSwitch.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// background
|
// background
|
||||||
{
|
{
|
||||||
@@ -1269,7 +1269,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile(*itr);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(*itr);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
|
||||||
@@ -1305,7 +1305,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
geode->addDrawable(text);
|
geode->addDrawable(text);
|
||||||
_scoreTextList.push_back(text);
|
_scoreTextList.push_back(text);
|
||||||
|
|
||||||
textPosition -= _height*0.05f;
|
textPosition -= _height*0.05f;
|
||||||
_levelText = new osgText::Text;
|
_levelText = new osgText::Text;
|
||||||
_levelText->setText("Level : 0");
|
_levelText->setText("Level : 0");
|
||||||
@@ -1317,7 +1317,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
_levelText->setAxisAlignment(osgText::Text::XZ_PLANE);
|
_levelText->setAxisAlignment(osgText::Text::XZ_PLANE);
|
||||||
|
|
||||||
geode->addDrawable(_levelText.get());
|
geode->addDrawable(_levelText.get());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_gameGroup->addChild(geode);
|
_gameGroup->addChild(geode);
|
||||||
@@ -1325,7 +1325,7 @@ osg::Node* GameEventHandler::createScene()
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentIndex = _welcomeIndex;
|
_currentIndex = _welcomeIndex;
|
||||||
_gameSwitch->setSingleChildOn(_currentIndex);
|
_gameSwitch->setSingleChildOn(_currentIndex);
|
||||||
|
|
||||||
@@ -1338,7 +1338,7 @@ void GameEventHandler::createNewCatchable()
|
|||||||
|
|
||||||
unsigned int catachableIndex = (unsigned int)((float)_benignCatachables.size()*(float)rand()/(float)RAND_MAX);
|
unsigned int catachableIndex = (unsigned int)((float)_benignCatachables.size()*(float)rand()/(float)RAND_MAX);
|
||||||
if (catachableIndex>=_benignCatachables.size()) catachableIndex = _benignCatachables.size()-1;
|
if (catachableIndex>=_benignCatachables.size()) catachableIndex = _benignCatachables.size()-1;
|
||||||
|
|
||||||
const std::string& filename = _benignCatachables[catachableIndex];
|
const std::string& filename = _benignCatachables[catachableIndex];
|
||||||
|
|
||||||
float ratio = ((float)rand() / (float)RAND_MAX);
|
float ratio = ((float)rand() / (float)RAND_MAX);
|
||||||
@@ -1356,7 +1356,7 @@ void GameEventHandler::createNewCatchable()
|
|||||||
float r = (float)rand() / (float)RAND_MAX;
|
float r = (float)rand() / (float)RAND_MAX;
|
||||||
if (r < _chanceOfExplodingAtStart)
|
if (r < _chanceOfExplodingAtStart)
|
||||||
{
|
{
|
||||||
catchableObject->explode();
|
catchableObject->explode();
|
||||||
}
|
}
|
||||||
|
|
||||||
_gameGroup->addChild(catchableObject->_object.get());
|
_gameGroup->addChild(catchableObject->_object.get());
|
||||||
@@ -1366,9 +1366,10 @@ class CompileStateCallback : public osg::Operation
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CompileStateCallback(GameEventHandler* eh):
|
CompileStateCallback(GameEventHandler* eh):
|
||||||
|
osg::Referenced(true),
|
||||||
osg::Operation("CompileStateCallback", false),
|
osg::Operation("CompileStateCallback", false),
|
||||||
_gameEventHandler(eh) {}
|
_gameEventHandler(eh) {}
|
||||||
|
|
||||||
virtual void operator () (osg::Object* object)
|
virtual void operator () (osg::Object* object)
|
||||||
{
|
{
|
||||||
osg::GraphicsContext* context = dynamic_cast<osg::GraphicsContext*>(object);
|
osg::GraphicsContext* context = dynamic_cast<osg::GraphicsContext*>(object);
|
||||||
@@ -1379,7 +1380,7 @@ class CompileStateCallback : public osg::Operation
|
|||||||
_gameEventHandler->compileGLObjects(*(context->getState()));
|
_gameEventHandler->compileGLObjects(*(context->getState()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenThreads::Mutex _mutex;
|
OpenThreads::Mutex _mutex;
|
||||||
GameEventHandler* _gameEventHandler;
|
GameEventHandler* _gameEventHandler;
|
||||||
};
|
};
|
||||||
@@ -1389,7 +1390,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use node masks to create stereo images.");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use node masks to create stereo images.");
|
||||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file_left_eye image_file_right_eye");
|
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file_left_eye image_file_right_eye");
|
||||||
@@ -1409,8 +1410,8 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
while (arguments.read("--boy")) seh->addPlayer(GameEventHandler::PLAYER_BOY);
|
while (arguments.read("--boy")) seh->addPlayer(GameEventHandler::PLAYER_BOY);
|
||||||
while (arguments.read("--girl")) seh->addPlayer(GameEventHandler::PLAYER_GIRL);
|
while (arguments.read("--girl")) seh->addPlayer(GameEventHandler::PLAYER_GIRL);
|
||||||
|
|
||||||
|
|
||||||
// if user request help write it out to cout.
|
// if user request help write it out to cout.
|
||||||
if (arguments.read("-h") || arguments.read("--help"))
|
if (arguments.read("-h") || arguments.read("--help"))
|
||||||
{
|
{
|
||||||
@@ -1427,8 +1428,8 @@ int main( int argc, char **argv )
|
|||||||
arguments.writeErrorMessages(std::cout);
|
arguments.writeErrorMessages(std::cout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// enable the image cache so we don't need to keep loading the particle files
|
// enable the image cache so we don't need to keep loading the particle files
|
||||||
osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options;
|
osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options;
|
||||||
options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_IMAGES);
|
options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_IMAGES);
|
||||||
@@ -1453,7 +1454,7 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
double fovy, aspectRatio, zNear, zFar;
|
double fovy, aspectRatio, zNear, zFar;
|
||||||
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar);
|
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar);
|
||||||
seh->setFOVY(osg::DegreesToRadians(fovy));
|
seh->setFOVY(osg::DegreesToRadians(fovy));
|
||||||
|
|
||||||
// todo for osgViewer - create default set up.
|
// todo for osgViewer - create default set up.
|
||||||
viewer.setUpViewAcrossAllScreens();
|
viewer.setUpViewAcrossAllScreens();
|
||||||
@@ -1471,7 +1472,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// todo for osgViewer - implement warp pointer that can be done relative to different coordinate frames
|
// todo for osgViewer - implement warp pointer that can be done relative to different coordinate frames
|
||||||
// viewer.requestWarpPointer(0.5f,0.5f);
|
// viewer.requestWarpPointer(0.5f,0.5f);
|
||||||
|
|
||||||
while( !viewer.done() )
|
while( !viewer.done() )
|
||||||
{
|
{
|
||||||
@@ -1479,8 +1480,8 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
// fire off the cull and draw traversals of the scene.
|
// fire off the cull and draw traversals of the scene.
|
||||||
viewer.frame();
|
viewer.frame();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,10 +40,9 @@
|
|||||||
#include <osgUtil/Optimizer>
|
#include <osgUtil/Optimizer>
|
||||||
|
|
||||||
|
|
||||||
osg::Node* decorate_with_clip_node(osg::Node* subgraph)
|
osg::ref_ptr<osg::Node> decorate_with_clip_node(const osg::ref_ptr<osg::Node>& subgraph)
|
||||||
{
|
{
|
||||||
osg::Group* rootnode = new osg::Group;
|
osg::ref_ptr<osg::Group> rootnode = new osg::Group;
|
||||||
|
|
||||||
|
|
||||||
// create wireframe view of the model so the user can see
|
// create wireframe view of the model so the user can see
|
||||||
// what parts are being culled away.
|
// what parts are being culled away.
|
||||||
@@ -52,14 +51,14 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
|
|||||||
osg::PolygonMode* polymode = new osg::PolygonMode;
|
osg::PolygonMode* polymode = new osg::PolygonMode;
|
||||||
polymode->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE);
|
polymode->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE);
|
||||||
stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
||||||
|
|
||||||
osg::Group* wireframe_subgraph = new osg::Group;
|
osg::Group* wireframe_subgraph = new osg::Group;
|
||||||
wireframe_subgraph->setStateSet(stateset);
|
wireframe_subgraph->setStateSet(stateset);
|
||||||
wireframe_subgraph->addChild(subgraph);
|
wireframe_subgraph->addChild(subgraph);
|
||||||
rootnode->addChild(wireframe_subgraph);
|
rootnode->addChild(wireframe_subgraph);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// simple approach to adding a clipnode above a subrgaph.
|
// simple approach to adding a clipnode above a subgraph.
|
||||||
|
|
||||||
// create clipped part.
|
// create clipped part.
|
||||||
osg::ClipNode* clipped_subgraph = new osg::ClipNode;
|
osg::ClipNode* clipped_subgraph = new osg::ClipNode;
|
||||||
@@ -78,9 +77,9 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
|
|||||||
|
|
||||||
|
|
||||||
// more complex approach to managing ClipNode, allowing
|
// more complex approach to managing ClipNode, allowing
|
||||||
// ClipNode node to be transformed independantly from the subgraph
|
// ClipNode node to be transformed independently from the subgraph
|
||||||
// that it is clipping.
|
// that it is clipping.
|
||||||
|
|
||||||
osg::MatrixTransform* transform= new osg::MatrixTransform;
|
osg::MatrixTransform* transform= new osg::MatrixTransform;
|
||||||
|
|
||||||
osg::NodeCallback* nc = new osg::AnimationPathCallback(subgraph->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
osg::NodeCallback* nc = new osg::AnimationPathCallback(subgraph->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||||
@@ -117,28 +116,28 @@ int main( int argc, char **argv )
|
|||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("cow.osgt");
|
||||||
|
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Please specifiy a filename and the command line"<<std::endl;
|
osg::notify(osg::NOTICE)<<"Please specify a filename on the command line"<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// decorate the scenegraph with a clip node.
|
// decorate the scenegraph with a clip node.
|
||||||
osg::Node* rootnode = decorate_with_clip_node(loadedModel);
|
osg::ref_ptr<osg::Node> rootnode = decorate_with_clip_node(loadedModel);
|
||||||
|
|
||||||
// run optimization over the scene graph
|
// run optimization over the scene graph
|
||||||
osgUtil::Optimizer optimzer;
|
osgUtil::Optimizer optimzer;
|
||||||
optimzer.optimize(rootnode);
|
optimzer.optimize(rootnode);
|
||||||
|
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
// set the scene to render
|
// set the scene to render
|
||||||
viewer.setSceneData(rootnode);
|
viewer.setSceneData(rootnode);
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,8 @@
|
|||||||
#include <net/soioctl.h>
|
#include <net/soioctl.h>
|
||||||
#elif defined(__CYGWIN__)
|
#elif defined(__CYGWIN__)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#elif defined (__GNU__)
|
||||||
|
#include <unistd.h>
|
||||||
#elif defined(__sun)
|
#elif defined(__sun)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
|
|||||||
@@ -44,17 +44,16 @@
|
|||||||
#include "broadcaster.h"
|
#include "broadcaster.h"
|
||||||
|
|
||||||
|
|
||||||
const unsigned int MAX_NUM_EVENTS = 10;
|
|
||||||
const unsigned int SWAP_BYTES_COMPARE = 0x12345678;
|
const unsigned int SWAP_BYTES_COMPARE = 0x12345678;
|
||||||
class CameraPacket {
|
class CameraPacket {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
CameraPacket():_masterKilled(false)
|
CameraPacket():_masterKilled(false)
|
||||||
{
|
{
|
||||||
_byte_order = SWAP_BYTES_COMPARE;
|
_byte_order = SWAP_BYTES_COMPARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp)
|
void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp)
|
||||||
{
|
{
|
||||||
_matrix = matrix;
|
_matrix = matrix;
|
||||||
@@ -63,20 +62,20 @@ class CameraPacket {
|
|||||||
_frameStamp = *frameStamp;
|
_frameStamp = *frameStamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void getModelView(osg::Matrix& matrix,float angle_offset=0.0f)
|
void getModelView(osg::Matrix& matrix,float angle_offset=0.0f)
|
||||||
{
|
{
|
||||||
|
|
||||||
matrix = _matrix * osg::Matrix::rotate(osg::DegreesToRadians(angle_offset),0.0f,1.0f,0.0f);
|
matrix = _matrix * osg::Matrix::rotate(osg::DegreesToRadians(angle_offset),0.0f,1.0f,0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void readEventQueue(osgViewer::Viewer& viewer);
|
void readEventQueue(osgViewer::Viewer& viewer);
|
||||||
|
|
||||||
void writeEventQueue(osgViewer::Viewer& viewer);
|
void writeEventQueue(osgViewer::Viewer& viewer);
|
||||||
|
|
||||||
void setMasterKilled(const bool flag) { _masterKilled = flag; }
|
void setMasterKilled(const bool flag) { _masterKilled = flag; }
|
||||||
const bool getMasterKilled() const { return _masterKilled; }
|
const bool getMasterKilled() const { return _masterKilled; }
|
||||||
|
|
||||||
unsigned int _byte_order;
|
unsigned int _byte_order;
|
||||||
bool _masterKilled;
|
bool _masterKilled;
|
||||||
osg::Matrix _matrix;
|
osg::Matrix _matrix;
|
||||||
@@ -84,11 +83,11 @@ class CameraPacket {
|
|||||||
// note don't use a ref_ptr as used elsewhere for FrameStamp
|
// note don't use a ref_ptr as used elsewhere for FrameStamp
|
||||||
// since we don't want to copy the pointer - but the memory.
|
// since we don't want to copy the pointer - but the memory.
|
||||||
// FrameStamp doesn't have a private destructor to allow
|
// FrameStamp doesn't have a private destructor to allow
|
||||||
// us to do this, even though its a reference counted object.
|
// us to do this, even though its a reference counted object.
|
||||||
osg::FrameStamp _frameStamp;
|
osg::FrameStamp _frameStamp;
|
||||||
|
|
||||||
osgGA::EventQueue::Events _events;
|
osgGA::EventQueue::Events _events;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DataConverter
|
class DataConverter
|
||||||
@@ -112,7 +111,7 @@ class DataConverter
|
|||||||
bool _swapBytes;
|
bool _swapBytes;
|
||||||
|
|
||||||
char* _currentPtr;
|
char* _currentPtr;
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
_currentPtr = _startPtr;
|
_currentPtr = _startPtr;
|
||||||
@@ -122,22 +121,22 @@ class DataConverter
|
|||||||
{
|
{
|
||||||
if (_currentPtr+1>=_endPtr) return;
|
if (_currentPtr+1>=_endPtr) return;
|
||||||
|
|
||||||
*(_currentPtr++) = *(ptr);
|
*(_currentPtr++) = *(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void read1(char* ptr)
|
inline void read1(char* ptr)
|
||||||
{
|
{
|
||||||
if (_currentPtr+1>=_endPtr) return;
|
if (_currentPtr+1>=_endPtr) return;
|
||||||
|
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void write2(char* ptr)
|
inline void write2(char* ptr)
|
||||||
{
|
{
|
||||||
if (_currentPtr+2>=_endPtr) return;
|
if (_currentPtr+2>=_endPtr) return;
|
||||||
|
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr);
|
*(_currentPtr++) = *(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void read2(char* ptr)
|
inline void read2(char* ptr)
|
||||||
@@ -146,13 +145,13 @@ class DataConverter
|
|||||||
|
|
||||||
if (_swapBytes)
|
if (_swapBytes)
|
||||||
{
|
{
|
||||||
*(ptr+1) = *(_currentPtr++);
|
*(ptr+1) = *(_currentPtr++);
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,10 +159,10 @@ class DataConverter
|
|||||||
{
|
{
|
||||||
if (_currentPtr+4>=_endPtr) return;
|
if (_currentPtr+4>=_endPtr) return;
|
||||||
|
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr);
|
*(_currentPtr++) = *(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void read4(char* ptr)
|
inline void read4(char* ptr)
|
||||||
@@ -172,17 +171,17 @@ class DataConverter
|
|||||||
|
|
||||||
if (_swapBytes)
|
if (_swapBytes)
|
||||||
{
|
{
|
||||||
*(ptr+3) = *(_currentPtr++);
|
*(ptr+3) = *(_currentPtr++);
|
||||||
*(ptr+2) = *(_currentPtr++);
|
*(ptr+2) = *(_currentPtr++);
|
||||||
*(ptr+1) = *(_currentPtr++);
|
*(ptr+1) = *(_currentPtr++);
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,15 +189,15 @@ class DataConverter
|
|||||||
{
|
{
|
||||||
if (_currentPtr+8>=_endPtr) return;
|
if (_currentPtr+8>=_endPtr) return;
|
||||||
|
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
|
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr++);
|
*(_currentPtr++) = *(ptr++);
|
||||||
*(_currentPtr++) = *(ptr);
|
*(_currentPtr++) = *(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void read8(char* ptr)
|
inline void read8(char* ptr)
|
||||||
@@ -208,27 +207,27 @@ class DataConverter
|
|||||||
|
|
||||||
if (_swapBytes)
|
if (_swapBytes)
|
||||||
{
|
{
|
||||||
*(ptr+7) = *(_currentPtr++);
|
*(ptr+7) = *(_currentPtr++);
|
||||||
*(ptr+6) = *(_currentPtr++);
|
*(ptr+6) = *(_currentPtr++);
|
||||||
*(ptr+5) = *(_currentPtr++);
|
*(ptr+5) = *(_currentPtr++);
|
||||||
*(ptr+4) = *(_currentPtr++);
|
*(ptr+4) = *(_currentPtr++);
|
||||||
|
|
||||||
*(ptr+3) = *(_currentPtr++);
|
*(ptr+3) = *(_currentPtr++);
|
||||||
*(ptr+2) = *(_currentPtr++);
|
*(ptr+2) = *(_currentPtr++);
|
||||||
*(ptr+1) = *(_currentPtr++);
|
*(ptr+1) = *(_currentPtr++);
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
|
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr++) = *(_currentPtr++);
|
*(ptr++) = *(_currentPtr++);
|
||||||
*(ptr) = *(_currentPtr++);
|
*(ptr) = *(_currentPtr++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,14 +240,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; read1(&c); return c; }
|
inline char readChar() { char c=0; read1(&c); return c; }
|
||||||
inline unsigned char readUChar() { unsigned char c; read1((char*)&c); return c; }
|
inline unsigned char readUChar() { unsigned char c=0; read1((char*)&c); return c; }
|
||||||
inline short readShort() { short c; read2((char*)&c); return c; }
|
inline short readShort() { short c=0; read2((char*)&c); return c; }
|
||||||
inline unsigned short readUShort() { unsigned short c; read2((char*)&c); return c; }
|
inline unsigned short readUShort() { unsigned short c=0; read2((char*)&c); return c; }
|
||||||
inline int readInt() { int c; read4((char*)&c); return c; }
|
inline int readInt() { int c=0; read4((char*)&c); return c; }
|
||||||
inline unsigned int readUInt() { unsigned int c; read4((char*)&c); return c; }
|
inline unsigned int readUInt() { unsigned int c=0; read4((char*)&c); return c; }
|
||||||
inline float readFloat() { float c; read4((char*)&c); return c; }
|
inline float readFloat() { float c=0.0f; read4((char*)&c); return c; }
|
||||||
inline double readDouble() { double c; read8((char*)&c); return c; }
|
inline double readDouble() { double c=0.0; read8((char*)&c); return c; }
|
||||||
|
|
||||||
void write(const osg::FrameStamp& fs)
|
void write(const osg::FrameStamp& fs)
|
||||||
{
|
{
|
||||||
@@ -361,22 +360,23 @@ class DataConverter
|
|||||||
event.setModKeyMask(readUInt());
|
event.setModKeyMask(readUInt());
|
||||||
event.setTime(readDouble());
|
event.setTime(readDouble());
|
||||||
}
|
}
|
||||||
|
|
||||||
void write(CameraPacket& cameraPacket)
|
void write(CameraPacket& cameraPacket)
|
||||||
{
|
{
|
||||||
writeUInt(cameraPacket._byte_order);
|
writeUInt(cameraPacket._byte_order);
|
||||||
|
|
||||||
writeUInt(cameraPacket._masterKilled);
|
writeUInt(cameraPacket._masterKilled);
|
||||||
|
|
||||||
write(cameraPacket._matrix);
|
write(cameraPacket._matrix);
|
||||||
write(cameraPacket._frameStamp);
|
write(cameraPacket._frameStamp);
|
||||||
|
|
||||||
writeUInt(cameraPacket._events.size());
|
writeUInt(cameraPacket._events.size());
|
||||||
for(osgGA::EventQueue::Events::iterator itr = cameraPacket._events.begin();
|
for(osgGA::EventQueue::Events::iterator itr = cameraPacket._events.begin();
|
||||||
itr != cameraPacket._events.end();
|
itr != cameraPacket._events.end();
|
||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
write(*(*itr));
|
osgGA::GUIEventAdapter* event = (*itr)->asGUIEventAdapter();
|
||||||
|
if (event) write(*event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,12 +387,12 @@ class DataConverter
|
|||||||
{
|
{
|
||||||
_swapBytes = !_swapBytes;
|
_swapBytes = !_swapBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
cameraPacket._masterKilled = readUInt()!=0;
|
cameraPacket._masterKilled = readUInt()!=0;
|
||||||
|
|
||||||
read(cameraPacket._matrix);
|
read(cameraPacket._matrix);
|
||||||
read(cameraPacket._frameStamp);
|
read(cameraPacket._frameStamp);
|
||||||
|
|
||||||
cameraPacket._events.clear();
|
cameraPacket._events.clear();
|
||||||
unsigned int numEvents = readUInt();
|
unsigned int numEvents = readUInt();
|
||||||
for(unsigned int i=0;i<numEvents;++i)
|
for(unsigned int i=0;i<numEvents;++i)
|
||||||
@@ -409,7 +409,7 @@ void CameraPacket::readEventQueue(osgViewer::Viewer& viewer)
|
|||||||
_events.clear();
|
_events.clear();
|
||||||
|
|
||||||
osgViewer::ViewerBase::Contexts contexts;
|
osgViewer::ViewerBase::Contexts contexts;
|
||||||
viewer.getContexts(contexts);
|
viewer.getContexts(contexts);
|
||||||
|
|
||||||
for(osgViewer::ViewerBase::Contexts::iterator citr =contexts.begin(); citr != contexts.end(); ++citr)
|
for(osgViewer::ViewerBase::Contexts::iterator citr =contexts.begin(); citr != contexts.end(); ++citr)
|
||||||
{
|
{
|
||||||
@@ -423,7 +423,7 @@ void CameraPacket::readEventQueue(osgViewer::Viewer& viewer)
|
|||||||
}
|
}
|
||||||
_events.insert(_events.end(), gw_events.begin(), gw_events.end());
|
_events.insert(_events.end(), gw_events.begin(), gw_events.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer.getEventQueue()->copyEvents(_events);
|
viewer.getEventQueue()->copyEvents(_events);
|
||||||
|
|
||||||
osg::notify(osg::INFO)<<"written events = "<<_events.size()<<std::endl;
|
osg::notify(osg::INFO)<<"written events = "<<_events.size()<<std::endl;
|
||||||
@@ -449,7 +449,7 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates how to approach implementation of clustering.");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates how to approach implementation of clustering.");
|
||||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
||||||
@@ -459,7 +459,7 @@ int main( int argc, char **argv )
|
|||||||
arguments.getApplicationUsage()->addCommandLineOption("-n <int>","Socket number to transmit packets");
|
arguments.getApplicationUsage()->addCommandLineOption("-n <int>","Socket number to transmit packets");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-f <float>","Field of view of camera");
|
arguments.getApplicationUsage()->addCommandLineOption("-f <float>","Field of view of camera");
|
||||||
arguments.getApplicationUsage()->addCommandLineOption("-o <float>","Offset angle of camera");
|
arguments.getApplicationUsage()->addCommandLineOption("-o <float>","Offset angle of camera");
|
||||||
|
|
||||||
// construct the viewer.
|
// construct the viewer.
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
@@ -468,12 +468,12 @@ int main( int argc, char **argv )
|
|||||||
ViewerMode viewerMode = STAND_ALONE;
|
ViewerMode viewerMode = STAND_ALONE;
|
||||||
while (arguments.read("-m")) viewerMode = MASTER;
|
while (arguments.read("-m")) viewerMode = MASTER;
|
||||||
while (arguments.read("-s")) viewerMode = SLAVE;
|
while (arguments.read("-s")) viewerMode = SLAVE;
|
||||||
|
|
||||||
int socketNumber=8100;
|
int socketNumber=8100;
|
||||||
while (arguments.read("-n",socketNumber)) ;
|
while (arguments.read("-n",socketNumber)) ;
|
||||||
|
|
||||||
float camera_fov=-1.0f;
|
float camera_fov=-1.0f;
|
||||||
while (arguments.read("-f",camera_fov))
|
while (arguments.read("-f",camera_fov))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,7 +497,7 @@ int main( int argc, char **argv )
|
|||||||
arguments.writeErrorMessages(std::cout);
|
arguments.writeErrorMessages(std::cout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arguments.argc()<=1)
|
if (arguments.argc()<=1)
|
||||||
{
|
{
|
||||||
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
||||||
@@ -505,7 +505,7 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load model.
|
// load model.
|
||||||
osg::ref_ptr<osg::Node> rootnode = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> rootnode = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// set the scene to render
|
// set the scene to render
|
||||||
viewer.setSceneData(rootnode.get());
|
viewer.setSceneData(rootnode.get());
|
||||||
@@ -514,13 +514,13 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
double fovy, aspectRatio, zNear, zFar;
|
double fovy, aspectRatio, zNear, zFar;
|
||||||
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
|
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
|
||||||
|
|
||||||
double original_fov = atan(tan(osg::DegreesToRadians(fovy)*0.5)*aspectRatio)*2.0;
|
double original_fov = atan(tan(osg::DegreesToRadians(fovy)*0.5)*aspectRatio)*2.0;
|
||||||
std::cout << "setting lens perspective : original "<<original_fov<<" "<<fovy<<std::endl;
|
std::cout << "setting lens perspective : original "<<original_fov<<" "<<fovy<<std::endl;
|
||||||
|
|
||||||
fovy = atan(tan(osg::DegreesToRadians(camera_fov)*0.5)/aspectRatio)*2.0;
|
fovy = atan(tan(osg::DegreesToRadians(camera_fov)*0.5)/aspectRatio)*2.0;
|
||||||
viewer.getCamera()->setProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
|
viewer.getCamera()->setProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
|
||||||
|
|
||||||
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
|
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
|
||||||
original_fov = atan(tan(osg::DegreesToRadians(fovy)*0.5)*aspectRatio)*2.0;
|
original_fov = atan(tan(osg::DegreesToRadians(fovy)*0.5)*aspectRatio)*2.0;
|
||||||
std::cout << "setting lens perspective : new "<<original_fov<<" "<<fovy<<std::endl;
|
std::cout << "setting lens perspective : new "<<original_fov<<" "<<fovy<<std::endl;
|
||||||
@@ -549,13 +549,13 @@ int main( int argc, char **argv )
|
|||||||
rc.setPort(static_cast<short int>(socketNumber));
|
rc.setPort(static_cast<short int>(socketNumber));
|
||||||
|
|
||||||
bool masterKilled = false;
|
bool masterKilled = false;
|
||||||
|
|
||||||
DataConverter scratchPad(1024);
|
DataConverter scratchPad(1024);
|
||||||
|
|
||||||
while( !viewer.done() && !masterKilled )
|
while( !viewer.done() && !masterKilled )
|
||||||
{
|
{
|
||||||
osg::Timer_t startTick = osg::Timer::instance()->tick();
|
osg::Timer_t startTick = osg::Timer::instance()->tick();
|
||||||
|
|
||||||
viewer.advance();
|
viewer.advance();
|
||||||
|
|
||||||
// special handling for working as a cluster.
|
// special handling for working as a cluster.
|
||||||
@@ -563,12 +563,12 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
case(MASTER):
|
case(MASTER):
|
||||||
{
|
{
|
||||||
|
|
||||||
// take camera zero as the guide.
|
// take camera zero as the guide.
|
||||||
osg::Matrix modelview(viewer.getCamera()->getViewMatrix());
|
osg::Matrix modelview(viewer.getCamera()->getViewMatrix());
|
||||||
|
|
||||||
cp->setPacket(modelview,viewer.getFrameStamp());
|
cp->setPacket(modelview,viewer.getFrameStamp());
|
||||||
|
|
||||||
cp->readEventQueue(viewer);
|
cp->readEventQueue(viewer);
|
||||||
|
|
||||||
scratchPad.reset();
|
scratchPad.reset();
|
||||||
@@ -578,11 +578,11 @@ int main( int argc, char **argv )
|
|||||||
scratchPad.read(*cp);
|
scratchPad.read(*cp);
|
||||||
|
|
||||||
bc.setBuffer(scratchPad._startPtr, scratchPad._numBytes);
|
bc.setBuffer(scratchPad._startPtr, scratchPad._numBytes);
|
||||||
|
|
||||||
std::cout << "bc.sync()"<<scratchPad._numBytes<<std::endl;
|
std::cout << "bc.sync()"<<scratchPad._numBytes<<std::endl;
|
||||||
|
|
||||||
bc.sync();
|
bc.sync();
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case(SLAVE):
|
case(SLAVE):
|
||||||
@@ -591,13 +591,13 @@ int main( int argc, char **argv )
|
|||||||
rc.setBuffer(scratchPad._startPtr, scratchPad._numBytes);
|
rc.setBuffer(scratchPad._startPtr, scratchPad._numBytes);
|
||||||
|
|
||||||
rc.sync();
|
rc.sync();
|
||||||
|
|
||||||
scratchPad.reset();
|
scratchPad.reset();
|
||||||
scratchPad.read(*cp);
|
scratchPad.read(*cp);
|
||||||
|
|
||||||
cp->writeEventQueue(viewer);
|
cp->writeEventQueue(viewer);
|
||||||
|
|
||||||
if (cp->getMasterKilled())
|
if (cp->getMasterKilled())
|
||||||
{
|
{
|
||||||
std::cout << "Received master killed."<<std::endl;
|
std::cout << "Received master killed."<<std::endl;
|
||||||
// break out of while (!done) loop since we've now want to shut down.
|
// break out of while (!done) loop since we've now want to shut down.
|
||||||
@@ -609,12 +609,12 @@ int main( int argc, char **argv )
|
|||||||
// no need to anything here, just a normal interactive viewer.
|
// no need to anything here, just a normal interactive viewer.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Timer_t endTick = osg::Timer::instance()->tick();
|
osg::Timer_t endTick = osg::Timer::instance()->tick();
|
||||||
|
|
||||||
osg::notify(osg::INFO)<<"Time to do cluster sync "<<osg::Timer::instance()->delta_m(startTick,endTick)<<std::endl;
|
osg::notify(osg::INFO)<<"Time to do cluster sync "<<osg::Timer::instance()->delta_m(startTick,endTick)<<std::endl;
|
||||||
|
|
||||||
// update the scene by traversing it with the the update visitor which will
|
// update the scene by traversing it with the update visitor which will
|
||||||
// call all node update callbacks and animations.
|
// call all node update callbacks and animations.
|
||||||
viewer.eventTraversal();
|
viewer.eventTraversal();
|
||||||
viewer.updateTraversal();
|
viewer.updateTraversal();
|
||||||
@@ -623,14 +623,14 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
osg::Matrix modelview;
|
osg::Matrix modelview;
|
||||||
cp->getModelView(modelview,camera_offset);
|
cp->getModelView(modelview,camera_offset);
|
||||||
|
|
||||||
viewer.getCamera()->setViewMatrix(modelview);
|
viewer.getCamera()->setViewMatrix(modelview);
|
||||||
}
|
}
|
||||||
|
|
||||||
// fire off the cull and draw traversals of the scene.
|
// fire off the cull and draw traversals of the scene.
|
||||||
if(!masterKilled)
|
if(!masterKilled)
|
||||||
viewer.renderingTraversals();
|
viewer.renderingTraversals();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are master clean up by telling all slaves that we're going down.
|
// if we are master clean up by telling all slaves that we're going down.
|
||||||
@@ -638,7 +638,7 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
// need to broadcast my death.
|
// need to broadcast my death.
|
||||||
cp->setPacket(osg::Matrix::identity(),viewer.getFrameStamp());
|
cp->setPacket(osg::Matrix::identity(),viewer.getFrameStamp());
|
||||||
cp->setMasterKilled(true);
|
cp->setMasterKilled(true);
|
||||||
|
|
||||||
scratchPad.reset();
|
scratchPad.reset();
|
||||||
scratchPad.write(*cp);
|
scratchPad.write(*cp);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ void Receiver::sync( void )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ )
|
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || defined(__FreeBSD_kernel__) || defined(__GNU__)
|
||||||
socklen_t size;
|
socklen_t size;
|
||||||
#else
|
#else
|
||||||
int size;
|
int size;
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ int main( int argc, char **argv )
|
|||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> scene = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
if (!scene)
|
if (!scene)
|
||||||
{
|
{
|
||||||
@@ -149,7 +149,7 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
osgViewer::View* view = new osgViewer::View;
|
osgViewer::View* view = new osgViewer::View;
|
||||||
view->setName("Single view");
|
view->setName("Single view");
|
||||||
view->setSceneData(osgDB::readNodeFile("fountain.osgt"));
|
view->setSceneData(osgDB::readRefNodeFile("fountain.osgt"));
|
||||||
|
|
||||||
view->addEventHandler( new osgViewer::StatsHandler );
|
view->addEventHandler( new osgViewer::StatsHandler );
|
||||||
|
|
||||||
@@ -283,7 +283,7 @@ int main( int argc, char **argv )
|
|||||||
view->setName("View three");
|
view->setName("View three");
|
||||||
viewer.addView(view);
|
viewer.addView(view);
|
||||||
|
|
||||||
view->setSceneData(osgDB::readNodeFile("cessnafire.osgt"));
|
view->setSceneData(osgDB::readRefNodeFile("cessnafire.osgt"));
|
||||||
|
|
||||||
view->getCamera()->setName("Cam three");
|
view->getCamera()->setName("Cam three");
|
||||||
view->getCamera()->setProjectionMatrixAsPerspective(30.0, double(traits->width) / double(traits->height/2), 1.0, 1000.0);
|
view->getCamera()->setProjectionMatrixAsPerspective(30.0, double(traits->width) / double(traits->height/2), 1.0, 1000.0);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
static const char* computeSrc = {
|
static const char* computeSrc = {
|
||||||
"#version 430\n"
|
"#version 430\n"
|
||||||
"uniform float osg_FrameTime;\n"
|
"uniform float osg_FrameTime;\n"
|
||||||
"uniform image2D targetTex;\n"
|
"layout (r32f, binding =0) uniform image2D targetTex;\n"
|
||||||
"layout (local_size_x = 16, local_size_y = 16) in;\n"
|
"layout (local_size_x = 16, local_size_y = 16) in;\n"
|
||||||
"void main() {\n"
|
"void main() {\n"
|
||||||
" ivec2 storePos = ivec2(gl_GlobalInvocationID.xy);\n"
|
" ivec2 storePos = ivec2(gl_GlobalInvocationID.xy);\n"
|
||||||
@@ -43,7 +43,7 @@ static const char* computeSrc = {
|
|||||||
int main( int argc, char** argv )
|
int main( int argc, char** argv )
|
||||||
{
|
{
|
||||||
osg::ArgumentParser arguments( &argc, argv );
|
osg::ArgumentParser arguments( &argc, argv );
|
||||||
|
|
||||||
// Create the texture as both the output of compute shader and the input of a normal quad
|
// Create the texture as both the output of compute shader and the input of a normal quad
|
||||||
osg::ref_ptr<osg::Texture2D> tex2D = new osg::Texture2D;
|
osg::ref_ptr<osg::Texture2D> tex2D = new osg::Texture2D;
|
||||||
tex2D->setTextureSize( 512, 512 );
|
tex2D->setTextureSize( 512, 512 );
|
||||||
@@ -53,23 +53,23 @@ int main( int argc, char** argv )
|
|||||||
tex2D->setSourceFormat( GL_RED );
|
tex2D->setSourceFormat( GL_RED );
|
||||||
tex2D->setSourceType( GL_FLOAT );
|
tex2D->setSourceType( GL_FLOAT );
|
||||||
tex2D->bindToImageUnit( 0, osg::Texture::WRITE_ONLY ); // So we can use 'image2D' in the compute shader
|
tex2D->bindToImageUnit( 0, osg::Texture::WRITE_ONLY ); // So we can use 'image2D' in the compute shader
|
||||||
|
|
||||||
// The compute shader can't work with other kinds of shaders
|
// The compute shader can't work with other kinds of shaders
|
||||||
// It also requires the work group numbers. Setting them to 0 will disable the compute shader
|
// It also requires the work group numbers. Setting them to 0 will disable the compute shader
|
||||||
osg::ref_ptr<osg::Program> computeProg = new osg::Program;
|
osg::ref_ptr<osg::Program> computeProg = new osg::Program;
|
||||||
computeProg->setComputeGroups( 512/16, 512/16, 1 );
|
computeProg->setComputeGroups( 512/16, 512/16, 1 );
|
||||||
computeProg->addShader( new osg::Shader(osg::Shader::COMPUTE, computeSrc) );
|
computeProg->addShader( new osg::Shader(osg::Shader::COMPUTE, computeSrc) );
|
||||||
|
|
||||||
// Create a node for outputting to the texture.
|
// Create a node for outputting to the texture.
|
||||||
// It is OK to have just an empty node here, but seems inbuilt uniforms like osg_FrameTime won't work then.
|
// It is OK to have just an empty node here, but seems inbuilt uniforms like osg_FrameTime won't work then.
|
||||||
// TODO: maybe we can have a custom drawable which also will implement glMemoryBarrier?
|
// TODO: maybe we can have a custom drawable which also will implement glMemoryBarrier?
|
||||||
osg::Node* sourceNode = osgDB::readNodeFile("axes.osgt");
|
osg::ref_ptr<osg::Node> sourceNode = osgDB::readRefNodeFile("axes.osgt");
|
||||||
if ( !sourceNode ) sourceNode = new osg::Node;
|
if ( !sourceNode ) sourceNode = new osg::Node;
|
||||||
sourceNode->setDataVariance( osg::Object::DYNAMIC );
|
sourceNode->setDataVariance( osg::Object::DYNAMIC );
|
||||||
sourceNode->getOrCreateStateSet()->setAttributeAndModes( computeProg.get() );
|
sourceNode->getOrCreateStateSet()->setAttributeAndModes( computeProg.get() );
|
||||||
sourceNode->getOrCreateStateSet()->addUniform( new osg::Uniform("targetTex", (int)0) );
|
sourceNode->getOrCreateStateSet()->addUniform( new osg::Uniform("targetTex", (int)0) );
|
||||||
sourceNode->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
|
sourceNode->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
|
||||||
|
|
||||||
// Display the texture on a quad. We will also be able to operate on the data if reading back to CPU side
|
// Display the texture on a quad. We will also be able to operate on the data if reading back to CPU side
|
||||||
osg::Geometry* geom = osg::createTexturedQuadGeometry(
|
osg::Geometry* geom = osg::createTexturedQuadGeometry(
|
||||||
osg::Vec3(), osg::Vec3(1.0f,0.0f,0.0f), osg::Vec3(0.0f,0.0f,1.0f) );
|
osg::Vec3(), osg::Vec3(1.0f,0.0f,0.0f), osg::Vec3(0.0f,0.0f,1.0f) );
|
||||||
@@ -77,12 +77,12 @@ int main( int argc, char** argv )
|
|||||||
quad->addDrawable( geom );
|
quad->addDrawable( geom );
|
||||||
quad->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
|
quad->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
|
||||||
quad->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
|
quad->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
|
||||||
|
|
||||||
// Create the scene graph and start the viewer
|
// Create the scene graph and start the viewer
|
||||||
osg::ref_ptr<osg::Group> scene = new osg::Group;
|
osg::ref_ptr<osg::Group> scene = new osg::Group;
|
||||||
scene->addChild( sourceNode );
|
scene->addChild( sourceNode );
|
||||||
scene->addChild( quad.get() );
|
scene->addChild( quad.get() );
|
||||||
|
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||||
viewer.addEventHandler( new osgViewer::StatsHandler );
|
viewer.addEventHandler( new osgViewer::StatsHandler );
|
||||||
|
|||||||
@@ -33,12 +33,12 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// Customize the CopyOp so that we add our own verbose
|
// Customize the CopyOp so that we add our own verbose
|
||||||
// output of what's being copied.
|
// output of what's being copied.
|
||||||
class MyCopyOp : public osg::CopyOp
|
class MyCopyOp : public osg::CopyOp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
inline MyCopyOp(CopyFlags flags=SHALLOW_COPY):
|
inline MyCopyOp(CopyFlags flags=SHALLOW_COPY):
|
||||||
osg::CopyOp(flags),
|
osg::CopyOp(flags),
|
||||||
_indent(0),
|
_indent(0),
|
||||||
@@ -46,11 +46,11 @@ class MyCopyOp : public osg::CopyOp
|
|||||||
|
|
||||||
inline void moveIn() const { _indent += _step; }
|
inline void moveIn() const { _indent += _step; }
|
||||||
inline void moveOut() const { _indent -= _step; }
|
inline void moveOut() const { _indent -= _step; }
|
||||||
inline void writeIndent() const
|
inline void writeIndent() const
|
||||||
{
|
{
|
||||||
for(int i=0;i<_indent;++i) std::cout << " ";
|
for(int i=0;i<_indent;++i) std::cout << " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual osg::Referenced* operator() (const osg::Referenced* ref) const
|
virtual osg::Referenced* operator() (const osg::Referenced* ref) const
|
||||||
{
|
{
|
||||||
writeIndent(); std::cout << "copying Referenced "<<ref<<std::endl;
|
writeIndent(); std::cout << "copying Referenced "<<ref<<std::endl;
|
||||||
@@ -59,7 +59,7 @@ class MyCopyOp : public osg::CopyOp
|
|||||||
moveOut();
|
moveOut();
|
||||||
return ret_ref;
|
return ret_ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual osg::Object* operator() (const osg::Object* obj) const
|
virtual osg::Object* operator() (const osg::Object* obj) const
|
||||||
{
|
{
|
||||||
writeIndent(); std::cout << "copying Object "<<obj;
|
writeIndent(); std::cout << "copying Object "<<obj;
|
||||||
@@ -70,7 +70,7 @@ class MyCopyOp : public osg::CopyOp
|
|||||||
moveOut();
|
moveOut();
|
||||||
return ret_obj;
|
return ret_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual osg::Node* operator() (const osg::Node* node) const
|
virtual osg::Node* operator() (const osg::Node* node) const
|
||||||
{
|
{
|
||||||
writeIndent(); std::cout << "copying Node "<<node;
|
writeIndent(); std::cout << "copying Node "<<node;
|
||||||
@@ -136,25 +136,25 @@ class MyCopyOp : public osg::CopyOp
|
|||||||
moveOut();
|
moveOut();
|
||||||
return ret_image;
|
return ret_image;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// must be mutable since CopyOp is passed around as const to
|
// must be mutable since CopyOp is passed around as const to
|
||||||
// the various clone/copy constructors.
|
// the various clone/copy constructors.
|
||||||
mutable int _indent;
|
mutable int _indent;
|
||||||
mutable int _step;
|
mutable int _step;
|
||||||
};
|
};
|
||||||
|
|
||||||
// this CopyOp class will preserve the multi-parent structure of the copied
|
// this CopyOp class will preserve the multi-parent structure of the copied
|
||||||
// object, instead of expanding it into a tree. Works with the
|
// object, instead of expanding it into a tree. Works with the
|
||||||
// DEEP_COPY_NODES flag.
|
// DEEP_COPY_NODES flag.
|
||||||
class GraphCopyOp : public osg::CopyOp
|
class GraphCopyOp : public osg::CopyOp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
inline GraphCopyOp(CopyFlags flags=SHALLOW_COPY):
|
inline GraphCopyOp(CopyFlags flags=SHALLOW_COPY):
|
||||||
osg::CopyOp(flags) { _nodeCopyMap.clear();}
|
osg::CopyOp(flags) { _nodeCopyMap.clear();}
|
||||||
|
|
||||||
virtual osg::Node* operator() (const osg::Node* node) const
|
virtual osg::Node* operator() (const osg::Node* node) const
|
||||||
{
|
{
|
||||||
if (node && _flags&DEEP_COPY_NODES)
|
if (node && _flags&DEEP_COPY_NODES)
|
||||||
@@ -180,9 +180,9 @@ class GraphCopyOp : public osg::CopyOp
|
|||||||
else
|
else
|
||||||
return const_cast<osg::Node*>(node);
|
return const_cast<osg::Node*>(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// must be mutable since CopyOp is passed around as const to
|
// must be mutable since CopyOp is passed around as const to
|
||||||
// the various clone/copy constructors.
|
// the various clone/copy constructors.
|
||||||
mutable std::map<const osg::Node*,osg::Node*> _nodeCopyMap;
|
mutable std::map<const osg::Node*,osg::Node*> _nodeCopyMap;
|
||||||
@@ -198,20 +198,20 @@ int main( int argc, char **argv )
|
|||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* rootnode = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> rootnode = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!rootnode)
|
if (!rootnode)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Please specify a model filename on the command line."<<std::endl;
|
osg::notify(osg::NOTICE)<<"Please specify a model filename on the command line."<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// run optimization over the scene graph
|
// run optimization over the scene graph
|
||||||
osgUtil::Optimizer optimzer;
|
osgUtil::Optimizer optimzer;
|
||||||
optimzer.optimize(rootnode);
|
optimzer.optimize(rootnode);
|
||||||
|
|
||||||
// ------------- Start of copy specific code -------------------------------------------------------
|
// ------------- Start of copy specific code -------------------------------------------------------
|
||||||
|
|
||||||
// do a deep copy, using MyCopyOp to reveal whats going on under the good,
|
// do a deep copy, using MyCopyOp to reveal whats going on under the hood,
|
||||||
// in your own code you'd typically just use the basic osg::CopyOp something like
|
// in your own code you'd typically just use the basic osg::CopyOp something like
|
||||||
osg::ref_ptr<osg::Node> mycopy = dynamic_cast<osg::Node*>(rootnode->clone(osg::CopyOp::DEEP_COPY_ALL));
|
osg::ref_ptr<osg::Node> mycopy = dynamic_cast<osg::Node*>(rootnode->clone(osg::CopyOp::DEEP_COPY_ALL));
|
||||||
std::cout << "Doing a deep copy of scene graph"<<std::endl;
|
std::cout << "Doing a deep copy of scene graph"<<std::endl;
|
||||||
@@ -219,7 +219,7 @@ int main( int argc, char **argv )
|
|||||||
// note, we need the dyanmic_cast because MS Visual Studio can't handle covarient
|
// note, we need the dyanmic_cast because MS Visual Studio can't handle covarient
|
||||||
// return types, so that clone has return just Object*. bahh hum bug
|
// return types, so that clone has return just Object*. bahh hum bug
|
||||||
osg::ref_ptr<osg::Node> deep_copy = dynamic_cast<osg::Node*>(rootnode->clone(MyCopyOp(osg::CopyOp::DEEP_COPY_ALL)));
|
osg::ref_ptr<osg::Node> deep_copy = dynamic_cast<osg::Node*>(rootnode->clone(MyCopyOp(osg::CopyOp::DEEP_COPY_ALL)));
|
||||||
|
|
||||||
std::cout << "----------------------------------------------------------------"<<std::endl;
|
std::cout << "----------------------------------------------------------------"<<std::endl;
|
||||||
|
|
||||||
// do a graph preserving deep copy.
|
// do a graph preserving deep copy.
|
||||||
@@ -260,18 +260,18 @@ int main( int argc, char **argv )
|
|||||||
// DEEP_COPY_IMAGES = 64,
|
// DEEP_COPY_IMAGES = 64,
|
||||||
// DEEP_COPY_ALL = 0xffffffff
|
// DEEP_COPY_ALL = 0xffffffff
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
// These options you can use together such as :
|
// These options you can use together such as :
|
||||||
// osg::Node* mycopy = dynamic_cast<osg::Node*>(rootnode->clone(osg::CopyOp::DEEP_COPY_NODES | DEEP_COPY_DRAWABLES));
|
// osg::Node* mycopy = dynamic_cast<osg::Node*>(rootnode->clone(osg::CopyOp::DEEP_COPY_NODES | DEEP_COPY_DRAWABLES));
|
||||||
// Which shares state but creates copies of all nodes and drawables (which contain the geometry).
|
// Which shares state but creates copies of all nodes and drawables (which contain the geometry).
|
||||||
//
|
//
|
||||||
// You may also want to subclass from CopyOp to provide finer grained control of what gets shared (shallow copy) vs
|
// You may also want to subclass from CopyOp to provide finer grained control of what gets shared (shallow copy) vs
|
||||||
// cloned (deep copy).
|
// cloned (deep copy).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ------------- End of copy specific code -------------------------------------------------------
|
// ------------- End of copy specific code -------------------------------------------------------
|
||||||
|
|
||||||
// set the scene to render
|
// set the scene to render
|
||||||
viewer.setSceneData(rootnode);
|
viewer.setSceneData(rootnode);
|
||||||
|
|
||||||
|
|||||||
@@ -43,21 +43,21 @@
|
|||||||
void create_specular_highlights(osg::Node *node)
|
void create_specular_highlights(osg::Node *node)
|
||||||
{
|
{
|
||||||
osg::StateSet *ss = node->getOrCreateStateSet();
|
osg::StateSet *ss = node->getOrCreateStateSet();
|
||||||
|
|
||||||
// create and setup the texture object
|
// create and setup the texture object
|
||||||
osg::TextureCubeMap *tcm = new osg::TextureCubeMap;
|
osg::TextureCubeMap *tcm = new osg::TextureCubeMap;
|
||||||
tcm->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP);
|
tcm->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP);
|
||||||
tcm->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP);
|
tcm->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP);
|
||||||
tcm->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP);
|
tcm->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP);
|
||||||
tcm->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR);
|
tcm->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR);
|
||||||
tcm->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
|
tcm->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
|
||||||
|
|
||||||
// generate the six highlight map images (light direction = [1, 1, -1])
|
// generate the six highlight map images (light direction = [1, 1, -1])
|
||||||
osgUtil::HighlightMapGenerator *mapgen = new osgUtil::HighlightMapGenerator(
|
osgUtil::HighlightMapGenerator *mapgen = new osgUtil::HighlightMapGenerator(
|
||||||
osg::Vec3(1, 1, -1), // light direction
|
osg::Vec3(1, 1, -1), // light direction
|
||||||
osg::Vec4(1, 0.9f, 0.8f, 1), // light color
|
osg::Vec4(1, 0.9f, 0.8f, 1), // light color
|
||||||
8); // specular exponent
|
8); // specular exponent
|
||||||
|
|
||||||
mapgen->generateMap();
|
mapgen->generateMap();
|
||||||
|
|
||||||
// assign the six images to the texture object
|
// assign the six images to the texture object
|
||||||
@@ -77,7 +77,7 @@ void create_specular_highlights(osg::Node *node)
|
|||||||
ss->setTextureAttributeAndModes(0, tg, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
|
ss->setTextureAttributeAndModes(0, tg, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
|
||||||
|
|
||||||
// use TexEnvCombine to add the highlights to the original lighting
|
// use TexEnvCombine to add the highlights to the original lighting
|
||||||
osg::TexEnvCombine *te = new osg::TexEnvCombine;
|
osg::TexEnvCombine *te = new osg::TexEnvCombine;
|
||||||
te->setCombine_RGB(osg::TexEnvCombine::ADD);
|
te->setCombine_RGB(osg::TexEnvCombine::ADD);
|
||||||
te->setSource0_RGB(osg::TexEnvCombine::TEXTURE);
|
te->setSource0_RGB(osg::TexEnvCombine::TEXTURE);
|
||||||
te->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
|
te->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
|
||||||
@@ -93,12 +93,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// construct the viewer.
|
// construct the viewer.
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* rootnode = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> rootnode = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!rootnode) rootnode = osgDB::readNodeFile("cessna.osgt");
|
if (!rootnode) rootnode = osgDB::readRefNodeFile("cessna.osgt");
|
||||||
|
|
||||||
if (!rootnode)
|
if (!rootnode)
|
||||||
{
|
{
|
||||||
@@ -107,33 +107,17 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create specular highlights
|
// create specular highlights
|
||||||
create_specular_highlights(rootnode);
|
create_specular_highlights(rootnode.get());
|
||||||
|
|
||||||
// run optimization over the scene graph
|
// run optimization over the scene graph
|
||||||
osgUtil::Optimizer optimzer;
|
osgUtil::Optimizer optimzer;
|
||||||
optimzer.optimize(rootnode);
|
optimzer.optimize(rootnode);
|
||||||
|
|
||||||
// add a viewport to the viewer and attach the scene graph.
|
// add a viewport to the viewer and attach the scene graph.
|
||||||
viewer.setSceneData(rootnode);
|
viewer.setSceneData(rootnode);
|
||||||
|
|
||||||
// create the windows and run the threads.
|
// create the windows and run the threads.
|
||||||
viewer.realize();
|
viewer.realize();
|
||||||
|
|
||||||
// now check to see if texture cube map is supported.
|
|
||||||
for(unsigned int contextID = 0;
|
|
||||||
contextID<osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts();
|
|
||||||
++contextID)
|
|
||||||
{
|
|
||||||
osg::TextureCubeMap::Extensions* tcmExt = osg::TextureCubeMap::getExtensions(contextID,false);
|
|
||||||
if (tcmExt)
|
|
||||||
{
|
|
||||||
if (!tcmExt->isCubeMapSupported())
|
|
||||||
{
|
|
||||||
std::cout<<"Warning: texture_cube_map not supported by OpenGL drivers, unable to run application."<<std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return viewer.run();
|
return viewer.run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||||
*
|
*
|
||||||
* This application is open source and may be redistributed and/or modified
|
* This application is open source and may be redistributed and/or modified
|
||||||
* freely and without restriction, both in commercial and non commercial applications,
|
* freely and without restriction, both in commercial and non commercial applications,
|
||||||
* as long as this copyright notice is maintained.
|
* as long as this copyright notice is maintained.
|
||||||
*
|
*
|
||||||
* This application is distributed in the hope that it will be useful,
|
* This application is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
@@ -50,7 +50,7 @@ int main(int argc, char** argv)
|
|||||||
arguments.getApplicationUsage()->write(std::cout, helpType);
|
arguments.getApplicationUsage()->write(std::cout, helpType);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// report any errors if they have occurred when parsing the program arguments.
|
// report any errors if they have occurred when parsing the program arguments.
|
||||||
if (arguments.errors())
|
if (arguments.errors())
|
||||||
{
|
{
|
||||||
@@ -81,7 +81,7 @@ int main(int argc, char** argv)
|
|||||||
while (arguments.read("-p",pathfile))
|
while (arguments.read("-p",pathfile))
|
||||||
{
|
{
|
||||||
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
|
||||||
if (apm || !apm->valid())
|
if (apm || !apm->valid())
|
||||||
{
|
{
|
||||||
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
|
||||||
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
|
||||||
@@ -95,13 +95,13 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
// add the state manipulator
|
// add the state manipulator
|
||||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||||
|
|
||||||
// add the thread model handler
|
// add the thread model handler
|
||||||
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
viewer.addEventHandler(new osgViewer::ThreadingHandler);
|
||||||
|
|
||||||
// add the window size toggle handler
|
// add the window size toggle handler
|
||||||
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
||||||
|
|
||||||
// add the stats handler
|
// add the stats handler
|
||||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||||
|
|
||||||
@@ -129,8 +129,8 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
|
|
||||||
// load the data
|
// load the data
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile(file);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFile(file);
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ public:
|
|||||||
osg::StateSet *dstate= gm->getOrCreateStateSet( );
|
osg::StateSet *dstate= gm->getOrCreateStateSet( );
|
||||||
dstate->setMode( GL_LIGHTING, osg::StateAttribute::ON );
|
dstate->setMode( GL_LIGHTING, osg::StateAttribute::ON );
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile("Images/Brick-Std-Orange.TGA");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Images/Brick-Std-Orange.TGA");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* txt = new osg::Texture2D;
|
osg::Texture2D* txt = new osg::Texture2D;
|
||||||
@@ -354,7 +354,7 @@ osg::Group *makedelaunay(const int ndcs)
|
|||||||
|
|
||||||
osg::Vec3Array *points=new osg::Vec3Array;
|
osg::Vec3Array *points=new osg::Vec3Array;
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile("Images/blueFlowers.png");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Images/blueFlowers.png");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* texture = new osg::Texture2D;
|
osg::Texture2D* texture = new osg::Texture2D;
|
||||||
@@ -817,7 +817,7 @@ osg::Geometry *WallConstraint::makeWallGeometry() const
|
|||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry; // the wall
|
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry; // the wall
|
||||||
if (texture!="") {
|
if (texture!="") {
|
||||||
osg::Image* image = osgDB::readImageFile(texture.c_str());
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(texture.c_str());
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* txt = new osg::Texture2D;
|
osg::Texture2D* txt = new osg::Texture2D;
|
||||||
@@ -1005,7 +1005,7 @@ deprecated_osg::Geometry *ArealConstraint::makeWallGeometry( osg::Vec3Array *pt)
|
|||||||
tscx->retessellatePolygons(*(edges)); // find all edges
|
tscx->retessellatePolygons(*(edges)); // find all edges
|
||||||
|
|
||||||
if (walltexture!="") {
|
if (walltexture!="") {
|
||||||
osg::Image* image = osgDB::readImageFile(walltexture.c_str());
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(walltexture.c_str());
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* txt = new osg::Texture2D;
|
osg::Texture2D* txt = new osg::Texture2D;
|
||||||
@@ -1062,7 +1062,7 @@ deprecated_osg::Geometry * ArealConstraint::makeAreal( osg::Vec3Array *points)
|
|||||||
gm->setNormalArray(getCanopyNormals(points));
|
gm->setNormalArray(getCanopyNormals(points));
|
||||||
gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
|
gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
|
||||||
gm->setTexCoordArray(0,getCanopyTexcoords(points));
|
gm->setTexCoordArray(0,getCanopyTexcoords(points));
|
||||||
osg::Image* image = osgDB::readImageFile(texture);
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(texture);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* txt = new osg::Texture2D;
|
osg::Texture2D* txt = new osg::Texture2D;
|
||||||
@@ -1238,7 +1238,7 @@ deprecated_osg::Geometry * LinearConstraint::makeGeometry(const osg::Vec3Array *
|
|||||||
if (_midline->size()>0) {
|
if (_midline->size()>0) {
|
||||||
osg::ref_ptr<osg::Vec3Array> locpts=getPoints(points);
|
osg::ref_ptr<osg::Vec3Array> locpts=getPoints(points);
|
||||||
if (texture!="") {
|
if (texture!="") {
|
||||||
osg::Image* image = osgDB::readImageFile(texture.c_str());
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(texture.c_str());
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* txt = new osg::Texture2D;
|
osg::Texture2D* txt = new osg::Texture2D;
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ int main( int argc, char **argv )
|
|||||||
bool needToSetHomePosition = false;
|
bool needToSetHomePosition = false;
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> scene = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if one hasn't been loaded create an earth and sun test model.
|
// if one hasn't been loaded create an earth and sun test model.
|
||||||
if (!scene)
|
if (!scene)
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ bool DePee::createHUD()
|
|||||||
osg::BoundingBox bb;
|
osg::BoundingBox bb;
|
||||||
for(unsigned int i=0;i<geode->getNumDrawables();++i)
|
for(unsigned int i=0;i<geode->getNumDrawables();++i)
|
||||||
{
|
{
|
||||||
bb.expandBy(geode->getDrawable(i)->getBound());
|
bb.expandBy(geode->getDrawable(i)->getBoundingBox());
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Geometry* geom = new osg::Geometry;
|
osg::Geometry* geom = new osg::Geometry;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
The DePee class is main class for setting up and managing depth peeling.
|
The DePee class is main class for setting up and managing depth peeling.
|
||||||
A DePee object can be seen as a virtual node, that has one parent and one child. The rendering of every child and subchil of this child is managed by the the DePee node. Besides that, it handles a head up display.
|
A DePee object can be seen as a virtual node, that has one parent and one child. The rendering of every child and subchil of this child is managed by the DePee node. Besides that, it handles a head up display.
|
||||||
*/
|
*/
|
||||||
class DePee : public osg::Referenced
|
class DePee : public osg::Referenced
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "DePee.h"
|
#include "DePee.h"
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Handles keyboard events.
|
Handles keyboard events.
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
class KeyboardEventHandler : public osgGA::GUIEventHandler
|
class KeyboardEventHandler : public osgGA::GUIEventHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
KeyboardEventHandler(DePee* dePee)
|
KeyboardEventHandler(DePee* dePee)
|
||||||
{
|
{
|
||||||
_apc = 0;
|
_apc = 0;
|
||||||
@@ -41,12 +41,12 @@ public:
|
|||||||
_dePee->setSketchy(_sketchy);
|
_dePee->setSketchy(_sketchy);
|
||||||
_dePee->setColored(_colored);
|
_dePee->setColored(_colored);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
||||||
{
|
{
|
||||||
switch(ea.getEventType())
|
switch(ea.getEventType())
|
||||||
{
|
{
|
||||||
|
|
||||||
case(osgGA::GUIEventAdapter::KEYDOWN):
|
case(osgGA::GUIEventAdapter::KEYDOWN):
|
||||||
{
|
{
|
||||||
if (ea.getKey()==osgGA::GUIEventAdapter::KEY_Space)
|
if (ea.getKey()==osgGA::GUIEventAdapter::KEY_Space)
|
||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
_dePee->setSketchy(_sketchy);
|
_dePee->setSketchy(_sketchy);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (ea.getKey() == 'e')
|
else if (ea.getKey() == 'e')
|
||||||
{
|
{
|
||||||
_edgy = !_edgy;
|
_edgy = !_edgy;
|
||||||
@@ -106,13 +106,13 @@ public:
|
|||||||
_crayon = !_crayon;
|
_crayon = !_crayon;
|
||||||
_dePee->setCrayon(_crayon);
|
_dePee->setCrayon(_crayon);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -139,12 +139,12 @@ private:
|
|||||||
class MouseEventHandler : public osgGA::GUIEventHandler
|
class MouseEventHandler : public osgGA::GUIEventHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MouseEventHandler(DePee* dePee)
|
MouseEventHandler(DePee* dePee)
|
||||||
{
|
{
|
||||||
_dePee = dePee;
|
_dePee = dePee;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
|
||||||
{
|
{
|
||||||
switch(ea.getEventType())
|
switch(ea.getEventType())
|
||||||
@@ -152,17 +152,17 @@ public:
|
|||||||
//mouse
|
//mouse
|
||||||
case(osgGA::GUIEventAdapter::DRAG):
|
case(osgGA::GUIEventAdapter::DRAG):
|
||||||
{
|
{
|
||||||
rotate(ea.getXnormalized(), ea.getYnormalized());
|
rotate(ea.getXnormalized(), ea.getYnormalized());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(osgGA::GUIEventAdapter::MOVE):
|
case(osgGA::GUIEventAdapter::MOVE):
|
||||||
_prevX = ea.getXnormalized();
|
_prevX = ea.getXnormalized();
|
||||||
_prevY = ea.getYnormalized();
|
_prevY = ea.getYnormalized();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -175,25 +175,25 @@ private:
|
|||||||
void rotate(float x, float y)
|
void rotate(float x, float y)
|
||||||
{
|
{
|
||||||
osg::Matrix baseMatrix = _modelGroupTransform->getMatrix();
|
osg::Matrix baseMatrix = _modelGroupTransform->getMatrix();
|
||||||
|
|
||||||
baseMatrix.preMultTranslate(_rotCenter);
|
baseMatrix.preMultTranslate(_rotCenter);
|
||||||
baseMatrix.preMultRotate(osg::Quat((x - _prevX) * 3, osg::Vec3d(0.0, 0.0, 1.0)));
|
baseMatrix.preMultRotate(osg::Quat((x - _prevX) * 3, osg::Vec3d(0.0, 0.0, 1.0)));
|
||||||
baseMatrix.preMultRotate(osg::Quat(-(y - _prevY) * 3, (baseMatrix * osg::Vec3d(1.0, 0.0, 0.0))));
|
baseMatrix.preMultRotate(osg::Quat(-(y - _prevY) * 3, (baseMatrix * osg::Vec3d(1.0, 0.0, 0.0))));
|
||||||
baseMatrix.preMultTranslate(-_rotCenter);
|
baseMatrix.preMultTranslate(-_rotCenter);
|
||||||
|
|
||||||
_modelGroupTransform->setMatrix(baseMatrix);
|
_modelGroupTransform->setMatrix(baseMatrix);
|
||||||
|
|
||||||
_prevX = x;
|
_prevX = x;
|
||||||
_prevY = y;
|
_prevY = y;
|
||||||
};
|
};
|
||||||
|
|
||||||
DePee* _dePee;
|
DePee* _dePee;
|
||||||
|
|
||||||
float _prevX;
|
float _prevX;
|
||||||
float _prevY;
|
float _prevY;
|
||||||
|
|
||||||
osg::Vec3 _rotCenter;
|
osg::Vec3 _rotCenter;
|
||||||
osg::MatrixTransform* _modelGroupTransform;
|
osg::MatrixTransform* _modelGroupTransform;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -202,25 +202,25 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
// set up the usage document, in case we need to print out how to use this program.
|
// set up the usage document, in case we need to print out how to use this program.
|
||||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates Depth Peeling");
|
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates Depth Peeling");
|
||||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" filename");
|
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" filename");
|
||||||
|
|
||||||
|
|
||||||
// construct the viewer
|
// construct the viewer
|
||||||
osgViewer::Viewer viewer(arguments);
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
// any option left unread are converted into errors to write out later.
|
// any option left unread are converted into errors to write out later.
|
||||||
arguments.reportRemainingOptionsAsUnrecognized();
|
arguments.reportRemainingOptionsAsUnrecognized();
|
||||||
|
|
||||||
// report any errors if they have occurred when parsing the program arguments.
|
// report any errors if they have occurred when parsing the program arguments.
|
||||||
if (arguments.errors())
|
if (arguments.errors())
|
||||||
{
|
{
|
||||||
arguments.writeErrorMessages(std::cout);
|
arguments.writeErrorMessages(std::cout);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arguments.argc()<=1 || arguments.argc() > 3)
|
if (arguments.argc()<=1 || arguments.argc() > 3)
|
||||||
{
|
{
|
||||||
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
||||||
@@ -232,29 +232,29 @@ int main( int argc, char **argv )
|
|||||||
viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
|
viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
|
||||||
|
|
||||||
// read the model to do depth peeling with
|
// read the model to do depth peeling with
|
||||||
osg::Node* loadedModel = osgDB::readNodeFile(arguments.argv()[1]);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFile(arguments.argv()[1]);
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
// create a transform to spin the model.
|
// create a transform to spin the model.
|
||||||
osg::MatrixTransform* modelGroupTransform = new osg::MatrixTransform;
|
osg::MatrixTransform* modelGroupTransform = new osg::MatrixTransform;
|
||||||
osg::Group* modelGroup = new osg::Group;
|
osg::Group* modelGroup = new osg::Group;
|
||||||
modelGroupTransform->addChild(modelGroup);
|
modelGroupTransform->addChild(modelGroup);
|
||||||
modelGroup->addChild(loadedModel);
|
modelGroup->addChild(loadedModel);
|
||||||
|
|
||||||
osg::Group* rootNode = new osg::Group();
|
osg::Group* rootNode = new osg::Group();
|
||||||
|
|
||||||
// add model to the viewer.
|
// add model to the viewer.
|
||||||
viewer.setSceneData(rootNode);
|
viewer.setSceneData(rootNode);
|
||||||
|
|
||||||
// Depth peel example only works on a single graphics context right now
|
// Depth peel example only works on a single graphics context right now
|
||||||
// so open up viewer on single screen to prevent problems
|
// so open up viewer on single screen to prevent problems
|
||||||
viewer.setUpViewOnSingleScreen(0);
|
viewer.setUpViewOnSingleScreen(0);
|
||||||
|
|
||||||
// create the windows and run the threads.
|
// create the windows and run the threads.
|
||||||
viewer.realize();
|
viewer.realize();
|
||||||
|
|
||||||
unsigned int width = 1280;
|
unsigned int width = 1280;
|
||||||
unsigned int height = 1280;
|
unsigned int height = 1280;
|
||||||
osgViewer::Viewer::Windows windows;
|
osgViewer::Viewer::Windows windows;
|
||||||
@@ -266,11 +266,11 @@ int main( int argc, char **argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
osg::ref_ptr<DePee> dePee = new DePee(rootNode,
|
osg::ref_ptr<DePee> dePee = new DePee(rootNode,
|
||||||
modelGroupTransform,
|
modelGroupTransform,
|
||||||
width,
|
width,
|
||||||
height);
|
height);
|
||||||
|
|
||||||
//create event handlers
|
//create event handlers
|
||||||
KeyboardEventHandler* keyboardEventHandler = new KeyboardEventHandler(dePee.get());
|
KeyboardEventHandler* keyboardEventHandler = new KeyboardEventHandler(dePee.get());
|
||||||
MouseEventHandler* mouseEventHandler = new MouseEventHandler(dePee.get());
|
MouseEventHandler* mouseEventHandler = new MouseEventHandler(dePee.get());
|
||||||
@@ -278,7 +278,7 @@ int main( int argc, char **argv )
|
|||||||
viewer.addEventHandler(mouseEventHandler);
|
viewer.addEventHandler(mouseEventHandler);
|
||||||
|
|
||||||
//viewer.setCameraManipulator(new osgGA::TrackballManipulator);
|
//viewer.setCameraManipulator(new osgGA::TrackballManipulator);
|
||||||
|
|
||||||
osg::StateSet* stateset = modelGroupTransform->getOrCreateStateSet();
|
osg::StateSet* stateset = modelGroupTransform->getOrCreateStateSet();
|
||||||
|
|
||||||
stateset->setMode(GL_BLEND, osg::StateAttribute::OFF);
|
stateset->setMode(GL_BLEND, osg::StateAttribute::OFF);
|
||||||
@@ -287,15 +287,15 @@ int main( int argc, char **argv )
|
|||||||
osg::AnimationPathCallback* apc = new osg::AnimationPathCallback(modelGroupTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
osg::AnimationPathCallback* apc = new osg::AnimationPathCallback(modelGroupTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
|
||||||
apc->setPause(true);
|
apc->setPause(true);
|
||||||
modelGroupTransform->setUpdateCallback(apc);
|
modelGroupTransform->setUpdateCallback(apc);
|
||||||
|
|
||||||
keyboardEventHandler->registerAnimationPathCallback(apc);
|
keyboardEventHandler->registerAnimationPathCallback(apc);
|
||||||
mouseEventHandler->registerModelGroupTransform(modelGroupTransform);
|
mouseEventHandler->registerModelGroupTransform(modelGroupTransform);
|
||||||
|
|
||||||
//setup stuff that is necessary for measuring fps
|
//setup stuff that is necessary for measuring fps
|
||||||
osg::Timer_t current_tick, previous_tick = 1;
|
osg::Timer_t current_tick, previous_tick = 1;
|
||||||
double* fps = new double;
|
double* fps = new double;
|
||||||
dePee->setFPS(fps);
|
dePee->setFPS(fps);
|
||||||
|
|
||||||
while(!viewer.done())
|
while(!viewer.done())
|
||||||
{
|
{
|
||||||
current_tick = osg::Timer::instance()->tick();
|
current_tick = osg::Timer::instance()->tick();
|
||||||
|
|||||||
@@ -52,18 +52,96 @@
|
|||||||
|
|
||||||
using namespace osg;
|
using namespace osg;
|
||||||
|
|
||||||
osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearColour)
|
struct CommandLineOptions
|
||||||
|
{
|
||||||
|
unsigned int width;
|
||||||
|
unsigned int height;
|
||||||
|
unsigned int tex_width;
|
||||||
|
unsigned int tex_height;
|
||||||
|
double sphere_radius;
|
||||||
|
double collar_radius;
|
||||||
|
double distance;
|
||||||
|
|
||||||
|
CommandLineOptions():
|
||||||
|
width(1024),
|
||||||
|
height(1024),
|
||||||
|
tex_width(1024),
|
||||||
|
tex_height(1024),
|
||||||
|
sphere_radius(1.0),
|
||||||
|
collar_radius(0.45),
|
||||||
|
distance(1.0)
|
||||||
|
{
|
||||||
|
|
||||||
|
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
||||||
|
if (!wsi)
|
||||||
|
{
|
||||||
|
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int width, height;
|
||||||
|
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
|
||||||
|
|
||||||
|
distance = sqrt(sphere_radius*sphere_radius - collar_radius*collar_radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
void read(osg::ArgumentParser& arguments)
|
||||||
|
{
|
||||||
|
while (arguments.read("--width",width)) {}
|
||||||
|
while (arguments.read("--height",height)) {}
|
||||||
|
while (arguments.read("--texture-width",tex_width) || arguments.read("--tx",tex_width) ) {}
|
||||||
|
while (arguments.read("--texture-height",tex_height) || arguments.read("--ty",tex_height) ) {}
|
||||||
|
|
||||||
|
while (arguments.read("--radius", sphere_radius)) {}
|
||||||
|
while (arguments.read("--collar", collar_radius)) {}
|
||||||
|
|
||||||
|
distance = sqrt(sphere_radius*sphere_radius - collar_radius*collar_radius);
|
||||||
|
while (arguments.read("--distance", distance)) {}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class WindowResizedHandler : public osgGA::GUIEventHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WindowResizedHandler()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv)
|
||||||
|
{
|
||||||
|
osg::Camera* camera = dynamic_cast<osg::Camera*>(object);
|
||||||
|
if (!camera) return false;
|
||||||
|
|
||||||
|
const osg::FrameStamp* fs = nv->getFrameStamp();
|
||||||
|
|
||||||
|
if (ea.getEventType()==osgGA::GUIEventAdapter::RESIZE)
|
||||||
|
{
|
||||||
|
OSG_NOTICE<<"Window resized event context="<<ea.getGraphicsContext()<<" frameNumber = "<<fs->getFrameNumber()<<std::endl;
|
||||||
|
OSG_NOTICE<<" WindowX="<<ea.getWindowX()<<std::endl;
|
||||||
|
OSG_NOTICE<<" WindowY="<<ea.getWindowY()<<std::endl;
|
||||||
|
OSG_NOTICE<<" WindowWidth="<<ea.getWindowWidth()<<std::endl;
|
||||||
|
OSG_NOTICE<<" WindowHeight="<<ea.getWindowHeight()<<std::endl;
|
||||||
|
|
||||||
|
// reset the Camera viewport and associated Texture's to make sure it tracks the new window size.
|
||||||
|
camera->resize(ea.getWindowWidth(), ea.getWindowHeight());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
osg::Node* createDistortionSubgraph(CommandLineOptions& options, osg::Node* subgraph, const osg::Vec4& clearColour)
|
||||||
{
|
{
|
||||||
osg::Group* distortionNode = new osg::Group;
|
osg::Group* distortionNode = new osg::Group;
|
||||||
|
|
||||||
unsigned int tex_width = 1024;
|
|
||||||
unsigned int tex_height = 1024;
|
|
||||||
|
|
||||||
osg::Texture2D* texture = new osg::Texture2D;
|
osg::Texture2D* texture = new osg::Texture2D;
|
||||||
texture->setTextureSize(tex_width, tex_height);
|
texture->setTextureSize(options.tex_width, options.tex_height);
|
||||||
texture->setInternalFormat(GL_RGBA);
|
texture->setInternalFormat(GL_RGBA);
|
||||||
texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
|
texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
|
||||||
texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
|
texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
|
||||||
|
texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP_TO_EDGE);
|
||||||
|
texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP_TO_EDGE);
|
||||||
|
|
||||||
// set up the render to texture camera.
|
// set up the render to texture camera.
|
||||||
{
|
{
|
||||||
@@ -79,7 +157,7 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
|
|||||||
camera->setViewMatrix(osg::Matrixd::identity());
|
camera->setViewMatrix(osg::Matrixd::identity());
|
||||||
|
|
||||||
// set viewport
|
// set viewport
|
||||||
camera->setViewport(0,0,tex_width,tex_height);
|
camera->setViewport(0,0,options.tex_width,options.tex_height);
|
||||||
|
|
||||||
// set the camera to render before the main camera.
|
// set the camera to render before the main camera.
|
||||||
camera->setRenderOrder(osg::Camera::PRE_RENDER);
|
camera->setRenderOrder(osg::Camera::PRE_RENDER);
|
||||||
@@ -94,6 +172,8 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
|
|||||||
camera->addChild(subgraph);
|
camera->addChild(subgraph);
|
||||||
|
|
||||||
distortionNode->addChild(camera);
|
distortionNode->addChild(camera);
|
||||||
|
|
||||||
|
camera->addEventCallback(new WindowResizedHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up the hud camera
|
// set up the hud camera
|
||||||
@@ -186,27 +266,13 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
|
|||||||
return distortionNode;
|
return distortionNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDomeFaces(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments)
|
void setDomeFaces(osgViewer::Viewer& viewer, CommandLineOptions& options)
|
||||||
{
|
{
|
||||||
|
|
||||||
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
|
||||||
if (!wsi)
|
|
||||||
{
|
|
||||||
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int width, height;
|
|
||||||
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
|
|
||||||
|
|
||||||
while (arguments.read("--width",width)) {}
|
|
||||||
while (arguments.read("--height",height)) {}
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
|
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
|
||||||
traits->x = 0;
|
traits->x = 0;
|
||||||
traits->y = 0;
|
traits->y = 0;
|
||||||
traits->width = width;
|
traits->width = options.width;
|
||||||
traits->height = height;
|
traits->height = options.height;
|
||||||
traits->windowDecoration = true;
|
traits->windowDecoration = true;
|
||||||
traits->doubleBuffer = true;
|
traits->doubleBuffer = true;
|
||||||
traits->sharedContext = 0;
|
traits->sharedContext = 0;
|
||||||
@@ -219,8 +285,8 @@ void setDomeFaces(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int center_x = width/2;
|
int center_x = options.width/2;
|
||||||
int center_y = height/2;
|
int center_y = options.height/2;
|
||||||
int camera_width = 256;
|
int camera_width = 256;
|
||||||
int camera_height = 256;
|
int camera_height = 256;
|
||||||
|
|
||||||
@@ -303,27 +369,18 @@ void setDomeFaces(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments)
|
|||||||
}
|
}
|
||||||
|
|
||||||
osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector,
|
osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector,
|
||||||
osg::ArgumentParser& arguments)
|
CommandLineOptions& options)
|
||||||
{
|
{
|
||||||
double sphere_radius = 1.0;
|
|
||||||
if (arguments.read("--radius", sphere_radius)) {}
|
|
||||||
|
|
||||||
double collar_radius = 0.45;
|
|
||||||
if (arguments.read("--collar", collar_radius)) {}
|
|
||||||
|
|
||||||
osg::Vec3d center(0.0,0.0,0.0);
|
osg::Vec3d center(0.0,0.0,0.0);
|
||||||
osg::Vec3d eye(0.0,0.0,0.0);
|
osg::Vec3d eye(0.0,0.0,0.0);
|
||||||
|
|
||||||
double distance = sqrt(sphere_radius*sphere_radius - collar_radius*collar_radius);
|
|
||||||
if (arguments.read("--distance", distance)) {}
|
|
||||||
|
|
||||||
bool centerProjection = false;
|
bool centerProjection = false;
|
||||||
|
|
||||||
osg::Vec3d projector = eye - osg::Vec3d(0.0,0.0, distance);
|
osg::Vec3d projector = eye - osg::Vec3d(0.0,0.0, options.distance);
|
||||||
|
|
||||||
|
|
||||||
osg::notify(osg::NOTICE)<<"Projector position = "<<projector<<std::endl;
|
osg::notify(osg::NOTICE)<<"Projector position = "<<projector<<std::endl;
|
||||||
osg::notify(osg::NOTICE)<<"distance = "<<distance<<std::endl;
|
osg::notify(osg::NOTICE)<<"distance = "<<options.distance<<std::endl;
|
||||||
|
|
||||||
|
|
||||||
// create the quad to visualize.
|
// create the quad to visualize.
|
||||||
@@ -396,15 +453,15 @@ osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3
|
|||||||
|
|
||||||
// osg::notify(osg::NOTICE)<<"theta = "<<theta<< "phi="<<phi<<std::endl;
|
// osg::notify(osg::NOTICE)<<"theta = "<<theta<< "phi="<<phi<<std::endl;
|
||||||
|
|
||||||
double f = distance * sin(phi);
|
double f = options.distance * sin(phi);
|
||||||
double e = distance * cos(phi) + sqrt( sphere_radius*sphere_radius - f*f);
|
double e = options.distance * cos(phi) + sqrt( options.sphere_radius*options.sphere_radius - f*f);
|
||||||
double l = e * cos(phi);
|
double l = e * cos(phi);
|
||||||
double h = e * sin(phi);
|
double h = e * sin(phi);
|
||||||
double z = l - distance;
|
double z = l - options.distance;
|
||||||
|
|
||||||
osg::Vec3 texcoord(h * cos(theta) / sphere_radius,
|
osg::Vec3 texcoord(h * cos(theta) / options.sphere_radius,
|
||||||
h * sin(theta) / sphere_radius,
|
h * sin(theta) / options.sphere_radius,
|
||||||
z / sphere_radius);
|
z / options.sphere_radius);
|
||||||
|
|
||||||
vertices->push_back(cursor);
|
vertices->push_back(cursor);
|
||||||
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));
|
||||||
@@ -437,33 +494,17 @@ osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3
|
|||||||
return geometry;
|
return geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments)
|
void setDomeCorrection(osgViewer::Viewer& viewer, CommandLineOptions& options)
|
||||||
{
|
{
|
||||||
|
|
||||||
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
|
|
||||||
if (!wsi)
|
|
||||||
{
|
|
||||||
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int width, height;
|
|
||||||
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
|
|
||||||
|
|
||||||
while (arguments.read("--width",width)) {}
|
|
||||||
while (arguments.read("--height",height)) {}
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
|
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
|
||||||
traits->x = 0;
|
traits->x = 0;
|
||||||
traits->y = 0;
|
traits->y = 0;
|
||||||
traits->width = width;
|
traits->width = options.width;
|
||||||
traits->height = height;
|
traits->height = options.height;
|
||||||
traits->windowDecoration = false;
|
traits->windowDecoration = false;
|
||||||
traits->doubleBuffer = true;
|
traits->doubleBuffer = true;
|
||||||
traits->sharedContext = 0;
|
traits->sharedContext = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
|
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
|
||||||
if (!gc)
|
if (!gc)
|
||||||
{
|
{
|
||||||
@@ -471,18 +512,18 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tex_width = 512;
|
int camera_width = options.tex_width;
|
||||||
int tex_height = 512;
|
int camera_height = options.tex_height;
|
||||||
|
|
||||||
int camera_width = tex_width;
|
|
||||||
int camera_height = tex_height;
|
|
||||||
|
|
||||||
osg::TextureCubeMap* texture = new osg::TextureCubeMap;
|
osg::TextureCubeMap* texture = new osg::TextureCubeMap;
|
||||||
|
|
||||||
texture->setTextureSize(tex_width, tex_height);
|
texture->setTextureSize(options.tex_width, options.tex_height);
|
||||||
texture->setInternalFormat(GL_RGB);
|
texture->setInternalFormat(GL_RGB);
|
||||||
texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
|
texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
|
||||||
texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
|
texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
|
||||||
|
texture->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP_TO_EDGE);
|
||||||
|
texture->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_EDGE);
|
||||||
|
texture->setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP_TO_EDGE);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
osg::Camera::RenderTargetImplementation renderTargetImplementation = osg::Camera::SEPERATE_WINDOW;
|
osg::Camera::RenderTargetImplementation renderTargetImplementation = osg::Camera::SEPERATE_WINDOW;
|
||||||
@@ -614,7 +655,7 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
|
|||||||
// distortion correction set up.
|
// distortion correction set up.
|
||||||
{
|
{
|
||||||
osg::Geode* geode = new osg::Geode();
|
osg::Geode* geode = new osg::Geode();
|
||||||
geode->addDrawable(createDomeDistortionMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), arguments));
|
geode->addDrawable(createDomeDistortionMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(options.width,0.0f,0.0f), osg::Vec3(0.0f,options.height,0.0f), options));
|
||||||
|
|
||||||
// new we need to add the texture to the mesh, we do so by creating a
|
// new we need to add the texture to the mesh, we do so by creating a
|
||||||
// StateSet to contain the Texture StateAttribute.
|
// StateSet to contain the Texture StateAttribute.
|
||||||
@@ -626,7 +667,7 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
|
|||||||
camera->setGraphicsContext(gc.get());
|
camera->setGraphicsContext(gc.get());
|
||||||
camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
|
camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
|
||||||
camera->setClearColor( osg::Vec4(0.1,0.1,1.0,1.0) );
|
camera->setClearColor( osg::Vec4(0.1,0.1,1.0,1.0) );
|
||||||
camera->setViewport(new osg::Viewport(0, 0, width, height));
|
camera->setViewport(new osg::Viewport(0, 0, options.width, options.height));
|
||||||
GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
|
GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
|
||||||
camera->setDrawBuffer(buffer);
|
camera->setDrawBuffer(buffer);
|
||||||
camera->setReadBuffer(buffer);
|
camera->setReadBuffer(buffer);
|
||||||
@@ -635,7 +676,7 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
|
|||||||
//camera->setInheritanceMask(camera->getInheritanceMask() & ~osg::CullSettings::CLEAR_COLOR & ~osg::CullSettings::COMPUTE_NEAR_FAR_MODE);
|
//camera->setInheritanceMask(camera->getInheritanceMask() & ~osg::CullSettings::CLEAR_COLOR & ~osg::CullSettings::COMPUTE_NEAR_FAR_MODE);
|
||||||
//camera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
|
//camera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
|
||||||
|
|
||||||
camera->setProjectionMatrixAsOrtho2D(0,width,0,height);
|
camera->setProjectionMatrixAsOrtho2D(0,options.width,0,options.height);
|
||||||
camera->setViewMatrix(osg::Matrix::identity());
|
camera->setViewMatrix(osg::Matrix::identity());
|
||||||
|
|
||||||
// add subgraph to render
|
// add subgraph to render
|
||||||
@@ -655,14 +696,17 @@ int main(int argc, char** argv)
|
|||||||
// use an ArgumentParser object to manage the program arguments.
|
// use an ArgumentParser object to manage the program arguments.
|
||||||
osg::ArgumentParser arguments(&argc,argv);
|
osg::ArgumentParser arguments(&argc,argv);
|
||||||
|
|
||||||
|
CommandLineOptions options;
|
||||||
|
options.read(arguments);
|
||||||
|
|
||||||
// construct the viewer.
|
// construct the viewer.
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer(arguments);
|
||||||
|
|
||||||
// load the nodes from the commandline arguments.
|
// load the nodes from the commandline arguments.
|
||||||
osg::Node* loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("cow.osgt");
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
@@ -674,20 +718,20 @@ int main(int argc, char** argv)
|
|||||||
if (arguments.read("--dome") || arguments.read("--puffer") )
|
if (arguments.read("--dome") || arguments.read("--puffer") )
|
||||||
{
|
{
|
||||||
|
|
||||||
setDomeCorrection(viewer, arguments);
|
setDomeCorrection(viewer, options);
|
||||||
|
|
||||||
viewer.setSceneData( loadedModel );
|
viewer.setSceneData( loadedModel );
|
||||||
}
|
}
|
||||||
else if (arguments.read("--faces"))
|
else if (arguments.read("--faces"))
|
||||||
{
|
{
|
||||||
|
|
||||||
setDomeFaces(viewer, arguments);
|
setDomeFaces(viewer, options);
|
||||||
|
|
||||||
viewer.setSceneData( loadedModel );
|
viewer.setSceneData( loadedModel );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
osg::Node* distortionNode = createDistortionSubgraph( loadedModel, viewer.getCamera()->getClearColor());
|
osg::Node* distortionNode = createDistortionSubgraph( options, loadedModel.get(), viewer.getCamera()->getClearColor());
|
||||||
viewer.setSceneData( distortionNode );
|
viewer.setSceneData( distortionNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -738,6 +782,9 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
||||||
|
|
||||||
|
// add window resize handler
|
||||||
|
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
|
||||||
|
|
||||||
// add the state manipulator
|
// add the state manipulator
|
||||||
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ createStateSet()
|
|||||||
ss->setAttribute( program.get(),
|
ss->setAttribute( program.get(),
|
||||||
osg::StateAttribute::ON | osg::StateAttribute::PROTECTED );
|
osg::StateAttribute::ON | osg::StateAttribute::PROTECTED );
|
||||||
|
|
||||||
osg::ref_ptr< osg::Image> iLogo = osgDB::readImageFile( "Images/osg128.png" );
|
osg::ref_ptr< osg::Image> iLogo = osgDB::readRefImageFile( "Images/osg128.png" );
|
||||||
if( !iLogo.valid() )
|
if( !iLogo.valid() )
|
||||||
{
|
{
|
||||||
osg::notify( osg::ALWAYS ) << "Can't open image file osg128.png" << std::endl;
|
osg::notify( osg::ALWAYS ) << "Can't open image file osg128.png" << std::endl;
|
||||||
|
|||||||
@@ -44,21 +44,21 @@ osg::Node* createEarth()
|
|||||||
osg::TessellationHints* hints = new osg::TessellationHints;
|
osg::TessellationHints* hints = new osg::TessellationHints;
|
||||||
hints->setDetailRatio(5.0f);
|
hints->setDetailRatio(5.0f);
|
||||||
|
|
||||||
|
|
||||||
osg::ShapeDrawable* sd = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0,0.0,0.0), osg::WGS_84_RADIUS_POLAR), hints);
|
osg::ShapeDrawable* sd = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0,0.0,0.0), osg::WGS_84_RADIUS_POLAR), hints);
|
||||||
|
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
geode->addDrawable(sd);
|
geode->addDrawable(sd);
|
||||||
|
|
||||||
std::string filename = osgDB::findDataFile("Images/land_shallow_topo_2048.jpg");
|
std::string filename = osgDB::findDataFile("Images/land_shallow_topo_2048.jpg");
|
||||||
geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, new osg::Texture2D(osgDB::readImageFile(filename)));
|
geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, new osg::Texture2D(osgDB::readRefImageFile(filename)));
|
||||||
|
|
||||||
osg::CoordinateSystemNode* csn = new osg::CoordinateSystemNode;
|
osg::CoordinateSystemNode* csn = new osg::CoordinateSystemNode;
|
||||||
csn->setEllipsoidModel(new osg::EllipsoidModel());
|
csn->setEllipsoidModel(new osg::EllipsoidModel());
|
||||||
csn->addChild(geode);
|
csn->addChild(geode);
|
||||||
|
|
||||||
return csn;
|
return csn;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
osgText::Text* createText(osg::EllipsoidModel* ellipsoid, double latitude, double longitude, double height, const std::string& str)
|
osgText::Text* createText(osg::EllipsoidModel* ellipsoid, double latitude, double longitude, double height, const std::string& str)
|
||||||
@@ -78,7 +78,7 @@ osgText::Text* createText(osg::EllipsoidModel* ellipsoid, double latitude, doubl
|
|||||||
text->setCharacterSize(300000.0f);
|
text->setCharacterSize(300000.0f);
|
||||||
text->setCharacterSizeMode(osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
|
text->setCharacterSizeMode(osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
|
||||||
text->setAutoRotateToScreen(true);
|
text->setAutoRotateToScreen(true);
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,10 +87,10 @@ osg::Node* createFadeText(osg::EllipsoidModel* ellipsoid)
|
|||||||
osg::Group* group = new osg::Group;
|
osg::Group* group = new osg::Group;
|
||||||
|
|
||||||
group->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
|
group->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
|
||||||
|
|
||||||
osg::Geode* geode = new osg::Geode;
|
osg::Geode* geode = new osg::Geode;
|
||||||
group->addChild(geode);
|
group->addChild(geode);
|
||||||
|
|
||||||
std::vector<std::string> textList;
|
std::vector<std::string> textList;
|
||||||
textList.push_back("Town");
|
textList.push_back("Town");
|
||||||
textList.push_back("City");
|
textList.push_back("City");
|
||||||
@@ -99,7 +99,7 @@ osg::Node* createFadeText(osg::EllipsoidModel* ellipsoid)
|
|||||||
textList.push_back("Mountain");
|
textList.push_back("Mountain");
|
||||||
textList.push_back("Road");
|
textList.push_back("Road");
|
||||||
textList.push_back("Lake");
|
textList.push_back("Lake");
|
||||||
|
|
||||||
unsigned int numLat = 15;
|
unsigned int numLat = 15;
|
||||||
unsigned int numLong = 20;
|
unsigned int numLong = 20;
|
||||||
double latitude = 0.0;
|
double latitude = 0.0;
|
||||||
@@ -118,7 +118,7 @@ osg::Node* createFadeText(osg::EllipsoidModel* ellipsoid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
@@ -128,10 +128,10 @@ int main(int, char**)
|
|||||||
|
|
||||||
viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::COMPUTE_NEAR_FAR_USING_PRIMITIVES);
|
viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::COMPUTE_NEAR_FAR_USING_PRIMITIVES);
|
||||||
viewer.getCamera()->setNearFarRatio(0.00001f);
|
viewer.getCamera()->setNearFarRatio(0.00001f);
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> root = createEarth();
|
osg::ref_ptr<osg::Node> root = createEarth();
|
||||||
|
|
||||||
if (!root) return 0;
|
if (!root) return 0;
|
||||||
|
|
||||||
// add a viewport to the viewer and attach the scene graph.
|
// add a viewport to the viewer and attach the scene graph.
|
||||||
@@ -142,7 +142,7 @@ int main(int, char**)
|
|||||||
{
|
{
|
||||||
// add fade text around the globe
|
// add fade text around the globe
|
||||||
csn->addChild(createFadeText(csn->getEllipsoidModel()));
|
csn->addChild(createFadeText(csn->getEllipsoidModel()));
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer.setCameraManipulator(new osgGA::TerrainManipulator);
|
viewer.setCameraManipulator(new osgGA::TerrainManipulator);
|
||||||
|
|
||||||
|
|||||||
@@ -19,17 +19,10 @@ void textInfo(osgText::Text* text)
|
|||||||
|
|
||||||
for(unsigned int i = 0; i < s.size(); i++)
|
for(unsigned int i = 0; i < s.size(); i++)
|
||||||
{
|
{
|
||||||
osg::Vec2 ul = gq.getCoords()[0 + (i * 4)]; // upperLeft
|
osg::Vec2 ul = (*gq.getCoords())[0 + (i * 4)]; // upperLeft
|
||||||
osg::Vec2 ll = gq.getCoords()[1 + (i * 4)]; // lowerLeft
|
osg::Vec2 ll = (*gq.getCoords())[1 + (i * 4)]; // lowerLeft
|
||||||
osg::Vec2 lr = gq.getCoords()[2 + (i * 4)]; // lowerRight
|
osg::Vec2 lr = (*gq.getCoords())[2 + (i * 4)]; // lowerRight
|
||||||
osg::Vec2 ur = gq.getCoords()[3 + (i * 4)]; // upperRight
|
osg::Vec2 ur = (*gq.getCoords())[3 + (i * 4)]; // upperRight
|
||||||
|
|
||||||
/*
|
|
||||||
osg::Vec3 ul = gq.getTransformedCoords(0)[0 + (i * 4)];
|
|
||||||
osg::Vec3 ll = gq.getTransformedCoords(0)[1 + (i * 4)];
|
|
||||||
osg::Vec3 lr = gq.getTransformedCoords(0)[2 + (i * 4)];
|
|
||||||
osg::Vec3 ur = gq.getTransformedCoords(0)[3 + (i * 4)];
|
|
||||||
*/
|
|
||||||
|
|
||||||
osg::notify(osg::NOTICE)
|
osg::notify(osg::NOTICE)
|
||||||
<< "'" << static_cast<char>(s[i]) << "':"
|
<< "'" << static_cast<char>(s[i]) << "':"
|
||||||
@@ -69,7 +62,7 @@ osgText::Text* createLabel(const std::string& l, const char* f, unsigned int siz
|
|||||||
static osg::Vec3 pos(10.0f, 10.0f, 0.0f);
|
static osg::Vec3 pos(10.0f, 10.0f, 0.0f);
|
||||||
|
|
||||||
osgText::Text* label = new osgText::Text();
|
osgText::Text* label = new osgText::Text();
|
||||||
osgText::Font* font = osgText::readFontFile(f);
|
osg::ref_ptr<osgText::Font> font = osgText::readRefFontFile(f);
|
||||||
|
|
||||||
label->setFont(font);
|
label->setFont(font);
|
||||||
label->setCharacterSize(size);
|
label->setCharacterSize(size);
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ osg::Geode* ForestTechniqueManager::createTerrain(const osg::Vec3& origin, const
|
|||||||
// ---------------------------------------
|
// ---------------------------------------
|
||||||
osg::StateSet* stateset = new osg::StateSet();
|
osg::StateSet* stateset = new osg::StateSet();
|
||||||
|
|
||||||
osg::Image* image = osgDB::readImageFile("Images/lz.rgb");
|
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Images/lz.rgb");
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
osg::Texture2D* texture = new osg::Texture2D;
|
osg::Texture2D* texture = new osg::Texture2D;
|
||||||
@@ -812,9 +812,9 @@ class ShaderGeometry : public osg::Drawable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual osg::BoundingBox computeBound() const
|
virtual osg::BoundingBox computeBoundingBox() const
|
||||||
{
|
{
|
||||||
osg::BoundingBox geom_box = _geometry->getBound();
|
osg::BoundingBox geom_box = _geometry->getBoundingBox();
|
||||||
osg::BoundingBox bb;
|
osg::BoundingBox bb;
|
||||||
for(PositionSizeList::const_iterator itr = _trees.begin();
|
for(PositionSizeList::const_iterator itr = _trees.begin();
|
||||||
itr != _trees.end();
|
itr != _trees.end();
|
||||||
@@ -1182,7 +1182,7 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates, u
|
|||||||
osg::Texture2D *tex = new osg::Texture2D;
|
osg::Texture2D *tex = new osg::Texture2D;
|
||||||
tex->setWrap( osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP );
|
tex->setWrap( osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP );
|
||||||
tex->setWrap( osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP );
|
tex->setWrap( osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP );
|
||||||
tex->setImage(osgDB::readImageFile("Images/tree0.rgba"));
|
tex->setImage(osgDB::readRefImageFile("Images/tree0.rgba"));
|
||||||
|
|
||||||
osg::StateSet *dstate = new osg::StateSet;
|
osg::StateSet *dstate = new osg::StateSet;
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#include <osg/Geometry>
|
#include <osg/Geometry>
|
||||||
#include <osg/GLExtensions>
|
#include <osg/GLExtensions>
|
||||||
#include <osg/Node>
|
#include <osg/Node>
|
||||||
#include <osg/NodeCallback>
|
|
||||||
#include <osg/Notify>
|
#include <osg/Notify>
|
||||||
#include <osg/observer_ptr>
|
#include <osg/observer_ptr>
|
||||||
#include <osg/Projection>
|
#include <osg/Projection>
|
||||||
@@ -133,10 +132,10 @@ void getPossibleConfigs(GraphicsContext* gc, BufferConfigList& colorConfigs,
|
|||||||
unsigned contextID = gc->getState()->getContextID();
|
unsigned contextID = gc->getState()->getContextID();
|
||||||
colorConfigs.push_back(BufferConfig("RGBA8", GL_RGBA8, 8));
|
colorConfigs.push_back(BufferConfig("RGBA8", GL_RGBA8, 8));
|
||||||
depthConfigs.push_back(BufferConfig("D24", GL_DEPTH_COMPONENT24, 24));
|
depthConfigs.push_back(BufferConfig("D24", GL_DEPTH_COMPONENT24, 24));
|
||||||
FBOExtensions* fboe = FBOExtensions::instance(contextID, true);
|
osg::GLExtensions* ext = gc->getState()->get<GLExtensions>();
|
||||||
if (!fboe->isSupported())
|
if (!ext->isRenderbufferMultisampleSupported())
|
||||||
return;
|
return;
|
||||||
if (fboe->isMultisampleSupported())
|
if (ext->isMultisampleSupported)
|
||||||
glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples);
|
glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples);
|
||||||
// isMultisampleCoverageSupported
|
// isMultisampleCoverageSupported
|
||||||
if (isGLExtensionSupported(contextID,
|
if (isGLExtensionSupported(contextID,
|
||||||
@@ -157,9 +156,8 @@ void getPossibleConfigs(GraphicsContext* gc, BufferConfigList& colorConfigs,
|
|||||||
bool checkFramebufferStatus(GraphicsContext* gc, bool silent = false)
|
bool checkFramebufferStatus(GraphicsContext* gc, bool silent = false)
|
||||||
{
|
{
|
||||||
State& state = *gc->getState();
|
State& state = *gc->getState();
|
||||||
unsigned contextID = state.getContextID();
|
osg::GLExtensions* ext = state.get<GLExtensions>();
|
||||||
FBOExtensions* fboe = FBOExtensions::instance(contextID, true);
|
switch(ext->glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT)) {
|
||||||
switch(fboe->glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT)) {
|
|
||||||
case GL_FRAMEBUFFER_COMPLETE_EXT:
|
case GL_FRAMEBUFFER_COMPLETE_EXT:
|
||||||
break;
|
break;
|
||||||
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
|
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
|
||||||
@@ -243,30 +241,30 @@ bool createFBO(GraphicsContext* gc, FboConfig &config, FboData &data)
|
|||||||
}
|
}
|
||||||
State& state = *gc->getState();
|
State& state = *gc->getState();
|
||||||
unsigned int contextID = state.getContextID();
|
unsigned int contextID = state.getContextID();
|
||||||
FBOExtensions* fboe = FBOExtensions::instance(contextID, true);
|
osg::GLExtensions* ext = gc->getState()->get<GLExtensions>();
|
||||||
|
|
||||||
data.fb->apply(state);
|
data.fb->apply(state);
|
||||||
result = checkFramebufferStatus(gc, true);
|
result = checkFramebufferStatus(gc, true);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
fboe->glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
|
ext->glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int query;
|
int query;
|
||||||
if (multisample)
|
if (multisample)
|
||||||
{
|
{
|
||||||
GLuint colorRBID = colorRB->getObjectID(contextID, fboe);
|
GLuint colorRBID = colorRB->getObjectID(contextID, ext);
|
||||||
fboe->glBindRenderbuffer(GL_RENDERBUFFER_EXT, colorRBID);
|
ext->glBindRenderbuffer(GL_RENDERBUFFER_EXT, colorRBID);
|
||||||
if (csaa)
|
if (csaa)
|
||||||
{
|
{
|
||||||
fboe->glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT,
|
ext->glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT,
|
||||||
GL_RENDERBUFFER_COVERAGE_SAMPLES_NV,
|
GL_RENDERBUFFER_COVERAGE_SAMPLES_NV,
|
||||||
&query);
|
&query);
|
||||||
if (query < config.coverageSamples)
|
if (query < config.coverageSamples)
|
||||||
result = false;
|
result = false;
|
||||||
else
|
else
|
||||||
config.coverageSamples = query;
|
config.coverageSamples = query;
|
||||||
fboe->glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT,
|
ext->glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT,
|
||||||
GL_RENDERBUFFER_COLOR_SAMPLES_NV,
|
GL_RENDERBUFFER_COLOR_SAMPLES_NV,
|
||||||
&query);
|
&query);
|
||||||
|
|
||||||
@@ -278,7 +276,7 @@ bool createFBO(GraphicsContext* gc, FboConfig &config, FboData &data)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fboe->glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT,
|
ext->glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT,
|
||||||
GL_RENDERBUFFER_SAMPLES_EXT,
|
GL_RENDERBUFFER_SAMPLES_EXT,
|
||||||
&query);
|
&query);
|
||||||
if (query < config.depthSamples)
|
if (query < config.depthSamples)
|
||||||
@@ -304,7 +302,7 @@ bool createFBO(GraphicsContext* gc, FboConfig &config, FboData &data)
|
|||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fboe->glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
|
ext->glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -697,15 +695,15 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments)
|
|||||||
DisplaySettings* ds = viewer.getDisplaySettings() ? viewer.getDisplaySettings() : DisplaySettings::instance().get();
|
DisplaySettings* ds = viewer.getDisplaySettings() ? viewer.getDisplaySettings() : DisplaySettings::instance().get();
|
||||||
GraphicsContext::ScreenIdentifier si;
|
GraphicsContext::ScreenIdentifier si;
|
||||||
si.readDISPLAY();
|
si.readDISPLAY();
|
||||||
|
si.setUndefinedScreenDetailsToDefaultScreen();
|
||||||
// displayNum has not been set so reset it to 0.
|
|
||||||
if (si.displayNum<0) si.displayNum = 0;
|
|
||||||
|
|
||||||
bool decoration = true;
|
bool decoration = true;
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
{
|
{
|
||||||
unsigned int w, h;
|
unsigned int w, h;
|
||||||
wsi->getScreenResolution(si, w, h);
|
wsi->getScreenResolution(si, w, h);
|
||||||
|
OSG_NOTICE<<"Screen resolution is "<<w<<", "<<h<<std::endl;
|
||||||
|
OSG_NOTICE<<"ScreenIdentifier "<<si.displayNum<<", "<<si.screenNum<<std::endl;
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
width = w;
|
width = w;
|
||||||
@@ -713,8 +711,9 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments)
|
|||||||
decoration = false;
|
decoration = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ref_ptr<GraphicsContext::Traits> traits
|
OSG_NOTICE<<"x = "<<x<<", y = "<<y<<", width = "<<width<<", height = "<<height<<std::endl;
|
||||||
= new GraphicsContext::Traits(ds);
|
|
||||||
|
ref_ptr<GraphicsContext::Traits> traits = new GraphicsContext::Traits(ds);
|
||||||
traits->hostName = si.hostName;
|
traits->hostName = si.hostName;
|
||||||
traits->displayNum = si.displayNum;
|
traits->displayNum = si.displayNum;
|
||||||
traits->screenNum = si.screenNum;
|
traits->screenNum = si.screenNum;
|
||||||
@@ -725,10 +724,9 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments)
|
|||||||
traits->windowDecoration = decoration;
|
traits->windowDecoration = decoration;
|
||||||
traits->doubleBuffer = true;
|
traits->doubleBuffer = true;
|
||||||
traits->sharedContext = 0;
|
traits->sharedContext = 0;
|
||||||
ref_ptr<GraphicsContext> gc
|
|
||||||
= GraphicsContext::createGraphicsContext(traits.get());
|
ref_ptr<GraphicsContext> gc = GraphicsContext::createGraphicsContext(traits.get());
|
||||||
osgViewer::GraphicsWindow* gw
|
osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(gc.get());
|
||||||
= dynamic_cast<osgViewer::GraphicsWindow*>(gc.get());
|
|
||||||
if (gw)
|
if (gw)
|
||||||
{
|
{
|
||||||
OSG_NOTIFY(INFO)<<"View::setUpViewOnSingleScreen - GraphicsWindow has been created successfully."<<std::endl;
|
OSG_NOTIFY(INFO)<<"View::setUpViewOnSingleScreen - GraphicsWindow has been created successfully."<<std::endl;
|
||||||
@@ -751,20 +749,29 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments)
|
|||||||
}
|
}
|
||||||
// Context has to be current to test for extensions
|
// Context has to be current to test for extensions
|
||||||
gc->realize();
|
gc->realize();
|
||||||
gc->makeCurrent();
|
if (!gc->makeCurrent())
|
||||||
|
{
|
||||||
|
OSG_NOTIFY(NOTICE) << "Unable to create GraphicsWindow"<<std::endl;
|
||||||
|
gc->releaseContext();
|
||||||
|
gc->close(true);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int contextID = gc->getState()->getContextID();
|
unsigned int contextID = gc->getState()->getContextID();
|
||||||
FBOExtensions* fboe = FBOExtensions::instance(contextID, true);
|
osg::GLExtensions* ext = gc->getState()->get<GLExtensions>();
|
||||||
if (!fboe->isSupported())
|
if (!ext->isFrameBufferObjectSupported)
|
||||||
{
|
{
|
||||||
OSG_NOTIFY(NOTICE) << "Frame buffer objects are not supported\n";
|
OSG_NOTIFY(NOTICE) << "Frame buffer objects are not supported\n";
|
||||||
gc->releaseContext();
|
gc->releaseContext();
|
||||||
gc->close(true);
|
gc->close(true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGLExtensionSupported(contextID, "GL_ARB_depth_buffer_float"))
|
if (isGLExtensionSupported(contextID, "GL_ARB_depth_buffer_float"))
|
||||||
depthTextureEnum = GL_DEPTH_COMPONENT32F;
|
depthTextureEnum = GL_DEPTH_COMPONENT32F;
|
||||||
else if (isGLExtensionSupported(contextID, "GL_NV_depth_buffer_float"))
|
else if (isGLExtensionSupported(contextID, "GL_NV_depth_buffer_float"))
|
||||||
depthTextureEnum = GL_DEPTH_COMPONENT32F_NV;
|
depthTextureEnum = GL_DEPTH_COMPONENT32F_NV;
|
||||||
|
|
||||||
BufferConfigList colorConfigs;
|
BufferConfigList colorConfigs;
|
||||||
BufferConfigList depthConfigs;
|
BufferConfigList depthConfigs;
|
||||||
vector<int> coverageConfigs;
|
vector<int> coverageConfigs;
|
||||||
@@ -956,7 +963,7 @@ int main(int argc, char **argv)
|
|||||||
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ref_ptr<Node> loadedModel = osgDB::readNodeFiles(arguments);
|
ref_ptr<Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
if (!loadedModel) {
|
if (!loadedModel) {
|
||||||
cerr << "couldn't load " << argv[1] << "\n";
|
cerr << "couldn't load " << argv[1] << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public:
|
|||||||
for (osgFX::Registry::EffectMap::const_iterator i=emap.begin(); i!=emap.end(); ++i) {
|
for (osgFX::Registry::EffectMap::const_iterator i=emap.begin(); i!=emap.end(); ++i) {
|
||||||
std::cout << "INFO: \t" << i->first << "\n";
|
std::cout << "INFO: \t" << i->first << "\n";
|
||||||
osg::ref_ptr<osgFX::Effect> effect = static_cast<osgFX::Effect *>(i->second->cloneType());
|
osg::ref_ptr<osgFX::Effect> effect = static_cast<osgFX::Effect *>(i->second->cloneType());
|
||||||
_effects.push_back(effect.get());
|
_effects.push_back(effect.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "INFO: " << emap.size() << " effect(s) ready.\n";
|
std::cout << "INFO: " << emap.size() << " effect(s) ready.\n";
|
||||||
@@ -144,9 +144,9 @@ public:
|
|||||||
inline void setScene(osg::Node* node) { _scene = node; }
|
inline void setScene(osg::Node* node) { _scene = node; }
|
||||||
|
|
||||||
inline bool getEffectsEnabled() const { return _fxen; }
|
inline bool getEffectsEnabled() const { return _fxen; }
|
||||||
inline void setEffectsEnabled(bool v)
|
inline void setEffectsEnabled(bool v)
|
||||||
{
|
{
|
||||||
_fxen = v;
|
_fxen = v;
|
||||||
if (getSelectedEffect()) {
|
if (getSelectedEffect()) {
|
||||||
getSelectedEffect()->setEnabled(_fxen);
|
getSelectedEffect()->setEnabled(_fxen);
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ public:
|
|||||||
inline void setEffectIndex(int i)
|
inline void setEffectIndex(int i)
|
||||||
{
|
{
|
||||||
if (i >= static_cast<int>(_effects.size())) i = 0;
|
if (i >= static_cast<int>(_effects.size())) i = 0;
|
||||||
if (i < 0) i = static_cast<int>(_effects.size()-1);
|
if (i < 0) i = static_cast<int>(_effects.size()-1);
|
||||||
_selected_fx = i;
|
_selected_fx = i;
|
||||||
rebuild();
|
rebuild();
|
||||||
}
|
}
|
||||||
@@ -174,11 +174,11 @@ protected:
|
|||||||
{
|
{
|
||||||
float zPos = -0.1; // note from Robert, was 0.1f, but now must be -0.1f to keep text visible??#!? due
|
float zPos = -0.1; // note from Robert, was 0.1f, but now must be -0.1f to keep text visible??#!? due
|
||||||
// to some other change in the OSG not tracked down yet...
|
// to some other change in the OSG not tracked down yet...
|
||||||
|
|
||||||
osg::ref_ptr<osgText::Font> arial = osgText::readFontFile("fonts/arial.ttf");
|
osg::ref_ptr<osgText::Font> arial = osgText::readRefFontFile("fonts/arial.ttf");
|
||||||
|
|
||||||
osg::ref_ptr<osgText::Text> hints = new osgText::Text;
|
osg::ref_ptr<osgText::Text> hints = new osgText::Text;
|
||||||
hints->setFont(arial.get());
|
hints->setFont(arial);
|
||||||
hints->setColor(_hints_color);
|
hints->setColor(_hints_color);
|
||||||
hints->setAlignment(osgText::Text::CENTER_BOTTOM);
|
hints->setAlignment(osgText::Text::CENTER_BOTTOM);
|
||||||
hints->setCharacterSize(13);
|
hints->setCharacterSize(13);
|
||||||
@@ -195,7 +195,7 @@ protected:
|
|||||||
if (!author_name.empty()) {
|
if (!author_name.empty()) {
|
||||||
effect_description = author_name = "AUTHOR: " + std::string(_effects[_selected_fx]->effectAuthor()) + std::string("\n\n");
|
effect_description = author_name = "AUTHOR: " + std::string(_effects[_selected_fx]->effectAuthor()) + std::string("\n\n");
|
||||||
}
|
}
|
||||||
effect_description += "DESCRIPTION:\n" + std::string(_effects[_selected_fx]->effectDescription());
|
effect_description += "DESCRIPTION:\n" + std::string(_effects[_selected_fx]->effectDescription());
|
||||||
|
|
||||||
if (_scene.valid() && _root.valid()) {
|
if (_scene.valid() && _root.valid()) {
|
||||||
_root->removeChildren(0, _root->getNumChildren());
|
_root->removeChildren(0, _root->getNumChildren());
|
||||||
@@ -268,7 +268,7 @@ EffectPanel* build_gui(osg::Group* root)
|
|||||||
|
|
||||||
osg::ref_ptr<EffectPanel> effect_panel = new EffectPanel;
|
osg::ref_ptr<EffectPanel> effect_panel = new EffectPanel;
|
||||||
effect_panel->setCaption("osgFX Effect Browser");
|
effect_panel->setCaption("osgFX Effect Browser");
|
||||||
effect_panel->setRect(osgfxbrowser::Rect(20, 20, 1000, 280));
|
effect_panel->setRect(osgfxbrowser::Rect(20, 20, 1000, 280));
|
||||||
|
|
||||||
hud->addChild(effect_panel.get());
|
hud->addChild(effect_panel.get());
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@ int main(int argc, char *argv[])
|
|||||||
unsigned int clearMask = viewer.getCamera()->getClearMask();
|
unsigned int clearMask = viewer.getCamera()->getClearMask();
|
||||||
viewer.getCamera()->setClearMask(clearMask | GL_STENCIL_BUFFER_BIT);
|
viewer.getCamera()->setClearMask(clearMask | GL_STENCIL_BUFFER_BIT);
|
||||||
viewer.getCamera()->setClearStencil(0);
|
viewer.getCamera()->setClearStencil(0);
|
||||||
|
|
||||||
// any option left unread are converted into errors to write out later.
|
// any option left unread are converted into errors to write out later.
|
||||||
arguments.reportRemainingOptionsAsUnrecognized();
|
arguments.reportRemainingOptionsAsUnrecognized();
|
||||||
|
|
||||||
@@ -336,11 +336,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read the scene from the list of file specified commandline args.
|
// read the scene from the list of file specified commandline args.
|
||||||
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
|
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
|
||||||
|
|
||||||
// if not loaded assume no arguments passed in, try use default mode instead.
|
// if not loaded assume no arguments passed in, try use default mode instead.
|
||||||
if (!loadedModel) loadedModel = osgDB::readNodeFile("dumptruck.osgt");
|
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("dumptruck.osgt");
|
||||||
|
|
||||||
if (!loadedModel)
|
if (!loadedModel)
|
||||||
{
|
{
|
||||||
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user